diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8de3807c90d..2600981e3c5 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -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, @@ -28,7 +28,7 @@ } }, "remoteEnv": { - "TARGET": "net8.0" + "TARGET": "net9.0" }, "postCreateCommand": [ "dotnet", "build", "FSharp.Compiler.Service.sln"] } diff --git a/.fantomasignore b/.fantomasignore index d142916bd16..a4802164d9b 100644 --- a/.fantomasignore +++ b/.fantomasignore @@ -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\\FSComp.fsi) +# For some reason, it tries to format files from remotes (Processing ./.git/refs/remotes//FSComp.fsi) .git/ # Explicitly unformatted implementation @@ -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 @@ -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 diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index d8110ac0ace..7a3d952c25d 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -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 diff --git a/.github/ISSUE_TEMPLATE/nullness_issue.yml b/.github/ISSUE_TEMPLATE/nullness_issue.yml new file mode 100644 index 00000000000..5d46cbdffae --- /dev/null +++ b/.github/ISSUE_TEMPLATE/nullness_issue.yml @@ -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 \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index f3fc39c1ec7..d675e8ab67a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -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/.md`, where `` 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/.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). diff --git a/.gitignore b/.gitignore index e6d289dd19b..f0dbae4d2f3 100644 --- a/.gitignore +++ b/.gitignore @@ -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 \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 1c0af1d324e..b93e358bbc1 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -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}" ], @@ -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", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index c80b85f366a..770609cd3ef 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -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", @@ -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}" diff --git a/DEVGUIDE.md b/DEVGUIDE.md index 3b22faf2fd9..b4d744a24cf 100644 --- a/DEVGUIDE.md +++ b/DEVGUIDE.md @@ -136,7 +136,7 @@ To use your custom build of `Fsc`, add the `DotnetFscCompilerPath` property to y ```xml - D:\Git\fsharp\artifacts\bin\fsc\Debug\net8.0\fsc.dll + D:\Git\fsharp\artifacts\bin\fsc\Debug\net9.0\fsc.dll ``` @@ -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: @@ -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) diff --git a/Directory.Build.props b/Directory.Build.props index 463feb6cbb3..719838f0a0d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -6,14 +6,15 @@ $(FSharpLangVersion) $(MSBuildThisFileDirectory) true - net8.0 + net9.0 + $(DotNetBuildFromSource) + All settings below can be overridden via CLI switches if needed. --> true @@ -45,7 +46,10 @@ false - true + + + false + true $(MSBuildThisFileDirectory)artifacts/ $(ArtifactsDir)/bin/$(MSBuildProjectName)/$(Configuration)/ @@ -56,6 +60,7 @@ $(ArtifactsDir)/bin/fsyacc/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/$(RuntimeIdentifier)/fsyacc.dll NO_CHECKNULLS;BUILDING_WITH_LKG;NO_NULLCHECKING_LIB_SUPPORT;$(DefineConstants) + diff --git a/Directory.Build.targets b/Directory.Build.targets index 8a1a1fa4a3f..df0677f7673 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -37,4 +37,18 @@ + + + + + + + + + diff --git a/FSharp.Benchmarks.sln b/FSharp.Benchmarks.sln index 83f1a6c3bf7..f77afff1c10 100644 --- a/FSharp.Benchmarks.sln +++ b/FSharp.Benchmarks.sln @@ -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 diff --git a/FSharp.Profiles.props b/FSharp.Profiles.props index 66e46a32b08..1d9eafa8c2b 100644 --- a/FSharp.Profiles.props +++ b/FSharp.Profiles.props @@ -1,6 +1,40 @@ + + + + false + + + + + false + + + + false + NO_CHECKNULLS;BUILDING_WITH_LKG;NO_NULLCHECKING_LIB_SUPPORT;$(DefineConstants) + false + + + + $(OtherFlags) /langversion:preview + + + + false + + + + enable + + + + + $(NoWarn);3271 + NO_CHECKNULLS;$(DefineConstants) + diff --git a/FSharpBuild.Directory.Build.props b/FSharpBuild.Directory.Build.props index f991ba6b072..b2b9ae303cb 100644 --- a/FSharpBuild.Directory.Build.props +++ b/FSharpBuild.Directory.Build.props @@ -70,8 +70,7 @@ - false - true + false diff --git a/FSharpBuild.Directory.Build.targets b/FSharpBuild.Directory.Build.targets index d49de27dccc..05201df3466 100644 --- a/FSharpBuild.Directory.Build.targets +++ b/FSharpBuild.Directory.Build.targets @@ -88,6 +88,14 @@ + + + $(ProtoOutputPath)\fsc\FSharp.Build.dll + + + + + - <_GitUrl>$([System.Text.RegularExpressions.Regex]::Replace($(ScmRepositoryUrl), ".git$", "")) + <_GitUrl>https://github.com/dotnet/fsharp $(_GitUrl)$(PackageReleaseNotes) diff --git a/NuGet.config b/NuGet.config index 72a88909ad8..e348c8b6abe 100644 --- a/NuGet.config +++ b/NuGet.config @@ -13,6 +13,8 @@ + + diff --git a/TESTGUIDE.md b/TESTGUIDE.md index cebd809a915..d9faeafde73 100644 --- a/TESTGUIDE.md +++ b/TESTGUIDE.md @@ -1,6 +1,6 @@ # F# Compiler, Core Library and Visual F# Tools Tests -Where this guide mentions the command `build` it means either `build.cmd` in the root folder for Windows, or `build.sh` for Linux/MacOS. +Where this guide mentions the command `build` it means either `build.cmd` in the root folder for Windows, or `build.sh` for Linux/macOS. ## In this guide @@ -49,9 +49,9 @@ Some test groups can only be run in `CI` configuration, for that, you need to pa To run tests, from a command prompt, use variations such as the following, depending on which test suite and build configuration you want. -### Tests that can be run on Linux and MacOS +### Tests that can be run on Linux and macOS -If you're using Linux or MacOS to develop, the group of tests that are known to succeed are all in `-testCoreClr`. Any other `-testXXX` argument will currently fail. An effort is underway to make testing and running tests easier on all systems. +If you're using Linux or macOS to develop, the group of tests that are known to succeed are all in `-testCoreClr`. Any other `-testXXX` argument will currently fail. An effort is underway to make testing and running tests easier on all systems. ### Tests that can only be run in Release mode @@ -114,7 +114,7 @@ The F# tests are split as follows: ### FSharp Suite -This is compiled using [tests\fsharp\FSharp.Tests.FSharpSuite.fsproj](tests/fsharp/FSharp.Tests.FSharpSuite.fsproj) to a unit test DLL which acts as a driver script. Each individual test is an NUnit test case, and so you can run it like any other NUnit test. +This is compiled using [tests\fsharp\FSharp.Tests.FSharpSuite.fsproj](tests/fsharp/FSharp.Tests.FSharpSuite.fsproj) to a unit test DLL which acts as a driver script. Each individual test is an xUnit test case, and so you can run it like any other xUnit test. ```shell .\build.cmd net40 test-net40-fsharp @@ -123,7 +123,7 @@ This is compiled using [tests\fsharp\FSharp.Tests.FSharpSuite.fsproj](tests/fsha Tests are grouped in folders per area. Each test compiles and executes a `test.fsx|fs` file in its folder using some combination of compiler or FSI flags specified in the FSharpSuite test project. If the compilation and execution encounter no errors, the test is considered to have passed. -There are also negative tests checking code expected to fail compilation. See note about baseline under "Other Tips" bellow for tests checking expectations against "baseline" (.bsl) files. +There are also negative tests checking code expected to fail compilation. See note about baseline under "Other Tips" below for tests checking expectations against "baseline" (.bsl) files. ### FSharpQA Suite @@ -151,9 +151,9 @@ Tags are in the left column, paths to to corresponding test folders are in the r If you want to re-run a particular test area, the easiest way to do so is to set a temporary tag for that area in test.lst (e.g. "RERUN") and adjust `ttags` [run.fsharpqa.test.fsx script](tests/fsharpqa/run.fsharpqa.test.fsx) and run it. -### VisualFSharp.UnitTests, FSharpSuite.Tests +### VisualFSharp.UnitTests -These are all currently NUnit tests (we hope to migrate them to xUnit). You can execute these tests individually via the Visual Studio NUnit3 runner +These are currently NUnit tests (we hope to migrate them to xUnit). You can execute these tests individually via the Visual Studio NUnit3 runner extension or the command line via `nunit3-console.exe`. Note that for compatibility reasons, the IDE unit tests should be run in a 32-bit process, @@ -174,7 +174,7 @@ All test execution logs and result files will be dropped into the `tests\TestRes ### Working with baseline tests FSharp Test Suite works with a couple of `.bsl` (or `.bslpp`) files describing "expected test results" and are called the _Baseline Tests_. Those are matched against the actual output that resides under `.err` or `.vserr` files of the same name during test execution. -When doing so keep in mind to carefully review the diff before comitting updated baseline files. +When doing so keep in mind to carefully review the diff before committing updated baseline files. The `.bslpp` (for: baseline pre-process) files are specially designed to enable substitution of certain tokens to generate the `.bsl` file. You can look further about the pre-processing logic under [tests/fsharp/TypeProviderTests.fs](tests/fsharp/TypeProviderTests.fs), this is used only for type provider tests for now. diff --git a/Test.cmd b/Test.cmd index 4a6eabc39e2..7ce9bcdd381 100644 --- a/Test.cmd +++ b/Test.cmd @@ -1,2 +1,2 @@ -@echo off +@echo off powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\build.ps1""" -test %*" diff --git a/UseLocalCompiler.Directory.Build.props b/UseLocalCompiler.Directory.Build.props new file mode 100644 index 00000000000..1b03ac191a8 --- /dev/null +++ b/UseLocalCompiler.Directory.Build.props @@ -0,0 +1,36 @@ + + + False + + Release + + $(MSBuildThisFileDirectory) + + true + true + $([System.IO.Path]::GetDirectoryName($(DOTNET_HOST_PATH))) + $([System.IO.Path]::GetFileName($(DOTNET_HOST_PATH))) + + $(LocalFSharpCompilerPath)/artifacts/bin/fsc/$(LocalFSharpCompilerConfiguration)/net9.0/fsc.dll + $(LocalFSharpCompilerPath)/artifacts/bin/fsc/$(LocalFSharpCompilerConfiguration)/net9.0/fsc.dll + + False + True + + + + $(LocalFSharpCompilerPath)/artifacts/bin/fsc/$(LocalFSharpCompilerConfiguration)/net9.0 + $(LocalFSharpBuildBinPath)/FSharp.Build.dll + $(LocalFSharpBuildBinPath)/Microsoft.FSharp.Targets + $(LocalFSharpBuildBinPath)/Microsoft.FSharp.NetSdk.props + $(LocalFSharpBuildBinPath)/Microsoft.FSharp.NetSdk.targets + $(LocalFSharpBuildBinPath)/Microsoft.FSharp.Overrides.NetSdk.targets + + + + + + + + + diff --git a/azure-pipelines-PR.yml b/azure-pipelines-PR.yml index 9723c7356df..bf0339c0cc5 100644 --- a/azure-pipelines-PR.yml +++ b/azure-pipelines-PR.yml @@ -169,7 +169,6 @@ stages: # because we want to catch cases when version is desynched and we didn't update it. # It is also helping the release notes automation to be up to date with packages versions. - job: Check_Published_Package_Versions - condition: or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), or(startsWith(variables['System.PullRequest.SourceBranch'], 'release/dev'), startsWith(variables['System.PullRequest.TargetBranch'], 'release/dev'))) pool: vmImage: $(UbuntuMachineQueueName) strategy: @@ -228,6 +227,9 @@ stages: - script: eng\CIBuild.cmd -compressallmetadata -configuration Release /p:FSharpLangVersion=preview env: + DOTNET_DbgEnableMiniDump: 1 + DOTNET_DbgMiniDumpType: 3 # Triage dump, 1 for mini, 2 for Heap, 3 for triage, 4 for full. Don't use 4 unless you know what you're doing. + DOTNET_DbgMiniDumpName: $(Build.SourcesDirectory)\artifacts\log\$(_configuration)\$(Build.BuildId)-%e-%p-%t.dmp NativeToolsOnMachine: true displayName: Build @@ -240,6 +242,15 @@ stages: ArtifactName: 'Windows Release build binlogs' ArtifactType: Container parallel: true + - task: PublishBuildArtifacts@1 + displayName: Publish Dumps + condition: failed() + continueOnError: true + inputs: + PathToPublish: '$(Build.SourcesDirectory)\artifacts\log\$(_configuration)' + ArtifactName: 'Windows $(_configuration) $(_testKind) process dumps' + ArtifactType: Container + parallel: true - job: WindowsNoRealsig_testCoreclr pool: @@ -256,6 +267,9 @@ stages: - script: eng\CIBuild.cmd -compressallmetadata -buildnorealsig -testCoreclr -configuration Release env: + DOTNET_DbgEnableMiniDump: 1 + DOTNET_DbgMiniDumpType: 3 # Triage dump, 1 for mini, 2 for Heap, 3 for triage, 4 for full. Don't use 4 unless you know what you're doing. + DOTNET_DbgMiniDumpName: $(Build.SourcesDirectory)\artifacts\log\$(_configuration)\$(Build.BuildId)-%e-%p-%t.dmp NativeToolsOnMachine: true displayName: Build @@ -268,6 +282,15 @@ stages: ArtifactName: 'Windows Release build binlogs' ArtifactType: Container parallel: true + - task: PublishBuildArtifacts@1 + displayName: Publish Dumps + condition: failed() + continueOnError: true + inputs: + PathToPublish: '$(Build.SourcesDirectory)\artifacts\log\$(_configuration)' + ArtifactName: 'Windows $(_configuration) $(_testKind) process dumps' + ArtifactType: Container + parallel: true - job: WindowsNoRealsig_testDesktop pool: @@ -284,6 +307,9 @@ stages: - script: eng\CIBuild.cmd -compressallmetadata -buildnorealsig -testDesktop -configuration Release env: + DOTNET_DbgEnableMiniDump: 1 + DOTNET_DbgMiniDumpType: 3 # Triage dump, 1 for mini, 2 for Heap, 3 for triage, 4 for full. Don't use 4 unless you know what you're doing. + DOTNET_DbgMiniDumpName: $(Build.SourcesDirectory)\artifacts\log\$(_configuration)\$(Build.BuildId)-%e-%p-%t.dmp NativeToolsOnMachine: true displayName: Build @@ -296,6 +322,15 @@ stages: ArtifactName: 'Windows Release build binlogs' ArtifactType: Container parallel: true + - task: PublishBuildArtifacts@1 + displayName: Publish Dumps + condition: failed() + continueOnError: true + inputs: + PathToPublish: '$(Build.SourcesDirectory)\artifacts\log\$(_configuration)' + ArtifactName: 'Windows $(_configuration) $(_testKind) process dumps' + ArtifactType: Container + parallel: true - job: WindowsStrictIndentation pool: @@ -312,6 +347,9 @@ stages: - script: eng\CIBuild.cmd -compressallmetadata -configuration Release /p:AdditionalFscCmdFlags=--strict-indentation+ env: + DOTNET_DbgEnableMiniDump: 1 + DOTNET_DbgMiniDumpType: 3 # Triage dump, 1 for mini, 2 for Heap, 3 for triage, 4 for full. Don't use 4 unless you know what you're doing. + DOTNET_DbgMiniDumpName: $(Build.SourcesDirectory)\artifacts\log\$(_configuration)\$(Build.BuildId)-%e-%p-%t.dmp NativeToolsOnMachine: true displayName: Build @@ -324,6 +362,15 @@ stages: ArtifactName: 'Windows Release build binlogs' ArtifactType: Container parallel: true + - task: PublishBuildArtifacts@1 + displayName: Publish Dumps + condition: failed() + continueOnError: true + inputs: + PathToPublish: '$(Build.SourcesDirectory)\artifacts\log\$(_configuration)' + ArtifactName: 'Windows $(_configuration) $(_testKind) process dumps' + ArtifactType: Container + parallel: true - job: WindowsNoStrictIndentation pool: @@ -336,6 +383,9 @@ stages: - script: eng\CIBuild.cmd -compressallmetadata -configuration Release /p:AdditionalFscCmdFlags=--strict-indentation- env: + DOTNET_DbgEnableMiniDump: 1 + DOTNET_DbgMiniDumpType: 3 # Triage dump, 1 for mini, 2 for Heap, 3 for triage, 4 for full. Don't use 4 unless you know what you're doing. + DOTNET_DbgMiniDumpName: $(Build.SourcesDirectory)\artifacts\log\$(_configuration)\$(Build.BuildId)-%e-%p-%t.dmp NativeToolsOnMachine: true displayName: Build @@ -348,6 +398,15 @@ stages: ArtifactName: 'Windows Release build binlogs' ArtifactType: Container parallel: true + - task: PublishBuildArtifacts@1 + displayName: Publish Dumps + condition: failed() + continueOnError: true + inputs: + PathToPublish: '$(Build.SourcesDirectory)\artifacts\log\$(_configuration)' + ArtifactName: 'Windows $(_configuration) $(_testKind) process dumps' + ArtifactType: Container + parallel: true # Windows With Compressed Metadata - job: WindowsCompressedMetadata @@ -398,12 +457,18 @@ stages: # yes, this is miserable, but - https://github.com/dotnet/arcade/issues/13239 - script: eng\CIBuild.cmd -compressallmetadata -configuration $(_configuration) -$(_testKind) env: + DOTNET_DbgEnableMiniDump: 1 + DOTNET_DbgMiniDumpType: 3 # Triage dump, 1 for mini, 2 for Heap, 3 for triage, 4 for full. Don't use 4 unless you know what you're doing. + DOTNET_DbgMiniDumpName: $(Build.SourcesDirectory)\artifacts\log\$(_configuration)\$(Build.BuildId)-%e-%p-%t.dmp NativeToolsOnMachine: true displayName: Build / Test condition: and( ne(variables['_testKind'], 'testIntegration'), ne(variables['System.JobName'], 'transparent_compiler_release') ) - script: eng\CIBuild.cmd -compressallmetadata -configuration $(_configuration) -$(_testKind) env: + DOTNET_DbgEnableMiniDump: 1 + DOTNET_DbgMiniDumpType: 3 # Triage dump, 1 for mini, 2 for Heap, 3 for triage, 4 for full. Don't use 4 unless you know what you're doing. + DOTNET_DbgMiniDumpName: $(Build.SourcesDirectory)\artifacts\log\$(_configuration)\$(Build.BuildId)-%e-%p-%t.dmp TEST_TRANSPARENT_COMPILER: 1 NativeToolsOnMachine: true displayName: Build / Test Transparent Compiler @@ -411,6 +476,9 @@ stages: - script: eng\CIBuild.cmd -compressallmetadata -configuration $(_configuration) -$(_testKind) env: + DOTNET_DbgEnableMiniDump: 1 + DOTNET_DbgMiniDumpType: 3 # Triage dump, 1 for mini, 2 for Heap, 3 for triage, 4 for full. Don't use 4 unless you know what you're doing. + DOTNET_DbgMiniDumpName: $(Build.SourcesDirectory)\artifacts\log\$(_configuration)\$(Build.BuildId)-%e-%p-%t.dmp NativeToolsOnMachine: true displayName: Build / Integration Test continueOnError: true @@ -433,6 +501,15 @@ stages: ArtifactName: 'Windows $(_configuration) $(_testKind) test binlogs' ArtifactType: Container parallel: true + - task: PublishBuildArtifacts@1 + displayName: Publish Dumps + condition: failed() + continueOnError: true + inputs: + PathToPublish: '$(Build.SourcesDirectory)\artifacts\log\$(_configuration)' + ArtifactName: 'Windows $(_configuration) $(_testKind) process dumps' + ArtifactType: Container + parallel: true - task: PublishBuildArtifacts@1 displayName: Publish Test Logs inputs: @@ -468,6 +545,7 @@ stages: - job: Linux pool: vmImage: $(UbuntuMachineQueueName) + timeoutInMinutes: 120 variables: - name: _SignType value: Test @@ -508,6 +586,7 @@ stages: - job: MacOS pool: vmImage: macos-12 + timeoutInMinutes: 120 variables: - name: _SignType value: Test diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e0c4349b26b..b4f235359af 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -29,7 +29,7 @@ variables: # Should be 'current' release branch name, i.e. 'release/dev17.10' in dotnet/fsharp/refs/heads/main, 'release/dev17.10' in dotnet/fsharp/refs/heads/release/dev17.10 and 'release/dev17.9' in dotnet/fsharp/refs/heads/release/dev17.9 # Should **never** be 'main' in dotnet/fsharp/refs/heads/main, since it will start inserting to VS twice. - name: FSharpReleaseBranchName - value: release/dev17.11 + value: release/dev17.12 # VS Insertion branch name (NOT the same as F# branch) # Should be previous release branch or 'main' in 'main' and 'main' in release branch # (since for all *new* release branches we insert into VS main and for all *previous* releases we insert into corresponding VS release), @@ -85,7 +85,7 @@ extends: # Signed build # #-------------------------------------------------------------------------------------------------------------------# # Localization: we only run it for specific release branches - - ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/release/dev17.11') }}: + - ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/release/dev17.12') }}: - template: /eng/common/templates-official/job/onelocbuild.yml@self parameters: MirrorRepo: fsharp diff --git a/buildtools/AssemblyCheck/SkipVerifyEmbeddedPdb.txt b/buildtools/AssemblyCheck/SkipVerifyEmbeddedPdb.txt index 2961d6963f2..7af2a7f58cb 100644 --- a/buildtools/AssemblyCheck/SkipVerifyEmbeddedPdb.txt +++ b/buildtools/AssemblyCheck/SkipVerifyEmbeddedPdb.txt @@ -6,4 +6,4 @@ FSharp.Test.Utilities.dll FSharp.Compiler.Private.Scripting.UnitTests.dll FSharp.Compiler.Service.Tests.dll FSharp.Core.UnitTests.dll -FSharpSuite.Tests.dll \ No newline at end of file +FSharpSuite.Tests.dll diff --git a/buildtools/README-fslexyacc.md b/buildtools/README-fslexyacc.md index 51630ddd143..685e3afd2d7 100644 --- a/buildtools/README-fslexyacc.md +++ b/buildtools/README-fslexyacc.md @@ -15,7 +15,7 @@ That means we have to build up FsLex and FsYacc from scratch, _including_ their We can't pick up the source from "packages" because in a build-from-source scenario we can't even fetch those packages - we really have to build from just our source tree and .NET SDK. -Please do _not_ modify the code in these directories except by copying over from an upgraded FsLexYacc pacakge. +Please do _not_ modify the code in these directories except by copying over from an upgraded FsLexYacc package. Without the testing and documentation in the `FsLexYacc` repo, this copied code is just a bunch of untested, undocumented and largely generated code checked into our source tree. @@ -31,14 +31,14 @@ For (1), to improve the code/table generators, make a PR to the `FsLexYacc` repo For (2), normally for FsLexYacc-based tools the runtime is either a source inclusion of `Lexing.fs`, Lexing.fsi, Parsing.fs, Parsing.fsi or a reference to the `FsLexYacc.Runtime` package. The runtime contains LexBuffer and the lexing/parsing table interpreters. -However long ago we decided to duplicate and ingest the _runtime_ files for FsLex and FsYacc into the F# compiler rather than taking them directly from the FsLexYacc project. This was mainly because we wanted to squeeze optimizations out of them based on profiling and simplify them a bit. The duplicated files are `prim-lexing.fs`, `prim-parsing.fs` and the corresponding `.fsi` files in `src/utils`. These files are sufficient to implement the contracts exepcted by the FsLex/FsYacc generated code, and require exactly the same table formats as generated by FsLex/FsYacc. +However long ago we decided to duplicate and ingest the _runtime_ files for FsLex and FsYacc into the F# compiler rather than taking them directly from the FsLexYacc project. This was mainly because we wanted to squeeze optimizations out of them based on profiling and simplify them a bit. The duplicated files are `prim-lexing.fs`, `prim-parsing.fs` and the corresponding `.fsi` files in `src/utils`. These files are sufficient to implement the contracts excepted by the FsLex/FsYacc generated code, and require exactly the same table formats as generated by FsLex/FsYacc. This means you can improve some aspects of the _runtime_ for FsLex and FsYacc by making direct changes to `prim-lexing.fs` and `prim-parsing.fs`. For example, the _actual_ `LexBuffer` type being used in the F# compiler (for all three lexers and grammars) is this one: https://github.com/dotnet/fsharp/blob/bdb64624f0ca220ca4433c83d02dd5822fe767a5/src/Compiler/Facilities/prim-lexing.fsi#L102 . (That version of the Lex/Yacc runtime has added some things: `BufferLocalStore` for example, which we use for the `XmlDoc` accumulator as we strip those out. It's also dropped any mention of async lexing, and any mention of `byte`. The use of generics for `LexBuffer<'Char>` is also superfluous because `'Char` is always `char` but is needed because the FsLex/FsYacc generated code expects this type to be generic.) -## What if I want to eridicate our use of FsLex and FsYacc? +## What if I want to eradicate our use of FsLex and FsYacc? The use of FsLex and FsYacc in this repo is somewhat controversial since the C# compiler implementation uses hand-written lexers and parsers. @@ -48,7 +48,7 @@ overly difficult given the declarative nature of `FsLex` tokenization. The use of a table-driven LALR(1) parser is more controversial: there is a general feeling that it would be great to somehow move on from FsYacc and do parsing some other way. However, it is not at all easy to do that and remain fully compatible. For this reason it is unlikely we will remove the use of FsYacc any time soon. However incremental -modifications to extract more information from the grammer may yield good results. +modifications to extract more information from the grammar may yield good results. ## Why aren't FsLex and FsYacc just ingested into this repo if we depend on them (and even have an exact copy of them for build-from-source)? @@ -57,7 +57,7 @@ considered carefully. While we are open to adding features to these tools specif independently. For these reasons it is generally best that these tools live in their own repository. The copy of the `fslex` and `fsyacc` source code in `buildtools` is an exact copy and is not tested or documented -apart from what's been done before in FsLexYacc repo. Adjusting these copies is not allowed and would be wrong from an engineering persepctive, +apart from what's been done before in FsLexYacc repo. Adjusting these copies is not allowed and would be wrong from an engineering perspective, because there's no place to put documentation or tests. Occasionally we discuss ingesting FsLex and FsYacc into this repository. This often comes up in the hope that by doing so diff --git a/buildtools/checkpackages/FSharp.Compiler.Service_notshipped.fsproj b/buildtools/checkpackages/FSharp.Compiler.Service_notshipped.fsproj index 961418a39eb..ab47e25013c 100644 --- a/buildtools/checkpackages/FSharp.Compiler.Service_notshipped.fsproj +++ b/buildtools/checkpackages/FSharp.Compiler.Service_notshipped.fsproj @@ -3,7 +3,7 @@ - net8.0 + net9.0 true $(MSBuildProjectDirectory)\..\..\artifacts\tmp\$([System.Guid]::NewGuid()) $(CachePath)\bin diff --git a/buildtools/checkpackages/check.ps1 b/buildtools/checkpackages/check.ps1 index d956de90789..0e7a80cc927 100644 --- a/buildtools/checkpackages/check.ps1 +++ b/buildtools/checkpackages/check.ps1 @@ -9,7 +9,7 @@ if ($LASTEXITCODE -eq 0) { $package = Get-Content -Path .\Version.txt Write-Error " - Package restore succeded for '${package}', expected to fail. + Package restore succeeded for '${package}', expected to fail. This usually means that the package has been already published. Please, bump the version to fix this failure." -ErrorAction Stop } else { diff --git a/buildtools/fslex/Lexing.fs b/buildtools/fslex/Lexing.fs index 40aacdcac96..afeae0f0dca 100644 --- a/buildtools/fslex/Lexing.fs +++ b/buildtools/fslex/Lexing.fs @@ -72,7 +72,7 @@ and [] let extendBufferAsync = (fun () -> match filler.fillAsync with Some refill -> refill this | None -> invalidOp "attempt to read asynchronously from a synchronous lex buffer") let mutable buffer=[||] - /// number of valid charactes beyond bufferScanStart + /// number of valid characters beyond bufferScanStart let mutable bufferMaxScanLength=0 /// count into the buffer when scanning diff --git a/buildtools/fslex/Lexing.fsi b/buildtools/fslex/Lexing.fsi index 866ba6a1e56..d88af6712aa 100644 --- a/buildtools/fslex/Lexing.fsi +++ b/buildtools/fslex/Lexing.fsi @@ -136,7 +136,7 @@ type AsciiTables = /// Interpret tables for an ascii lexer generated by fslex. member Interpret: initialState:int * LexBuffer -> int - [] + [] /// Interpret tables for an ascii lexer generated by fslex, processing input asynchronously member AsyncInterpret: initialState:int * LexBuffer -> Async @@ -150,7 +150,7 @@ type UnicodeTables = /// Interpret tables for a unicode lexer generated by fslex. member Interpret: initialState:int * LexBuffer -> int - [] + [] /// Interpret tables for a unicode lexer generated by fslex, processing input asynchronously member AsyncInterpret: initialState:int * LexBuffer -> Async diff --git a/buildtools/fslex/Parsing.fs b/buildtools/fslex/Parsing.fs index f66aa7a77f4..bfb4c1705af 100644 --- a/buildtools/fslex/Parsing.fs +++ b/buildtools/fslex/Parsing.fs @@ -431,7 +431,7 @@ module Implementation = // and an EOF token. if inEofCountDown && eofCountDown < 10 then #if __DEBUG - if Flags.debug then printfn "poppin stack, lokking to shift both 'error' and that token, during end-of-file error recovery" + if Flags.debug then printfn "poppin stack, looking to shift both 'error' and that token, during end-of-file error recovery" #endif popStackUntilErrorShifted(if haveLookahead then Some(lookaheadToken) else None) diff --git a/buildtools/fslex/Parsing.fsi b/buildtools/fslex/Parsing.fsi index e4e7329441a..68ab4dbfcdf 100644 --- a/buildtools/fslex/Parsing.fsi +++ b/buildtools/fslex/Parsing.fsi @@ -113,9 +113,9 @@ type Tables<'tok> = /// Returns an object indicating the final synthesized value for the parse. member Interpret : lexer:(LexBuffer<'char> -> 'tok) * lexbuf:LexBuffer<'char> * startState:int -> obj -/// Indicates an accept action has occured +/// Indicates an accept action has occurred exception Accept of obj -/// Indicates a parse error has occured and parse recovery is in progress +/// Indicates a parse error has occurred and parse recovery is in progress exception RecoverableParseError #if __DEBUG diff --git a/buildtools/fslex/fslexast.fs b/buildtools/fslex/fslexast.fs index b1815abcbf3..b621ac2dcdd 100644 --- a/buildtools/fslex/fslexast.fs +++ b/buildtools/fslex/fslexast.fs @@ -258,7 +258,7 @@ let LexerStateToNfa ctx (macros: Map) (clauses: Clause list) = // These cases unwind the difficult cases in the syntax that rely on knowing the // entire alphabet. // - // Note we've delayed the expension of these until we've worked out all the 'special' Unicode characters + // Note we've delayed the expansion of these until we've worked out all the 'special' Unicode characters // mentioned in the entire lexer spec, i.e. we wait until GetAlphabet returns a reliable and stable answer. | Inp (UnicodeCategory uc) -> let re = Alt(fun ctx -> diff --git a/buildtools/fsyacc/Lexing.fs b/buildtools/fsyacc/Lexing.fs index 40aacdcac96..afeae0f0dca 100644 --- a/buildtools/fsyacc/Lexing.fs +++ b/buildtools/fsyacc/Lexing.fs @@ -72,7 +72,7 @@ and [] let extendBufferAsync = (fun () -> match filler.fillAsync with Some refill -> refill this | None -> invalidOp "attempt to read asynchronously from a synchronous lex buffer") let mutable buffer=[||] - /// number of valid charactes beyond bufferScanStart + /// number of valid characters beyond bufferScanStart let mutable bufferMaxScanLength=0 /// count into the buffer when scanning diff --git a/buildtools/fsyacc/Lexing.fsi b/buildtools/fsyacc/Lexing.fsi index 866ba6a1e56..d88af6712aa 100644 --- a/buildtools/fsyacc/Lexing.fsi +++ b/buildtools/fsyacc/Lexing.fsi @@ -136,7 +136,7 @@ type AsciiTables = /// Interpret tables for an ascii lexer generated by fslex. member Interpret: initialState:int * LexBuffer -> int - [] + [] /// Interpret tables for an ascii lexer generated by fslex, processing input asynchronously member AsyncInterpret: initialState:int * LexBuffer -> Async @@ -150,7 +150,7 @@ type UnicodeTables = /// Interpret tables for a unicode lexer generated by fslex. member Interpret: initialState:int * LexBuffer -> int - [] + [] /// Interpret tables for a unicode lexer generated by fslex, processing input asynchronously member AsyncInterpret: initialState:int * LexBuffer -> Async diff --git a/buildtools/fsyacc/Parsing.fs b/buildtools/fsyacc/Parsing.fs index f66aa7a77f4..bfb4c1705af 100644 --- a/buildtools/fsyacc/Parsing.fs +++ b/buildtools/fsyacc/Parsing.fs @@ -431,7 +431,7 @@ module Implementation = // and an EOF token. if inEofCountDown && eofCountDown < 10 then #if __DEBUG - if Flags.debug then printfn "poppin stack, lokking to shift both 'error' and that token, during end-of-file error recovery" + if Flags.debug then printfn "poppin stack, looking to shift both 'error' and that token, during end-of-file error recovery" #endif popStackUntilErrorShifted(if haveLookahead then Some(lookaheadToken) else None) diff --git a/buildtools/fsyacc/Parsing.fsi b/buildtools/fsyacc/Parsing.fsi index e4e7329441a..68ab4dbfcdf 100644 --- a/buildtools/fsyacc/Parsing.fsi +++ b/buildtools/fsyacc/Parsing.fsi @@ -113,9 +113,9 @@ type Tables<'tok> = /// Returns an object indicating the final synthesized value for the parse. member Interpret : lexer:(LexBuffer<'char> -> 'tok) * lexbuf:LexBuffer<'char> * startState:int -> obj -/// Indicates an accept action has occured +/// Indicates an accept action has occurred exception Accept of obj -/// Indicates a parse error has occured and parse recovery is in progress +/// Indicates a parse error has occurred and parse recovery is in progress exception RecoverableParseError #if __DEBUG diff --git a/buildtools/fsyacc/fsyaccast.fs b/buildtools/fsyacc/fsyaccast.fs index 3f81e725556..23dcd7fcbd3 100644 --- a/buildtools/fsyacc/fsyaccast.fs +++ b/buildtools/fsyacc/fsyaccast.fs @@ -134,9 +134,9 @@ let ProcessParserSpecAst (spec: ParserSpec) = // Process LALR(1) grammars to tables type ProductionIndex = int -type ProdictionDotIndex = int +type ProductionDotIndex = int -/// Represent (ProductionIndex,ProdictionDotIndex) as one integer +/// Represent (ProductionIndex,ProductionDotIndex) as one integer type Item0 = uint32 let mkItem0 (prodIdx,dotIdx) : Item0 = (uint32 prodIdx <<< 16) ||| uint32 dotIdx @@ -287,7 +287,7 @@ type ProductionTable(ntTab:NonTerminalTable, termTab:TerminalTable, nonTerminals if n >= syms.Length then None else Some syms.[n] member prodTab.Productions = productions -/// A mutable table maping kernels to sets of lookahead tokens +/// A mutable table mapping kernels to sets of lookahead tokens type LookaheadTable() = let t = Dictionary>() member table.Add(x,y) = @@ -311,7 +311,7 @@ type KernelTable(kernels) = member t.Index(kernel) = toIdxMap.[kernel] member t.Kernel(i) = ofIdxMap.[i] -/// Hold the results of cpmuting the LALR(1) closure of an LR(0) kernel +/// Hold the results of computing the LALR(1) closure of an LR(0) kernel type Closure1Table() = let t = Dictionary>() member table.Add(a,b) = @@ -648,7 +648,7 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = // Compute the "spontaneous" and "propagate" maps for each LR(0) kernelItem // - // Input: The kernal K of a set of LR(0) items I and a grammar symbol X + // Input: The kernel K of a set of LR(0) items I and a grammar symbol X // // Output: The lookaheads generated spontaneously by items in I for kernel items // in goto(I,X) and the items I from which lookaheads are propagated to kernel @@ -661,7 +661,7 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = // // PLAN TO OPTIMIZE THIS; // - Clarify and comment what's going on here - // - verify if we really have to do these enormouos closure computations + // - verify if we really have to do these enormous closure computations // - assess if it's possible to use the symbol we're looking for to help trim the jset reportTime(); printf "computing lookahead relations..."; stdout.Flush(); @@ -741,7 +741,7 @@ let CompilerLalrParserSpec logf (spec : ProcessedParserSpec): CompiledSpec = // into the table, taking into account precedences etc. and reporting errors. let addResolvingPrecedence (arr: _[]) kernelIdx termIdx (precNew, actionNew) = // printf "DEBUG: state %d: adding action for %s, precNew = %a, actionNew = %a\n" kernelIdx (termTab.OfIndex termIdx) outputPrec precNew OutputAction actionNew; - // We add in order of precedence - however the precedences may be the same, and we give warnings when rpecedence resolution is based on implicit file orderings + // We add in order of precedence - however the precedences may be the same, and we give warnings when precedence resolution is based on implicit file orderings let _, actionSoFar as itemSoFar = arr.[termIdx] diff --git a/buildtools/fsyacc/fsyaccdriver.fs b/buildtools/fsyacc/fsyaccdriver.fs index 3e68d5c0d4d..f46e607f93a 100644 --- a/buildtools/fsyacc/fsyaccdriver.fs +++ b/buildtools/fsyacc/fsyaccdriver.fs @@ -199,6 +199,8 @@ let writeSpecToFile (generatorState: GeneratorState) (spec: ParserSpec) (compile writer.WriteLineInterface "module %s" s; writer.WriteLine "#nowarn \"64\";; // turn off warnings that type variables used in production annotations are instantiated to concrete type"; + writer.WriteLine "#nowarn \"1182\" // the generated code often has unused variable 'parseState'" + writer.WriteLine "#nowarn \"3261\" // the generated code would need to properly annotate nulls, e.g. changing System.Object to `obj|null`"; for s in generatorState.opens do writer.WriteLine "open %s" s; @@ -530,7 +532,7 @@ let writeSpecToFile (generatorState: GeneratorState) (spec: ParserSpec) (compile for id,startState in List.zip spec.StartSymbols compiledSpec.startStates do if not (types.ContainsKey id) then - failwith ("a %type declaration is required for for start token "+id); + failwith ("a %type declaration is required for start token "+id); let ty = types.[id] in writer.WriteLine "let %s lexer lexbuf : %s =" id ty; writer.WriteLine " engine lexer lexbuf %d :?> _" startState diff --git a/docs/builder-caches.md b/docs/builder-caches.md index 90d7e2e471d..13a72eb815e 100644 --- a/docs/builder-caches.md +++ b/docs/builder-caches.md @@ -9,5 +9,5 @@ index: 1300 Incremental builder keeps in a cache at most one `ParsedInput` for each file it parses. This behavior can be toggled with `useSyntaxTreeCache` parameter. -Memory impact of this feature can be in range of tens of MB for larger solutions. This can be inspected in memory profilng tools by searching for `ParsedInput` instances. +Memory impact of this feature can be in range of tens of MB for larger solutions. This can be inspected in memory profiling tools by searching for `ParsedInput` instances. When partial checking is enabled, implementation files backed by signature will not be parsed or cached, as expected. diff --git a/docs/changing-the-ast.md b/docs/changing-the-ast.md index 150275d8c06..1204767afb6 100644 --- a/docs/changing-the-ast.md +++ b/docs/changing-the-ast.md @@ -43,7 +43,7 @@ type SynRationalConst = // ... ``` -After modifying `SyntaxTree.fsi` and `SyntaxTree.fs`, the compiler will report erros in `pars.fsy`. If not, the `fsy` file wasn't processed by the compilation. In this case, a rebuild of `FSharp.Compiler.Service.fsproj` should help. +After modifying `SyntaxTree.fsi` and `SyntaxTree.fs`, the compiler will report errors in `pars.fsy`. If not, the `fsy` file wasn't processed by the compilation. In this case, a rebuild of `FSharp.Compiler.Service.fsproj` should help. `pars.fsy` is the parser specification of F#, a list of rules that describe how to parse F# code. Don't be scared by the size of the file or the unfamiliar content. It's easier than it looks. The F# compiler uses a parser generator called [fsyacc](https://github.com/fsprojects/FsLexYacc) to generate the parser from the specification in `pars.fsy`. @@ -82,6 +82,6 @@ SynRationalConst.Rational(fst $1, rhs parseState 1, rhs parseState 2, fst $3, rh ``` That's it. Adjusting the other constructor calls of `Rational` in `pars.fsy` should be enough to have a working parser again which returns the modified AST. -While fixing the remaining compiler errors outside of `pars.fsy`, it's a good idea to use named access to the fields of the `SynRationalConst.Rational` union case instead of positional access. This way, the compilation won't fail if aditional fields are added to the union case in the future. +While fixing the remaining compiler errors outside of `pars.fsy`, it's a good idea to use named access to the fields of the `SynRationalConst.Rational` union case instead of positional access. This way, the compilation won't fail if additional fields are added to the union case in the future. After a successful compilation, you can run the parser tests in `SyntaxTreeTests.fs` to verify that everything works as expected. -It's likely that you'll need to update the baseline files as decribed in `SyntaxTreeTests.fs`. +It's likely that you'll need to update the baseline files as described in `SyntaxTreeTests.fs`. diff --git a/docs/coding-standards.md b/docs/coding-standards.md index fb86474d883..45056e91dce 100644 --- a/docs/coding-standards.md +++ b/docs/coding-standards.md @@ -68,4 +68,4 @@ The compiler codebase uses various abbreviations. Here are some of the most comm | `Syn` | Abstract Syntax Tree | | `Tc` | Type-checker | | `IL` | Abstract IL = F# representation of .NET IL | -| `Ilx` | Extended Abstract IL = .NET IL plus a couple of contructs that get erased | +| `Ilx` | Extended Abstract IL = .NET IL plus a couple of constructs that get erased | diff --git a/docs/debug-emit.md b/docs/debug-emit.md index 6ce5d471307..2b0f37391dd 100644 --- a/docs/debug-emit.md +++ b/docs/debug-emit.md @@ -480,7 +480,7 @@ See [shadowed locals mini-spec](https://github.com/dotnet/fsharp/pull/12018). ### Discriminated union debug display text -For discriminated union types and all implied subtypes we emit a `DebuggerDisplayAttrubte` and a private `__DebugDisplay()` method that uses `sprintf "%+0.8A" obj` to format the object. +For discriminated union types and all implied subtypes we emit a `DebuggerDisplayAttribute` and a private `__DebugDisplay()` method that uses `sprintf "%+0.8A" obj` to format the object. ## Missing debug emit diff --git a/docs/diagnostics.md b/docs/diagnostics.md index 784d1491c0b..8d22433adc3 100644 --- a/docs/diagnostics.md +++ b/docs/diagnostics.md @@ -52,7 +52,7 @@ Diagnostics must often format types. * When displaying a type, you will normally want to "prettify" the type first. This converts any remaining type inference variables to new, better user-friendly type variables with names like `'a`. Various functions prettify types prior to display, for example, `NicePrint.layoutPrettifiedTypes` and others. -* When displaying multiple types in a comparative way, for example, two types that didn't match, you will want to display the minimal amount of infomation to convey the fact that the two types are different, for example, `NicePrint.minimalStringsOfTwoTypes`. +* When displaying multiple types in a comparative way, for example, two types that didn't match, you will want to display the minimal amount of information to convey the fact that the two types are different, for example, `NicePrint.minimalStringsOfTwoTypes`. * When displaying a type, you have the option of displaying the constraints implied by any type variables mentioned in the types, appended as `when ...`. For example, `NicePrint.layoutPrettifiedTypeAndConstraints`. diff --git a/docs/fcs-samples/FscExe/FscMain.fs b/docs/fcs-samples/FscExe/FscMain.fs index a1c41a44dba..6690d25f1e3 100644 --- a/docs/fcs-samples/FscExe/FscMain.fs +++ b/docs/fcs-samples/FscExe/FscMain.fs @@ -147,7 +147,7 @@ module FSharpResidentCompiler = cmdProcess.EnableRaisingEvents <- true; // Create the client proxy and attempt to connect to the server - let rec tryAcccesServer nRemaining = + let rec tryAccessServer nRemaining = if !progress then printfn "client: trying to access server, nRemaining = '%d'" nRemaining if nRemaining = 0 then // Failed to connect to server, give up @@ -163,9 +163,9 @@ module FSharpResidentCompiler = with _ (* System.Runtime.Remoting.RemotingException *) -> // Sleep a bit System.Threading.Thread.Sleep 50 - tryAcccesServer (nRemaining - 1) + tryAccessServer (nRemaining - 1) - tryAcccesServer 20 + tryAccessServer 20 match clientOpt with | Some client -> diff --git a/docs/fcs-samples/FsiExe/console.fs b/docs/fcs-samples/FsiExe/console.fs index efde3707c25..b52f682e156 100644 --- a/docs/fcs-samples/FsiExe/console.fs +++ b/docs/fcs-samples/FsiExe/console.fs @@ -61,7 +61,7 @@ module internal Utils = let guard(f) = f() - // Quick and dirty dirty method lookup for inlined IL + // Quick and dirty method lookup for inlined IL // In some situations, we can't use ldtoken to obtain a RuntimeMethodHandle, since the method // in question's token may contain typars from an external type environment. Such a token would // cause the PE file to be flagged as invalid. diff --git a/docs/fcs-samples/Tokenizer/Program.fs b/docs/fcs-samples/Tokenizer/Program.fs index 5a353736738..6e36b59bbb5 100644 --- a/docs/fcs-samples/Tokenizer/Program.fs +++ b/docs/fcs-samples/Tokenizer/Program.fs @@ -18,7 +18,7 @@ let tokenizeLines (lines:string[]) = let tokenizedLines = tokenizeLines - [| "// Sets the hello wrold variable" + [| "// Sets the hello world variable" "let hello = \"Hello world\" " |] for lineNo, lineToks in tokenizedLines do diff --git a/docs/fcs/typedtree.fsx b/docs/fcs/typedtree.fsx index e49a92385a0..476fbe832bf 100644 --- a/docs/fcs/typedtree.fsx +++ b/docs/fcs/typedtree.fsx @@ -279,7 +279,7 @@ and visitObjMember f memb = visitExpr f memb.Body (** -Let's use this expresssion walker: +Let's use this expression walker: *) fooExpression |> visitExpr (fun e -> printfn "Visiting %A" e) diff --git a/docs/names.md b/docs/names.md index cb2bb35d4ea..67a0f2fef57 100644 --- a/docs/names.md +++ b/docs/names.md @@ -59,7 +59,7 @@ The F# tooling distinguishes between the following concepts of "name" for values * Compiled names - Characterists: + Characteristics: - Mark the names that appear in the .NET IL Current aliases in code: diff --git a/docs/overview.md b/docs/overview.md index 1c796bbd87d..8136b63a6d8 100644 --- a/docs/overview.md +++ b/docs/overview.md @@ -33,7 +33,7 @@ The following are the key data formats and internal data representations of the * _Typed Abstract Syntax Tree (Typed Tree)_, see [TypedTree.fs](https://github.com/dotnet/fsharp/blob/main/src/Compiler/TypedTree/TypedTree.fs), [TypedTreeBasics.fs](https://github.com/dotnet/fsharp/blob/main/src/Compiler/TypedTree/TypedTreeBasics.fs), [TypedTreeOps.fs](https://github.com/dotnet/fsharp/blob/main/src/Compiler/TypedTree/TypedTreeOps.fs), and related files. The typed, bound syntax tree including both type/module definitions and their backing expressions, resulting from type checking and the subject of successive phases of optimization and representation change. -* _Type checking context/state_, see for example [`TcState` in ParseAndCheckInputs.fsi](https://github.com/dotnet/fsharp/blob/main/src/Compiler/Driver/ParseAndCheckInputs.fsi) and its constituent parts, particularly `TcEnv` in [CheckExpressions.fsi](https://github.com/dotnet/fsharp/blob/main/src/Compiler/Checking/CheckExpressions.fsi) and `NameResolutionEnv` in [NameResolution.fsi](https://github.com/dotnet/fsharp/blob/main/src/Compiler/Checking/NameResolution.fsi). A set of tables representing the available names, assemblies etc. in scope during type checking, plus associated information. +* _Type checking context/state_, see for example [`TcState` in ParseAndCheckInputs.fsi](https://github.com/dotnet/fsharp/blob/main/src/Compiler/Driver/ParseAndCheckInputs.fsi) and its constituent parts, particularly `TcEnv` in [CheckExpressions.fsi](https://github.com/dotnet/fsharp/blob/main/src/Compiler/Checking/Expressions/CheckExpressions.fsi) and `NameResolutionEnv` in [NameResolution.fsi](https://github.com/dotnet/fsharp/blob/main/src/Compiler/Checking/NameResolution.fsi). A set of tables representing the available names, assemblies etc. in scope during type checking, plus associated information. * _Abstract IL_, the output of code generation, then used for binary generation, and the input format when reading .NET assemblies, see [`ILModuleDef` in il.fsi](https://github.com/dotnet/fsharp/blob/main/src/Compiler/AbstractIL/il.fsi). @@ -146,7 +146,7 @@ The following are the key phases and high-level logical operations of the F# com * _Sequentially type checking files_, see [CheckDeclarations.fsi](https://github.com/dotnet/fsharp/blob/main/src/Compiler/Checking/CheckDeclarations.fsi)/[CheckDeclarations.fs](https://github.com/dotnet/fsharp/blob/main/src/Compiler/Checking/CheckDeclarations.fs). Accepts an AST plus a type checking context/state and produces new Typed Tree nodes incorporated into an updated type checking state, plus additional Typed Tree Expression nodes used during code generation. A key part of this is - checking syntactic types and expressions, see [CheckExpressions.fsi](https://github.com/dotnet/fsharp/blob/main/src/Compiler/Checking/CheckDeclarations.fsi)/[CheckExpressions.fs](https://github.com/dotnet/fsharp/blob/main/src/Compiler/Checking/CheckDeclarations.fs) including the state held across the checking of a file (see `TcFileState`) and the + checking syntactic types and expressions, see [CheckExpressions.fsi](https://github.com/dotnet/fsharp/blob/main/src/Compiler/Checking/CheckDeclarations.fsi)/[CheckExpressions.fs](https://github.com/dotnet/fsharp/blob/main/src/Compiler/Checking/Expressions/CheckDeclarations.fs) including the state held across the checking of a file (see `TcFileState`) and the environment active as we traverse declarations and expressions (see `TcEnv`). * _Pattern match compilation_, see [PatternMatchCompilation.fsi](https://github.com/dotnet/fsharp/blob/main/src/Compiler/Checking/PatternMatchCompilation.fsi)/[PatternMatchCompilation.fs](https://github.com/dotnet/fsharp/blob/main/src/Compiler/Checking/PatternMatchCompilation.fs). Accepts a subset of checked Typed Tree nodes representing F# pattern matching and produces Typed Tree expressions implementing the pattern matching. Called during type checking as each construct involving pattern matching is processed. diff --git a/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md b/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md index d218d87856e..ea5cbcf0b30 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md +++ b/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md @@ -5,7 +5,7 @@ * Don't blow the stack when traversing deeply nested sequential expressions. ([PR #16882](https://github.com/dotnet/fsharp/pull/16882)) * Fix wrong range start of INTERP_STRING_END. ([PR #16774](https://github.com/dotnet/fsharp/pull/16774), [PR #16785](https://github.com/dotnet/fsharp/pull/16785)) * Fix missing warning for recursive calls in list comprehensions. ([PR #16652](https://github.com/dotnet/fsharp/pull/16652)) -* Code generated files with > 64K methods and generated symbols crash when loaded. Use infered sequence points for debugging. ([Issue #16399](https://github.com/dotnet/fsharp/issues/16399), [#PR 16514](https://github.com/dotnet/fsharp/pull/16514)) +* Code generated files with > 64K methods and generated symbols crash when loaded. Use inferred sequence points for debugging. ([Issue #16399](https://github.com/dotnet/fsharp/issues/16399), [#PR 16514](https://github.com/dotnet/fsharp/pull/16514)) * `nameof Module` expressions and patterns are processed to link files in `--test:GraphBasedChecking`. ([PR #16550](https://github.com/dotnet/fsharp/pull/16550), [PR #16743](https://github.com/dotnet/fsharp/pull/16743)) * Graph Based Checking doesn't throw on invalid parsed input so it can be used for IDE scenarios ([PR #16575](https://github.com/dotnet/fsharp/pull/16575), [PR #16588](https://github.com/dotnet/fsharp/pull/16588), [PR #16643](https://github.com/dotnet/fsharp/pull/16643)) * Various parenthesization API fixes. ([PR #16578](https://github.com/dotnet/fsharp/pull/16578), [PR #16666](https://github.com/dotnet/fsharp/pull/16666), [PR #16901](https://github.com/dotnet/fsharp/pull/16901), [PR #16973](https://github.com/dotnet/fsharp/pull/16973), [PR #17012](https://github.com/dotnet/fsharp/pull/17012)) diff --git a/docs/release-notes/.FSharp.Compiler.Service/8.0.400.md b/docs/release-notes/.FSharp.Compiler.Service/8.0.400.md index 12a54d572fc..d4dad08b83a 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/8.0.400.md +++ b/docs/release-notes/.FSharp.Compiler.Service/8.0.400.md @@ -1,5 +1,6 @@ ### Fixed +* Enforce `AttributeTargets` on records. ([PR #17207](https://github.com/dotnet/fsharp/pull/17207)) * Fix a false positive of the `[]` analysis in combination with async. ([Issue #17237](https://github.com/dotnet/fsharp/issues/17237), [PR #17241](https://github.com/dotnet/fsharp/pull/17241)) * Extended #help directive in fsi to show documentation in the REPL. ([PR #17140](https://github.com/dotnet/fsharp/pull/17140)) * Fix internal error when dotting into delegates with multiple type parameters. ([PR #17227](https://github.com/dotnet/fsharp/pull/17227)) @@ -18,6 +19,7 @@ * Fix for exponential runtime in CE builders when using nested implicit yields [PR #17096](https://github.com/dotnet/fsharp/pull/17096) * Fix several AND operator parser bugs and regressions ([Issue #16447](https://github.com/dotnet/fsharp/issues/16447), [Issue #17134](https://github.com/dotnet/fsharp/issues/17134), [Issue #16309](https://github.com/dotnet/fsharp/issues/16309), [PR #17113](https://github.com/dotnet/fsharp/pull/17113)) * Treat exceptions as types in a namespace for graph based type checking ([Issue #17262](https://github.com/dotnet/fsharp/issues/17262), [PR #17268](https://github.com/dotnet/fsharp/pull/17268)) +* FS0243 - Unrecognized option: '--realsig-' #17561 ([Issue #17561](https://github.com/dotnet/fsharp/issues/17561), [PR #17268](https://github.com/dotnet/fsharp/pull/17562)) ### Added @@ -25,7 +27,9 @@ * Allow #nowarn to support the FS prefix on error codes to disable warnings ([Issue #17206](https://github.com/dotnet/fsharp/issues/16447), [PR #17209](https://github.com/dotnet/fsharp/pull/17209)) * Allow ParsedHashDirectives to have argument types other than strings ([Issue #17240](https://github.com/dotnet/fsharp/issues/16447), [PR #17209](https://github.com/dotnet/fsharp/pull/17209)) * Parser: better recovery for unfinished patterns ([PR #17231](https://github.com/dotnet/fsharp/pull/17231)) +* Expose inner exception information of TypeProviders to help diagnostics in IDE ([PR #17251](https://github.com/dotnet/fsharp/pull/17251)) * Parser: recover on empty match clause ([PR #17233](https://github.com/dotnet/fsharp/pull/17233)) +* Support empty-bodied computation expressions. ([Language suggestion #1232](https://github.com/fsharp/fslang-suggestions/issues/1232), [RFC FS-1144 (PR #774)](https://github.com/fsharp/fslang-design/pull/774), [PR #17352](https://github.com/dotnet/fsharp/pull/17352)) ### Changed * Enforce `AttributeTargets.Interface` ([PR #17173](https://github.com/dotnet/fsharp/pull/17173)) @@ -35,4 +39,5 @@ * Reduce allocations in compiler checking via `ValueOption` usage ([PR #16822](https://github.com/dotnet/fsharp/pull/16822)) * Use AsyncLocal instead of ThreadStatic to hold Cancellable.Token ([PR #17156](https://github.com/dotnet/fsharp/pull/17156)) * Showing and inserting correct name of entities from unopened namespace/module ([Issue #14375](https://github.com/dotnet/fsharp/issues/14375), [PR #17261](https://github.com/dotnet/fsharp/pull/17261)) +* Improve completion after method/property override ([PR #17292](https://github.com/dotnet/fsharp/pull/17292)) * Support lazy custom attributes calculation for `ILTypeDef` public API, improve `ExtensionAttribute` presence detecting perf. ([PR #16168](https://github.com/dotnet/fsharp/pull/16168)) diff --git a/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md new file mode 100644 index 00000000000..22eee3e2e5b --- /dev/null +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md @@ -0,0 +1,59 @@ +### Fixed + +* Fix a bug in the interaction between ``#line` and `#nowarn` directives ([PR #17649](https://github.com/dotnet/fsharp/pull/17649)) +* Fix wrong TailCall warning ([Issue #17604](https://github.com/dotnet/fsharp/issues/17604), [PR #17637](https://github.com/dotnet/fsharp/pull/17637)) +* Compiler hangs when compiling inline recursive invocation ([Issue #17376](https://github.com/dotnet/fsharp/issues/17376), [PR #17394](https://github.com/dotnet/fsharp/pull/17394)) +* Fix reporting IsFromComputationExpression only for CE builder type constructors and let bindings. ([PR #17375](https://github.com/dotnet/fsharp/pull/17375)) +* Optimize simple mappings in comprehensions when the body of the mapping has `let`-bindings and/or sequential expressions before a single yield. ([PR #17419](https://github.com/dotnet/fsharp/pull/17419)) +* C# protected property can be assigned in F# inherit constructor call. ([Issue #13299](https://github.com/dotnet/fsharp/issues/13299), [PR #17391](https://github.com/dotnet/fsharp/pull/17391)) +* MethodAccessException on equality comparison of a record with private fields. ([Issue #17447](https://github.com/dotnet/fsharp/issues/17447), [PR #17391](https://github.com/dotnet/fsharp/pull/17467)) +* Fix `function` implicit conversion. ([Issue #7401](https://github.com/dotnet/fsharp/issues/7401), [PR #17487](https://github.com/dotnet/fsharp/pull/17487)) +* Compiler fails to recognise namespace in FQN with enabled GraphBasedChecking. ([Issue #17508](https://github.com/dotnet/fsharp/issues/17508), [PR #17510](https://github.com/dotnet/fsharp/pull/17510)) +* Fix missing message for type error (FS0001). ([Issue #17373](https://github.com/dotnet/fsharp/issues/17373), [PR #17516](https://github.com/dotnet/fsharp/pull/17516)) +* Nullness export - make sure option<> and other UseNullAsTrueValue types are properly annotated as nullable for C# and reflection consumers [PR #17528](https://github.com/dotnet/fsharp/pull/17528) +* MethodAccessException on equality comparison of a type private to module. ([Issue #17541](https://github.com/dotnet/fsharp/issues/17541), [PR #17548](https://github.com/dotnet/fsharp/pull/17548)) +* Fixed checking failure when `global` namespace is involved with enabled GraphBasedChecking ([PR #17553](https://github.com/dotnet/fsharp/pull/17553)) +* Add missing byte chars notations, enforce limits in decimal notation in byte char & string (Issues [#15867](https://github.com/dotnet/fsharp/issues/15867), [#15868](https://github.com/dotnet/fsharp/issues/15868), [#15869](https://github.com/dotnet/fsharp/issues/15869), [PR #15898](https://github.com/dotnet/fsharp/pull/15898)) +* Parentheses analysis: keep extra parentheses around unit & tuples in method definitions. ([PR #17618](https://github.com/dotnet/fsharp/pull/17618)) +* Fix IsUnionCaseTester throwing for non-methods/properties [#17301](https://github.com/dotnet/fsharp/pull/17634) +* Fix xmlc doc tooltip display for nullable types [#17741](https://github.com/dotnet/fsharp/pull/17741) +* Consider `open type` used when the type is an enum and any of the enum cases is used unqualified. ([PR #17628](https://github.com/dotnet/fsharp/pull/17628)) +* Guard for possible StackOverflowException when typechecking non recursive modules and namespaces ([PR #17654](https://github.com/dotnet/fsharp/pull/17654)) +* Nullable - fix for processing System.Nullable types with nesting ([PR #17736](https://github.com/dotnet/fsharp/pull/17736)) +* Fixes for the optimization of simple mappings in array and list comprehensions. ([Issue #17708](https://github.com/dotnet/fsharp/issues/17708), [PR #17711](https://github.com/dotnet/fsharp/pull/17711)) + + +### Added + +* Support for nullable reference types ([PR #15181](https://github.com/dotnet/fsharp/pull/15181)) +* Treat .ToString() on F# types as returning non-nullable string in --checknulls+ context ([PR #17547](https://github.com/dotnet/fsharp/pull/17547)) +* Parser: recover on missing union case fields (PR [#17452](https://github.com/dotnet/fsharp/pull/17452)) +* Parser: recover on missing union case field types (PR [#17455](https://github.com/dotnet/fsharp/pull/17455)) +* Sink: report function domain type ([PR #17470](https://github.com/dotnet/fsharp/pull/17470)) +* Allow access modifies to auto properties getters and setters ([Language suggestion #430](https://github.com/fsharp/fslang-suggestions/issues/430), [PR 16687](https://github.com/dotnet/fsharp/pull/16687), [PR 16861](https://github.com/dotnet/fsharp/pull/16861), [PR 17522](https://github.com/dotnet/fsharp/pull/17522)) +* Render C# nullable-analysis attributes in tooltips ([PR #17485](https://github.com/dotnet/fsharp/pull/17485)) +* Allow object expression without overrides. ([Language suggestion #632](https://github.com/fsharp/fslang-suggestions/issues/632), [PR #17387](https://github.com/dotnet/fsharp/pull/17387)) +* Enable FSharp 9.0 Language Version ([Issue #17497](https://github.com/dotnet/fsharp/issues/17438)), [PR](https://github.com/dotnet/fsharp/pull/17500))) +* Enable LanguageFeature.EnforceAttributeTargets in F# 9.0. ([Issue #17514](https://github.com/dotnet/fsharp/issues/17558), [PR #17516](https://github.com/dotnet/fsharp/pull/17558)) +* Parser: better recovery for unfinished patterns ([PR #17231](https://github.com/dotnet/fsharp/pull/17231), [PR #17232](https://github.com/dotnet/fsharp/pull/17232))) +* Enable consuming generic arguments defined as `allows ref struct` in C# ([Issue #17597](https://github.com/dotnet/fsharp/issues/17597) +* Trivia for SynTypeConstraint.WhereTyparNotSupportsNull. ([Issue #17721](https://github.com/dotnet/fsharp/issues/17721), [PR #17745](https://github.com/dotnet/fsharp/pull/17745)) +* Trivia for SynType.WithNull. ([Issue #17720](https://github.com/dotnet/fsharp/issues/17720), [PR #17745](https://github.com/dotnet/fsharp/pull/17745)) + +### Changed + +* Change compiler default setting realsig+ when building assemblies ([Issue #17384](https://github.com/dotnet/fsharp/issues/17384), [PR #17378](https://github.com/dotnet/fsharp/pull/17385)) +* Change compiler default setting for compressedMetadata ([Issue #17379](https://github.com/dotnet/fsharp/issues/17379), [PR #17383](https://github.com/dotnet/fsharp/pull/17383)) +* Treat `{ new Foo() }` as `SynExpr.ObjExpr` ([PR #17388](https://github.com/dotnet/fsharp/pull/17388)) +* Optimize metadata reading for type members and custom attributes. ([PR #17364](https://github.com/dotnet/fsharp/pull/17364)) +* Enforce `AttributeTargets` on unions. ([PR #17389](https://github.com/dotnet/fsharp/pull/17389)) +* Applied nullable reference types to FSharp.Compiler.Service itself ([PR #15310](https://github.com/dotnet/fsharp/pull/15310)) +* Ensure that isinteractive multi-emit backing fields are not public. ([Issue #17439](https://github.com/dotnet/fsharp/issues/17438)), ([PR #17439](https://github.com/dotnet/fsharp/pull/17439)) +* Better error reporting for unions with duplicated fields. ([PR #17521](https://github.com/dotnet/fsharp/pull/17521)) +* Better CE error reporting when using `use!` with `and!` ([PR #17671](https://github.com/dotnet/fsharp/pull/17671)) +* Better error reporting for let bindings. ([PR #17601](https://github.com/dotnet/fsharp/pull/17601)) +* Optimize ILTypeDef interface impls reading from metadata. ([PR #17382](https://github.com/dotnet/fsharp/pull/17382)) +* Better error reporting for active patterns. ([PR #17666](https://github.com/dotnet/fsharp/pull/17666)) + + +### Breaking Changes diff --git a/docs/release-notes/.FSharp.Core/8.0.400.md b/docs/release-notes/.FSharp.Core/8.0.400.md index 3f9a780974b..cd6f26bd981 100644 --- a/docs/release-notes/.FSharp.Core/8.0.400.md +++ b/docs/release-notes/.FSharp.Core/8.0.400.md @@ -8,6 +8,7 @@ * Cache delegate in query extensions. ([PR #17130](https://github.com/dotnet/fsharp/pull/17130)) * Update `AllowNullLiteralAttribute` to also use `AttributeTargets.Interface` ([PR #17173](https://github.com/dotnet/fsharp/pull/17173)) +* Update `StructAttribute ` to also use `AttributeTargets.Class` ([PR #17207](https://github.com/dotnet/fsharp/pull/17207)) ### Breaking Changes diff --git a/docs/release-notes/.FSharp.Core/9.0.100.md b/docs/release-notes/.FSharp.Core/9.0.100.md new file mode 100644 index 00000000000..503a6c17d85 --- /dev/null +++ b/docs/release-notes/.FSharp.Core/9.0.100.md @@ -0,0 +1,15 @@ +### Fixed +* Struct UnionCase doesn't seem to be a valid target for the DefaultAugmentationAttribute ([Issue #17499](https://github.com/dotnet/fsharp/issues/17499), [PR #17502](https://github.com/dotnet/fsharp/pull/17502)) + +### Added + +* Enable C# collection expression support for F# lists & sets. ([Language suggestion #1355](https://github.com/fsharp/fslang-suggestions/issues/1355), [RFC FS-1145 (PR#776)](https://github.com/fsharp/fslang-design/pull/776), [PR #17359](https://github.com/dotnet/fsharp/pull/17359)) +* Add module functions for converting between `'T option` and `'T voption`. ([PR #17436](https://github.com/dotnet/fsharp/pull/17436)) + +### Changed +* Change compiler default setting realsig+ when building assemblies ([Issue #17384](https://github.com/dotnet/fsharp/issues/17384), [PR #17378](https://github.com/dotnet/fsharp/pull/17385)) +* Change compiler default setting for compressedMetadata ([Issue #17379](https://github.com/dotnet/fsharp/issues/17379), [PR #17383](https://github.com/dotnet/fsharp/pull/17383)) +* Enable FSharp 9.0 Language Version ([Issue #17497](https://github.com/dotnet/fsharp/issues/17438)), [PR](https://github.com/dotnet/fsharp/pull/17500))) +* Struct UnionCase doesn't seem to be a valid target for the DefaultAugmentationAttribute ([Issue #17499](https://github.com/dotnet/fsharp/issues/17499), [PR #17502](https://github.com/dotnet/fsharp/pull/17502)) +### Breaking Changes + diff --git a/docs/release-notes/.Language/9.0.md b/docs/release-notes/.Language/9.0.md new file mode 100644 index 00000000000..2785a646e56 --- /dev/null +++ b/docs/release-notes/.Language/9.0.md @@ -0,0 +1,28 @@ +### Added + +* Speed up `for x in xs -> …` in list & array comprehensions in certain scenarios. ([PR #16948](https://github.com/dotnet/fsharp/pull/16948)) +* Lower integral ranges to fast loops in more cases and optimize list and array construction from ranges. ([PR #16650](https://github.com/dotnet/fsharp/pull/16650), [PR #16832](https://github.com/dotnet/fsharp/pull/16832)) +* Support for nullable reference types ([PR #15181](https://github.com/dotnet/fsharp/pull/15181)) +* Bidirectional F#/C# interop for 'unmanaged' constraint. ([PR #12154](https://github.com/dotnet/fsharp/pull/12154)) +* Make `.Is*` discriminated union properties visible. ([Language suggestion #222](https://github.com/fsharp/fslang-suggestions/issues/222), [PR #16341](https://github.com/dotnet/fsharp/pull/16341)) +* Allow returning bool instead of unit option for partial active patterns. ([Language suggestion #1041](https://github.com/fsharp/fslang-suggestions/issues/1041), [PR #16473](https://github.com/dotnet/fsharp/pull/16473)) +* Allow access modifies to auto properties getters and setters ([Language suggestion #430](https://github.com/fsharp/fslang-suggestions/issues/430), [PR 16687](https://github.com/dotnet/fsharp/pull/16687), [PR 16861](https://github.com/dotnet/fsharp/pull/16861), [PR 17522](https://github.com/dotnet/fsharp/pull/17522)) +* Allow #nowarn to support the FS prefix on error codes to disable warnings ([Issue #17206](https://github.com/dotnet/fsharp/issues/16447), [PR #17209](https://github.com/dotnet/fsharp/pull/17209)) +* Allow ParsedHashDirectives to have argument types other than strings ([Issue #17240](https://github.com/dotnet/fsharp/issues/16447), [PR #17209](https://github.com/dotnet/fsharp/pull/17209)) +* Support empty-bodied computation expressions. ([Language suggestion #1232](https://github.com/fsharp/fslang-suggestions/issues/1232), [PR #17352](https://github.com/dotnet/fsharp/pull/17352)) +* Allow object expression without overrides. ([Language suggestion #632](https://github.com/fsharp/fslang-suggestions/issues/632), [PR #17387](https://github.com/dotnet/fsharp/pull/17387)) +* Enable FSharp 9.0 Language Version ([Issue #17497](https://github.com/dotnet/fsharp/issues/17438)), [PR](https://github.com/dotnet/fsharp/pull/17500))) + +### Fixed + +* Allow extension methods without type attribute work for types from imported assemblies. ([PR #16368](https://github.com/dotnet/fsharp/pull/16368)) +* 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)) +* Enforce AttributeTargets on implicit constructors. ([PR #16845](https://github.com/dotnet/fsharp/pull/16845/)) +* Enforce AttributeTargets on structs and classes ([PR #16790](https://github.com/dotnet/fsharp/pull/16790)) +* Ensure consistent interaction between ``#line` and `#nowarn` directives ([PR #17649](https://github.com/dotnet/fsharp/pull/17649)) + + +### Changed + +* Lower interpolated strings to string concatenation. ([PR #16556](https://github.com/dotnet/fsharp/pull/16556)) diff --git a/docs/release-notes/.Language/preview.md b/docs/release-notes/.Language/preview.md index 49f990c8c3d..b18d08e30c3 100644 --- a/docs/release-notes/.Language/preview.md +++ b/docs/release-notes/.Language/preview.md @@ -1,22 +1,7 @@ ### Added -* Speed up `for x in xs -> …` in list & array comprehensions in certain scenarios. ([PR #16948](https://github.com/dotnet/fsharp/pull/16948)) -* Lower integral ranges to fast loops in more cases and optimize list and array construction from ranges. ([PR #16650](https://github.com/dotnet/fsharp/pull/16650), [PR #16832](https://github.com/dotnet/fsharp/pull/16832)) * Better generic unmanaged structs handling. ([Language suggestion #692](https://github.com/fsharp/fslang-suggestions/issues/692), [PR #12154](https://github.com/dotnet/fsharp/pull/12154)) -* Bidirectional F#/C# interop for 'unmanaged' constraint. ([PR #12154](https://github.com/dotnet/fsharp/pull/12154)) -* Make `.Is*` discriminated union properties visible. ([Language suggestion #222](https://github.com/fsharp/fslang-suggestions/issues/222), [PR #16341](https://github.com/dotnet/fsharp/pull/16341)) -* Allow returning bool instead of unit option for partial active patterns. ([Language suggestion #1041](https://github.com/fsharp/fslang-suggestions/issues/1041), [PR #16473](https://github.com/dotnet/fsharp/pull/16473)) -* Allow #nowarn to support the FS prefix on error codes to disable warnings ([Issue #17206](https://github.com/dotnet/fsharp/issues/16447), [PR #17209](https://github.com/dotnet/fsharp/pull/17209)) -* Allow ParsedHashDirectives to have argument types other than strings ([Issue #17240](https://github.com/dotnet/fsharp/issues/16447), [PR #17209](https://github.com/dotnet/fsharp/pull/17209)) ### Fixed -* Allow extension methods without type attribute work for types from imported assemblies. ([PR #16368](https://github.com/dotnet/fsharp/pull/16368)) -* 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)) -* Enforce AttributeTargets on implicit constructors. ([PR #16845](https://github.com/dotnet/fsharp/pull/16845/)) -* Enforce AttributeTargets on structs and classes ([PR #16790](https://github.com/dotnet/fsharp/pull/16790)) - ### Changed - -* Lower interpolated strings to string concatenation. ([PR #16556](https://github.com/dotnet/fsharp/pull/16556)) diff --git a/docs/release-notes/.VisualStudio/17.12.md b/docs/release-notes/.VisualStudio/17.12.md new file mode 100644 index 00000000000..c53417cbf6e --- /dev/null +++ b/docs/release-notes/.VisualStudio/17.12.md @@ -0,0 +1,12 @@ +### Fixed + +* In the prefix-to-infix code fix, don't throw an exception if the error range for FS0003 extends through the end of the source text. ([PR #17448](https://github.com/dotnet/fsharp/pull/17448)) + +### Added + +### Changed +* Fix unwanted navigation on hover [PR #17592](https://github.com/dotnet/fsharp/pull/17592)) + + +### Breaking Changes +* Enable FSharp 9.0 Language Version ([Issue #17497](https://github.com/dotnet/fsharp/issues/17438)), [PR](https://github.com/dotnet/fsharp/pull/17500))) diff --git a/docs/tooling-features.md b/docs/tooling-features.md index 81a689e4f55..3e637dfa62b 100644 --- a/docs/tooling-features.md +++ b/docs/tooling-features.md @@ -24,7 +24,7 @@ The following tables are split into two categories: syntactic and semantic. They | Code fixes operating only on syntax | Current doc's source text | Small text change for document | S | | XML doc template generation | Current doc's syntax tree | Small (usually) text change for document | S | | Brace pair completion | Current doc's source text | Additional brace pair inserted into source text | S | -| Souce document navigation | Current doc's syntax tree | "Navigation Items" with optional child navigation items containing ranges in source code | S | +| Source document navigation | Current doc's syntax tree | "Navigation Items" with optional child navigation items containing ranges in source code | S | | Code outlining | Current doc's source text | Text spans representing blocks of F# code that are collapsable as a group | S - M | | Editor formatting | Current doc's source text | New source text for the document | S - L | | Syntax diagnostics | Current doc's source text | List of diagnostic data including the span of text corresponding to the diagnostic | S | diff --git a/eng/Build.ps1 b/eng/Build.ps1 index 104353203df..a6bda85ef6b 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -35,8 +35,8 @@ param ( # Options [switch][Alias('proto')]$bootstrap, [string]$bootstrapConfiguration = "Proto", - [string]$bootstrapTfm = "net8.0", - [string]$fsharpNetCoreProductTfm = "net8.0", + [string]$bootstrapTfm = "net9.0", + [string]$fsharpNetCoreProductTfm = "net9.0", [switch][Alias('bl')]$binaryLog = $true, [switch][Alias('nobl')]$excludeCIBinaryLog = $false, [switch][Alias('nolog')]$noBinaryLog = $false, @@ -64,6 +64,7 @@ param ( [switch]$testAllButIntegrationAndAot, [switch]$testpack, [switch]$testAOT, + [switch]$testEditor, [switch]$testBenchmarks, [string]$officialSkipTests = "false", [switch]$noVisualStudio, @@ -80,7 +81,7 @@ $BuildCategory = "" $BuildMessage = "" $desktopTargetFramework = "net472" -$coreclrTargetFramework = "net8.0" +$coreclrTargetFramework = "net9.0" function Print-Usage() { Write-Host "Common settings:" @@ -119,6 +120,7 @@ function Print-Usage() { Write-Host " -testVs Run F# editor unit tests" Write-Host " -testpack Verify built packages" Write-Host " -testAOT Run AOT/Trimming tests" + Write-Host " -testEditor Run VS Editor tests" Write-Host " -testBenchmarks Build and Run Benchmark suite" Write-Host " -officialSkipTests Set to 'true' to skip running tests" Write-Host "" @@ -178,7 +180,11 @@ function Process-Arguments() { $script:testFSharpQA = $True $script:testIntegration = $False $script:testVs = $True - $script:testAOT = $False + $script:testEditor = $True + } + + if($script:testVs) { + $script:testEditor = $True } if ([System.Boolean]::Parse($script:officialSkipTests)) { @@ -354,14 +360,14 @@ function VerifyAssemblyVersionsAndSymbols() { } } -function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [string]$testadapterpath, [boolean] $noTestFilter = $false, [boolean] $asBackgroundJob = $false) { +function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [string]$testadapterpath, [boolean] $asBackgroundJob = $false) { $dotnetPath = InitializeDotNetCli $dotnetExe = Join-Path $dotnetPath "dotnet.exe" $projectName = [System.IO.Path]::GetFileNameWithoutExtension($testProject) $testLogPath = "$ArtifactsDir\TestResults\$configuration\${projectName}_$targetFramework.xml" $testBinLogPath = "$LogDir\${projectName}_$targetFramework.binlog" $args = "test $testProject -c $configuration -f $targetFramework -v n --test-adapter-path $testadapterpath --logger ""nunit;LogFilePath=$testLogPath"" /bl:$testBinLogPath" - $args += " --blame --results-directory $ArtifactsDir\TestResults\$configuration" + $args += " --blame --results-directory $ArtifactsDir\TestResults\$configuration -p:vstestusemsbuildoutput=false" if (-not $noVisualStudio -or $norestore) { $args += " --no-restore" @@ -371,10 +377,6 @@ function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [str $args += " --no-build" } - if ($env:RunningAsPullRequest -ne "true" -and $noTestFilter -eq $false) { - $args += " --filter TestCategory!=PullRequest" - } - if ($asBackgroundJob) { Write-Host("Starting on the background: $args") Write-Host("------------------------------------") @@ -391,14 +393,6 @@ function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [str } } -function TestUsingXUnit([string] $testProject, [string] $targetFramework, [string]$testadapterpath, [boolean] $asBackgroundJob = $false) { - TestUsingMsBuild -testProject $testProject -targetFramework $targetFramework -testadapterpath $testadapterpath -noTestFilter $true -asBackgroundJob $asBackgroundJob -} - -function TestUsingNUnit([string] $testProject, [string] $targetFramework, [string]$testadapterpath, [boolean] $asBackgroundJob = $false) { - TestUsingMsBuild -testProject $testProject -targetFramework $targetFramework -testadapterpath $testadapterpath -noTestFilter $false -asBackgroundJob $asBackgroundJob -} - function Prepare-TempDir() { Copy-Item (Join-Path $RepoRoot "tests\Resources\Directory.Build.props") $TempDir Copy-Item (Join-Path $RepoRoot "tests\Resources\Directory.Build.targets") $TempDir @@ -593,13 +587,13 @@ try { $script:BuildMessage = "Failure running tests" if ($testCoreClr) { - $bgJob = TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" -asBackgroundJob $true + $bgJob = TestUsingMSBuild -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" -asBackgroundJob $true - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Build.UnitTests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Build.UnitTests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\" # Collect output from background jobs Wait-job $bgJob | out-null @@ -607,13 +601,13 @@ try { } if ($testDesktop) { - $bgJob = TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" -asBackgroundJob $true + $bgJob = TestUsingMSBuild -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" -asBackgroundJob $true - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" -noTestFilter $true - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Build.UnitTests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Build.UnitTests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\" # Collect output from background jobs Wait-job $bgJob | out-null @@ -648,46 +642,50 @@ try { } if ($testFSharpCore) { - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\" } if ($testCompiler) { - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" -noTestFilter $true - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" -noTestFilter $true - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" } if ($testCompilerComponentTests) { - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" -noTestFilter $true + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" } if ($testCompilerService) { - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" } if ($testCambridge) { - TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" - TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" } if ($testScripting) { - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\" + TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\" + } + + if ($testEditor -and -not $noVisualStudio) { + TestUsingMSBuild -testProject "$RepoRoot\vsintegration\tests\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj" } if ($testVs -and -not $noVisualStudio) { - TestUsingXUnit -testProject "$RepoRoot\vsintegration\tests\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj" - TestUsingNUnit -testProject "$RepoRoot\vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\VisualFSharp.UnitTests\" + TestUsingMSBuild -testProject "$RepoRoot\vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\VisualFSharp.UnitTests\" } + if ($testIntegration) { - TestUsingXUnit -testProject "$RepoRoot\vsintegration\tests\FSharp.Editor.IntegrationTests\FSharp.Editor.IntegrationTests.csproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Editor.IntegrationTests\" + TestUsingMSBuild -testProject "$RepoRoot\vsintegration\tests\FSharp.Editor.IntegrationTests\FSharp.Editor.IntegrationTests.csproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Editor.IntegrationTests\" } if ($testAOT) { diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props index 8683870a8e9..c1759d53260 100644 --- a/eng/SourceBuild.props +++ b/eng/SourceBuild.props @@ -30,6 +30,7 @@ --tfm $(SourceBuildBootstrapTfm) + false - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ff6b85afaaa..a6fe9dd9339 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,49 +1,56 @@ - + https://github.com/dotnet/source-build-reference-packages - 4642f9b75b588565642dd00dabcfedfe67ca106f + 08649fed58d668737a54913f7d4c649a8da5dc6e - + https://github.com/dotnet/msbuild - 2cbc8b6aef648cf21c6a68a0dab7fe09a614e475 + 2d02daa886f279e2ee749cad03db4b1b75bb9adb - + https://github.com/dotnet/msbuild - 2cbc8b6aef648cf21c6a68a0dab7fe09a614e475 + 2d02daa886f279e2ee749cad03db4b1b75bb9adb - + https://github.com/dotnet/msbuild - 2cbc8b6aef648cf21c6a68a0dab7fe09a614e475 + 2d02daa886f279e2ee749cad03db4b1b75bb9adb - + https://github.com/dotnet/msbuild - 2cbc8b6aef648cf21c6a68a0dab7fe09a614e475 + 2d02daa886f279e2ee749cad03db4b1b75bb9adb - + https://github.com/dotnet/msbuild - 2cbc8b6aef648cf21c6a68a0dab7fe09a614e475 + 2d02daa886f279e2ee749cad03db4b1b75bb9adb + + + https://github.com/dotnet/runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 + + + https://github.com/dotnet/runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 + + + https://github.com/dotnet/runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - + https://github.com/dotnet/arcade - c214b6ad17aedca4fa48294d80f6c52ef2463081 - - - - https://github.com/dotnet/xliff-tasks - 73f0850939d96131c28cf6ea6ee5aacb4da0083a + 91b9734abbad751d575c002b30778c88d978993c - - https://github.com/dotnet/xliff-tasks - 73f0850939d96131c28cf6ea6ee5aacb4da0083a - + + https://github.com/dotnet/arcade + 91b9734abbad751d575c002b30778c88d978993c + https://dev.azure.com/dnceng/internal/_git/dotnet-optimization diff --git a/eng/Versions.props b/eng/Versions.props index e2c40164eac..c56fb4a3cd0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -12,51 +12,48 @@ beta - 8 + 9 0 - 400 + 100 0 $(FSMajorVersion).$(FSMinorVersion) - $(FSMajorVersion)-$(FSMinorVersion) $(FSMajorVersion).$(FSMinorVersion) $(FSMajorVersion).$(FSMinorVersion).$(FSBuildVersion) - $(FSMajorVersion)-$(FSMinorVersion)-$(FSBuildVersion) $(FSMajorVersion).$(FSMinorVersion).$(FSBuildVersion) $(FSMajorVersion).$(FSMinorVersion).0.0 8.0.0.0 43 - 8 + 9 $(FSBuildVersion) $(FSRevisionVersion) $(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion) $(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion).$(FCSRevisionVersion) - $(FCSMajorVersion)$(FCSMinorVersion)$(FCSBuildVersion) + $(FSMajorVersion).$(FSMinorVersion).$(FSBuildVersion) - 8.0.200 + 8.0.400 $(FSCorePackageVersionValue)-$(PreReleaseVersionLabel).* 12 - 8 + 9 $(FSBuildVersion) $(FSRevisionVersion) $(FSToolsMajorVersion).$(FSToolsMinorVersion).$(FSToolsBuildVersion) - $(FSToolsMajorVersion)-$(FSToolsMinorVersion)-$(FSToolsBuildVersion) $(FSToolsMajorVersion).$(FSToolsMinorVersion).$(FSToolsBuildVersion).$(FSToolsRevisionVersion) 17 - 11 + 12 $(VSMajorVersion).0 $(VSMajorVersion).$(VSMinorVersion).0 $(VSAssemblyVersionPrefix).0 @@ -78,22 +75,26 @@ + 8.0.0 4.5.1 - 7.0.0 - 1.6.0 - 7.0.2 + $(SystemPackageVersionVersion) + $(SystemPackageVersionVersion) + $(SystemPackageVersionVersion) + $(SystemPackageVersionVersion) 4.5.5 4.7.0 - 7.0.0 - 7.0.0 + $(SystemPackageVersionVersion) 6.0.0 + $(SystemPackageVersionVersion) 4.5.0 + 1.6.0 - 4.6.0-3.23329.3 - 17.7.25-preview - 17.7.35338-preview.1 - 17.7.58-pre - 17.7.5-preview + 4.11.0-2.24264.2 + 17.10.191 + 17.10.40152 + 17.10.526-pre-g1b474069f5 + 17.10.41 + 17.11.0-preview-24178-03 $(RoslynVersion) $(RoslynVersion) @@ -104,6 +105,7 @@ $(RoslynVersion) 2.0.28 $(RoslynVersion) + $(MicrosoftVisualStudioShellPackagesVersion) $(MicrosoftVisualStudioShellPackagesVersion) @@ -115,6 +117,7 @@ $(MicrosoftVisualStudioShellPackagesVersion) $(MicrosoftVisualStudioShellPackagesVersion) $(MicrosoftVisualStudioShellPackagesVersion) + $(MicrosoftVisualStudioShellPackagesVersion) $(MicrosoftVisualStudioShellPackagesVersion) $(MicrosoftVisualStudioShellPackagesVersion) $(MicrosoftVisualStudioShellPackagesVersion) @@ -125,11 +128,12 @@ 10.0.30319 11.0.50727 15.0.25123-Dev15Preview + - 17.7.0-preview-23217-02 - 17.7.0-preview-23217-02 - 17.7.0-preview-23217-02 - 17.7.0-preview-23217-02 + $(MicrosoftBuildVersion) + $(MicrosoftBuildVersion) + $(MicrosoftBuildVersion) + $(VisualStudioEditorPackagesVersion) $(VisualStudioEditorPackagesVersion) @@ -146,33 +150,36 @@ 0.1.169-beta $(MicrosoftVisualStudioExtensibilityTestingVersion) $(MicrosoftVisualStudioExtensibilityTestingVersion) + $(MicrosoftVisualStudioThreadingPackagesVersion) + $(VisualStudioProjectSystemPackagesVersion) 2.3.6152103 + 17.10.2179 - 17.7.3-preview + 17.10.21 17.0.0 - 17.6.11 + 17.8.8 12.0.4 7.0.4 8.0.4 11.0.4 7.0.4 + 0.2.0 1.0.0 1.1.33 + 0.13.10 2.16.5 4.3.0.0 1.0.31 - 7.0.0 - 7.0.0 - 8.0.0 + $(SystemPackageVersionVersion) 4.3.0-1.22220.8 3.1.0 5.0.0-preview.7.20364.11 @@ -184,12 +191,13 @@ 3.11.0 2.1.80 1.0.0-beta2-dev3 - 2.16.8-preview - 2.9.112 - 2.4.1 - 2.4.2 + 2.18.48 + 2.10.69 + 2.9.0 + 2.8.2 5.10.3 2.2.0 + 1.0.0-prerelease.23614.4 1.0.0-prerelease.23614.4 diff --git a/eng/build-utils.ps1 b/eng/build-utils.ps1 index 61016da9aa9..3c870011188 100644 --- a/eng/build-utils.ps1 +++ b/eng/build-utils.ps1 @@ -14,7 +14,7 @@ $nodeReuse = if (Test-Path variable:nodeReuse) { $nodeReuse } else { $false } $bootstrapDir = if (Test-Path variable:bootstrapDir) { $bootstrapDir } else { "" } $bootstrapConfiguration = if (Test-Path variable:bootstrapConfiguration) { $bootstrapConfiguration } else { "Proto" } $bootstrapTfm = if (Test-Path variable:bootstrapTfm) { $bootstrapTfm } else { "net472" } -$fsharpNetCoreProductTfm = if (Test-Path variable:fsharpNetCoreProductTfm) { $fsharpNetCoreProductTfm } else { "net8.0" } +$fsharpNetCoreProductTfm = if (Test-Path variable:fsharpNetCoreProductTfm) { $fsharpNetCoreProductTfm } else { "net9.0" } $properties = if (Test-Path variable:properties) { $properties } else { @() } function GetProjectOutputBinary([string]$fileName, [string]$projectName = "", [string]$configuration = $script:configuration, [string]$tfm = "net472", [string]$rid = "", [bool]$published = $false) { diff --git a/eng/build.sh b/eng/build.sh index e0a3348bfdb..8544de1e72e 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -26,6 +26,7 @@ usage() echo " --testcoreclr Run unit tests on .NET Core (short: --test, -t)" echo " --testCompilerComponentTests Run FSharp.Compiler.ComponentTests on .NET Core" echo " --testBenchmarks Build and Run Benchmark suite" + echo " --testScripting Run FSharp.Private.ScriptingTests on .NET Core" echo "" echo "Advanced settings:" echo " --ci Building in CI" @@ -60,6 +61,7 @@ publish=false test_core_clr=false test_compilercomponent_tests=false test_benchmarks=false +test_scripting=false configuration="Debug" verbosity='minimal' binary_log=false @@ -75,7 +77,7 @@ properties="" docker=false args="" -tfm="net8.0" # This needs to be changed every time it's bumped by arcade/us. +tfm="net9.0" # This needs to be changed every time it's bumped by arcade/us. BuildCategory="" BuildMessage="" @@ -136,6 +138,9 @@ while [[ $# > 0 ]]; do --testbenchmarks) test_benchmarks=true ;; + --testscripting) + test_scripting=true + ;; --ci) ci=true ;; @@ -177,12 +182,11 @@ done # Import Arcade functions . "$scriptroot/common/tools.sh" -function TestUsingNUnit() { +function Test() { BuildCategory="Test" BuildMessage="Error running tests" testproject="" targetframework="" - notestfilter=0 while [[ $# > 0 ]]; do opt="$(echo "$1" | awk '{print tolower($0)}')" case "$opt" in @@ -194,10 +198,6 @@ function TestUsingNUnit() { targetframework=$2 shift ;; - --notestfilter) - notestfilter=1 - shift - ;; *) echo "Invalid argument: $1" exit 1 @@ -211,15 +211,10 @@ function TestUsingNUnit() { exit 1 fi - filterArgs="" - if [[ "${RunningAsPullRequest:-}" != "true" && $notestfilter == 0 ]]; then - filterArgs=" --filter TestCategory!=PullRequest" - fi - projectname=$(basename -- "$testproject") projectname="${projectname%.*}" testlogpath="$artifacts_dir/TestResults/$configuration/${projectname}_$targetframework.xml" - args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"nunit;LogFilePath=$testlogpath\"$filterArgs --blame --results-directory $artifacts_dir/TestResults/$configuration" + args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"nunit;LogFilePath=$testlogpath\" --blame --results-directory $artifacts_dir/TestResults/$configuration -p:vstestusemsbuildoutput=false" "$DOTNET_INSTALL_DIR/dotnet" $args || exit $? } @@ -324,16 +319,16 @@ BuildSolution if [[ "$test_core_clr" == true ]]; then coreclrtestframework=$tfm - TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj" --targetframework $coreclrtestframework --notestfilter - TestUsingXUnit --testproject "$repo_root/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj" --targetframework $coreclrtestframework --notestfilter - TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj" --targetframework $coreclrtestframework - TestUsingXUnit --testproject "$repo_root/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj" --targetframework $coreclrtestframework - TestUsingNUnit --testproject "$repo_root/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj" --targetframework $coreclrtestframework + Test --testproject "$repo_root/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj" --targetframework $coreclrtestframework + Test --testproject "$repo_root/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj" --targetframework $coreclrtestframework + Test --testproject "$repo_root/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj" --targetframework $coreclrtestframework + Test --testproject "$repo_root/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj" --targetframework $coreclrtestframework + Test --testproject "$repo_root/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj" --targetframework $coreclrtestframework fi if [[ "$test_compilercomponent_tests" == true ]]; then coreclrtestframework=$tfm - TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj" --targetframework $coreclrtestframework --notestfilter + Test --testproject "$repo_root/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj" --targetframework $coreclrtestframework fi if [[ "$test_benchmarks" == true ]]; then @@ -342,4 +337,9 @@ if [[ "$test_benchmarks" == true ]]; then popd fi +if [[ "$test_scripting" == true ]]; then + coreclrtestframework=$tfm + Test --testproject "$repo_root/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj" --targetframework $coreclrtestframework +fi + ExitWithExitCode 0 diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index efa2fd72bfa..5db4ad71ee2 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -1,17 +1,10 @@ -# This file is a temporary workaround for internal builds to be able to restore from private AzDO feeds. -# This file should be removed as part of this issue: https://github.com/dotnet/arcade/issues/4080 +# This script adds internal feeds required to build commits that depend on internal package sources. For instance, +# dotnet6-internal would be added automatically if dotnet6 was found in the nuget.config file. In addition also enables +# disabled internal Maestro (darc-int*) feeds. # -# What the script does is iterate over all package sources in the pointed NuGet.config and add a credential entry -# under for each Maestro managed private feed. Two additional credential -# entries are also added for the two private static internal feeds: dotnet3-internal and dotnet3-internal-transport. +# Optionally, this script also adds a credential entry for each of the internal feeds if supplied. # -# This script needs to be called in every job that will restore packages and which the base repo has -# private AzDO feeds in the NuGet.config. -# -# See example YAML call for this script below. Note the use of the variable `$(dn-bot-dnceng-artifact-feeds-rw)` -# from the AzureDevOps-Artifact-Feeds-Pats variable group. -# -# Any disabledPackageSources entries which start with "darc-int" will be re-enabled as part of this script executing +# See example call for this script below. # # - task: PowerShell@2 # displayName: Setup Private Feeds Credentials @@ -21,11 +14,18 @@ # arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token # env: # Token: $(dn-bot-dnceng-artifact-feeds-rw) +# +# Note that the NuGetAuthenticate task should be called after SetupNugetSources. +# This ensures that: +# - Appropriate creds are set for the added internal feeds (if not supplied to the scrupt) +# - The credential provider is installed. +# +# This logic is also abstracted into enable-internal-sources.yml. [CmdletBinding()] param ( [Parameter(Mandatory = $true)][string]$ConfigFile, - [Parameter(Mandatory = $true)][string]$Password + $Password ) $ErrorActionPreference = "Stop" @@ -48,11 +48,17 @@ function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Usern else { Write-Host "Package source $SourceName already present." } + AddCredential -Creds $creds -Source $SourceName -Username $Username -pwd $pwd } # Add a credential node for the specified source function AddCredential($creds, $source, $username, $pwd) { + # If no cred supplied, don't do anything. + if (!$pwd) { + return; + } + # Looks for credential configuration for the given SourceName. Create it if none is found. $sourceElement = $creds.SelectSingleNode($Source) if ($sourceElement -eq $null) @@ -110,11 +116,6 @@ if (!(Test-Path $ConfigFile -PathType Leaf)) { ExitWithExitCode 1 } -if (!$Password) { - Write-PipelineTelemetryError -Category 'Build' -Message 'Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. Please supply a valid PAT' - ExitWithExitCode 1 -} - # Load NuGet.config $doc = New-Object System.Xml.XmlDocument $filename = (Get-Item $ConfigFile).FullName @@ -127,11 +128,14 @@ if ($sources -eq $null) { $doc.DocumentElement.AppendChild($sources) | Out-Null } -# Looks for a node. Create it if none is found. -$creds = $doc.DocumentElement.SelectSingleNode("packageSourceCredentials") -if ($creds -eq $null) { - $creds = $doc.CreateElement("packageSourceCredentials") - $doc.DocumentElement.AppendChild($creds) | Out-Null +$creds = $null +if ($Password) { + # Looks for a node. Create it if none is found. + $creds = $doc.DocumentElement.SelectSingleNode("packageSourceCredentials") + if ($creds -eq $null) { + $creds = $doc.CreateElement("packageSourceCredentials") + $doc.DocumentElement.AppendChild($creds) | Out-Null + } } # Check for disabledPackageSources; we'll enable any darc-int ones we find there @@ -153,7 +157,7 @@ if ($dotnet31Source -ne $null) { AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -pwd $Password } -$dotnetVersions = @('5','6','7','8') +$dotnetVersions = @('5','6','7','8','9') foreach ($dotnetVersion in $dotnetVersions) { $feedPrefix = "dotnet" + $dotnetVersion; @@ -164,4 +168,4 @@ foreach ($dotnetVersion in $dotnetVersions) { } } -$doc.Save($filename) \ No newline at end of file +$doc.Save($filename) diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh old mode 100644 new mode 100755 index d387c7eac95..4604b61b032 --- a/eng/common/SetupNugetSources.sh +++ b/eng/common/SetupNugetSources.sh @@ -1,28 +1,27 @@ #!/usr/bin/env bash -# This file is a temporary workaround for internal builds to be able to restore from private AzDO feeds. -# This file should be removed as part of this issue: https://github.com/dotnet/arcade/issues/4080 +# This script adds internal feeds required to build commits that depend on internal package sources. For instance, +# dotnet6-internal would be added automatically if dotnet6 was found in the nuget.config file. In addition also enables +# disabled internal Maestro (darc-int*) feeds. +# +# Optionally, this script also adds a credential entry for each of the internal feeds if supplied. # -# What the script does is iterate over all package sources in the pointed NuGet.config and add a credential entry -# under for each Maestro's managed private feed. Two additional credential -# entries are also added for the two private static internal feeds: dotnet3-internal and dotnet3-internal-transport. -# -# This script needs to be called in every job that will restore packages and which the base repo has -# private AzDO feeds in the NuGet.config. -# -# See example YAML call for this script below. Note the use of the variable `$(dn-bot-dnceng-artifact-feeds-rw)` -# from the AzureDevOps-Artifact-Feeds-Pats variable group. -# -# Any disabledPackageSources entries which start with "darc-int" will be re-enabled as part of this script executing. +# See example call for this script below. # # - task: Bash@3 -# displayName: Setup Private Feeds Credentials +# displayName: Setup Internal Feeds # inputs: # filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh -# arguments: $(Build.SourcesDirectory)/NuGet.config $Token +# arguments: $(Build.SourcesDirectory)/NuGet.config # condition: ne(variables['Agent.OS'], 'Windows_NT') -# env: -# Token: $(dn-bot-dnceng-artifact-feeds-rw) +# - task: NuGetAuthenticate@1 +# +# Note that the NuGetAuthenticate task should be called after SetupNugetSources. +# This ensures that: +# - Appropriate creds are set for the added internal feeds (if not supplied to the scrupt) +# - The credential provider is installed. +# +# This logic is also abstracted into enable-internal-sources.yml. ConfigFile=$1 CredToken=$2 @@ -48,11 +47,6 @@ if [ ! -f "$ConfigFile" ]; then ExitWithExitCode 1 fi -if [ -z "$CredToken" ]; then - Write-PipelineTelemetryError -category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. Please supply a valid PAT" - ExitWithExitCode 1 -fi - if [[ `uname -s` == "Darwin" ]]; then NL=$'\\\n' TB='' @@ -105,7 +99,7 @@ if [ "$?" == "0" ]; then PackageSources+=('dotnet3.1-internal-transport') fi -DotNetVersions=('5' '6' '7' '8') +DotNetVersions=('5' '6' '7' '8' '9') for DotNetVersion in ${DotNetVersions[@]} ; do FeedPrefix="dotnet${DotNetVersion}"; @@ -140,18 +134,20 @@ PackageSources+="$IFS" PackageSources+=$(grep -oh '"darc-int-[^"]*"' $ConfigFile | tr -d '"') IFS=$PrevIFS -for FeedName in ${PackageSources[@]} ; do - # Check if there is no existing credential for this FeedName - grep -i "<$FeedName>" $ConfigFile - if [ "$?" != "0" ]; then - echo "Adding credentials for $FeedName." +if [ "$CredToken" ]; then + for FeedName in ${PackageSources[@]} ; do + # Check if there is no existing credential for this FeedName + grep -i "<$FeedName>" $ConfigFile + if [ "$?" != "0" ]; then + echo "Adding credentials for $FeedName." - PackageSourceCredentialsNodeFooter="" - NewCredential="${TB}${TB}<$FeedName>${NL}${NL}${NL}" + PackageSourceCredentialsNodeFooter="" + NewCredential="${TB}${TB}<$FeedName>${NL}${NL}${NL}" - sed -i.bak "s|$PackageSourceCredentialsNodeFooter|$NewCredential${NL}$PackageSourceCredentialsNodeFooter|" $ConfigFile - fi -done + sed -i.bak "s|$PackageSourceCredentialsNodeFooter|$NewCredential${NL}$PackageSourceCredentialsNodeFooter|" $ConfigFile + fi + done +fi # Re-enable any entries in disabledPackageSources where the feed name contains darc-int grep -i "" $ConfigFile diff --git a/eng/common/build.cmd b/eng/common/build.cmd new file mode 100644 index 00000000000..99daf368aba --- /dev/null +++ b/eng/common/build.cmd @@ -0,0 +1,3 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0build.ps1""" %*" +exit /b %ErrorLevel% diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 33a6f2d0e24..438f9920c43 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -19,6 +19,7 @@ Param( [switch] $pack, [switch] $publish, [switch] $clean, + [switch][Alias('pb')]$productBuild, [switch][Alias('bl')]$binaryLog, [switch][Alias('nobl')]$excludeCIBinarylog, [switch] $ci, @@ -58,6 +59,7 @@ function Print-Usage() { Write-Host " -sign Sign build outputs" Write-Host " -publish Publish artifacts (e.g. symbols)" Write-Host " -clean Clean the solution" + Write-Host " -productBuild Build the solution in the way it will be built in the full .NET product (VMR) build (short: -pb)" Write-Host "" Write-Host "Advanced settings:" @@ -120,6 +122,7 @@ function Build { /p:Deploy=$deploy ` /p:Test=$test ` /p:Pack=$pack ` + /p:DotNetBuildRepo=$productBuild ` /p:IntegrationTest=$integrationTest ` /p:PerformanceTest=$performanceTest ` /p:Sign=$sign ` diff --git a/eng/common/build.sh b/eng/common/build.sh index 50af40cdd2c..ac1ee8620cd 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -22,6 +22,9 @@ usage() echo " --sourceBuild Source-build the solution (short: -sb)" echo " Will additionally trigger the following actions: --restore, --build, --pack" echo " If --configuration is not set explicitly, will also set it to 'Release'" + echo " --productBuild Build the solution in the way it will be built in the full .NET product (VMR) build (short: -pb)" + echo " Will additionally trigger the following actions: --restore, --build, --pack" + echo " If --configuration is not set explicitly, will also set it to 'Release'" echo " --rebuild Rebuild solution" echo " --test Run all unit tests in the solution (short: -t)" echo " --integrationTest Run all integration tests in the solution" @@ -59,6 +62,7 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" restore=false build=false source_build=false +product_build=false rebuild=false test=false integration_test=false @@ -105,7 +109,7 @@ while [[ $# > 0 ]]; do -binarylog|-bl) binary_log=true ;; - -excludeCIBinarylog|-nobl) + -excludecibinarylog|-nobl) exclude_ci_binary_log=true ;; -pipelineslog|-pl) @@ -126,6 +130,13 @@ while [[ $# > 0 ]]; do -sourcebuild|-sb) build=true source_build=true + product_build=true + restore=true + pack=true + ;; + -productBuild|-pb) + build=true + product_build=true restore=true pack=true ;; @@ -219,7 +230,9 @@ function Build { /p:RepoRoot="$repo_root" \ /p:Restore=$restore \ /p:Build=$build \ + /p:DotNetBuildRepo=$product_build \ /p:ArcadeBuildFromSource=$source_build \ + /p:DotNetBuildSourceOnly=$source_build \ /p:Rebuild=$rebuild \ /p:Test=$test \ /p:Pack=$pack \ diff --git a/eng/common/core-templates/job/job.yml b/eng/common/core-templates/job/job.yml new file mode 100644 index 00000000000..ba53ebfbd51 --- /dev/null +++ b/eng/common/core-templates/job/job.yml @@ -0,0 +1,247 @@ +parameters: +# Job schema parameters - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job + cancelTimeoutInMinutes: '' + condition: '' + container: '' + continueOnError: false + dependsOn: '' + displayName: '' + pool: '' + steps: [] + strategy: '' + timeoutInMinutes: '' + variables: [] + workspace: '' + templateContext: {} + +# Job base template specific parameters + # See schema documentation - https://github.com/dotnet/arcade/blob/master/Documentation/AzureDevOps/TemplateSchema.md + # publishing defaults + artifacts: '' + enableMicrobuild: false + enablePublishBuildArtifacts: false + enablePublishBuildAssets: false + enablePublishTestResults: false + enablePublishUsingPipelines: false + enableBuildRetry: false + mergeTestResults: false + testRunTitle: '' + testResultsFormat: '' + name: '' + componentGovernanceSteps: [] + preSteps: [] + artifactPublishSteps: [] + runAsPublic: false + +# 1es specific parameters + is1ESPipeline: '' + +jobs: +- job: ${{ parameters.name }} + + ${{ if ne(parameters.cancelTimeoutInMinutes, '') }}: + cancelTimeoutInMinutes: ${{ parameters.cancelTimeoutInMinutes }} + + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} + + ${{ if ne(parameters.container, '') }}: + container: ${{ parameters.container }} + + ${{ if ne(parameters.continueOnError, '') }}: + continueOnError: ${{ parameters.continueOnError }} + + ${{ if ne(parameters.dependsOn, '') }}: + dependsOn: ${{ parameters.dependsOn }} + + ${{ if ne(parameters.displayName, '') }}: + displayName: ${{ parameters.displayName }} + + ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + + ${{ if ne(parameters.strategy, '') }}: + strategy: ${{ parameters.strategy }} + + ${{ if ne(parameters.timeoutInMinutes, '') }}: + timeoutInMinutes: ${{ parameters.timeoutInMinutes }} + + ${{ if ne(parameters.templateContext, '') }}: + templateContext: ${{ parameters.templateContext }} + + variables: + - ${{ if ne(parameters.enableTelemetry, 'false') }}: + - name: DOTNET_CLI_TELEMETRY_PROFILE + value: '$(Build.Repository.Uri)' + - ${{ if eq(parameters.enableRichCodeNavigation, 'true') }}: + - name: EnableRichCodeNavigation + value: 'true' + # Retry signature validation up to three times, waiting 2 seconds between attempts. + # See https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu3028#retry-untrusted-root-failures + - name: NUGET_EXPERIMENTAL_CHAIN_BUILD_RETRY_POLICY + value: 3,2000 + - ${{ each variable in parameters.variables }}: + # handle name-value variable syntax + # example: + # - name: [key] + # value: [value] + - ${{ if ne(variable.name, '') }}: + - name: ${{ variable.name }} + value: ${{ variable.value }} + + # handle variable groups + - ${{ if ne(variable.group, '') }}: + - group: ${{ variable.group }} + + # handle template variable syntax + # example: + # - template: path/to/template.yml + # parameters: + # [key]: [value] + - ${{ if ne(variable.template, '') }}: + - template: ${{ variable.template }} + ${{ if ne(variable.parameters, '') }}: + parameters: ${{ variable.parameters }} + + # handle key-value variable syntax. + # example: + # - [key]: [value] + - ${{ if and(eq(variable.name, ''), eq(variable.group, ''), eq(variable.template, '')) }}: + - ${{ each pair in variable }}: + - name: ${{ pair.key }} + value: ${{ pair.value }} + + # DotNet-HelixApi-Access provides 'HelixApiAccessToken' for internal builds + - ${{ if and(eq(parameters.enableTelemetry, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - group: DotNet-HelixApi-Access + + ${{ if ne(parameters.workspace, '') }}: + workspace: ${{ parameters.workspace }} + + steps: + - ${{ if eq(parameters.is1ESPipeline, '') }}: + - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error + + - ${{ if ne(parameters.preSteps, '') }}: + - ${{ each preStep in parameters.preSteps }}: + - ${{ preStep }} + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: + - task: MicroBuildSigningPlugin@4 + displayName: Install MicroBuild plugin + inputs: + signType: $(_SignType) + zipSources: false + feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json + env: + TeamName: $(_TeamName) + MicroBuildOutputFolderOverride: '$(Agent.TempDirectory)' + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) + + - ${{ if and(eq(parameters.runAsPublic, 'false'), eq(variables['System.TeamProject'], 'internal')) }}: + - task: NuGetAuthenticate@1 + + - ${{ if and(ne(parameters.artifacts.download, 'false'), ne(parameters.artifacts.download, '')) }}: + - task: DownloadPipelineArtifact@2 + inputs: + buildType: current + artifactName: ${{ coalesce(parameters.artifacts.download.name, 'Artifacts_$(Agent.OS)_$(_BuildConfig)') }} + targetPath: ${{ coalesce(parameters.artifacts.download.path, 'artifacts') }} + itemPattern: ${{ coalesce(parameters.artifacts.download.pattern, '**') }} + + - ${{ each step in parameters.steps }}: + - ${{ step }} + + - ${{ if eq(parameters.enableRichCodeNavigation, true) }}: + - task: RichCodeNavIndexer@0 + displayName: RichCodeNav Upload + inputs: + languages: ${{ coalesce(parameters.richCodeNavigationLanguage, 'csharp') }} + environment: ${{ coalesce(parameters.richCodeNavigationEnvironment, 'internal') }} + richNavLogOutputDirectory: $(Build.SourcesDirectory)/artifacts/bin + uploadRichNavArtifacts: ${{ coalesce(parameters.richCodeNavigationUploadArtifacts, false) }} + continueOnError: true + + - ${{ each step in parameters.componentGovernanceSteps }}: + - ${{ step }} + + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: MicroBuildCleanup@1 + displayName: Execute Microbuild cleanup tasks + condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + env: + TeamName: $(_TeamName) + + # Publish test results + - ${{ if or(and(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, '')), eq(parameters.testResultsFormat, 'xunit')) }}: + - task: PublishTestResults@2 + displayName: Publish XUnit Test Results + inputs: + testResultsFormat: 'xUnit' + testResultsFiles: '*.xml' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-xunit + mergeTestResults: ${{ parameters.mergeTestResults }} + continueOnError: true + condition: always() + - ${{ if or(and(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, '')), eq(parameters.testResultsFormat, 'vstest')) }}: + - task: PublishTestResults@2 + displayName: Publish TRX Test Results + inputs: + testResultsFormat: 'VSTest' + testResultsFiles: '*.trx' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-trx + mergeTestResults: ${{ parameters.mergeTestResults }} + continueOnError: true + condition: always() + + # gather artifacts + - ${{ if ne(parameters.artifacts.publish, '') }}: + - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: + - task: CopyFiles@2 + displayName: Gather binaries for publish to artifacts + inputs: + SourceFolder: 'artifacts/bin' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/bin' + - task: CopyFiles@2 + displayName: Gather packages for publish to artifacts + inputs: + SourceFolder: 'artifacts/packages' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/packages' + - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: + - task: CopyFiles@2 + displayName: Gather logs for publish to artifacts + inputs: + SourceFolder: 'artifacts/log' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/log' + continueOnError: true + condition: always() + + - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: + - task: CopyFiles@2 + displayName: Gather logs for publish to artifacts + inputs: + SourceFolder: 'artifacts/log/$(_BuildConfig)' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)' + continueOnError: true + condition: always() + - ${{ if eq(parameters.enableBuildRetry, 'true') }}: + - task: CopyFiles@2 + displayName: Gather buildconfiguration for build retry + inputs: + SourceFolder: '$(Build.SourcesDirectory)/eng/common/BuildConfiguration' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/eng/common/BuildConfiguration' + continueOnError: true + condition: always() + - ${{ each step in parameters.artifactPublishSteps }}: + - ${{ step }} diff --git a/eng/common/core-templates/job/onelocbuild.yml b/eng/common/core-templates/job/onelocbuild.yml new file mode 100644 index 00000000000..00feec8ebbc --- /dev/null +++ b/eng/common/core-templates/job/onelocbuild.yml @@ -0,0 +1,121 @@ +parameters: + # Optional: dependencies of the job + dependsOn: '' + + # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool + pool: '' + + CeapexPat: $(dn-bot-ceapex-package-r) # PAT for the loc AzDO instance https://dev.azure.com/ceapex + GithubPat: $(BotAccount-dotnet-bot-repo-PAT) + + SourcesDirectory: $(Build.SourcesDirectory) + CreatePr: true + AutoCompletePr: false + ReusePr: true + UseLfLineEndings: true + UseCheckedInLocProjectJson: false + SkipLocProjectJsonGeneration: false + LanguageSet: VS_Main_Languages + LclSource: lclFilesInRepo + LclPackageId: '' + RepoType: gitHub + GitHubOrg: dotnet + MirrorRepo: '' + MirrorBranch: main + condition: '' + JobNameSuffix: '' + is1ESPipeline: '' +jobs: +- job: OneLocBuild${{ parameters.JobNameSuffix }} + + dependsOn: ${{ parameters.dependsOn }} + + displayName: OneLocBuild${{ parameters.JobNameSuffix }} + + variables: + - group: OneLocBuildVariables # Contains the CeapexPat and GithubPat + - name: _GenerateLocProjectArguments + value: -SourcesDirectory ${{ parameters.SourcesDirectory }} + -LanguageSet "${{ parameters.LanguageSet }}" + -CreateNeutralXlfs + - ${{ if eq(parameters.UseCheckedInLocProjectJson, 'true') }}: + - name: _GenerateLocProjectArguments + value: ${{ variables._GenerateLocProjectArguments }} -UseCheckedInLocProjectJson + - template: /eng/common/core-templates/variables/pool-providers.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + ${{ if eq(parameters.pool, '') }}: + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022 + os: windows + + steps: + - ${{ if eq(parameters.is1ESPipeline, '') }}: + - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error + + - ${{ if ne(parameters.SkipLocProjectJsonGeneration, 'true') }}: + - task: Powershell@2 + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/generate-locproject.ps1 + arguments: $(_GenerateLocProjectArguments) + displayName: Generate LocProject.json + condition: ${{ parameters.condition }} + + - task: OneLocBuild@2 + displayName: OneLocBuild + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + inputs: + locProj: eng/Localize/LocProject.json + outDir: $(Build.ArtifactStagingDirectory) + lclSource: ${{ parameters.LclSource }} + lclPackageId: ${{ parameters.LclPackageId }} + isCreatePrSelected: ${{ parameters.CreatePr }} + isAutoCompletePrSelected: ${{ parameters.AutoCompletePr }} + ${{ if eq(parameters.CreatePr, true) }}: + isUseLfLineEndingsSelected: ${{ parameters.UseLfLineEndings }} + ${{ if eq(parameters.RepoType, 'gitHub') }}: + isShouldReusePrSelected: ${{ parameters.ReusePr }} + packageSourceAuth: patAuth + patVariable: ${{ parameters.CeapexPat }} + ${{ if eq(parameters.RepoType, 'gitHub') }}: + repoType: ${{ parameters.RepoType }} + gitHubPatVariable: "${{ parameters.GithubPat }}" + ${{ if ne(parameters.MirrorRepo, '') }}: + isMirrorRepoSelected: true + gitHubOrganization: ${{ parameters.GitHubOrg }} + mirrorRepo: ${{ parameters.MirrorRepo }} + mirrorBranch: ${{ parameters.MirrorBranch }} + condition: ${{ parameters.condition }} + + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + displayName: Publish Localization Files + pathToPublish: '$(Build.ArtifactStagingDirectory)/loc' + publishLocation: Container + artifactName: Loc + condition: ${{ parameters.condition }} + + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + displayName: Publish LocProject.json + pathToPublish: '$(Build.SourcesDirectory)/eng/Localize/' + publishLocation: Container + artifactName: Loc + condition: ${{ parameters.condition }} \ No newline at end of file diff --git a/eng/common/core-templates/job/publish-build-assets.yml b/eng/common/core-templates/job/publish-build-assets.yml new file mode 100644 index 00000000000..3d3356e3196 --- /dev/null +++ b/eng/common/core-templates/job/publish-build-assets.yml @@ -0,0 +1,158 @@ +parameters: + configuration: 'Debug' + + # Optional: condition for the job to run + condition: '' + + # Optional: 'true' if future jobs should run even if this job fails + continueOnError: false + + # Optional: dependencies of the job + dependsOn: '' + + # Optional: Include PublishBuildArtifacts task + enablePublishBuildArtifacts: false + + # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool + pool: {} + + # Optional: should run as a public build even in the internal project + # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + runAsPublic: false + + # Optional: whether the build's artifacts will be published using release pipelines or direct feed publishing + publishUsingPipelines: false + + # Optional: whether the build's artifacts will be published using release pipelines or direct feed publishing + publishAssetsImmediately: false + + artifactsPublishingAdditionalParameters: '' + + signingValidationAdditionalParameters: '' + + is1ESPipeline: '' + +jobs: +- job: Asset_Registry_Publish + + dependsOn: ${{ parameters.dependsOn }} + timeoutInMinutes: 150 + + ${{ if eq(parameters.publishAssetsImmediately, 'true') }}: + displayName: Publish Assets + ${{ else }}: + displayName: Publish to Build Asset Registry + + variables: + - template: /eng/common/core-templates/variables/pool-providers.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - group: Publish-Build-Assets + - group: AzureDevOps-Artifact-Feeds-Pats + - name: runCodesignValidationInjection + value: false + # unconditional - needed for logs publishing (redactor tool version) + - template: /eng/common/core-templates/post-build/common-variables.yml + + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Publishing-Internal + image: windows.vs2019.amd64 + os: windows + steps: + - ${{ if eq(parameters.is1ESPipeline, '') }}: + - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - checkout: self + fetchDepth: 3 + clean: true + + - task: DownloadBuildArtifacts@0 + displayName: Download artifact + inputs: + artifactName: AssetManifests + downloadPath: '$(Build.StagingDirectory)/Download' + checkDownloadedFiles: true + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} + + - task: NuGetAuthenticate@1 + + - task: AzureCLI@2 + displayName: Publish Build Assets + inputs: + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/sdk-task.ps1 + arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet + /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' + /p:MaestroApiEndpoint=https://maestro.dot.net + /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} + /p:OfficialBuildId=$(Build.BuildNumber) + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} + + - task: powershell@2 + displayName: Create ReleaseConfigs Artifact + inputs: + targetType: inline + script: | + New-Item -Path "$(Build.StagingDirectory)/ReleaseConfigs" -ItemType Directory -Force + $filePath = "$(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt" + Add-Content -Path $filePath -Value $(BARBuildId) + Add-Content -Path $filePath -Value "$(DefaultChannels)" + Add-Content -Path $filePath -Value $(IsStableBuild) + + $symbolExclusionfile = "$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt" + if (Test-Path -Path $symbolExclusionfile) + { + Write-Host "SymbolExclusionFile exists" + Copy-Item -Path $symbolExclusionfile -Destination "$(Build.StagingDirectory)/ReleaseConfigs" + } + + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + displayName: Publish ReleaseConfigs Artifact + pathToPublish: '$(Build.StagingDirectory)/ReleaseConfigs' + publishLocation: Container + artifactName: ReleaseConfigs + + - ${{ if eq(parameters.publishAssetsImmediately, 'true') }}: + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + - task: AzureCLI@2 + displayName: Publish Using Darc + inputs: + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 + arguments: > + -BuildId $(BARBuildId) + -PublishingInfraVersion 3 + -AzdoToken '$(System.AccessToken)' + -WaitPublishingFinish true + -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' + -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' + + - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: + - template: /eng/common/core-templates/steps/publish-logs.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + JobLabel: 'Publish_Artifacts_Logs' diff --git a/eng/common/core-templates/job/source-build.yml b/eng/common/core-templates/job/source-build.yml new file mode 100644 index 00000000000..c4713c8b6ed --- /dev/null +++ b/eng/common/core-templates/job/source-build.yml @@ -0,0 +1,93 @@ +parameters: + # This template adds arcade-powered source-build to CI. The template produces a server job with a + # default ID 'Source_Build_Complete' to put in a dependency list if necessary. + + # Specifies the prefix for source-build jobs added to pipeline. Use this if disambiguation needed. + jobNamePrefix: 'Source_Build' + + # Defines the platform on which to run the job. By default, a linux-x64 machine, suitable for + # managed-only repositories. This is an object with these properties: + # + # name: '' + # The name of the job. This is included in the job ID. + # targetRID: '' + # The name of the target RID to use, instead of the one auto-detected by Arcade. + # nonPortable: false + # Enables non-portable mode. This means a more specific RID (e.g. fedora.32-x64 rather than + # linux-x64), and compiling against distro-provided packages rather than portable ones. + # skipPublishValidation: false + # Disables publishing validation. By default, a check is performed to ensure no packages are + # published by source-build. + # container: '' + # A container to use. Runs in docker. + # pool: {} + # A pool to use. Runs directly on an agent. + # buildScript: '' + # Specifies the build script to invoke to perform the build in the repo. The default + # './build.sh' should work for typical Arcade repositories, but this is customizable for + # difficult situations. + # jobProperties: {} + # A list of job properties to inject at the top level, for potential extensibility beyond + # container and pool. + platform: {} + + is1ESPipeline: '' + + # If set to true and running on a non-public project, + # Internal nuget and blob storage locations will be enabled. + # This is not enabled by default because many repositories do not need internal sources + # and do not need to have the required service connections approved in the pipeline. + enableInternalSources: false + +jobs: +- job: ${{ parameters.jobNamePrefix }}_${{ parameters.platform.name }} + displayName: Source-Build (${{ parameters.platform.name }}) + + ${{ each property in parameters.platform.jobProperties }}: + ${{ property.key }}: ${{ property.value }} + + ${{ if ne(parameters.platform.container, '') }}: + container: ${{ parameters.platform.container }} + + ${{ if eq(parameters.platform.pool, '') }}: + # The default VM host AzDO pool. This should be capable of running Docker containers: almost all + # source-build builds run in Docker, including the default managed platform. + # /eng/common/core-templates/variables/pool-providers.yml can't be used here (some customers declare variables already), so duplicate its logic + ${{ if eq(parameters.is1ESPipeline, 'true') }}: + pool: + ${{ if eq(variables['System.TeamProject'], 'public') }}: + name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore-Svc-Public' ), False, 'NetCore-Public')] + demands: ImageOverride -equals build.ubuntu.2004.amd64 + ${{ if eq(variables['System.TeamProject'], 'internal') }}: + name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore1ESPool-Svc-Internal'), False, 'NetCore1ESPool-Internal')] + image: 1es-mariner-2 + os: linux + ${{ else }}: + pool: + ${{ if eq(variables['System.TeamProject'], 'public') }}: + name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore-Svc-Public' ), False, 'NetCore-Public')] + demands: ImageOverride -equals Build.Ubuntu.2204.Amd64.Open + ${{ if eq(variables['System.TeamProject'], 'internal') }}: + name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore1ESPool-Svc-Internal'), False, 'NetCore1ESPool-Internal')] + demands: ImageOverride -equals Build.Ubuntu.2204.Amd64 + ${{ if ne(parameters.platform.pool, '') }}: + pool: ${{ parameters.platform.pool }} + + workspace: + clean: all + + steps: + - ${{ if eq(parameters.is1ESPipeline, '') }}: + - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error + + - ${{ if eq(parameters.enableInternalSources, true) }}: + - template: /eng/common/core-templates/steps/enable-internal-sources.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + - template: /eng/common/core-templates/steps/enable-internal-runtimes.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + - template: /eng/common/core-templates/steps/source-build.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + platform: ${{ parameters.platform }} diff --git a/eng/common/core-templates/job/source-index-stage1.yml b/eng/common/core-templates/job/source-index-stage1.yml new file mode 100644 index 00000000000..205fb5b3a39 --- /dev/null +++ b/eng/common/core-templates/job/source-index-stage1.yml @@ -0,0 +1,81 @@ +parameters: + runAsPublic: false + sourceIndexUploadPackageVersion: 2.0.0-20240522.1 + sourceIndexProcessBinlogPackageVersion: 1.0.1-20240522.1 + sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json + sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" + preSteps: [] + binlogPath: artifacts/log/Debug/Build.binlog + condition: '' + dependsOn: '' + pool: '' + is1ESPipeline: '' + +jobs: +- job: SourceIndexStage1 + dependsOn: ${{ parameters.dependsOn }} + condition: ${{ parameters.condition }} + variables: + - name: SourceIndexUploadPackageVersion + value: ${{ parameters.sourceIndexUploadPackageVersion }} + - name: SourceIndexProcessBinlogPackageVersion + value: ${{ parameters.sourceIndexProcessBinlogPackageVersion }} + - name: SourceIndexPackageSource + value: ${{ parameters.sourceIndexPackageSource }} + - name: BinlogPath + value: ${{ parameters.binlogPath }} + - template: /eng/common/core-templates/variables/pool-providers.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + ${{ if eq(parameters.pool, '') }}: + pool: + ${{ if eq(variables['System.TeamProject'], 'public') }}: + name: $(DncEngPublicBuildPool) + image: 1es-windows-2022-open + os: windows + ${{ if eq(variables['System.TeamProject'], 'internal') }}: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022 + os: windows + + steps: + - ${{ if eq(parameters.is1ESPipeline, '') }}: + - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error + + - ${{ each preStep in parameters.preSteps }}: + - ${{ preStep }} + + - task: UseDotNet@2 + displayName: Use .NET 8 SDK + inputs: + packageType: sdk + version: 8.0.x + installationPath: $(Agent.TempDirectory)/dotnet + workingDirectory: $(Agent.TempDirectory) + + - script: | + $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version $(sourceIndexProcessBinlogPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version $(sourceIndexUploadPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools + displayName: Download Tools + # Set working directory to temp directory so 'dotnet' doesn't try to use global.json and use the repo's sdk. + workingDirectory: $(Agent.TempDirectory) + + - script: ${{ parameters.sourceIndexBuildCommand }} + displayName: Build Repository + + - script: $(Agent.TempDirectory)/.source-index/tools/BinLogToSln -i $(BinlogPath) -r $(Build.SourcesDirectory) -n $(Build.Repository.Name) -o .source-index/stage1output + displayName: Process Binlog into indexable sln + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: AzureCLI@2 + displayName: Log in to Azure and upload stage1 artifacts to source index + inputs: + azureSubscription: 'SourceDotNet Stage1 Publish' + addSpnToEnvironment: true + scriptType: 'ps' + scriptLocation: 'inlineScript' + inlineScript: | + $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) -s netsourceindexstage1 -b stage1 diff --git a/eng/common/core-templates/jobs/codeql-build.yml b/eng/common/core-templates/jobs/codeql-build.yml new file mode 100644 index 00000000000..f2144252cc6 --- /dev/null +++ b/eng/common/core-templates/jobs/codeql-build.yml @@ -0,0 +1,33 @@ +parameters: + # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md + continueOnError: false + # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job + jobs: [] + # Optional: if specified, restore and use this version of Guardian instead of the default. + overrideGuardianVersion: '' + is1ESPipeline: '' + +jobs: +- template: /eng/common/core-templates/jobs/jobs.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + enableMicrobuild: false + enablePublishBuildArtifacts: false + enablePublishTestResults: false + enablePublishBuildAssets: false + enablePublishUsingPipelines: false + enableTelemetry: true + + variables: + - group: Publish-Build-Assets + # The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in + # sync with the packages.config file. + - name: DefaultGuardianVersion + value: 0.109.0 + - name: GuardianPackagesConfigFile + value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config + - name: GuardianVersion + value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }} + + jobs: ${{ parameters.jobs }} + diff --git a/eng/common/core-templates/jobs/jobs.yml b/eng/common/core-templates/jobs/jobs.yml new file mode 100644 index 00000000000..ea69be4341c --- /dev/null +++ b/eng/common/core-templates/jobs/jobs.yml @@ -0,0 +1,119 @@ +parameters: + # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md + continueOnError: false + + # Optional: Include PublishBuildArtifacts task + enablePublishBuildArtifacts: false + + # Optional: Enable publishing using release pipelines + enablePublishUsingPipelines: false + + # Optional: Enable running the source-build jobs to build repo from source + enableSourceBuild: false + + # Optional: Parameters for source-build template. + # See /eng/common/core-templates/jobs/source-build.yml for options + sourceBuildParameters: [] + + graphFileGeneration: + # Optional: Enable generating the graph files at the end of the build + enabled: false + # Optional: Include toolset dependencies in the generated graph files + includeToolset: false + + # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job + jobs: [] + + # Optional: Override automatically derived dependsOn value for "publish build assets" job + publishBuildAssetsDependsOn: '' + + # Optional: Publish the assets as soon as the publish to BAR stage is complete, rather doing so in a separate stage. + publishAssetsImmediately: false + + # Optional: If using publishAssetsImmediately and additional parameters are needed, can be used to send along additional parameters (normally sent to post-build.yml) + artifactsPublishingAdditionalParameters: '' + signingValidationAdditionalParameters: '' + + # Optional: should run as a public build even in the internal project + # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + runAsPublic: false + + enableSourceIndex: false + sourceIndexParams: {} + + artifacts: {} + is1ESPipeline: '' + +# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, +# and some (Microbuild) should only be applied to non-PR cases for internal builds. + +jobs: +- ${{ each job in parameters.jobs }}: + - ${{ if eq(parameters.is1ESPipeline, 'true') }}: + - template: /eng/common/templates-official/job/job.yml + parameters: + # pass along parameters + ${{ each parameter in parameters }}: + ${{ if ne(parameter.key, 'jobs') }}: + ${{ parameter.key }}: ${{ parameter.value }} + + # pass along job properties + ${{ each property in job }}: + ${{ if ne(property.key, 'job') }}: + ${{ property.key }}: ${{ property.value }} + + name: ${{ job.job }} + + - ${{ else }}: + - template: /eng/common/templates/job/job.yml + parameters: + # pass along parameters + ${{ each parameter in parameters }}: + ${{ if ne(parameter.key, 'jobs') }}: + ${{ parameter.key }}: ${{ parameter.value }} + + # pass along job properties + ${{ each property in job }}: + ${{ if ne(property.key, 'job') }}: + ${{ property.key }}: ${{ property.value }} + + name: ${{ job.job }} + +- ${{ if eq(parameters.enableSourceBuild, true) }}: + - template: /eng/common/core-templates/jobs/source-build.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + allCompletedJobId: Source_Build_Complete + ${{ each parameter in parameters.sourceBuildParameters }}: + ${{ parameter.key }}: ${{ parameter.value }} + +- ${{ if eq(parameters.enableSourceIndex, 'true') }}: + - template: ../job/source-index-stage1.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + runAsPublic: ${{ parameters.runAsPublic }} + ${{ each parameter in parameters.sourceIndexParams }}: + ${{ parameter.key }}: ${{ parameter.value }} + +- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if or(eq(parameters.enablePublishBuildAssets, true), eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, '')) }}: + - template: ../job/publish-build-assets.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + continueOnError: ${{ parameters.continueOnError }} + dependsOn: + - ${{ if ne(parameters.publishBuildAssetsDependsOn, '') }}: + - ${{ each job in parameters.publishBuildAssetsDependsOn }}: + - ${{ job.job }} + - ${{ if eq(parameters.publishBuildAssetsDependsOn, '') }}: + - ${{ each job in parameters.jobs }}: + - ${{ job.job }} + - ${{ if eq(parameters.enableSourceBuild, true) }}: + - Source_Build_Complete + + runAsPublic: ${{ parameters.runAsPublic }} + publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }} + publishAssetsImmediately: ${{ parameters.publishAssetsImmediately }} + enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + signingValidationAdditionalParameters: ${{ parameters.signingValidationAdditionalParameters }} diff --git a/eng/common/core-templates/jobs/source-build.yml b/eng/common/core-templates/jobs/source-build.yml new file mode 100644 index 00000000000..a10ccfbee6d --- /dev/null +++ b/eng/common/core-templates/jobs/source-build.yml @@ -0,0 +1,58 @@ +parameters: + # This template adds arcade-powered source-build to CI. A job is created for each platform, as + # well as an optional server job that completes when all platform jobs complete. + + # The name of the "join" job for all source-build platforms. If set to empty string, the job is + # not included. Existing repo pipelines can use this job depend on all source-build jobs + # completing without maintaining a separate list of every single job ID: just depend on this one + # server job. By default, not included. Recommended name if used: 'Source_Build_Complete'. + allCompletedJobId: '' + + # See /eng/common/core-templates/job/source-build.yml + jobNamePrefix: 'Source_Build' + + # This is the default platform provided by Arcade, intended for use by a managed-only repo. + defaultManagedPlatform: + name: 'Managed' + container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9' + + # Defines the platforms on which to run build jobs. One job is created for each platform, and the + # object in this array is sent to the job template as 'platform'. If no platforms are specified, + # one job runs on 'defaultManagedPlatform'. + platforms: [] + + is1ESPipeline: '' + + # If set to true and running on a non-public project, + # Internal nuget and blob storage locations will be enabled. + # This is not enabled by default because many repositories do not need internal sources + # and do not need to have the required service connections approved in the pipeline. + enableInternalSources: false + +jobs: + +- ${{ if ne(parameters.allCompletedJobId, '') }}: + - job: ${{ parameters.allCompletedJobId }} + displayName: Source-Build Complete + pool: server + dependsOn: + - ${{ each platform in parameters.platforms }}: + - ${{ parameters.jobNamePrefix }}_${{ platform.name }} + - ${{ if eq(length(parameters.platforms), 0) }}: + - ${{ parameters.jobNamePrefix }}_${{ parameters.defaultManagedPlatform.name }} + +- ${{ each platform in parameters.platforms }}: + - template: /eng/common/core-templates/job/source-build.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + jobNamePrefix: ${{ parameters.jobNamePrefix }} + platform: ${{ platform }} + enableInternalSources: ${{ parameters.enableInternalSources }} + +- ${{ if eq(length(parameters.platforms), 0) }}: + - template: /eng/common/core-templates/job/source-build.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + jobNamePrefix: ${{ parameters.jobNamePrefix }} + platform: ${{ parameters.defaultManagedPlatform }} + enableInternalSources: ${{ parameters.enableInternalSources }} diff --git a/eng/common/core-templates/post-build/common-variables.yml b/eng/common/core-templates/post-build/common-variables.yml new file mode 100644 index 00000000000..d5627a994ae --- /dev/null +++ b/eng/common/core-templates/post-build/common-variables.yml @@ -0,0 +1,22 @@ +variables: + - group: Publish-Build-Assets + + # Whether the build is internal or not + - name: IsInternalBuild + value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }} + + # Default Maestro++ API Endpoint and API Version + - name: MaestroApiEndPoint + value: "https://maestro.dot.net" + - name: MaestroApiVersion + value: "2020-02-20" + + - name: SourceLinkCLIVersion + value: 3.0.0 + - name: SymbolToolVersion + value: 1.0.1 + - name: BinlogToolVersion + value: 1.0.11 + + - name: runCodesignValidationInjection + value: false diff --git a/eng/common/core-templates/post-build/post-build.yml b/eng/common/core-templates/post-build/post-build.yml new file mode 100644 index 00000000000..454fd75c7af --- /dev/null +++ b/eng/common/core-templates/post-build/post-build.yml @@ -0,0 +1,316 @@ +parameters: + # Which publishing infra should be used. THIS SHOULD MATCH THE VERSION ON THE BUILD MANIFEST. + # Publishing V1 is no longer supported + # Publishing V2 is no longer supported + # Publishing V3 is the default + - name: publishingInfraVersion + displayName: Which version of publishing should be used to promote the build definition? + type: number + default: 3 + values: + - 3 + + - name: BARBuildId + displayName: BAR Build Id + type: number + default: 0 + + - name: PromoteToChannelIds + displayName: Channel to promote BARBuildId to + type: string + default: '' + + - name: enableSourceLinkValidation + displayName: Enable SourceLink validation + type: boolean + default: false + + - name: enableSigningValidation + displayName: Enable signing validation + type: boolean + default: true + + - name: enableSymbolValidation + displayName: Enable symbol validation + type: boolean + default: false + + - name: enableNugetValidation + displayName: Enable NuGet validation + type: boolean + default: true + + - name: publishInstallersAndChecksums + displayName: Publish installers and checksums + type: boolean + default: true + + - name: SDLValidationParameters + type: object + default: + enable: false + publishGdn: false + continueOnError: false + params: '' + artifactNames: '' + downloadArtifacts: true + + # These parameters let the user customize the call to sdk-task.ps1 for publishing + # symbols & general artifacts as well as for signing validation + - name: symbolPublishingAdditionalParameters + displayName: Symbol publishing additional parameters + type: string + default: '' + + - name: artifactsPublishingAdditionalParameters + displayName: Artifact publishing additional parameters + type: string + default: '' + + - name: signingValidationAdditionalParameters + displayName: Signing validation additional parameters + type: string + default: '' + + # Which stages should finish execution before post-build stages start + - name: validateDependsOn + type: object + default: + - build + + - name: publishDependsOn + type: object + default: + - Validate + + # Optional: Call asset publishing rather than running in a separate stage + - name: publishAssetsImmediately + type: boolean + default: false + + - name: is1ESPipeline + type: boolean + default: false + +stages: +- ${{ if or(eq( parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: + - stage: Validate + dependsOn: ${{ parameters.validateDependsOn }} + displayName: Validate Build Assets + variables: + - template: /eng/common/core-templates/post-build/common-variables.yml + - template: /eng/common/core-templates/variables/pool-providers.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + jobs: + - job: + displayName: NuGet Validation + condition: and(succeededOrFailed(), eq( ${{ parameters.enableNugetValidation }}, 'true')) + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + ${{ if eq(parameters.is1ESPipeline, true) }}: + name: $(DncEngInternalBuildPool) + image: windows.vs2022.amd64 + os: windows + ${{ else }}: + name: $(DncEngInternalBuildPool) + demands: ImageOverride -equals windows.vs2022.amd64 + + steps: + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: PackageArtifacts + checkDownloadedFiles: true + + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1 + arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ + + - job: + displayName: Signing Validation + condition: and( eq( ${{ parameters.enableSigningValidation }}, 'true'), ne( variables['PostBuildSign'], 'true')) + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + ${{ if eq(parameters.is1ESPipeline, true) }}: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022 + os: windows + ${{ else }}: + name: $(DncEngInternalBuildPool) + demands: ImageOverride -equals windows.vs2022.amd64 + steps: + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: PackageArtifacts + checkDownloadedFiles: true + itemPattern: | + ** + !**/Microsoft.SourceBuild.Intermediate.*.nupkg + + # This is necessary whenever we want to publish/restore to an AzDO private feed + # Since sdk-task.ps1 tries to restore packages we need to do this authentication here + # otherwise it'll complain about accessing a private feed. + - task: NuGetAuthenticate@1 + displayName: 'Authenticate to AzDO Feeds' + + # Signing validation will optionally work with the buildmanifest file which is downloaded from + # Azure DevOps above. + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task SigningValidation -restore -msbuildEngine vs + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts' + /p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt' + ${{ parameters.signingValidationAdditionalParameters }} + + - template: /eng/common/core-templates/steps/publish-logs.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + StageLabel: 'Validation' + JobLabel: 'Signing' + BinlogToolVersion: $(BinlogToolVersion) + + - job: + displayName: SourceLink Validation + condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true') + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + ${{ if eq(parameters.is1ESPipeline, true) }}: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022 + os: windows + ${{ else }}: + name: $(DncEngInternalBuildPool) + demands: ImageOverride -equals windows.vs2022.amd64 + steps: + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + - task: DownloadBuildArtifacts@0 + displayName: Download Blob Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: BlobArtifacts + checkDownloadedFiles: true + + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1 + arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ + -ExtractPath $(Agent.BuildDirectory)/Extract/ + -GHRepoName $(Build.Repository.Name) + -GHCommit $(Build.SourceVersion) + -SourcelinkCliVersion $(SourceLinkCLIVersion) + continueOnError: true + +- ${{ if ne(parameters.publishAssetsImmediately, 'true') }}: + - stage: publish_using_darc + ${{ if or(eq(parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: + dependsOn: ${{ parameters.publishDependsOn }} + ${{ else }}: + dependsOn: ${{ parameters.validateDependsOn }} + displayName: Publish using Darc + variables: + - template: /eng/common/core-templates/post-build/common-variables.yml + - template: /eng/common/core-templates/variables/pool-providers.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + jobs: + - job: + displayName: Publish Using Darc + timeoutInMinutes: 120 + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + ${{ if eq(parameters.is1ESPipeline, true) }}: + name: NetCore1ESPool-Publishing-Internal + image: windows.vs2019.amd64 + os: windows + ${{ else }}: + name: NetCore1ESPool-Publishing-Internal + demands: ImageOverride -equals windows.vs2019.amd64 + steps: + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + - task: NuGetAuthenticate@1 + + - task: AzureCLI@2 + displayName: Publish Using Darc + inputs: + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 + arguments: > + -BuildId $(BARBuildId) + -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} + -AzdoToken '$(System.AccessToken)' + -WaitPublishingFinish true + -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' + -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/core-templates/post-build/setup-maestro-vars.yml b/eng/common/core-templates/post-build/setup-maestro-vars.yml new file mode 100644 index 00000000000..f7602980dbe --- /dev/null +++ b/eng/common/core-templates/post-build/setup-maestro-vars.yml @@ -0,0 +1,74 @@ +parameters: + BARBuildId: '' + PromoteToChannelIds: '' + is1ESPipeline: '' + +steps: + - ${{ if eq(parameters.is1ESPipeline, '') }}: + - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error + + - ${{ if eq(coalesce(parameters.PromoteToChannelIds, 0), 0) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download Release Configs + inputs: + buildType: current + artifactName: ReleaseConfigs + checkDownloadedFiles: true + + - task: AzureCLI@2 + name: setReleaseVars + displayName: Set Release Configs Vars + inputs: + azureSubscription: "Darc: Maestro Production" + scriptType: pscore + scriptLocation: inlineScript + inlineScript: | + try { + if (!$Env:PromoteToMaestroChannels -or $Env:PromoteToMaestroChannels.Trim() -eq '') { + $Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt + + $BarId = $Content | Select -Index 0 + $Channels = $Content | Select -Index 1 + $IsStableBuild = $Content | Select -Index 2 + + $AzureDevOpsProject = $Env:System_TeamProject + $AzureDevOpsBuildDefinitionId = $Env:System_DefinitionId + $AzureDevOpsBuildId = $Env:Build_BuildId + } + else { + . $(Build.SourcesDirectory)\eng\common\tools.ps1 + $darc = Get-Darc + $buildInfo = & $darc get-build ` + --id ${{ parameters.BARBuildId }} ` + --extended ` + --output-format json ` + --ci ` + | convertFrom-Json + + $BarId = ${{ parameters.BARBuildId }} + $Channels = $Env:PromoteToMaestroChannels -split "," + $Channels = $Channels -join "][" + $Channels = "[$Channels]" + + $IsStableBuild = $buildInfo.stable + $AzureDevOpsProject = $buildInfo.azureDevOpsProject + $AzureDevOpsBuildDefinitionId = $buildInfo.azureDevOpsBuildDefinitionId + $AzureDevOpsBuildId = $buildInfo.azureDevOpsBuildId + } + + Write-Host "##vso[task.setvariable variable=BARBuildId]$BarId" + Write-Host "##vso[task.setvariable variable=TargetChannels]$Channels" + Write-Host "##vso[task.setvariable variable=IsStableBuild]$IsStableBuild" + + Write-Host "##vso[task.setvariable variable=AzDOProjectName]$AzureDevOpsProject" + Write-Host "##vso[task.setvariable variable=AzDOPipelineId]$AzureDevOpsBuildDefinitionId" + Write-Host "##vso[task.setvariable variable=AzDOBuildId]$AzureDevOpsBuildId" + } + catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + exit 1 + } + env: + PromoteToMaestroChannels: ${{ parameters.PromoteToChannelIds }} diff --git a/eng/common/core-templates/steps/component-governance.yml b/eng/common/core-templates/steps/component-governance.yml new file mode 100644 index 00000000000..cf0649aa956 --- /dev/null +++ b/eng/common/core-templates/steps/component-governance.yml @@ -0,0 +1,16 @@ +parameters: + disableComponentGovernance: false + componentGovernanceIgnoreDirectories: '' + is1ESPipeline: false + displayName: 'Component Detection' + +steps: +- ${{ if eq(parameters.disableComponentGovernance, 'true') }}: + - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true" + displayName: Set skipComponentGovernanceDetection variable +- ${{ if ne(parameters.disableComponentGovernance, 'true') }}: + - task: ComponentGovernanceComponentDetection@0 + continueOnError: true + displayName: ${{ parameters.displayName }} + inputs: + ignoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} diff --git a/eng/common/core-templates/steps/enable-internal-runtimes.yml b/eng/common/core-templates/steps/enable-internal-runtimes.yml new file mode 100644 index 00000000000..6bdbf62ac50 --- /dev/null +++ b/eng/common/core-templates/steps/enable-internal-runtimes.yml @@ -0,0 +1,32 @@ +# Obtains internal runtime download credentials and populates the 'dotnetbuilds-internal-container-read-token-base64' +# variable with the base64-encoded SAS token, by default + +parameters: +- name: federatedServiceConnection + type: string + default: 'dotnetbuilds-internal-read' +- name: outputVariableName + type: string + default: 'dotnetbuilds-internal-container-read-token-base64' +- name: expiryInHours + type: number + default: 1 +- name: base64Encode + type: boolean + default: true +- name: is1ESPipeline + type: boolean + default: false + +steps: +- ${{ if ne(variables['System.TeamProject'], 'public') }}: + - template: /eng/common/core-templates/steps/get-delegation-sas.yml + parameters: + federatedServiceConnection: ${{ parameters.federatedServiceConnection }} + outputVariableName: ${{ parameters.outputVariableName }} + expiryInHours: ${{ parameters.expiryInHours }} + base64Encode: ${{ parameters.base64Encode }} + storageAccount: dotnetbuilds + container: internal + permissions: rl + is1ESPipeline: ${{ parameters.is1ESPipeline }} \ No newline at end of file diff --git a/eng/common/core-templates/steps/enable-internal-sources.yml b/eng/common/core-templates/steps/enable-internal-sources.yml new file mode 100644 index 00000000000..64f881bffc3 --- /dev/null +++ b/eng/common/core-templates/steps/enable-internal-sources.yml @@ -0,0 +1,47 @@ +parameters: +# This is the Azure federated service connection that we log into to get an access token. +- name: nugetFederatedServiceConnection + type: string + default: 'dnceng-artifacts-feeds-read' +- name: is1ESPipeline + type: boolean + default: false +# Legacy parameters to allow for PAT usage +- name: legacyCredential + type: string + default: '' + +steps: +- ${{ if ne(variables['System.TeamProject'], 'public') }}: + - ${{ if ne(parameters.legacyCredential, '') }}: + - task: PowerShell@2 + displayName: Setup Internal Feeds + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1 + arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token + env: + Token: ${{ parameters.legacyCredential }} + # If running on dnceng (internal project), just use the default behavior for NuGetAuthenticate. + # If running on DevDiv, NuGetAuthenticate is not really an option. It's scoped to a single feed, and we have many feeds that + # may be added. Instead, we'll use the traditional approach (add cred to nuget.config), but use an account token. + - ${{ else }}: + - ${{ if eq(variables['System.TeamProject'], 'internal') }}: + - task: PowerShell@2 + displayName: Setup Internal Feeds + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1 + arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config + - ${{ else }}: + - template: /eng/common/templates/steps/get-federated-access-token.yml + parameters: + federatedServiceConnection: ${{ parameters.nugetFederatedServiceConnection }} + outputVariableName: 'dnceng-artifacts-feeds-read-access-token' + - task: PowerShell@2 + displayName: Setup Internal Feeds + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1 + arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $(dnceng-artifacts-feeds-read-access-token) + # This is required in certain scenarios to install the ADO credential provider. + # It installed by default in some msbuild invocations (e.g. VS msbuild), but needs to be installed for others + # (e.g. dotnet msbuild). + - task: NuGetAuthenticate@1 diff --git a/eng/common/core-templates/steps/generate-sbom.yml b/eng/common/core-templates/steps/generate-sbom.yml new file mode 100644 index 00000000000..d938b60e1bb --- /dev/null +++ b/eng/common/core-templates/steps/generate-sbom.yml @@ -0,0 +1,54 @@ +# BuildDropPath - The root folder of the drop directory for which the manifest file will be generated. +# PackageName - The name of the package this SBOM represents. +# PackageVersion - The version of the package this SBOM represents. +# ManifestDirPath - The path of the directory where the generated manifest files will be placed +# IgnoreDirectories - Directories to ignore for SBOM generation. This will be passed through to the CG component detector. + +parameters: + PackageVersion: 9.0.0 + BuildDropPath: '$(Build.SourcesDirectory)/artifacts' + PackageName: '.NET' + ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom + IgnoreDirectories: '' + sbomContinueOnError: true + is1ESPipeline: false + # disable publishArtifacts if some other step is publishing the artifacts (like job.yml). + publishArtifacts: true + +steps: +- task: PowerShell@2 + displayName: Prep for SBOM generation in (Non-linux) + condition: or(eq(variables['Agent.Os'], 'Windows_NT'), eq(variables['Agent.Os'], 'Darwin')) + inputs: + filePath: ./eng/common/generate-sbom-prep.ps1 + arguments: ${{parameters.manifestDirPath}} + +# Chmodding is a workaround for https://github.com/dotnet/arcade/issues/8461 +- script: | + chmod +x ./eng/common/generate-sbom-prep.sh + ./eng/common/generate-sbom-prep.sh ${{parameters.manifestDirPath}} + displayName: Prep for SBOM generation in (Linux) + condition: eq(variables['Agent.Os'], 'Linux') + continueOnError: ${{ parameters.sbomContinueOnError }} + +- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 + displayName: 'Generate SBOM manifest' + continueOnError: ${{ parameters.sbomContinueOnError }} + inputs: + PackageName: ${{ parameters.packageName }} + BuildDropPath: ${{ parameters.buildDropPath }} + PackageVersion: ${{ parameters.packageVersion }} + ManifestDirPath: ${{ parameters.manifestDirPath }} + ${{ if ne(parameters.IgnoreDirectories, '') }}: + AdditionalComponentDetectorArgs: '--IgnoreDirectories ${{ parameters.IgnoreDirectories }}' + +- ${{ if eq(parameters.publishArtifacts, 'true')}}: + - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + displayName: Publish SBOM manifest + continueOnError: ${{parameters.sbomContinueOnError}} + targetPath: '${{ parameters.manifestDirPath }}' + artifactName: $(ARTIFACT_NAME) + diff --git a/eng/common/core-templates/steps/get-delegation-sas.yml b/eng/common/core-templates/steps/get-delegation-sas.yml new file mode 100644 index 00000000000..d2901470a7f --- /dev/null +++ b/eng/common/core-templates/steps/get-delegation-sas.yml @@ -0,0 +1,46 @@ +parameters: +- name: federatedServiceConnection + type: string +- name: outputVariableName + type: string +- name: expiryInHours + type: number + default: 1 +- name: base64Encode + type: boolean + default: false +- name: storageAccount + type: string +- name: container + type: string +- name: permissions + type: string + default: 'rl' +- name: is1ESPipeline + type: boolean + default: false + +steps: +- task: AzureCLI@2 + displayName: 'Generate delegation SAS Token for ${{ parameters.storageAccount }}/${{ parameters.container }}' + inputs: + azureSubscription: ${{ parameters.federatedServiceConnection }} + scriptType: 'pscore' + scriptLocation: 'inlineScript' + inlineScript: | + # Calculate the expiration of the SAS token and convert to UTC + $expiry = (Get-Date).AddHours(${{ parameters.expiryInHours }}).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ") + + $sas = az storage container generate-sas --account-name ${{ parameters.storageAccount }} --name ${{ parameters.container }} --permissions ${{ parameters.permissions }} --expiry $expiry --auth-mode login --as-user -o tsv + + if ($LASTEXITCODE -ne 0) { + Write-Error "Failed to generate SAS token." + exit 1 + } + + if ('${{ parameters.base64Encode }}' -eq 'true') { + $sas = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($sas)) + } + + Write-Host "Setting '${{ parameters.outputVariableName }}' with the access token value" + Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true]$sas" diff --git a/eng/common/core-templates/steps/get-federated-access-token.yml b/eng/common/core-templates/steps/get-federated-access-token.yml new file mode 100644 index 00000000000..3a4d4410c48 --- /dev/null +++ b/eng/common/core-templates/steps/get-federated-access-token.yml @@ -0,0 +1,42 @@ +parameters: +- name: federatedServiceConnection + type: string +- name: outputVariableName + type: string +- name: is1ESPipeline + type: boolean +- name: stepName + type: string + default: 'getFederatedAccessToken' +- name: condition + type: string + default: '' +# Resource to get a token for. Common values include: +# - '499b84ac-1321-427f-aa17-267ca6975798' for Azure DevOps +# - 'https://storage.azure.com/' for storage +# Defaults to Azure DevOps +- name: resource + type: string + default: '499b84ac-1321-427f-aa17-267ca6975798' +- name: isStepOutputVariable + type: boolean + default: false + +steps: +- task: AzureCLI@2 + displayName: 'Getting federated access token for feeds' + name: ${{ parameters.stepName }} + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} + inputs: + azureSubscription: ${{ parameters.federatedServiceConnection }} + scriptType: 'pscore' + scriptLocation: 'inlineScript' + inlineScript: | + $accessToken = az account get-access-token --query accessToken --resource ${{ parameters.resource }} --output tsv + if ($LASTEXITCODE -ne 0) { + Write-Error "Failed to get access token for resource '${{ parameters.resource }}'" + exit 1 + } + Write-Host "Setting '${{ parameters.outputVariableName }}' with the access token value" + Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true;isOutput=${{ parameters.isStepOutputVariable }}]$accessToken" \ No newline at end of file diff --git a/eng/common/core-templates/steps/publish-build-artifacts.yml b/eng/common/core-templates/steps/publish-build-artifacts.yml new file mode 100644 index 00000000000..f24ce346684 --- /dev/null +++ b/eng/common/core-templates/steps/publish-build-artifacts.yml @@ -0,0 +1,20 @@ +parameters: +- name: is1ESPipeline + type: boolean + default: false +- name: args + type: object + default: {} +steps: +- ${{ if ne(parameters.is1ESPipeline, true) }}: + - template: /eng/common/templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + ${{ each parameter in parameters.args }}: + ${{ parameter.key }}: ${{ parameter.value }} +- ${{ else }}: + - template: /eng/common/templates-official/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + ${{ each parameter in parameters.args }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/core-templates/steps/publish-logs.yml b/eng/common/core-templates/steps/publish-logs.yml new file mode 100644 index 00000000000..80788c52319 --- /dev/null +++ b/eng/common/core-templates/steps/publish-logs.yml @@ -0,0 +1,58 @@ +parameters: + StageLabel: '' + JobLabel: '' + CustomSensitiveDataList: '' + # A default - in case value from eng/common/core-templates/post-build/common-variables.yml is not passed + BinlogToolVersion: '1.0.11' + is1ESPipeline: false + +steps: +- task: Powershell@2 + displayName: Prepare Binlogs to Upload + inputs: + targetType: inline + script: | + New-Item -ItemType Directory $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/ + Move-Item -Path $(Build.SourcesDirectory)/artifacts/log/Debug/* $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/ + continueOnError: true + condition: always() + +- task: PowerShell@2 + displayName: Redact Logs + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/redact-logs.ps1 + # For now this needs to have explicit list of all sensitive data. Taken from eng/publishing/v3/publish.yml + # Sensitive data can as well be added to $(Build.SourcesDirectory)/eng/BinlogSecretsRedactionFile.txt' + # If the file exists - sensitive data for redaction will be sourced from it + # (single entry per line, lines starting with '# ' are considered comments and skipped) + arguments: -InputPath '$(Build.SourcesDirectory)/PostBuildLogs' + -BinlogToolVersion ${{parameters.BinlogToolVersion}} + -TokensFilePath '$(Build.SourcesDirectory)/eng/BinlogSecretsRedactionFile.txt' + '$(publishing-dnceng-devdiv-code-r-build-re)' + '$(MaestroAccessToken)' + '$(dn-bot-all-orgs-artifact-feeds-rw)' + '$(akams-client-id)' + '$(microsoft-symbol-server-pat)' + '$(symweb-symbol-server-pat)' + '$(dn-bot-all-orgs-build-rw-code-rw)' + ${{parameters.CustomSensitiveDataList}} + continueOnError: true + condition: always() + +- task: CopyFiles@2 + displayName: Gather post build logs + inputs: + SourceFolder: '$(Build.SourcesDirectory)/PostBuildLogs' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/PostBuildLogs' + +- template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + displayName: Publish Logs + pathToPublish: '$(Build.ArtifactStagingDirectory)/PostBuildLogs' + publishLocation: Container + artifactName: PostBuildLogs + continueOnError: true + condition: always() diff --git a/eng/common/core-templates/steps/publish-pipeline-artifacts.yml b/eng/common/core-templates/steps/publish-pipeline-artifacts.yml new file mode 100644 index 00000000000..2efec04dc2c --- /dev/null +++ b/eng/common/core-templates/steps/publish-pipeline-artifacts.yml @@ -0,0 +1,20 @@ +parameters: +- name: is1ESPipeline + type: boolean + default: false + +- name: args + type: object + default: {} + +steps: +- ${{ if ne(parameters.is1ESPipeline, true) }}: + - template: /eng/common/templates/steps/publish-pipeline-artifacts.yml + parameters: + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} +- ${{ else }}: + - template: /eng/common/templates-official/steps/publish-pipeline-artifacts.yml + parameters: + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/core-templates/steps/retain-build.yml b/eng/common/core-templates/steps/retain-build.yml new file mode 100644 index 00000000000..83d97a26a01 --- /dev/null +++ b/eng/common/core-templates/steps/retain-build.yml @@ -0,0 +1,28 @@ +parameters: + # Optional azure devops PAT with build execute permissions for the build's organization, + # only needed if the build that should be retained ran on a different organization than + # the pipeline where this template is executing from + Token: '' + # Optional BuildId to retain, defaults to the current running build + BuildId: '' + # Azure devops Organization URI for the build in the https://dev.azure.com/ format. + # Defaults to the organization the current pipeline is running on + AzdoOrgUri: '$(System.CollectionUri)' + # Azure devops project for the build. Defaults to the project the current pipeline is running on + AzdoProject: '$(System.TeamProject)' + +steps: + - task: powershell@2 + inputs: + targetType: 'filePath' + filePath: eng/common/retain-build.ps1 + pwsh: true + arguments: > + -AzdoOrgUri: ${{parameters.AzdoOrgUri}} + -AzdoProject ${{parameters.AzdoProject}} + -Token ${{coalesce(parameters.Token, '$env:SYSTEM_ACCESSTOKEN') }} + -BuildId ${{coalesce(parameters.BuildId, '$env:BUILD_ID')}} + displayName: Enable permanent build retention + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + BUILD_ID: $(Build.BuildId) \ No newline at end of file diff --git a/eng/common/core-templates/steps/send-to-helix.yml b/eng/common/core-templates/steps/send-to-helix.yml new file mode 100644 index 00000000000..68fa739c4ab --- /dev/null +++ b/eng/common/core-templates/steps/send-to-helix.yml @@ -0,0 +1,93 @@ +# Please remember to update the documentation if you make changes to these parameters! +parameters: + HelixSource: 'pr/default' # required -- sources must start with pr/, official/, prodcon/, or agent/ + HelixType: 'tests/default/' # required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/' + HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number + HelixTargetQueues: '' # required -- semicolon-delimited list of Helix queues to test on; see https://helix.dot.net/ for a list of queues + HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group + HelixProjectPath: 'eng/common/helixpublish.proj' # optional -- path to the project file to build relative to BUILD_SOURCESDIRECTORY + HelixProjectArguments: '' # optional -- arguments passed to the build command + HelixConfiguration: '' # optional -- additional property attached to a job + HelixPreCommands: '' # optional -- commands to run before Helix work item execution + HelixPostCommands: '' # optional -- commands to run after Helix work item execution + WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects + WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects + WorkItemTimeout: '' # optional -- a timeout in TimeSpan.Parse-ready value (e.g. 00:02:00) for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects + CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload + XUnitProjects: '' # optional -- semicolon-delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true + XUnitWorkItemTimeout: '' # optional -- the workitem timeout in seconds for all workitems created from the xUnit projects specified by XUnitProjects + XUnitPublishTargetFramework: '' # optional -- framework to use to publish your xUnit projects + XUnitRuntimeTargetFramework: '' # optional -- framework to use for the xUnit console runner + XUnitRunnerVersion: '' # optional -- version of the xUnit nuget package you wish to use on Helix; required for XUnitProjects + IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion + DotNetCliPackageType: '' # optional -- either 'sdk', 'runtime' or 'aspnetcore-runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/main/release-notes/releases-index.json + DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/main/release-notes/releases-index.json + WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." + IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set + HelixBaseUri: 'https://helix.dot.net/' # optional -- sets the Helix API base URI (allows targeting https://helix.int-dot.net ) + Creator: '' # optional -- if the build is external, use this to specify who is sending the job + DisplayNamePrefix: 'Run Tests' # optional -- rename the beginning of the displayName of the steps in AzDO + condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() + continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false + +steps: + - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY/${{ parameters.HelixProjectPath }} /restore /p:TreatWarningsAsErrors=false ${{ parameters.HelixProjectArguments }} /t:Test /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"' + displayName: ${{ parameters.DisplayNamePrefix }} (Windows) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixConfiguration: ${{ parameters.HelixConfiguration }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + WorkItemTimeout: ${{ parameters.WorkItemTimeout }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} + XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + HelixBaseUri: ${{ parameters.HelixBaseUri }} + Creator: ${{ parameters.Creator }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/${{ parameters.HelixProjectPath }} /restore /p:TreatWarningsAsErrors=false ${{ parameters.HelixProjectArguments }} /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog + displayName: ${{ parameters.DisplayNamePrefix }} (Unix) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixConfiguration: ${{ parameters.HelixConfiguration }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + WorkItemTimeout: ${{ parameters.WorkItemTimeout }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} + XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + HelixBaseUri: ${{ parameters.HelixBaseUri }} + Creator: ${{ parameters.Creator }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/core-templates/steps/source-build.yml b/eng/common/core-templates/steps/source-build.yml new file mode 100644 index 00000000000..2915d29bb7f --- /dev/null +++ b/eng/common/core-templates/steps/source-build.yml @@ -0,0 +1,129 @@ +parameters: + # This template adds arcade-powered source-build to CI. + + # This is a 'steps' template, and is intended for advanced scenarios where the existing build + # infra has a careful build methodology that must be followed. For example, a repo + # (dotnet/runtime) might choose to clone the GitHub repo only once and store it as a pipeline + # artifact for all subsequent jobs to use, to reduce dependence on a strong network connection to + # GitHub. Using this steps template leaves room for that infra to be included. + + # Defines the platform on which to run the steps. See 'eng/common/core-templates/job/source-build.yml' + # for details. The entire object is described in the 'job' template for simplicity, even though + # the usage of the properties on this object is split between the 'job' and 'steps' templates. + platform: {} + is1ESPipeline: false + +steps: +# Build. Keep it self-contained for simple reusability. (No source-build-specific job variables.) +- script: | + set -x + df -h + + # If file changes are detected, set CopyWipIntoInnerSourceBuildRepo to copy the WIP changes into the inner source build repo. + internalRestoreArgs= + if ! git diff --quiet; then + internalRestoreArgs='/p:CopyWipIntoInnerSourceBuildRepo=true' + # The 'Copy WIP' feature of source build uses git stash to apply changes from the original repo. + # This only works if there is a username/email configured, which won't be the case in most CI runs. + git config --get user.email + if [ $? -ne 0 ]; then + git config user.email dn-bot@microsoft.com + git config user.name dn-bot + fi + fi + + # If building on the internal project, the internal storage variable may be available (usually only if needed) + # In that case, add variables to allow the download of internal runtimes if the specified versions are not found + # in the default public locations. + internalRuntimeDownloadArgs= + if [ '$(dotnetbuilds-internal-container-read-token-base64)' != '$''(dotnetbuilds-internal-container-read-token-base64)' ]; then + internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://dotnetbuilds.blob.core.windows.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64) --runtimesourcefeed https://dotnetbuilds.blob.core.windows.net/internal --runtimesourcefeedkey $(dotnetbuilds-internal-container-read-token-base64)' + fi + + buildConfig=Release + # Check if AzDO substitutes in a build config from a variable, and use it if so. + if [ '$(_BuildConfig)' != '$''(_BuildConfig)' ]; then + buildConfig='$(_BuildConfig)' + fi + + officialBuildArgs= + if [ '${{ and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}' = 'True' ]; then + officialBuildArgs='/p:DotNetPublishUsingPipelines=true /p:OfficialBuildId=$(BUILD.BUILDNUMBER)' + fi + + targetRidArgs= + if [ '${{ parameters.platform.targetRID }}' != '' ]; then + targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}' + fi + + runtimeOsArgs= + if [ '${{ parameters.platform.runtimeOS }}' != '' ]; then + runtimeOsArgs='/p:RuntimeOS=${{ parameters.platform.runtimeOS }}' + fi + + baseOsArgs= + if [ '${{ parameters.platform.baseOS }}' != '' ]; then + baseOsArgs='/p:BaseOS=${{ parameters.platform.baseOS }}' + fi + + publishArgs= + if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then + publishArgs='--publish' + fi + + assetManifestFileName=SourceBuild_RidSpecific.xml + if [ '${{ parameters.platform.name }}' != '' ]; then + assetManifestFileName=SourceBuild_${{ parameters.platform.name }}.xml + fi + + ${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \ + --configuration $buildConfig \ + --restore --build --pack $publishArgs -bl \ + $officialBuildArgs \ + $internalRuntimeDownloadArgs \ + $internalRestoreArgs \ + $targetRidArgs \ + $runtimeOsArgs \ + $baseOsArgs \ + /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \ + /p:ArcadeBuildFromSource=true \ + /p:DotNetBuildSourceOnly=true \ + /p:DotNetBuildRepo=true \ + /p:AssetManifestFileName=$assetManifestFileName + displayName: Build + +# Upload build logs for diagnosis. +- task: CopyFiles@2 + displayName: Prepare BuildLogs staging directory + inputs: + SourceFolder: '$(Build.SourcesDirectory)' + Contents: | + **/*.log + **/*.binlog + artifacts/sb/prebuilt-report/** + TargetFolder: '$(Build.StagingDirectory)/BuildLogs' + CleanTargetFolder: true + continueOnError: true + condition: succeededOrFailed() + +- template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + displayName: Publish BuildLogs + targetPath: '$(Build.StagingDirectory)/BuildLogs' + artifactName: BuildLogs_SourceBuild_${{ parameters.platform.name }}_Attempt$(System.JobAttempt) + continueOnError: true + condition: succeededOrFailed() + sbomEnabled: false # we don't need SBOM for logs + +# Manually inject component detection so that we can ignore the source build upstream cache, which contains +# a nupkg cache of input packages (a local feed). +# This path must match the upstream cache path in property 'CurrentRepoSourceBuiltNupkgCacheDir' +# in src\Microsoft.DotNet.Arcade.Sdk\tools\SourceBuild\SourceBuildArcade.targets +- template: /eng/common/core-templates/steps/component-governance.yml + parameters: + displayName: Component Detection (Exclude upstream cache) + is1ESPipeline: ${{ parameters.is1ESPipeline }} + componentGovernanceIgnoreDirectories: '$(Build.SourcesDirectory)/artifacts/sb/src/artifacts/obj/source-built-upstream-cache' + disableComponentGovernance: ${{ eq(variables['System.TeamProject'], 'public') }} diff --git a/eng/common/core-templates/variables/pool-providers.yml b/eng/common/core-templates/variables/pool-providers.yml new file mode 100644 index 00000000000..41053d382a2 --- /dev/null +++ b/eng/common/core-templates/variables/pool-providers.yml @@ -0,0 +1,8 @@ +parameters: + is1ESPipeline: false + +variables: + - ${{ if eq(parameters.is1ESPipeline, 'true') }}: + - template: /eng/common/templates-official/variables/pool-providers.yml + - ${{ else }}: + - template: /eng/common/templates/variables/pool-providers.yml \ No newline at end of file diff --git a/eng/common/cross/arm/sources.list.bionic b/eng/common/cross/arm/sources.list.bionic deleted file mode 100644 index 21095574095..00000000000 --- a/eng/common/cross/arm/sources.list.bionic +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse diff --git a/eng/common/cross/arm/sources.list.focal b/eng/common/cross/arm/sources.list.focal deleted file mode 100644 index 4de2600c174..00000000000 --- a/eng/common/cross/arm/sources.list.focal +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse diff --git a/eng/common/cross/arm/sources.list.jammy b/eng/common/cross/arm/sources.list.jammy deleted file mode 100644 index 6bb0453029c..00000000000 --- a/eng/common/cross/arm/sources.list.jammy +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse diff --git a/eng/common/cross/arm/sources.list.jessie b/eng/common/cross/arm/sources.list.jessie deleted file mode 100644 index 4d142ac9b10..00000000000 --- a/eng/common/cross/arm/sources.list.jessie +++ /dev/null @@ -1,3 +0,0 @@ -# Debian (sid) # UNSTABLE -deb http://ftp.debian.org/debian/ sid main contrib non-free -deb-src http://ftp.debian.org/debian/ sid main contrib non-free diff --git a/eng/common/cross/arm/sources.list.xenial b/eng/common/cross/arm/sources.list.xenial deleted file mode 100644 index 56fbb36a59f..00000000000 --- a/eng/common/cross/arm/sources.list.xenial +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse diff --git a/eng/common/cross/arm/sources.list.zesty b/eng/common/cross/arm/sources.list.zesty deleted file mode 100644 index ea2c14a7874..00000000000 --- a/eng/common/cross/arm/sources.list.zesty +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse diff --git a/eng/common/cross/arm64/sources.list.bionic b/eng/common/cross/arm64/sources.list.bionic deleted file mode 100644 index 21095574095..00000000000 --- a/eng/common/cross/arm64/sources.list.bionic +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse diff --git a/eng/common/cross/arm64/sources.list.buster b/eng/common/cross/arm64/sources.list.buster deleted file mode 100644 index 7194ac64a96..00000000000 --- a/eng/common/cross/arm64/sources.list.buster +++ /dev/null @@ -1,11 +0,0 @@ -deb http://deb.debian.org/debian buster main -deb-src http://deb.debian.org/debian buster main - -deb http://deb.debian.org/debian-security/ buster/updates main -deb-src http://deb.debian.org/debian-security/ buster/updates main - -deb http://deb.debian.org/debian buster-updates main -deb-src http://deb.debian.org/debian buster-updates main - -deb http://deb.debian.org/debian buster-backports main contrib non-free -deb-src http://deb.debian.org/debian buster-backports main contrib non-free diff --git a/eng/common/cross/arm64/sources.list.focal b/eng/common/cross/arm64/sources.list.focal deleted file mode 100644 index 4de2600c174..00000000000 --- a/eng/common/cross/arm64/sources.list.focal +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse diff --git a/eng/common/cross/arm64/sources.list.jammy b/eng/common/cross/arm64/sources.list.jammy deleted file mode 100644 index 6bb0453029c..00000000000 --- a/eng/common/cross/arm64/sources.list.jammy +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse diff --git a/eng/common/cross/arm64/sources.list.stretch b/eng/common/cross/arm64/sources.list.stretch deleted file mode 100644 index 0e121577436..00000000000 --- a/eng/common/cross/arm64/sources.list.stretch +++ /dev/null @@ -1,12 +0,0 @@ -deb http://deb.debian.org/debian stretch main -deb-src http://deb.debian.org/debian stretch main - -deb http://deb.debian.org/debian-security/ stretch/updates main -deb-src http://deb.debian.org/debian-security/ stretch/updates main - -deb http://deb.debian.org/debian stretch-updates main -deb-src http://deb.debian.org/debian stretch-updates main - -deb http://deb.debian.org/debian stretch-backports main contrib non-free -deb-src http://deb.debian.org/debian stretch-backports main contrib non-free - diff --git a/eng/common/cross/arm64/sources.list.xenial b/eng/common/cross/arm64/sources.list.xenial deleted file mode 100644 index 56fbb36a59f..00000000000 --- a/eng/common/cross/arm64/sources.list.xenial +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse diff --git a/eng/common/cross/arm64/sources.list.zesty b/eng/common/cross/arm64/sources.list.zesty deleted file mode 100644 index ea2c14a7874..00000000000 --- a/eng/common/cross/arm64/sources.list.zesty +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse diff --git a/eng/common/cross/armel/sources.list.jessie b/eng/common/cross/armel/sources.list.jessie deleted file mode 100644 index 3d9c3059d89..00000000000 --- a/eng/common/cross/armel/sources.list.jessie +++ /dev/null @@ -1,3 +0,0 @@ -# Debian (jessie) # Stable -deb http://ftp.debian.org/debian/ jessie main contrib non-free -deb-src http://ftp.debian.org/debian/ jessie main contrib non-free diff --git a/eng/common/cross/armv6/sources.list.buster b/eng/common/cross/armv6/sources.list.buster deleted file mode 100644 index f27fc4fb346..00000000000 --- a/eng/common/cross/armv6/sources.list.buster +++ /dev/null @@ -1,2 +0,0 @@ -deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi -deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi diff --git a/eng/common/cross/build-android-rootfs.sh b/eng/common/cross/build-android-rootfs.sh index f163fb9dae9..7e9ba2b75ed 100755 --- a/eng/common/cross/build-android-rootfs.sh +++ b/eng/common/cross/build-android-rootfs.sh @@ -5,15 +5,15 @@ __NDK_Version=r21 usage() { echo "Creates a toolchain and sysroot used for cross-compiling for Android." - echo. + echo echo "Usage: $0 [BuildArch] [ApiLevel]" - echo. + echo echo "BuildArch is the target architecture of Android. Currently only arm64 is supported." echo "ApiLevel is the target Android API level. API levels usually match to Android releases. See https://source.android.com/source/build-numbers.html" - echo. + echo echo "By default, the toolchain and sysroot will be generated in cross/android-rootfs/toolchain/[BuildArch]. You can change this behavior" echo "by setting the TOOLCHAIN_DIR environment variable" - echo. + echo echo "By default, the NDK will be downloaded into the cross/android-rootfs/android-ndk-$__NDK_Version directory. If you already have an NDK installation," echo "you can set the NDK_DIR environment variable to have this script use that installation of the NDK." echo "By default, this script will generate a file, android_platform, in the root of the ROOTFS_DIR directory that contains the RID for the supported and tested Android build: android.28-arm64. This file is to replace '/etc/os-release', which is not available for Android." diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 9caf9b021db..4b5e8d7166b 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -8,7 +8,7 @@ usage() echo "BuildArch can be: arm(default), arm64, armel, armv6, ppc64le, riscv64, s390x, x64, x86" echo "CodeName - optional, Code name for Linux, can be: xenial(default), zesty, bionic, alpine" echo " for alpine can be specified with version: alpineX.YY or alpineedge" - echo " for FreeBSD can be: freebsd12, freebsd13" + echo " for FreeBSD can be: freebsd13, freebsd14" echo " for illumos can be: illumos" echo " for Haiku can be: haiku." echo "lldbx.y - optional, LLDB version, can be: lldb3.9(default), lldb4.0, lldb5.0, lldb6.0 no-lldb. Ignored for alpine and FreeBSD" @@ -30,7 +30,8 @@ __IllumosArch=arm7 __HaikuArch=arm __QEMUArch=arm __UbuntuArch=armhf -__UbuntuRepo="http://ports.ubuntu.com/" +__UbuntuRepo= +__UbuntuSuites="updates security backports" __LLDB_Package="liblldb-3.9-dev" __SkipUnmount=0 @@ -71,9 +72,9 @@ __AlpinePackages+=" krb5-dev" __AlpinePackages+=" openssl-dev" __AlpinePackages+=" zlib-dev" -__FreeBSDBase="12.4-RELEASE" +__FreeBSDBase="13.3-RELEASE" __FreeBSDPkg="1.17.0" -__FreeBSDABI="12" +__FreeBSDABI="13" __FreeBSDPackages="libunwind" __FreeBSDPackages+=" icu" __FreeBSDPackages+=" libinotify" @@ -129,6 +130,7 @@ __AlpineKeys=' 616db30d:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnpUpyWDWjlUk3smlWeA0\nlIMW+oJ38t92CRLHH3IqRhyECBRW0d0aRGtq7TY8PmxjjvBZrxTNDpJT6KUk4LRm\na6A6IuAI7QnNK8SJqM0DLzlpygd7GJf8ZL9SoHSH+gFsYF67Cpooz/YDqWrlN7Vw\ntO00s0B+eXy+PCXYU7VSfuWFGK8TGEv6HfGMALLjhqMManyvfp8hz3ubN1rK3c8C\nUS/ilRh1qckdbtPvoDPhSbTDmfU1g/EfRSIEXBrIMLg9ka/XB9PvWRrekrppnQzP\nhP9YE3x/wbFc5QqQWiRCYyQl/rgIMOXvIxhkfe8H5n1Et4VAorkpEAXdsfN8KSVv\nLSMazVlLp9GYq5SUpqYX3KnxdWBgN7BJoZ4sltsTpHQ/34SXWfu3UmyUveWj7wp0\nx9hwsPirVI00EEea9AbP7NM2rAyu6ukcm4m6ATd2DZJIViq2es6m60AE6SMCmrQF\nwmk4H/kdQgeAELVfGOm2VyJ3z69fQuywz7xu27S6zTKi05Qlnohxol4wVb6OB7qG\nLPRtK9ObgzRo/OPumyXqlzAi/Yvyd1ZQk8labZps3e16bQp8+pVPiumWioMFJDWV\nGZjCmyMSU8V6MB6njbgLHoyg2LCukCAeSjbPGGGYhnKLm1AKSoJh3IpZuqcKCk5C\n8CM1S15HxV78s9dFntEqIokCAwEAAQ== ' __Keyring= +__KeyringFile="/usr/share/keyrings/ubuntu-archive-keyring.gpg" __SkipSigCheck=0 __UseMirror=0 @@ -142,7 +144,6 @@ while :; do case $lowerI in -\?|-h|--help) usage - exit 1 ;; arm) __BuildArch=arm @@ -163,6 +164,7 @@ while :; do __UbuntuArch=armel __UbuntuRepo="http://ftp.debian.org/debian/" __CodeName=jessie + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" ;; armv6) __BuildArch=armv6 @@ -170,10 +172,12 @@ while :; do __QEMUArch=arm __UbuntuRepo="http://raspbian.raspberrypi.org/raspbian/" __CodeName=buster + __KeyringFile="/usr/share/keyrings/raspbian-archive-keyring.gpg" __LLDB_Package="liblldb-6.0-dev" + __UbuntuSuites= - if [[ -e "/usr/share/keyrings/raspbian-archive-keyring.gpg" ]]; then - __Keyring="--keyring /usr/share/keyrings/raspbian-archive-keyring.gpg" + if [[ -e "$__KeyringFile" ]]; then + __Keyring="--keyring $__KeyringFile" fi ;; riscv64) @@ -182,13 +186,8 @@ while :; do __AlpinePackages="${__AlpinePackages// lldb-dev/}" __QEMUArch=riscv64 __UbuntuArch=riscv64 - __UbuntuRepo="http://deb.debian.org/debian-ports" __UbuntuPackages="${__UbuntuPackages// libunwind8-dev/}" unset __LLDB_Package - - if [[ -e "/usr/share/keyrings/debian-ports-archive-keyring.gpg" ]]; then - __Keyring="--keyring /usr/share/keyrings/debian-ports-archive-keyring.gpg --include=debian-ports-archive-keyring" - fi ;; ppc64le) __BuildArch=ppc64le @@ -229,12 +228,19 @@ while :; do __UbuntuRepo="http://archive.ubuntu.com/ubuntu/" ;; lldb*) - version="${lowerI/lldb/}" - parts=(${version//./ }) + version="$(echo "$lowerI" | tr -d '[:alpha:]-=')" + majorVersion="${version%%.*}" + + [ -z "${version##*.*}" ] && minorVersion="${version#*.}" + if [ -z "$minorVersion" ]; then + minorVersion=0 + fi # for versions > 6.0, lldb has dropped the minor version - if [[ "${parts[0]}" -gt 6 ]]; then - version="${parts[0]}" + if [ "$majorVersion" -le 6 ]; then + version="$majorVersion.$minorVersion" + else + version="$majorVersion" fi __LLDB_Package="liblldb-${version}-dev" @@ -243,15 +249,19 @@ while :; do unset __LLDB_Package ;; llvm*) - version="${lowerI/llvm/}" - parts=(${version//./ }) - __LLVM_MajorVersion="${parts[0]}" - __LLVM_MinorVersion="${parts[1]}" - - # for versions > 6.0, llvm has dropped the minor version - if [[ -z "$__LLVM_MinorVersion" && "$__LLVM_MajorVersion" -le 6 ]]; then - __LLVM_MinorVersion=0; + version="$(echo "$lowerI" | tr -d '[:alpha:]-=')" + __LLVM_MajorVersion="${version%%.*}" + + [ -z "${version##*.*}" ] && __LLVM_MinorVersion="${version#*.}" + if [ -z "$__LLVM_MinorVersion" ]; then + __LLVM_MinorVersion=0 + fi + + # for versions > 6.0, lldb has dropped the minor version + if [ "$__LLVM_MajorVersion" -gt 6 ]; then + __LLVM_MinorVersion= fi + ;; xenial) # Ubuntu 16.04 if [[ "$__CodeName" != "jessie" ]]; then @@ -278,8 +288,17 @@ while :; do __CodeName=jammy fi ;; + noble) # Ubuntu 24.04 + if [[ "$__CodeName" != "jessie" ]]; then + __CodeName=noble + fi + if [[ -n "$__LLDB_Package" ]]; then + __LLDB_Package="liblldb-18-dev" + fi + ;; jessie) # Debian 8 __CodeName=jessie + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" if [[ -z "$__UbuntuRepo" ]]; then __UbuntuRepo="http://ftp.debian.org/debian/" @@ -288,6 +307,7 @@ while :; do stretch) # Debian 9 __CodeName=stretch __LLDB_Package="liblldb-6.0-dev" + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" if [[ -z "$__UbuntuRepo" ]]; then __UbuntuRepo="http://ftp.debian.org/debian/" @@ -296,6 +316,7 @@ while :; do buster) # Debian 10 __CodeName=buster __LLDB_Package="liblldb-6.0-dev" + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" if [[ -z "$__UbuntuRepo" ]]; then __UbuntuRepo="http://ftp.debian.org/debian/" @@ -303,6 +324,15 @@ while :; do ;; bullseye) # Debian 11 __CodeName=bullseye + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" + + if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://ftp.debian.org/debian/" + fi + ;; + bookworm) # Debian 12 + __CodeName=bookworm + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" if [[ -z "$__UbuntuRepo" ]]; then __UbuntuRepo="http://ftp.debian.org/debian/" @@ -310,6 +340,7 @@ while :; do ;; sid) # Debian sid __CodeName=sid + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" if [[ -z "$__UbuntuRepo" ]]; then __UbuntuRepo="http://ftp.debian.org/debian/" @@ -323,25 +354,24 @@ while :; do alpine*) __CodeName=alpine __UbuntuRepo= - version="${lowerI/alpine/}" - if [[ "$version" == "edge" ]]; then + if [[ "$lowerI" == "alpineedge" ]]; then __AlpineVersion=edge else - parts=(${version//./ }) - __AlpineMajorVersion="${parts[0]}" - __AlpineMinoVersion="${parts[1]}" - __AlpineVersion="$__AlpineMajorVersion.$__AlpineMinoVersion" + version="$(echo "$lowerI" | tr -d '[:alpha:]-=')" + __AlpineMajorVersion="${version%%.*}" + __AlpineMinorVersion="${version#*.}" + __AlpineVersion="$__AlpineMajorVersion.$__AlpineMinorVersion" fi ;; - freebsd12) + freebsd13) __CodeName=freebsd __SkipUnmount=1 ;; - freebsd13) + freebsd14) __CodeName=freebsd - __FreeBSDBase="13.2-RELEASE" - __FreeBSDABI="13" + __FreeBSDBase="14.0-RELEASE" + __FreeBSDABI="14" __SkipUnmount=1 ;; illumos) @@ -420,6 +450,10 @@ fi __UbuntuPackages+=" ${__LLDB_Package:-}" +if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://ports.ubuntu.com/" +fi + if [[ -n "$__LLVM_MajorVersion" ]]; then __UbuntuPackages+=" libclang-common-${__LLVM_MajorVersion}${__LLVM_MinorVersion:+.$__LLVM_MinorVersion}-dev" fi @@ -442,13 +476,39 @@ fi mkdir -p "$__RootfsDir" __RootfsDir="$( cd "$__RootfsDir" && pwd )" +__hasWget= +ensureDownloadTool() +{ + if command -v wget &> /dev/null; then + __hasWget=1 + elif command -v curl &> /dev/null; then + __hasWget=0 + else + >&2 echo "ERROR: either wget or curl is required by this script." + exit 1 + fi +} + if [[ "$__CodeName" == "alpine" ]]; then __ApkToolsVersion=2.12.11 - __ApkToolsSHA512SUM=53e57b49230da07ef44ee0765b9592580308c407a8d4da7125550957bb72cb59638e04f8892a18b584451c8d841d1c7cb0f0ab680cc323a3015776affaa3be33 __ApkToolsDir="$(mktemp -d)" __ApkKeysDir="$(mktemp -d)" + arch="$(uname -m)" - wget "https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic//v$__ApkToolsVersion/x86_64/apk.static" -P "$__ApkToolsDir" + ensureDownloadTool + + if [[ "$__hasWget" == 1 ]]; then + wget -P "$__ApkToolsDir" "https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v$__ApkToolsVersion/$arch/apk.static" + else + curl -SLO --create-dirs --output-dir "$__ApkToolsDir" "https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v$__ApkToolsVersion/$arch/apk.static" + fi + if [[ "$arch" == "x86_64" ]]; then + __ApkToolsSHA512SUM="53e57b49230da07ef44ee0765b9592580308c407a8d4da7125550957bb72cb59638e04f8892a18b584451c8d841d1c7cb0f0ab680cc323a3015776affaa3be33" + elif [[ "$arch" == "aarch64" ]]; then + __ApkToolsSHA512SUM="9e2b37ecb2b56c05dad23d379be84fd494c14bd730b620d0d576bda760588e1f2f59a7fcb2f2080577e0085f23a0ca8eadd993b4e61c2ab29549fdb71969afd0" + else + echo "WARNING: add missing hash for your host architecture. To find the value, use: 'find /tmp -name apk.static -exec sha512sum {} \;'" + fi echo "$__ApkToolsSHA512SUM $__ApkToolsDir/apk.static" | sha512sum -c chmod +x "$__ApkToolsDir/apk.static" @@ -477,20 +537,23 @@ if [[ "$__CodeName" == "alpine" ]]; then fi # initialize DB + # shellcheck disable=SC2086 "$__ApkToolsDir/apk.static" \ -X "http://dl-cdn.alpinelinux.org/alpine/$version/main" \ -X "http://dl-cdn.alpinelinux.org/alpine/$version/community" \ -U $__ApkSignatureArg --root "$__RootfsDir" --arch "$__AlpineArch" --initdb add if [[ "$__AlpineLlvmLibsLookup" == 1 ]]; then + # shellcheck disable=SC2086 __AlpinePackages+=" $("$__ApkToolsDir/apk.static" \ -X "http://dl-cdn.alpinelinux.org/alpine/$version/main" \ -X "http://dl-cdn.alpinelinux.org/alpine/$version/community" \ -U $__ApkSignatureArg --root "$__RootfsDir" --arch "$__AlpineArch" \ - search 'llvm*-libs' | sort | tail -1 | sed 's/-[^-]*//2g')" + search 'llvm*-libs' | grep -E '^llvm' | sort | tail -1 | sed 's/-[^-]*//2g')" fi # install all packages in one go + # shellcheck disable=SC2086 "$__ApkToolsDir/apk.static" \ -X "http://dl-cdn.alpinelinux.org/alpine/$version/main" \ -X "http://dl-cdn.alpinelinux.org/alpine/$version/community" \ @@ -501,12 +564,23 @@ if [[ "$__CodeName" == "alpine" ]]; then elif [[ "$__CodeName" == "freebsd" ]]; then mkdir -p "$__RootfsDir"/usr/local/etc JOBS=${MAXJOBS:="$(getconf _NPROCESSORS_ONLN)"} - wget -O - "https://download.freebsd.org/ftp/releases/${__FreeBSDArch}/${__FreeBSDMachineArch}/${__FreeBSDBase}/base.txz" | tar -C "$__RootfsDir" -Jxf - ./lib ./usr/lib ./usr/libdata ./usr/include ./usr/share/keys ./etc ./bin/freebsd-version + + ensureDownloadTool + + if [[ "$__hasWget" == 1 ]]; then + wget -O- "https://download.freebsd.org/ftp/releases/${__FreeBSDArch}/${__FreeBSDMachineArch}/${__FreeBSDBase}/base.txz" | tar -C "$__RootfsDir" -Jxf - ./lib ./usr/lib ./usr/libdata ./usr/include ./usr/share/keys ./etc ./bin/freebsd-version + else + curl -SL "https://download.freebsd.org/ftp/releases/${__FreeBSDArch}/${__FreeBSDMachineArch}/${__FreeBSDBase}/base.txz" | tar -C "$__RootfsDir" -Jxf - ./lib ./usr/lib ./usr/libdata ./usr/include ./usr/share/keys ./etc ./bin/freebsd-version + fi echo "ABI = \"FreeBSD:${__FreeBSDABI}:${__FreeBSDMachineArch}\"; FINGERPRINTS = \"${__RootfsDir}/usr/share/keys\"; REPOS_DIR = [\"${__RootfsDir}/etc/pkg\"]; REPO_AUTOUPDATE = NO; RUN_SCRIPTS = NO;" > "${__RootfsDir}"/usr/local/etc/pkg.conf echo "FreeBSD: { url: \"pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly\", mirror_type: \"srv\", signature_type: \"fingerprints\", fingerprints: \"${__RootfsDir}/usr/share/keys/pkg\", enabled: yes }" > "${__RootfsDir}"/etc/pkg/FreeBSD.conf mkdir -p "$__RootfsDir"/tmp # get and build package manager - wget -O - "https://github.com/freebsd/pkg/archive/${__FreeBSDPkg}.tar.gz" | tar -C "$__RootfsDir"/tmp -zxf - + if [[ "$__hasWget" == 1 ]]; then + wget -O- "https://github.com/freebsd/pkg/archive/${__FreeBSDPkg}.tar.gz" | tar -C "$__RootfsDir"/tmp -zxf - + else + curl -SL "https://github.com/freebsd/pkg/archive/${__FreeBSDPkg}.tar.gz" | tar -C "$__RootfsDir"/tmp -zxf - + fi cd "$__RootfsDir/tmp/pkg-${__FreeBSDPkg}" # needed for install to succeed mkdir -p "$__RootfsDir"/host/etc @@ -514,27 +588,43 @@ elif [[ "$__CodeName" == "freebsd" ]]; then rm -rf "$__RootfsDir/tmp/pkg-${__FreeBSDPkg}" # install packages we need. INSTALL_AS_USER=$(whoami) "$__RootfsDir"/host/sbin/pkg -r "$__RootfsDir" -C "$__RootfsDir"/usr/local/etc/pkg.conf update + # shellcheck disable=SC2086 INSTALL_AS_USER=$(whoami) "$__RootfsDir"/host/sbin/pkg -r "$__RootfsDir" -C "$__RootfsDir"/usr/local/etc/pkg.conf install --yes $__FreeBSDPackages elif [[ "$__CodeName" == "illumos" ]]; then mkdir "$__RootfsDir/tmp" pushd "$__RootfsDir/tmp" JOBS=${MAXJOBS:="$(getconf _NPROCESSORS_ONLN)"} + + ensureDownloadTool + echo "Downloading sysroot." - wget -O - https://github.com/illumos/sysroot/releases/download/20181213-de6af22ae73b-v1/illumos-sysroot-i386-20181213-de6af22ae73b-v1.tar.gz | tar -C "$__RootfsDir" -xzf - + if [[ "$__hasWget" == 1 ]]; then + wget -O- https://github.com/illumos/sysroot/releases/download/20181213-de6af22ae73b-v1/illumos-sysroot-i386-20181213-de6af22ae73b-v1.tar.gz | tar -C "$__RootfsDir" -xzf - + else + curl -SL https://github.com/illumos/sysroot/releases/download/20181213-de6af22ae73b-v1/illumos-sysroot-i386-20181213-de6af22ae73b-v1.tar.gz | tar -C "$__RootfsDir" -xzf - + fi echo "Building binutils. Please wait.." - wget -O - https://ftp.gnu.org/gnu/binutils/binutils-2.33.1.tar.bz2 | tar -xjf - + if [[ "$__hasWget" == 1 ]]; then + wget -O- https://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.xz | tar -xJf - + else + curl -SL https://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.xz | tar -xJf - + fi mkdir build-binutils && cd build-binutils - ../binutils-2.33.1/configure --prefix="$__RootfsDir" --target="${__illumosArch}-sun-solaris2.10" --program-prefix="${__illumosArch}-illumos-" --with-sysroot="$__RootfsDir" + ../binutils-2.42/configure --prefix="$__RootfsDir" --target="${__illumosArch}-sun-solaris2.11" --program-prefix="${__illumosArch}-illumos-" --with-sysroot="$__RootfsDir" make -j "$JOBS" && make install && cd .. echo "Building gcc. Please wait.." - wget -O - https://ftp.gnu.org/gnu/gcc/gcc-8.4.0/gcc-8.4.0.tar.xz | tar -xJf - + if [[ "$__hasWget" == 1 ]]; then + wget -O- https://ftp.gnu.org/gnu/gcc/gcc-13.3.0/gcc-13.3.0.tar.xz | tar -xJf - + else + curl -SL https://ftp.gnu.org/gnu/gcc/gcc-13.3.0/gcc-13.3.0.tar.xz | tar -xJf - + fi CFLAGS="-fPIC" CXXFLAGS="-fPIC" CXXFLAGS_FOR_TARGET="-fPIC" CFLAGS_FOR_TARGET="-fPIC" export CFLAGS CXXFLAGS CXXFLAGS_FOR_TARGET CFLAGS_FOR_TARGET mkdir build-gcc && cd build-gcc - ../gcc-8.4.0/configure --prefix="$__RootfsDir" --target="${__illumosArch}-sun-solaris2.10" --program-prefix="${__illumosArch}-illumos-" --with-sysroot="$__RootfsDir" --with-gnu-as \ + ../gcc-13.3.0/configure --prefix="$__RootfsDir" --target="${__illumosArch}-sun-solaris2.11" --program-prefix="${__illumosArch}-illumos-" --with-sysroot="$__RootfsDir" --with-gnu-as \ --with-gnu-ld --disable-nls --disable-libgomp --disable-libquadmath --disable-libssp --disable-libvtv --disable-libcilkrts --disable-libada --disable-libsanitizer \ --disable-libquadmath-support --disable-shared --enable-tls make -j "$JOBS" && make install && cd .. @@ -542,9 +632,13 @@ elif [[ "$__CodeName" == "illumos" ]]; then if [[ "$__UseMirror" == 1 ]]; then BaseUrl=https://pkgsrc.smartos.skylime.net fi - BaseUrl="$BaseUrl/packages/SmartOS/trunk/${__illumosArch}/All" + BaseUrl="$BaseUrl/packages/SmartOS/2019Q4/${__illumosArch}/All" echo "Downloading manifest" - wget "$BaseUrl" + if [[ "$__hasWget" == 1 ]]; then + wget "$BaseUrl" + else + curl -SLO "$BaseUrl" + fi echo "Downloading dependencies." read -ra array <<<"$__IllumosPackages" for package in "${array[@]}"; do @@ -552,7 +646,11 @@ elif [[ "$__CodeName" == "illumos" ]]; then # find last occurrence of package in listing and extract its name package="$(sed -En '/.*href="('"$package"'-[0-9].*).tgz".*/h;$!d;g;s//\1/p' All)" echo "Resolved name '$package'" - wget "$BaseUrl"/"$package".tgz + if [[ "$__hasWget" == 1 ]]; then + wget "$BaseUrl"/"$package".tgz + else + curl -SLO "$BaseUrl"/"$package".tgz + fi ar -x "$package".tgz tar --skip-old-files -xzf "$package".tmp.tg* -C "$__RootfsDir" 2>/dev/null done @@ -561,10 +659,17 @@ elif [[ "$__CodeName" == "illumos" ]]; then rm -rf "$__RootfsDir"/{tmp,+*} mkdir -p "$__RootfsDir"/usr/include/net mkdir -p "$__RootfsDir"/usr/include/netpacket - wget -P "$__RootfsDir"/usr/include/net https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/io/bpf/net/bpf.h - wget -P "$__RootfsDir"/usr/include/net https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/io/bpf/net/dlt.h - wget -P "$__RootfsDir"/usr/include/netpacket https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/inet/sockmods/netpacket/packet.h - wget -P "$__RootfsDir"/usr/include/sys https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/sys/sdt.h + if [[ "$__hasWget" == 1 ]]; then + wget -P "$__RootfsDir"/usr/include/net https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/io/bpf/net/bpf.h + wget -P "$__RootfsDir"/usr/include/net https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/io/bpf/net/dlt.h + wget -P "$__RootfsDir"/usr/include/netpacket https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/inet/sockmods/netpacket/packet.h + wget -P "$__RootfsDir"/usr/include/sys https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/sys/sdt.h + else + curl -SLO --create-dirs --output-dir "$__RootfsDir"/usr/include/net https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/io/bpf/net/bpf.h + curl -SLO --create-dirs --output-dir "$__RootfsDir"/usr/include/net https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/io/bpf/net/dlt.h + curl -SLO --create-dirs --output-dir "$__RootfsDir"/usr/include/netpacket https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/inet/sockmods/netpacket/packet.h + curl -SLO --create-dirs --output-dir "$__RootfsDir"/usr/include/sys https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/sys/sdt.h + fi elif [[ "$__CodeName" == "haiku" ]]; then JOBS=${MAXJOBS:="$(getconf _NPROCESSORS_ONLN)"} @@ -574,9 +679,16 @@ elif [[ "$__CodeName" == "haiku" ]]; then mkdir "$__RootfsDir/tmp/download" + ensureDownloadTool + echo "Downloading Haiku package tool" - git clone https://github.com/haiku/haiku-toolchains-ubuntu --depth 1 $__RootfsDir/tmp/script - wget -O "$__RootfsDir/tmp/download/hosttools.zip" $($__RootfsDir/tmp/script/fetch.sh --hosttools) + git clone https://github.com/haiku/haiku-toolchains-ubuntu --depth 1 "$__RootfsDir/tmp/script" + if [[ "$__hasWget" == 1 ]]; then + wget -O "$__RootfsDir/tmp/download/hosttools.zip" "$("$__RootfsDir/tmp/script/fetch.sh" --hosttools)" + else + curl -SLo "$__RootfsDir/tmp/download/hosttools.zip" "$("$__RootfsDir/tmp/script/fetch.sh" --hosttools)" + fi + unzip -o "$__RootfsDir/tmp/download/hosttools.zip" -d "$__RootfsDir/tmp/bin" DepotBaseUrl="https://depot.haiku-os.org/__api/v2/pkg/get-pkg" @@ -589,14 +701,25 @@ elif [[ "$__CodeName" == "haiku" ]]; then echo "Downloading $package..." # API documented here: https://github.com/haiku/haikudepotserver/blob/master/haikudepotserver-api2/src/main/resources/api2/pkg.yaml#L60 # The schema here: https://github.com/haiku/haikudepotserver/blob/master/haikudepotserver-api2/src/main/resources/api2/pkg.yaml#L598 - hpkgDownloadUrl="$(wget -qO- --post-data='{"name":"'"$package"'","repositorySourceCode":"haikuports_'$__HaikuArch'","versionType":"LATEST","naturalLanguageCode":"en"}' \ - --header='Content-Type:application/json' "$DepotBaseUrl" | jq -r '.result.versions[].hpkgDownloadURL')" - wget -P "$__RootfsDir/tmp/download" "$hpkgDownloadUrl" + if [[ "$__hasWget" == 1 ]]; then + hpkgDownloadUrl="$(wget -qO- --post-data '{"name":"'"$package"'","repositorySourceCode":"haikuports_'$__HaikuArch'","versionType":"LATEST","naturalLanguageCode":"en"}' \ + --header 'Content-Type:application/json' "$DepotBaseUrl" | jq -r '.result.versions[].hpkgDownloadURL')" + wget -P "$__RootfsDir/tmp/download" "$hpkgDownloadUrl" + else + hpkgDownloadUrl="$(curl -sSL -XPOST --data '{"name":"'"$package"'","repositorySourceCode":"haikuports_'$__HaikuArch'","versionType":"LATEST","naturalLanguageCode":"en"}' \ + --header 'Content-Type:application/json' "$DepotBaseUrl" | jq -r '.result.versions[].hpkgDownloadURL')" + curl -SLO --create-dirs --output-dir "$__RootfsDir/tmp/download" "$hpkgDownloadUrl" + fi done for package in haiku haiku_devel; do echo "Downloading $package..." - hpkgVersion="$(wget -qO- $HpkgBaseUrl | sed -n 's/^.*version: "\([^"]*\)".*$/\1/p')" - wget -P "$__RootfsDir/tmp/download" "$HpkgBaseUrl/packages/$package-$hpkgVersion-1-$__HaikuArch.hpkg" + if [[ "$__hasWget" == 1 ]]; then + hpkgVersion="$(wget -qO- "$HpkgBaseUrl" | sed -n 's/^.*version: "\([^"]*\)".*$/\1/p')" + wget -P "$__RootfsDir/tmp/download" "$HpkgBaseUrl/packages/$package-$hpkgVersion-1-$__HaikuArch.hpkg" + else + hpkgVersion="$(curl -sSL "$HpkgBaseUrl" | sed -n 's/^.*version: "\([^"]*\)".*$/\1/p')" + curl -SLO --create-dirs --output-dir "$__RootfsDir/tmp/download" "$HpkgBaseUrl/packages/$package-$hpkgVersion-1-$__HaikuArch.hpkg" + fi done # Set up the sysroot @@ -609,7 +732,11 @@ elif [[ "$__CodeName" == "haiku" ]]; then # Download buildtools echo "Downloading Haiku buildtools" - wget -O "$__RootfsDir/tmp/download/buildtools.zip" $($__RootfsDir/tmp/script/fetch.sh --buildtools --arch=$__HaikuArch) + if [[ "$__hasWget" == 1 ]]; then + wget -O "$__RootfsDir/tmp/download/buildtools.zip" "$("$__RootfsDir/tmp/script/fetch.sh" --buildtools --arch=$__HaikuArch)" + else + curl -SLo "$__RootfsDir/tmp/download/buildtools.zip" "$("$__RootfsDir/tmp/script/fetch.sh" --buildtools --arch=$__HaikuArch)" + fi unzip -o "$__RootfsDir/tmp/download/buildtools.zip" -d "$__RootfsDir" # Cleaning up temporary files @@ -622,10 +749,22 @@ elif [[ -n "$__CodeName" ]]; then __Keyring="$__Keyring --force-check-gpg" fi + # shellcheck disable=SC2086 + echo running debootstrap "--variant=minbase" $__Keyring --arch "$__UbuntuArch" "$__CodeName" "$__RootfsDir" "$__UbuntuRepo" debootstrap "--variant=minbase" $__Keyring --arch "$__UbuntuArch" "$__CodeName" "$__RootfsDir" "$__UbuntuRepo" - cp "$__CrossDir/$__BuildArch/sources.list.$__CodeName" "$__RootfsDir/etc/apt/sources.list" + + mkdir -p "$__RootfsDir/etc/apt/sources.list.d/" + cat > "$__RootfsDir/etc/apt/sources.list.d/$__CodeName.sources" <>Start configuring Tizen rootfs" ln -sfn asm-${LINK_ARCH} ./usr/include/asm patch -p1 < $__TIZEN_CROSSDIR/tizen.patch +if [[ "$TIZEN_ARCH" == "riscv64" ]]; then + echo "Fixing broken symlinks in $PWD" + rm ./usr/lib64/libresolv.so + ln -s ../../lib64/libresolv.so.2 ./usr/lib64/libresolv.so + rm ./usr/lib64/libpthread.so + ln -s ../../lib64/libpthread.so.0 ./usr/lib64/libpthread.so + rm ./usr/lib64/libdl.so + ln -s ../../lib64/libdl.so.2 ./usr/lib64/libdl.so + rm ./usr/lib64/libutil.so + ln -s ../../lib64/libutil.so.1 ./usr/lib64/libutil.so + rm ./usr/lib64/libm.so + ln -s ../../lib64/libm.so.6 ./usr/lib64/libm.so + rm ./usr/lib64/librt.so + ln -s ../../lib64/librt.so.1 ./usr/lib64/librt.so + rm ./lib/ld-linux-riscv64-lp64d.so.1 + ln -s ../lib64/ld-linux-riscv64-lp64d.so.1 ./lib/ld-linux-riscv64-lp64d.so.1 +fi echo "<:--stdlib=${CLR_CMAKE_CXX_STANDARD_LIBRARY}>) + add_link_options($<$:--stdlib=${CLR_CMAKE_CXX_STANDARD_LIBRARY}>) +endif() + +option(CLR_CMAKE_CXX_STANDARD_LIBRARY_STATIC "Statically link against the C++ standard library" OFF) +if(CLR_CMAKE_CXX_STANDARD_LIBRARY_STATIC) + add_link_options($<$:-static-libstdc++>) +endif() + +set(CLR_CMAKE_CXX_ABI_LIBRARY "" CACHE STRING "C++ ABI implementation library to link against. Only supported with the Clang compiler.") +if (CLR_CMAKE_CXX_ABI_LIBRARY) + # The user may specify the ABI library with the 'lib' prefix, like 'libstdc++'. Strip the prefix here so the linker finds the right library. + string(REGEX REPLACE "^lib(.+)" "\\1" CLR_CMAKE_CXX_ABI_LIBRARY ${CLR_CMAKE_CXX_ABI_LIBRARY}) + # We need to specify this as a linker-backend option as Clang will filter this option out when linking to libc++. + add_link_options("LINKER:-l${CLR_CMAKE_CXX_ABI_LIBRARY}") +endif() + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/eng/common/cross/x64/sources.list.bionic b/eng/common/cross/x64/sources.list.bionic deleted file mode 100644 index a71ccadcffa..00000000000 --- a/eng/common/cross/x64/sources.list.bionic +++ /dev/null @@ -1,11 +0,0 @@ -deb http://archive.ubuntu.com/ubuntu/ bionic main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted -deb-src http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted - -deb http://archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse -deb-src http://archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse diff --git a/eng/common/cross/x64/sources.list.xenial b/eng/common/cross/x64/sources.list.xenial deleted file mode 100644 index ad9c5a0144e..00000000000 --- a/eng/common/cross/x64/sources.list.xenial +++ /dev/null @@ -1,11 +0,0 @@ -deb http://archive.ubuntu.com/ubuntu/ xenial main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted -deb-src http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted - -deb http://archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse -deb-src http://archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse diff --git a/eng/common/cross/x86/sources.list.bionic b/eng/common/cross/x86/sources.list.bionic deleted file mode 100644 index a71ccadcffa..00000000000 --- a/eng/common/cross/x86/sources.list.bionic +++ /dev/null @@ -1,11 +0,0 @@ -deb http://archive.ubuntu.com/ubuntu/ bionic main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted -deb-src http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted - -deb http://archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse -deb-src http://archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse diff --git a/eng/common/cross/x86/sources.list.focal b/eng/common/cross/x86/sources.list.focal deleted file mode 100644 index 99d5731330e..00000000000 --- a/eng/common/cross/x86/sources.list.focal +++ /dev/null @@ -1,11 +0,0 @@ -deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted -deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted - -deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse -deb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse diff --git a/eng/common/cross/x86/sources.list.jammy b/eng/common/cross/x86/sources.list.jammy deleted file mode 100644 index af1c1feaeac..00000000000 --- a/eng/common/cross/x86/sources.list.jammy +++ /dev/null @@ -1,11 +0,0 @@ -deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted -deb-src http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted - -deb http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse -deb-src http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse diff --git a/eng/common/cross/x86/sources.list.xenial b/eng/common/cross/x86/sources.list.xenial deleted file mode 100644 index ad9c5a0144e..00000000000 --- a/eng/common/cross/x86/sources.list.xenial +++ /dev/null @@ -1,11 +0,0 @@ -deb http://archive.ubuntu.com/ubuntu/ xenial main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted -deb-src http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted - -deb http://archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse -deb-src http://archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index 8fda30bdce2..e3374310563 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -1,6 +1,6 @@ param ( $darcVersion = $null, - $versionEndpoint = 'https://maestro.dot.net/api/assets/darc-version?api-version=2019-01-16', + $versionEndpoint = 'https://maestro.dot.net/api/assets/darc-version?api-version=2020-02-20', $verbosity = 'minimal', $toolpath = $null ) diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh index c305ae6bd77..36dbd45e1ce 100755 --- a/eng/common/darc-init.sh +++ b/eng/common/darc-init.sh @@ -2,7 +2,7 @@ source="${BASH_SOURCE[0]}" darcVersion='' -versionEndpoint='https://maestro.dot.net/api/assets/darc-version?api-version=2019-01-16' +versionEndpoint='https://maestro.dot.net/api/assets/darc-version?api-version=2020-02-20' verbosity='minimal' while [[ $# > 0 ]]; do diff --git a/eng/common/dotnet-install.sh b/eng/common/dotnet-install.sh index 7e69e3a9e24..7b9d97e3bd4 100755 --- a/eng/common/dotnet-install.sh +++ b/eng/common/dotnet-install.sh @@ -71,6 +71,9 @@ case $cpuname in i[3-6]86) buildarch=x86 ;; + riscv64) + buildarch=riscv64 + ;; *) echo "Unknown CPU $cpuname detected, treating it as x64" buildarch=x64 @@ -82,7 +85,7 @@ if [[ $architecture != "" ]] && [[ $architecture != $buildarch ]]; then dotnetRoot="$dotnetRoot/$architecture" fi -InstallDotNet $dotnetRoot $version "$architecture" $runtime true $runtimeSourceFeed $runtimeSourceFeedKey || { +InstallDotNet "$dotnetRoot" $version "$architecture" $runtime true $runtimeSourceFeed $runtimeSourceFeedKey || { local exit_code=$? Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "dotnet-install.sh failed (exit code '$exit_code')." >&2 ExitWithExitCode $exit_code diff --git a/eng/common/generate-sbom-prep.sh b/eng/common/generate-sbom-prep.sh old mode 100644 new mode 100755 diff --git a/eng/common/helixpublish.proj b/eng/common/helixpublish.proj index d7f185856e7..c1323bf4121 100644 --- a/eng/common/helixpublish.proj +++ b/eng/common/helixpublish.proj @@ -1,3 +1,4 @@ + diff --git a/eng/common/internal/Directory.Build.props b/eng/common/internal/Directory.Build.props index dbf99d82a5c..f1d041c33da 100644 --- a/eng/common/internal/Directory.Build.props +++ b/eng/common/internal/Directory.Build.props @@ -1,4 +1,11 @@ + + + false + false + + + diff --git a/eng/common/internal/Tools.csproj b/eng/common/internal/Tools.csproj index 7f5ce6d6081..db46d5582eb 100644 --- a/eng/common/internal/Tools.csproj +++ b/eng/common/internal/Tools.csproj @@ -1,10 +1,36 @@ + net472 - false false + false + + + + + + + + + + + + + @@ -27,4 +53,5 @@ + diff --git a/eng/common/native/CommonLibrary.psm1 b/eng/common/native/CommonLibrary.psm1 index ca38268c44d..f71f6af6cdb 100644 --- a/eng/common/native/CommonLibrary.psm1 +++ b/eng/common/native/CommonLibrary.psm1 @@ -277,7 +277,8 @@ function Get-MachineArchitecture { if (($ProcessorArchitecture -Eq "AMD64") -Or ($ProcessorArchitecture -Eq "IA64") -Or ($ProcessorArchitecture -Eq "ARM64") -Or - ($ProcessorArchitecture -Eq "LOONGARCH64")) { + ($ProcessorArchitecture -Eq "LOONGARCH64") -Or + ($ProcessorArchitecture -Eq "RISCV64")) { return "x64" } return "x86" diff --git a/eng/common/native/init-compiler.sh b/eng/common/native/init-compiler.sh index 2d5660642b8..9a0e1f2b456 100644 --- a/eng/common/native/init-compiler.sh +++ b/eng/common/native/init-compiler.sh @@ -2,7 +2,9 @@ # # This file detects the C/C++ compiler and exports it to the CC/CXX environment variables # -# NOTE: some scripts source this file and rely on stdout being empty, make sure to not output anything here! +# NOTE: some scripts source this file and rely on stdout being empty, make sure +# to not output *anything* here, unless it is an error message that fails the +# build. if [ -z "$build_arch" ] || [ -z "$compiler" ]; then echo "Usage..." @@ -17,11 +19,9 @@ case "$compiler" in # clangx.y or clang-x.y version="$(echo "$compiler" | tr -d '[:alpha:]-=')" majorVersion="${version%%.*}" - [ -z "${version##*.*}" ] && minorVersion="${version#*.}" - if [ -z "$minorVersion" ] && [ -n "$majorVersion" ] && [ "$majorVersion" -le 6 ]; then - minorVersion=0; - fi + # LLVM based on v18 released in early 2024, with two releases per year + maxVersion="$((18 + ((($(date +%Y) - 2024) * 12 + $(date +%-m) - 3) / 6)))" compiler=clang ;; @@ -29,7 +29,9 @@ case "$compiler" in # gccx.y or gcc-x.y version="$(echo "$compiler" | tr -d '[:alpha:]-=')" majorVersion="${version%%.*}" - [ -z "${version##*.*}" ] && minorVersion="${version#*.}" + + # GCC based on v14 released in early 2024, with one release per year + maxVersion="$((14 + ((($(date +%Y) - 2024) * 12 + $(date +%-m) - 3) / 12)))" compiler=gcc ;; esac @@ -47,91 +49,98 @@ check_version_exists() { desired_version=-1 # Set up the environment to be used for building with the desired compiler. - if command -v "$compiler-$1.$2" > /dev/null; then - desired_version="-$1.$2" - elif command -v "$compiler$1$2" > /dev/null; then - desired_version="$1$2" - elif command -v "$compiler-$1$2" > /dev/null; then - desired_version="-$1$2" + if command -v "$compiler-$1" > /dev/null; then + desired_version="-$1" + elif command -v "$compiler$1" > /dev/null; then + desired_version="$1" fi echo "$desired_version" } +__baseOS="$(uname)" +set_compiler_version_from_CC() { + if [ "$__baseOS" = "Darwin" ]; then + # On Darwin, the versions from -version/-dumpversion refer to Xcode + # versions, not llvm versions, so we can't rely on them. + return + fi + + version="$("$CC" -dumpversion)" + if [ -z "$version" ]; then + echo "Error: $CC -dumpversion didn't provide a version" + exit 1 + fi + + # gcc and clang often display 3 part versions. However, gcc can show only 1 part in some environments. + IFS=. read -r majorVersion _ < /dev/null; then - if [ "$(uname)" != "Darwin" ]; then - echo "Warning: Specific version of $compiler not found, falling back to use the one in PATH." - fi - CC="$(command -v "$compiler")" - CXX="$(command -v "$cxxCompiler")" - else - echo "No usable version of $compiler found." + if ! command -v "$compiler" > /dev/null; then + echo "Error: No compatible version of $compiler was found within the range of $minVersion to $maxVersion. Please upgrade your toolchain or specify the compiler explicitly using CLR_CC and CLR_CXX environment variables." exit 1 fi - else - if [ "$compiler" = "clang" ] && [ "$majorVersion" -lt 5 ]; then - if [ "$build_arch" = "arm" ] || [ "$build_arch" = "armel" ]; then - if command -v "$compiler" > /dev/null; then - echo "Warning: Found clang version $majorVersion which is not supported on arm/armel architectures, falling back to use clang from PATH." - CC="$(command -v "$compiler")" - CXX="$(command -v "$cxxCompiler")" - else - echo "Found clang version $majorVersion which is not supported on arm/armel architectures, and there is no clang in PATH." - exit 1 - fi - fi - fi + + CC="$(command -v "$compiler" 2> /dev/null)" + CXX="$(command -v "$cxxCompiler" 2> /dev/null)" + set_compiler_version_from_CC fi else - desired_version="$(check_version_exists "$majorVersion" "$minorVersion")" + desired_version="$(check_version_exists "$majorVersion")" if [ "$desired_version" = "-1" ]; then - echo "Could not find specific version of $compiler: $majorVersion $minorVersion." + echo "Error: Could not find specific version of $compiler: $majorVersion." exit 1 fi fi if [ -z "$CC" ]; then - CC="$(command -v "$compiler$desired_version")" - CXX="$(command -v "$cxxCompiler$desired_version")" - if [ -z "$CXX" ]; then CXX="$(command -v "$cxxCompiler")"; fi + CC="$(command -v "$compiler$desired_version" 2> /dev/null)" + CXX="$(command -v "$cxxCompiler$desired_version" 2> /dev/null)" + if [ -z "$CXX" ]; then CXX="$(command -v "$cxxCompiler" 2> /dev/null)"; fi + set_compiler_version_from_CC fi else if [ ! -f "$CLR_CC" ]; then - echo "CLR_CC is set but path '$CLR_CC' does not exist" + echo "Error: CLR_CC is set but path '$CLR_CC' does not exist" exit 1 fi CC="$CLR_CC" CXX="$CLR_CXX" + set_compiler_version_from_CC fi if [ -z "$CC" ]; then - echo "Unable to find $compiler." + echo "Error: Unable to find $compiler." exit 1 fi -# Only lld version >= 9 can be considered stable. lld doesn't support s390x. -if [ "$compiler" = "clang" ] && [ -n "$majorVersion" ] && [ "$majorVersion" -ge 9 ] && [ "$build_arch" != "s390x" ]; then - if "$CC" -fuse-ld=lld -Wl,--version >/dev/null 2>&1; then - LDFLAGS="-fuse-ld=lld" +if [ "$__baseOS" != "Darwin" ]; then + # On Darwin, we always want to use the Apple linker. + + # Only lld version >= 9 can be considered stable. lld supports s390x starting from 18.0. + if [ "$compiler" = "clang" ] && [ -n "$majorVersion" ] && [ "$majorVersion" -ge 9 ] && { [ "$build_arch" != "s390x" ] || [ "$majorVersion" -ge 18 ]; }; then + if "$CC" -fuse-ld=lld -Wl,--version >/dev/null 2>&1; then + LDFLAGS="-fuse-ld=lld" + fi fi fi -SCAN_BUILD_COMMAND="$(command -v "scan-build$desired_version")" +SCAN_BUILD_COMMAND="$(command -v "scan-build$desired_version" 2> /dev/null)" export CC CXX LDFLAGS SCAN_BUILD_COMMAND diff --git a/eng/common/native/init-distro-rid.sh b/eng/common/native/init-distro-rid.sh index de1687b2ccb..83ea7aab0e0 100644 --- a/eng/common/native/init-distro-rid.sh +++ b/eng/common/native/init-distro-rid.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # getNonPortableDistroRid # @@ -11,21 +11,16 @@ # non-portable rid getNonPortableDistroRid() { - local targetOs="$1" - local targetArch="$2" - local rootfsDir="$3" - local nonPortableRid="" + targetOs="$1" + targetArch="$2" + rootfsDir="$3" + nonPortableRid="" if [ "$targetOs" = "linux" ]; then + # shellcheck disable=SC1091 if [ -e "${rootfsDir}/etc/os-release" ]; then - source "${rootfsDir}/etc/os-release" - - if [[ "${ID}" == "rhel" || "${ID}" == "rocky" || "${ID}" == "alpine" ]]; then - # remove the last version digit - VERSION_ID="${VERSION_ID%.*}" - fi - - if [[ "${VERSION_ID:-}" =~ ^([[:digit:]]|\.)+$ ]]; then + . "${rootfsDir}/etc/os-release" + if echo "${VERSION_ID:-}" | grep -qE '^([[:digit:]]|\.)+$'; then nonPortableRid="${ID}.${VERSION_ID}-${targetArch}" else # Rolling release distros either do not set VERSION_ID, set it as blank or @@ -33,45 +28,33 @@ getNonPortableDistroRid() # so omit it here to be consistent with everything else. nonPortableRid="${ID}-${targetArch}" fi - elif [ -e "${rootfsDir}/android_platform" ]; then - source "$rootfsDir"/android_platform + # shellcheck disable=SC1091 + . "${rootfsDir}/android_platform" nonPortableRid="$RID" fi fi if [ "$targetOs" = "freebsd" ]; then - # $rootfsDir can be empty. freebsd-version is shell script and it should always work. - __freebsd_major_version=$($rootfsDir/bin/freebsd-version | { read v; echo "${v%%.*}"; }) + # $rootfsDir can be empty. freebsd-version is a shell script and should always work. + __freebsd_major_version=$("$rootfsDir"/bin/freebsd-version | cut -d'.' -f1) nonPortableRid="freebsd.$__freebsd_major_version-${targetArch}" - elif command -v getprop && getprop ro.product.system.model 2>&1 | grep -qi android; then + elif command -v getprop >/dev/null && getprop ro.product.system.model | grep -qi android; then __android_sdk_version=$(getprop ro.build.version.sdk) nonPortableRid="android.$__android_sdk_version-${targetArch}" elif [ "$targetOs" = "illumos" ]; then __uname_version=$(uname -v) - case "$__uname_version" in - omnios-*) - __omnios_major_version=$(echo "${__uname_version:8:2}") - nonPortableRid=omnios."$__omnios_major_version"-"$targetArch" - ;; - joyent_*) - __smartos_major_version=$(echo "${__uname_version:7:4}") - nonPortableRid=smartos."$__smartos_major_version"-"$targetArch" - ;; - illumos_*) - nonPortableRid=openindiana-"$targetArch" - ;; - esac + nonPortableRid="illumos-${targetArch}" elif [ "$targetOs" = "solaris" ]; then __uname_version=$(uname -v) - __solaris_major_version=$(echo "${__uname_version%.*}") - nonPortableRid=solaris."$__solaris_major_version"-"$targetArch" + __solaris_major_version=$(echo "$__uname_version" | cut -d'.' -f1) + nonPortableRid="solaris.$__solaris_major_version-${targetArch}" elif [ "$targetOs" = "haiku" ]; then - __uname_release=$(uname -r) + __uname_release="$(uname -r)" nonPortableRid=haiku.r"$__uname_release"-"$targetArch" fi - echo "$(echo $nonPortableRid | tr '[:upper:]' '[:lower:]')" + echo "$nonPortableRid" | tr '[:upper:]' '[:lower:]' } # initDistroRidGlobal @@ -85,26 +68,23 @@ getNonPortableDistroRid() # None # # Notes: -# -# It is important to note that the function does not return anything, but it -# exports the following variables on success: -# -# __DistroRid : Non-portable rid of the target platform. -# __PortableTargetOS : OS-part of the portable rid that corresponds to the target platform. -# +# It is important to note that the function does not return anything, but it +# exports the following variables on success: +# __DistroRid : Non-portable rid of the target platform. +# __PortableTargetOS : OS-part of the portable rid that corresponds to the target platform. initDistroRidGlobal() { - local targetOs="$1" - local targetArch="$2" - local rootfsDir="" - if [ "$#" -ge 3 ]; then + targetOs="$1" + targetArch="$2" + rootfsDir="" + if [ $# -ge 3 ]; then rootfsDir="$3" fi if [ -n "${rootfsDir}" ]; then # We may have a cross build. Check for the existence of the rootfsDir if [ ! -e "${rootfsDir}" ]; then - echo "Error rootfsDir has been passed, but the location is not valid." + echo "Error: rootfsDir has been passed, but the location is not valid." exit 1 fi fi @@ -119,7 +99,7 @@ initDistroRidGlobal() STRINGS="$(command -v llvm-strings || true)" fi - # Check for musl-based distros (e.g Alpine Linux, Void Linux). + # Check for musl-based distros (e.g. Alpine Linux, Void Linux). if "${rootfsDir}/usr/bin/ldd" --version 2>&1 | grep -q musl || ( [ -n "$STRINGS" ] && "$STRINGS" "${rootfsDir}/usr/bin/ldd" 2>&1 | grep -q musl ); then __PortableTargetOS="linux-musl" diff --git a/eng/common/native/init-os-and-arch.sh b/eng/common/native/init-os-and-arch.sh index e693617a6c2..38921d4338f 100644 --- a/eng/common/native/init-os-and-arch.sh +++ b/eng/common/native/init-os-and-arch.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # Use uname to determine what the OS is. OSName=$(uname -s | tr '[:upper:]' '[:lower:]') @@ -35,6 +35,10 @@ fi case "$CPUName" in arm64|aarch64) arch=arm64 + if [ "$(getconf LONG_BIT)" -lt 64 ]; then + # This is 32-bit OS running on 64-bit CPU (for example Raspberry Pi OS) + arch=arm + fi ;; loongarch64) @@ -50,6 +54,7 @@ case "$CPUName" in ;; armv7l|armv8l) + # shellcheck disable=SC1091 if (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then arch=armel else diff --git a/eng/common/post-build/add-build-to-channel.ps1 b/eng/common/post-build/add-build-to-channel.ps1 deleted file mode 100644 index 49938f0c89f..00000000000 --- a/eng/common/post-build/add-build-to-channel.ps1 +++ /dev/null @@ -1,48 +0,0 @@ -param( - [Parameter(Mandatory=$true)][int] $BuildId, - [Parameter(Mandatory=$true)][int] $ChannelId, - [Parameter(Mandatory=$true)][string] $MaestroApiAccessToken, - [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net', - [Parameter(Mandatory=$false)][string] $MaestroApiVersion = '2019-01-16' -) - -try { - . $PSScriptRoot\post-build-utils.ps1 - - # Check that the channel we are going to promote the build to exist - $channelInfo = Get-MaestroChannel -ChannelId $ChannelId - - if (!$channelInfo) { - Write-PipelineTelemetryCategory -Category 'PromoteBuild' -Message "Channel with BAR ID $ChannelId was not found in BAR!" - ExitWithExitCode 1 - } - - # Get info about which channel(s) the build has already been promoted to - $buildInfo = Get-MaestroBuild -BuildId $BuildId - - if (!$buildInfo) { - Write-PipelineTelemetryError -Category 'PromoteBuild' -Message "Build with BAR ID $BuildId was not found in BAR!" - ExitWithExitCode 1 - } - - # Find whether the build is already assigned to the channel or not - if ($buildInfo.channels) { - foreach ($channel in $buildInfo.channels) { - if ($channel.Id -eq $ChannelId) { - Write-Host "The build with BAR ID $BuildId is already on channel $ChannelId!" - ExitWithExitCode 0 - } - } - } - - Write-Host "Promoting build '$BuildId' to channel '$ChannelId'." - - Assign-BuildToChannel -BuildId $BuildId -ChannelId $ChannelId - - Write-Host 'done.' -} -catch { - Write-Host $_ - Write-PipelineTelemetryError -Category 'PromoteBuild' -Message "There was an error while trying to promote build '$BuildId' to channel '$ChannelId'" - ExitWithExitCode 1 -} diff --git a/eng/common/post-build/check-channel-consistency.ps1 b/eng/common/post-build/check-channel-consistency.ps1 index 63f3464c986..61208d2d135 100644 --- a/eng/common/post-build/check-channel-consistency.ps1 +++ b/eng/common/post-build/check-channel-consistency.ps1 @@ -4,10 +4,18 @@ param( ) try { - . $PSScriptRoot\post-build-utils.ps1 + $ErrorActionPreference = 'Stop' + Set-StrictMode -Version 2.0 + + # `tools.ps1` checks $ci to perform some actions. Since the post-build + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + $disableConfigureToolsetImport = $true + . $PSScriptRoot\..\tools.ps1 if ($PromoteToChannels -eq "") { - Write-PipelineTaskError -Type 'warning' -Message "This build won't publish assets as it's not configured to any Maestro channel. If that wasn't intended use Darc to configure a default channel using add-default-channel for this branch or to promote it to a channel using add-build-to-channel. See https://github.com/dotnet/arcade/blob/master/Documentation/Darc.md#assigning-an-individual-build-to-a-channel for more info." + Write-PipelineTaskError -Type 'warning' -Message "This build won't publish assets as it's not configured to any Maestro channel. If that wasn't intended use Darc to configure a default channel using add-default-channel for this branch or to promote it to a channel using add-build-to-channel. See https://github.com/dotnet/arcade/blob/main/Documentation/Darc.md#assigning-an-individual-build-to-a-channel for more info." ExitWithExitCode 0 } diff --git a/eng/common/post-build/nuget-validation.ps1 b/eng/common/post-build/nuget-validation.ps1 index dab3534ab53..e5de00c8983 100644 --- a/eng/common/post-build/nuget-validation.ps1 +++ b/eng/common/post-build/nuget-validation.ps1 @@ -2,20 +2,18 @@ # tool: https://github.com/NuGet/NuGetGallery/tree/jver-verify/src/VerifyMicrosoftPackage param( - [Parameter(Mandatory=$true)][string] $PackagesPath, # Path to where the packages to be validated are - [Parameter(Mandatory=$true)][string] $ToolDestinationPath # Where the validation tool should be downloaded to + [Parameter(Mandatory=$true)][string] $PackagesPath # Path to where the packages to be validated are ) -try { - . $PSScriptRoot\post-build-utils.ps1 - - $url = 'https://raw.githubusercontent.com/NuGet/NuGetGallery/3e25ad135146676bcab0050a516939d9958bfa5d/src/VerifyMicrosoftPackage/verify.ps1' - - New-Item -ItemType 'directory' -Path ${ToolDestinationPath} -Force +# `tools.ps1` checks $ci to perform some actions. Since the post-build +# scripts don't necessarily execute in the same agent that run the +# build.ps1/sh script this variable isn't automatically set. +$ci = $true +$disableConfigureToolsetImport = $true +. $PSScriptRoot\..\tools.ps1 - Invoke-WebRequest $url -OutFile ${ToolDestinationPath}\verify.ps1 - - & ${ToolDestinationPath}\verify.ps1 ${PackagesPath}\*.nupkg +try { + & $PSScriptRoot\nuget-verification.ps1 ${PackagesPath}\*.nupkg } catch { Write-Host $_.ScriptStackTrace diff --git a/eng/common/post-build/nuget-verification.ps1 b/eng/common/post-build/nuget-verification.ps1 new file mode 100644 index 00000000000..a365194a938 --- /dev/null +++ b/eng/common/post-build/nuget-verification.ps1 @@ -0,0 +1,121 @@ +<# +.SYNOPSIS + Verifies that Microsoft NuGet packages have proper metadata. +.DESCRIPTION + Downloads a verification tool and runs metadata validation on the provided NuGet packages. This script writes an + error if any of the provided packages fail validation. All arguments provided to this PowerShell script that do not + match PowerShell parameters are passed on to the verification tool downloaded during the execution of this script. +.PARAMETER NuGetExePath + The path to the nuget.exe binary to use. If not provided, nuget.exe will be downloaded into the -DownloadPath + directory. +.PARAMETER PackageSource + The package source to use to download the verification tool. If not provided, nuget.org will be used. +.PARAMETER DownloadPath + The directory path to download the verification tool and nuget.exe to. If not provided, + %TEMP%\NuGet.VerifyNuGetPackage will be used. +.PARAMETER args + Arguments that will be passed to the verification tool. +.EXAMPLE + PS> .\verify.ps1 *.nupkg + Verifies the metadata of all .nupkg files in the currect working directory. +.EXAMPLE + PS> .\verify.ps1 --help + Displays the help text of the downloaded verifiction tool. +.LINK + https://github.com/NuGet/NuGetGallery/blob/master/src/VerifyMicrosoftPackage/README.md +#> + +# This script was copied from https://github.com/NuGet/NuGetGallery/blob/3e25ad135146676bcab0050a516939d9958bfa5d/src/VerifyMicrosoftPackage/verify.ps1 + +[CmdletBinding(PositionalBinding = $false)] +param( + [string]$NuGetExePath, + [string]$PackageSource = "https://api.nuget.org/v3/index.json", + [string]$DownloadPath, + [Parameter(ValueFromRemainingArguments = $true)] + [string[]]$args +) + +# The URL to download nuget.exe. +$nugetExeUrl = "https://dist.nuget.org/win-x86-commandline/v4.9.4/nuget.exe" + +# The package ID of the verification tool. +$packageId = "NuGet.VerifyMicrosoftPackage" + +# The location that nuget.exe and the verification tool will be downloaded to. +if (!$DownloadPath) { + $DownloadPath = (Join-Path $env:TEMP "NuGet.VerifyMicrosoftPackage") +} + +$fence = New-Object -TypeName string -ArgumentList '=', 80 + +# Create the download directory, if it doesn't already exist. +if (!(Test-Path $DownloadPath)) { + New-Item -ItemType Directory $DownloadPath | Out-Null +} +Write-Host "Using download path: $DownloadPath" + +if ($NuGetExePath) { + $nuget = $NuGetExePath +} else { + $downloadedNuGetExe = Join-Path $DownloadPath "nuget.exe" + + # Download nuget.exe, if it doesn't already exist. + if (!(Test-Path $downloadedNuGetExe)) { + Write-Host "Downloading nuget.exe from $nugetExeUrl..." + $ProgressPreference = 'SilentlyContinue' + try { + Invoke-WebRequest $nugetExeUrl -OutFile $downloadedNuGetExe + $ProgressPreference = 'Continue' + } catch { + $ProgressPreference = 'Continue' + Write-Error $_ + Write-Error "nuget.exe failed to download." + exit + } + } + + $nuget = $downloadedNuGetExe +} + +Write-Host "Using nuget.exe path: $nuget" +Write-Host " " + +# Download the latest version of the verification tool. +Write-Host "Downloading the latest version of $packageId from $packageSource..." +Write-Host $fence +& $nuget install $packageId ` + -Prerelease ` + -OutputDirectory $DownloadPath ` + -Source $PackageSource +Write-Host $fence +Write-Host " " + +if ($LASTEXITCODE -ne 0) { + Write-Error "nuget.exe failed to fetch the verify tool." + exit +} + +# Find the most recently downloaded tool +Write-Host "Finding the most recently downloaded verification tool." +$verifyProbePath = Join-Path $DownloadPath "$packageId.*" +$verifyPath = Get-ChildItem -Path $verifyProbePath -Directory ` + | Sort-Object -Property LastWriteTime -Descending ` + | Select-Object -First 1 +$verify = Join-Path $verifyPath "tools\NuGet.VerifyMicrosoftPackage.exe" +Write-Host "Using verification tool: $verify" +Write-Host " " + +# Execute the verification tool. +Write-Host "Executing the verify tool..." +Write-Host $fence +& $verify $args +Write-Host $fence +Write-Host " " + +# Respond to the exit code. +if ($LASTEXITCODE -ne 0) { + Write-Error "The verify tool found some problems." +} else { + Write-Output "The verify tool succeeded." +} diff --git a/eng/common/post-build/post-build-utils.ps1 b/eng/common/post-build/post-build-utils.ps1 deleted file mode 100644 index 534f6988d5b..00000000000 --- a/eng/common/post-build/post-build-utils.ps1 +++ /dev/null @@ -1,91 +0,0 @@ -# Most of the functions in this file require the variables `MaestroApiEndPoint`, -# `MaestroApiVersion` and `MaestroApiAccessToken` to be globally available. - -$ErrorActionPreference = 'Stop' -Set-StrictMode -Version 2.0 - -# `tools.ps1` checks $ci to perform some actions. Since the post-build -# scripts don't necessarily execute in the same agent that run the -# build.ps1/sh script this variable isn't automatically set. -$ci = $true -$disableConfigureToolsetImport = $true -. $PSScriptRoot\..\tools.ps1 - -function Create-MaestroApiRequestHeaders([string]$ContentType = 'application/json') { - Validate-MaestroVars - - $headers = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' - $headers.Add('Accept', $ContentType) - $headers.Add('Authorization',"Bearer $MaestroApiAccessToken") - return $headers -} - -function Get-MaestroChannel([int]$ChannelId) { - Validate-MaestroVars - - $apiHeaders = Create-MaestroApiRequestHeaders - $apiEndpoint = "$MaestroApiEndPoint/api/channels/${ChannelId}?api-version=$MaestroApiVersion" - - $result = try { Invoke-WebRequest -Method Get -Uri $apiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } - return $result -} - -function Get-MaestroBuild([int]$BuildId) { - Validate-MaestroVars - - $apiHeaders = Create-MaestroApiRequestHeaders -AuthToken $MaestroApiAccessToken - $apiEndpoint = "$MaestroApiEndPoint/api/builds/${BuildId}?api-version=$MaestroApiVersion" - - $result = try { return Invoke-WebRequest -Method Get -Uri $apiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } - return $result -} - -function Get-MaestroSubscriptions([string]$SourceRepository, [int]$ChannelId) { - Validate-MaestroVars - - $SourceRepository = [System.Web.HttpUtility]::UrlEncode($SourceRepository) - $apiHeaders = Create-MaestroApiRequestHeaders -AuthToken $MaestroApiAccessToken - $apiEndpoint = "$MaestroApiEndPoint/api/subscriptions?sourceRepository=$SourceRepository&channelId=$ChannelId&api-version=$MaestroApiVersion" - - $result = try { Invoke-WebRequest -Method Get -Uri $apiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } - return $result -} - -function Assign-BuildToChannel([int]$BuildId, [int]$ChannelId) { - Validate-MaestroVars - - $apiHeaders = Create-MaestroApiRequestHeaders -AuthToken $MaestroApiAccessToken - $apiEndpoint = "$MaestroApiEndPoint/api/channels/${ChannelId}/builds/${BuildId}?api-version=$MaestroApiVersion" - Invoke-WebRequest -Method Post -Uri $apiEndpoint -Headers $apiHeaders | Out-Null -} - -function Trigger-Subscription([string]$SubscriptionId) { - Validate-MaestroVars - - $apiHeaders = Create-MaestroApiRequestHeaders -AuthToken $MaestroApiAccessToken - $apiEndpoint = "$MaestroApiEndPoint/api/subscriptions/$SubscriptionId/trigger?api-version=$MaestroApiVersion" - Invoke-WebRequest -Uri $apiEndpoint -Headers $apiHeaders -Method Post | Out-Null -} - -function Validate-MaestroVars { - try { - Get-Variable MaestroApiEndPoint | Out-Null - Get-Variable MaestroApiVersion | Out-Null - Get-Variable MaestroApiAccessToken | Out-Null - - if (!($MaestroApiEndPoint -Match '^http[s]?://maestro-(int|prod).westus2.cloudapp.azure.com$')) { - Write-PipelineTelemetryError -Category 'MaestroVars' -Message "MaestroApiEndPoint is not a valid Maestro URL. '$MaestroApiEndPoint'" - ExitWithExitCode 1 - } - - if (!($MaestroApiVersion -Match '^[0-9]{4}-[0-9]{2}-[0-9]{2}$')) { - Write-PipelineTelemetryError -Category 'MaestroVars' -Message "MaestroApiVersion does not match a version string in the format yyyy-MM-DD. '$MaestroApiVersion'" - ExitWithExitCode 1 - } - } - catch { - Write-PipelineTelemetryError -Category 'MaestroVars' -Message 'Error: Variables `MaestroApiEndPoint`, `MaestroApiVersion` and `MaestroApiAccessToken` are required while using this script.' - Write-Host $_ - ExitWithExitCode 1 - } -} diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1 index 5a3a32ea8d7..90b58e32a87 100644 --- a/eng/common/post-build/publish-using-darc.ps1 +++ b/eng/common/post-build/publish-using-darc.ps1 @@ -2,7 +2,6 @@ param( [Parameter(Mandatory=$true)][int] $BuildId, [Parameter(Mandatory=$true)][int] $PublishingInfraVersion, [Parameter(Mandatory=$true)][string] $AzdoToken, - [Parameter(Mandatory=$true)][string] $MaestroToken, [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net', [Parameter(Mandatory=$true)][string] $WaitPublishingFinish, [Parameter(Mandatory=$false)][string] $ArtifactsPublishingAdditionalParameters, @@ -10,7 +9,12 @@ param( ) try { - . $PSScriptRoot\post-build-utils.ps1 + # `tools.ps1` checks $ci to perform some actions. Since the post-build + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + $disableConfigureToolsetImport = $true + . $PSScriptRoot\..\tools.ps1 $darc = Get-Darc @@ -31,13 +35,14 @@ try { } & $darc add-build-to-channel ` - --id $buildId ` - --publishing-infra-version $PublishingInfraVersion ` - --default-channels ` - --source-branch main ` - --azdev-pat $AzdoToken ` - --bar-uri $MaestroApiEndPoint ` - --password $MaestroToken ` + --id $buildId ` + --publishing-infra-version $PublishingInfraVersion ` + --default-channels ` + --source-branch main ` + --azdev-pat "$AzdoToken" ` + --bar-uri "$MaestroApiEndPoint" ` + --ci ` + --verbose ` @optionalParams if ($LastExitCode -ne 0) { diff --git a/eng/common/post-build/redact-logs.ps1 b/eng/common/post-build/redact-logs.ps1 new file mode 100644 index 00000000000..b7fc1959150 --- /dev/null +++ b/eng/common/post-build/redact-logs.ps1 @@ -0,0 +1,89 @@ +[CmdletBinding(PositionalBinding=$False)] +param( + [Parameter(Mandatory=$true, Position=0)][string] $InputPath, + [Parameter(Mandatory=$true)][string] $BinlogToolVersion, + [Parameter(Mandatory=$false)][string] $DotnetPath, + [Parameter(Mandatory=$false)][string] $PackageFeed = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json', + # File with strings to redact - separated by newlines. + # For comments start the line with '# ' - such lines are ignored + [Parameter(Mandatory=$false)][string] $TokensFilePath, + [Parameter(ValueFromRemainingArguments=$true)][String[]]$TokensToRedact +) + +try { + $ErrorActionPreference = 'Stop' + Set-StrictMode -Version 2.0 + + # `tools.ps1` checks $ci to perform some actions. Since the post-build + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + $disableConfigureToolsetImport = $true + . $PSScriptRoot\..\tools.ps1 + + $packageName = 'binlogtool' + + $dotnet = $DotnetPath + + if (!$dotnet) { + $dotnetRoot = InitializeDotNetCli -install:$true + $dotnet = "$dotnetRoot\dotnet.exe" + } + + $toolList = & "$dotnet" tool list -g + + if ($toolList -like "*$packageName*") { + & "$dotnet" tool uninstall $packageName -g + } + + $toolPath = "$PSScriptRoot\..\..\..\.tools" + $verbosity = 'minimal' + + New-Item -ItemType Directory -Force -Path $toolPath + + Push-Location -Path $toolPath + + try { + Write-Host "Installing Binlog redactor CLI..." + Write-Host "'$dotnet' new tool-manifest" + & "$dotnet" new tool-manifest + Write-Host "'$dotnet' tool install $packageName --local --add-source '$PackageFeed' -v $verbosity --version $BinlogToolVersion" + & "$dotnet" tool install $packageName --local --add-source "$PackageFeed" -v $verbosity --version $BinlogToolVersion + + if (Test-Path $TokensFilePath) { + Write-Host "Adding additional sensitive data for redaction from file: " $TokensFilePath + $TokensToRedact += Get-Content -Path $TokensFilePath | Foreach {$_.Trim()} | Where { $_ -notmatch "^# " } + } + + $optionalParams = [System.Collections.ArrayList]::new() + + Foreach ($p in $TokensToRedact) + { + if($p -match '^\$\(.*\)$') + { + Write-Host ("Ignoring token {0} as it is probably unexpanded AzDO variable" -f $p) + } + elseif($p) + { + $optionalParams.Add("-p:" + $p) | Out-Null + } + } + + & $dotnet binlogtool redact --input:$InputPath --recurse --in-place ` + @optionalParams + + if ($LastExitCode -ne 0) { + Write-PipelineTelemetryError -Category 'Redactor' -Type 'warning' -Message "Problems using Redactor tool (exit code: $LastExitCode). But ignoring them now." + } + } + finally { + Pop-Location + } + + Write-Host 'done.' +} +catch { + Write-Host $_ + Write-PipelineTelemetryError -Category 'Redactor' -Message "There was an error while trying to redact logs. Error: $_" + ExitWithExitCode 1 +} diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 index 4011d324e73..1976ef70fb8 100644 --- a/eng/common/post-build/sourcelink-validation.ps1 +++ b/eng/common/post-build/sourcelink-validation.ps1 @@ -6,7 +6,15 @@ param( [Parameter(Mandatory=$true)][string] $SourcelinkCliVersion # Version of SourceLink CLI to use ) -. $PSScriptRoot\post-build-utils.ps1 +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 + +# `tools.ps1` checks $ci to perform some actions. Since the post-build +# scripts don't necessarily execute in the same agent that run the +# build.ps1/sh script this variable isn't automatically set. +$ci = $true +$disableConfigureToolsetImport = $true +. $PSScriptRoot\..\tools.ps1 # Cache/HashMap (File -> Exist flag) used to consult whether a file exist # in the repository at a specific commit point. This is populated by inserting diff --git a/eng/common/post-build/symbols-validation.ps1 b/eng/common/post-build/symbols-validation.ps1 index cd2181bafa0..7146e593ffa 100644 --- a/eng/common/post-build/symbols-validation.ps1 +++ b/eng/common/post-build/symbols-validation.ps1 @@ -322,8 +322,6 @@ function InstallDotnetSymbol { } try { - . $PSScriptRoot\post-build-utils.ps1 - InstallDotnetSymbol foreach ($Job in @(Get-Job)) { diff --git a/eng/common/post-build/trigger-subscriptions.ps1 b/eng/common/post-build/trigger-subscriptions.ps1 deleted file mode 100644 index ac9a95778fc..00000000000 --- a/eng/common/post-build/trigger-subscriptions.ps1 +++ /dev/null @@ -1,64 +0,0 @@ -param( - [Parameter(Mandatory=$true)][string] $SourceRepo, - [Parameter(Mandatory=$true)][int] $ChannelId, - [Parameter(Mandatory=$true)][string] $MaestroApiAccessToken, - [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net', - [Parameter(Mandatory=$false)][string] $MaestroApiVersion = '2019-01-16' -) - -try { - . $PSScriptRoot\post-build-utils.ps1 - - # Get all the $SourceRepo subscriptions - $normalizedSourceRepo = $SourceRepo.Replace('dnceng@', '') - $subscriptions = Get-MaestroSubscriptions -SourceRepository $normalizedSourceRepo -ChannelId $ChannelId - - if (!$subscriptions) { - Write-PipelineTelemetryError -Category 'TriggerSubscriptions' -Message "No subscriptions found for source repo '$normalizedSourceRepo' in channel '$ChannelId'" - ExitWithExitCode 0 - } - - $subscriptionsToTrigger = New-Object System.Collections.Generic.List[string] - $failedTriggeredSubscription = $false - - # Get all enabled subscriptions that need dependency flow on 'everyBuild' - foreach ($subscription in $subscriptions) { - if ($subscription.enabled -and $subscription.policy.updateFrequency -like 'everyBuild' -and $subscription.channel.id -eq $ChannelId) { - Write-Host "Should trigger this subscription: ${$subscription.id}" - [void]$subscriptionsToTrigger.Add($subscription.id) - } - } - - foreach ($subscriptionToTrigger in $subscriptionsToTrigger) { - try { - Write-Host "Triggering subscription '$subscriptionToTrigger'." - - Trigger-Subscription -SubscriptionId $subscriptionToTrigger - - Write-Host 'done.' - } - catch - { - Write-Host "There was an error while triggering subscription '$subscriptionToTrigger'" - Write-Host $_ - Write-Host $_.ScriptStackTrace - $failedTriggeredSubscription = $true - } - } - - if ($subscriptionsToTrigger.Count -eq 0) { - Write-Host "No subscription matched source repo '$normalizedSourceRepo' and channel ID '$ChannelId'." - } - elseif ($failedTriggeredSubscription) { - Write-PipelineTelemetryError -Category 'TriggerSubscriptions' -Message 'At least one subscription failed to be triggered...' - ExitWithExitCode 1 - } - else { - Write-Host 'All subscriptions were triggered successfully!' - } -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category 'TriggerSubscriptions' -Message $_ - ExitWithExitCode 1 -} diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 index 73828dd30d3..aab40de3fd9 100644 --- a/eng/common/sdk-task.ps1 +++ b/eng/common/sdk-task.ps1 @@ -64,7 +64,7 @@ try { $GlobalJson.tools | Add-Member -Name "vs" -Value (ConvertFrom-Json "{ `"version`": `"16.5`" }") -MemberType NoteProperty } if( -not ($GlobalJson.tools.PSObject.Properties.Name -match "xcopy-msbuild" )) { - $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.8.1-2" -MemberType NoteProperty + $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.10.0-pre.4.0" -MemberType NoteProperty } if ($GlobalJson.tools."xcopy-msbuild".Trim() -ine "none") { $xcopyMSBuildToolsFolder = InitializeXCopyMSBuild $GlobalJson.tools."xcopy-msbuild" -install $true diff --git a/eng/common/sdl/trim-assets-version.ps1 b/eng/common/sdl/trim-assets-version.ps1 index a2e00487704..0daa2a9e946 100644 --- a/eng/common/sdl/trim-assets-version.ps1 +++ b/eng/common/sdl/trim-assets-version.ps1 @@ -72,4 +72,4 @@ catch { Write-Host $_ Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ ExitWithExitCode 1 -} \ No newline at end of file +} diff --git a/eng/common/template-guidance.md b/eng/common/template-guidance.md new file mode 100644 index 00000000000..5ef6c30ba92 --- /dev/null +++ b/eng/common/template-guidance.md @@ -0,0 +1,133 @@ +# Overview + +Arcade provides templates for public (`/templates`) and 1ES pipeline templates (`/templates-official`) scenarios. Pipelines which are required to be managed by 1ES pipeline templates should reference `/templates-offical`, all other pipelines may reference `/templates`. + +## How to use + +Basic guidance is: + +- 1ES Pipeline Template or 1ES Microbuild template runs should reference `eng/common/templates-official`. Any internal production-graded pipeline should use these templates. + +- All other runs should reference `eng/common/templates`. + +See [azure-pipelines.yml](../../azure-pipelines.yml) (templates-official example) or [azure-pipelines-pr.yml](../../azure-pipelines-pr.yml) (templates example) for examples. + +#### The `templateIs1ESManaged` parameter + +The `templateIs1ESManaged` is available on most templates and affects which of the variants is used for nested templates. See [Development Notes](#development-notes) below for more information on the `templateIs1ESManaged1 parameter. + +- For templates under `job/`, `jobs/`, `steps`, or `post-build/`, this parameter must be explicitly set. + +## Multiple outputs + +1ES pipeline templates impose a policy where every publish artifact execution results in additional security scans being injected into your pipeline. When using `templates-official/jobs/jobs.yml`, Arcade reduces the number of additional security injections by gathering all publishing outputs into the [Build.ArtifactStagingDirectory](https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#build-variables-devops-services), and utilizing the [outputParentDirectory](https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/features/outputs#multiple-outputs) feature of 1ES pipeline templates. When implementing your pipeline, if you ensure publish artifacts are located in the `$(Build.ArtifactStagingDirectory)`, and utilize the 1ES provided template context, then you can reduce the number of security scans for your pipeline. + +Example: +``` yaml +# azure-pipelines.yml +extends: + template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate + parameters: + stages: + - stage: build + jobs: + - template: /eng/common/templates-official/jobs/jobs.yml@self + parameters: + # 1ES makes use of outputs to reduce security task injection overhead + templateContext: + outputs: + - output: pipelineArtifact + displayName: 'Publish logs from source' + continueOnError: true + condition: always() + targetPath: $(Build.ArtifactStagingDirectory)/artifacts/log + artifactName: Logs + jobs: + - job: Windows + steps: + - script: echo "friendly neighborhood" > artifacts/marvel/spiderman.txt + # copy build outputs to artifact staging directory for publishing + - task: CopyFiles@2 + displayName: Gather build output + inputs: + SourceFolder: '$(Build.SourcesDirectory)/artifacts/marvel' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/marvel' +``` + +Note: Multiple outputs are ONLY applicable to 1ES PT publishing (only usable when referencing `templates-official`). + +# Development notes + +**Folder / file structure** + +``` text +eng\common\ + [templates || templates-official]\ + job\ + job.yml (shim + artifact publishing logic) + onelocbuild.yml (shim) + publish-build-assets.yml (shim) + source-build.yml (shim) + source-index-stage1.yml (shim) + jobs\ + codeql-build.yml (shim) + jobs.yml (shim) + source-build.yml (shim) + post-build\ + post-build.yml (shim) + common-variabls.yml (shim) + setup-maestro-vars.yml (shim) + steps\ + publish-build-artifacts.yml (logic) + publish-pipeline-artifacts.yml (logic) + component-governance.yml (shim) + generate-sbom.yml (shim) + publish-logs.yml (shim) + retain-build.yml (shim) + send-to-helix.yml (shim) + source-build.yml (shim) + variables\ + pool-providers.yml (logic + redirect) # templates/variables/pool-providers.yml will redirect to templates-official/variables/pool-providers.yml if you are running in the internal project + sdl-variables.yml (logic) + core-templates\ + job\ + job.yml (logic) + onelocbuild.yml (logic) + publish-build-assets.yml (logic) + source-build.yml (logic) + source-index-stage1.yml (logic) + jobs\ + codeql-build.yml (logic) + jobs.yml (logic) + source-build.yml (logic) + post-build\ + common-variabls.yml (logic) + post-build.yml (logic) + setup-maestro-vars.yml (logic) + steps\ + component-governance.yml (logic) + generate-sbom.yml (logic) + publish-build-artifacts.yml (redirect) + publish-logs.yml (logic) + publish-pipeline-artifacts.yml (redirect) + retain-build.yml (logic) + send-to-helix.yml (logic) + source-build.yml (logic) + variables\ + pool-providers.yml (redirect) +``` + +In the table above, a file is designated as "shim", "logic", or "redirect". + +- shim - represents a yaml file which is an intermediate step between pipeline logic and .Net Core Engineering's templates (`core-templates`) and defines the `is1ESPipeline` parameter value. + +- logic - represents actual base template logic. + +- redirect- represents a file in `core-templates` which redirects to the "logic" file in either `templates` or `templates-official`. + +Logic for Arcade's templates live **primarily** in the `core-templates` folder. The exceptions to the location of the logic files are around artifact publishing, which is handled differently between 1es pipeline templates and standard templates. `templates` and `templates-official` provide shim entry points which redirect to `core-templates` while also defining the `is1ESPipeline` parameter. If a shim is referenced in `templates`, then `is1ESPipeline` is set to `false`. If a shim is referenced in `templates-official`, then `is1ESPipeline` is set to `true`. + +Within `templates` and `templates-official`, the templates at the "stages", and "jobs" / "job" level have been replaced with shims. Templates at the "steps" and "variables" level are typically too granular to be replaced with shims and instead persist logic which is directly applicable to either scenario. + +Within `core-templates`, there are a handful of places where logic is dependent on which shim entry point was used. In those places, we redirect back to the respective logic file in `templates` or `templates-official`. diff --git a/eng/common/templates-official/job/job.yml b/eng/common/templates-official/job/job.yml index 1f035fee73f..3d16b41c78c 100644 --- a/eng/common/templates-official/job/job.yml +++ b/eng/common/templates-official/job/job.yml @@ -1,264 +1,79 @@ -# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, -# and some (Microbuild) should only be applied to non-PR cases for internal builds. - parameters: -# Job schema parameters - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job - cancelTimeoutInMinutes: '' - condition: '' - container: '' - continueOnError: false - dependsOn: '' - displayName: '' - pool: '' - steps: [] - strategy: '' - timeoutInMinutes: '' - variables: [] - workspace: '' - templateContext: '' - -# Job base template specific parameters - # See schema documentation - https://github.com/dotnet/arcade/blob/master/Documentation/AzureDevOps/TemplateSchema.md - artifacts: '' - enableMicrobuild: false - enablePublishBuildArtifacts: false - enablePublishBuildAssets: false - enablePublishTestResults: false - enablePublishUsingPipelines: false - enableBuildRetry: false - disableComponentGovernance: '' - componentGovernanceIgnoreDirectories: '' - mergeTestResults: false - testRunTitle: '' - testResultsFormat: '' - name: '' - preSteps: [] - runAsPublic: false # Sbom related params enableSbom: true - PackageVersion: 7.0.0 + PackageVersion: 9.0.0 BuildDropPath: '$(Build.SourcesDirectory)/artifacts' jobs: -- job: ${{ parameters.name }} - - ${{ if ne(parameters.cancelTimeoutInMinutes, '') }}: - cancelTimeoutInMinutes: ${{ parameters.cancelTimeoutInMinutes }} - - ${{ if ne(parameters.condition, '') }}: - condition: ${{ parameters.condition }} - - ${{ if ne(parameters.container, '') }}: - container: ${{ parameters.container }} - - ${{ if ne(parameters.continueOnError, '') }}: - continueOnError: ${{ parameters.continueOnError }} - - ${{ if ne(parameters.dependsOn, '') }}: - dependsOn: ${{ parameters.dependsOn }} - - ${{ if ne(parameters.displayName, '') }}: - displayName: ${{ parameters.displayName }} - - ${{ if ne(parameters.pool, '') }}: - pool: ${{ parameters.pool }} - - ${{ if ne(parameters.strategy, '') }}: - strategy: ${{ parameters.strategy }} - - ${{ if ne(parameters.timeoutInMinutes, '') }}: - timeoutInMinutes: ${{ parameters.timeoutInMinutes }} - - ${{ if ne(parameters.templateContext, '') }}: - templateContext: ${{ parameters.templateContext }} - - variables: - - ${{ if ne(parameters.enableTelemetry, 'false') }}: - - name: DOTNET_CLI_TELEMETRY_PROFILE - value: '$(Build.Repository.Uri)' - - ${{ if eq(parameters.enableRichCodeNavigation, 'true') }}: - - name: EnableRichCodeNavigation - value: 'true' - # Retry signature validation up to three times, waiting 2 seconds between attempts. - # See https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu3028#retry-untrusted-root-failures - - name: NUGET_EXPERIMENTAL_CHAIN_BUILD_RETRY_POLICY - value: 3,2000 - - ${{ each variable in parameters.variables }}: - # handle name-value variable syntax - # example: - # - name: [key] - # value: [value] - - ${{ if ne(variable.name, '') }}: - - name: ${{ variable.name }} - value: ${{ variable.value }} - - # handle variable groups - - ${{ if ne(variable.group, '') }}: - - group: ${{ variable.group }} - - # handle template variable syntax - # example: - # - template: path/to/template.yml - # parameters: - # [key]: [value] - - ${{ if ne(variable.template, '') }}: - - template: ${{ variable.template }} - ${{ if ne(variable.parameters, '') }}: - parameters: ${{ variable.parameters }} - - # handle key-value variable syntax. - # example: - # - [key]: [value] - - ${{ if and(eq(variable.name, ''), eq(variable.group, ''), eq(variable.template, '')) }}: - - ${{ each pair in variable }}: - - name: ${{ pair.key }} - value: ${{ pair.value }} - - # DotNet-HelixApi-Access provides 'HelixApiAccessToken' for internal builds - - ${{ if and(eq(parameters.enableTelemetry, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - group: DotNet-HelixApi-Access - - ${{ if ne(parameters.workspace, '') }}: - workspace: ${{ parameters.workspace }} - - steps: - - ${{ if ne(parameters.preSteps, '') }}: - - ${{ each preStep in parameters.preSteps }}: - - ${{ preStep }} - - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - - task: MicroBuildSigningPlugin@4 - displayName: Install MicroBuild plugin - inputs: - signType: $(_SignType) - zipSources: false - feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json - env: - TeamName: $(_TeamName) - MicroBuildOutputFolderOverride: '$(Agent.TempDirectory)' - continueOnError: ${{ parameters.continueOnError }} - condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) - - - ${{ if and(eq(parameters.runAsPublic, 'false'), eq(variables['System.TeamProject'], 'internal')) }}: - - task: NuGetAuthenticate@1 - - - ${{ if and(ne(parameters.artifacts.download, 'false'), ne(parameters.artifacts.download, '')) }}: - - task: DownloadPipelineArtifact@2 - inputs: - buildType: current - artifactName: ${{ coalesce(parameters.artifacts.download.name, 'Artifacts_$(Agent.OS)_$(_BuildConfig)') }} - targetPath: ${{ coalesce(parameters.artifacts.download.path, 'artifacts') }} - itemPattern: ${{ coalesce(parameters.artifacts.download.pattern, '**') }} - - - ${{ each step in parameters.steps }}: - - ${{ step }} - - - ${{ if eq(parameters.enableRichCodeNavigation, true) }}: - - task: RichCodeNavIndexer@0 - displayName: RichCodeNav Upload - inputs: - languages: ${{ coalesce(parameters.richCodeNavigationLanguage, 'csharp') }} - environment: ${{ coalesce(parameters.richCodeNavigationEnvironment, 'production') }} - richNavLogOutputDirectory: $(Build.SourcesDirectory)/artifacts/bin - uploadRichNavArtifacts: ${{ coalesce(parameters.richCodeNavigationUploadArtifacts, false) }} - continueOnError: true - - - template: /eng/common/templates-official/steps/component-governance.yml - parameters: - ${{ if eq(parameters.disableComponentGovernance, '') }}: - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/dotnet/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}: - disableComponentGovernance: false - ${{ else }}: - disableComponentGovernance: true - ${{ else }}: - disableComponentGovernance: ${{ parameters.disableComponentGovernance }} - componentGovernanceIgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} - - - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: MicroBuildCleanup@1 - displayName: Execute Microbuild cleanup tasks - condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} - env: - TeamName: $(_TeamName) - - - ${{ if ne(parameters.artifacts.publish, '') }}: - - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: - - task: CopyFiles@2 - displayName: Gather binaries for publish to artifacts - inputs: - SourceFolder: 'artifacts/bin' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/bin' - - task: CopyFiles@2 - displayName: Gather packages for publish to artifacts - inputs: - SourceFolder: 'artifacts/packages' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/packages' - - task: 1ES.PublishBuildArtifacts@1 - displayName: Publish pipeline artifacts - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts' - PublishLocation: Container - ArtifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} - continueOnError: true - condition: always() - - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: - - task: 1ES.PublishPipelineArtifact@1 - inputs: - targetPath: 'artifacts/log' - artifactName: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} - displayName: 'Publish logs' - continueOnError: true - condition: always() - - - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: - - task: 1ES.PublishBuildArtifacts@1 - displayName: Publish Logs - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' - PublishLocation: Container - ArtifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} - continueOnError: true - condition: always() - - - ${{ if or(and(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, '')), eq(parameters.testResultsFormat, 'xunit')) }}: - - task: PublishTestResults@2 - displayName: Publish XUnit Test Results - inputs: - testResultsFormat: 'xUnit' - testResultsFiles: '*.xml' - searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' - testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-xunit - mergeTestResults: ${{ parameters.mergeTestResults }} - continueOnError: true - condition: always() - - ${{ if or(and(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, '')), eq(parameters.testResultsFormat, 'vstest')) }}: - - task: PublishTestResults@2 - displayName: Publish TRX Test Results - inputs: - testResultsFormat: 'VSTest' - testResultsFiles: '*.trx' - searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' - testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-trx - mergeTestResults: ${{ parameters.mergeTestResults }} - continueOnError: true - condition: always() - - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: - - template: /eng/common/templates-official/steps/generate-sbom.yml - parameters: - PackageVersion: ${{ parameters.packageVersion}} - BuildDropPath: ${{ parameters.buildDropPath }} - IgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} - - - ${{ if eq(parameters.enableBuildRetry, 'true') }}: - - task: 1ES.PublishPipelineArtifact@1 - inputs: - targetPath: '$(Build.SourcesDirectory)\eng\common\BuildConfiguration' - artifactName: 'BuildConfiguration' - displayName: 'Publish build retry configuration' - continueOnError: true \ No newline at end of file +- template: /eng/common/core-templates/job/job.yml + parameters: + is1ESPipeline: true + + componentGovernanceSteps: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: + - template: /eng/common/templates/steps/generate-sbom.yml + parameters: + PackageVersion: ${{ parameters.packageVersion }} + BuildDropPath: ${{ parameters.buildDropPath }} + publishArtifacts: false + + # publish artifacts + # for 1ES managed templates, use the templateContext.output to handle multiple outputs. + templateContext: + outputParentDirectory: $(Build.ArtifactStagingDirectory) + outputs: + - ${{ if ne(parameters.artifacts.publish, '') }}: + - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: + - output: buildArtifacts + displayName: Publish pipeline artifacts + PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts' + ArtifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} + condition: always() + continueOnError: true + - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: + - output: pipelineArtifact + targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/log' + artifactName: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)_Attempt$(System.JobAttempt)') }} + displayName: 'Publish logs' + continueOnError: true + condition: always() + sbomEnabled: false # we don't need SBOM for logs + + - ${{ if eq(parameters.enablePublishBuildArtifacts, true) }}: + - output: buildArtifacts + displayName: Publish Logs + PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)' + publishLocation: Container + ArtifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} + continueOnError: true + condition: always() + sbomEnabled: false # we don't need SBOM for logs + + - ${{ if eq(parameters.enableBuildRetry, 'true') }}: + - output: pipelineArtifact + targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/eng/common/BuildConfiguration' + artifactName: 'BuildConfiguration' + displayName: 'Publish build retry configuration' + continueOnError: true + sbomEnabled: false # we don't need SBOM for BuildConfiguration + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: + - output: pipelineArtifact + displayName: Publish SBOM manifest + continueOnError: true + targetPath: $(Build.ArtifactStagingDirectory)/sbom + artifactName: $(ARTIFACT_NAME) + + # add any outputs provided via root yaml + - ${{ if ne(parameters.templateContext.outputs, '') }}: + - ${{ each output in parameters.templateContext.outputs }}: + - ${{ output }} + + # add any remaining templateContext properties + ${{ each context in parameters.templateContext }}: + ${{ if and(ne(context.key, 'outputParentDirectory'), ne(context.key, 'outputs')) }}: + ${{ context.key }}: ${{ context.value }} + + ${{ each parameter in parameters }}: + ${{ if and(ne(parameter.key, 'templateContext'), ne(parameter.key, 'is1ESPipeline')) }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/job/onelocbuild.yml b/eng/common/templates-official/job/onelocbuild.yml index 52b4d05d3f8..0f0c514b912 100644 --- a/eng/common/templates-official/job/onelocbuild.yml +++ b/eng/common/templates-official/job/onelocbuild.yml @@ -1,112 +1,7 @@ -parameters: - # Optional: dependencies of the job - dependsOn: '' - - # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool - pool: '' - - CeapexPat: $(dn-bot-ceapex-package-r) # PAT for the loc AzDO instance https://dev.azure.com/ceapex - GithubPat: $(BotAccount-dotnet-bot-repo-PAT) - - SourcesDirectory: $(Build.SourcesDirectory) - CreatePr: true - AutoCompletePr: false - ReusePr: true - UseLfLineEndings: true - UseCheckedInLocProjectJson: false - SkipLocProjectJsonGeneration: false - LanguageSet: VS_Main_Languages - LclSource: lclFilesInRepo - LclPackageId: '' - RepoType: gitHub - GitHubOrg: dotnet - MirrorRepo: '' - MirrorBranch: main - condition: '' - JobNameSuffix: '' - jobs: -- job: OneLocBuild${{ parameters.JobNameSuffix }} - - dependsOn: ${{ parameters.dependsOn }} - - displayName: OneLocBuild${{ parameters.JobNameSuffix }} - - variables: - - group: OneLocBuildVariables # Contains the CeapexPat and GithubPat - - name: _GenerateLocProjectArguments - value: -SourcesDirectory ${{ parameters.SourcesDirectory }} - -LanguageSet "${{ parameters.LanguageSet }}" - -CreateNeutralXlfs - - ${{ if eq(parameters.UseCheckedInLocProjectJson, 'true') }}: - - name: _GenerateLocProjectArguments - value: ${{ variables._GenerateLocProjectArguments }} -UseCheckedInLocProjectJson - - template: /eng/common/templates-official/variables/pool-providers.yml - - ${{ if ne(parameters.pool, '') }}: - pool: ${{ parameters.pool }} - ${{ if eq(parameters.pool, '') }}: - pool: - # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) - ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: - name: AzurePipelines-EO - image: 1ESPT-Windows2022 - demands: Cmd - os: windows - # If it's not devdiv, it's dnceng - ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: - name: $(DncEngInternalBuildPool) - image: 1es-windows-2022 - os: windows - - steps: - - ${{ if ne(parameters.SkipLocProjectJsonGeneration, 'true') }}: - - task: Powershell@2 - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/generate-locproject.ps1 - arguments: $(_GenerateLocProjectArguments) - displayName: Generate LocProject.json - condition: ${{ parameters.condition }} - - - task: OneLocBuild@2 - displayName: OneLocBuild - env: - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - inputs: - locProj: eng/Localize/LocProject.json - outDir: $(Build.ArtifactStagingDirectory) - lclSource: ${{ parameters.LclSource }} - lclPackageId: ${{ parameters.LclPackageId }} - isCreatePrSelected: ${{ parameters.CreatePr }} - isAutoCompletePrSelected: ${{ parameters.AutoCompletePr }} - ${{ if eq(parameters.CreatePr, true) }}: - isUseLfLineEndingsSelected: ${{ parameters.UseLfLineEndings }} - ${{ if eq(parameters.RepoType, 'gitHub') }}: - isShouldReusePrSelected: ${{ parameters.ReusePr }} - packageSourceAuth: patAuth - patVariable: ${{ parameters.CeapexPat }} - ${{ if eq(parameters.RepoType, 'gitHub') }}: - repoType: ${{ parameters.RepoType }} - gitHubPatVariable: "${{ parameters.GithubPat }}" - ${{ if ne(parameters.MirrorRepo, '') }}: - isMirrorRepoSelected: true - gitHubOrganization: ${{ parameters.GitHubOrg }} - mirrorRepo: ${{ parameters.MirrorRepo }} - mirrorBranch: ${{ parameters.MirrorBranch }} - condition: ${{ parameters.condition }} - - - task: 1ES.PublishBuildArtifacts@1 - displayName: Publish Localization Files - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/loc' - PublishLocation: Container - ArtifactName: Loc - condition: ${{ parameters.condition }} +- template: /eng/common/core-templates/job/onelocbuild.yml + parameters: + is1ESPipeline: true - - task: 1ES.PublishBuildArtifacts@1 - displayName: Publish LocProject.json - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/eng/Localize/' - PublishLocation: Container - ArtifactName: Loc - condition: ${{ parameters.condition }} \ No newline at end of file + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/job/publish-build-assets.yml b/eng/common/templates-official/job/publish-build-assets.yml index 589ac80a18b..d667a70e8de 100644 --- a/eng/common/templates-official/job/publish-build-assets.yml +++ b/eng/common/templates-official/job/publish-build-assets.yml @@ -1,155 +1,7 @@ -parameters: - configuration: 'Debug' - - # Optional: condition for the job to run - condition: '' - - # Optional: 'true' if future jobs should run even if this job fails - continueOnError: false - - # Optional: dependencies of the job - dependsOn: '' - - # Optional: Include PublishBuildArtifacts task - enablePublishBuildArtifacts: false - - # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool - pool: {} - - # Optional: should run as a public build even in the internal project - # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. - runAsPublic: false - - # Optional: whether the build's artifacts will be published using release pipelines or direct feed publishing - publishUsingPipelines: false - - # Optional: whether the build's artifacts will be published using release pipelines or direct feed publishing - publishAssetsImmediately: false - - artifactsPublishingAdditionalParameters: '' - - signingValidationAdditionalParameters: '' - jobs: -- job: Asset_Registry_Publish - - dependsOn: ${{ parameters.dependsOn }} - timeoutInMinutes: 150 - - ${{ if eq(parameters.publishAssetsImmediately, 'true') }}: - displayName: Publish Assets - ${{ else }}: - displayName: Publish to Build Asset Registry - - variables: - - template: /eng/common/templates-official/variables/pool-providers.yml - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - group: Publish-Build-Assets - - group: AzureDevOps-Artifact-Feeds-Pats - - name: runCodesignValidationInjection - value: false - - ${{ if eq(parameters.publishAssetsImmediately, 'true') }}: - - template: /eng/common/templates-official/post-build/common-variables.yml - - pool: - # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) - ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: - name: AzurePipelines-EO - image: 1ESPT-Windows2022 - demands: Cmd - os: windows - # If it's not devdiv, it's dnceng - ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: - name: NetCore1ESPool-Publishing-Internal - image: windows.vs2019.amd64 - os: windows - steps: - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: DownloadBuildArtifacts@0 - displayName: Download artifact - inputs: - artifactName: AssetManifests - downloadPath: '$(Build.StagingDirectory)/Download' - checkDownloadedFiles: true - condition: ${{ parameters.condition }} - continueOnError: ${{ parameters.continueOnError }} - - - task: NuGetAuthenticate@1 - - - task: PowerShell@2 - displayName: Publish Build Assets - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet - /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' - /p:BuildAssetRegistryToken=$(MaestroAccessToken) - /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com - /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} - /p:OfficialBuildId=$(Build.BuildNumber) - condition: ${{ parameters.condition }} - continueOnError: ${{ parameters.continueOnError }} - - - task: powershell@2 - displayName: Create ReleaseConfigs Artifact - inputs: - targetType: inline - script: | - New-Item -Path "$(Build.StagingDirectory)/ReleaseConfigs" -ItemType Directory -Force - $filePath = "$(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt" - Add-Content -Path $filePath -Value $(BARBuildId) - Add-Content -Path $filePath -Value "$(DefaultChannels)" - Add-Content -Path $filePath -Value $(IsStableBuild) - - - task: 1ES.PublishBuildArtifacts@1 - displayName: Publish ReleaseConfigs Artifact - inputs: - PathtoPublish: '$(Build.StagingDirectory)/ReleaseConfigs' - PublishLocation: Container - ArtifactName: ReleaseConfigs - - - task: powershell@2 - displayName: Check if SymbolPublishingExclusionsFile.txt exists - inputs: - targetType: inline - script: | - $symbolExclusionfile = "$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt" - if(Test-Path -Path $symbolExclusionfile) - { - Write-Host "SymbolExclusionFile exists" - Write-Host "##vso[task.setvariable variable=SymbolExclusionFile]true" - } - else{ - Write-Host "Symbols Exclusion file does not exists" - Write-Host "##vso[task.setvariable variable=SymbolExclusionFile]false" - } - - - task: 1ES.PublishBuildArtifacts@1 - displayName: Publish SymbolPublishingExclusionsFile Artifact - condition: eq(variables['SymbolExclusionFile'], 'true') - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' - PublishLocation: Container - ArtifactName: ReleaseConfigs - - - ${{ if eq(parameters.publishAssetsImmediately, 'true') }}: - - template: /eng/common/templates-official/post-build/setup-maestro-vars.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - - - task: PowerShell@2 - displayName: Publish Using Darc - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 - arguments: -BuildId $(BARBuildId) - -PublishingInfraVersion 3 - -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' - -MaestroToken '$(MaestroApiAccessToken)' - -WaitPublishingFinish true - -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' - -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' +- template: /eng/common/core-templates/job/publish-build-assets.yml + parameters: + is1ESPipeline: true - - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: - - template: /eng/common/templates-official/steps/publish-logs.yml - parameters: - JobLabel: 'Publish_Artifacts_Logs' + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/job/source-build.yml b/eng/common/templates-official/job/source-build.yml index f193dfbe236..1a480034b67 100644 --- a/eng/common/templates-official/job/source-build.yml +++ b/eng/common/templates-official/job/source-build.yml @@ -1,67 +1,7 @@ -parameters: - # This template adds arcade-powered source-build to CI. The template produces a server job with a - # default ID 'Source_Build_Complete' to put in a dependency list if necessary. - - # Specifies the prefix for source-build jobs added to pipeline. Use this if disambiguation needed. - jobNamePrefix: 'Source_Build' - - # Defines the platform on which to run the job. By default, a linux-x64 machine, suitable for - # managed-only repositories. This is an object with these properties: - # - # name: '' - # The name of the job. This is included in the job ID. - # targetRID: '' - # The name of the target RID to use, instead of the one auto-detected by Arcade. - # nonPortable: false - # Enables non-portable mode. This means a more specific RID (e.g. fedora.32-x64 rather than - # linux-x64), and compiling against distro-provided packages rather than portable ones. - # skipPublishValidation: false - # Disables publishing validation. By default, a check is performed to ensure no packages are - # published by source-build. - # container: '' - # A container to use. Runs in docker. - # pool: {} - # A pool to use. Runs directly on an agent. - # buildScript: '' - # Specifies the build script to invoke to perform the build in the repo. The default - # './build.sh' should work for typical Arcade repositories, but this is customizable for - # difficult situations. - # jobProperties: {} - # A list of job properties to inject at the top level, for potential extensibility beyond - # container and pool. - platform: {} - jobs: -- job: ${{ parameters.jobNamePrefix }}_${{ parameters.platform.name }} - displayName: Source-Build (${{ parameters.platform.name }}) - - ${{ each property in parameters.platform.jobProperties }}: - ${{ property.key }}: ${{ property.value }} - - ${{ if ne(parameters.platform.container, '') }}: - container: ${{ parameters.platform.container }} - - ${{ if eq(parameters.platform.pool, '') }}: - # The default VM host AzDO pool. This should be capable of running Docker containers: almost all - # source-build builds run in Docker, including the default managed platform. - # /eng/common/templates-official/variables/pool-providers.yml can't be used here (some customers declare variables already), so duplicate its logic - pool: - ${{ if eq(variables['System.TeamProject'], 'public') }}: - name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore-Svc-Public' ), False, 'NetCore-Public')] - demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open - - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore1ESPool-Svc-Internal'), False, 'NetCore1ESPool-Internal')] - image: 1es-mariner-2 - os: linux - - ${{ if ne(parameters.platform.pool, '') }}: - pool: ${{ parameters.platform.pool }} - - workspace: - clean: all +- template: /eng/common/core-templates/job/source-build.yml + parameters: + is1ESPipeline: true - steps: - - template: /eng/common/templates-official/steps/source-build.yml - parameters: - platform: ${{ parameters.platform }} + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/job/source-index-stage1.yml b/eng/common/templates-official/job/source-index-stage1.yml index 60dfb6b2d1c..6d5ead316f9 100644 --- a/eng/common/templates-official/job/source-index-stage1.yml +++ b/eng/common/templates-official/job/source-index-stage1.yml @@ -1,83 +1,7 @@ -parameters: - runAsPublic: false - sourceIndexUploadPackageVersion: 2.0.0-20240502.12 - sourceIndexProcessBinlogPackageVersion: 1.0.1-20240129.2 - sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json - sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" - preSteps: [] - binlogPath: artifacts/log/Debug/Build.binlog - condition: '' - dependsOn: '' - pool: '' - jobs: -- job: SourceIndexStage1 - dependsOn: ${{ parameters.dependsOn }} - condition: ${{ parameters.condition }} - variables: - - name: SourceIndexUploadPackageVersion - value: ${{ parameters.sourceIndexUploadPackageVersion }} - - name: SourceIndexProcessBinlogPackageVersion - value: ${{ parameters.sourceIndexProcessBinlogPackageVersion }} - - name: SourceIndexPackageSource - value: ${{ parameters.sourceIndexPackageSource }} - - name: BinlogPath - value: ${{ parameters.binlogPath }} - - template: /eng/common/templates-official/variables/pool-providers.yml - - ${{ if ne(parameters.pool, '') }}: - pool: ${{ parameters.pool }} - ${{ if eq(parameters.pool, '') }}: - pool: - ${{ if eq(variables['System.TeamProject'], 'public') }}: - name: $(DncEngPublicBuildPool) - demands: ImageOverride -equals windows.vs2019.amd64.open - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - name: $(DncEngInternalBuildPool) - image: windows.vs2022.amd64 - os: windows - - steps: - - ${{ each preStep in parameters.preSteps }}: - - ${{ preStep }} - - - task: UseDotNet@2 - displayName: Use .NET 8 SDK - inputs: - packageType: sdk - version: 8.0.x - installationPath: $(Agent.TempDirectory)/dotnet - workingDirectory: $(Agent.TempDirectory) - - - script: | - $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version $(sourceIndexProcessBinlogPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools - $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version $(sourceIndexUploadPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools - displayName: Download Tools - # Set working directory to temp directory so 'dotnet' doesn't try to use global.json and use the repo's sdk. - workingDirectory: $(Agent.TempDirectory) - - - script: ${{ parameters.sourceIndexBuildCommand }} - displayName: Build Repository - - - script: $(Agent.TempDirectory)/.source-index/tools/BinLogToSln -i $(BinlogPath) -r $(Build.SourcesDirectory) -n $(Build.Repository.Name) -o .source-index/stage1output - displayName: Process Binlog into indexable sln - - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: AzureCLI@2 - displayName: Get stage 1 auth token - inputs: - azureSubscription: 'SourceDotNet Stage1 Publish' - addSpnToEnvironment: true - scriptType: 'ps' - scriptLocation: 'inlineScript' - inlineScript: | - echo "##vso[task.setvariable variable=ARM_CLIENT_ID;issecret=true]$env:servicePrincipalId" - echo "##vso[task.setvariable variable=ARM_ID_TOKEN;issecret=true]$env:idToken" - echo "##vso[task.setvariable variable=ARM_TENANT_ID;issecret=true]$env:tenantId" - - - script: | - az login --service-principal -u $(ARM_CLIENT_ID) --tenant $(ARM_TENANT_ID) --allow-no-subscriptions --federated-token $(ARM_ID_TOKEN) - displayName: "Login to Azure" +- template: /eng/common/core-templates/job/source-index-stage1.yml + parameters: + is1ESPipeline: true - - script: $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) -s netsourceindexstage1 -b stage1 - displayName: Upload stage1 artifacts to source index + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/jobs/codeql-build.yml b/eng/common/templates-official/jobs/codeql-build.yml index b68d3c2f319..a726322ecfe 100644 --- a/eng/common/templates-official/jobs/codeql-build.yml +++ b/eng/common/templates-official/jobs/codeql-build.yml @@ -1,31 +1,7 @@ -parameters: - # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md - continueOnError: false - # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job - jobs: [] - # Optional: if specified, restore and use this version of Guardian instead of the default. - overrideGuardianVersion: '' - jobs: -- template: /eng/common/templates-official/jobs/jobs.yml +- template: /eng/common/core-templates/jobs/codeql-build.yml parameters: - enableMicrobuild: false - enablePublishBuildArtifacts: false - enablePublishTestResults: false - enablePublishBuildAssets: false - enablePublishUsingPipelines: false - enableTelemetry: true + is1ESPipeline: true - variables: - - group: Publish-Build-Assets - # The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in - # sync with the packages.config file. - - name: DefaultGuardianVersion - value: 0.109.0 - - name: GuardianPackagesConfigFile - value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config - - name: GuardianVersion - value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }} - - jobs: ${{ parameters.jobs }} - + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/jobs/jobs.yml b/eng/common/templates-official/jobs/jobs.yml index 857a0f8ba43..007deddaea0 100644 --- a/eng/common/templates-official/jobs/jobs.yml +++ b/eng/common/templates-official/jobs/jobs.yml @@ -1,97 +1,7 @@ -parameters: - # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md - continueOnError: false - - # Optional: Include PublishBuildArtifacts task - enablePublishBuildArtifacts: false - - # Optional: Enable publishing using release pipelines - enablePublishUsingPipelines: false - - # Optional: Enable running the source-build jobs to build repo from source - enableSourceBuild: false - - # Optional: Parameters for source-build template. - # See /eng/common/templates-official/jobs/source-build.yml for options - sourceBuildParameters: [] - - graphFileGeneration: - # Optional: Enable generating the graph files at the end of the build - enabled: false - # Optional: Include toolset dependencies in the generated graph files - includeToolset: false - - # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job - jobs: [] - - # Optional: Override automatically derived dependsOn value for "publish build assets" job - publishBuildAssetsDependsOn: '' - - # Optional: Publish the assets as soon as the publish to BAR stage is complete, rather doing so in a separate stage. - publishAssetsImmediately: false - - # Optional: If using publishAssetsImmediately and additional parameters are needed, can be used to send along additional parameters (normally sent to post-build.yml) - artifactsPublishingAdditionalParameters: '' - signingValidationAdditionalParameters: '' - - # Optional: should run as a public build even in the internal project - # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. - runAsPublic: false - - enableSourceIndex: false - sourceIndexParams: {} - -# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, -# and some (Microbuild) should only be applied to non-PR cases for internal builds. - jobs: -- ${{ each job in parameters.jobs }}: - - template: ../job/job.yml - parameters: - # pass along parameters - ${{ each parameter in parameters }}: - ${{ if ne(parameter.key, 'jobs') }}: - ${{ parameter.key }}: ${{ parameter.value }} - - # pass along job properties - ${{ each property in job }}: - ${{ if ne(property.key, 'job') }}: - ${{ property.key }}: ${{ property.value }} - - name: ${{ job.job }} - -- ${{ if eq(parameters.enableSourceBuild, true) }}: - - template: /eng/common/templates-official/jobs/source-build.yml - parameters: - allCompletedJobId: Source_Build_Complete - ${{ each parameter in parameters.sourceBuildParameters }}: - ${{ parameter.key }}: ${{ parameter.value }} - -- ${{ if eq(parameters.enableSourceIndex, 'true') }}: - - template: ../job/source-index-stage1.yml - parameters: - runAsPublic: ${{ parameters.runAsPublic }} - ${{ each parameter in parameters.sourceIndexParams }}: - ${{ parameter.key }}: ${{ parameter.value }} - -- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - ${{ if or(eq(parameters.enablePublishBuildAssets, true), eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, '')) }}: - - template: ../job/publish-build-assets.yml - parameters: - continueOnError: ${{ parameters.continueOnError }} - dependsOn: - - ${{ if ne(parameters.publishBuildAssetsDependsOn, '') }}: - - ${{ each job in parameters.publishBuildAssetsDependsOn }}: - - ${{ job.job }} - - ${{ if eq(parameters.publishBuildAssetsDependsOn, '') }}: - - ${{ each job in parameters.jobs }}: - - ${{ job.job }} - - ${{ if eq(parameters.enableSourceBuild, true) }}: - - Source_Build_Complete +- template: /eng/common/core-templates/jobs/jobs.yml + parameters: + is1ESPipeline: true - runAsPublic: ${{ parameters.runAsPublic }} - publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }} - publishAssetsImmediately: ${{ parameters.publishAssetsImmediately }} - enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - signingValidationAdditionalParameters: ${{ parameters.signingValidationAdditionalParameters }} + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/jobs/source-build.yml b/eng/common/templates-official/jobs/source-build.yml index 08e5db9bb11..483e7b611f3 100644 --- a/eng/common/templates-official/jobs/source-build.yml +++ b/eng/common/templates-official/jobs/source-build.yml @@ -1,46 +1,7 @@ -parameters: - # This template adds arcade-powered source-build to CI. A job is created for each platform, as - # well as an optional server job that completes when all platform jobs complete. - - # The name of the "join" job for all source-build platforms. If set to empty string, the job is - # not included. Existing repo pipelines can use this job depend on all source-build jobs - # completing without maintaining a separate list of every single job ID: just depend on this one - # server job. By default, not included. Recommended name if used: 'Source_Build_Complete'. - allCompletedJobId: '' - - # See /eng/common/templates-official/job/source-build.yml - jobNamePrefix: 'Source_Build' - - # This is the default platform provided by Arcade, intended for use by a managed-only repo. - defaultManagedPlatform: - name: 'Managed' - container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8' - - # Defines the platforms on which to run build jobs. One job is created for each platform, and the - # object in this array is sent to the job template as 'platform'. If no platforms are specified, - # one job runs on 'defaultManagedPlatform'. - platforms: [] - jobs: +- template: /eng/common/core-templates/jobs/source-build.yml + parameters: + is1ESPipeline: true -- ${{ if ne(parameters.allCompletedJobId, '') }}: - - job: ${{ parameters.allCompletedJobId }} - displayName: Source-Build Complete - pool: server - dependsOn: - - ${{ each platform in parameters.platforms }}: - - ${{ parameters.jobNamePrefix }}_${{ platform.name }} - - ${{ if eq(length(parameters.platforms), 0) }}: - - ${{ parameters.jobNamePrefix }}_${{ parameters.defaultManagedPlatform.name }} - -- ${{ each platform in parameters.platforms }}: - - template: /eng/common/templates-official/job/source-build.yml - parameters: - jobNamePrefix: ${{ parameters.jobNamePrefix }} - platform: ${{ platform }} - -- ${{ if eq(length(parameters.platforms), 0) }}: - - template: /eng/common/templates-official/job/source-build.yml - parameters: - jobNamePrefix: ${{ parameters.jobNamePrefix }} - platform: ${{ parameters.defaultManagedPlatform }} + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates-official/post-build/common-variables.yml b/eng/common/templates-official/post-build/common-variables.yml index c24193acfc9..c32fc49233f 100644 --- a/eng/common/templates-official/post-build/common-variables.yml +++ b/eng/common/templates-official/post-build/common-variables.yml @@ -1,22 +1,8 @@ variables: - - group: Publish-Build-Assets +- template: /eng/common/core-templates/post-build/common-variables.yml + parameters: + # Specifies whether to use 1ES + is1ESPipeline: true - # Whether the build is internal or not - - name: IsInternalBuild - value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }} - - # Default Maestro++ API Endpoint and API Version - - name: MaestroApiEndPoint - value: "https://maestro-prod.westus2.cloudapp.azure.com" - - name: MaestroApiAccessToken - value: $(MaestroAccessToken) - - name: MaestroApiVersion - value: "2020-02-20" - - - name: SourceLinkCLIVersion - value: 3.0.0 - - name: SymbolToolVersion - value: 1.0.1 - - - name: runCodesignValidationInjection - value: false + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates-official/post-build/post-build.yml b/eng/common/templates-official/post-build/post-build.yml index da1f40958b4..2364c0fd4a5 100644 --- a/eng/common/templates-official/post-build/post-build.yml +++ b/eng/common/templates-official/post-build/post-build.yml @@ -1,285 +1,8 @@ -parameters: - # Which publishing infra should be used. THIS SHOULD MATCH THE VERSION ON THE BUILD MANIFEST. - # Publishing V1 is no longer supported - # Publishing V2 is no longer supported - # Publishing V3 is the default - - name: publishingInfraVersion - displayName: Which version of publishing should be used to promote the build definition? - type: number - default: 3 - values: - - 3 - - - name: BARBuildId - displayName: BAR Build Id - type: number - default: 0 - - - name: PromoteToChannelIds - displayName: Channel to promote BARBuildId to - type: string - default: '' - - - name: enableSourceLinkValidation - displayName: Enable SourceLink validation - type: boolean - default: false - - - name: enableSigningValidation - displayName: Enable signing validation - type: boolean - default: true - - - name: enableSymbolValidation - displayName: Enable symbol validation - type: boolean - default: false - - - name: enableNugetValidation - displayName: Enable NuGet validation - type: boolean - default: true - - - name: publishInstallersAndChecksums - displayName: Publish installers and checksums - type: boolean - default: true - - - name: SDLValidationParameters - type: object - default: - enable: false - publishGdn: false - continueOnError: false - params: '' - artifactNames: '' - downloadArtifacts: true - - # These parameters let the user customize the call to sdk-task.ps1 for publishing - # symbols & general artifacts as well as for signing validation - - name: symbolPublishingAdditionalParameters - displayName: Symbol publishing additional parameters - type: string - default: '' - - - name: artifactsPublishingAdditionalParameters - displayName: Artifact publishing additional parameters - type: string - default: '' - - - name: signingValidationAdditionalParameters - displayName: Signing validation additional parameters - type: string - default: '' - - # Which stages should finish execution before post-build stages start - - name: validateDependsOn - type: object - default: - - build - - - name: publishDependsOn - type: object - default: - - Validate - - # Optional: Call asset publishing rather than running in a separate stage - - name: publishAssetsImmediately - type: boolean - default: false - stages: -- ${{ if or(eq( parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: - - stage: Validate - dependsOn: ${{ parameters.validateDependsOn }} - displayName: Validate Build Assets - variables: - - template: common-variables.yml - - template: /eng/common/templates-official/variables/pool-providers.yml - jobs: - - job: - displayName: NuGet Validation - condition: and(succeededOrFailed(), eq( ${{ parameters.enableNugetValidation }}, 'true')) - pool: - # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) - ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: - name: AzurePipelines-EO - image: 1ESPT-Windows2022 - demands: Cmd - os: windows - # If it's not devdiv, it's dnceng - ${{ else }}: - name: $(DncEngInternalBuildPool) - image: 1es-windows-2022 - os: windows - - steps: - - template: setup-maestro-vars.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: PackageArtifacts - checkDownloadedFiles: true - - - task: PowerShell@2 - displayName: Validate - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1 - arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ - -ToolDestinationPath $(Agent.BuildDirectory)/Extract/ - - - job: - displayName: Signing Validation - condition: and( eq( ${{ parameters.enableSigningValidation }}, 'true'), ne( variables['PostBuildSign'], 'true')) - pool: - # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) - ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: - name: AzurePipelines-EO - image: 1ESPT-Windows2022 - demands: Cmd - os: windows - # If it's not devdiv, it's dnceng - ${{ else }}: - name: $(DncEngInternalBuildPool) - image: 1es-windows-2022 - os: windows - steps: - - template: setup-maestro-vars.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: PackageArtifacts - checkDownloadedFiles: true - itemPattern: | - ** - !**/Microsoft.SourceBuild.Intermediate.*.nupkg - - # This is necessary whenever we want to publish/restore to an AzDO private feed - # Since sdk-task.ps1 tries to restore packages we need to do this authentication here - # otherwise it'll complain about accessing a private feed. - - task: NuGetAuthenticate@1 - displayName: 'Authenticate to AzDO Feeds' - - # Signing validation will optionally work with the buildmanifest file which is downloaded from - # Azure DevOps above. - - task: PowerShell@2 - displayName: Validate - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task SigningValidation -restore -msbuildEngine vs - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts' - /p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt' - ${{ parameters.signingValidationAdditionalParameters }} - - - template: ../steps/publish-logs.yml - parameters: - StageLabel: 'Validation' - JobLabel: 'Signing' - BinlogToolVersion: $(BinlogToolVersion) - - - job: - displayName: SourceLink Validation - condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true') - pool: - # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) - ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: - name: AzurePipelines-EO - image: 1ESPT-Windows2022 - demands: Cmd - os: windows - # If it's not devdiv, it's dnceng - ${{ else }}: - name: $(DncEngInternalBuildPool) - image: 1es-windows-2022 - os: windows - steps: - - template: setup-maestro-vars.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: BlobArtifacts - checkDownloadedFiles: true - - - task: PowerShell@2 - displayName: Validate - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1 - arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ - -ExtractPath $(Agent.BuildDirectory)/Extract/ - -GHRepoName $(Build.Repository.Name) - -GHCommit $(Build.SourceVersion) - -SourcelinkCliVersion $(SourceLinkCLIVersion) - continueOnError: true - -- ${{ if ne(parameters.publishAssetsImmediately, 'true') }}: - - stage: publish_using_darc - ${{ if or(eq(parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: - dependsOn: ${{ parameters.publishDependsOn }} - ${{ else }}: - dependsOn: ${{ parameters.validateDependsOn }} - displayName: Publish using Darc - variables: - - template: common-variables.yml - - template: /eng/common/templates-official/variables/pool-providers.yml - jobs: - - job: - displayName: Publish Using Darc - timeoutInMinutes: 120 - pool: - # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) - ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: - name: AzurePipelines-EO - image: 1ESPT-Windows2022 - demands: Cmd - os: windows - # If it's not devdiv, it's dnceng - ${{ else }}: - name: NetCore1ESPool-Publishing-Internal - image: windows.vs2019.amd64 - os: windows - steps: - - template: setup-maestro-vars.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - - - task: NuGetAuthenticate@1 +- template: /eng/common/core-templates/post-build/post-build.yml + parameters: + # Specifies whether to use 1ES + is1ESPipeline: true - - task: PowerShell@2 - displayName: Publish Using Darc - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 - arguments: -BuildId $(BARBuildId) - -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} - -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' - -MaestroToken '$(MaestroApiAccessToken)' - -WaitPublishingFinish true - -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' - -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/post-build/setup-maestro-vars.yml b/eng/common/templates-official/post-build/setup-maestro-vars.yml index 0c87f149a4a..024397d8786 100644 --- a/eng/common/templates-official/post-build/setup-maestro-vars.yml +++ b/eng/common/templates-official/post-build/setup-maestro-vars.yml @@ -1,70 +1,8 @@ -parameters: - BARBuildId: '' - PromoteToChannelIds: '' - steps: - - ${{ if eq(coalesce(parameters.PromoteToChannelIds, 0), 0) }}: - - task: DownloadBuildArtifacts@0 - displayName: Download Release Configs - inputs: - buildType: current - artifactName: ReleaseConfigs - checkDownloadedFiles: true - - - task: PowerShell@2 - name: setReleaseVars - displayName: Set Release Configs Vars - inputs: - targetType: inline - pwsh: true - script: | - try { - if (!$Env:PromoteToMaestroChannels -or $Env:PromoteToMaestroChannels.Trim() -eq '') { - $Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt - - $BarId = $Content | Select -Index 0 - $Channels = $Content | Select -Index 1 - $IsStableBuild = $Content | Select -Index 2 - - $AzureDevOpsProject = $Env:System_TeamProject - $AzureDevOpsBuildDefinitionId = $Env:System_DefinitionId - $AzureDevOpsBuildId = $Env:Build_BuildId - } - else { - $buildApiEndpoint = "${Env:MaestroApiEndPoint}/api/builds/${Env:BARBuildId}?api-version=${Env:MaestroApiVersion}" - - $apiHeaders = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' - $apiHeaders.Add('Accept', 'application/json') - $apiHeaders.Add('Authorization',"Bearer ${Env:MAESTRO_API_TOKEN}") - - $buildInfo = try { Invoke-WebRequest -Method Get -Uri $buildApiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } - - $BarId = $Env:BARBuildId - $Channels = $Env:PromoteToMaestroChannels -split "," - $Channels = $Channels -join "][" - $Channels = "[$Channels]" - - $IsStableBuild = $buildInfo.stable - $AzureDevOpsProject = $buildInfo.azureDevOpsProject - $AzureDevOpsBuildDefinitionId = $buildInfo.azureDevOpsBuildDefinitionId - $AzureDevOpsBuildId = $buildInfo.azureDevOpsBuildId - } - - Write-Host "##vso[task.setvariable variable=BARBuildId]$BarId" - Write-Host "##vso[task.setvariable variable=TargetChannels]$Channels" - Write-Host "##vso[task.setvariable variable=IsStableBuild]$IsStableBuild" +- template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + # Specifies whether to use 1ES + is1ESPipeline: true - Write-Host "##vso[task.setvariable variable=AzDOProjectName]$AzureDevOpsProject" - Write-Host "##vso[task.setvariable variable=AzDOPipelineId]$AzureDevOpsBuildDefinitionId" - Write-Host "##vso[task.setvariable variable=AzDOBuildId]$AzureDevOpsBuildId" - } - catch { - Write-Host $_ - Write-Host $_.Exception - Write-Host $_.ScriptStackTrace - exit 1 - } - env: - MAESTRO_API_TOKEN: $(MaestroApiAccessToken) - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToMaestroChannels: ${{ parameters.PromoteToChannelIds }} + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates-official/post-build/trigger-subscription.yml b/eng/common/templates-official/post-build/trigger-subscription.yml deleted file mode 100644 index da669030daf..00000000000 --- a/eng/common/templates-official/post-build/trigger-subscription.yml +++ /dev/null @@ -1,13 +0,0 @@ -parameters: - ChannelId: 0 - -steps: -- task: PowerShell@2 - displayName: Triggering subscriptions - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/trigger-subscriptions.ps1 - arguments: -SourceRepo $(Build.Repository.Uri) - -ChannelId ${{ parameters.ChannelId }} - -MaestroApiAccessToken $(MaestroAccessToken) - -MaestroApiEndPoint $(MaestroApiEndPoint) - -MaestroApiVersion $(MaestroApiVersion) diff --git a/eng/common/templates-official/steps/add-build-to-channel.yml b/eng/common/templates-official/steps/add-build-to-channel.yml deleted file mode 100644 index f67a210d62f..00000000000 --- a/eng/common/templates-official/steps/add-build-to-channel.yml +++ /dev/null @@ -1,13 +0,0 @@ -parameters: - ChannelId: 0 - -steps: -- task: PowerShell@2 - displayName: Add Build to Channel - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/add-build-to-channel.ps1 - arguments: -BuildId $(BARBuildId) - -ChannelId ${{ parameters.ChannelId }} - -MaestroApiAccessToken $(MaestroApiAccessToken) - -MaestroApiEndPoint $(MaestroApiEndPoint) - -MaestroApiVersion $(MaestroApiVersion) diff --git a/eng/common/templates-official/steps/build-reason.yml b/eng/common/templates-official/steps/build-reason.yml deleted file mode 100644 index eba58109b52..00000000000 --- a/eng/common/templates-official/steps/build-reason.yml +++ /dev/null @@ -1,12 +0,0 @@ -# build-reason.yml -# Description: runs steps if build.reason condition is valid. conditions is a string of valid build reasons -# to include steps (',' separated). -parameters: - conditions: '' - steps: [] - -steps: - - ${{ if and( not(startsWith(parameters.conditions, 'not')), contains(parameters.conditions, variables['build.reason'])) }}: - - ${{ parameters.steps }} - - ${{ if and( startsWith(parameters.conditions, 'not'), not(contains(parameters.conditions, variables['build.reason']))) }}: - - ${{ parameters.steps }} diff --git a/eng/common/templates-official/steps/component-governance.yml b/eng/common/templates-official/steps/component-governance.yml index cbba0596709..30bb3985ca2 100644 --- a/eng/common/templates-official/steps/component-governance.yml +++ b/eng/common/templates-official/steps/component-governance.yml @@ -1,13 +1,7 @@ -parameters: - disableComponentGovernance: false - componentGovernanceIgnoreDirectories: '' - steps: -- ${{ if eq(parameters.disableComponentGovernance, 'true') }}: - - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true" - displayName: Set skipComponentGovernanceDetection variable -- ${{ if ne(parameters.disableComponentGovernance, 'true') }}: - - task: ComponentGovernanceComponentDetection@0 - continueOnError: true - inputs: - ignoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} \ No newline at end of file +- template: /eng/common/core-templates/steps/component-governance.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/enable-internal-runtimes.yml b/eng/common/templates-official/steps/enable-internal-runtimes.yml new file mode 100644 index 00000000000..f9dd238c6cd --- /dev/null +++ b/eng/common/templates-official/steps/enable-internal-runtimes.yml @@ -0,0 +1,9 @@ +# Obtains internal runtime download credentials and populates the 'dotnetbuilds-internal-container-read-token-base64' +# variable with the base64-encoded SAS token, by default +steps: +- template: /eng/common/core-templates/steps/enable-internal-runtimes.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/enable-internal-sources.yml b/eng/common/templates-official/steps/enable-internal-sources.yml new file mode 100644 index 00000000000..e6d57182284 --- /dev/null +++ b/eng/common/templates-official/steps/enable-internal-sources.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/enable-internal-sources.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates-official/steps/execute-codeql.yml b/eng/common/templates-official/steps/execute-codeql.yml deleted file mode 100644 index 9b4a5ffa30a..00000000000 --- a/eng/common/templates-official/steps/execute-codeql.yml +++ /dev/null @@ -1,32 +0,0 @@ -parameters: - # Language that should be analyzed. Defaults to csharp - language: csharp - # Build Commands - buildCommands: '' - overrideParameters: '' # Optional: to override values for parameters. - additionalParameters: '' # Optional: parameters that need user specific values eg: '-SourceToolsList @("abc","def") -ArtifactToolsList @("ghi","jkl")' - # Optional: if specified, restore and use this version of Guardian instead of the default. - overrideGuardianVersion: '' - # Optional: if true, publish the '.gdn' folder as a pipeline artifact. This can help with in-depth - # diagnosis of problems with specific tool configurations. - publishGuardianDirectoryToPipeline: false - # The script to run to execute all SDL tools. Use this if you want to use a script to define SDL - # parameters rather than relying on YAML. It may be better to use a local script, because you can - # reproduce results locally without piecing together a command based on the YAML. - executeAllSdlToolsScript: 'eng/common/sdl/execute-all-sdl-tools.ps1' - # There is some sort of bug (has been reported) in Azure DevOps where if this parameter is named - # 'continueOnError', the parameter value is not correctly picked up. - # This can also be remedied by the caller (post-build.yml) if it does not use a nested parameter - # optional: determines whether to continue the build if the step errors; - sdlContinueOnError: false - -steps: -- template: /eng/common/templates-official/steps/execute-sdl.yml - parameters: - overrideGuardianVersion: ${{ parameters.overrideGuardianVersion }} - executeAllSdlToolsScript: ${{ parameters.executeAllSdlToolsScript }} - overrideParameters: ${{ parameters.overrideParameters }} - additionalParameters: '${{ parameters.additionalParameters }} - -CodeQLAdditionalRunConfigParams @("BuildCommands < ${{ parameters.buildCommands }}", "Language < ${{ parameters.language }}")' - publishGuardianDirectoryToPipeline: ${{ parameters.publishGuardianDirectoryToPipeline }} - sdlContinueOnError: ${{ parameters.sdlContinueOnError }} \ No newline at end of file diff --git a/eng/common/templates-official/steps/execute-sdl.yml b/eng/common/templates-official/steps/execute-sdl.yml deleted file mode 100644 index 07426fde05d..00000000000 --- a/eng/common/templates-official/steps/execute-sdl.yml +++ /dev/null @@ -1,88 +0,0 @@ -parameters: - overrideGuardianVersion: '' - executeAllSdlToolsScript: '' - overrideParameters: '' - additionalParameters: '' - publishGuardianDirectoryToPipeline: false - sdlContinueOnError: false - condition: '' - -steps: -- task: NuGetAuthenticate@1 - inputs: - nuGetServiceConnections: GuardianConnect - -- task: NuGetToolInstaller@1 - displayName: 'Install NuGet.exe' - -- ${{ if ne(parameters.overrideGuardianVersion, '') }}: - - pwsh: | - Set-Location -Path $(Build.SourcesDirectory)\eng\common\sdl - . .\sdl.ps1 - $guardianCliLocation = Install-Gdn -Path $(Build.SourcesDirectory)\.artifacts -Version ${{ parameters.overrideGuardianVersion }} - Write-Host "##vso[task.setvariable variable=GuardianCliLocation]$guardianCliLocation" - displayName: Install Guardian (Overridden) - -- ${{ if eq(parameters.overrideGuardianVersion, '') }}: - - pwsh: | - Set-Location -Path $(Build.SourcesDirectory)\eng\common\sdl - . .\sdl.ps1 - $guardianCliLocation = Install-Gdn -Path $(Build.SourcesDirectory)\.artifacts - Write-Host "##vso[task.setvariable variable=GuardianCliLocation]$guardianCliLocation" - displayName: Install Guardian - -- ${{ if ne(parameters.overrideParameters, '') }}: - - powershell: ${{ parameters.executeAllSdlToolsScript }} ${{ parameters.overrideParameters }} - displayName: Execute SDL (Overridden) - continueOnError: ${{ parameters.sdlContinueOnError }} - condition: ${{ parameters.condition }} - -- ${{ if eq(parameters.overrideParameters, '') }}: - - powershell: ${{ parameters.executeAllSdlToolsScript }} - -GuardianCliLocation $(GuardianCliLocation) - -NugetPackageDirectory $(Build.SourcesDirectory)\.packages - -AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw) - ${{ parameters.additionalParameters }} - displayName: Execute SDL - continueOnError: ${{ parameters.sdlContinueOnError }} - condition: ${{ parameters.condition }} - -- ${{ if ne(parameters.publishGuardianDirectoryToPipeline, 'false') }}: - # We want to publish the Guardian results and configuration for easy diagnosis. However, the - # '.gdn' dir is a mix of configuration, results, extracted dependencies, and Guardian default - # tooling files. Some of these files are large and aren't useful during an investigation, so - # exclude them by simply deleting them before publishing. (As of writing, there is no documented - # way to selectively exclude a dir from the pipeline artifact publish task.) - - task: DeleteFiles@1 - displayName: Delete Guardian dependencies to avoid uploading - inputs: - SourceFolder: $(Agent.BuildDirectory)/.gdn - Contents: | - c - i - condition: succeededOrFailed() - - - publish: $(Agent.BuildDirectory)/.gdn - artifact: GuardianConfiguration - displayName: Publish GuardianConfiguration - condition: succeededOrFailed() - - # Publish the SARIF files in a container named CodeAnalysisLogs to enable integration - # with the "SARIF SAST Scans Tab" Azure DevOps extension - - task: CopyFiles@2 - displayName: Copy SARIF files - inputs: - flattenFolders: true - sourceFolder: $(Agent.BuildDirectory)/.gdn/rc/ - contents: '**/*.sarif' - targetFolder: $(Build.SourcesDirectory)/CodeAnalysisLogs - condition: succeededOrFailed() - - # Use PublishBuildArtifacts because the SARIF extension only checks this case - # see microsoft/sarif-azuredevops-extension#4 - - task: PublishBuildArtifacts@1 - displayName: Publish SARIF files to CodeAnalysisLogs container - inputs: - pathToPublish: $(Build.SourcesDirectory)/CodeAnalysisLogs - artifactName: CodeAnalysisLogs - condition: succeededOrFailed() \ No newline at end of file diff --git a/eng/common/templates-official/steps/generate-sbom.yml b/eng/common/templates-official/steps/generate-sbom.yml index 1bf43bf807a..9a89a4706d9 100644 --- a/eng/common/templates-official/steps/generate-sbom.yml +++ b/eng/common/templates-official/steps/generate-sbom.yml @@ -1,48 +1,7 @@ -# BuildDropPath - The root folder of the drop directory for which the manifest file will be generated. -# PackageName - The name of the package this SBOM represents. -# PackageVersion - The version of the package this SBOM represents. -# ManifestDirPath - The path of the directory where the generated manifest files will be placed -# IgnoreDirectories - Directories to ignore for SBOM generation. This will be passed through to the CG component detector. - -parameters: - PackageVersion: 8.0.0 - BuildDropPath: '$(Build.SourcesDirectory)/artifacts' - PackageName: '.NET' - ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom - IgnoreDirectories: '' - sbomContinueOnError: true - steps: -- task: PowerShell@2 - displayName: Prep for SBOM generation in (Non-linux) - condition: or(eq(variables['Agent.Os'], 'Windows_NT'), eq(variables['Agent.Os'], 'Darwin')) - inputs: - filePath: ./eng/common/generate-sbom-prep.ps1 - arguments: ${{parameters.manifestDirPath}} - -# Chmodding is a workaround for https://github.com/dotnet/arcade/issues/8461 -- script: | - chmod +x ./eng/common/generate-sbom-prep.sh - ./eng/common/generate-sbom-prep.sh ${{parameters.manifestDirPath}} - displayName: Prep for SBOM generation in (Linux) - condition: eq(variables['Agent.Os'], 'Linux') - continueOnError: ${{ parameters.sbomContinueOnError }} - -- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 - displayName: 'Generate SBOM manifest' - continueOnError: ${{ parameters.sbomContinueOnError }} - inputs: - PackageName: ${{ parameters.packageName }} - BuildDropPath: ${{ parameters.buildDropPath }} - PackageVersion: ${{ parameters.packageVersion }} - ManifestDirPath: ${{ parameters.manifestDirPath }} - ${{ if ne(parameters.IgnoreDirectories, '') }}: - AdditionalComponentDetectorArgs: '--IgnoreDirectories ${{ parameters.IgnoreDirectories }}' - -- task: 1ES.PublishPipelineArtifact@1 - displayName: Publish SBOM manifest - continueOnError: ${{parameters.sbomContinueOnError}} - inputs: - targetPath: '${{parameters.manifestDirPath}}' - artifactName: $(ARTIFACT_NAME) +- template: /eng/common/core-templates/steps/generate-sbom.yml + parameters: + is1ESPipeline: true + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/get-delegation-sas.yml b/eng/common/templates-official/steps/get-delegation-sas.yml new file mode 100644 index 00000000000..c5a9c1f8275 --- /dev/null +++ b/eng/common/templates-official/steps/get-delegation-sas.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/get-delegation-sas.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/get-federated-access-token.yml b/eng/common/templates-official/steps/get-federated-access-token.yml new file mode 100644 index 00000000000..c8dcf6b8139 --- /dev/null +++ b/eng/common/templates-official/steps/get-federated-access-token.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/get-federated-access-token.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates-official/steps/publish-build-artifacts.yml b/eng/common/templates-official/steps/publish-build-artifacts.yml new file mode 100644 index 00000000000..100a3fc9849 --- /dev/null +++ b/eng/common/templates-official/steps/publish-build-artifacts.yml @@ -0,0 +1,41 @@ +parameters: +- name: displayName + type: string + default: 'Publish to Build Artifact' + +- name: condition + type: string + default: succeeded() + +- name: artifactName + type: string + +- name: pathToPublish + type: string + +- name: continueOnError + type: boolean + default: false + +- name: publishLocation + type: string + default: 'Container' + +- name: is1ESPipeline + type: boolean + default: true + +steps: +- ${{ if ne(parameters.is1ESPipeline, true) }}: + - 'eng/common/templates-official cannot be referenced from a non-1ES managed template': error +- task: 1ES.PublishBuildArtifacts@1 + displayName: ${{ parameters.displayName }} + condition: ${{ parameters.condition }} + ${{ if parameters.continueOnError }}: + continueOnError: ${{ parameters.continueOnError }} + inputs: + PublishLocation: ${{ parameters.publishLocation }} + PathtoPublish: ${{ parameters.pathToPublish }} + ${{ if parameters.artifactName }}: + ArtifactName: ${{ parameters.artifactName }} + diff --git a/eng/common/templates-official/steps/publish-logs.yml b/eng/common/templates-official/steps/publish-logs.yml index 04012fed182..579fd531e94 100644 --- a/eng/common/templates-official/steps/publish-logs.yml +++ b/eng/common/templates-official/steps/publish-logs.yml @@ -1,23 +1,7 @@ -parameters: - StageLabel: '' - JobLabel: '' - steps: -- task: Powershell@2 - displayName: Prepare Binlogs to Upload - inputs: - targetType: inline - script: | - New-Item -ItemType Directory $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/ - Move-Item -Path $(Build.SourcesDirectory)/artifacts/log/Debug/* $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/ - continueOnError: true - condition: always() +- template: /eng/common/core-templates/steps/publish-logs.yml + parameters: + is1ESPipeline: true -- task: 1ES.PublishBuildArtifacts@1 - displayName: Publish Logs - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/PostBuildLogs' - PublishLocation: Container - ArtifactName: PostBuildLogs - continueOnError: true - condition: always() + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/publish-pipeline-artifacts.yml b/eng/common/templates-official/steps/publish-pipeline-artifacts.yml new file mode 100644 index 00000000000..172f9f0fdc9 --- /dev/null +++ b/eng/common/templates-official/steps/publish-pipeline-artifacts.yml @@ -0,0 +1,28 @@ +parameters: +- name: is1ESPipeline + type: boolean + default: true + +- name: args + type: object + default: {} + +steps: +- ${{ if ne(parameters.is1ESPipeline, true) }}: + - 'eng/common/templates-official cannot be referenced from a non-1ES managed template': error +- task: 1ES.PublishPipelineArtifact@1 + displayName: ${{ coalesce(parameters.args.displayName, 'Publish to Build Artifact') }} + ${{ if parameters.args.condition }}: + condition: ${{ parameters.args.condition }} + ${{ else }}: + condition: succeeded() + ${{ if parameters.args.continueOnError }}: + continueOnError: ${{ parameters.args.continueOnError }} + inputs: + targetPath: ${{ parameters.args.targetPath }} + ${{ if parameters.args.artifactName }}: + artifactName: ${{ parameters.args.artifactName }} + ${{ if parameters.args.properties }}: + properties: ${{ parameters.args.properties }} + ${{ if parameters.args.sbomEnabled }}: + sbomEnabled: ${{ parameters.args.sbomEnabled }} diff --git a/eng/common/templates-official/steps/retain-build.yml b/eng/common/templates-official/steps/retain-build.yml index 83d97a26a01..5594551508a 100644 --- a/eng/common/templates-official/steps/retain-build.yml +++ b/eng/common/templates-official/steps/retain-build.yml @@ -1,28 +1,7 @@ -parameters: - # Optional azure devops PAT with build execute permissions for the build's organization, - # only needed if the build that should be retained ran on a different organization than - # the pipeline where this template is executing from - Token: '' - # Optional BuildId to retain, defaults to the current running build - BuildId: '' - # Azure devops Organization URI for the build in the https://dev.azure.com/ format. - # Defaults to the organization the current pipeline is running on - AzdoOrgUri: '$(System.CollectionUri)' - # Azure devops project for the build. Defaults to the project the current pipeline is running on - AzdoProject: '$(System.TeamProject)' - steps: - - task: powershell@2 - inputs: - targetType: 'filePath' - filePath: eng/common/retain-build.ps1 - pwsh: true - arguments: > - -AzdoOrgUri: ${{parameters.AzdoOrgUri}} - -AzdoProject ${{parameters.AzdoProject}} - -Token ${{coalesce(parameters.Token, '$env:SYSTEM_ACCESSTOKEN') }} - -BuildId ${{coalesce(parameters.BuildId, '$env:BUILD_ID')}} - displayName: Enable permanent build retention - env: - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - BUILD_ID: $(Build.BuildId) \ No newline at end of file +- template: /eng/common/core-templates/steps/retain-build.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/send-to-helix.yml b/eng/common/templates-official/steps/send-to-helix.yml index 3eb7e2d5f84..6500f21bf84 100644 --- a/eng/common/templates-official/steps/send-to-helix.yml +++ b/eng/common/templates-official/steps/send-to-helix.yml @@ -1,91 +1,7 @@ -# Please remember to update the documentation if you make changes to these parameters! -parameters: - HelixSource: 'pr/default' # required -- sources must start with pr/, official/, prodcon/, or agent/ - HelixType: 'tests/default/' # required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/' - HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number - HelixTargetQueues: '' # required -- semicolon-delimited list of Helix queues to test on; see https://helix.dot.net/ for a list of queues - HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group - HelixConfiguration: '' # optional -- additional property attached to a job - HelixPreCommands: '' # optional -- commands to run before Helix work item execution - HelixPostCommands: '' # optional -- commands to run after Helix work item execution - WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects - WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects - WorkItemTimeout: '' # optional -- a timeout in TimeSpan.Parse-ready value (e.g. 00:02:00) for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects - CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload - XUnitProjects: '' # optional -- semicolon-delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true - XUnitWorkItemTimeout: '' # optional -- the workitem timeout in seconds for all workitems created from the xUnit projects specified by XUnitProjects - XUnitPublishTargetFramework: '' # optional -- framework to use to publish your xUnit projects - XUnitRuntimeTargetFramework: '' # optional -- framework to use for the xUnit console runner - XUnitRunnerVersion: '' # optional -- version of the xUnit nuget package you wish to use on Helix; required for XUnitProjects - IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion - DotNetCliPackageType: '' # optional -- either 'sdk', 'runtime' or 'aspnetcore-runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/main/release-notes/releases-index.json - DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/main/release-notes/releases-index.json - WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." - IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set - HelixBaseUri: 'https://helix.dot.net/' # optional -- sets the Helix API base URI (allows targeting https://helix.int-dot.net ) - Creator: '' # optional -- if the build is external, use this to specify who is sending the job - DisplayNamePrefix: 'Run Tests' # optional -- rename the beginning of the displayName of the steps in AzDO - condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() - continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false - steps: - - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY\eng\common\helixpublish.proj /restore /p:TreatWarningsAsErrors=false /t:Test /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"' - displayName: ${{ parameters.DisplayNamePrefix }} (Windows) - env: - BuildConfig: $(_BuildConfig) - HelixSource: ${{ parameters.HelixSource }} - HelixType: ${{ parameters.HelixType }} - HelixBuild: ${{ parameters.HelixBuild }} - HelixConfiguration: ${{ parameters.HelixConfiguration }} - HelixTargetQueues: ${{ parameters.HelixTargetQueues }} - HelixAccessToken: ${{ parameters.HelixAccessToken }} - HelixPreCommands: ${{ parameters.HelixPreCommands }} - HelixPostCommands: ${{ parameters.HelixPostCommands }} - WorkItemDirectory: ${{ parameters.WorkItemDirectory }} - WorkItemCommand: ${{ parameters.WorkItemCommand }} - WorkItemTimeout: ${{ parameters.WorkItemTimeout }} - CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} - XUnitProjects: ${{ parameters.XUnitProjects }} - XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} - XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} - XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} - XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} - IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} - DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} - DotNetCliVersion: ${{ parameters.DotNetCliVersion }} - WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} - HelixBaseUri: ${{ parameters.HelixBaseUri }} - Creator: ${{ parameters.Creator }} - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} - - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/helixpublish.proj /restore /p:TreatWarningsAsErrors=false /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog - displayName: ${{ parameters.DisplayNamePrefix }} (Unix) - env: - BuildConfig: $(_BuildConfig) - HelixSource: ${{ parameters.HelixSource }} - HelixType: ${{ parameters.HelixType }} - HelixBuild: ${{ parameters.HelixBuild }} - HelixConfiguration: ${{ parameters.HelixConfiguration }} - HelixTargetQueues: ${{ parameters.HelixTargetQueues }} - HelixAccessToken: ${{ parameters.HelixAccessToken }} - HelixPreCommands: ${{ parameters.HelixPreCommands }} - HelixPostCommands: ${{ parameters.HelixPostCommands }} - WorkItemDirectory: ${{ parameters.WorkItemDirectory }} - WorkItemCommand: ${{ parameters.WorkItemCommand }} - WorkItemTimeout: ${{ parameters.WorkItemTimeout }} - CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} - XUnitProjects: ${{ parameters.XUnitProjects }} - XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} - XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} - XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} - XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} - IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} - DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} - DotNetCliVersion: ${{ parameters.DotNetCliVersion }} - WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} - HelixBaseUri: ${{ parameters.HelixBaseUri }} - Creator: ${{ parameters.Creator }} - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} +- template: /eng/common/core-templates/steps/send-to-helix.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/source-build.yml b/eng/common/templates-official/steps/source-build.yml index 829f17c34d1..8f92c49e7b0 100644 --- a/eng/common/templates-official/steps/source-build.yml +++ b/eng/common/templates-official/steps/source-build.yml @@ -1,129 +1,7 @@ -parameters: - # This template adds arcade-powered source-build to CI. - - # This is a 'steps' template, and is intended for advanced scenarios where the existing build - # infra has a careful build methodology that must be followed. For example, a repo - # (dotnet/runtime) might choose to clone the GitHub repo only once and store it as a pipeline - # artifact for all subsequent jobs to use, to reduce dependence on a strong network connection to - # GitHub. Using this steps template leaves room for that infra to be included. - - # Defines the platform on which to run the steps. See 'eng/common/templates-official/job/source-build.yml' - # for details. The entire object is described in the 'job' template for simplicity, even though - # the usage of the properties on this object is split between the 'job' and 'steps' templates. - platform: {} - steps: -# Build. Keep it self-contained for simple reusability. (No source-build-specific job variables.) -- script: | - set -x - df -h - - # If building on the internal project, the artifact feeds variable may be available (usually only if needed) - # In that case, call the feed setup script to add internal feeds corresponding to public ones. - # In addition, add an msbuild argument to copy the WIP from the repo to the target build location. - # This is because SetupNuGetSources.sh will alter the current NuGet.config file, and we need to preserve those - # changes. - internalRestoreArgs= - if [ '$(dn-bot-dnceng-artifact-feeds-rw)' != '$''(dn-bot-dnceng-artifact-feeds-rw)' ]; then - # Temporarily work around https://github.com/dotnet/arcade/issues/7709 - chmod +x $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh - $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh $(Build.SourcesDirectory)/NuGet.config $(dn-bot-dnceng-artifact-feeds-rw) - internalRestoreArgs='/p:CopyWipIntoInnerSourceBuildRepo=true' - - # The 'Copy WIP' feature of source build uses git stash to apply changes from the original repo. - # This only works if there is a username/email configured, which won't be the case in most CI runs. - git config --get user.email - if [ $? -ne 0 ]; then - git config user.email dn-bot@microsoft.com - git config user.name dn-bot - fi - fi - - # If building on the internal project, the internal storage variable may be available (usually only if needed) - # In that case, add variables to allow the download of internal runtimes if the specified versions are not found - # in the default public locations. - internalRuntimeDownloadArgs= - if [ '$(dotnetbuilds-internal-container-read-token-base64)' != '$''(dotnetbuilds-internal-container-read-token-base64)' ]; then - internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://dotnetbuilds.blob.core.windows.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64) --runtimesourcefeed https://dotnetbuilds.blob.core.windows.net/internal --runtimesourcefeedkey $(dotnetbuilds-internal-container-read-token-base64)' - fi - - buildConfig=Release - # Check if AzDO substitutes in a build config from a variable, and use it if so. - if [ '$(_BuildConfig)' != '$''(_BuildConfig)' ]; then - buildConfig='$(_BuildConfig)' - fi - - officialBuildArgs= - if [ '${{ and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}' = 'True' ]; then - officialBuildArgs='/p:DotNetPublishUsingPipelines=true /p:OfficialBuildId=$(BUILD.BUILDNUMBER)' - fi - - targetRidArgs= - if [ '${{ parameters.platform.targetRID }}' != '' ]; then - targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}' - fi - - runtimeOsArgs= - if [ '${{ parameters.platform.runtimeOS }}' != '' ]; then - runtimeOsArgs='/p:RuntimeOS=${{ parameters.platform.runtimeOS }}' - fi - - baseOsArgs= - if [ '${{ parameters.platform.baseOS }}' != '' ]; then - baseOsArgs='/p:BaseOS=${{ parameters.platform.baseOS }}' - fi - - publishArgs= - if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then - publishArgs='--publish' - fi - - assetManifestFileName=SourceBuild_RidSpecific.xml - if [ '${{ parameters.platform.name }}' != '' ]; then - assetManifestFileName=SourceBuild_${{ parameters.platform.name }}.xml - fi - - ${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \ - --configuration $buildConfig \ - --restore --build --pack $publishArgs -bl \ - $officialBuildArgs \ - $internalRuntimeDownloadArgs \ - $internalRestoreArgs \ - $targetRidArgs \ - $runtimeOsArgs \ - $baseOsArgs \ - /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \ - /p:ArcadeBuildFromSource=true \ - /p:AssetManifestFileName=$assetManifestFileName - displayName: Build - -# Upload build logs for diagnosis. -- task: CopyFiles@2 - displayName: Prepare BuildLogs staging directory - inputs: - SourceFolder: '$(Build.SourcesDirectory)' - Contents: | - **/*.log - **/*.binlog - artifacts/source-build/self/prebuilt-report/** - TargetFolder: '$(Build.StagingDirectory)/BuildLogs' - CleanTargetFolder: true - continueOnError: true - condition: succeededOrFailed() - -- task: 1ES.PublishPipelineArtifact@1 - displayName: Publish BuildLogs - inputs: - targetPath: '$(Build.StagingDirectory)/BuildLogs' - artifactName: BuildLogs_SourceBuild_${{ parameters.platform.name }}_Attempt$(System.JobAttempt) - continueOnError: true - condition: succeededOrFailed() +- template: /eng/common/core-templates/steps/source-build.yml + parameters: + is1ESPipeline: true -# Manually inject component detection so that we can ignore the source build upstream cache, which contains -# a nupkg cache of input packages (a local feed). -# This path must match the upstream cache path in property 'CurrentRepoSourceBuiltNupkgCacheDir' -# in src\Microsoft.DotNet.Arcade.Sdk\tools\SourceBuild\SourceBuildArcade.targets -- task: ComponentGovernanceComponentDetection@0 - displayName: Component Detection (Exclude upstream cache) - inputs: - ignoreDirectories: '$(Build.SourcesDirectory)/artifacts/source-build/self/src/artifacts/obj/source-built-upstream-cache' + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml deleted file mode 100644 index 7870f93bc17..00000000000 --- a/eng/common/templates/job/execute-sdl.yml +++ /dev/null @@ -1,139 +0,0 @@ -parameters: - enable: 'false' # Whether the SDL validation job should execute or not - overrideParameters: '' # Optional: to override values for parameters. - additionalParameters: '' # Optional: parameters that need user specific values eg: '-SourceToolsList @("abc","def") -ArtifactToolsList @("ghi","jkl")' - # Optional: if specified, restore and use this version of Guardian instead of the default. - overrideGuardianVersion: '' - # Optional: if true, publish the '.gdn' folder as a pipeline artifact. This can help with in-depth - # diagnosis of problems with specific tool configurations. - publishGuardianDirectoryToPipeline: false - # The script to run to execute all SDL tools. Use this if you want to use a script to define SDL - # parameters rather than relying on YAML. It may be better to use a local script, because you can - # reproduce results locally without piecing together a command based on the YAML. - executeAllSdlToolsScript: 'eng/common/sdl/execute-all-sdl-tools.ps1' - # There is some sort of bug (has been reported) in Azure DevOps where if this parameter is named - # 'continueOnError', the parameter value is not correctly picked up. - # This can also be remedied by the caller (post-build.yml) if it does not use a nested parameter - sdlContinueOnError: false # optional: determines whether to continue the build if the step errors; - # optional: determines if build artifacts should be downloaded. - downloadArtifacts: true - # optional: determines if this job should search the directory of downloaded artifacts for - # 'tar.gz' and 'zip' archive files and extract them before running SDL validation tasks. - extractArchiveArtifacts: false - dependsOn: '' # Optional: dependencies of the job - artifactNames: '' # Optional: patterns supplied to DownloadBuildArtifacts - # Usage: - # artifactNames: - # - 'BlobArtifacts' - # - 'Artifacts_Windows_NT_Release' - # Optional: download a list of pipeline artifacts. 'downloadArtifacts' controls build artifacts, - # not pipeline artifacts, so doesn't affect the use of this parameter. - pipelineArtifactNames: [] - -jobs: -- job: Run_SDL - dependsOn: ${{ parameters.dependsOn }} - displayName: Run SDL tool - condition: and(succeededOrFailed(), eq( ${{ parameters.enable }}, 'true')) - variables: - - group: DotNet-VSTS-Bot - - name: AzDOProjectName - value: ${{ parameters.AzDOProjectName }} - - name: AzDOPipelineId - value: ${{ parameters.AzDOPipelineId }} - - name: AzDOBuildId - value: ${{ parameters.AzDOBuildId }} - - template: /eng/common/templates/variables/sdl-variables.yml - - name: GuardianVersion - value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }} - - template: /eng/common/templates/variables/pool-providers.yml - pool: - # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) - ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: - name: VSEngSS-MicroBuild2022-1ES - demands: Cmd - # If it's not devdiv, it's dnceng - ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: - name: $(DncEngInternalBuildPool) - demands: ImageOverride -equals windows.vs2019.amd64 - steps: - - checkout: self - clean: true - - # If the template caller didn't provide an AzDO parameter, set them all up as Maestro vars. - - ${{ if not(and(parameters.AzDOProjectName, parameters.AzDOPipelineId, parameters.AzDOBuildId)) }}: - - template: /eng/common/templates/post-build/setup-maestro-vars.yml - - - ${{ if ne(parameters.downloadArtifacts, 'false')}}: - - ${{ if ne(parameters.artifactNames, '') }}: - - ${{ each artifactName in parameters.artifactNames }}: - - task: DownloadBuildArtifacts@0 - displayName: Download Build Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: ${{ artifactName }} - downloadPath: $(Build.ArtifactStagingDirectory)\artifacts - checkDownloadedFiles: true - - ${{ if eq(parameters.artifactNames, '') }}: - - task: DownloadBuildArtifacts@0 - displayName: Download Build Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - downloadType: specific files - itemPattern: "**" - downloadPath: $(Build.ArtifactStagingDirectory)\artifacts - checkDownloadedFiles: true - - - ${{ each artifactName in parameters.pipelineArtifactNames }}: - - task: DownloadPipelineArtifact@2 - displayName: Download Pipeline Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: ${{ artifactName }} - downloadPath: $(Build.ArtifactStagingDirectory)\artifacts - checkDownloadedFiles: true - - - powershell: eng/common/sdl/trim-assets-version.ps1 - -InputPath $(Build.ArtifactStagingDirectory)\artifacts - displayName: Trim the version from the NuGet packages - continueOnError: ${{ parameters.sdlContinueOnError }} - - - powershell: eng/common/sdl/extract-artifact-packages.ps1 - -InputPath $(Build.ArtifactStagingDirectory)\artifacts\BlobArtifacts - -ExtractPath $(Build.ArtifactStagingDirectory)\artifacts\BlobArtifacts - displayName: Extract Blob Artifacts - continueOnError: ${{ parameters.sdlContinueOnError }} - - - powershell: eng/common/sdl/extract-artifact-packages.ps1 - -InputPath $(Build.ArtifactStagingDirectory)\artifacts\PackageArtifacts - -ExtractPath $(Build.ArtifactStagingDirectory)\artifacts\PackageArtifacts - displayName: Extract Package Artifacts - continueOnError: ${{ parameters.sdlContinueOnError }} - - - ${{ if ne(parameters.extractArchiveArtifacts, 'false') }}: - - powershell: eng/common/sdl/extract-artifact-archives.ps1 - -InputPath $(Build.ArtifactStagingDirectory)\artifacts - -ExtractPath $(Build.ArtifactStagingDirectory)\artifacts - displayName: Extract Archive Artifacts - continueOnError: ${{ parameters.sdlContinueOnError }} - - - template: /eng/common/templates/steps/execute-sdl.yml - parameters: - overrideGuardianVersion: ${{ parameters.overrideGuardianVersion }} - executeAllSdlToolsScript: ${{ parameters.executeAllSdlToolsScript }} - overrideParameters: ${{ parameters.overrideParameters }} - additionalParameters: ${{ parameters.additionalParameters }} - publishGuardianDirectoryToPipeline: ${{ parameters.publishGuardianDirectoryToPipeline }} - sdlContinueOnError: ${{ parameters.sdlContinueOnError }} diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 8ec5c4f2d9f..07d317bf8f9 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -1,259 +1,81 @@ -# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, -# and some (Microbuild) should only be applied to non-PR cases for internal builds. - -parameters: -# Job schema parameters - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job - cancelTimeoutInMinutes: '' - condition: '' - container: '' - continueOnError: false - dependsOn: '' - displayName: '' - pool: '' - steps: [] - strategy: '' - timeoutInMinutes: '' - variables: [] - workspace: '' - templateContext: '' - -# Job base template specific parameters - # See schema documentation - https://github.com/dotnet/arcade/blob/master/Documentation/AzureDevOps/TemplateSchema.md - artifacts: '' - enableMicrobuild: false +parameters: enablePublishBuildArtifacts: false - enablePublishBuildAssets: false - enablePublishTestResults: false - enablePublishUsingPipelines: false - enableBuildRetry: false disableComponentGovernance: '' componentGovernanceIgnoreDirectories: '' - mergeTestResults: false - testRunTitle: '' - testResultsFormat: '' - name: '' - preSteps: [] - runAsPublic: false # Sbom related params enableSbom: true - PackageVersion: 7.0.0 + PackageVersion: 9.0.0 BuildDropPath: '$(Build.SourcesDirectory)/artifacts' jobs: -- job: ${{ parameters.name }} - - ${{ if ne(parameters.cancelTimeoutInMinutes, '') }}: - cancelTimeoutInMinutes: ${{ parameters.cancelTimeoutInMinutes }} - - ${{ if ne(parameters.condition, '') }}: - condition: ${{ parameters.condition }} - - ${{ if ne(parameters.container, '') }}: - container: ${{ parameters.container }} - - ${{ if ne(parameters.continueOnError, '') }}: - continueOnError: ${{ parameters.continueOnError }} - - ${{ if ne(parameters.dependsOn, '') }}: - dependsOn: ${{ parameters.dependsOn }} - - ${{ if ne(parameters.displayName, '') }}: - displayName: ${{ parameters.displayName }} - - ${{ if ne(parameters.pool, '') }}: - pool: ${{ parameters.pool }} - - ${{ if ne(parameters.strategy, '') }}: - strategy: ${{ parameters.strategy }} - - ${{ if ne(parameters.timeoutInMinutes, '') }}: - timeoutInMinutes: ${{ parameters.timeoutInMinutes }} - - ${{ if ne(parameters.templateContext, '') }}: - templateContext: ${{ parameters.templateContext }} - - variables: - - ${{ if ne(parameters.enableTelemetry, 'false') }}: - - name: DOTNET_CLI_TELEMETRY_PROFILE - value: '$(Build.Repository.Uri)' - - ${{ if eq(parameters.enableRichCodeNavigation, 'true') }}: - - name: EnableRichCodeNavigation - value: 'true' - # Retry signature validation up to three times, waiting 2 seconds between attempts. - # See https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu3028#retry-untrusted-root-failures - - name: NUGET_EXPERIMENTAL_CHAIN_BUILD_RETRY_POLICY - value: 3,2000 - - ${{ each variable in parameters.variables }}: - # handle name-value variable syntax - # example: - # - name: [key] - # value: [value] - - ${{ if ne(variable.name, '') }}: - - name: ${{ variable.name }} - value: ${{ variable.value }} - - # handle variable groups - - ${{ if ne(variable.group, '') }}: - - group: ${{ variable.group }} - - # handle template variable syntax - # example: - # - template: path/to/template.yml - # parameters: - # [key]: [value] - - ${{ if ne(variable.template, '') }}: - - template: ${{ variable.template }} - ${{ if ne(variable.parameters, '') }}: - parameters: ${{ variable.parameters }} +- template: /eng/common/core-templates/job/job.yml + parameters: + is1ESPipeline: false - # handle key-value variable syntax. - # example: - # - [key]: [value] - - ${{ if and(eq(variable.name, ''), eq(variable.group, ''), eq(variable.template, '')) }}: - - ${{ each pair in variable }}: - - name: ${{ pair.key }} - value: ${{ pair.value }} + ${{ each parameter in parameters }}: + ${{ if and(ne(parameter.key, 'steps'), ne(parameter.key, 'is1ESPipeline')) }}: + ${{ parameter.key }}: ${{ parameter.value }} - # DotNet-HelixApi-Access provides 'HelixApiAccessToken' for internal builds - - ${{ if and(eq(parameters.enableTelemetry, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - group: DotNet-HelixApi-Access + steps: + - ${{ each step in parameters.steps }}: + - ${{ step }} - ${{ if ne(parameters.workspace, '') }}: - workspace: ${{ parameters.workspace }} - - steps: - - ${{ if ne(parameters.preSteps, '') }}: - - ${{ each preStep in parameters.preSteps }}: - - ${{ preStep }} - - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - - task: MicroBuildSigningPlugin@3 - displayName: Install MicroBuild plugin - inputs: - signType: $(_SignType) - zipSources: false - feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json - env: - TeamName: $(_TeamName) - continueOnError: ${{ parameters.continueOnError }} - condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) - - - ${{ if and(eq(parameters.runAsPublic, 'false'), eq(variables['System.TeamProject'], 'internal')) }}: - - task: NuGetAuthenticate@1 - - - ${{ if and(ne(parameters.artifacts.download, 'false'), ne(parameters.artifacts.download, '')) }}: - - task: DownloadPipelineArtifact@2 - inputs: - buildType: current - artifactName: ${{ coalesce(parameters.artifacts.download.name, 'Artifacts_$(Agent.OS)_$(_BuildConfig)') }} - targetPath: ${{ coalesce(parameters.artifacts.download.path, 'artifacts') }} - itemPattern: ${{ coalesce(parameters.artifacts.download.pattern, '**') }} - - - ${{ each step in parameters.steps }}: - - ${{ step }} - - - ${{ if eq(parameters.enableRichCodeNavigation, true) }}: - - task: RichCodeNavIndexer@0 - displayName: RichCodeNav Upload - inputs: - languages: ${{ coalesce(parameters.richCodeNavigationLanguage, 'csharp') }} - environment: ${{ coalesce(parameters.richCodeNavigationEnvironment, 'production') }} - richNavLogOutputDirectory: $(Build.SourcesDirectory)/artifacts/bin - uploadRichNavArtifacts: ${{ coalesce(parameters.richCodeNavigationUploadArtifacts, false) }} - continueOnError: true - - - template: /eng/common/templates/steps/component-governance.yml - parameters: - ${{ if eq(parameters.disableComponentGovernance, '') }}: - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/dotnet/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}: - disableComponentGovernance: false - ${{ else }}: - disableComponentGovernance: true - ${{ else }}: - disableComponentGovernance: ${{ parameters.disableComponentGovernance }} - componentGovernanceIgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} - - - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: MicroBuildCleanup@1 - displayName: Execute Microbuild cleanup tasks - condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} - env: - TeamName: $(_TeamName) - - - ${{ if ne(parameters.artifacts.publish, '') }}: - - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: - - task: CopyFiles@2 - displayName: Gather binaries for publish to artifacts - inputs: - SourceFolder: 'artifacts/bin' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/bin' - - task: CopyFiles@2 - displayName: Gather packages for publish to artifacts - inputs: - SourceFolder: 'artifacts/packages' - Contents: '**' - TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/packages' - - task: PublishBuildArtifacts@1 - displayName: Publish pipeline artifacts - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts' - PublishLocation: Container - ArtifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} - continueOnError: true - condition: always() - - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: - - publish: artifacts/log - artifact: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} - displayName: Publish logs - continueOnError: true - condition: always() - - - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: - - task: PublishBuildArtifacts@1 - displayName: Publish Logs - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' - PublishLocation: Container - ArtifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} - continueOnError: true - condition: always() - - - ${{ if or(and(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, '')), eq(parameters.testResultsFormat, 'xunit')) }}: - - task: PublishTestResults@2 - displayName: Publish XUnit Test Results - inputs: - testResultsFormat: 'xUnit' - testResultsFiles: '*.xml' - searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' - testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-xunit - mergeTestResults: ${{ parameters.mergeTestResults }} - continueOnError: true - condition: always() - - ${{ if or(and(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, '')), eq(parameters.testResultsFormat, 'vstest')) }}: - - task: PublishTestResults@2 - displayName: Publish TRX Test Results - inputs: - testResultsFormat: 'VSTest' - testResultsFiles: '*.trx' - searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' - testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-trx - mergeTestResults: ${{ parameters.mergeTestResults }} - continueOnError: true - condition: always() - - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: - - template: /eng/common/templates/steps/generate-sbom.yml + componentGovernanceSteps: + - template: /eng/common/templates/steps/component-governance.yml parameters: - PackageVersion: ${{ parameters.packageVersion}} - BuildDropPath: ${{ parameters.buildDropPath }} - IgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} - - - ${{ if eq(parameters.enableBuildRetry, 'true') }}: - - publish: $(Build.SourcesDirectory)\eng\common\BuildConfiguration - artifact: BuildConfiguration - displayName: Publish build retry configuration - continueOnError: true + ${{ if eq(parameters.disableComponentGovernance, '') }}: + ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/dotnet/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}: + disableComponentGovernance: false + ${{ else }}: + disableComponentGovernance: true + ${{ else }}: + disableComponentGovernance: ${{ parameters.disableComponentGovernance }} + componentGovernanceIgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} + + artifactPublishSteps: + - ${{ if ne(parameters.artifacts.publish, '') }}: + - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: false + args: + displayName: Publish pipeline artifacts + pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts' + publishLocation: Container + artifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} + continueOnError: true + condition: always() + - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: + - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: false + args: + targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/log' + artifactName: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} + displayName: 'Publish logs' + continueOnError: true + condition: always() + sbomEnabled: false # we don't need SBOM for logs + + - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: false + args: + displayName: Publish Logs + pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)' + publishLocation: Container + artifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} + continueOnError: true + condition: always() + + - ${{ if eq(parameters.enableBuildRetry, 'true') }}: + - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: false + args: + targetPath: '$(Build.SourcesDirectory)\eng\common\BuildConfiguration' + artifactName: 'BuildConfiguration' + displayName: 'Publish build retry configuration' + continueOnError: true + sbomEnabled: false # we don't need SBOM for BuildConfiguration diff --git a/eng/common/templates/job/onelocbuild.yml b/eng/common/templates/job/onelocbuild.yml index 60ab00c4de3..ff829dc4c70 100644 --- a/eng/common/templates/job/onelocbuild.yml +++ b/eng/common/templates/job/onelocbuild.yml @@ -1,109 +1,7 @@ -parameters: - # Optional: dependencies of the job - dependsOn: '' - - # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool - pool: '' - - CeapexPat: $(dn-bot-ceapex-package-r) # PAT for the loc AzDO instance https://dev.azure.com/ceapex - GithubPat: $(BotAccount-dotnet-bot-repo-PAT) - - SourcesDirectory: $(Build.SourcesDirectory) - CreatePr: true - AutoCompletePr: false - ReusePr: true - UseLfLineEndings: true - UseCheckedInLocProjectJson: false - SkipLocProjectJsonGeneration: false - LanguageSet: VS_Main_Languages - LclSource: lclFilesInRepo - LclPackageId: '' - RepoType: gitHub - GitHubOrg: dotnet - MirrorRepo: '' - MirrorBranch: main - condition: '' - JobNameSuffix: '' - jobs: -- job: OneLocBuild${{ parameters.JobNameSuffix }} - - dependsOn: ${{ parameters.dependsOn }} - - displayName: OneLocBuild${{ parameters.JobNameSuffix }} - - variables: - - group: OneLocBuildVariables # Contains the CeapexPat and GithubPat - - name: _GenerateLocProjectArguments - value: -SourcesDirectory ${{ parameters.SourcesDirectory }} - -LanguageSet "${{ parameters.LanguageSet }}" - -CreateNeutralXlfs - - ${{ if eq(parameters.UseCheckedInLocProjectJson, 'true') }}: - - name: _GenerateLocProjectArguments - value: ${{ variables._GenerateLocProjectArguments }} -UseCheckedInLocProjectJson - - template: /eng/common/templates/variables/pool-providers.yml - - ${{ if ne(parameters.pool, '') }}: - pool: ${{ parameters.pool }} - ${{ if eq(parameters.pool, '') }}: - pool: - # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) - ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: - name: VSEngSS-MicroBuild2022-1ES - demands: Cmd - # If it's not devdiv, it's dnceng - ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: - name: $(DncEngInternalBuildPool) - demands: ImageOverride -equals windows.vs2019.amd64 - - steps: - - ${{ if ne(parameters.SkipLocProjectJsonGeneration, 'true') }}: - - task: Powershell@2 - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/generate-locproject.ps1 - arguments: $(_GenerateLocProjectArguments) - displayName: Generate LocProject.json - condition: ${{ parameters.condition }} - - - task: OneLocBuild@2 - displayName: OneLocBuild - env: - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - inputs: - locProj: eng/Localize/LocProject.json - outDir: $(Build.ArtifactStagingDirectory) - lclSource: ${{ parameters.LclSource }} - lclPackageId: ${{ parameters.LclPackageId }} - isCreatePrSelected: ${{ parameters.CreatePr }} - isAutoCompletePrSelected: ${{ parameters.AutoCompletePr }} - ${{ if eq(parameters.CreatePr, true) }}: - isUseLfLineEndingsSelected: ${{ parameters.UseLfLineEndings }} - ${{ if eq(parameters.RepoType, 'gitHub') }}: - isShouldReusePrSelected: ${{ parameters.ReusePr }} - packageSourceAuth: patAuth - patVariable: ${{ parameters.CeapexPat }} - ${{ if eq(parameters.RepoType, 'gitHub') }}: - repoType: ${{ parameters.RepoType }} - gitHubPatVariable: "${{ parameters.GithubPat }}" - ${{ if ne(parameters.MirrorRepo, '') }}: - isMirrorRepoSelected: true - gitHubOrganization: ${{ parameters.GitHubOrg }} - mirrorRepo: ${{ parameters.MirrorRepo }} - mirrorBranch: ${{ parameters.MirrorBranch }} - condition: ${{ parameters.condition }} - - - task: PublishBuildArtifacts@1 - displayName: Publish Localization Files - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/loc' - PublishLocation: Container - ArtifactName: Loc - condition: ${{ parameters.condition }} +- template: /eng/common/core-templates/job/onelocbuild.yml + parameters: + is1ESPipeline: false - - task: PublishBuildArtifacts@1 - displayName: Publish LocProject.json - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/eng/Localize/' - PublishLocation: Container - ArtifactName: Loc - condition: ${{ parameters.condition }} \ No newline at end of file + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index 8ec0151def2..ab2edec2adb 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -1,151 +1,7 @@ -parameters: - configuration: 'Debug' - - # Optional: condition for the job to run - condition: '' - - # Optional: 'true' if future jobs should run even if this job fails - continueOnError: false - - # Optional: dependencies of the job - dependsOn: '' - - # Optional: Include PublishBuildArtifacts task - enablePublishBuildArtifacts: false - - # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool - pool: {} - - # Optional: should run as a public build even in the internal project - # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. - runAsPublic: false - - # Optional: whether the build's artifacts will be published using release pipelines or direct feed publishing - publishUsingPipelines: false - - # Optional: whether the build's artifacts will be published using release pipelines or direct feed publishing - publishAssetsImmediately: false - - artifactsPublishingAdditionalParameters: '' - - signingValidationAdditionalParameters: '' - jobs: -- job: Asset_Registry_Publish - - dependsOn: ${{ parameters.dependsOn }} - timeoutInMinutes: 150 - - ${{ if eq(parameters.publishAssetsImmediately, 'true') }}: - displayName: Publish Assets - ${{ else }}: - displayName: Publish to Build Asset Registry - - variables: - - template: /eng/common/templates/variables/pool-providers.yml - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - group: Publish-Build-Assets - - group: AzureDevOps-Artifact-Feeds-Pats - - name: runCodesignValidationInjection - value: false - - ${{ if eq(parameters.publishAssetsImmediately, 'true') }}: - - template: /eng/common/templates/post-build/common-variables.yml - - pool: - # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) - ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: - name: VSEngSS-MicroBuild2022-1ES - demands: Cmd - # If it's not devdiv, it's dnceng - ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: - name: NetCore1ESPool-Publishing-Internal - demands: ImageOverride -equals windows.vs2019.amd64 - - steps: - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: DownloadBuildArtifacts@0 - displayName: Download artifact - inputs: - artifactName: AssetManifests - downloadPath: '$(Build.StagingDirectory)/Download' - checkDownloadedFiles: true - condition: ${{ parameters.condition }} - continueOnError: ${{ parameters.continueOnError }} - - - task: NuGetAuthenticate@1 - - - task: PowerShell@2 - displayName: Publish Build Assets - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet - /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' - /p:BuildAssetRegistryToken=$(MaestroAccessToken) - /p:MaestroApiEndpoint=https://maestro.dot.net - /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} - /p:OfficialBuildId=$(Build.BuildNumber) - condition: ${{ parameters.condition }} - continueOnError: ${{ parameters.continueOnError }} - - - task: powershell@2 - displayName: Create ReleaseConfigs Artifact - inputs: - targetType: inline - script: | - Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(BARBuildId) - Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value "$(DefaultChannels)" - Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(IsStableBuild) - - - task: PublishBuildArtifacts@1 - displayName: Publish ReleaseConfigs Artifact - inputs: - PathtoPublish: '$(Build.StagingDirectory)/ReleaseConfigs.txt' - PublishLocation: Container - ArtifactName: ReleaseConfigs - - - task: powershell@2 - displayName: Check if SymbolPublishingExclusionsFile.txt exists - inputs: - targetType: inline - script: | - $symbolExclusionfile = "$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt" - if(Test-Path -Path $symbolExclusionfile) - { - Write-Host "SymbolExclusionFile exists" - Write-Host "##vso[task.setvariable variable=SymbolExclusionFile]true" - } - else{ - Write-Host "Symbols Exclusion file does not exists" - Write-Host "##vso[task.setvariable variable=SymbolExclusionFile]false" - } - - - task: PublishBuildArtifacts@1 - displayName: Publish SymbolPublishingExclusionsFile Artifact - condition: eq(variables['SymbolExclusionFile'], 'true') - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' - PublishLocation: Container - ArtifactName: ReleaseConfigs - - - ${{ if eq(parameters.publishAssetsImmediately, 'true') }}: - - template: /eng/common/templates/post-build/setup-maestro-vars.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - - - task: PowerShell@2 - displayName: Publish Using Darc - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 - arguments: -BuildId $(BARBuildId) - -PublishingInfraVersion 3 - -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' - -MaestroToken '$(MaestroApiAccessToken)' - -WaitPublishingFinish true - -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' - -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' +- template: /eng/common/core-templates/job/publish-build-assets.yml + parameters: + is1ESPipeline: false - - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: - - template: /eng/common/templates/steps/publish-logs.yml - parameters: - JobLabel: 'Publish_Artifacts_Logs' + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/job/source-build.yml b/eng/common/templates/job/source-build.yml index 8a3deef2b72..e44d47b1d76 100644 --- a/eng/common/templates/job/source-build.yml +++ b/eng/common/templates/job/source-build.yml @@ -1,66 +1,7 @@ -parameters: - # This template adds arcade-powered source-build to CI. The template produces a server job with a - # default ID 'Source_Build_Complete' to put in a dependency list if necessary. - - # Specifies the prefix for source-build jobs added to pipeline. Use this if disambiguation needed. - jobNamePrefix: 'Source_Build' - - # Defines the platform on which to run the job. By default, a linux-x64 machine, suitable for - # managed-only repositories. This is an object with these properties: - # - # name: '' - # The name of the job. This is included in the job ID. - # targetRID: '' - # The name of the target RID to use, instead of the one auto-detected by Arcade. - # nonPortable: false - # Enables non-portable mode. This means a more specific RID (e.g. fedora.32-x64 rather than - # linux-x64), and compiling against distro-provided packages rather than portable ones. - # skipPublishValidation: false - # Disables publishing validation. By default, a check is performed to ensure no packages are - # published by source-build. - # container: '' - # A container to use. Runs in docker. - # pool: {} - # A pool to use. Runs directly on an agent. - # buildScript: '' - # Specifies the build script to invoke to perform the build in the repo. The default - # './build.sh' should work for typical Arcade repositories, but this is customizable for - # difficult situations. - # jobProperties: {} - # A list of job properties to inject at the top level, for potential extensibility beyond - # container and pool. - platform: {} - jobs: -- job: ${{ parameters.jobNamePrefix }}_${{ parameters.platform.name }} - displayName: Source-Build (${{ parameters.platform.name }}) - - ${{ each property in parameters.platform.jobProperties }}: - ${{ property.key }}: ${{ property.value }} - - ${{ if ne(parameters.platform.container, '') }}: - container: ${{ parameters.platform.container }} - - ${{ if eq(parameters.platform.pool, '') }}: - # The default VM host AzDO pool. This should be capable of running Docker containers: almost all - # source-build builds run in Docker, including the default managed platform. - # /eng/common/templates/variables/pool-providers.yml can't be used here (some customers declare variables already), so duplicate its logic - pool: - ${{ if eq(variables['System.TeamProject'], 'public') }}: - name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore-Svc-Public' ), False, 'NetCore-Public')] - demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open - - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore1ESPool-Svc-Internal'), False, 'NetCore1ESPool-Internal')] - demands: ImageOverride -equals Build.Ubuntu.1804.Amd64 - - ${{ if ne(parameters.platform.pool, '') }}: - pool: ${{ parameters.platform.pool }} - - workspace: - clean: all +- template: /eng/common/core-templates/job/source-build.yml + parameters: + is1ESPipeline: false - steps: - - template: /eng/common/templates/steps/source-build.yml - parameters: - platform: ${{ parameters.platform }} + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/job/source-index-stage1.yml b/eng/common/templates/job/source-index-stage1.yml index 0b6bb89dc78..89f3291593c 100644 --- a/eng/common/templates/job/source-index-stage1.yml +++ b/eng/common/templates/job/source-index-stage1.yml @@ -1,82 +1,7 @@ -parameters: - runAsPublic: false - sourceIndexUploadPackageVersion: 2.0.0-20240502.12 - sourceIndexProcessBinlogPackageVersion: 1.0.1-20240129.2 - sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json - sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" - preSteps: [] - binlogPath: artifacts/log/Debug/Build.binlog - condition: '' - dependsOn: '' - pool: '' - jobs: -- job: SourceIndexStage1 - dependsOn: ${{ parameters.dependsOn }} - condition: ${{ parameters.condition }} - variables: - - name: SourceIndexUploadPackageVersion - value: ${{ parameters.sourceIndexUploadPackageVersion }} - - name: SourceIndexProcessBinlogPackageVersion - value: ${{ parameters.sourceIndexProcessBinlogPackageVersion }} - - name: SourceIndexPackageSource - value: ${{ parameters.sourceIndexPackageSource }} - - name: BinlogPath - value: ${{ parameters.binlogPath }} - - template: /eng/common/templates/variables/pool-providers.yml - - ${{ if ne(parameters.pool, '') }}: - pool: ${{ parameters.pool }} - ${{ if eq(parameters.pool, '') }}: - pool: - ${{ if eq(variables['System.TeamProject'], 'public') }}: - name: $(DncEngPublicBuildPool) - demands: ImageOverride -equals windows.vs2019.amd64.open - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - name: $(DncEngInternalBuildPool) - demands: ImageOverride -equals windows.vs2019.amd64 - - steps: - - ${{ each preStep in parameters.preSteps }}: - - ${{ preStep }} - - - task: UseDotNet@2 - displayName: Use .NET 8 SDK - inputs: - packageType: sdk - version: 8.0.x - installationPath: $(Agent.TempDirectory)/dotnet - workingDirectory: $(Agent.TempDirectory) - - - script: | - $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version $(sourceIndexProcessBinlogPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools - $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version $(sourceIndexUploadPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools - displayName: Download Tools - # Set working directory to temp directory so 'dotnet' doesn't try to use global.json and use the repo's sdk. - workingDirectory: $(Agent.TempDirectory) - - - script: ${{ parameters.sourceIndexBuildCommand }} - displayName: Build Repository - - - script: $(Agent.TempDirectory)/.source-index/tools/BinLogToSln -i $(BinlogPath) -r $(Build.SourcesDirectory) -n $(Build.Repository.Name) -o .source-index/stage1output - displayName: Process Binlog into indexable sln - - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: AzureCLI@2 - displayName: Get stage 1 auth token - inputs: - azureSubscription: 'SourceDotNet Stage1 Publish' - addSpnToEnvironment: true - scriptType: 'ps' - scriptLocation: 'inlineScript' - inlineScript: | - echo "##vso[task.setvariable variable=ARM_CLIENT_ID;issecret=true]$env:servicePrincipalId" - echo "##vso[task.setvariable variable=ARM_ID_TOKEN;issecret=true]$env:idToken" - echo "##vso[task.setvariable variable=ARM_TENANT_ID;issecret=true]$env:tenantId" - - - script: | - az login --service-principal -u $(ARM_CLIENT_ID) --tenant $(ARM_TENANT_ID) --allow-no-subscriptions --federated-token $(ARM_ID_TOKEN) - displayName: "Login to Azure" +- template: /eng/common/core-templates/job/source-index-stage1.yml + parameters: + is1ESPipeline: false - - script: $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) -s netsourceindexstage1 -b stage1 - displayName: Upload stage1 artifacts to source index + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/jobs/codeql-build.yml b/eng/common/templates/jobs/codeql-build.yml index f7dc5ea4aaa..517f24d6a52 100644 --- a/eng/common/templates/jobs/codeql-build.yml +++ b/eng/common/templates/jobs/codeql-build.yml @@ -1,31 +1,7 @@ -parameters: - # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md - continueOnError: false - # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job - jobs: [] - # Optional: if specified, restore and use this version of Guardian instead of the default. - overrideGuardianVersion: '' - jobs: -- template: /eng/common/templates/jobs/jobs.yml +- template: /eng/common/core-templates/jobs/codeql-build.yml parameters: - enableMicrobuild: false - enablePublishBuildArtifacts: false - enablePublishTestResults: false - enablePublishBuildAssets: false - enablePublishUsingPipelines: false - enableTelemetry: true + is1ESPipeline: false - variables: - - group: Publish-Build-Assets - # The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in - # sync with the packages.config file. - - name: DefaultGuardianVersion - value: 0.109.0 - - name: GuardianPackagesConfigFile - value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config - - name: GuardianVersion - value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }} - - jobs: ${{ parameters.jobs }} - + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml index 289bb2396ce..388e9037b3e 100644 --- a/eng/common/templates/jobs/jobs.yml +++ b/eng/common/templates/jobs/jobs.yml @@ -1,97 +1,7 @@ -parameters: - # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md - continueOnError: false - - # Optional: Include PublishBuildArtifacts task - enablePublishBuildArtifacts: false - - # Optional: Enable publishing using release pipelines - enablePublishUsingPipelines: false - - # Optional: Enable running the source-build jobs to build repo from source - enableSourceBuild: false - - # Optional: Parameters for source-build template. - # See /eng/common/templates/jobs/source-build.yml for options - sourceBuildParameters: [] - - graphFileGeneration: - # Optional: Enable generating the graph files at the end of the build - enabled: false - # Optional: Include toolset dependencies in the generated graph files - includeToolset: false - - # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job - jobs: [] - - # Optional: Override automatically derived dependsOn value for "publish build assets" job - publishBuildAssetsDependsOn: '' - - # Optional: Publish the assets as soon as the publish to BAR stage is complete, rather doing so in a separate stage. - publishAssetsImmediately: false - - # Optional: If using publishAssetsImmediately and additional parameters are needed, can be used to send along additional parameters (normally sent to post-build.yml) - artifactsPublishingAdditionalParameters: '' - signingValidationAdditionalParameters: '' - - # Optional: should run as a public build even in the internal project - # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. - runAsPublic: false - - enableSourceIndex: false - sourceIndexParams: {} - -# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, -# and some (Microbuild) should only be applied to non-PR cases for internal builds. - jobs: -- ${{ each job in parameters.jobs }}: - - template: ../job/job.yml - parameters: - # pass along parameters - ${{ each parameter in parameters }}: - ${{ if ne(parameter.key, 'jobs') }}: - ${{ parameter.key }}: ${{ parameter.value }} - - # pass along job properties - ${{ each property in job }}: - ${{ if ne(property.key, 'job') }}: - ${{ property.key }}: ${{ property.value }} - - name: ${{ job.job }} - -- ${{ if eq(parameters.enableSourceBuild, true) }}: - - template: /eng/common/templates/jobs/source-build.yml - parameters: - allCompletedJobId: Source_Build_Complete - ${{ each parameter in parameters.sourceBuildParameters }}: - ${{ parameter.key }}: ${{ parameter.value }} - -- ${{ if eq(parameters.enableSourceIndex, 'true') }}: - - template: ../job/source-index-stage1.yml - parameters: - runAsPublic: ${{ parameters.runAsPublic }} - ${{ each parameter in parameters.sourceIndexParams }}: - ${{ parameter.key }}: ${{ parameter.value }} - -- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - ${{ if or(eq(parameters.enablePublishBuildAssets, true), eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, '')) }}: - - template: ../job/publish-build-assets.yml - parameters: - continueOnError: ${{ parameters.continueOnError }} - dependsOn: - - ${{ if ne(parameters.publishBuildAssetsDependsOn, '') }}: - - ${{ each job in parameters.publishBuildAssetsDependsOn }}: - - ${{ job.job }} - - ${{ if eq(parameters.publishBuildAssetsDependsOn, '') }}: - - ${{ each job in parameters.jobs }}: - - ${{ job.job }} - - ${{ if eq(parameters.enableSourceBuild, true) }}: - - Source_Build_Complete +- template: /eng/common/core-templates/jobs/jobs.yml + parameters: + is1ESPipeline: false - runAsPublic: ${{ parameters.runAsPublic }} - publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }} - publishAssetsImmediately: ${{ parameters.publishAssetsImmediately }} - enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - signingValidationAdditionalParameters: ${{ parameters.signingValidationAdditionalParameters }} + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/jobs/source-build.yml b/eng/common/templates/jobs/source-build.yml index a15b07eb51d..818d4c326db 100644 --- a/eng/common/templates/jobs/source-build.yml +++ b/eng/common/templates/jobs/source-build.yml @@ -1,46 +1,7 @@ -parameters: - # This template adds arcade-powered source-build to CI. A job is created for each platform, as - # well as an optional server job that completes when all platform jobs complete. - - # The name of the "join" job for all source-build platforms. If set to empty string, the job is - # not included. Existing repo pipelines can use this job depend on all source-build jobs - # completing without maintaining a separate list of every single job ID: just depend on this one - # server job. By default, not included. Recommended name if used: 'Source_Build_Complete'. - allCompletedJobId: '' - - # See /eng/common/templates/job/source-build.yml - jobNamePrefix: 'Source_Build' - - # This is the default platform provided by Arcade, intended for use by a managed-only repo. - defaultManagedPlatform: - name: 'Managed' - container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8' - - # Defines the platforms on which to run build jobs. One job is created for each platform, and the - # object in this array is sent to the job template as 'platform'. If no platforms are specified, - # one job runs on 'defaultManagedPlatform'. - platforms: [] - jobs: +- template: /eng/common/core-templates/jobs/source-build.yml + parameters: + is1ESPipeline: false -- ${{ if ne(parameters.allCompletedJobId, '') }}: - - job: ${{ parameters.allCompletedJobId }} - displayName: Source-Build Complete - pool: server - dependsOn: - - ${{ each platform in parameters.platforms }}: - - ${{ parameters.jobNamePrefix }}_${{ platform.name }} - - ${{ if eq(length(parameters.platforms), 0) }}: - - ${{ parameters.jobNamePrefix }}_${{ parameters.defaultManagedPlatform.name }} - -- ${{ each platform in parameters.platforms }}: - - template: /eng/common/templates/job/source-build.yml - parameters: - jobNamePrefix: ${{ parameters.jobNamePrefix }} - platform: ${{ platform }} - -- ${{ if eq(length(parameters.platforms), 0) }}: - - template: /eng/common/templates/job/source-build.yml - parameters: - jobNamePrefix: ${{ parameters.jobNamePrefix }} - platform: ${{ parameters.defaultManagedPlatform }} + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml index 173914f2364..7fa10587559 100644 --- a/eng/common/templates/post-build/common-variables.yml +++ b/eng/common/templates/post-build/common-variables.yml @@ -1,22 +1,8 @@ variables: - - group: Publish-Build-Assets +- template: /eng/common/core-templates/post-build/common-variables.yml + parameters: + # Specifies whether to use 1ES + is1ESPipeline: false - # Whether the build is internal or not - - name: IsInternalBuild - value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }} - - # Default Maestro++ API Endpoint and API Version - - name: MaestroApiEndPoint - value: "https://maestro.dot.net" - - name: MaestroApiAccessToken - value: $(MaestroAccessToken) - - name: MaestroApiVersion - value: "2020-02-20" - - - name: SourceLinkCLIVersion - value: 3.0.0 - - name: SymbolToolVersion - value: 1.0.1 - - - name: runCodesignValidationInjection - value: false + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index aba44a25a33..53ede714bdd 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -1,281 +1,8 @@ -parameters: - # Which publishing infra should be used. THIS SHOULD MATCH THE VERSION ON THE BUILD MANIFEST. - # Publishing V1 is no longer supported - # Publishing V2 is no longer supported - # Publishing V3 is the default - - name: publishingInfraVersion - displayName: Which version of publishing should be used to promote the build definition? - type: number - default: 3 - values: - - 3 - - - name: BARBuildId - displayName: BAR Build Id - type: number - default: 0 - - - name: PromoteToChannelIds - displayName: Channel to promote BARBuildId to - type: string - default: '' - - - name: enableSourceLinkValidation - displayName: Enable SourceLink validation - type: boolean - default: false - - - name: enableSigningValidation - displayName: Enable signing validation - type: boolean - default: true - - - name: enableSymbolValidation - displayName: Enable symbol validation - type: boolean - default: false - - - name: enableNugetValidation - displayName: Enable NuGet validation - type: boolean - default: true - - - name: publishInstallersAndChecksums - displayName: Publish installers and checksums - type: boolean - default: true - - - name: SDLValidationParameters - type: object - default: - enable: false - publishGdn: false - continueOnError: false - params: '' - artifactNames: '' - downloadArtifacts: true - - # These parameters let the user customize the call to sdk-task.ps1 for publishing - # symbols & general artifacts as well as for signing validation - - name: symbolPublishingAdditionalParameters - displayName: Symbol publishing additional parameters - type: string - default: '' - - - name: artifactsPublishingAdditionalParameters - displayName: Artifact publishing additional parameters - type: string - default: '' - - - name: signingValidationAdditionalParameters - displayName: Signing validation additional parameters - type: string - default: '' - - # Which stages should finish execution before post-build stages start - - name: validateDependsOn - type: object - default: - - build - - - name: publishDependsOn - type: object - default: - - Validate - - # Optional: Call asset publishing rather than running in a separate stage - - name: publishAssetsImmediately - type: boolean - default: false - stages: -- ${{ if or(eq( parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: - - stage: Validate - dependsOn: ${{ parameters.validateDependsOn }} - displayName: Validate Build Assets - variables: - - template: common-variables.yml - - template: /eng/common/templates/variables/pool-providers.yml - jobs: - - job: - displayName: NuGet Validation - condition: and(succeededOrFailed(), eq( ${{ parameters.enableNugetValidation }}, 'true')) - pool: - # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) - ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: - name: VSEngSS-MicroBuild2022-1ES - demands: Cmd - # If it's not devdiv, it's dnceng - ${{ else }}: - name: $(DncEngInternalBuildPool) - demands: ImageOverride -equals windows.vs2019.amd64 - - steps: - - template: setup-maestro-vars.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: PackageArtifacts - checkDownloadedFiles: true - - - task: PowerShell@2 - displayName: Validate - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1 - arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ - -ToolDestinationPath $(Agent.BuildDirectory)/Extract/ - - - job: - displayName: Signing Validation - condition: and( eq( ${{ parameters.enableSigningValidation }}, 'true'), ne( variables['PostBuildSign'], 'true')) - pool: - # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) - ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: - name: VSEngSS-MicroBuild2022-1ES - demands: Cmd - # If it's not devdiv, it's dnceng - ${{ else }}: - name: $(DncEngInternalBuildPool) - demands: ImageOverride -equals windows.vs2019.amd64 - steps: - - template: setup-maestro-vars.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: PackageArtifacts - checkDownloadedFiles: true - itemPattern: | - ** - !**/Microsoft.SourceBuild.Intermediate.*.nupkg - - # This is necessary whenever we want to publish/restore to an AzDO private feed - # Since sdk-task.ps1 tries to restore packages we need to do this authentication here - # otherwise it'll complain about accessing a private feed. - - task: NuGetAuthenticate@1 - displayName: 'Authenticate to AzDO Feeds' - - # Signing validation will optionally work with the buildmanifest file which is downloaded from - # Azure DevOps above. - - task: PowerShell@2 - displayName: Validate - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task SigningValidation -restore -msbuildEngine vs - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts' - /p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt' - ${{ parameters.signingValidationAdditionalParameters }} - - - template: ../steps/publish-logs.yml - parameters: - StageLabel: 'Validation' - JobLabel: 'Signing' - - - job: - displayName: SourceLink Validation - condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true') - pool: - # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) - ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: - name: VSEngSS-MicroBuild2022-1ES - demands: Cmd - # If it's not devdiv, it's dnceng - ${{ else }}: - name: $(DncEngInternalBuildPool) - demands: ImageOverride -equals windows.vs2019.amd64 - steps: - - template: setup-maestro-vars.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: BlobArtifacts - checkDownloadedFiles: true - - - task: PowerShell@2 - displayName: Validate - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1 - arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ - -ExtractPath $(Agent.BuildDirectory)/Extract/ - -GHRepoName $(Build.Repository.Name) - -GHCommit $(Build.SourceVersion) - -SourcelinkCliVersion $(SourceLinkCLIVersion) - continueOnError: true - - - template: /eng/common/templates/job/execute-sdl.yml - parameters: - enable: ${{ parameters.SDLValidationParameters.enable }} - publishGuardianDirectoryToPipeline: ${{ parameters.SDLValidationParameters.publishGdn }} - additionalParameters: ${{ parameters.SDLValidationParameters.params }} - continueOnError: ${{ parameters.SDLValidationParameters.continueOnError }} - artifactNames: ${{ parameters.SDLValidationParameters.artifactNames }} - downloadArtifacts: ${{ parameters.SDLValidationParameters.downloadArtifacts }} - -- ${{ if ne(parameters.publishAssetsImmediately, 'true') }}: - - stage: publish_using_darc - ${{ if or(eq(parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: - dependsOn: ${{ parameters.publishDependsOn }} - ${{ else }}: - dependsOn: ${{ parameters.validateDependsOn }} - displayName: Publish using Darc - variables: - - template: common-variables.yml - - template: /eng/common/templates/variables/pool-providers.yml - jobs: - - job: - displayName: Publish Using Darc - timeoutInMinutes: 120 - pool: - # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) - ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: - name: VSEngSS-MicroBuild2022-1ES - demands: Cmd - # If it's not devdiv, it's dnceng - ${{ else }}: - name: NetCore1ESPool-Publishing-Internal - demands: ImageOverride -equals windows.vs2019.amd64 - steps: - - template: setup-maestro-vars.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - - - task: NuGetAuthenticate@1 +- template: /eng/common/core-templates/post-build/post-build.yml + parameters: + # Specifies whether to use 1ES + is1ESPipeline: false - - task: PowerShell@2 - displayName: Publish Using Darc - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 - arguments: -BuildId $(BARBuildId) - -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} - -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' - -MaestroToken '$(MaestroApiAccessToken)' - -WaitPublishingFinish true - -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' - -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates/post-build/setup-maestro-vars.yml b/eng/common/templates/post-build/setup-maestro-vars.yml index 0c87f149a4a..a79fab5b441 100644 --- a/eng/common/templates/post-build/setup-maestro-vars.yml +++ b/eng/common/templates/post-build/setup-maestro-vars.yml @@ -1,70 +1,8 @@ -parameters: - BARBuildId: '' - PromoteToChannelIds: '' - steps: - - ${{ if eq(coalesce(parameters.PromoteToChannelIds, 0), 0) }}: - - task: DownloadBuildArtifacts@0 - displayName: Download Release Configs - inputs: - buildType: current - artifactName: ReleaseConfigs - checkDownloadedFiles: true - - - task: PowerShell@2 - name: setReleaseVars - displayName: Set Release Configs Vars - inputs: - targetType: inline - pwsh: true - script: | - try { - if (!$Env:PromoteToMaestroChannels -or $Env:PromoteToMaestroChannels.Trim() -eq '') { - $Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt - - $BarId = $Content | Select -Index 0 - $Channels = $Content | Select -Index 1 - $IsStableBuild = $Content | Select -Index 2 - - $AzureDevOpsProject = $Env:System_TeamProject - $AzureDevOpsBuildDefinitionId = $Env:System_DefinitionId - $AzureDevOpsBuildId = $Env:Build_BuildId - } - else { - $buildApiEndpoint = "${Env:MaestroApiEndPoint}/api/builds/${Env:BARBuildId}?api-version=${Env:MaestroApiVersion}" - - $apiHeaders = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' - $apiHeaders.Add('Accept', 'application/json') - $apiHeaders.Add('Authorization',"Bearer ${Env:MAESTRO_API_TOKEN}") - - $buildInfo = try { Invoke-WebRequest -Method Get -Uri $buildApiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } - - $BarId = $Env:BARBuildId - $Channels = $Env:PromoteToMaestroChannels -split "," - $Channels = $Channels -join "][" - $Channels = "[$Channels]" - - $IsStableBuild = $buildInfo.stable - $AzureDevOpsProject = $buildInfo.azureDevOpsProject - $AzureDevOpsBuildDefinitionId = $buildInfo.azureDevOpsBuildDefinitionId - $AzureDevOpsBuildId = $buildInfo.azureDevOpsBuildId - } - - Write-Host "##vso[task.setvariable variable=BARBuildId]$BarId" - Write-Host "##vso[task.setvariable variable=TargetChannels]$Channels" - Write-Host "##vso[task.setvariable variable=IsStableBuild]$IsStableBuild" +- template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + # Specifies whether to use 1ES + is1ESPipeline: false - Write-Host "##vso[task.setvariable variable=AzDOProjectName]$AzureDevOpsProject" - Write-Host "##vso[task.setvariable variable=AzDOPipelineId]$AzureDevOpsBuildDefinitionId" - Write-Host "##vso[task.setvariable variable=AzDOBuildId]$AzureDevOpsBuildId" - } - catch { - Write-Host $_ - Write-Host $_.Exception - Write-Host $_.ScriptStackTrace - exit 1 - } - env: - MAESTRO_API_TOKEN: $(MaestroApiAccessToken) - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToMaestroChannels: ${{ parameters.PromoteToChannelIds }} + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates/post-build/trigger-subscription.yml b/eng/common/templates/post-build/trigger-subscription.yml deleted file mode 100644 index da669030daf..00000000000 --- a/eng/common/templates/post-build/trigger-subscription.yml +++ /dev/null @@ -1,13 +0,0 @@ -parameters: - ChannelId: 0 - -steps: -- task: PowerShell@2 - displayName: Triggering subscriptions - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/trigger-subscriptions.ps1 - arguments: -SourceRepo $(Build.Repository.Uri) - -ChannelId ${{ parameters.ChannelId }} - -MaestroApiAccessToken $(MaestroAccessToken) - -MaestroApiEndPoint $(MaestroApiEndPoint) - -MaestroApiVersion $(MaestroApiVersion) diff --git a/eng/common/templates/steps/add-build-to-channel.yml b/eng/common/templates/steps/add-build-to-channel.yml deleted file mode 100644 index f67a210d62f..00000000000 --- a/eng/common/templates/steps/add-build-to-channel.yml +++ /dev/null @@ -1,13 +0,0 @@ -parameters: - ChannelId: 0 - -steps: -- task: PowerShell@2 - displayName: Add Build to Channel - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/add-build-to-channel.ps1 - arguments: -BuildId $(BARBuildId) - -ChannelId ${{ parameters.ChannelId }} - -MaestroApiAccessToken $(MaestroApiAccessToken) - -MaestroApiEndPoint $(MaestroApiEndPoint) - -MaestroApiVersion $(MaestroApiVersion) diff --git a/eng/common/templates/steps/build-reason.yml b/eng/common/templates/steps/build-reason.yml deleted file mode 100644 index eba58109b52..00000000000 --- a/eng/common/templates/steps/build-reason.yml +++ /dev/null @@ -1,12 +0,0 @@ -# build-reason.yml -# Description: runs steps if build.reason condition is valid. conditions is a string of valid build reasons -# to include steps (',' separated). -parameters: - conditions: '' - steps: [] - -steps: - - ${{ if and( not(startsWith(parameters.conditions, 'not')), contains(parameters.conditions, variables['build.reason'])) }}: - - ${{ parameters.steps }} - - ${{ if and( startsWith(parameters.conditions, 'not'), not(contains(parameters.conditions, variables['build.reason']))) }}: - - ${{ parameters.steps }} diff --git a/eng/common/templates/steps/component-governance.yml b/eng/common/templates/steps/component-governance.yml index cbba0596709..c12a5f8d21d 100644 --- a/eng/common/templates/steps/component-governance.yml +++ b/eng/common/templates/steps/component-governance.yml @@ -1,13 +1,7 @@ -parameters: - disableComponentGovernance: false - componentGovernanceIgnoreDirectories: '' - steps: -- ${{ if eq(parameters.disableComponentGovernance, 'true') }}: - - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true" - displayName: Set skipComponentGovernanceDetection variable -- ${{ if ne(parameters.disableComponentGovernance, 'true') }}: - - task: ComponentGovernanceComponentDetection@0 - continueOnError: true - inputs: - ignoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} \ No newline at end of file +- template: /eng/common/core-templates/steps/component-governance.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/enable-internal-runtimes.yml b/eng/common/templates/steps/enable-internal-runtimes.yml new file mode 100644 index 00000000000..b21a8038cc1 --- /dev/null +++ b/eng/common/templates/steps/enable-internal-runtimes.yml @@ -0,0 +1,10 @@ +# Obtains internal runtime download credentials and populates the 'dotnetbuilds-internal-container-read-token-base64' +# variable with the base64-encoded SAS token, by default + +steps: +- template: /eng/common/core-templates/steps/enable-internal-runtimes.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/enable-internal-sources.yml b/eng/common/templates/steps/enable-internal-sources.yml new file mode 100644 index 00000000000..5f87e9abb8a --- /dev/null +++ b/eng/common/templates/steps/enable-internal-sources.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/enable-internal-sources.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates/steps/execute-codeql.yml b/eng/common/templates/steps/execute-codeql.yml deleted file mode 100644 index 3930b163021..00000000000 --- a/eng/common/templates/steps/execute-codeql.yml +++ /dev/null @@ -1,32 +0,0 @@ -parameters: - # Language that should be analyzed. Defaults to csharp - language: csharp - # Build Commands - buildCommands: '' - overrideParameters: '' # Optional: to override values for parameters. - additionalParameters: '' # Optional: parameters that need user specific values eg: '-SourceToolsList @("abc","def") -ArtifactToolsList @("ghi","jkl")' - # Optional: if specified, restore and use this version of Guardian instead of the default. - overrideGuardianVersion: '' - # Optional: if true, publish the '.gdn' folder as a pipeline artifact. This can help with in-depth - # diagnosis of problems with specific tool configurations. - publishGuardianDirectoryToPipeline: false - # The script to run to execute all SDL tools. Use this if you want to use a script to define SDL - # parameters rather than relying on YAML. It may be better to use a local script, because you can - # reproduce results locally without piecing together a command based on the YAML. - executeAllSdlToolsScript: 'eng/common/sdl/execute-all-sdl-tools.ps1' - # There is some sort of bug (has been reported) in Azure DevOps where if this parameter is named - # 'continueOnError', the parameter value is not correctly picked up. - # This can also be remedied by the caller (post-build.yml) if it does not use a nested parameter - # optional: determines whether to continue the build if the step errors; - sdlContinueOnError: false - -steps: -- template: /eng/common/templates/steps/execute-sdl.yml - parameters: - overrideGuardianVersion: ${{ parameters.overrideGuardianVersion }} - executeAllSdlToolsScript: ${{ parameters.executeAllSdlToolsScript }} - overrideParameters: ${{ parameters.overrideParameters }} - additionalParameters: '${{ parameters.additionalParameters }} - -CodeQLAdditionalRunConfigParams @("BuildCommands < ${{ parameters.buildCommands }}", "Language < ${{ parameters.language }}")' - publishGuardianDirectoryToPipeline: ${{ parameters.publishGuardianDirectoryToPipeline }} - sdlContinueOnError: ${{ parameters.sdlContinueOnError }} \ No newline at end of file diff --git a/eng/common/templates/steps/execute-sdl.yml b/eng/common/templates/steps/execute-sdl.yml deleted file mode 100644 index 07426fde05d..00000000000 --- a/eng/common/templates/steps/execute-sdl.yml +++ /dev/null @@ -1,88 +0,0 @@ -parameters: - overrideGuardianVersion: '' - executeAllSdlToolsScript: '' - overrideParameters: '' - additionalParameters: '' - publishGuardianDirectoryToPipeline: false - sdlContinueOnError: false - condition: '' - -steps: -- task: NuGetAuthenticate@1 - inputs: - nuGetServiceConnections: GuardianConnect - -- task: NuGetToolInstaller@1 - displayName: 'Install NuGet.exe' - -- ${{ if ne(parameters.overrideGuardianVersion, '') }}: - - pwsh: | - Set-Location -Path $(Build.SourcesDirectory)\eng\common\sdl - . .\sdl.ps1 - $guardianCliLocation = Install-Gdn -Path $(Build.SourcesDirectory)\.artifacts -Version ${{ parameters.overrideGuardianVersion }} - Write-Host "##vso[task.setvariable variable=GuardianCliLocation]$guardianCliLocation" - displayName: Install Guardian (Overridden) - -- ${{ if eq(parameters.overrideGuardianVersion, '') }}: - - pwsh: | - Set-Location -Path $(Build.SourcesDirectory)\eng\common\sdl - . .\sdl.ps1 - $guardianCliLocation = Install-Gdn -Path $(Build.SourcesDirectory)\.artifacts - Write-Host "##vso[task.setvariable variable=GuardianCliLocation]$guardianCliLocation" - displayName: Install Guardian - -- ${{ if ne(parameters.overrideParameters, '') }}: - - powershell: ${{ parameters.executeAllSdlToolsScript }} ${{ parameters.overrideParameters }} - displayName: Execute SDL (Overridden) - continueOnError: ${{ parameters.sdlContinueOnError }} - condition: ${{ parameters.condition }} - -- ${{ if eq(parameters.overrideParameters, '') }}: - - powershell: ${{ parameters.executeAllSdlToolsScript }} - -GuardianCliLocation $(GuardianCliLocation) - -NugetPackageDirectory $(Build.SourcesDirectory)\.packages - -AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw) - ${{ parameters.additionalParameters }} - displayName: Execute SDL - continueOnError: ${{ parameters.sdlContinueOnError }} - condition: ${{ parameters.condition }} - -- ${{ if ne(parameters.publishGuardianDirectoryToPipeline, 'false') }}: - # We want to publish the Guardian results and configuration for easy diagnosis. However, the - # '.gdn' dir is a mix of configuration, results, extracted dependencies, and Guardian default - # tooling files. Some of these files are large and aren't useful during an investigation, so - # exclude them by simply deleting them before publishing. (As of writing, there is no documented - # way to selectively exclude a dir from the pipeline artifact publish task.) - - task: DeleteFiles@1 - displayName: Delete Guardian dependencies to avoid uploading - inputs: - SourceFolder: $(Agent.BuildDirectory)/.gdn - Contents: | - c - i - condition: succeededOrFailed() - - - publish: $(Agent.BuildDirectory)/.gdn - artifact: GuardianConfiguration - displayName: Publish GuardianConfiguration - condition: succeededOrFailed() - - # Publish the SARIF files in a container named CodeAnalysisLogs to enable integration - # with the "SARIF SAST Scans Tab" Azure DevOps extension - - task: CopyFiles@2 - displayName: Copy SARIF files - inputs: - flattenFolders: true - sourceFolder: $(Agent.BuildDirectory)/.gdn/rc/ - contents: '**/*.sarif' - targetFolder: $(Build.SourcesDirectory)/CodeAnalysisLogs - condition: succeededOrFailed() - - # Use PublishBuildArtifacts because the SARIF extension only checks this case - # see microsoft/sarif-azuredevops-extension#4 - - task: PublishBuildArtifacts@1 - displayName: Publish SARIF files to CodeAnalysisLogs container - inputs: - pathToPublish: $(Build.SourcesDirectory)/CodeAnalysisLogs - artifactName: CodeAnalysisLogs - condition: succeededOrFailed() \ No newline at end of file diff --git a/eng/common/templates/steps/generate-sbom.yml b/eng/common/templates/steps/generate-sbom.yml index 2b21eae4273..26dc00a2e0f 100644 --- a/eng/common/templates/steps/generate-sbom.yml +++ b/eng/common/templates/steps/generate-sbom.yml @@ -1,48 +1,7 @@ -# BuildDropPath - The root folder of the drop directory for which the manifest file will be generated. -# PackageName - The name of the package this SBOM represents. -# PackageVersion - The version of the package this SBOM represents. -# ManifestDirPath - The path of the directory where the generated manifest files will be placed -# IgnoreDirectories - Directories to ignore for SBOM generation. This will be passed through to the CG component detector. - -parameters: - PackageVersion: 8.0.0 - BuildDropPath: '$(Build.SourcesDirectory)/artifacts' - PackageName: '.NET' - ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom - IgnoreDirectories: '' - sbomContinueOnError: true - steps: -- task: PowerShell@2 - displayName: Prep for SBOM generation in (Non-linux) - condition: or(eq(variables['Agent.Os'], 'Windows_NT'), eq(variables['Agent.Os'], 'Darwin')) - inputs: - filePath: ./eng/common/generate-sbom-prep.ps1 - arguments: ${{parameters.manifestDirPath}} - -# Chmodding is a workaround for https://github.com/dotnet/arcade/issues/8461 -- script: | - chmod +x ./eng/common/generate-sbom-prep.sh - ./eng/common/generate-sbom-prep.sh ${{parameters.manifestDirPath}} - displayName: Prep for SBOM generation in (Linux) - condition: eq(variables['Agent.Os'], 'Linux') - continueOnError: ${{ parameters.sbomContinueOnError }} - -- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 - displayName: 'Generate SBOM manifest' - continueOnError: ${{ parameters.sbomContinueOnError }} - inputs: - PackageName: ${{ parameters.packageName }} - BuildDropPath: ${{ parameters.buildDropPath }} - PackageVersion: ${{ parameters.packageVersion }} - ManifestDirPath: ${{ parameters.manifestDirPath }} - ${{ if ne(parameters.IgnoreDirectories, '') }}: - AdditionalComponentDetectorArgs: '--IgnoreDirectories ${{ parameters.IgnoreDirectories }}' - -- task: PublishPipelineArtifact@1 - displayName: Publish SBOM manifest - continueOnError: ${{parameters.sbomContinueOnError}} - inputs: - targetPath: '${{parameters.manifestDirPath}}' - artifactName: $(ARTIFACT_NAME) +- template: /eng/common/core-templates/steps/generate-sbom.yml + parameters: + is1ESPipeline: false + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/get-delegation-sas.yml b/eng/common/templates/steps/get-delegation-sas.yml new file mode 100644 index 00000000000..83760c9798e --- /dev/null +++ b/eng/common/templates/steps/get-delegation-sas.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/get-delegation-sas.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/get-federated-access-token.yml b/eng/common/templates/steps/get-federated-access-token.yml new file mode 100644 index 00000000000..31e151d9d9e --- /dev/null +++ b/eng/common/templates/steps/get-federated-access-token.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/get-federated-access-token.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates/steps/publish-build-artifacts.yml b/eng/common/templates/steps/publish-build-artifacts.yml new file mode 100644 index 00000000000..6428a98dfef --- /dev/null +++ b/eng/common/templates/steps/publish-build-artifacts.yml @@ -0,0 +1,40 @@ +parameters: +- name: is1ESPipeline + type: boolean + default: false + +- name: displayName + type: string + default: 'Publish to Build Artifact' + +- name: condition + type: string + default: succeeded() + +- name: artifactName + type: string + +- name: pathToPublish + type: string + +- name: continueOnError + type: boolean + default: false + +- name: publishLocation + type: string + default: 'Container' + +steps: +- ${{ if eq(parameters.is1ESPipeline, true) }}: + - 'eng/common/templates cannot be referenced from a 1ES managed template': error +- task: PublishBuildArtifacts@1 + displayName: ${{ parameters.displayName }} + condition: ${{ parameters.condition }} + ${{ if parameters.continueOnError }}: + continueOnError: ${{ parameters.continueOnError }} + inputs: + PublishLocation: ${{ parameters.publishLocation }} + PathtoPublish: ${{ parameters.pathToPublish }} + ${{ if parameters.artifactName }}: + ArtifactName: ${{ parameters.artifactName }} \ No newline at end of file diff --git a/eng/common/templates/steps/publish-logs.yml b/eng/common/templates/steps/publish-logs.yml index 88f238f36bf..4ea86bd8823 100644 --- a/eng/common/templates/steps/publish-logs.yml +++ b/eng/common/templates/steps/publish-logs.yml @@ -1,23 +1,7 @@ -parameters: - StageLabel: '' - JobLabel: '' - steps: -- task: Powershell@2 - displayName: Prepare Binlogs to Upload - inputs: - targetType: inline - script: | - New-Item -ItemType Directory $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/ - Move-Item -Path $(Build.SourcesDirectory)/artifacts/log/Debug/* $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/ - continueOnError: true - condition: always() +- template: /eng/common/core-templates/steps/publish-logs.yml + parameters: + is1ESPipeline: false -- task: PublishBuildArtifacts@1 - displayName: Publish Logs - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/PostBuildLogs' - PublishLocation: Container - ArtifactName: PostBuildLogs - continueOnError: true - condition: always() + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/publish-pipeline-artifacts.yml b/eng/common/templates/steps/publish-pipeline-artifacts.yml new file mode 100644 index 00000000000..5dd698b212f --- /dev/null +++ b/eng/common/templates/steps/publish-pipeline-artifacts.yml @@ -0,0 +1,34 @@ +parameters: +- name: is1ESPipeline + type: boolean + default: false + +- name: args + type: object + default: {} + +steps: +- ${{ if eq(parameters.is1ESPipeline, true) }}: + - 'eng/common/templates cannot be referenced from a 1ES managed template': error +- task: PublishPipelineArtifact@1 + displayName: ${{ coalesce(parameters.args.displayName, 'Publish to Build Artifact') }} + ${{ if parameters.args.condition }}: + condition: ${{ parameters.args.condition }} + ${{ else }}: + condition: succeeded() + ${{ if parameters.args.continueOnError }}: + continueOnError: ${{ parameters.args.continueOnError }} + inputs: + targetPath: ${{ parameters.args.targetPath }} + ${{ if parameters.args.artifactName }}: + artifactName: ${{ parameters.args.artifactName }} + ${{ if parameters.args.publishLocation }}: + publishLocation: ${{ parameters.args.publishLocation }} + ${{ if parameters.args.fileSharePath }}: + fileSharePath: ${{ parameters.args.fileSharePath }} + ${{ if parameters.args.Parallel }}: + parallel: ${{ parameters.args.Parallel }} + ${{ if parameters.args.parallelCount }}: + parallelCount: ${{ parameters.args.parallelCount }} + ${{ if parameters.args.properties }}: + properties: ${{ parameters.args.properties }} \ No newline at end of file diff --git a/eng/common/templates/steps/retain-build.yml b/eng/common/templates/steps/retain-build.yml index 83d97a26a01..8e841ace3d2 100644 --- a/eng/common/templates/steps/retain-build.yml +++ b/eng/common/templates/steps/retain-build.yml @@ -1,28 +1,7 @@ -parameters: - # Optional azure devops PAT with build execute permissions for the build's organization, - # only needed if the build that should be retained ran on a different organization than - # the pipeline where this template is executing from - Token: '' - # Optional BuildId to retain, defaults to the current running build - BuildId: '' - # Azure devops Organization URI for the build in the https://dev.azure.com/ format. - # Defaults to the organization the current pipeline is running on - AzdoOrgUri: '$(System.CollectionUri)' - # Azure devops project for the build. Defaults to the project the current pipeline is running on - AzdoProject: '$(System.TeamProject)' - steps: - - task: powershell@2 - inputs: - targetType: 'filePath' - filePath: eng/common/retain-build.ps1 - pwsh: true - arguments: > - -AzdoOrgUri: ${{parameters.AzdoOrgUri}} - -AzdoProject ${{parameters.AzdoProject}} - -Token ${{coalesce(parameters.Token, '$env:SYSTEM_ACCESSTOKEN') }} - -BuildId ${{coalesce(parameters.BuildId, '$env:BUILD_ID')}} - displayName: Enable permanent build retention - env: - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - BUILD_ID: $(Build.BuildId) \ No newline at end of file +- template: /eng/common/core-templates/steps/retain-build.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/run-on-unix.yml b/eng/common/templates/steps/run-on-unix.yml deleted file mode 100644 index e1733814f65..00000000000 --- a/eng/common/templates/steps/run-on-unix.yml +++ /dev/null @@ -1,7 +0,0 @@ -parameters: - agentOs: '' - steps: [] - -steps: -- ${{ if ne(parameters.agentOs, 'Windows_NT') }}: - - ${{ parameters.steps }} diff --git a/eng/common/templates/steps/run-on-windows.yml b/eng/common/templates/steps/run-on-windows.yml deleted file mode 100644 index 73e7e9c275a..00000000000 --- a/eng/common/templates/steps/run-on-windows.yml +++ /dev/null @@ -1,7 +0,0 @@ -parameters: - agentOs: '' - steps: [] - -steps: -- ${{ if eq(parameters.agentOs, 'Windows_NT') }}: - - ${{ parameters.steps }} diff --git a/eng/common/templates/steps/run-script-ifequalelse.yml b/eng/common/templates/steps/run-script-ifequalelse.yml deleted file mode 100644 index 3d1242f5587..00000000000 --- a/eng/common/templates/steps/run-script-ifequalelse.yml +++ /dev/null @@ -1,33 +0,0 @@ -parameters: - # if parameter1 equals parameter 2, run 'ifScript' command, else run 'elsescript' command - parameter1: '' - parameter2: '' - ifScript: '' - elseScript: '' - - # name of script step - name: Script - - # display name of script step - displayName: If-Equal-Else Script - - # environment - env: {} - - # conditional expression for step execution - condition: '' - -steps: -- ${{ if and(ne(parameters.ifScript, ''), eq(parameters.parameter1, parameters.parameter2)) }}: - - script: ${{ parameters.ifScript }} - name: ${{ parameters.name }} - displayName: ${{ parameters.displayName }} - env: ${{ parameters.env }} - condition: ${{ parameters.condition }} - -- ${{ if and(ne(parameters.elseScript, ''), ne(parameters.parameter1, parameters.parameter2)) }}: - - script: ${{ parameters.elseScript }} - name: ${{ parameters.name }} - displayName: ${{ parameters.displayName }} - env: ${{ parameters.env }} - condition: ${{ parameters.condition }} \ No newline at end of file diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml index 3eb7e2d5f84..39f99fc2762 100644 --- a/eng/common/templates/steps/send-to-helix.yml +++ b/eng/common/templates/steps/send-to-helix.yml @@ -1,91 +1,7 @@ -# Please remember to update the documentation if you make changes to these parameters! -parameters: - HelixSource: 'pr/default' # required -- sources must start with pr/, official/, prodcon/, or agent/ - HelixType: 'tests/default/' # required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/' - HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number - HelixTargetQueues: '' # required -- semicolon-delimited list of Helix queues to test on; see https://helix.dot.net/ for a list of queues - HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group - HelixConfiguration: '' # optional -- additional property attached to a job - HelixPreCommands: '' # optional -- commands to run before Helix work item execution - HelixPostCommands: '' # optional -- commands to run after Helix work item execution - WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects - WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects - WorkItemTimeout: '' # optional -- a timeout in TimeSpan.Parse-ready value (e.g. 00:02:00) for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects - CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload - XUnitProjects: '' # optional -- semicolon-delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true - XUnitWorkItemTimeout: '' # optional -- the workitem timeout in seconds for all workitems created from the xUnit projects specified by XUnitProjects - XUnitPublishTargetFramework: '' # optional -- framework to use to publish your xUnit projects - XUnitRuntimeTargetFramework: '' # optional -- framework to use for the xUnit console runner - XUnitRunnerVersion: '' # optional -- version of the xUnit nuget package you wish to use on Helix; required for XUnitProjects - IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion - DotNetCliPackageType: '' # optional -- either 'sdk', 'runtime' or 'aspnetcore-runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/main/release-notes/releases-index.json - DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/main/release-notes/releases-index.json - WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." - IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set - HelixBaseUri: 'https://helix.dot.net/' # optional -- sets the Helix API base URI (allows targeting https://helix.int-dot.net ) - Creator: '' # optional -- if the build is external, use this to specify who is sending the job - DisplayNamePrefix: 'Run Tests' # optional -- rename the beginning of the displayName of the steps in AzDO - condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() - continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false - steps: - - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY\eng\common\helixpublish.proj /restore /p:TreatWarningsAsErrors=false /t:Test /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"' - displayName: ${{ parameters.DisplayNamePrefix }} (Windows) - env: - BuildConfig: $(_BuildConfig) - HelixSource: ${{ parameters.HelixSource }} - HelixType: ${{ parameters.HelixType }} - HelixBuild: ${{ parameters.HelixBuild }} - HelixConfiguration: ${{ parameters.HelixConfiguration }} - HelixTargetQueues: ${{ parameters.HelixTargetQueues }} - HelixAccessToken: ${{ parameters.HelixAccessToken }} - HelixPreCommands: ${{ parameters.HelixPreCommands }} - HelixPostCommands: ${{ parameters.HelixPostCommands }} - WorkItemDirectory: ${{ parameters.WorkItemDirectory }} - WorkItemCommand: ${{ parameters.WorkItemCommand }} - WorkItemTimeout: ${{ parameters.WorkItemTimeout }} - CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} - XUnitProjects: ${{ parameters.XUnitProjects }} - XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} - XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} - XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} - XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} - IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} - DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} - DotNetCliVersion: ${{ parameters.DotNetCliVersion }} - WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} - HelixBaseUri: ${{ parameters.HelixBaseUri }} - Creator: ${{ parameters.Creator }} - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} - - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/helixpublish.proj /restore /p:TreatWarningsAsErrors=false /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog - displayName: ${{ parameters.DisplayNamePrefix }} (Unix) - env: - BuildConfig: $(_BuildConfig) - HelixSource: ${{ parameters.HelixSource }} - HelixType: ${{ parameters.HelixType }} - HelixBuild: ${{ parameters.HelixBuild }} - HelixConfiguration: ${{ parameters.HelixConfiguration }} - HelixTargetQueues: ${{ parameters.HelixTargetQueues }} - HelixAccessToken: ${{ parameters.HelixAccessToken }} - HelixPreCommands: ${{ parameters.HelixPreCommands }} - HelixPostCommands: ${{ parameters.HelixPostCommands }} - WorkItemDirectory: ${{ parameters.WorkItemDirectory }} - WorkItemCommand: ${{ parameters.WorkItemCommand }} - WorkItemTimeout: ${{ parameters.WorkItemTimeout }} - CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} - XUnitProjects: ${{ parameters.XUnitProjects }} - XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} - XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} - XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} - XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} - IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} - DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} - DotNetCliVersion: ${{ parameters.DotNetCliVersion }} - WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} - HelixBaseUri: ${{ parameters.HelixBaseUri }} - Creator: ${{ parameters.Creator }} - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} +- template: /eng/common/core-templates/steps/send-to-helix.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/source-build.yml b/eng/common/templates/steps/source-build.yml index 41bbb915736..23c1d6f4e9f 100644 --- a/eng/common/templates/steps/source-build.yml +++ b/eng/common/templates/steps/source-build.yml @@ -1,129 +1,7 @@ -parameters: - # This template adds arcade-powered source-build to CI. - - # This is a 'steps' template, and is intended for advanced scenarios where the existing build - # infra has a careful build methodology that must be followed. For example, a repo - # (dotnet/runtime) might choose to clone the GitHub repo only once and store it as a pipeline - # artifact for all subsequent jobs to use, to reduce dependence on a strong network connection to - # GitHub. Using this steps template leaves room for that infra to be included. - - # Defines the platform on which to run the steps. See 'eng/common/templates/job/source-build.yml' - # for details. The entire object is described in the 'job' template for simplicity, even though - # the usage of the properties on this object is split between the 'job' and 'steps' templates. - platform: {} - steps: -# Build. Keep it self-contained for simple reusability. (No source-build-specific job variables.) -- script: | - set -x - df -h - - # If building on the internal project, the artifact feeds variable may be available (usually only if needed) - # In that case, call the feed setup script to add internal feeds corresponding to public ones. - # In addition, add an msbuild argument to copy the WIP from the repo to the target build location. - # This is because SetupNuGetSources.sh will alter the current NuGet.config file, and we need to preserve those - # changes. - internalRestoreArgs= - if [ '$(dn-bot-dnceng-artifact-feeds-rw)' != '$''(dn-bot-dnceng-artifact-feeds-rw)' ]; then - # Temporarily work around https://github.com/dotnet/arcade/issues/7709 - chmod +x $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh - $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh $(Build.SourcesDirectory)/NuGet.config $(dn-bot-dnceng-artifact-feeds-rw) - internalRestoreArgs='/p:CopyWipIntoInnerSourceBuildRepo=true' - - # The 'Copy WIP' feature of source build uses git stash to apply changes from the original repo. - # This only works if there is a username/email configured, which won't be the case in most CI runs. - git config --get user.email - if [ $? -ne 0 ]; then - git config user.email dn-bot@microsoft.com - git config user.name dn-bot - fi - fi - - # If building on the internal project, the internal storage variable may be available (usually only if needed) - # In that case, add variables to allow the download of internal runtimes if the specified versions are not found - # in the default public locations. - internalRuntimeDownloadArgs= - if [ '$(dotnetbuilds-internal-container-read-token-base64)' != '$''(dotnetbuilds-internal-container-read-token-base64)' ]; then - internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://dotnetbuilds.blob.core.windows.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64) --runtimesourcefeed https://dotnetbuilds.blob.core.windows.net/internal --runtimesourcefeedkey $(dotnetbuilds-internal-container-read-token-base64)' - fi - - buildConfig=Release - # Check if AzDO substitutes in a build config from a variable, and use it if so. - if [ '$(_BuildConfig)' != '$''(_BuildConfig)' ]; then - buildConfig='$(_BuildConfig)' - fi - - officialBuildArgs= - if [ '${{ and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}' = 'True' ]; then - officialBuildArgs='/p:DotNetPublishUsingPipelines=true /p:OfficialBuildId=$(BUILD.BUILDNUMBER)' - fi - - targetRidArgs= - if [ '${{ parameters.platform.targetRID }}' != '' ]; then - targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}' - fi - - runtimeOsArgs= - if [ '${{ parameters.platform.runtimeOS }}' != '' ]; then - runtimeOsArgs='/p:RuntimeOS=${{ parameters.platform.runtimeOS }}' - fi - - baseOsArgs= - if [ '${{ parameters.platform.baseOS }}' != '' ]; then - baseOsArgs='/p:BaseOS=${{ parameters.platform.baseOS }}' - fi - - publishArgs= - if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then - publishArgs='--publish' - fi - - assetManifestFileName=SourceBuild_RidSpecific.xml - if [ '${{ parameters.platform.name }}' != '' ]; then - assetManifestFileName=SourceBuild_${{ parameters.platform.name }}.xml - fi - - ${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \ - --configuration $buildConfig \ - --restore --build --pack $publishArgs -bl \ - $officialBuildArgs \ - $internalRuntimeDownloadArgs \ - $internalRestoreArgs \ - $targetRidArgs \ - $runtimeOsArgs \ - $baseOsArgs \ - /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \ - /p:ArcadeBuildFromSource=true \ - /p:AssetManifestFileName=$assetManifestFileName - displayName: Build - -# Upload build logs for diagnosis. -- task: CopyFiles@2 - displayName: Prepare BuildLogs staging directory - inputs: - SourceFolder: '$(Build.SourcesDirectory)' - Contents: | - **/*.log - **/*.binlog - artifacts/source-build/self/prebuilt-report/** - TargetFolder: '$(Build.StagingDirectory)/BuildLogs' - CleanTargetFolder: true - continueOnError: true - condition: succeededOrFailed() - -- task: PublishPipelineArtifact@1 - displayName: Publish BuildLogs - inputs: - targetPath: '$(Build.StagingDirectory)/BuildLogs' - artifactName: BuildLogs_SourceBuild_${{ parameters.platform.name }}_Attempt$(System.JobAttempt) - continueOnError: true - condition: succeededOrFailed() +- template: /eng/common/core-templates/steps/source-build.yml + parameters: + is1ESPipeline: false -# Manually inject component detection so that we can ignore the source build upstream cache, which contains -# a nupkg cache of input packages (a local feed). -# This path must match the upstream cache path in property 'CurrentRepoSourceBuiltNupkgCacheDir' -# in src\Microsoft.DotNet.Arcade.Sdk\tools\SourceBuild\SourceBuildArcade.targets -- task: ComponentGovernanceComponentDetection@0 - displayName: Component Detection (Exclude upstream cache) - inputs: - ignoreDirectories: '$(Build.SourcesDirectory)/artifacts/source-build/self/src/artifacts/obj/source-built-upstream-cache' + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/telemetry-end.yml b/eng/common/templates/steps/telemetry-end.yml deleted file mode 100644 index fadc04ca1b9..00000000000 --- a/eng/common/templates/steps/telemetry-end.yml +++ /dev/null @@ -1,102 +0,0 @@ -parameters: - maxRetries: 5 - retryDelay: 10 # in seconds - -steps: -- bash: | - if [ "$AGENT_JOBSTATUS" = "Succeeded" ] || [ "$AGENT_JOBSTATUS" = "PartiallySucceeded" ]; then - errorCount=0 - else - errorCount=1 - fi - warningCount=0 - - curlStatus=1 - retryCount=0 - # retry loop to harden against spotty telemetry connections - # we don't retry successes and 4xx client errors - until [[ $curlStatus -eq 0 || ( $curlStatus -ge 400 && $curlStatus -le 499 ) || $retryCount -ge $MaxRetries ]] - do - if [ $retryCount -gt 0 ]; then - echo "Failed to send telemetry to Helix; waiting $RetryDelay seconds before retrying..." - sleep $RetryDelay - fi - - # create a temporary file for curl output - res=`mktemp` - - curlResult=` - curl --verbose --output $res --write-out "%{http_code}"\ - -H 'Content-Type: application/json' \ - -H "X-Helix-Job-Token: $Helix_JobToken" \ - -H 'Content-Length: 0' \ - -X POST -G "https://helix.dot.net/api/2018-03-14/telemetry/job/build/$Helix_WorkItemId/finish" \ - --data-urlencode "errorCount=$errorCount" \ - --data-urlencode "warningCount=$warningCount"` - curlStatus=$? - - if [ $curlStatus -eq 0 ]; then - if [ $curlResult -gt 299 ] || [ $curlResult -lt 200 ]; then - curlStatus=$curlResult - fi - fi - - let retryCount++ - done - - if [ $curlStatus -ne 0 ]; then - echo "Failed to Send Build Finish information after $retryCount retries" - vstsLogOutput="vso[task.logissue type=error;sourcepath=templates/steps/telemetry-end.yml;code=1;]Failed to Send Build Finish information: $curlStatus" - echo "##$vstsLogOutput" - exit 1 - fi - displayName: Send Unix Build End Telemetry - env: - # defined via VSTS variables in start-job.sh - Helix_JobToken: $(Helix_JobToken) - Helix_WorkItemId: $(Helix_WorkItemId) - MaxRetries: ${{ parameters.maxRetries }} - RetryDelay: ${{ parameters.retryDelay }} - condition: and(always(), ne(variables['Agent.Os'], 'Windows_NT')) -- powershell: | - if (($env:Agent_JobStatus -eq 'Succeeded') -or ($env:Agent_JobStatus -eq 'PartiallySucceeded')) { - $ErrorCount = 0 - } else { - $ErrorCount = 1 - } - $WarningCount = 0 - - # Basic retry loop to harden against server flakiness - $retryCount = 0 - while ($retryCount -lt $env:MaxRetries) { - try { - Invoke-RestMethod -Uri "https://helix.dot.net/api/2018-03-14/telemetry/job/build/$env:Helix_WorkItemId/finish?errorCount=$ErrorCount&warningCount=$WarningCount" -Method Post -ContentType "application/json" -Body "" ` - -Headers @{ 'X-Helix-Job-Token'=$env:Helix_JobToken } - break - } - catch { - $statusCode = $_.Exception.Response.StatusCode.value__ - if ($statusCode -ge 400 -and $statusCode -le 499) { - Write-Host "##vso[task.logissue]error Failed to send telemetry to Helix (status code $statusCode); not retrying (4xx client error)" - Write-Host "##vso[task.logissue]error ", $_.Exception.GetType().FullName, $_.Exception.Message - exit 1 - } - Write-Host "Failed to send telemetry to Helix (status code $statusCode); waiting $env:RetryDelay seconds before retrying..." - $retryCount++ - sleep $env:RetryDelay - continue - } - } - - if ($retryCount -ge $env:MaxRetries) { - Write-Host "##vso[task.logissue]error Failed to send telemetry to Helix after $retryCount retries." - exit 1 - } - displayName: Send Windows Build End Telemetry - env: - # defined via VSTS variables in start-job.ps1 - Helix_JobToken: $(Helix_JobToken) - Helix_WorkItemId: $(Helix_WorkItemId) - MaxRetries: ${{ parameters.maxRetries }} - RetryDelay: ${{ parameters.retryDelay }} - condition: and(always(),eq(variables['Agent.Os'], 'Windows_NT')) diff --git a/eng/common/templates/steps/telemetry-start.yml b/eng/common/templates/steps/telemetry-start.yml deleted file mode 100644 index 32c01ef0b55..00000000000 --- a/eng/common/templates/steps/telemetry-start.yml +++ /dev/null @@ -1,241 +0,0 @@ -parameters: - helixSource: 'undefined_defaulted_in_telemetry.yml' - helixType: 'undefined_defaulted_in_telemetry.yml' - buildConfig: '' - runAsPublic: false - maxRetries: 5 - retryDelay: 10 # in seconds - -steps: -- ${{ if and(eq(parameters.runAsPublic, 'false'), not(eq(variables['System.TeamProject'], 'public'))) }}: - - task: AzureKeyVault@1 - inputs: - azureSubscription: 'HelixProd_KeyVault' - KeyVaultName: HelixProdKV - SecretsFilter: 'HelixApiAccessToken' - condition: always() -- bash: | - # create a temporary file - jobInfo=`mktemp` - - # write job info content to temporary file - cat > $jobInfo < /dev/null; then echo "Curl failed; dumping some information about dotnet.microsoft.com for later investigation" - echo | openssl s_client -showcerts -servername dotnet.microsoft.com -connect dotnet.microsoft.com:443 + echo | openssl s_client -showcerts -servername dotnet.microsoft.com -connect dotnet.microsoft.com:443 || true fi echo "Will now retry the same URL with verbose logging." with_retries curl "$install_script_url" -sSL --verbose --retry 10 --create-dirs -o "$install_script" || { @@ -343,20 +341,20 @@ function InitializeBuildTool { _InitializeBuildToolCommand="msbuild" # use override if it exists - commonly set by source-build if [[ "${_OverrideArcadeInitializeBuildToolFramework:-x}" == "x" ]]; then - _InitializeBuildToolFramework="net8.0" + _InitializeBuildToolFramework="net9.0" else _InitializeBuildToolFramework="${_OverrideArcadeInitializeBuildToolFramework}" fi } -# Set RestoreNoCache as a workaround for https://github.com/NuGet/Home/issues/3116 +# Set RestoreNoHttpCache as a workaround for https://github.com/NuGet/Home/issues/3116 function GetNuGetPackageCachePath { if [[ -z ${NUGET_PACKAGES:-} ]]; then if [[ "$use_global_nuget_cache" == true ]]; then - export NUGET_PACKAGES="$HOME/.nuget/packages" + export NUGET_PACKAGES="$HOME/.nuget/packages/" else - export NUGET_PACKAGES="$repo_root/.packages" - export RESTORENOCACHE=true + export NUGET_PACKAGES="$repo_root/.packages/" + export RESTORENOHTTPCACHE=true fi fi @@ -440,7 +438,7 @@ function StopProcesses { } function MSBuild { - local args=$@ + local args=( "$@" ) if [[ "$pipelines_log" == true ]]; then InitializeBuildTool InitializeToolset @@ -458,12 +456,10 @@ function MSBuild { local possiblePaths=() possiblePaths+=( "$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.ArcadeLogging.dll" ) possiblePaths+=( "$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.Arcade.Sdk.dll" ) - possiblePaths+=( "$toolset_dir/netcoreapp2.1/Microsoft.DotNet.ArcadeLogging.dll" ) - possiblePaths+=( "$toolset_dir/netcoreapp2.1/Microsoft.DotNet.Arcade.Sdk.dll" ) - possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.ArcadeLogging.dll" ) - possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.Arcade.Sdk.dll" ) possiblePaths+=( "$toolset_dir/net7.0/Microsoft.DotNet.ArcadeLogging.dll" ) possiblePaths+=( "$toolset_dir/net7.0/Microsoft.DotNet.Arcade.Sdk.dll" ) + possiblePaths+=( "$toolset_dir/net8.0/Microsoft.DotNet.ArcadeLogging.dll" ) + possiblePaths+=( "$toolset_dir/net8.0/Microsoft.DotNet.Arcade.Sdk.dll" ) for path in "${possiblePaths[@]}"; do if [[ -f $path ]]; then selectedPath=$path @@ -477,7 +473,7 @@ function MSBuild { args+=( "-logger:$selectedPath" ) fi - MSBuild-Core ${args[@]} + MSBuild-Core "${args[@]}" } function MSBuild-Core { @@ -510,7 +506,8 @@ function MSBuild-Core { echo "Build failed with exit code $exit_code. Check errors above." # When running on Azure Pipelines, override the returned exit code to avoid double logging. - if [[ "$ci" == "true" && -n ${SYSTEM_TEAMPROJECT:-} ]]; then + # Skip this when the build is a child of the VMR orchestrator build. + if [[ "$ci" == true && -n ${SYSTEM_TEAMPROJECT:-} && "$product_build" != true && "$properties" != *"DotNetBuildRepo=true"* ]]; then Write-PipelineSetResult -result "Failed" -message "msbuild execution failed." # Exiting with an exit code causes the azure pipelines task to log yet another "noise" error # The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error diff --git a/eng/restore/optimizationData.targets b/eng/restore/optimizationData.targets new file mode 100644 index 00000000000..324fc488f4c --- /dev/null +++ b/eng/restore/optimizationData.targets @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eng/test-determinism.ps1 b/eng/test-determinism.ps1 index 05c0417b1ec..fcb5495f434 100644 --- a/eng/test-determinism.ps1 +++ b/eng/test-determinism.ps1 @@ -404,7 +404,7 @@ try { $script:bootstrap = $true $script:bootstrapConfiguration = "Proto" - $script:fsharpNetCoreProductTfm = "net8.0" + $script:fsharpNetCoreProductTfm = "net9.0" $script:bootstrapTfm = $script:fsharpNetCoreProductTfm $bootstrapDir = Make-BootstrapBuild diff --git a/global.json b/global.json index ac61062b1c7..b66eed16d21 100644 --- a/global.json +++ b/global.json @@ -1,10 +1,10 @@ { "sdk": { - "version": "9.0.100-preview.3.24204.13", + "version": "9.0.100-rc.1.24452.12", "allowPrerelease": true }, "tools": { - "dotnet": "9.0.100-preview.3.24204.13", + "dotnet": "9.0.100-rc.1.24452.12", "vs": { "version": "17.8", "components": [ @@ -17,7 +17,7 @@ "perl": "5.38.2.2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24311.3", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24462.3", "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23255.2" } } diff --git a/release-notes.md b/release-notes.md index 748f7575eb3..54445f86e2f 100644 --- a/release-notes.md +++ b/release-notes.md @@ -25,7 +25,7 @@ These release notes track our current efforts to document changes to the F# proj * In FSharpExpr, FastIntegerForLoop has been renamed to IntegerForLoop * SynModuleDecl.DoExpr --> SynModuleDecl.Expr because it was not corresponding to a 'do expr' declaration. A 'do expr' declaration in a module will correspond to a SynModuleDecl.Expr enclosing a SynExpr.Do - This constructo also loses the debug point as it was always None. The debug point + This constructor also loses the debug point as it was always None. The debug point is always implicit for this construct. * In FCS API, FSharpParsingOptions, `CompilingFsLib` --> `CompilingFSharpCore` * In FCS API, FSharpParsingOptions, `ErrorSeverityOptions` --> `DiagnosticOptions` @@ -75,7 +75,7 @@ These release notes track our current efforts to document changes to the F# proj * Add MakeDeclarationMutable code fix [#10480](https://github.com/dotnet/fsharp/pull/10480) * Add ChangeToUpcast code fix [#10463](https://github.com/dotnet/fsharp/pull/10463) * Add AddMissingEqualsToTypeDefinition code fixer [#10470](https://github.com/dotnet/fsharp/pull/10470) -* Tag items in tooltips consistenly with respect to document classification. [#9563](https://github.com/dotnet/fsharp/pull/9563) +* Tag items in tooltips consistently with respect to document classification. [#9563](https://github.com/dotnet/fsharp/pull/9563) * Add ConvertToSingleEqualsEqualityExpression code fix [#10462](https://github.com/dotnet/fsharp/pull/10462) * Turn XML doc and Sig<->Impl mismatch warnings on by default [#10457](https://github.com/dotnet/fsharp/pull/10457) * Add ChangeRefCellDerefToNotExpression code fixer [#10469](https://github.com/dotnet/fsharp/pull/10469) @@ -103,7 +103,7 @@ The primary namespaces are now: ``` FSharp.Compiler.IO // FileSystem -FSharp.Compiler.CodeAnalysis // FSharpChecker, FSharpCheckFileResults, FSharpChecProjectResults and friends +FSharp.Compiler.CodeAnalysis // FSharpChecker, FSharpCheckFileResults, FSharpCheckProjectResults and friends FSharp.Compiler.Diagnostics // FSharpDiagnostic and friends FSharp.Compiler.EditorServices // Misc functionality for editors, e.g. interface stub generation FSharp.Compiler.Interactive.Shell // F# Interactive @@ -442,7 +442,7 @@ Renamings in `FSharp.Compiler.SourceCodeServices`: ``` -* Extension methods in `ServiceAssemblyContent.fsi` are now now intrinsic methods on the symbol types themselves. +* Extension methods in `ServiceAssemblyContent.fsi` are now intrinsic methods on the symbol types themselves. * `SemanticClassificationType` is now an enum instead of a discriminated union. * `GetBackgroundSemanticClassificationForFile` now returns `Async` instead of `Async`. The `SemanticClassificationView` provides a read-only view over the semantic classification contents via the `ForEach (FSharpSemanticClassificationItem -> unit) -> unit` function. @@ -475,7 +475,7 @@ This release covers three important milestones: F# 5, Visual Studio 16.8, and .N ### FSharp Core 5.0.0 -* Consistent behavior for empty/non-existent slices for lists, strings, arrays, 2D arrays, 3D arrays, and 4D arrays +* Consistent behavior for empty/nonexistent slices for lists, strings, arrays, 2D arrays, 3D arrays, and 4D arrays * Support for fixed-index slices in 3D and 4D arrays * Support for negative indexes (in preview) * Reverted a change where the %A and %O and `ToString`/`string` result of a union with `RequireQualifiedAccess` gave the fully-qualified union case name in response to user feedback @@ -487,7 +487,7 @@ This release covers three important milestones: F# 5, Visual Studio 16.8, and .N * Improved batch compilation performance (up to 30% faster depending on the project type) * Support for editing `#r "nuget:..."` scripts in Visual Studio * Various fixes for F# script editing performance, especially for scripts with significant dependencies getting loaded -* Support for compiling against .NET Core on Windows when no STAThread is availble +* Support for compiling against .NET Core on Windows when no STAThread is available * Support for validating signatures against XML doc comments when compiling via `/warnon:3390` * Fixed a bug where FSharp.Core XML doc contents were not displayed in F# scripts in Visual Studio * Support for strong name signing against F# projects when compiling using the .NET SDK @@ -522,7 +522,7 @@ The most notable change for FSharp.Compiler.Service is that it is now built and * Support for Witness information [#9510](https://github.com/dotnet/fsharp/pull/95100) in `FSharpExpr` and `FSharpMemberOrFunctionOrValue` * Support for Jupyter Notebooks and VSCode notebooks via `FSharp.Compiler.Private.Scripting` and .NET Interactive -* Improvements to the F# syntax tree represtation by [Eugene Auduchinok](https://github.com/auduchinok) +* Improvements to the F# syntax tree representation by [Eugene Auduchinok](https://github.com/auduchinok) * Support for `const` in keyword completion info by [Alex Berezhnykh](https://github.com/DedSec256) * Support for passing in a `PrimaryAssembly` for AST compilation routines by [Eirik Tsarpalis](https://github.com/eiriktsarpalis) * Support for `ToString` in `FSharp.Compiler.SourceCodeServices.StringText` by [Asti](https://github.com/deviousasti) @@ -620,7 +620,7 @@ Several F# preview language features have been merged. You can try them out by s * It is now possible to [specify the `[]` attribute](https://github.com/dotnet/fsharp/issues/7897) in F# signature files * A bug where the [`LangVersion` flag was culture-dependent](https://github.com/dotnet/fsharp/issues/7757) has been resolved * A bug where [large types and expressions defined in source would lead to a stack overflow](https://github.com/dotnet/fsharp/issues/7673) has been resolved -* A bug where [arbitrary, nonsense attributes could be defined on F# type extesions](https://github.com/dotnet/fsharp/issues/7394) was resolved +* A bug where [arbitrary, nonsense attributes could be defined on F# type extensions](https://github.com/dotnet/fsharp/issues/7394) was resolved * A bug where [exhaustive matches on SByte and Byte literal values emitted a warning](https://github.com/dotnet/fsharp/issues/6928) was resolved * A bug where [invalid type abbreviations with `byref`s and `byref`-like values](https://github.com/dotnet/fsharp/issues/6133) could be defined was resolved * A bug where [invalid binary and octal literals would be accepted by the compiler](https://github.com/dotnet/fsharp/issues/5729) was resolved, contributed by [Grzegorz Dziadkiewicz](https://github.com/gdziadkiewicz) @@ -667,7 +667,7 @@ In addition to the F# 4.7 feature set, this release includes support for the fol * Support for [`nameof` expressions](https://github.com/fsharp/fslang-design/blob/master/preview/FS-1003-nameof-operator.md) * Support for opening of static classes -You can enable this by seeting `preview` in your project file. +You can enable this by setting `preview` in your project file. This release also contains the following bug fixes and improvements to the F# compiler: @@ -676,7 +676,7 @@ This release also contains the following bug fixes and improvements to the F# co * Resolution of an issue where copying of a struct would not occur if it was defined in C# and mutated in a member call ([#7406](https://github.com/dotnet/fsharp/issues/7406)) * A crypto hash of the portable PDB content created by the compiler is not included in the PE debug directory, with a configurable hash set to SHA-256 by default ([#4259](https://github.com/dotnet/fsharp/issues/4259), [#1223](https://github.com/dotnet/fsharp/issues/1223)) * A bug where `LeafExpressionConverter` ignored `ValueType` and assumed `System.Tuple` has been fixed ([#6515](https://github.com/dotnet/fsharp/issues/6515)) by [Kevin Malenfant](https://github.com/kevmal) -* A bug where `List.transpose` discaded data instead of throwing an exception has been resolved ([#6908](https://github.com/dotnet/fsharp/issues/6908)) by [Patrick McDonald](https://github.com/PatrickMcDonald) +* A bug where `List.transpose` discarded data instead of throwing an exception has been resolved ([#6908](https://github.com/dotnet/fsharp/issues/6908)) by [Patrick McDonald](https://github.com/PatrickMcDonald) * A bug where `List.map3` gave a misleading error when used on lists of different lengths has been resolved ([#6897](https://github.com/dotnet/fsharp/issues/6897)) by [reacheight](https://github.com/reacheight) #### F# tools @@ -707,7 +707,7 @@ This is a relatively minor release for the F# language and tools, but it's not w * A longstanding bug where extremely large generated parsers in FsLexYacc (over 100 million lines) has been resolved ([#5967](https://github.com/Microsoft/visualfsharp/issues/5976]) * A longstanding issue in the Type Provider plugin component of the compiler that could leave the door open for a memory leak caused by a type provider has been resolved ([#6409](https://github.com/Microsoft/visualfsharp/issues/6409)) * Support for `--pathmap` was added to the F# compiler by [Saul Rennison](https://github.com/saul), which resolves an issue where the resulting executable from a compilation would include absolute paths to source files in the embedded F# signature file resource ([#5213](https://github.com/Microsoft/visualfsharp/issues/5213)) -* An optimization to the F# AST that improves its consumption via other tools and enviroments (e.g., [Fable](https://fable.io/)) has been added by [ncave](https://github.com/ncave) ([#6333](https://github.com/Microsoft/visualfsharp/pull/6333)) +* An optimization to the F# AST that improves its consumption via other tools and environments (e.g., [Fable](https://fable.io/)) has been added by [ncave](https://github.com/ncave) ([#6333](https://github.com/Microsoft/visualfsharp/pull/6333)) * An optimization around traversing information when resolving members has been added by [Steffen Forkmann](https://github.com/forki) ([#4457](https://github.com/Microsoft/visualfsharp/pull/4457)) * An improvement to error messages such that when a type implementation is missing necessary overrides a list of those missing overrides is reported has been added by [Gauthier Segay](https://github.com/smoothdeveloper) ([#4982](https://github.com/Microsoft/visualfsharp/issues/4982)) @@ -909,7 +909,7 @@ There is now an experimental CodeLens implementation, contributed by [Victor Pet We made the following enhancements to infrastructure, packaging, and our open source contribution experience: -* The F# compiler distributed with Visual Studio no longer installs as a singleton in the F# Compiler SDK location. It is now fully side-by-side with Visual Studio, meaning that side-by-side installations of Visual Studio wil finally have truly side-by-side F# tooling and language experiences. +* The F# compiler distributed with Visual Studio no longer installs as a singleton in the F# Compiler SDK location. It is now fully side-by-side with Visual Studio, meaning that side-by-side installations of Visual Studio will finally have truly side-by-side F# tooling and language experiences. * The FSharp.Core NuGet package is now signed. * ETW logging has been added to the F# tools and compiler. * The very large `control.fs`/`control.fsi` files in FSharp.Core have been split into `async.fs`/`async.fsi`, `event.fs`/`event.fsi`, `eventmodule.fs`/`eventmodule.fsi`, `mailbox.fs`/`mailbox.fsi`, and `observable.fs`/`observable.fsi`. @@ -931,7 +931,7 @@ We made the following enhancements to infrastructure, packaging, and our open so * Struct record support with the `[]` attribute * Struct Discriminated Union support with the `[]` attribute * `Result<'TSuccess, 'TFailure>` type, with supporting functions in FSharp.Core -* Support for the `fixed` keyword to pin a pointer-tyle local to the stack +* Support for the `fixed` keyword to pin a pointer-style local to the stack * Underscores in numeric literals * Caller Info Attribute Argument support * `namespace rec` and `module rec` to support mutually referential types and functions within the same file @@ -944,7 +944,7 @@ We made the following enhancements to infrastructure, packaging, and our open so * Significant improvements to error messages, particularly to aid with suggestions * Performance improvements * Interoperability improvements -* Support for geenerating F# AssymblyInfo from properties for .NET SDK projects +* Support for generating F# AssemblyInfo from properties for .NET SDK projects * `--debug:full` support for F# on .NET Core on Windows * `MakeTuple` support for struct tuples * Warnings are forwarded when searching for method overloads @@ -976,8 +976,8 @@ Most items here contributed by community members. * Semantic document highlighting for selected symbols * Support for Structured Guidelines and code outlining, which is toggleable * Support for `EditorBrowsable(EditorBrowsableState.Never)` -* Code fix for making Record and Discriminated Union case lables upper-case -* Code fix to make suggestions for an unkown identifier +* Code fix for making Record and Discriminated Union case labels upper-case +* Code fix to make suggestions for an unknown identifier * Code fix for prefixing or replacing an unused value with an underscore * Code fix to add the `new` keyword to a disposable type * Code fix to add an `open` statement at the top for a symbol coming from an unopened namespace or module @@ -1511,7 +1511,7 @@ Integrate dotnet/fsharp from 48f932cf8 to 085985140. Notable changes include: ### 1.4.1 - -* Add pause before backgrounnd work starts. The FCS request queue must be empty for 1 second before work will start +* Add pause before background work starts. The FCS request queue must be empty for 1 second before work will start * Write trace information about the reactor queue to the event log * Rewrite reactor to consistently prioritize queued work * Implement cancellation for queued work if it is cancelled prior to being executed @@ -1525,7 +1525,7 @@ Integrate dotnet/fsharp from 48f932cf8 to 085985140. Notable changes include: ### 1.4.0.8 - * FSharpType.Format now prettifies type variables. If necessary, FSharpType.Prettify can also be called -* Add maximum-memory trigger to downsize FCS caches. Defaults to 1.7GB of allocaed memory in the system +* Add maximum-memory trigger to downsize FCS caches. Defaults to 1.7GB of allocated memory in the system process for a 32-bit process, and 2x this for a 64-bit process ### 1.4.0.7 - @@ -1561,7 +1561,7 @@ Integrate dotnet/fsharp from 48f932cf8 to 085985140. Notable changes include: ### 1.4.0.2 - -* #387 - types and arrays in F# attribute contructor arguments +* #387 - types and arrays in F# attribute constructor arguments ### 1.4.0.1 - F# 4.0 support @@ -1600,7 +1600,7 @@ Integrate dotnet/fsharp from 48f932cf8 to 085985140. Notable changes include: ### 0.0.85 - * Fix for FSharpSymbolUse for single case union type #301 -* Added supprt for ReturnParameter in nested functions +* Added support for ReturnParameter in nested functions ### 0.0.84 - @@ -1623,7 +1623,7 @@ Integrate dotnet/fsharp from 48f932cf8 to 085985140. Notable changes include: ### 0.0.80 - -* Update to latest F# 3.1.3 (inclunding updated FsLex/FsYacc used in build of FCS) +* Update to latest F# 3.1.3 (including updated FsLex/FsYacc used in build of FCS) * Report printf specifiers from Service API * Improve Accessibility of non-F# symbols @@ -1930,7 +1930,7 @@ Integrate dotnet/fsharp from 48f932cf8 to 085985140. Notable changes include: ### 0.0.16 - * Make FSharpEntity.BaseType return an option -* FsiSesion got a new "EvalScript" method which allows to evaluate .fsx files +* FsiSession got a new "EvalScript" method which allows to evaluate .fsx files ### 0.0.15 - @@ -1987,7 +1987,7 @@ Integrate dotnet/fsharp from 48f932cf8 to 085985140. Notable changes include: ### 0.0.4-alpha - * Added documentation of file system API -* Reporte errors correctly from ParseAndCheckProject +* Report errors correctly from ParseAndCheckProject ### 0.0.3-alpha - @@ -2073,7 +2073,7 @@ Includes commits up to `dd8252eb8d20aaedf7b1c7576cd2a8a82d24f587` * Added `NonStructuralComparison` module containing non-structural comparison operators * Support for rational exponents in units of measure * Give fsi.exe, fsiAnyCpi.exe nice icons -* `Microsoft.` optional in namepsace paths from FSharp.Core +* `Microsoft.` optional in namespace paths from FSharp.Core * Support for extension properties in object initializers * Pre-support (not yet used) for additional nativeptr intrinsics * Simplified, more robust resolution of type references in quotations @@ -2098,7 +2098,7 @@ Includes commits up to `dd8252eb8d20aaedf7b1c7576cd2a8a82d24f587` * Bugfix [#61](https://visualfsharp.codeplex.com/workitem/61) Nonverifiable code generated with units of measure conversion * Bugfix [#68](https://visualfsharp.codeplex.com/workitem/68) BadImageFormatException with Units of Measure * Bugfix [#146](https://visualfsharp.codeplex.com/workitem/146) BadImageFormatException in both Release and Debug build with units of measure -* Bugfix: Incorrent cross-module inlining between different .NET profiles +* Bugfix: Incorrect cross-module inlining between different .NET profiles * Bugfix: Properly document exceptions in `Array` module * Bugfix [#24](https://visualfsharp.codeplex.com/workitem/24): Error reporting of exceptions in type providers `AddMemberDelayed` * Bugfix [#13](https://github.com/fsharp/fsharp/issues/13): Error on FSI terminal resize diff --git a/scripts/Install-VisualFSharpNightly.ps1 b/scripts/Install-VisualFSharpNightly.ps1 index ed2fb127b69..4478671ddce 100644 --- a/scripts/Install-VisualFSharpNightly.ps1 +++ b/scripts/Install-VisualFSharpNightly.ps1 @@ -4,7 +4,7 @@ # https://blogs.msdn.microsoft.com/dotnet/2017/03/14/announcing-nightly-releases-for-the-visual-f-tools/ # https://dotnet.myget.org/feed/fsharp/package/vsix/VisualFSharp -# requies Visual Studio Setup PowerShell Module +# requires Visual Studio Setup PowerShell Module # https://github.com/Microsoft/vssetup.powershell # Install-Module VSSetup -Scope CurrentUser diff --git a/scripts/diff-fsharp-repos.sh b/scripts/diff-fsharp-repos.sh index 1e0a55d7ae6..42c381f6bf9 100755 --- a/scripts/diff-fsharp-repos.sh +++ b/scripts/diff-fsharp-repos.sh @@ -2,7 +2,7 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. # This script generates a patch by comparing the contents of the fsharp/fsharp -# and Microsoft/visualfsharp Github repositories. The resulting patch can be applied, +# and Microsoft/visualfsharp GitHub repositories. The resulting patch can be applied, # if desired, to one of the repositories to synchronize changes in one direction; # CAUTION MUST BE TAKEN though, since this script generates the patch in a way that # ignores any ordering of commits in the repos -- so it could also end up reverting @@ -100,7 +100,7 @@ remove_irrelevant_files "$repo_dir1" remove_irrelevant_files "$repo_dir2" # Use git-diff to compare the two source trees and create a patch. -# Note, the 'git diff' command reeturns with non-zero exit code if there are any warnings emitted, +# Note, the 'git diff' command returns with non-zero exit code if there are any warnings emitted, # which there will be -- so we can't really check the exit code to see if it succeeded' if [ "$include_all_changes" != '1' ]; then diff_filter_arg="--diff-filter=ad" diff --git a/scripts/dotnet-install.ps1 b/scripts/dotnet-install.ps1 index 3dc96520540..e0e8d6800cd 100644 --- a/scripts/dotnet-install.ps1 +++ b/scripts/dotnet-install.ps1 @@ -39,7 +39,7 @@ .PARAMETER DryRun If set it will not perform installation but instead display what command line to use to consistently install currently requested version of dotnet cli. In example if you specify version 'latest' it will display a link - with specific version so that this command can be used deterministicly in a build script. + with specific version so that this command can be used deterministically in a build script. It also displays binaries location if you prefer to install or download it yourself. .PARAMETER NoPath By default this script will set environment variable PATH for the current process to the binaries folder inside installation folder. diff --git a/scripts/dotnet-install.sh b/scripts/dotnet-install.sh index 0d43070726d..a1ff41cb755 100755 --- a/scripts/dotnet-install.sh +++ b/scripts/dotnet-install.sh @@ -11,7 +11,7 @@ set -u # This is causing it to fail set -o pipefail -# Use in the the functions: eval $invocation +# Use in the functions: eval $invocation invocation='say_verbose "Calling: ${yellow:-}${FUNCNAME[0]} ${green:-}$*${normal:-}"' # standard output may be used as a return value in the functions @@ -740,7 +740,7 @@ calculate_vars() { if [ "$valid_legacy_download_link" = true ]; then say_verbose "legacy_download_link=$legacy_download_link" else - say_verbose "Cound not construct a legacy_download_link; omitting..." + say_verbose "Could not construct a legacy_download_link; omitting..." fi install_root="$(resolve_installation_path "$install_dir")" diff --git a/scripts/init-tools.cmd b/scripts/init-tools.cmd index 3b17a835b9e..e075d5ccef5 100644 --- a/scripts/init-tools.cmd +++ b/scripts/init-tools.cmd @@ -26,7 +26,7 @@ if "!cleanup_existing!" == "1" ( rmdir /s /q "%DOTNET_TOOLS_PATH%" ) -:: download and install install SDK +:: download and install SDK if not exist "%dotnetexe%" ( echo powershell -ExecutionPolicy unrestricted -NoProfile -Command ".\scripts\dotnet-install.ps1 -InstallDir %DOTNET_TOOLS_PATH% -Architecture x64 -Version %DOTNET_TOOLS_VERSION% -NoPath true; exit $LastExitCode;" powershell -ExecutionPolicy unrestricted -NoProfile -Command ".\scripts\dotnet-install.ps1 -InstallDir %DOTNET_TOOLS_PATH% -Architecture x64 -Version %DOTNET_TOOLS_VERSION% -NoPath true; exit $LastExitCode;" diff --git a/scripts/init-tools.sh b/scripts/init-tools.sh index 178d1bca003..a8ecd8cab85 100644 --- a/scripts/init-tools.sh +++ b/scripts/init-tools.sh @@ -154,7 +154,7 @@ if [ ! -e $__INIT_TOOLS_DONE_MARKER ]; then echo "Running: $__BUILD_TOOLS_PATH/init-tools.sh $__scriptpath $__DOTNET_CMD $__TOOLRUNTIME_DIR" >> $__init_tools_log $__BUILD_TOOLS_PATH/init-tools.sh $__scriptpath $__DOTNET_CMD $__TOOLRUNTIME_DIR >> $__init_tools_log if [ "$?" != "0" ]; then - echo "ERROR: An error occured when trying to initialize the tools. Please check '$__init_tools_log' for more details."1>&2 + echo "ERROR: An error occurred when trying to initialize the tools. Please check '$__init_tools_log' for more details."1>&2 exit 1 fi fi @@ -163,7 +163,7 @@ if [ ! -e $__INIT_TOOLS_DONE_MARKER ]; then echo "Updating CLI NuGet Frameworks map..." cp $__TOOLRUNTIME_DIR/NuGet.Frameworks.dll $__TOOLRUNTIME_DIR/dotnetcli/sdk/$__DOTNET_VERSION >> $__init_tools_log if [ "$?" != "0" ]; then - echo "ERROR: An error occured when updating Nuget for CLI . Please check '$__init_tools_log' for more details."1>&2 + echo "ERROR: An error occurred when updating Nuget for CLI . Please check '$__init_tools_log' for more details."1>&2 exit 1 fi fi diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index 66b736f87c3..9ed1822676b 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -170,7 +170,11 @@ let splitTypeNameRight nm = // -------------------------------------------------------------------- /// This is used to store event, property and field maps. -type LazyOrderedMultiMap<'Key, 'Data when 'Key: equality>(keyf: 'Data -> 'Key, lazyItems: InterruptibleLazy<'Data list>) = +type LazyOrderedMultiMap<'Key, 'Data when 'Key: equality +#if !NO_CHECKNULLS + and 'Key:not null +#endif + >(keyf: 'Data -> 'Key, lazyItems: InterruptibleLazy<'Data list>) = let quickMap = lazyItems @@ -515,7 +519,8 @@ type ILAssemblyRef(data) = let retargetable = aname.Flags = AssemblyNameFlags.Retargetable - ILAssemblyRef.Create(aname.Name, None, publicKey, retargetable, version, locale) + let name = match aname.Name with | null -> aname.FullName | name -> name + ILAssemblyRef.Create(name, None, publicKey, retargetable, version, locale) member aref.QualifiedName = let b = StringBuilder(100) @@ -823,7 +828,7 @@ type ILTypeRef = member x.DebugText = x.ToString() /// For debugging - override x.ToString() = x.FullName + override x.ToString() : string = x.FullName and [] ILTypeSpec = { @@ -875,7 +880,7 @@ and [" + x.TypeRef.FullName + if isNil x.GenericArgs then "" else "<...>" and [] ILType = | Void @@ -1017,8 +1022,9 @@ type ILMethodRef = [] member x.DebugText = x.ToString() - override x.ToString() = - x.DeclaringTypeRef.ToString() + "::" + x.Name + "(...)" + member x.FullName = x.DeclaringTypeRef.FullName + "::" + x.Name + "(...)" + + override x.ToString() = x.FullName [] type ILFieldRef = @@ -1033,7 +1039,7 @@ type ILFieldRef = member x.DebugText = x.ToString() override x.ToString() = - x.DeclaringTypeRef.ToString() + "::" + x.Name + x.DeclaringTypeRef.FullName + "::" + x.Name [] type ILMethodSpec = @@ -1072,7 +1078,7 @@ type ILMethodSpec = [] member x.DebugText = x.ToString() - override x.ToString() = x.MethodRef.ToString() + "(...)" + override x.ToString() = x.MethodRef.FullName + "(...)" [] type ILFieldSpec = @@ -1213,7 +1219,7 @@ type ILAttribute = [] member x.DebugText = x.ToString() - override x.ToString() = x.Method.ToString() + "(...)" + override x.ToString() = x.Method.MethodRef.FullName [] type ILAttributes(array: ILAttribute[]) = @@ -1571,7 +1577,7 @@ type ILFieldInit = | ILFieldInit.UInt64 u64 -> box u64 | ILFieldInit.Single ieee32 -> box ieee32 | ILFieldInit.Double ieee64 -> box ieee64 - | ILFieldInit.Null -> (null :> Object) + | ILFieldInit.Null -> (null :> objnull) // -------------------------------------------------------------------- // Native Types, for marshalling to the native C interface. @@ -1856,9 +1862,10 @@ type ILGenericParameterDef = Name: string Constraints: ILTypes Variance: ILGenericVariance - HasReferenceTypeConstraint: bool + HasReferenceTypeConstraint: bool HasNotNullableValueTypeConstraint: bool HasDefaultConstructorConstraint: bool + HasAllowsRefStruct: bool CustomAttrsStored: ILAttributesStored MetadataIndex: int32 } @@ -2629,6 +2636,7 @@ type ILTypeDef attributes: TypeAttributes, layout: ILTypeDefLayout, implements: ILTypes, + implementsCustomAttrs: (ILAttributesStored * int) list option, genericParams: ILGenericParameterDefs, extends: ILType option, methods: ILMethodDefs, @@ -2651,6 +2659,7 @@ type ILTypeDef attributes, layout, implements, + implementsCustomAttrs, genericParams, extends, methods, @@ -2667,6 +2676,7 @@ type ILTypeDef attributes, layout, implements, + implementsCustomAttrs, genericParams, extends, methods, @@ -2693,6 +2703,8 @@ type ILTypeDef member _.Implements = implements + member _.ImplementsCustomAttrs = implementsCustomAttrs + member _.Extends = extends member _.Methods = methods @@ -2732,7 +2744,8 @@ type ILTypeDef ?properties, ?newAdditionalFlags, ?customAttrs, - ?securityDecls + ?securityDecls, + ?implementsCustomAttrs ) = ILTypeDef( name = defaultArg name x.Name, @@ -2741,6 +2754,7 @@ type ILTypeDef genericParams = defaultArg genericParams x.GenericParams, nestedTypes = defaultArg nestedTypes x.NestedTypes, implements = defaultArg implements x.Implements, + implementsCustomAttrs = defaultArg implementsCustomAttrs x.ImplementsCustomAttrs, extends = defaultArg extends x.Extends, methods = defaultArg methods x.Methods, securityDecls = defaultArg securityDecls x.SecurityDecls, @@ -2749,7 +2763,7 @@ type ILTypeDef events = defaultArg events x.Events, properties = defaultArg properties x.Properties, additionalFlags = defaultArg newAdditionalFlags additionalFlags, - customAttrs = defaultArg customAttrs (storeILCustomAttrs x.CustomAttrs) + customAttrs = defaultArg customAttrs (x.CustomAttrsStored) ) member x.CustomAttrs: ILAttributes = @@ -3270,6 +3284,7 @@ let mkILSimpleTypar nm = HasReferenceTypeConstraint = false HasNotNullableValueTypeConstraint = false HasDefaultConstructorConstraint = false + HasAllowsRefStruct = false CustomAttrsStored = storeILCustomAttrs emptyILCustomAttrs MetadataIndex = NoMetadataIdx } @@ -3439,6 +3454,11 @@ type ILGlobals(primaryScopeRef: ILScopeRef, equivPrimaryAssemblyRefs: ILAssembly let mkSysILTypeRef nm = mkILTyRef (primaryScopeRef, nm) + let byteIlType = ILType.Value(mkILNonGenericTySpec (mkSysILTypeRef tname_Byte)) + + let stringIlType = + mkILBoxedType (mkILNonGenericTySpec (mkSysILTypeRef tname_String)) + member _.primaryAssemblyScopeRef = primaryScopeRef member x.primaryAssemblyRef = @@ -3456,7 +3476,7 @@ type ILGlobals(primaryScopeRef: ILScopeRef, equivPrimaryAssemblyRefs: ILAssembly member val typ_Object = mkILBoxedType (mkILNonGenericTySpec (mkSysILTypeRef tname_Object)) - member val typ_String = mkILBoxedType (mkILNonGenericTySpec (mkSysILTypeRef tname_String)) + member val typ_String = stringIlType member val typ_Array = mkILBoxedType (mkILNonGenericTySpec (mkSysILTypeRef tname_Array)) @@ -3470,7 +3490,11 @@ type ILGlobals(primaryScopeRef: ILScopeRef, equivPrimaryAssemblyRefs: ILAssembly member val typ_Int64 = ILType.Value(mkILNonGenericTySpec (mkSysILTypeRef tname_Int64)) - member val typ_Byte = ILType.Value(mkILNonGenericTySpec (mkSysILTypeRef tname_Byte)) + member val typ_Byte = byteIlType + + member val typ_ByteArray = ILType.Array(ILArrayShape.SingleDimensional, byteIlType) + + member val typ_StringArray = ILType.Array(ILArrayShape.SingleDimensional, stringIlType) member val typ_UInt16 = ILType.Value(mkILNonGenericTySpec (mkSysILTypeRef tname_UInt16)) @@ -4231,6 +4255,7 @@ let mkILGenericClass (nm, access, genparams, extends, impl, methods, fields, nes attributes = attributes, genericParams = genparams, implements = impl, + implementsCustomAttrs = None, layout = ILTypeDefLayout.Auto, extends = Some extends, methods = methods, @@ -4255,6 +4280,7 @@ let mkRawDataValueTypeDef (iltyp_ValueType: ILType) (nm, size, pack) = ||| TypeAttributes.BeforeFieldInit ||| TypeAttributes.AnsiClass), implements = [], + implementsCustomAttrs = None, extends = Some iltyp_ValueType, layout = ILTypeDefLayout.Explicit { Size = Some size; Pack = Some pack }, methods = emptyILMethods, @@ -4380,7 +4406,7 @@ let buildILCode (_methName: string) lab2pc instrs tryspecs localspecs : ILCode = // Detecting Delegates // -------------------------------------------------------------------- -let mkILDelegateMethods access (ilg: ILGlobals) (iltyp_AsyncCallback, iltyp_IAsyncResult) (parms, rtv: ILReturn) = +let mkILDelegateMethods access (ilg: ILGlobals) (iltyp_AsyncCallback, iltyp_IAsyncResult) (params_, rtv: ILReturn) = let retTy = rtv.Type let one nm args ret = @@ -4403,10 +4429,10 @@ let mkILDelegateMethods access (ilg: ILGlobals) (iltyp_AsyncCallback, iltyp_IAsy [ ctor - one "Invoke" parms retTy + one "Invoke" params_ retTy one "BeginInvoke" - (parms + (params_ @ [ mkILParamNamed ("callback", iltyp_AsyncCallback) mkILParamNamed ("objects", ilg.typ_Object) diff --git a/src/Compiler/AbstractIL/il.fsi b/src/Compiler/AbstractIL/il.fsi index d6673131060..e3ec95a40d7 100644 --- a/src/Compiler/AbstractIL/il.fsi +++ b/src/Compiler/AbstractIL/il.fsi @@ -20,7 +20,7 @@ type internal PrimaryAssembly = member Name: string /// Checks if an assembly resolution may represent a primary assembly that actually contains the - /// definition of Sytem.Object. Note that the chosen target primary assembly may not actually be the one + /// definition of System.Object. Note that the chosen target primary assembly may not actually be the one /// that contains the definition of System.Object - it is just the one we are choosing to emit for. static member IsPossiblePrimaryAssembly: fileName: string -> bool @@ -237,6 +237,8 @@ type ILTypeRef = member internal EqualsWithPrimaryScopeRef: ILScopeRef * obj -> bool + override ToString: unit -> string + interface System.IComparable /// Type specs and types. @@ -664,7 +666,7 @@ type ILFieldInit = | Double of double | Null - member AsObject: unit -> obj + member AsObject: unit -> objnull [] type internal ILNativeVariant = @@ -869,7 +871,13 @@ type ILAttributes = /// Represents the efficiency-oriented storage of ILAttributes in another item. [] -type ILAttributesStored +type ILAttributesStored = + /// Computed by ilread.fs based on metadata index + | Reader of (int32 -> ILAttribute[]) + /// Already computed + | Given of ILAttributes + + member GetCustomAttrs: int32 -> ILAttributes /// Method parameters and return values. [] @@ -1013,6 +1021,9 @@ type ILGenericParameterDef = /// Indicates the type argument must have a public nullary constructor. HasDefaultConstructorConstraint: bool + /// Indicates the type parameter allows ref struct, i.e. an anti constraint. + HasAllowsRefStruct: bool + /// Do not use this CustomAttrsStored: ILAttributesStored @@ -1070,6 +1081,8 @@ type ILMethodDef = member IsEntryPoint: bool member GenericParams: ILGenericParameterDefs member CustomAttrs: ILAttributes + member MetadataIndex: int32 + member CustomAttrsStored: ILAttributesStored member ParameterTypes: ILTypes member IsIL: bool member Code: ILCode option @@ -1243,6 +1256,10 @@ type ILFieldDef = member CustomAttrs: ILAttributes + member MetadataIndex: int32 + + member CustomAttrsStored: ILAttributesStored + member IsStatic: bool member IsSpecialName: bool @@ -1326,6 +1343,8 @@ type ILEventDef = member FireMethod: ILMethodRef option member OtherMethods: ILMethodRef list member CustomAttrs: ILAttributes + member MetadataIndex: int32 + member CustomAttrsStored: ILAttributesStored member IsSpecialName: bool member IsRTSpecialName: bool @@ -1388,6 +1407,8 @@ type ILPropertyDef = member Init: ILFieldInit option member Args: ILTypes member CustomAttrs: ILAttributes + member MetadataIndex: int32 + member CustomAttrsStored: ILAttributesStored member IsSpecialName: bool member IsRTSpecialName: bool @@ -1498,6 +1519,7 @@ type ILTypeDef = attributes: TypeAttributes * layout: ILTypeDefLayout * implements: ILTypes * + implementsCustomAttrs: (ILAttributesStored * int) list option * genericParams: ILGenericParameterDefs * extends: ILType option * methods: ILMethodDefs * @@ -1518,6 +1540,7 @@ type ILTypeDef = attributes: TypeAttributes * layout: ILTypeDefLayout * implements: ILTypes * + implementsCustomAttrs: (ILAttributesStored * int) list option * genericParams: ILGenericParameterDefs * extends: ILType option * methods: ILMethodDefs * @@ -1537,6 +1560,7 @@ type ILTypeDef = member Layout: ILTypeDefLayout member NestedTypes: ILTypeDefs member Implements: ILTypes + member ImplementsCustomAttrs: (ILAttributesStored * int) list option member Extends: ILType option member Methods: ILMethodDefs member SecurityDecls: ILSecurityDecls @@ -1545,6 +1569,8 @@ type ILTypeDef = member Events: ILEventDefs member Properties: ILPropertyDefs member CustomAttrs: ILAttributes + member MetadataIndex: int32 + member CustomAttrsStored: ILAttributesStored member IsClass: bool member IsStruct: bool member IsInterface: bool @@ -1594,7 +1620,8 @@ type ILTypeDef = ?properties: ILPropertyDefs * ?newAdditionalFlags: ILTypeDefAdditionalFlags * ?customAttrs: ILAttributesStored * - ?securityDecls: ILSecurityDecls -> + ?securityDecls: ILSecurityDecls * + ?implementsCustomAttrs: (ILAttributesStored * int) list option -> ILTypeDef /// Represents a prefix of information for ILTypeDef. @@ -1890,11 +1917,13 @@ type internal ILGlobals = member typ_Enum: ILType member typ_Object: ILType member typ_String: ILType + member typ_StringArray: ILType member typ_Type: ILType member typ_Array: ILType member typ_IntPtr: ILType member typ_UIntPtr: ILType member typ_Byte: ILType + member typ_ByteArray: ILType member typ_Int16: ILType member typ_Int32: ILType member typ_Int64: ILType diff --git a/src/Compiler/AbstractIL/illex.fsl b/src/Compiler/AbstractIL/illex.fsl index 92c1190b14c..baf54ba0362 100644 --- a/src/Compiler/AbstractIL/illex.fsl +++ b/src/Compiler/AbstractIL/illex.fsl @@ -93,7 +93,7 @@ rule token = parse | "/" { SLASH } | "<" { LESS } | ">" { GREATER } - | "..." { ELIPSES } + | "..." { ELLIPSES } | "::" { DCOLON } | "+" { PLUS } | (['0'-'9']) | (['0'-'9']['0'-'9']['0'-'9']+) @@ -103,11 +103,11 @@ rule token = parse (* ldc.r8 0. *) (* float64(-657435.) *) (* and int32[0...,0...] *) - (* The problem is telling an integer-followed-by-ellipses from a floating-point-nubmer-followed-by-dots *) + (* The problem is telling an integer-followed-by-ellipses from a floating-point-number-followed-by-dots *) | ((['0'-'9']) | (['0'-'9']['0'-'9']['0'-'9']+)) "..." { let b = lexbuf.LexemeView in - VAL_INT32_ELIPSES(int32(b.Slice(0, (b.Length - 3)).ToString())) } + VAL_INT32_ELLIPSES(int32(b.Slice(0, (b.Length - 3)).ToString())) } | ['0'-'9' 'A'-'F' 'a'-'f' ] ['0'-'9' 'A'-'F' 'a'-'f' ] { let c1 = (lexemeChar lexbuf 0) in let c2 = (lexemeChar lexbuf 1) in diff --git a/src/Compiler/AbstractIL/ilnativeres.fs b/src/Compiler/AbstractIL/ilnativeres.fs index 0d0b6a1c986..62961613b3f 100644 --- a/src/Compiler/AbstractIL/ilnativeres.fs +++ b/src/Compiler/AbstractIL/ilnativeres.fs @@ -1000,7 +1000,7 @@ type Directory(name, id) = member val ID = id member val NumberOfNamedEntries = Unchecked.defaultof with get, set member val NumberOfIdEntries = Unchecked.defaultof with get, set - member val Entries = List() + member val Entries = List() type NativeResourceWriter() = static member private CompareResources (left: Win32Resource) (right: Win32Resource) = @@ -1149,7 +1149,12 @@ type NativeResourceWriter() = dataWriter.WriteByte 0uy false - | e -> failwithf "Unknown entry %s" (if isNull e then "" else e.GetType().FullName) + | e -> + failwithf + "Unknown entry %s" + (match e with + | null -> "" + | e -> e.GetType().FullName |> string) if id >= 0 then writer.WriteInt32 id diff --git a/src/Compiler/AbstractIL/ilpars.fsy b/src/Compiler/AbstractIL/ilpars.fsy index 67c8e4d1fe3..b8380364f6b 100644 --- a/src/Compiler/AbstractIL/ilpars.fsy +++ b/src/Compiler/AbstractIL/ilpars.fsy @@ -2,7 +2,9 @@ %{ +#nowarn "64" // turn off warnings that type variables used in production annotations are instantiated to concrete type #nowarn "1182" // the generated code often has unused variable "parseState" +#nowarn "3261" // the generated code would need to properly annotate nulls, e.g. changing System.Object to `obj|null` open Internal.Utilities.Library @@ -24,7 +26,7 @@ let resolveCurrentMethodSpecScope obj = *----------------------------------------------------------------------*/ %token VAL_INT64 /* 342534523534534 0x34FA434644554 */ -%token VAL_INT32_ELIPSES /* 342534523534534... */ +%token VAL_INT32_ELLIPSES /* 342534523534534... */ %token VAL_FLOAT64 /* -334234 24E-34 */ %token INSTR_I %token INSTR_I32_I32 @@ -51,7 +53,7 @@ let resolveCurrentMethodSpecScope obj = %token DCOLON %token DEFAULT %token DOT -%token ELIPSES +%token ELLIPSES %token EOF %token EXPLICIT %token FIELD @@ -285,18 +287,18 @@ bound: { (None, None) } | int32 { (None, Some $1) } - | int32 ELIPSES int32 + | int32 ELLIPSES int32 { (Some $1, Some ($3 - $1 + 1)) } - | int32 ELIPSES + | int32 ELLIPSES { (Some $1, None) } /* We need to be able to parse all of */ /* ldc.r8 0. */ /* float64(-657435.) */ /* and int32[0...,0...] */ -/* The problem is telling an integer-followed-by-ellipses from a floating-point-nubmer-followed-by-dots */ - | VAL_INT32_ELIPSES int32 +/* The problem is telling an integer-followed-by-ellipses from a floating-point-number-followed-by-dots */ + | VAL_INT32_ELLIPSES int32 { (Some $1, Some ($2 - $1 + 1)) } - | VAL_INT32_ELIPSES + | VAL_INT32_ELLIPSES { (Some $1, None) } id: diff --git a/src/Compiler/AbstractIL/ilread.fs b/src/Compiler/AbstractIL/ilread.fs index 1535078bfe0..02696c53f0e 100644 --- a/src/Compiler/AbstractIL/ilread.fs +++ b/src/Compiler/AbstractIL/ilread.fs @@ -195,7 +195,7 @@ type ByteFile(fileName: string, bytes: byte[]) = type PEFile(fileName: string, peReader: PEReader) as this = // We store a weak byte memory reference so we do not constantly create a lot of byte memory objects. - // We could just have a single ByteMemory stored in the PEFile, but we need to dispose of the stream via the finalizer; we cannot have a cicular reference. + // We could just have a single ByteMemory stored in the PEFile, but we need to dispose of the stream via the finalizer; we cannot have a circular reference. let mutable weakMemory = WeakReference(Unchecked.defaultof<_>) member _.FileName = fileName @@ -207,7 +207,7 @@ type PEFile(fileName: string, peReader: PEReader) as this = match weakMemory.TryGetTarget() with | true, m -> m.AsReadOnly() | _ -> - let block = peReader.GetEntireImage() // it's ok to call this everytime we do GetView as it is cached in the PEReader. + let block = peReader.GetEntireImage() // it's ok to call this every time we do GetView as it is cached in the PEReader. let m = ByteMemory.FromUnsafePointer(block.Pointer |> NativePtr.toNativeInt, block.Length, this) @@ -883,7 +883,7 @@ let tomdCompare (TaggedIndex(t1: TypeOrMethodDefTag, idx1)) (TaggedIndex(t2: Typ elif idx1 > idx2 then 1 else compare t1.Tag t2.Tag -let simpleIndexCompare (idx1: int) (idx2: int) = compare idx1 idx2 +let inline simpleIndexCompare (idx1: int) (idx2: int) = compare idx1 idx2 //--------------------------------------------------------------------- // The various keys for the various caches. @@ -930,8 +930,7 @@ let mkCacheGeneric lowMem _inbase _nm (sz: int) = if lowMem then (fun f x -> f x) else - let mutable cache = Unchecked.defaultof<_> - + let mutable cache = null #if STATISTICS let mutable _count = 0 @@ -942,11 +941,11 @@ let mkCacheGeneric lowMem _inbase _nm (sz: int) = fun f (idx: 'T) -> let cache = match cache with - | Null -> + | null -> let v = ConcurrentDictionary<_, _>(Environment.ProcessorCount, sz) cache <- v v - | NonNull v -> v + | v -> v match cache.TryGetValue idx with | true, v -> @@ -1155,6 +1154,7 @@ type ILMetadataReader = customAttrsReader_Module: ILAttributesStored customAttrsReader_Assembly: ILAttributesStored customAttrsReader_TypeDef: ILAttributesStored + customAttrsReader_InterfaceImpl: ILAttributesStored customAttrsReader_GenericParam: ILAttributesStored customAttrsReader_FieldDef: ILAttributesStored customAttrsReader_MethodDef: ILAttributesStored @@ -1425,11 +1425,10 @@ let seekReadParamRow (ctxt: ILMetadataReader) mdv idx = (flags, seq, nameIdx) /// Read Table InterfaceImpl. -let seekReadInterfaceImplRow (ctxt: ILMetadataReader) mdv idx = +let private seekReadInterfaceIdx (ctxt: ILMetadataReader) mdv idx = let mutable addr = ctxt.rowAddr TableNames.InterfaceImpl idx - let tidx = seekReadUntaggedIdx TableNames.TypeDef ctxt mdv &addr - let intfIdx = seekReadTypeDefOrRefOrSpecIdx ctxt mdv &addr - (tidx, intfIdx) + let _tidx = seekReadUntaggedIdx TableNames.TypeDef ctxt mdv &addr + seekReadTypeDefOrRefOrSpecIdx ctxt mdv &addr /// Read Table MemberRef. let seekReadMemberRefRow (ctxt: ILMetadataReader) mdv idx = @@ -1560,10 +1559,10 @@ let seekReadTypeSpecRow (ctxt: ILMetadataReader) mdv idx = let seekReadImplMapRow (ctxt: ILMetadataReader) mdv idx = let mutable addr = ctxt.rowAddr TableNames.ImplMap idx let flags = seekReadUInt16AsInt32Adv mdv &addr - let forwrdedIdx = seekReadMemberForwardedIdx ctxt mdv &addr + let forwardedIdx = seekReadMemberForwardedIdx ctxt mdv &addr let nameIdx = seekReadStringIdx ctxt mdv &addr let scopeIdx = seekReadUntaggedIdx TableNames.ModuleRef ctxt mdv &addr - (flags, forwrdedIdx, nameIdx, scopeIdx) + (flags, forwardedIdx, nameIdx, scopeIdx) /// Read Table FieldRVA. let seekReadFieldRVARow (ctxt: ILMetadataReader) mdv idx = @@ -1648,11 +1647,11 @@ let seekReadGenericParamRow (ctxt: ILMetadataReader) mdv idx = (idx, seq, flags, ownerIdx, nameIdx) // Read Table GenericParamConstraint. -let seekReadGenericParamConstraintRow (ctxt: ILMetadataReader) mdv idx = +let seekReadGenericParamConstraintIdx (ctxt: ILMetadataReader) mdv idx = let mutable addr = ctxt.rowAddr TableNames.GenericParamConstraint idx - let pidx = seekReadUntaggedIdx TableNames.GenericParam ctxt mdv &addr + let _pidx = seekReadUntaggedIdx TableNames.GenericParam ctxt mdv &addr let constraintIdx = seekReadTypeDefOrRefOrSpecIdx ctxt mdv &addr - (pidx, constraintIdx) + constraintIdx /// Read Table ILMethodSpec. let seekReadMethodSpecRow (ctxt: ILMetadataReader) mdv idx = @@ -2192,7 +2191,10 @@ and typeDefReader ctxtH : ILTypeDefStored = let mdefs = seekReadMethods ctxt numTypars methodsIdx endMethodsIdx let fdefs = seekReadFields ctxt (numTypars, hasLayout) fieldsIdx endFieldsIdx let nested = seekReadNestedTypeDefs ctxt idx - let impls = seekReadInterfaceImpls ctxt mdv numTypars idx + + let impls, intImplsAttrs = + seekReadInterfaceImpls ctxt mdv numTypars idx |> List.unzip + let mimpls = seekReadMethodImpls ctxt numTypars idx let props = seekReadProperties ctxt numTypars idx let events = seekReadEvents ctxt numTypars idx @@ -2204,6 +2206,7 @@ and typeDefReader ctxtH : ILTypeDefStored = layout = layout, nestedTypes = nested, implements = impls, + implementsCustomAttrs = Some intImplsAttrs, extends = super, methods = mdefs, securityDeclsStored = ctxt.securityDeclsReader_TypeDef, @@ -2239,11 +2242,16 @@ and seekReadNestedTypeDefs (ctxt: ILMetadataReader) tidx = and seekReadInterfaceImpls (ctxt: ILMetadataReader) mdv numTypars tidx = seekReadIndexedRows ( ctxt.getNumRows TableNames.InterfaceImpl, - seekReadInterfaceImplRow ctxt mdv, - fst, - simpleIndexCompare tidx, + id, + id, + (fun idx -> + let mutable addr = ctxt.rowAddr TableNames.InterfaceImpl idx + let _tidx = seekReadUntaggedIdx TableNames.TypeDef ctxt mdv &addr + simpleIndexCompare tidx _tidx), isSorted ctxt TableNames.InterfaceImpl, - (snd >> seekReadTypeDefOrRef ctxt numTypars AsObject []) + (fun idx -> + let intfIdx = seekReadInterfaceIdx ctxt mdv idx + seekReadTypeDefOrRef ctxt numTypars AsObject [] intfIdx, (ctxt.customAttrsReader_InterfaceImpl, idx)) ) and seekReadGenericParams ctxt numTypars (a, b) : ILGenericParameterDefs = @@ -2253,12 +2261,14 @@ and seekReadGenericParamsUncached ctxtH (GenericParamsIdx(numTypars, a, b)) = let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() + let key = TaggedIndex(a, b) + let pars = seekReadIndexedRows ( ctxt.getNumRows TableNames.GenericParam, seekReadGenericParamRow ctxt mdv, (fun (_, _, _, tomd, _) -> tomd), - tomdCompare (TaggedIndex(a, b)), + tomdCompare key, isSorted ctxt TableNames.GenericParam, (fun (gpidx, seq, flags, _, nameIdx) -> let flags = int32 flags @@ -2282,6 +2292,7 @@ and seekReadGenericParamsUncached ctxtH (GenericParamsIdx(numTypars, a, b)) = HasReferenceTypeConstraint = (flags &&& 0x0004) <> 0 HasNotNullableValueTypeConstraint = (flags &&& 0x0008) <> 0 HasDefaultConstructorConstraint = (flags &&& 0x0010) <> 0 + HasAllowsRefStruct = (flags &&& 0x0020) <> 0 }) ) @@ -2290,11 +2301,16 @@ and seekReadGenericParamsUncached ctxtH (GenericParamsIdx(numTypars, a, b)) = and seekReadGenericParamConstraints (ctxt: ILMetadataReader) mdv numTypars gpidx = seekReadIndexedRows ( ctxt.getNumRows TableNames.GenericParamConstraint, - seekReadGenericParamConstraintRow ctxt mdv, - fst, - simpleIndexCompare gpidx, + id, + id, + (fun idx -> + let mutable addr = ctxt.rowAddr TableNames.GenericParamConstraint idx + let pidx = seekReadUntaggedIdx TableNames.GenericParam ctxt mdv &addr + simpleIndexCompare gpidx pidx), isSorted ctxt TableNames.GenericParamConstraint, - (snd >> seekReadTypeDefOrRef ctxt numTypars AsObject []) + (fun idx -> + let constraintIdx = seekReadGenericParamConstraintIdx ctxt mdv idx + seekReadTypeDefOrRef ctxt numTypars AsObject [] constraintIdx) ) and seekReadTypeDefAsType (ctxt: ILMetadataReader) boxity (ginst: ILTypes) idx = @@ -2305,6 +2321,8 @@ and seekReadTypeDefAsTypeUncached ctxtH (TypeDefAsTypIdx(boxity, ginst, idx)) = mkILTy boxity (ILTypeSpec.Create(seekReadTypeDefAsTypeRef ctxt idx, ginst)) and seekReadTypeDefAsTypeRef (ctxt: ILMetadataReader) idx = + let mdv = ctxt.mdfile.GetView() + let enc = if seekIsTopTypeDefOfIdx ctxt idx then [] @@ -2312,11 +2330,14 @@ and seekReadTypeDefAsTypeRef (ctxt: ILMetadataReader) idx = let enclIdx = seekReadIndexedRow ( ctxt.getNumRows TableNames.Nested, - seekReadNestedRow ctxt, - fst, - simpleIndexCompare idx, + id, + id, + (fun i -> + let mutable addr = ctxt.rowAddr TableNames.Nested i + let nestedIdx = seekReadUntaggedIdx TableNames.TypeDef ctxt mdv &addr + simpleIndexCompare idx nestedIdx), isSorted ctxt TableNames.Nested, - snd + (fun i -> seekReadNestedRow ctxt i |> snd) ) let tref = seekReadTypeDefAsTypeRef ctxt enclIdx @@ -2737,10 +2758,10 @@ and readBlobHeapAsPropertySigUncached ctxtH (BlobAsPropSigIdx(numTypars, blobIdx let sigptr = 0 let ccByte, sigptr = sigptrGetByte bytes sigptr let hasthis = byteAsHasThis ccByte - let ccMaxked = (ccByte &&& 0x0Fuy) + let ccMasked = (ccByte &&& 0x0Fuy) - if ccMaxked <> e_IMAGE_CEE_CS_CALLCONV_PROPERTY then - dprintn ("warning: property sig was " + string ccMaxked + " instead of CC_PROPERTY") + if ccMasked <> e_IMAGE_CEE_CS_CALLCONV_PROPERTY then + dprintn ("warning: property sig was " + string ccMasked + " instead of CC_PROPERTY") let struct (numparams, sigptr) = sigptrGetZInt32 bytes sigptr let retTy, sigptr = sigptrGetTy ctxt numTypars bytes sigptr @@ -2778,17 +2799,17 @@ and byteAsHasThis b = and byteAsCallConv b = let cc = - let ccMaxked = b &&& 0x0Fuy + let ccMasked = b &&& 0x0Fuy - if ccMaxked = e_IMAGE_CEE_CS_CALLCONV_FASTCALL then + if ccMasked = e_IMAGE_CEE_CS_CALLCONV_FASTCALL then ILArgConvention.FastCall - elif ccMaxked = e_IMAGE_CEE_CS_CALLCONV_STDCALL then + elif ccMasked = e_IMAGE_CEE_CS_CALLCONV_STDCALL then ILArgConvention.StdCall - elif ccMaxked = e_IMAGE_CEE_CS_CALLCONV_THISCALL then + elif ccMasked = e_IMAGE_CEE_CS_CALLCONV_THISCALL then ILArgConvention.ThisCall - elif ccMaxked = e_IMAGE_CEE_CS_CALLCONV_CDECL then + elif ccMasked = e_IMAGE_CEE_CS_CALLCONV_CDECL then ILArgConvention.CDecl - elif ccMaxked = e_IMAGE_CEE_CS_CALLCONV_VARARG then + elif ccMasked = e_IMAGE_CEE_CS_CALLCONV_VARARG then ILArgConvention.VarArg else ILArgConvention.Default @@ -3077,15 +3098,18 @@ and seekReadMethodImpls (ctxt: ILMetadataReader) numTypars tidx = let mimpls = seekReadIndexedRows ( ctxt.getNumRows TableNames.MethodImpl, - seekReadMethodImplRow ctxt mdv, - (fun (a, _, _) -> a), - simpleIndexCompare tidx, + id, + id, + (fun i -> + let mutable addr = ctxt.rowAddr TableNames.MethodImpl i + let _tidx = seekReadUntaggedIdx TableNames.TypeDef ctxt mdv &addr + simpleIndexCompare tidx _tidx), isSorted ctxt TableNames.MethodImpl, - (fun (_, b, c) -> b, c) + seekReadMethodImplRow ctxt mdv ) mimpls - |> List.map (fun (b, c) -> + |> List.map (fun (_, b, c) -> { OverrideBy = let (MethodData(enclTy, cc, nm, argTys, retTy, methInst)) = @@ -3154,11 +3178,14 @@ and seekReadEvents (ctxt: ILMetadataReader) numTypars tidx = match seekReadOptionalIndexedRow ( ctxt.getNumRows TableNames.EventMap, - (fun i -> i, seekReadEventMapRow ctxt mdv i), - (fun (_, row) -> fst row), - compare tidx, + id, + id, + (fun i -> + let mutable addr = ctxt.rowAddr TableNames.EventMap i + let _tidx = seekReadUntaggedIdx TableNames.TypeDef ctxt mdv &addr + simpleIndexCompare tidx _tidx), false, - (fun (i, row) -> (i, snd row)) + (fun i -> i, seekReadEventMapRow ctxt mdv i |> snd) ) with | None -> [] @@ -3221,11 +3248,14 @@ and seekReadProperties (ctxt: ILMetadataReader) numTypars tidx = match seekReadOptionalIndexedRow ( ctxt.getNumRows TableNames.PropertyMap, - (fun i -> i, seekReadPropertyMapRow ctxt mdv i), - (fun (_, row) -> fst row), - compare tidx, + id, + id, + (fun i -> + let mutable addr = ctxt.rowAddr TableNames.PropertyMap i + let _tidx = seekReadUntaggedIdx TableNames.TypeDef ctxt mdv &addr + simpleIndexCompare tidx _tidx), false, - (fun (i, row) -> (i, snd row)) + (fun i -> i, seekReadPropertyMapRow ctxt mdv i |> snd) ) with | None -> [] @@ -3249,16 +3279,22 @@ and customAttrsReader ctxtH tag : ILAttributesStored = let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() - let reader = - { new ISeekReadIndexedRowReader, ILAttribute> with - member _.GetRow(i, row) = - seekReadCustomAttributeRow ctxt mdv i &row - - member _.GetKey(attrRow) = attrRow.parentIndex - - member _.CompareKey(key) = hcaCompare (TaggedIndex(tag, idx)) key + let searchedKey = TaggedIndex(tag, idx) - member _.ConvertRow(attrRow) = + let reader = + { new ISeekReadIndexedRowReader with + member _.GetRow(i, rowIndex) = rowIndex <- i + member _.GetKey(rowIndex) = rowIndex + + member _.CompareKey(rowIndex) = + let mutable addr = ctxt.rowAddr TableNames.CustomAttribute rowIndex + // read parentIndex + let key = seekReadHasCustomAttributeIdx ctxt mdv &addr + hcaCompare searchedKey key + + member _.ConvertRow(rowIndex) = + let mutable attrRow = Unchecked.defaultof<_> + seekReadCustomAttributeRow ctxt mdv rowIndex &attrRow seekReadCustomAttr ctxt (attrRow.typeIndex, attrRow.valueIndex) } @@ -4539,6 +4575,7 @@ let openMetadataReader customAttrsReader_Module = customAttrsReader ctxtH hca_Module customAttrsReader_Assembly = customAttrsReader ctxtH hca_Assembly customAttrsReader_TypeDef = customAttrsReader ctxtH hca_TypeDef + customAttrsReader_InterfaceImpl = customAttrsReader ctxtH hca_InterfaceImpl customAttrsReader_GenericParam = customAttrsReader ctxtH hca_GenericParam customAttrsReader_FieldDef = customAttrsReader ctxtH hca_FieldDef customAttrsReader_MethodDef = customAttrsReader ctxtH hca_MethodDef @@ -4685,10 +4722,10 @@ let openPEFileReader (fileName, pefile: BinaryFile, noFileOnDisk) = let _headerPhysSize = seekReadInt32 pev (peOptionalHeaderPhysLoc + 60) // Header Size Combined size of MS-DOS Header, PE Header, PE Optional Header and padding let subsys = seekReadUInt16 pev (peOptionalHeaderPhysLoc + 68) // SubSystem Subsystem required to run this image. - let useHighEnthropyVA = + let useHighEntropyVA = let n = seekReadUInt16 pev (peOptionalHeaderPhysLoc + 70) - let highEnthropyVA = 0x20us - (n &&& highEnthropyVA) = highEnthropyVA + let highEntropyVA = 0x20us + (n &&& highEntropyVA) = highEntropyVA (* x86: 000000e0 *) @@ -4888,7 +4925,7 @@ let openPEFileReader (fileName, pefile: BinaryFile, noFileOnDisk) = let peinfo = (subsys, (subsysMajor, subsysMinor), - useHighEnthropyVA, + useHighEntropyVA, ilOnly, only32, is32bitpreferred, diff --git a/src/Compiler/AbstractIL/ilreflect.fs b/src/Compiler/AbstractIL/ilreflect.fs index 748ecafda21..9b0b7eddb9e 100644 --- a/src/Compiler/AbstractIL/ilreflect.fs +++ b/src/Compiler/AbstractIL/ilreflect.fs @@ -163,7 +163,12 @@ type TypeBuilder with if logRefEmitCalls then printfn "typeBuilder%d.CreateType()" (abs <| hash typB) + //Buggy annotation in ns20, will not be fixed. +#if NETSTANDARD && !NO_CHECKNULLS + !!(typB.CreateTypeInfo()) :> Type +#else typB.CreateTypeInfo() :> Type +#endif member typB.DefineNestedTypeAndLog(name, attrs) = let res = typB.DefineNestedType(name, attrs) @@ -198,8 +203,8 @@ type TypeBuilder with typB.DefineGenericParameters gps - member typB.DefineConstructorAndLog(attrs, cconv, parms) = - let consB = typB.DefineConstructor(attrs, cconv, parms) + member typB.DefineConstructorAndLog(attrs, cconv, params_) = + let consB = typB.DefineConstructor(attrs, cconv, params_) if logRefEmitCalls then printfn @@ -208,7 +213,7 @@ type TypeBuilder with (abs <| hash typB) (LanguagePrimitives.EnumToValue attrs) cconv - parms + params_ consB @@ -270,10 +275,9 @@ type TypeBuilder with else null - if not (isNull m) then - m.Invoke(null, args) - else - raise (MissingMethodException nm) + match m with + | null -> raise (MissingMethodException nm) + | m -> m.Invoke(null, args) member typB.SetCustomAttributeAndLog(cinfo, bytes) = if logRefEmitCalls then @@ -284,9 +288,12 @@ type TypeBuilder with type OpCode with member opcode.RefEmitName = - (string (Char.ToUpper(opcode.Name[0])) + opcode.Name[1..]) - .Replace(".", "_") - .Replace("_i4", "_I4") + match opcode.Name with + | null -> "" + | name -> + (string (Char.ToUpper(name[0])) + name[1..]) + .Replace(".", "_") + .Replace("_i4", "_I4") type ILGenerator with @@ -320,7 +327,7 @@ type ILGenerator with ilG.BeginFinallyBlock() - member ilG.BeginCatchBlockAndLog ty = + member ilG.BeginCatchBlockAndLog(ty: Type) = if logRefEmitCalls then printfn "ilg%d.BeginCatchBlock(%A)" (abs <| hash ilG) ty @@ -396,7 +403,7 @@ type ILGenerator with member x.EmitAndLog(op: OpCode, v: ConstructorInfo) = if logRefEmitCalls then - printfn "ilg%d.Emit(OpCodes.%s, constructor_%s)" (abs <| hash x) op.RefEmitName v.DeclaringType.Name + printfn "ilg%d.Emit(OpCodes.%s, constructor_%s)" (abs <| hash x) op.RefEmitName (!!v.DeclaringType).Name x.Emit(op, v) @@ -693,7 +700,7 @@ let rec convTypeSpec cenv emEnv preferCreated (tspec: ILTypeSpec) = let typT = convTypeRef cenv emEnv preferCreated tspec.TypeRef let tyargs = List.map (convTypeAux cenv emEnv preferCreated) tspec.GenericArgs - let res = + let res: Type MaybeNull = match isNil tyargs, typT.IsGenericType with | _, true -> typT.MakeGenericType(List.toArray tyargs) | true, false -> typT @@ -706,7 +713,7 @@ let rec convTypeSpec cenv emEnv preferCreated (tspec: ILTypeSpec) = and convTypeAux cenv emEnv preferCreated ty = match ty with - | ILType.Void -> Type.GetType("System.Void") + | ILType.Void -> !! Type.GetType("System.Void") | ILType.Array(shape, eltType) -> let baseT = convTypeAux cenv emEnv preferCreated eltType let nDims = shape.Rank @@ -844,26 +851,10 @@ let queryableTypeGetField _emEnv (parentT: Type) (fref: ILFieldRef) = | NonNull res -> res let nonQueryableTypeGetField (parentTI: Type) (fieldInfo: FieldInfo) : FieldInfo = - let res = - if parentTI.IsGenericType then - TypeBuilder.GetField(parentTI, fieldInfo) - else - fieldInfo - - match res with - | Null -> - error ( - Error( - FSComp.SR.itemNotFoundInTypeDuringDynamicCodeGen ( - "field", - fieldInfo.Name, - parentTI.AssemblyQualifiedName, - parentTI.Assembly.FullName - ), - range0 - ) - ) - | NonNull res -> res + if parentTI.IsGenericType then + TypeBuilder.GetField(parentTI, fieldInfo) + else + fieldInfo let convFieldSpec cenv emEnv fspec = let fref = fspec.FieldRef @@ -1012,21 +1003,16 @@ let queryableTypeGetMethod cenv emEnv parentT (mref: ILMethodRef) : MethodInfo = let methInfo = try - parentT.GetMethod( - mref.Name, - cconv ||| BindingFlags.Public ||| BindingFlags.NonPublic, - null, - argTs, - (null: ParameterModifier[] MaybeNull) - ) + parentT.GetMethod(mref.Name, cconv ||| BindingFlags.Public ||| BindingFlags.NonPublic, null, argTs, null) // This can fail if there is an ambiguity w.r.t. return type with _ -> null - if (isNotNull methInfo && equalTypes resT methInfo.ReturnType) then - methInfo - else - queryableTypeGetMethodBySearch cenv emEnv parentT mref + match methInfo with + | null -> queryableTypeGetMethodBySearch cenv emEnv parentT mref + | m when equalTypes resT m.ReturnType -> m + | _ -> queryableTypeGetMethodBySearch cenv emEnv parentT mref + else queryableTypeGetMethodBySearch cenv emEnv parentT mref @@ -1062,7 +1048,12 @@ let convMethodRef cenv emEnv (parentTI: Type) (mref: ILMethodRef) = | Null -> error ( Error( - FSComp.SR.itemNotFoundInTypeDuringDynamicCodeGen ("method", mref.Name, parentTI.FullName, parentTI.Assembly.FullName), + FSComp.SR.itemNotFoundInTypeDuringDynamicCodeGen ( + "method", + mref.Name, + parentTI.FullName |> string, + parentTI.Assembly.FullName |> string + ), range0 ) ) @@ -1103,7 +1094,12 @@ let queryableTypeGetConstructor cenv emEnv (parentT: Type) (mref: ILMethodRef) = | Null -> error ( Error( - FSComp.SR.itemNotFoundInTypeDuringDynamicCodeGen ("constructor", mref.Name, parentT.FullName, parentT.Assembly.FullName), + FSComp.SR.itemNotFoundInTypeDuringDynamicCodeGen ( + "constructor", + mref.Name, + parentT.FullName |> string, + parentT.Assembly.FullName |> string + ), range0 ) ) @@ -1138,7 +1134,12 @@ let convConstructorSpec cenv emEnv (mspec: ILMethodSpec) = | Null -> error ( Error( - FSComp.SR.itemNotFoundInTypeDuringDynamicCodeGen ("constructor", "", parentTI.FullName, parentTI.Assembly.FullName), + FSComp.SR.itemNotFoundInTypeDuringDynamicCodeGen ( + "constructor", + "", + parentTI.FullName |> string, + parentTI.Assembly.FullName |> string + ), range0 ) ) @@ -1490,7 +1491,7 @@ let rec emitInstr cenv (modB: ModuleBuilder) emEnv (ilG: ILGenerator) instr = ilG.EmitAndLog(OpCodes.Ldelema, convType cenv emEnv ty) else let arrayTy = convType cenv emEnv (ILType.Array(shape, ty)) - let elemTy = arrayTy.GetElementType() + let elemTy = !! arrayTy.GetElementType() let argTys = Array.create shape.Rank typeof let retTy = elemTy.MakeByRefType() @@ -1516,7 +1517,7 @@ let rec emitInstr cenv (modB: ModuleBuilder) emEnv (ilG: ILGenerator) instr = ilG.EmitAndLog(OpCodes.Stelem, convType cenv emEnv ty) else let arrayTy = convType cenv emEnv (ILType.Array(shape, ty)) - let elemTy = arrayTy.GetElementType() + let elemTy = !! arrayTy.GetElementType() let meth = modB.GetArrayMethodAndLog( @@ -1624,7 +1625,7 @@ let emitCode cenv modB emEnv (ilG: ILGenerator) (code: ILCode) = | ILExceptionClause.FilterCatch((startFilter, _), (startHandler, endHandler)) -> add startFilter ilG.BeginExceptFilterBlockAndLog - add startHandler (fun () -> ilG.BeginCatchBlockAndLog null) + add startHandler (fun () -> ilG.BeginCatchBlockAndLog Unchecked.defaultof<_>) add endHandler ilG.EndExceptionBlockAndLog | ILExceptionClause.TypeCatch(ty, (startHandler, endHandler)) -> @@ -1713,31 +1714,34 @@ let buildGenParamsPass1b cenv emEnv (genArgs: Type array) (gps: ILGenericParamet gp.CustomAttrs |> emitCustomAttrs cenv emEnv (wrapCustomAttr gpB.SetCustomAttribute) - let flags = GenericParameterAttributes.None - let flags = match gp.Variance with - | NonVariant -> flags - | CoVariant -> flags ||| GenericParameterAttributes.Covariant - | ContraVariant -> flags ||| GenericParameterAttributes.Contravariant + | NonVariant -> GenericParameterAttributes.None + | CoVariant -> GenericParameterAttributes.Covariant + | ContraVariant -> GenericParameterAttributes.Contravariant - let flags = - if gp.HasReferenceTypeConstraint then - flags ||| GenericParameterAttributes.ReferenceTypeConstraint - else - flags + let zero = GenericParameterAttributes.None let flags = - if gp.HasNotNullableValueTypeConstraint then - flags ||| GenericParameterAttributes.NotNullableValueTypeConstraint - else - flags - - let flags = - if gp.HasDefaultConstructorConstraint then - flags ||| GenericParameterAttributes.DefaultConstructorConstraint - else - flags + flags + ||| (if gp.HasReferenceTypeConstraint then + GenericParameterAttributes.ReferenceTypeConstraint + else + zero) + ||| (if gp.HasNotNullableValueTypeConstraint then + GenericParameterAttributes.NotNullableValueTypeConstraint + else + zero) + ||| (if gp.HasDefaultConstructorConstraint then + GenericParameterAttributes.DefaultConstructorConstraint + else + zero) + ||| + // GenericParameterAttributes.AllowByRefLike from net9, not present in ns20 + (if gp.HasAllowsRefStruct then + (enum 0x0020) + else + zero) gpB.SetGenericParameterAttributes flags) //---------------------------------------------------------------------------- @@ -1830,24 +1834,25 @@ let rec buildMethodPass2 cenv tref (typB: TypeBuilder) emEnv (mdef: ILMethodDef) let methB = System.Diagnostics.Debug.Assert(not (isNull definePInvokeMethod), "Runtime does not have DefinePInvokeMethod") // Absolutely can't happen - definePInvokeMethod.Invoke( - typB, - [| - mdef.Name - p.Where.Name - p.Name - attrs - cconv - retTy - null - null - argTys - null - null - pcc - pcs - |] - ) + (!!definePInvokeMethod) + .Invoke( + typB, + [| + mdef.Name + p.Where.Name + p.Name + attrs + cconv + retTy + null + null + argTys + null + null + pcc + pcs + |] + ) :?> MethodBuilder methB.SetImplementationFlagsAndLog implflags @@ -1918,7 +1923,7 @@ let rec buildMethodPass3 cenv tref modB (typB: TypeBuilder) emEnv (mdef: ILMetho | ".cctor" | ".ctor" -> let consB = envGetConsB emEnv mref - // Constructors can not have generic parameters + // Constructors cannot have generic parameters assert isNil mdef.GenericParams // Value parameters let defineParameter (i, attr, name) = @@ -2227,7 +2232,7 @@ let rec buildTypeDefPass3 cenv nesting modB emEnv (tdef: ILTypeDef) = // // The code in this phase is fragile. // -// THe background is that System.Reflection.Emit implementations can be finnickity about the +// The background is that System.Reflection.Emit implementations can be finickity about the // order that CreateType calls are made when types refer to each other. Some of these restrictions // are not well documented, or are related to historical bugs where the F# emit code worked around the // underlying problems. Ideally the SRE implementation would just "work this out as it goes along" but @@ -2473,7 +2478,7 @@ let defineDynamicAssemblyAndLog (asmName, flags, asmDir: string) = asmB -let mkDynamicAssemblyAndModule (assemblyName, optimize, collectible) = +let mkDynamicAssemblyAndModule (assemblyName: string, optimize, collectible) = let asmDir = "." let asmName = AssemblyName() asmName.Name <- assemblyName @@ -2490,7 +2495,7 @@ let mkDynamicAssemblyAndModule (assemblyName, optimize, collectible) = let daType = typeof let daCtor = - daType.GetConstructor [| typeof |] + !! daType.GetConstructor([| typeof |]) let daBuilder = CustomAttributeBuilder( diff --git a/src/Compiler/AbstractIL/ilsign.fs b/src/Compiler/AbstractIL/ilsign.fs index 7a383d4a079..ac06baa5d54 100644 --- a/src/Compiler/AbstractIL/ilsign.fs +++ b/src/Compiler/AbstractIL/ilsign.fs @@ -64,7 +64,9 @@ let hashAssembly (peReader: PEReader) (hashAlgorithm: IncrementalHash) = let checkSumOffset = peHeaderOffset + 0x40 // offsetof(IMAGE_OPTIONAL_HEADER, CheckSum) let securityDirectoryEntryOffset, peHeaderSize = - match peHeaders.PEHeader.Magic with + let header = peHeaders.PEHeader |> nullArgCheck (nameof peHeaders.PEHeader) + + match header.Magic with | PEMagic.PE32 -> peHeaderOffset + 0x80, 0xE0 // offsetof(IMAGE_OPTIONAL_HEADER32, DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY]), sizeof(IMAGE_OPTIONAL_HEADER32) | PEMagic.PE32Plus -> peHeaderOffset + 0x90, 0xF0 // offsetof(IMAGE_OPTIONAL_HEADER64, DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY]), sizeof(IMAGE_OPTIONAL_HEADER64) | _ -> raise (BadImageFormatException(getResourceString (FSComp.SR.ilSignInvalidMagicValue ()))) @@ -87,7 +89,9 @@ let hashAssembly (peReader: PEReader) (hashAlgorithm: IncrementalHash) = hashAlgorithm.AppendData(allHeaders, 0, allHeadersSize) // Hash content of all sections - let signatureDirectory = peHeaders.CorHeader.StrongNameSignatureDirectory + let signatureDirectory = + let corHeader = peHeaders.CorHeader |> nullArgCheck (nameof peHeaders.CorHeader) + corHeader.StrongNameSignatureDirectory let signatureStart = match peHeaders.TryGetDirectoryOffset signatureDirectory with @@ -140,7 +144,7 @@ type BlobReader = x._offset <- x._offset + length arr |> Array.rev -let RSAParamatersFromBlob blob keyType = +let RSAParametersFromBlob blob keyType = let mutable reader = BlobReader blob if reader.ReadInt32() <> 0x00000207 && keyType = KeyType.KeyPair then @@ -186,10 +190,10 @@ let toCLRKeyBlob (rsaParameters: RSAParameters) (algId: int) : byte array = if isNull rsaParameters.Modulus then raise (CryptographicException(String.Format(getResourceString (FSComp.SR.ilSignInvalidRSAParams ()), "Modulus"))) - if isNull rsaParameters.Exponent || rsaParameters.Exponent.Length > 4 then + if isNull rsaParameters.Exponent || (!!rsaParameters.Exponent).Length > 4 then raise (CryptographicException(String.Format(getResourceString (FSComp.SR.ilSignInvalidRSAParams ()), "Exponent"))) - let modulusLength = rsaParameters.Modulus.Length + let modulusLength = (!!rsaParameters.Modulus).Length let halfModulusLength = (modulusLength + 1) / 2 // We assume that if P != null, then so are Q, DP, DQ, InverseQ and D and indicate KeyPair RSA Parameters @@ -227,31 +231,39 @@ let toCLRKeyBlob (rsaParameters: RSAParameters) (algId: int) : byte array = let expAsDword = let mutable buffer = int 0 - for i in 0 .. rsaParameters.Exponent.Length - 1 do - buffer <- (buffer <<< 8) ||| int rsaParameters.Exponent[i] + match rsaParameters.Exponent with + | null -> () + | exp -> + for i in 0 .. exp.Length - 1 do + buffer <- (buffer <<< 8) ||| int exp[i] buffer + let safeArrayRev (buffer: _ MaybeNull) = + match buffer with + | Null -> Array.empty + | NonNull buffer -> buffer |> Array.rev + bw.Write expAsDword // RSAPubKey.pubExp - bw.Write(rsaParameters.Modulus |> Array.rev) // Copy over the modulus for both public and private + bw.Write(rsaParameters.Modulus |> safeArrayRev) // Copy over the modulus for both public and private if isPrivate then do - bw.Write(rsaParameters.P |> Array.rev) - bw.Write(rsaParameters.Q |> Array.rev) - bw.Write(rsaParameters.DP |> Array.rev) - bw.Write(rsaParameters.DQ |> Array.rev) - bw.Write(rsaParameters.InverseQ |> Array.rev) - bw.Write(rsaParameters.D |> Array.rev) + bw.Write(rsaParameters.P |> safeArrayRev) + bw.Write(rsaParameters.Q |> safeArrayRev) + bw.Write(rsaParameters.DP |> safeArrayRev) + bw.Write(rsaParameters.DQ |> safeArrayRev) + bw.Write(rsaParameters.InverseQ |> safeArrayRev) + bw.Write(rsaParameters.D |> safeArrayRev) bw.Flush() ms.ToArray() key -let createSignature hash keyBlob keyType = +let createSignature (hash: byte array) keyBlob keyType = use rsa = RSA.Create() - rsa.ImportParameters(RSAParamatersFromBlob keyBlob keyType) + rsa.ImportParameters(RSAParametersFromBlob keyBlob keyType) let signature = rsa.SignHash(hash, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1) @@ -260,7 +272,8 @@ let createSignature hash keyBlob keyType = let patchSignature (stream: Stream) (peReader: PEReader) (signature: byte array) = let peHeaders = peReader.PEHeaders - let signatureDirectory = peHeaders.CorHeader.StrongNameSignatureDirectory + let corHeader = peHeaders.CorHeader |> nullArgCheck (nameof peHeaders.CorHeader) + let signatureDirectory = corHeader.StrongNameSignatureDirectory let signatureOffset = if signatureDirectory.Size > signature.Length then @@ -275,7 +288,7 @@ let patchSignature (stream: Stream) (peReader: PEReader) (signature: byte array) let corHeaderFlagsOffset = int64 (peHeaders.CorHeaderStartOffset + 16) // offsetof(IMAGE_COR20_HEADER, Flags) stream.Seek(corHeaderFlagsOffset, SeekOrigin.Begin) |> ignore - stream.WriteByte(byte (peHeaders.CorHeader.Flags ||| CorFlags.StrongNameSigned)) + stream.WriteByte(byte (corHeader.Flags ||| CorFlags.StrongNameSigned)) () let signStream stream keyBlob = @@ -307,7 +320,7 @@ let signatureSize (pk: byte array) = // Returns a CLR Format Blob public key let getPublicKeyForKeyPair keyBlob = use rsa = RSA.Create() - rsa.ImportParameters(RSAParamatersFromBlob keyBlob KeyType.KeyPair) + rsa.ImportParameters(RSAParametersFromBlob keyBlob KeyType.KeyPair) let rsaParameters = rsa.ExportParameters false toCLRKeyBlob rsaParameters CALG_RSA_KEYX diff --git a/src/Compiler/AbstractIL/ilwrite.fs b/src/Compiler/AbstractIL/ilwrite.fs index f41c8aaa08d..832aa1c2810 100644 --- a/src/Compiler/AbstractIL/ilwrite.fs +++ b/src/Compiler/AbstractIL/ilwrite.fs @@ -362,7 +362,11 @@ let envForOverrideSpec (ospec: ILOverridesSpec) = { EnclosingTyparCount=ospec.De //--------------------------------------------------------------------- [] -type MetadataTable<'T> = +type MetadataTable<'T +#if !NO_CHECKNULLS + when 'T:not null +#endif + > = { name: string dict: Dictionary<'T, int> // given a row, find its entry number mutable rows: ResizeArray<'T> } @@ -554,6 +558,8 @@ type cenv = methodDefIdxs: Dictionary + implementsIdxs: Dictionary + propertyDefs: MetadataTable eventDefs: MetadataTable @@ -1165,7 +1171,7 @@ let canGenMethodDef (tdef: ILTypeDef) cenv (mdef: ILMethodDef) = match mdef.Access with | ILMemberAccess.Public -> true // When emitting a reference assembly, do not emit methods that are private/protected/internal unless they are virtual/abstract or provide an explicit interface implementation. - // REVIEW: Addded(vlza, fixes #14937): + // REVIEW: Added(vlza, fixes #14937): // We also emit methods that are marked as HideBySig and static, // since they're not virtual or abstract, but we want (?) the same behaviour as normal instance implementations. | ILMemberAccess.Private | ILMemberAccess.Family | ILMemberAccess.Assembly | ILMemberAccess.FamilyOrAssembly @@ -1281,7 +1287,7 @@ and GetTypeAsImplementsRow cenv env tidx ty = TypeDefOrRefOrSpec (tdorTag, tdorRow) |] and GenImplementsPass2 cenv env tidx ty = - AddUnsharedRow cenv TableNames.InterfaceImpl (GetTypeAsImplementsRow cenv env tidx ty) |> ignore + AddUnsharedRow cenv TableNames.InterfaceImpl (GetTypeAsImplementsRow cenv env tidx ty) and GetKeyForEvent tidx (x: ILEventDef) = EventKey (tidx, x.Name) @@ -1317,7 +1323,8 @@ and GenTypeDefPass2 pidx enc cenv (tdef: ILTypeDef) = // Now generate or assign index numbers for tables referenced by the maps. // Don't yet generate contents of these tables - leave that to pass3, as // code may need to embed these entries. - tdef.Implements |> List.iter (GenImplementsPass2 cenv env tidx) + cenv.implementsIdxs[tidx] <- tdef.Implements |> List.map (GenImplementsPass2 cenv env tidx) + tdef.Fields.AsList() |> List.iter (GenFieldDefPass2 tdef cenv tidx) tdef.Methods |> Seq.iter (GenMethodDefPass2 tdef cenv tidx) // Generation of property & event definitions for **ref assemblies** is checking existence of generated method definitions. @@ -2506,7 +2513,8 @@ let rec GetGenericParamAsGenericParamRow cenv _env idx owner gp = | ContraVariant -> 0x0002) ||| (if gp.HasReferenceTypeConstraint then 0x0004 else 0x0000) ||| (if gp.HasNotNullableValueTypeConstraint then 0x0008 else 0x0000) ||| - (if gp.HasDefaultConstructorConstraint then 0x0010 else 0x0000) + (if gp.HasDefaultConstructorConstraint then 0x0010 else 0x0000) ||| + (if gp.HasAllowsRefStruct then 0x0020 else 0x0000) let mdVersionMajor, _ = metadataSchemaVersionSupportedByCLRVersion cenv.desiredMetadataVersion @@ -2866,6 +2874,14 @@ let rec GenTypeDefPass3 enc cenv (tdef: ILTypeDef) = try let env = envForTypeDef tdef let tidx = GetIdxForTypeDef cenv (TdKey(enc, tdef.Name)) + + match tdef.ImplementsCustomAttrs with + | None -> () + | Some attrList -> + attrList + |> List.zip cenv.implementsIdxs[tidx] + |> List.iter (fun (impIdx,(attrs,metadataIdx)) -> GenCustomAttrsPass3Or4 cenv (hca_InterfaceImpl,impIdx) (attrs.GetCustomAttrs metadataIdx)) + tdef.Properties.AsList() |> List.iter (GenPropertyPass3 cenv env) tdef.Events.AsList() |> List.iter (GenEventPass3 cenv env) tdef.Fields.AsList() |> List.iter (GenFieldDefPass3 tdef cenv env) @@ -3130,6 +3146,7 @@ let generateIL ( methodDefIdxsByKey = MetadataTable<_>.New("method defs", EqualityComparer.Default) // This uses reference identity on ILMethodDef objects methodDefIdxs = Dictionary<_, _>(100, HashIdentity.Reference) + implementsIdxs = Dictionary<_, _>(100, HashIdentity.Structural) propertyDefs = MetadataTable<_>.New("property defs", EqualityComparer.Default) eventDefs = MetadataTable<_>.New("event defs", EqualityComparer.Default) typeDefs = MetadataTable<_>.New("type defs", EqualityComparer.Default) @@ -3169,7 +3186,7 @@ let generateIL ( Methods = cenv.pdbinfo.ToArray() TableRowCounts = cenv.tables |> Seq.map(fun t -> t.Count) |> Seq.toArray } - let idxForNextedTypeDef (tdefs: ILTypeDef list, tdef: ILTypeDef) = + let idxForNestedTypeDef (tdefs: ILTypeDef list, tdef: ILTypeDef) = let enc = tdefs |> List.map (fun tdef -> tdef.Name) GetIdxForTypeDef cenv (TdKey(enc, tdef.Name)) @@ -3182,18 +3199,18 @@ let generateIL ( // turn idx tbls into token maps let mappings = { TypeDefTokenMap = (fun t -> - getUncodedToken TableNames.TypeDef (idxForNextedTypeDef t)) + getUncodedToken TableNames.TypeDef (idxForNestedTypeDef t)) FieldDefTokenMap = (fun t fd -> - let tidx = idxForNextedTypeDef t + let tidx = idxForNestedTypeDef t getUncodedToken TableNames.Field (GetFieldDefAsFieldDefIdx cenv tidx fd)) MethodDefTokenMap = (fun t mdef -> - let tidx = idxForNextedTypeDef t + let tidx = idxForNestedTypeDef t getUncodedToken TableNames.Method (FindMethodDefIdx cenv (GetKeyForMethodDef cenv tidx mdef))) PropertyTokenMap = (fun t pdef -> - let tidx = idxForNextedTypeDef t + let tidx = idxForNestedTypeDef t getUncodedToken TableNames.Property (cenv.propertyDefs.GetTableEntry (GetKeyForPropertyDef tidx pdef))) EventTokenMap = (fun t edef -> - let tidx = idxForNextedTypeDef t + let tidx = idxForNestedTypeDef t getUncodedToken TableNames.Event (cenv.eventDefs.GetTableEntry (EventKey (tidx, edef.Name)))) } reportTime "Finalize Module Generation Results" // New return the results diff --git a/src/Compiler/AbstractIL/ilwrite.fsi b/src/Compiler/AbstractIL/ilwrite.fsi index 986f79d53fc..d074f0bc584 100644 --- a/src/Compiler/AbstractIL/ilwrite.fsi +++ b/src/Compiler/AbstractIL/ilwrite.fsi @@ -31,6 +31,6 @@ type options = /// Write a binary to the file system. val WriteILBinaryFile: options: options * inputModule: ILModuleDef * (ILAssemblyRef -> ILAssemblyRef) -> unit -/// Write a binary to an array of bytes auitable for dynamic loading. +/// Write a binary to an array of bytes suitable for dynamic loading. val WriteILBinaryInMemory: options: options * inputModule: ILModuleDef * (ILAssemblyRef -> ILAssemblyRef) -> byte[] * byte[] option diff --git a/src/Compiler/AbstractIL/ilwritepdb.fs b/src/Compiler/AbstractIL/ilwritepdb.fs index fd5ffad27ac..8776330b7c8 100644 --- a/src/Compiler/AbstractIL/ilwritepdb.fs +++ b/src/Compiler/AbstractIL/ilwritepdb.fs @@ -343,12 +343,9 @@ let scopeSorter (scope1: PdbMethodScope) (scope2: PdbMethodScope) = type PortablePdbGenerator (embedAllSource: bool, embedSourceList: string list, sourceLink: string, checksumAlgorithm, info: PdbData, pathMap: PathMap) = - let docs = - match info.Documents with - | Null -> Array.empty - | NonNull docs -> docs + let docs = info.Documents - // The metadata to wite to the PoortablePDB (Roslyn = _debugMetadataOpt) + // The metadata to wite to the PortablePDB (Roslyn = _debugMetadataOpt) let metadata = MetadataBuilder() @@ -393,7 +390,7 @@ type PortablePdbGenerator /// let sourceCompressionThreshold = 200 - let includeSource file = + let includeSource (file: string) = let isInList = embedSourceList |> List.exists (fun f -> String.Compare(file, f, StringComparison.OrdinalIgnoreCase) = 0) @@ -654,12 +651,9 @@ type PortablePdbGenerator let emitMethod minfo = let docHandle, sequencePointBlob = let sps = - match minfo.DebugPoints with - | Null -> Array.empty - | NonNull pts -> - match minfo.DebugRange with - | None -> Array.empty - | Some _ -> pts + match minfo.DebugRange with + | None -> Array.empty + | Some _ -> minfo.DebugPoints let builder = BlobBuilder() builder.WriteCompressedInteger(minfo.LocalSignatureToken) @@ -703,12 +697,12 @@ type PortablePdbGenerator else //============================================================================================================================================= // Sequence-point-record - // Validate these with magic numbers according to the portable pdb spec Sequence point dexcription: + // Validate these with magic numbers according to the portable pdb spec Sequence point description: // https://github.com/dotnet/corefx/blob/master/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md#methoddebuginformation-table-0x31 // // So the spec is actually bit iffy!!!!! (More like guidelines really. ) // It uses code similar to this to validate the values - // if (result < 0 || result >= ushort.MaxValue) // be errorfull + // if (result < 0 || result >= ushort.MaxValue) // be errorful // Spec Says 0x10000 and value max = 0xFFFF but it can't even be = to maxvalue, and so the range is 0 .. 0xfffe inclusive //============================================================================================================================================= @@ -872,7 +866,7 @@ let getInfoForEmbeddedPortablePdb (uncompressedLength: int64) (contentId: BlobContentId) (compressedStream: MemoryStream) - pdbfile + (pdbfile: string) cvChunk pdbChunk deterministicPdbChunk @@ -886,7 +880,7 @@ let getInfoForEmbeddedPortablePdb pdbGetDebugInfo (contentId.Guid.ToByteArray()) (int32 contentId.Stamp) - fn + !!fn cvChunk (Some pdbChunk) deterministicPdbChunk diff --git a/src/Compiler/Checking/AccessibilityLogic.fs b/src/Compiler/Checking/AccessibilityLogic.fs index 4a70f268ddf..6aba2edcb4b 100644 --- a/src/Compiler/Checking/AccessibilityLogic.fs +++ b/src/Compiler/Checking/AccessibilityLogic.fs @@ -243,8 +243,8 @@ let IsILEventInfoAccessible g amap m ad einfo = let private IsILMethInfoAccessible g amap m adType ad ilminfo = match ilminfo with - | ILMethInfo (_, ty, None, mdef, _) -> IsILTypeAndMemberAccessible g amap m adType ad (ILTypeInfo.FromType g ty) mdef.Access - | ILMethInfo (_, _, Some declaringTyconRef, mdef, _) -> IsILMemberAccessible g amap m declaringTyconRef ad mdef.Access + | ILMethInfo (_, IlType ty, mdef, _) -> IsILTypeAndMemberAccessible g amap m adType ad ty mdef.Access + | ILMethInfo (_, CSharpStyleExtension(declaring=declaringTyconRef), mdef, _) -> IsILMemberAccessible g amap m declaringTyconRef ad mdef.Access let GetILAccessOfILPropInfo (ILPropInfo(tinfo, pdef)) = let tdef = tinfo.RawMetadata @@ -256,7 +256,7 @@ let GetILAccessOfILPropInfo (ILPropInfo(tinfo, pdef)) = | Some mrefGet, Some mrefSet -> // // Dotnet properties have a getter and a setter method, each of which can have a separate visibility public, protected, private etc ... - // This code computes the visibility for the property by choosing the most visible method. This approximation is usefull for cases + // This code computes the visibility for the property by choosing the most visible method. This approximation is useful for cases // where the compiler needs to know the visibility of the property. // The specific ordering for choosing the most visible is: // ILMemberAccess.Public, @@ -351,9 +351,10 @@ let CheckILFieldInfoAccessible g amap m ad finfo = /// when calling x.SomeMethod() we need to use 'adTyp' do verify that type of x is accessible from C /// and 'ad' to determine accessibility of SomeMethod. /// I.e when calling x.Public() and x.Protected() -in both cases first check should succeed and second - should fail in the latter one. -let IsTypeAndMethInfoAccessible amap m accessDomainTy ad = function +let rec IsTypeAndMethInfoAccessible amap m accessDomainTy ad = function | ILMeth (g, x, _) -> IsILMethInfoAccessible g amap m accessDomainTy ad x | FSMeth (_, _, vref, _) -> IsValAccessible ad vref + | MethInfoWithModifiedReturnType(mi,_) -> IsTypeAndMethInfoAccessible amap m accessDomainTy ad mi | DefaultStructCtor(g, ty) -> IsTypeAccessible g amap m ad ty #if !NO_TYPEPROVIDERS | ProvidedMeth(amap, tpmb, _, m) as etmi -> diff --git a/src/Compiler/Checking/AttributeChecking.fs b/src/Compiler/Checking/AttributeChecking.fs index 2564a54bdd3..a91ace98d4a 100644 --- a/src/Compiler/Checking/AttributeChecking.fs +++ b/src/Compiler/Checking/AttributeChecking.fs @@ -27,7 +27,7 @@ open FSharp.Core.CompilerServices exception ObsoleteWarning of string * range exception ObsoleteError of string * range -let fail() = failwith "This custom attribute has an argument that can not yet be converted using this API" +let fail() = failwith "This custom attribute has an argument that cannot yet be converted using this API" let rec private evalILAttribElem elem = match elem with @@ -90,7 +90,8 @@ type AttribInfo = match x with | FSAttribInfo(_g, Attrib(tcref, _, _, _, _, _, _)) -> tcref | ILAttribInfo (g, amap, scoref, a, m) -> - let ty = RescopeAndImportILType scoref amap m [] a.Method.DeclaringType + // We are skipping nullness check here because this reference is an attribute usage, nullness does not apply. + let ty = RescopeAndImportILTypeSkipNullness scoref amap m [] a.Method.DeclaringType tcrefOfAppTy g ty member x.ConstructorArguments = @@ -102,9 +103,10 @@ type AttribInfo = let obj = evalFSharpAttribArg g evaluatedExpr ty, obj) | ILAttribInfo (_g, amap, scoref, cattr, m) -> - let parms, _args = decodeILAttribData cattr - [ for argTy, arg in Seq.zip cattr.Method.FormalArgTypes parms -> - let ty = RescopeAndImportILType scoref amap m [] argTy + let params_, _args = decodeILAttribData cattr + [ for argTy, arg in Seq.zip cattr.Method.FormalArgTypes params_ -> + // We are skipping nullness check here because this reference is an attribute usage, nullness does not apply. + let ty = RescopeAndImportILTypeSkipNullness scoref amap m [] argTy let obj = evalILAttribElem arg ty, obj ] @@ -117,9 +119,10 @@ type AttribInfo = let obj = evalFSharpAttribArg g evaluatedExpr ty, nm, isField, obj) | ILAttribInfo (_g, amap, scoref, cattr, m) -> - let _parms, namedArgs = decodeILAttribData cattr + let _params_, namedArgs = decodeILAttribData cattr [ for nm, argTy, isProp, arg in namedArgs -> - let ty = RescopeAndImportILType scoref amap m [] argTy + // We are skipping nullness check here because this reference is an attribute usage, nullness does not apply. + let ty = RescopeAndImportILTypeSkipNullness scoref amap m [] argTy let obj = evalILAttribElem arg let isField = not isProp ty, nm, isField, obj ] @@ -149,10 +152,11 @@ let GetAttribInfosOfEntity g amap m (tcref:TyconRef) = tcref.Attribs |> List.map (fun a -> FSAttribInfo (g, a)) -let GetAttribInfosOfMethod amap m minfo = +let rec GetAttribInfosOfMethod amap m minfo = match minfo with | ILMeth (g, ilminfo, _) -> ilminfo.RawMetadata.CustomAttrs |> AttribInfosOfIL g amap ilminfo.MetadataScope m | FSMeth (g, _, vref, _) -> vref.Attribs |> AttribInfosOfFS g + | MethInfoWithModifiedReturnType(mi,_) -> GetAttribInfosOfMethod amap m mi | DefaultStructCtor _ -> [] #if !NO_TYPEPROVIDERS // TODO: provided attributes @@ -183,11 +187,12 @@ let GetAttribInfosOfEvent amap m einfo = /// Analyze three cases for attributes declared on methods: IL-declared attributes, F#-declared attributes and /// provided attributes. -let BindMethInfoAttributes m minfo f1 f2 f3 = +let rec BindMethInfoAttributes m minfo f1 f2 f3 = ignore m; ignore f3 match minfo with | ILMeth (_, x, _) -> f1 x.RawMetadata.CustomAttrs | FSMeth (_, _, vref, _) -> f2 vref.Attribs + | MethInfoWithModifiedReturnType(mi,_) -> BindMethInfoAttributes m mi f1 f2 f3 | DefaultStructCtor _ -> f2 [] #if !NO_TYPEPROVIDERS | ProvidedMeth (_, mi, _, _) -> f3 (mi.PApply((fun st -> (st :> IProvidedCustomAttributeProvider)), m)) @@ -232,7 +237,7 @@ let MethInfoHasAttribute g m attribSpec minfo = let private CheckCompilerFeatureRequiredAttribute (g: TcGlobals) cattrs msg m = // In some cases C# will generate both ObsoleteAttribute and CompilerFeatureRequiredAttribute. - // Specifically, when default constructor is generated for class with any reqired members in them. + // Specifically, when default constructor is generated for class with any required members in them. // ObsoleteAttribute should be ignored if CompilerFeatureRequiredAttribute is present, and its name is "RequiredMembers". let (AttribInfo(tref,_)) = g.attrib_CompilerFeatureRequiredAttribute match TryDecodeILAttribute tref cattrs with @@ -377,7 +382,7 @@ let CheckFSharpAttributesForUnseen g attribs _m = #if !NO_TYPEPROVIDERS /// Indicate if a list of provided attributes contains 'ObsoleteAttribute'. Used to suppress the item in intellisense. let CheckProvidedAttributesForUnseen (provAttribs: Tainted) m = - provAttribs.PUntaint((fun a -> a.GetAttributeConstructorArgs(provAttribs.TypeProvider.PUntaintNoFailure(id), typeof.FullName).IsSome), m) + provAttribs.PUntaint((fun a -> a.GetAttributeConstructorArgs(provAttribs.TypeProvider.PUntaintNoFailure(id), !! typeof.FullName).IsSome), m) #endif /// Check the attributes associated with a property, returning warnings and errors as data. @@ -476,7 +481,7 @@ let MethInfoIsUnseen g (m: range) (ty: TType) minfo = // just to look at the attributes on IL methods. if tcref.IsILTycon then tcref.ILTyconRawMetadata.CustomAttrs.AsArray() - |> Array.exists (fun attr -> attr.Method.DeclaringType.TypeSpec.Name = typeof.FullName) + |> Array.exists (fun attr -> attr.Method.DeclaringType.TypeSpec.Name = !! typeof.FullName) else false #else @@ -537,7 +542,7 @@ let IsSecurityAttribute (g: TcGlobals) amap (casmap : IDictionary) match casmap.TryGetValue tcs with | true, c -> c | _ -> - let exists = ExistsInEntireHierarchyOfType (fun t -> typeEquiv g t (mkAppTy attr.TyconRef [])) g amap m AllowMultiIntfInstantiations.Yes (mkAppTy tcref []) + let exists = ExistsInEntireHierarchyOfType (fun t -> typeEquiv g t (mkWoNullAppTy attr.TyconRef [])) g amap m AllowMultiIntfInstantiations.Yes (mkWoNullAppTy tcref []) casmap[tcs] <- exists exists | ValueNone -> false diff --git a/src/Compiler/Checking/AugmentWithHashCompare.fs b/src/Compiler/Checking/AugmentWithHashCompare.fs index 4326ac6ccfc..7efb505c9f3 100644 --- a/src/Compiler/Checking/AugmentWithHashCompare.fs +++ b/src/Compiler/Checking/AugmentWithHashCompare.fs @@ -15,12 +15,12 @@ open FSharp.Compiler.TypedTreeOps open FSharp.Compiler.TypeHierarchy let mkIComparableCompareToSlotSig (g: TcGlobals) = - TSlotSig("CompareTo", g.mk_IComparable_ty, [], [], [ [ TSlotParam(Some("obj"), g.obj_ty, false, false, false, []) ] ], Some g.int_ty) + TSlotSig("CompareTo", g.mk_IComparable_ty, [], [], [ [ TSlotParam(Some("obj"), g.obj_ty_withNulls, false, false, false, []) ] ], Some g.int_ty) let mkGenericIComparableCompareToSlotSig (g: TcGlobals) ty = TSlotSig( "CompareTo", - (mkAppTy g.system_GenericIComparable_tcref [ ty ]), + (mkWoNullAppTy g.system_GenericIComparable_tcref [ ty ]), [], [], [ [ TSlotParam(Some("obj"), ty, false, false, false, []) ] ], @@ -35,7 +35,7 @@ let mkIStructuralComparableCompareToSlotSig (g: TcGlobals) = [], [ [ - TSlotParam(None, (mkRefTupledTy g [ g.obj_ty; g.IComparer_ty ]), false, false, false, []) + TSlotParam(None, (mkRefTupledTy g [ g.obj_ty_withNulls; g.IComparer_ty ]), false, false, false, []) ] ], Some g.int_ty @@ -44,7 +44,7 @@ let mkIStructuralComparableCompareToSlotSig (g: TcGlobals) = let mkGenericIEquatableEqualsSlotSig (g: TcGlobals) ty = TSlotSig( "Equals", - (mkAppTy g.system_GenericIEquatable_tcref [ ty ]), + (mkWoNullAppTy g.system_GenericIEquatable_tcref [ ty ]), [], [], [ [ TSlotParam(Some("obj"), ty, false, false, false, []) ] ], @@ -59,7 +59,7 @@ let mkIStructuralEquatableEqualsSlotSig (g: TcGlobals) = [], [ [ - TSlotParam(None, (mkRefTupledTy g [ g.obj_ty; g.IEqualityComparer_ty ]), false, false, false, []) + TSlotParam(None, (mkRefTupledTy g [ g.obj_ty_withNulls; g.IEqualityComparer_ty ]), false, false, false, []) ] ], Some g.bool_ty @@ -76,10 +76,10 @@ let mkIStructuralEquatableGetHashCodeSlotSig (g: TcGlobals) = ) let mkGetHashCodeSlotSig (g: TcGlobals) = - TSlotSig("GetHashCode", g.obj_ty, [], [], [ [] ], Some g.int_ty) + TSlotSig("GetHashCode", g.obj_ty_noNulls, [], [], [ [] ], Some g.int_ty) let mkEqualsSlotSig (g: TcGlobals) = - TSlotSig("Equals", g.obj_ty, [], [], [ [ TSlotParam(Some("obj"), g.obj_ty, false, false, false, []) ] ], Some g.bool_ty) + TSlotSig("Equals", g.obj_ty_noNulls, [], [], [ [ TSlotParam(Some("obj"), g.obj_ty_withNulls, false, false, false, []) ] ], Some g.bool_ty) //------------------------------------------------------------------------- // Helpers associated with code-generation of comparison/hash augmentations @@ -89,22 +89,22 @@ let mkThisTy g ty = if isStructTy g ty then mkByrefTy g ty else ty let mkCompareObjTy g ty = - mkFunTy g (mkThisTy g ty) (mkFunTy g g.obj_ty g.int_ty) + mkFunTy g (mkThisTy g ty) (mkFunTy g g.obj_ty_withNulls g.int_ty) let mkCompareTy g ty = mkFunTy g (mkThisTy g ty) (mkFunTy g ty g.int_ty) let mkCompareWithComparerTy g ty = - mkFunTy g (mkThisTy g ty) (mkFunTy g (mkRefTupledTy g [ g.obj_ty; g.IComparer_ty ]) g.int_ty) + mkFunTy g (mkThisTy g ty) (mkFunTy g (mkRefTupledTy g [ g.obj_ty_withNulls; g.IComparer_ty ]) g.int_ty) let mkEqualsObjTy g ty = - mkFunTy g (mkThisTy g ty) (mkFunTy g g.obj_ty g.bool_ty) + mkFunTy g (mkThisTy g ty) (mkFunTy g g.obj_ty_withNulls g.bool_ty) let mkEqualsTy g ty = mkFunTy g (mkThisTy g ty) (mkFunTy g ty g.bool_ty) let mkEqualsWithComparerTy g ty = - mkFunTy g (mkThisTy g ty) (mkFunTy g (mkRefTupledTy g [ g.obj_ty; g.IEqualityComparer_ty ]) g.bool_ty) + mkFunTy g (mkThisTy g ty) (mkFunTy g (mkRefTupledTy g [ g.obj_ty_withNulls; g.IEqualityComparer_ty ]) g.bool_ty) let mkEqualsWithComparerTyExact g ty = mkFunTy g (mkThisTy g ty) (mkFunTy g (mkRefTupledTy g [ ty; g.IEqualityComparer_ty ]) g.bool_ty) @@ -424,7 +424,7 @@ let mkExnEquality (g: TcGlobals) exnref (exnc: Tycon) = let cases = [ - mkCase (DecisionTreeTest.IsInst(g.exn_ty, mkAppTy exnref []), mbuilder.AddResultTarget(expr)) + mkCase (DecisionTreeTest.IsInst(g.exn_ty, mkWoNullAppTy exnref []), mbuilder.AddResultTarget(expr)) ] let dflt = Some(mbuilder.AddResultTarget(mkFalse g m)) @@ -455,7 +455,7 @@ let mkExnEqualityWithComparer g exnref (exnc: Tycon) thise thatobje (thatv, that let cases = [ - mkCase (DecisionTreeTest.IsInst(g.exn_ty, mkAppTy exnref []), mbuilder.AddResultTarget(expr)) + mkCase (DecisionTreeTest.IsInst(g.exn_ty, mkWoNullAppTy exnref []), mbuilder.AddResultTarget(expr)) ] let dflt = mbuilder.AddResultTarget(mkFalse g m) @@ -1131,7 +1131,7 @@ let CheckAugmentationAttribs isImplementation g amap (tycon: Tycon) = hasNominalInterface g.system_GenericIComparable_tcref let hasExplicitEquals = - tycon.HasOverride g "Equals" [ g.obj_ty ] + tycon.HasOverride g "Equals" [ g.obj_ty_ambivalent ] || hasNominalInterface g.tcref_System_IStructuralEquatable let hasExplicitGenericEquals = hasNominalInterface g.system_GenericIEquatable_tcref @@ -1287,7 +1287,7 @@ let mkValSpecAux g m (tcref: TyconRef) ty vis slotsig methn valTy argData isGett let mkValSpec g (tcref: TyconRef) ty vis slotsig methn valTy argData isGetter = mkValSpecAux g tcref.Range tcref ty vis slotsig methn valTy argData isGetter true -// Unlike other generated items, the 'IsABC' propeties are visible, not considered compiler-generated +// Unlike other generated items, the 'IsABC' properties are visible, not considered compiler-generated let mkImpliedValSpec g m tcref ty vis slotsig methn valTy argData isGetter = let v = mkValSpecAux g m tcref ty vis slotsig methn valTy argData isGetter false v.SetIsImplied() @@ -1322,7 +1322,7 @@ let MakeValsForCompareWithComparerAugmentation g (tcref: TyconRef) = let MakeValsForEqualsAugmentation g (tcref: TyconRef) = let m = tcref.Range let _, ty = mkMinimalTy g tcref - let vis = tcref.TypeReprAccessibility + let vis = tcref.Accessibility let tps = tcref.Typars m let objEqualsVal = @@ -1347,16 +1347,13 @@ let MakeValsForEqualsAugmentation g (tcref: TyconRef) = let MakeValsForEqualityWithComparerAugmentation g (tcref: TyconRef) = let _, ty = mkMinimalTy g tcref - let vis = - // Equality method for union types match the union type visibility rather than the TypeReprAccessibility - if tcref.IsUnionTycon then tcref.Accessibility - else tcref.TypeReprAccessibility + let vis = tcref.Accessibility let tps = tcref.Typars tcref.Range let objGetHashCodeVal = mkValSpec g tcref ty vis (Some(mkGetHashCodeSlotSig g)) "GetHashCode" (tps +-> (mkHashTy g ty)) unitArg false - let withcGetHashCodeVal = + let withGetHashCodeVal = mkValSpec g tcref @@ -1368,10 +1365,11 @@ let MakeValsForEqualityWithComparerAugmentation g (tcref: TyconRef) = unaryArg false - let withcEqualsVal = + let withEqualsVal = mkValSpec g tcref ty vis (Some(mkIStructuralEquatableEqualsSlotSig g)) "Equals" (tps +-> (mkEqualsWithComparerTy g ty)) tupArg false - let withcEqualsValExact = + let withEqualsExactWithComparer = + let vis = TAccess (updateSyntaxAccessForCompPath (vis.CompilationPaths) SyntaxAccess.Public) mkValSpec g tcref @@ -1383,12 +1381,11 @@ let MakeValsForEqualityWithComparerAugmentation g (tcref: TyconRef) = (tps +-> (mkEqualsWithComparerTyExact g ty)) tupArg false - { GetHashCode = objGetHashCodeVal - GetHashCodeWithComparer = withcGetHashCodeVal - EqualsWithComparer = withcEqualsVal - EqualsExactWithComparer = withcEqualsValExact + GetHashCodeWithComparer = withGetHashCodeVal + EqualsWithComparer = withEqualsVal + EqualsExactWithComparer = withEqualsExactWithComparer } let MakeBindingsForCompareAugmentation g (tycon: Tycon) = @@ -1407,13 +1404,13 @@ let MakeBindingsForCompareAugmentation g (tycon: Tycon) = let tinst, ty = mkMinimalTy g tcref let thisv, thise = mkThisVar g m ty - let thatobjv, thatobje = mkCompGenLocal m "obj" g.obj_ty + let thatobjv, thatobje = mkCompGenLocal m "obj" g.obj_ty_ambivalent let comparee = if isUnitTy g ty then mkZero g m else - let thate = mkCoerceExpr (thatobje, ty, m, g.obj_ty) + let thate = mkCoerceExpr (thatobje, ty, m, g.obj_ty_ambivalent) mkApps g ((exprForValRef m vref2, vref2.Type), (if isNil tinst then [] else [ tinst ]), [ thise; thate ], m) @@ -1450,8 +1447,8 @@ let MakeBindingsForCompareWithComparerAugmentation g (tycon: Tycon) = let compv, compe = mkCompGenLocal m "comp" g.IComparer_ty let thisv, thise = mkThisVar g m ty - let thatobjv, thatobje = mkCompGenLocal m "obj" g.obj_ty - let thate = mkCoerceExpr (thatobje, ty, m, g.obj_ty) + let thatobjv, thatobje = mkCompGenLocal m "obj" g.obj_ty_ambivalent + let thate = mkCoerceExpr (thatobje, ty, m, g.obj_ty_ambivalent) let rhs = let comparee = comparef g tcref tycon (thisv, thise) (thatobjv, thate) compe @@ -1509,7 +1506,7 @@ let MakeBindingsForEqualityWithComparerAugmentation (g: TcGlobals) (tycon: Tycon let withcEqualsExpr = let tinst, ty = mkMinimalTy g tcref let thisv, thise = mkThisVar g m ty - let thatobjv, thatobje = mkCompGenLocal m "obj" g.obj_ty + let thatobjv, thatobje = mkCompGenLocal m "obj" g.obj_ty_ambivalent let thatv, thate = mkCompGenLocal m "that" ty let compv, compe = mkCompGenLocal m "comp" g.IEqualityComparer_ty @@ -1605,7 +1602,7 @@ let MakeBindingsForEqualsAugmentation (g: TcGlobals) (tycon: Tycon) = let tinst, ty = mkMinimalTy g tcref let thisv, thise = mkThisVar g m ty - let thatobjv, thatobje = mkCompGenLocal m "obj" g.obj_ty + let thatobjv, thatobje = mkCompGenLocal m "obj" g.obj_ty_ambivalent let equalse = if isUnitTy g ty then @@ -1685,7 +1682,7 @@ let MakeValsForUnionAugmentation g (tcref: TyconRef) = tcref.UnionCasesAsList |> List.map (fun uc -> - // Unlike other generated items, the 'IsABC' propeties are visible, not considered compiler-generated + // Unlike other generated items, the 'IsABC' properties are visible, not considered compiler-generated let v = mkImpliedValSpec g uc.Range tcref tmty vis None ("get_Is" + uc.CompiledName) (tps +-> (mkIsCaseTy g tmty)) unitArg true diff --git a/src/Compiler/Checking/CheckBasics.fs b/src/Compiler/Checking/CheckBasics.fs index 61b4b835c6f..7cbca970cc3 100644 --- a/src/Compiler/Checking/CheckBasics.fs +++ b/src/Compiler/Checking/CheckBasics.fs @@ -137,7 +137,7 @@ type CtorInfo = /// A handle to the boolean ref cell to hold success of initialized 'this' for 'type X() as x = ...' constructs safeInitInfo: SafeInitData - /// Is the an implicit constructor or an explicit one? + /// Is there an implicit constructor or an explicit one? ctorIsImplicit: bool } diff --git a/src/Compiler/Checking/CheckBasics.fsi b/src/Compiler/Checking/CheckBasics.fsi index a71aa08effb..179752c394c 100644 --- a/src/Compiler/Checking/CheckBasics.fsi +++ b/src/Compiler/Checking/CheckBasics.fsi @@ -47,7 +47,7 @@ type CtorInfo = /// A handle to the boolean ref cell to hold success of initialized 'this' for 'type X() as x = ...' constructs safeInitInfo: SafeInitData - /// Is the an implicit constructor or an explicit one? + /// Is there an implicit constructor or an explicit one? ctorIsImplicit: bool } @@ -197,7 +197,7 @@ type TcPatPhase2Input = /// Represents the context flowed left-to-right through pattern checking type TcPatLinearEnv = TcPatLinearEnv of tpenv: UnscopedTyparEnv * names: NameMap * takenNames: Set -/// Represents the flags passsed to TcPat regarding the binding location +/// Represents the flags passed to TcPat regarding the binding location type TcPatValFlags = | TcPatValFlags of inlineFlag: ValInline * diff --git a/src/Compiler/Checking/CheckComputationExpressions.fs b/src/Compiler/Checking/CheckComputationExpressions.fs deleted file mode 100644 index fa56149ac7f..00000000000 --- a/src/Compiler/Checking/CheckComputationExpressions.fs +++ /dev/null @@ -1,3605 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -/// The typechecker. Left-to-right constrained type checking -/// with generalization at appropriate points. -module internal FSharp.Compiler.CheckComputationExpressions - -open Internal.Utilities.Library -open FSharp.Compiler.AccessibilityLogic -open FSharp.Compiler.AttributeChecking -open FSharp.Compiler.CheckExpressions -open FSharp.Compiler.CheckBasics -open FSharp.Compiler.ConstraintSolver -open FSharp.Compiler.DiagnosticsLogger -open FSharp.Compiler.Features -open FSharp.Compiler.Infos -open FSharp.Compiler.InfoReader -open FSharp.Compiler.NameResolution -open FSharp.Compiler.PatternMatchCompilation -open FSharp.Compiler.Syntax.PrettyNaming -open FSharp.Compiler.Syntax -open FSharp.Compiler.SyntaxTrivia -open FSharp.Compiler.SyntaxTreeOps -open FSharp.Compiler.Text -open FSharp.Compiler.Text.Range -open FSharp.Compiler.TypedTree -open FSharp.Compiler.TypedTreeOps - -type cenv = TcFileState - -/// Used to flag if this is the first or a sebsequent translation pass through a computation expression -type CompExprTranslationPass = - | Initial - | Subsequent - -/// Used to flag if computation expression custom operations are allowed in a given context -type CustomOperationsMode = - | Allowed - | Denied - -let TryFindIntrinsicOrExtensionMethInfo collectionSettings (cenv: cenv) (env: TcEnv) m ad nm ty = - AllMethInfosOfTypeInScope collectionSettings cenv.infoReader env.NameEnv (Some nm) ad IgnoreOverrides m ty - -/// Ignores an attribute -let IgnoreAttribute _ = None - -[] -let (|ExprAsPat|_|) (f: SynExpr) = - match f with - | SingleIdent v1 - | SynExprParen(SingleIdent v1, _, _, _) -> ValueSome(mkSynPatVar None v1) - | SynExprParen(SynExpr.Tuple(false, elems, commas, _), _, _, _) -> - let elems = elems |> List.map (|SingleIdent|_|) - - if elems |> List.forall (fun x -> x.IsSome) then - ValueSome(SynPat.Tuple(false, (elems |> List.map (fun x -> mkSynPatVar None x.Value)), commas, f.Range)) - else - ValueNone - | _ -> ValueNone - -// For join clauses that join on nullable, we syntactically insert the creation of nullable values on the appropriate side of the condition, -// then pull the syntax apart again -[] -let (|JoinRelation|_|) cenv env (expr: SynExpr) = - let m = expr.Range - let ad = env.eAccessRights - - let isOpName opName vref s = - (s = opName) - && match - ResolveExprLongIdent - cenv.tcSink - cenv.nameResolver - m - ad - env.eNameResEnv - TypeNameResolutionInfo.Default - [ ident (opName, m) ] - None - with - | Result(_, Item.Value vref2, []) -> valRefEq cenv.g vref vref2 - | _ -> false - - match expr with - | BinOpExpr(opId, a, b) when isOpName opNameEquals cenv.g.equals_operator_vref opId.idText -> ValueSome(a, b) - - | BinOpExpr(opId, a, b) when isOpName opNameEqualsNullable cenv.g.equals_nullable_operator_vref opId.idText -> - - let a = - SynExpr.App(ExprAtomicFlag.Atomic, false, mkSynLidGet a.Range [ MangledGlobalName; "System" ] "Nullable", a, a.Range) - - ValueSome(a, b) - - | BinOpExpr(opId, a, b) when isOpName opNameNullableEquals cenv.g.nullable_equals_operator_vref opId.idText -> - - let b = - SynExpr.App(ExprAtomicFlag.Atomic, false, mkSynLidGet b.Range [ MangledGlobalName; "System" ] "Nullable", b, b.Range) - - ValueSome(a, b) - - | BinOpExpr(opId, a, b) when isOpName opNameNullableEqualsNullable cenv.g.nullable_equals_nullable_operator_vref opId.idText -> - - ValueSome(a, b) - - | _ -> ValueNone - -let elimFastIntegerForLoop (spFor, spTo, id, start: SynExpr, dir, finish: SynExpr, innerExpr, m: range) = - let mOp = (unionRanges start.Range finish.Range).MakeSynthetic() - - let pseudoEnumExpr = - if dir then - mkSynInfix mOp start ".." finish - else - mkSynTrifix mOp ".. .." start (SynExpr.Const(SynConst.Int32 -1, mOp)) finish - - SynExpr.ForEach(spFor, spTo, SeqExprOnly false, true, mkSynPatVar None id, pseudoEnumExpr, innerExpr, m) - -/// Check if a computation or sequence expression is syntactically free of 'yield' (though not yield!) -let YieldFree (cenv: cenv) expr = - if cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield then - - // Implement yield free logic for F# Language including the LanguageFeature.ImplicitYield - let rec YieldFree expr = - match expr with - | SynExpr.Sequential(expr1 = expr1; expr2 = expr2) -> YieldFree expr1 && YieldFree expr2 - - | SynExpr.IfThenElse(thenExpr = thenExpr; elseExpr = elseExprOpt) -> YieldFree thenExpr && Option.forall YieldFree elseExprOpt - - | SynExpr.TryWith(tryExpr = body; withCases = clauses) -> - YieldFree body - && clauses |> List.forall (fun (SynMatchClause(resultExpr = res)) -> YieldFree res) - - | SynExpr.Match(clauses = clauses) - | SynExpr.MatchBang(clauses = clauses) -> clauses |> List.forall (fun (SynMatchClause(resultExpr = res)) -> YieldFree res) - - | SynExpr.For(doBody = body) - | SynExpr.TryFinally(tryExpr = body) - | SynExpr.LetOrUse(body = body) - | SynExpr.While(doExpr = body) - | SynExpr.WhileBang(doExpr = body) - | SynExpr.ForEach(bodyExpr = body) -> YieldFree body - - | SynExpr.LetOrUseBang(body = body) -> YieldFree body - - | SynExpr.YieldOrReturn(flags = (true, _)) -> false - - | _ -> true - - YieldFree expr - else - // Implement yield free logic for F# Language without the LanguageFeature.ImplicitYield - let rec YieldFree expr = - match expr with - | SynExpr.Sequential(expr1 = expr1; expr2 = expr2) -> YieldFree expr1 && YieldFree expr2 - - | SynExpr.IfThenElse(thenExpr = thenExpr; elseExpr = elseExprOpt) -> YieldFree thenExpr && Option.forall YieldFree elseExprOpt - - | SynExpr.TryWith(tryExpr = e1; withCases = clauses) -> - YieldFree e1 - && clauses |> List.forall (fun (SynMatchClause(resultExpr = res)) -> YieldFree res) - - | SynExpr.Match(clauses = clauses) - | SynExpr.MatchBang(clauses = clauses) -> clauses |> List.forall (fun (SynMatchClause(resultExpr = res)) -> YieldFree res) - - | SynExpr.For(doBody = body) - | SynExpr.TryFinally(tryExpr = body) - | SynExpr.LetOrUse(body = body) - | SynExpr.While(doExpr = body) - | SynExpr.WhileBang(doExpr = body) - | SynExpr.ForEach(bodyExpr = body) -> YieldFree body - - | SynExpr.LetOrUseBang _ - | SynExpr.YieldOrReturnFrom _ - | SynExpr.YieldOrReturn _ - | SynExpr.ImplicitZero _ - | SynExpr.Do _ -> false - - | _ -> true - - YieldFree expr - -/// Determine if a syntactic expression inside 'seq { ... }' or '[...]' counts as a "simple sequence -/// of semicolon separated values". For example [1;2;3]. -/// 'acceptDeprecated' is true for the '[ ... ]' case, where we allow the syntax '[ if g then t else e ]' but ask it to be parenthesized -[] -let (|SimpleSemicolonSequence|_|) cenv acceptDeprecated cexpr = - - let IsSimpleSemicolonSequenceElement expr = - match expr with - | SynExpr.IfThenElse _ when acceptDeprecated && YieldFree cenv expr -> true - | SynExpr.IfThenElse _ - | SynExpr.TryWith _ - | SynExpr.Match _ - | SynExpr.For _ - | SynExpr.ForEach _ - | SynExpr.TryFinally _ - | SynExpr.YieldOrReturnFrom _ - | SynExpr.YieldOrReturn _ - | SynExpr.LetOrUse _ - | SynExpr.Do _ - | SynExpr.MatchBang _ - | SynExpr.LetOrUseBang _ - | SynExpr.While _ - | SynExpr.WhileBang _ -> false - | _ -> true - - let rec TryGetSimpleSemicolonSequenceOfComprehension expr acc = - match expr with - | SynExpr.Sequential(isTrueSeq = true; expr1 = e1; expr2 = e2) -> - if IsSimpleSemicolonSequenceElement e1 then - TryGetSimpleSemicolonSequenceOfComprehension e2 (e1 :: acc) - else - ValueNone - | _ -> - if IsSimpleSemicolonSequenceElement expr then - ValueSome(List.rev (expr :: acc)) - else - ValueNone - - TryGetSimpleSemicolonSequenceOfComprehension cexpr [] - -let RecordNameAndTypeResolutions cenv env tpenv expr = - // This function is motivated by cases like - // query { for ... join(for x in f(). } - // where there is incomplete code in a query, and we are current just dropping a piece of the AST on the floor (above, the bit inside the 'join'). - // - // The problem with dropping the AST on the floor is that we get no captured resolutions, which means no Intellisense/QuickInfo/ParamHelp. - // - // We check this AST-fragment, to get resolutions captured. - // - // This may have effects from typechecking, producing side-effects on the typecheck environment. - suppressErrorReporting (fun () -> - try - ignore (TcExprOfUnknownType cenv env tpenv expr) - with _ -> - ()) - -/// Used for all computation expressions except sequence expressions -let TcComputationExpression (cenv: cenv) env (overallTy: OverallTy) tpenv (mWhole, interpExpr: Expr, builderTy, comp: SynExpr) = - let overallTy = overallTy.Commit - - let g = cenv.g - let ad = env.eAccessRights - - let mkSynDelay2 (e: SynExpr) = mkSynDelay (e.Range.MakeSynthetic()) e - - let builderValName = CompilerGeneratedName "builder" - let mBuilderVal = interpExpr.Range - - // Give bespoke error messages for the FSharp.Core "query" builder - let isQuery = - match stripDebugPoints interpExpr with - // An unparameterized custom builder, e.g., `query`, `async`. - | Expr.Val(vref, _, m) - // A parameterized custom builder, e.g., `builder<…>`, `builder ()`. - | Expr.App(funcExpr = Expr.Val(vref, _, m)) -> - let item = Item.CustomBuilder(vref.DisplayName, vref) - CallNameResolutionSink cenv.tcSink (m, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, env.eAccessRights) - valRefEq cenv.g vref cenv.g.query_value_vref - | _ -> false - - /// Make a builder.Method(...) call - let mkSynCall nm (m: range) args = - let m = m.MakeSynthetic() // Mark as synthetic so the language service won't pick it up. - - let args = - match args with - | [] -> SynExpr.Const(SynConst.Unit, m) - | [ arg ] -> SynExpr.Paren(SynExpr.Paren(arg, range0, None, m), range0, None, m) - | args -> SynExpr.Paren(SynExpr.Tuple(false, args, [], m), range0, None, m) - - let builderVal = mkSynIdGet m builderValName - mkSynApp1 (SynExpr.DotGet(builderVal, range0, SynLongIdent([ mkSynId m nm ], [], [ None ]), m)) args m - - let hasMethInfo nm = - TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBuilderVal ad nm builderTy - |> isNil - |> not - - let sourceMethInfo = - TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBuilderVal ad "Source" builderTy - - // Optionally wrap sources of "let!", "yield!", "use!" in "query.Source" - let mkSourceExpr callExpr = - match sourceMethInfo with - | [] -> callExpr - | _ -> mkSynCall "Source" callExpr.Range [ callExpr ] - - let mkSourceExprConditional isFromSource callExpr = - if isFromSource then mkSourceExpr callExpr else callExpr - - /// Decide if the builder is an auto-quote builder - let isAutoQuote = hasMethInfo "Quote" - - let customOperationMethods = - AllMethInfosOfTypeInScope - ResultCollectionSettings.AllResults - cenv.infoReader - env.NameEnv - None - ad - IgnoreOverrides - mBuilderVal - builderTy - |> List.choose (fun methInfo -> - if not (IsMethInfoAccessible cenv.amap mBuilderVal ad methInfo) then - None - else - let nameSearch = - TryBindMethInfoAttribute - cenv.g - mBuilderVal - cenv.g.attrib_CustomOperationAttribute - methInfo - IgnoreAttribute // We do not respect this attribute for IL methods - (fun attr -> - // NOTE: right now, we support of custom operations with spaces in them ([]) - // In the parameterless CustomOperationAttribute - we use the method name, and also allow it to be ````-quoted (member _.``foo bar`` _ = ...) - match attr with - // Empty string and parameterless constructor - we use the method name - | Attrib(unnamedArgs = [ AttribStringArg "" ]) // Empty string as parameter - | Attrib(unnamedArgs = []) -> // No parameters, same as empty string for compat reasons. - Some methInfo.LogicalName - // Use the specified name - | Attrib(unnamedArgs = [ AttribStringArg msg ]) -> Some msg - | _ -> None) - IgnoreAttribute // We do not respect this attribute for provided methods - - match nameSearch with - | None -> None - | Some nm -> - let joinConditionWord = - TryBindMethInfoAttribute - cenv.g - mBuilderVal - cenv.g.attrib_CustomOperationAttribute - methInfo - IgnoreAttribute // We do not respect this attribute for IL methods - (function - | Attrib(propVal = ExtractAttribNamedArg "JoinConditionWord" (AttribStringArg s)) -> Some s - | _ -> None) - IgnoreAttribute // We do not respect this attribute for provided methods - - let flagSearch (propName: string) = - TryBindMethInfoAttribute - cenv.g - mBuilderVal - cenv.g.attrib_CustomOperationAttribute - methInfo - IgnoreAttribute // We do not respect this attribute for IL methods - (function - | Attrib(propVal = ExtractAttribNamedArg propName (AttribBoolArg b)) -> Some b - | _ -> None) - IgnoreAttribute // We do not respect this attribute for provided methods - - let maintainsVarSpaceUsingBind = - defaultArg (flagSearch "MaintainsVariableSpaceUsingBind") false - - let maintainsVarSpace = defaultArg (flagSearch "MaintainsVariableSpace") false - let allowInto = defaultArg (flagSearch "AllowIntoPattern") false - let isLikeZip = defaultArg (flagSearch "IsLikeZip") false - let isLikeJoin = defaultArg (flagSearch "IsLikeJoin") false - let isLikeGroupJoin = defaultArg (flagSearch "IsLikeGroupJoin") false - - Some( - nm, - maintainsVarSpaceUsingBind, - maintainsVarSpace, - allowInto, - isLikeZip, - isLikeJoin, - isLikeGroupJoin, - joinConditionWord, - methInfo - )) - - let customOperationMethodsIndexedByKeyword = - if cenv.g.langVersion.SupportsFeature LanguageFeature.OverloadsForCustomOperations then - customOperationMethods - |> Seq.groupBy (fun (nm, _, _, _, _, _, _, _, _) -> nm) - |> Seq.map (fun (nm, group) -> (nm, group |> Seq.toList)) - else - customOperationMethods - |> Seq.groupBy (fun (nm, _, _, _, _, _, _, _, _) -> nm) - |> Seq.map (fun (nm, g) -> (nm, Seq.toList g)) - |> dict - - // Check for duplicates by method name (keywords and method names must be 1:1) - let customOperationMethodsIndexedByMethodName = - if cenv.g.langVersion.SupportsFeature LanguageFeature.OverloadsForCustomOperations then - customOperationMethods - |> Seq.groupBy (fun (_, _, _, _, _, _, _, _, methInfo) -> methInfo.LogicalName) - |> Seq.map (fun (nm, group) -> (nm, group |> Seq.toList)) - else - customOperationMethods - |> Seq.groupBy (fun (_, _, _, _, _, _, _, _, methInfo) -> methInfo.LogicalName) - |> Seq.map (fun (nm, g) -> (nm, Seq.toList g)) - |> dict - - /// Decide if the identifier represents a use of a custom query operator - let tryGetDataForCustomOperation (nm: Ident) = - let isOpDataCountAllowed opDatas = - match opDatas with - | [ _ ] -> true - | _ :: _ -> cenv.g.langVersion.SupportsFeature LanguageFeature.OverloadsForCustomOperations - | _ -> false - - match customOperationMethodsIndexedByKeyword.TryGetValue nm.idText with - | true, opDatas when isOpDataCountAllowed opDatas -> - for opData in opDatas do - let (opName, - maintainsVarSpaceUsingBind, - maintainsVarSpace, - _allowInto, - isLikeZip, - isLikeJoin, - isLikeGroupJoin, - _joinConditionWord, - methInfo) = - opData - - if - (maintainsVarSpaceUsingBind && maintainsVarSpace) - || (isLikeZip && isLikeJoin) - || (isLikeZip && isLikeGroupJoin) - || (isLikeJoin && isLikeGroupJoin) - then - errorR (Error(FSComp.SR.tcCustomOperationInvalid opName, nm.idRange)) - - if not (cenv.g.langVersion.SupportsFeature LanguageFeature.OverloadsForCustomOperations) then - match customOperationMethodsIndexedByMethodName.TryGetValue methInfo.LogicalName with - | true, [ _ ] -> () - | _ -> errorR (Error(FSComp.SR.tcCustomOperationMayNotBeOverloaded nm.idText, nm.idRange)) - - Some opDatas - | true, opData :: _ -> - errorR (Error(FSComp.SR.tcCustomOperationMayNotBeOverloaded nm.idText, nm.idRange)) - Some [ opData ] - | _ -> None - - /// Decide if the identifier represents a use of a custom query operator - let hasCustomOperations () = - if isNil customOperationMethods then - CustomOperationsMode.Denied - else - CustomOperationsMode.Allowed - - let isCustomOperation nm = - tryGetDataForCustomOperation nm |> Option.isSome - - let customOperationCheckValidity m f opDatas = - let vs = opDatas |> List.map f - let v0 = vs[0] - - let (opName, - _maintainsVarSpaceUsingBind, - _maintainsVarSpace, - _allowInto, - _isLikeZip, - _isLikeJoin, - _isLikeGroupJoin, - _joinConditionWord, - _methInfo) = - opDatas[0] - - if not (List.allEqual vs) then - errorR (Error(FSComp.SR.tcCustomOperationInvalid opName, m)) - - v0 - - // Check for the MaintainsVariableSpace on custom operation - let customOperationMaintainsVarSpace (nm: Ident) = - match tryGetDataForCustomOperation nm with - | None -> false - | Some opDatas -> - opDatas - |> customOperationCheckValidity - nm.idRange - (fun - (_nm, - _maintainsVarSpaceUsingBind, - maintainsVarSpace, - _allowInto, - _isLikeZip, - _isLikeJoin, - _isLikeGroupJoin, - _joinConditionWord, - _methInfo) -> maintainsVarSpace) - - let customOperationMaintainsVarSpaceUsingBind (nm: Ident) = - match tryGetDataForCustomOperation nm with - | None -> false - | Some opDatas -> - opDatas - |> customOperationCheckValidity - nm.idRange - (fun - (_nm, - maintainsVarSpaceUsingBind, - _maintainsVarSpace, - _allowInto, - _isLikeZip, - _isLikeJoin, - _isLikeGroupJoin, - _joinConditionWord, - _methInfo) -> maintainsVarSpaceUsingBind) - - let customOperationIsLikeZip (nm: Ident) = - match tryGetDataForCustomOperation nm with - | None -> false - | Some opDatas -> - opDatas - |> customOperationCheckValidity - nm.idRange - (fun - (_nm, - _maintainsVarSpaceUsingBind, - _maintainsVarSpace, - _allowInto, - isLikeZip, - _isLikeJoin, - _isLikeGroupJoin, - _joinConditionWord, - _methInfo) -> isLikeZip) - - let customOperationIsLikeJoin (nm: Ident) = - match tryGetDataForCustomOperation nm with - | None -> false - | Some opDatas -> - opDatas - |> customOperationCheckValidity - nm.idRange - (fun - (_nm, - _maintainsVarSpaceUsingBind, - _maintainsVarSpace, - _allowInto, - _isLikeZip, - isLikeJoin, - _isLikeGroupJoin, - _joinConditionWord, - _methInfo) -> isLikeJoin) - - let customOperationIsLikeGroupJoin (nm: Ident) = - match tryGetDataForCustomOperation nm with - | None -> false - | Some opDatas -> - opDatas - |> customOperationCheckValidity - nm.idRange - (fun - (_nm, - _maintainsVarSpaceUsingBind, - _maintainsVarSpace, - _allowInto, - _isLikeZip, - _isLikeJoin, - isLikeGroupJoin, - _joinConditionWord, - _methInfo) -> isLikeGroupJoin) - - let customOperationJoinConditionWord (nm: Ident) = - match tryGetDataForCustomOperation nm with - | Some opDatas -> - opDatas - |> customOperationCheckValidity - nm.idRange - (fun - (_nm, - _maintainsVarSpaceUsingBind, - _maintainsVarSpace, - _allowInto, - _isLikeZip, - _isLikeJoin, - _isLikeGroupJoin, - joinConditionWord, - _methInfo) -> joinConditionWord) - |> function - | None -> "on" - | Some v -> v - | _ -> "on" - - let customOperationAllowsInto (nm: Ident) = - match tryGetDataForCustomOperation nm with - | None -> false - | Some opDatas -> - opDatas - |> customOperationCheckValidity - nm.idRange - (fun - (_nm, - _maintainsVarSpaceUsingBind, - _maintainsVarSpace, - allowInto, - _isLikeZip, - _isLikeJoin, - _isLikeGroupJoin, - _joinConditionWord, - _methInfo) -> allowInto) - - let customOpUsageText nm = - match tryGetDataForCustomOperation nm with - | Some((_nm, - _maintainsVarSpaceUsingBind, - _maintainsVarSpace, - _allowInto, - isLikeZip, - isLikeJoin, - isLikeGroupJoin, - _joinConditionWord, - _methInfo) :: _) -> - if isLikeGroupJoin then - Some( - FSComp.SR.customOperationTextLikeGroupJoin ( - nm.idText, - customOperationJoinConditionWord nm, - customOperationJoinConditionWord nm - ) - ) - elif isLikeJoin then - Some( - FSComp.SR.customOperationTextLikeJoin ( - nm.idText, - customOperationJoinConditionWord nm, - customOperationJoinConditionWord nm - ) - ) - elif isLikeZip then - Some(FSComp.SR.customOperationTextLikeZip (nm.idText)) - else - None - | _ -> None - - /// Inside the 'query { ... }' use a modified name environment that contains fake 'CustomOperation' entries - /// for all custom operations. This adds them to the completion lists and prevents them being used as values inside - /// the query. - let env = - if List.isEmpty customOperationMethods then - env - else - { env with - eNameResEnv = - (env.eNameResEnv, customOperationMethods) - ||> Seq.fold (fun nenv (nm, _, _, _, _, _, _, _, methInfo) -> - AddFakeNameToNameEnv - nm - nenv - (Item.CustomOperation(nm, (fun () -> customOpUsageText (ident (nm, mBuilderVal))), Some methInfo))) - } - - // Environment is needed for completions - CallEnvSink cenv.tcSink (comp.Range, env.NameEnv, ad) - - let tryGetArgAttribsForCustomOperator (nm: Ident) = - match tryGetDataForCustomOperation nm with - | Some argInfos -> - argInfos - |> List.map - (fun - (_nm, - __maintainsVarSpaceUsingBind, - _maintainsVarSpace, - _allowInto, - _isLikeZip, - _isLikeJoin, - _isLikeGroupJoin, - _joinConditionWord, - methInfo) -> - match methInfo.GetParamAttribs(cenv.amap, mWhole) with - | [ curriedArgInfo ] -> Some curriedArgInfo // one for the actual argument group - | _ -> None) - |> Some - | _ -> None - - let tryGetArgInfosForCustomOperator (nm: Ident) = - match tryGetDataForCustomOperation nm with - | Some argInfos -> - argInfos - |> List.map - (fun - (_nm, - __maintainsVarSpaceUsingBind, - _maintainsVarSpace, - _allowInto, - _isLikeZip, - _isLikeJoin, - _isLikeGroupJoin, - _joinConditionWord, - methInfo) -> - match methInfo with - | FSMeth(_, _, vref, _) -> - match ArgInfosOfMember cenv.g vref with - | [ curriedArgInfo ] -> Some curriedArgInfo - | _ -> None - | _ -> None) - |> Some - | _ -> None - - let tryExpectedArgCountForCustomOperator (nm: Ident) = - match tryGetArgAttribsForCustomOperator nm with - | None -> None - | Some argInfosForOverloads -> - let nums = - argInfosForOverloads - |> List.map (function - | None -> -1 - | Some argInfos -> List.length argInfos) - - // Prior to 'OverloadsForCustomOperations' we count exact arguments. - // - // With 'OverloadsForCustomOperations' we don't compute an exact expected argument count - // if any arguments are optional, out or ParamArray. - let isSpecial = - if cenv.g.langVersion.SupportsFeature LanguageFeature.OverloadsForCustomOperations then - argInfosForOverloads - |> List.exists (fun info -> - match info with - | None -> false - | Some args -> - args - |> List.exists - (fun (ParamAttribs(isParamArrayArg, _isInArg, isOutArg, optArgInfo, _callerInfo, _reflArgInfo)) -> - isParamArrayArg || isOutArg || optArgInfo.IsOptional)) - else - false - - if not isSpecial && nums |> List.forall (fun v -> v >= 0 && v = nums[0]) then - Some(max (nums[0] - 1) 0) // drop the computation context argument - else - None - - // Check for the [] attribute on an argument position - let isCustomOperationProjectionParameter i (nm: Ident) = - match tryGetArgInfosForCustomOperator nm with - | None -> false - | Some argInfosForOverloads -> - let vs = - argInfosForOverloads - |> List.map (function - | None -> false - | Some argInfos -> - i < argInfos.Length - && let _, argInfo = List.item i argInfos in - HasFSharpAttribute cenv.g cenv.g.attrib_ProjectionParameterAttribute argInfo.Attribs) - - if List.allEqual vs then - vs[0] - else - let opDatas = (tryGetDataForCustomOperation nm).Value - let opName, _, _, _, _, _, _, _j, _ = opDatas[0] - errorR (Error(FSComp.SR.tcCustomOperationInvalid opName, nm.idRange)) - false - - let (|ForEachThen|_|) synExpr = - match synExpr with - | SynExpr.ForEach(_spFor, - _spIn, - SeqExprOnly false, - isFromSource, - pat1, - expr1, - SynExpr.Sequential(isTrueSeq = true; expr1 = clause; expr2 = rest), - _) -> Some(isFromSource, pat1, expr1, clause, rest) - | _ -> None - - let (|CustomOpId|_|) predicate synExpr = - match synExpr with - | SingleIdent nm when isCustomOperation nm && predicate nm -> Some nm - | _ -> None - - // e1 in e2 ('in' is parsed as 'JOIN_IN') - let (|InExpr|_|) synExpr = - match synExpr with - | SynExpr.JoinIn(e1, _, e2, mApp) -> Some(e1, e2, mApp) - | _ -> None - - // e1 on e2 (note: 'on' is the 'JoinConditionWord') - let (|OnExpr|_|) nm synExpr = - match tryGetDataForCustomOperation nm with - | None -> None - | Some _ -> - match synExpr with - | SynExpr.App(funcExpr = SynExpr.App(funcExpr = e1; argExpr = SingleIdent opName); argExpr = e2) when - opName.idText = customOperationJoinConditionWord nm - -> - let item = Item.CustomOperation(opName.idText, (fun () -> None), None) - CallNameResolutionSink cenv.tcSink (opName.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, env.AccessRights) - Some(e1, e2) - | _ -> None - - // e1 into e2 - let (|IntoSuffix|_|) (e: SynExpr) = - match e with - | SynExpr.App(funcExpr = SynExpr.App(funcExpr = x; argExpr = SingleIdent nm2); argExpr = ExprAsPat intoPat) when - nm2.idText = CustomOperations.Into - -> - Some(x, nm2.idRange, intoPat) - | _ -> None - - let arbPat (m: range) = - mkSynPatVar None (mkSynId (m.MakeSynthetic()) "_missingVar") - - let MatchIntoSuffixOrRecover alreadyGivenError (nm: Ident) synExpr = - match synExpr with - | IntoSuffix(x, intoWordRange, intoPat) -> - // record the "into" as a custom operation for colorization - let item = Item.CustomOperation("into", (fun () -> None), None) - CallNameResolutionSink cenv.tcSink (intoWordRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, env.eAccessRights) - (x, intoPat, alreadyGivenError) - | _ -> - if not alreadyGivenError then - errorR (Error(FSComp.SR.tcOperatorIncorrectSyntax (nm.idText, Option.get (customOpUsageText nm)), nm.idRange)) - - (synExpr, arbPat synExpr.Range, true) - - let MatchOnExprOrRecover alreadyGivenError nm (onExpr: SynExpr) = - match onExpr with - | OnExpr nm (innerSource, SynExprParen(keySelectors, _, _, _)) -> (innerSource, keySelectors) - | _ -> - if not alreadyGivenError then - suppressErrorReporting (fun () -> TcExprOfUnknownType cenv env tpenv onExpr) - |> ignore - - errorR (Error(FSComp.SR.tcOperatorIncorrectSyntax (nm.idText, Option.get (customOpUsageText nm)), nm.idRange)) - - (arbExpr ("_innerSource", onExpr.Range), - mkSynBifix onExpr.Range "=" (arbExpr ("_keySelectors", onExpr.Range)) (arbExpr ("_keySelector2", onExpr.Range))) - - let JoinOrGroupJoinOp detector synExpr = - match synExpr with - | SynExpr.App(_, _, CustomOpId detector nm, ExprAsPat innerSourcePat, mJoinCore) -> Some(nm, innerSourcePat, mJoinCore, false) - // join with bad pattern (gives error on "join" and continues) - | SynExpr.App(_, _, CustomOpId detector nm, _innerSourcePatExpr, mJoinCore) -> - errorR (Error(FSComp.SR.tcBinaryOperatorRequiresVariable (nm.idText, Option.get (customOpUsageText nm)), nm.idRange)) - Some(nm, arbPat mJoinCore, mJoinCore, true) - // join (without anything after - gives error on "join" and continues) - | CustomOpId detector nm -> - errorR (Error(FSComp.SR.tcBinaryOperatorRequiresVariable (nm.idText, Option.get (customOpUsageText nm)), nm.idRange)) - Some(nm, arbPat synExpr.Range, synExpr.Range, true) - | _ -> None - // JoinOrGroupJoinOp customOperationIsLikeJoin - - let (|JoinOp|_|) synExpr = - JoinOrGroupJoinOp customOperationIsLikeJoin synExpr - - let (|GroupJoinOp|_|) synExpr = - JoinOrGroupJoinOp customOperationIsLikeGroupJoin synExpr - - let arbKeySelectors m = - mkSynBifix m "=" (arbExpr ("_keySelectors", m)) (arbExpr ("_keySelector2", m)) - - let (|JoinExpr|_|) synExpr = - match synExpr with - | InExpr(JoinOp(nm, innerSourcePat, _, alreadyGivenError), onExpr, mJoinCore) -> - let innerSource, keySelectors = MatchOnExprOrRecover alreadyGivenError nm onExpr - Some(nm, innerSourcePat, innerSource, keySelectors, mJoinCore) - | JoinOp(nm, innerSourcePat, mJoinCore, alreadyGivenError) -> - if alreadyGivenError then - errorR (Error(FSComp.SR.tcOperatorRequiresIn (nm.idText, Option.get (customOpUsageText nm)), nm.idRange)) - - Some(nm, innerSourcePat, arbExpr ("_innerSource", synExpr.Range), arbKeySelectors synExpr.Range, mJoinCore) - | _ -> None - - let (|GroupJoinExpr|_|) synExpr = - match synExpr with - | InExpr(GroupJoinOp(nm, innerSourcePat, _, alreadyGivenError), intoExpr, mGroupJoinCore) -> - let onExpr, intoPat, alreadyGivenError = - MatchIntoSuffixOrRecover alreadyGivenError nm intoExpr - - let innerSource, keySelectors = MatchOnExprOrRecover alreadyGivenError nm onExpr - Some(nm, innerSourcePat, innerSource, keySelectors, intoPat, mGroupJoinCore) - | GroupJoinOp(nm, innerSourcePat, mGroupJoinCore, alreadyGivenError) -> - if alreadyGivenError then - errorR (Error(FSComp.SR.tcOperatorRequiresIn (nm.idText, Option.get (customOpUsageText nm)), nm.idRange)) - - Some( - nm, - innerSourcePat, - arbExpr ("_innerSource", synExpr.Range), - arbKeySelectors synExpr.Range, - arbPat synExpr.Range, - mGroupJoinCore - ) - | _ -> None - - let (|JoinOrGroupJoinOrZipClause|_|) synExpr = - - match synExpr with - // join innerSourcePat in innerSource on (keySelector1 = keySelector2) - | JoinExpr(nm, innerSourcePat, innerSource, keySelectors, mJoinCore) -> - Some(nm, innerSourcePat, innerSource, Some keySelectors, None, mJoinCore) - - // groupJoin innerSourcePat in innerSource on (keySelector1 = keySelector2) into intoPat - | GroupJoinExpr(nm, innerSourcePat, innerSource, keySelectors, intoPat, mGroupJoinCore) -> - Some(nm, innerSourcePat, innerSource, Some keySelectors, Some intoPat, mGroupJoinCore) - - // zip intoPat in secondSource - | InExpr(SynExpr.App(_, _, CustomOpId customOperationIsLikeZip nm, ExprAsPat secondSourcePat, _), secondSource, mZipCore) -> - Some(nm, secondSourcePat, secondSource, None, None, mZipCore) - - // zip (without secondSource or in - gives error) - | CustomOpId customOperationIsLikeZip nm -> - errorR (Error(FSComp.SR.tcOperatorIncorrectSyntax (nm.idText, Option.get (customOpUsageText nm)), nm.idRange)) - Some(nm, arbPat synExpr.Range, arbExpr ("_secondSource", synExpr.Range), None, None, synExpr.Range) - - // zip secondSource (without in - gives error) - | SynExpr.App(_, _, CustomOpId customOperationIsLikeZip nm, ExprAsPat secondSourcePat, mZipCore) -> - errorR (Error(FSComp.SR.tcOperatorIncorrectSyntax (nm.idText, Option.get (customOpUsageText nm)), mZipCore)) - Some(nm, secondSourcePat, arbExpr ("_innerSource", synExpr.Range), None, None, mZipCore) - - | _ -> None - - let (|ForEachThenJoinOrGroupJoinOrZipClause|_|) strict synExpr = - match synExpr with - | ForEachThen(isFromSource, - firstSourcePat, - firstSource, - JoinOrGroupJoinOrZipClause(nm, secondSourcePat, secondSource, keySelectorsOpt, pat3opt, mOpCore), - innerComp) when - (let _firstSourceSimplePats, later1 = - use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink - SimplePatsOfPat cenv.synArgNameGenerator firstSourcePat - - Option.isNone later1) - -> - Some(isFromSource, firstSourcePat, firstSource, nm, secondSourcePat, secondSource, keySelectorsOpt, pat3opt, mOpCore, innerComp) - - | JoinOrGroupJoinOrZipClause(nm, pat2, expr2, expr3, pat3opt, mOpCore) when strict -> - errorR (Error(FSComp.SR.tcBinaryOperatorRequiresBody (nm.idText, Option.get (customOpUsageText nm)), nm.idRange)) - - Some( - true, - arbPat synExpr.Range, - arbExpr ("_outerSource", synExpr.Range), - nm, - pat2, - expr2, - expr3, - pat3opt, - mOpCore, - arbExpr ("_innerComp", synExpr.Range) - ) - - | _ -> None - - let (|StripApps|) e = - let rec strip e = - match e with - | SynExpr.FromParseError(SynExpr.App(funcExpr = f; argExpr = arg), _) - | SynExpr.App(funcExpr = f; argExpr = arg) -> - let g, acc = strip f - g, (arg :: acc) - | _ -> e, [] - - let g, acc = strip e - g, List.rev acc - - let (|OptionalIntoSuffix|) e = - match e with - | IntoSuffix(body, intoWordRange, intoInfo) -> (body, Some(intoWordRange, intoInfo)) - | body -> (body, None) - - let (|CustomOperationClause|_|) e = - match e with - | OptionalIntoSuffix(StripApps(SingleIdent nm, _) as core, intoOpt) when isCustomOperation nm -> - // Now we know we have a custom operation, commit the name resolution - let intoInfoOpt = - match intoOpt with - | Some(intoWordRange, intoInfo) -> - let item = Item.CustomOperation("into", (fun () -> None), None) - - CallNameResolutionSink - cenv.tcSink - (intoWordRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, env.eAccessRights) - - Some intoInfo - | None -> None - - Some(nm, Option.get (tryGetDataForCustomOperation nm), core, core.Range, intoInfoOpt) - | _ -> None - - let mkSynLambda p e m = - SynExpr.Lambda(false, false, p, e, None, m, SynExprLambdaTrivia.Zero) - - let mkExprForVarSpace m (patvs: Val list) = - match patvs with - | [] -> SynExpr.Const(SynConst.Unit, m) - | [ v ] -> SynExpr.Ident v.Id - | vs -> SynExpr.Tuple(false, (vs |> List.map (fun v -> SynExpr.Ident(v.Id))), [], m) - - let mkSimplePatForVarSpace m (patvs: Val list) = - let spats = - match patvs with - | [] -> [] - | [ v ] -> [ mkSynSimplePatVar false v.Id ] - | vs -> vs |> List.map (fun v -> mkSynSimplePatVar false v.Id) - - SynSimplePats.SimplePats(spats, [], m) - - let mkPatForVarSpace m (patvs: Val list) = - match patvs with - | [] -> SynPat.Const(SynConst.Unit, m) - | [ v ] -> mkSynPatVar None v.Id - | vs -> SynPat.Tuple(false, (vs |> List.map (fun x -> mkSynPatVar None x.Id)), [], m) - - let (|OptionalSequential|) e = - match e with - | SynExpr.Sequential(debugPoint = _sp; isTrueSeq = true; expr1 = dataComp1; expr2 = dataComp2) -> (dataComp1, Some dataComp2) - | _ -> (e, None) - - // "cexpr; cexpr" is treated as builder.Combine(cexpr1, cexpr1) - // This is not pretty - we have to decide which range markers we use for the calls to Combine and Delay - // NOTE: we should probably suppress these sequence points altogether - let rangeForCombine innerComp1 = - let m = - match innerComp1 with - | SynExpr.IfThenElse(trivia = { IfToThenRange = mIfToThen }) -> mIfToThen - | SynExpr.Match(matchDebugPoint = DebugPointAtBinding.Yes mMatch) -> mMatch - | SynExpr.TryWith(trivia = { TryKeyword = mTry }) -> mTry - | SynExpr.TryFinally(trivia = { TryKeyword = mTry }) -> mTry - | SynExpr.For(forDebugPoint = DebugPointAtFor.Yes mBind) -> mBind - | SynExpr.ForEach(forDebugPoint = DebugPointAtFor.Yes mBind) -> mBind - | SynExpr.While(whileDebugPoint = DebugPointAtWhile.Yes mWhile) -> mWhile - | _ -> innerComp1.Range - - m.NoteSourceConstruct(NotedSourceConstruct.Combine) - - // Check for 'where x > y', 'select x, y' and other mis-applications of infix operators, give a good error message, and return a flag - let checkForBinaryApp comp = - match comp with - | StripApps(SingleIdent nm, [ StripApps(SingleIdent nm2, args); arg2 ]) when - IsLogicalInfixOpName nm.idText - && (match tryExpectedArgCountForCustomOperator nm2 with - | Some n -> n > 0 - | _ -> false) - && not (List.isEmpty args) - -> - let estimatedRangeOfIntendedLeftAndRightArguments = - unionRanges (List.last args).Range arg2.Range - - errorR (Error(FSComp.SR.tcUnrecognizedQueryBinaryOperator (), estimatedRangeOfIntendedLeftAndRightArguments)) - true - | SynExpr.Tuple(false, StripApps(SingleIdent nm2, args) :: _, _, m) when - (match tryExpectedArgCountForCustomOperator nm2 with - | Some n -> n > 0 - | _ -> false) - && not (List.isEmpty args) - -> - let estimatedRangeOfIntendedLeftAndRightArguments = - unionRanges (List.last args).Range m.EndRange - - errorR (Error(FSComp.SR.tcUnrecognizedQueryBinaryOperator (), estimatedRangeOfIntendedLeftAndRightArguments)) - true - | _ -> false - - let addVarsToVarSpace (varSpace: LazyWithContext) f = - LazyWithContext.Create( - (fun m -> - let (patvs: Val list, env) = varSpace.Force m - let vs, envinner = f m env - - let patvs = - List.append - patvs - (vs - |> List.filter (fun v -> not (patvs |> List.exists (fun v2 -> v.LogicalName = v2.LogicalName)))) - - patvs, envinner), - id - ) - - // Flag that a debug point should get emitted prior to both the evaluation of 'rhsExpr' and the call to Using - let addBindDebugPoint spBind e = - match spBind with - | DebugPointAtBinding.Yes m -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes m, false, e) - | _ -> e - - let emptyVarSpace = LazyWithContext.NotLazy([], env) - - // If there are no 'yield' in the computation expression, and the builder supports 'Yield', - // then allow the type-directed rule interpreting non-unit-typed expressions in statement - // positions as 'yield'. 'yield!' may be present in the computation expression. - let enableImplicitYield = - cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield - && (hasMethInfo "Yield" - && hasMethInfo "Combine" - && hasMethInfo "Delay" - && YieldFree cenv comp) - - /// - /// Try translate the syntax sugar - /// - /// - /// a flag indicating if custom operators are allowed. They are not allowed inside try/with, try/finally, if/then/else etc. - /// a lazy data structure indicating the variables bound so far in the overall computation - /// the computation expression being analyzed - /// represents the translation of the context in which the computation expression 'comp' occurs, - /// up to a hole to be filled by (part of) the results of translating 'comp'. - let rec tryTrans - (firstTry: CompExprTranslationPass) - (q: CustomOperationsMode) - (varSpace: LazyWithContext<(Val list * TcEnv), range>) - (comp: SynExpr) - (translatedCtxt: SynExpr -> SynExpr) - : SynExpr option = - // Guard the stack for deeply nested computation expressions - cenv.stackGuard.Guard - <| fun () -> - - match comp with - - // for firstSourcePat in firstSource do - // join secondSourcePat in expr2 on (expr3 = expr4) - // ... - // --> - // join expr1 expr2 (fun firstSourcePat -> expr3) (fun secondSourcePat -> expr4) (fun firstSourcePat secondSourcePat -> ...) - - // for firstSourcePat in firstSource do - // groupJoin secondSourcePat in expr2 on (expr3 = expr4) into groupPat - // ... - // --> - // groupJoin expr1 expr2 (fun firstSourcePat -> expr3) (fun secondSourcePat -> expr4) (fun firstSourcePat groupPat -> ...) - - // for firstSourcePat in firstSource do - // zip secondSource into secondSourcePat - // ... - // --> - // zip expr1 expr2 (fun pat1 pat3 -> ...) - | ForEachThenJoinOrGroupJoinOrZipClause true (isFromSource, - firstSourcePat, - firstSource, - nm, - secondSourcePat, - secondSource, - keySelectorsOpt, - secondResultPatOpt, - mOpCore, - innerComp) -> - - if q = CustomOperationsMode.Denied then - error (Error(FSComp.SR.tcCustomOperationMayNotBeUsedHere (), nm.idRange)) - - let firstSource = mkSourceExprConditional isFromSource firstSource - let secondSource = mkSourceExpr secondSource - - // Add the variables to the variable space, on demand - let varSpaceWithFirstVars = - addVarsToVarSpace varSpace (fun _mCustomOp env -> - use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink - - let _, _, vspecs, envinner, _ = - TcMatchPattern cenv (NewInferenceType g) env tpenv firstSourcePat None - - vspecs, envinner) - - let varSpaceWithSecondVars = - addVarsToVarSpace varSpaceWithFirstVars (fun _mCustomOp env -> - use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink - - let _, _, vspecs, envinner, _ = - TcMatchPattern cenv (NewInferenceType g) env tpenv secondSourcePat None - - vspecs, envinner) - - let varSpaceWithGroupJoinVars = - match secondResultPatOpt with - | Some pat3 -> - addVarsToVarSpace varSpaceWithFirstVars (fun _mCustomOp env -> - use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink - - let _, _, vspecs, envinner, _ = - TcMatchPattern cenv (NewInferenceType g) env tpenv pat3 None - - vspecs, envinner) - | None -> varSpace - - let firstSourceSimplePats, later1 = - SimplePatsOfPat cenv.synArgNameGenerator firstSourcePat - - let secondSourceSimplePats, later2 = - SimplePatsOfPat cenv.synArgNameGenerator secondSourcePat - - if Option.isSome later1 then - errorR (Error(FSComp.SR.tcJoinMustUseSimplePattern (nm.idText), firstSourcePat.Range)) - - if Option.isSome later2 then - errorR (Error(FSComp.SR.tcJoinMustUseSimplePattern (nm.idText), secondSourcePat.Range)) - - // check 'join' or 'groupJoin' or 'zip' is permitted for this builder - match tryGetDataForCustomOperation nm with - | None -> error (Error(FSComp.SR.tcMissingCustomOperation (nm.idText), nm.idRange)) - | Some opDatas -> - let opName, _, _, _, _, _, _, _, methInfo = opDatas[0] - - // Record the resolution of the custom operation for posterity - let item = - Item.CustomOperation(opName, (fun () -> customOpUsageText nm), Some methInfo) - - // FUTURE: consider whether we can do better than emptyTyparInst here, in order to display instantiations - // of type variables in the quick info provided in the IDE. - CallNameResolutionSink cenv.tcSink (nm.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, env.eAccessRights) - - let mkJoinExpr keySelector1 keySelector2 innerPat e = - let mSynthetic = mOpCore.MakeSynthetic() - - mkSynCall - methInfo.DisplayName - mOpCore - [ - firstSource - secondSource - mkSynLambda firstSourceSimplePats keySelector1 mSynthetic - mkSynLambda secondSourceSimplePats keySelector2 mSynthetic - mkSynLambda firstSourceSimplePats (mkSynLambda innerPat e mSynthetic) mSynthetic - ] - - let mkZipExpr e = - let mSynthetic = mOpCore.MakeSynthetic() - - mkSynCall - methInfo.DisplayName - mOpCore - [ - firstSource - secondSource - mkSynLambda firstSourceSimplePats (mkSynLambda secondSourceSimplePats e mSynthetic) mSynthetic - ] - - // wraps given expression into sequence with result produced by arbExpr so result will look like: - // l; SynExpr.ArbitraryAfterError (...) - // this allows to handle cases like 'on (a > b)' // '>' is not permitted as correct join relation - // after wrapping a and b can still be typechecked (so we'll have correct completion inside 'on' part) - // but presence of SynExpr.ArbitraryAfterError allows to avoid errors about incompatible types in cases like - // query { - // for a in [1] do - // join b in [""] on (a > b) - // } - // if we typecheck raw 'a' and 'b' then we'll end up with 2 errors: - // 1. incorrect join relation - // 2. incompatible types: int and string - // with SynExpr.ArbitraryAfterError we have only first one - let wrapInArbErrSequence l caption = - SynExpr.Sequential( - DebugPointAtSequential.SuppressNeither, - true, - l, - (arbExpr (caption, l.Range.EndRange)), - l.Range, - SynExprSequentialTrivia.Zero - ) - - let mkOverallExprGivenVarSpaceExpr, varSpaceInner = - - let isNullableOp opId = - match ConvertValLogicalNameToDisplayNameCore opId with - | "?=" - | "=?" - | "?=?" -> true - | _ -> false - - match secondResultPatOpt, keySelectorsOpt with - // groupJoin - | Some secondResultPat, Some relExpr when customOperationIsLikeGroupJoin nm -> - let secondResultSimplePats, later3 = - SimplePatsOfPat cenv.synArgNameGenerator secondResultPat - - if Option.isSome later3 then - errorR (Error(FSComp.SR.tcJoinMustUseSimplePattern (nm.idText), secondResultPat.Range)) - - match relExpr with - | JoinRelation cenv env (keySelector1, keySelector2) -> - mkJoinExpr keySelector1 keySelector2 secondResultSimplePats, varSpaceWithGroupJoinVars - | BinOpExpr(opId, l, r) -> - if isNullableOp opId.idText then - // When we cannot resolve NullableOps, recommend the relevant namespace to be added - errorR ( - Error( - FSComp.SR.cannotResolveNullableOperators (ConvertValLogicalNameToDisplayNameCore opId.idText), - relExpr.Range - ) - ) - else - errorR (Error(FSComp.SR.tcInvalidRelationInJoin (nm.idText), relExpr.Range)) - - let l = wrapInArbErrSequence l "_keySelector1" - let r = wrapInArbErrSequence r "_keySelector2" - // this is not correct JoinRelation but it is still binary operation - // we've already reported error now we can use operands of binary operation as join components - mkJoinExpr l r secondResultSimplePats, varSpaceWithGroupJoinVars - | _ -> - errorR (Error(FSComp.SR.tcInvalidRelationInJoin (nm.idText), relExpr.Range)) - // since the shape of relExpr doesn't match our expectations (JoinRelation) - // then we assume that this is l.h.s. of the join relation - // so typechecker will treat relExpr as body of outerKeySelector lambda parameter in GroupJoin method - mkJoinExpr relExpr (arbExpr ("_keySelector2", relExpr.Range)) secondResultSimplePats, - varSpaceWithGroupJoinVars - - | None, Some relExpr when customOperationIsLikeJoin nm -> - match relExpr with - | JoinRelation cenv env (keySelector1, keySelector2) -> - mkJoinExpr keySelector1 keySelector2 secondSourceSimplePats, varSpaceWithSecondVars - | BinOpExpr(opId, l, r) -> - if isNullableOp opId.idText then - // When we cannot resolve NullableOps, recommend the relevant namespace to be added - errorR ( - Error( - FSComp.SR.cannotResolveNullableOperators (ConvertValLogicalNameToDisplayNameCore opId.idText), - relExpr.Range - ) - ) - else - errorR (Error(FSComp.SR.tcInvalidRelationInJoin (nm.idText), relExpr.Range)) - // this is not correct JoinRelation but it is still binary operation - // we've already reported error now we can use operands of binary operation as join components - let l = wrapInArbErrSequence l "_keySelector1" - let r = wrapInArbErrSequence r "_keySelector2" - mkJoinExpr l r secondSourceSimplePats, varSpaceWithGroupJoinVars - | _ -> - errorR (Error(FSComp.SR.tcInvalidRelationInJoin (nm.idText), relExpr.Range)) - // since the shape of relExpr doesn't match our expectations (JoinRelation) - // then we assume that this is l.h.s. of the join relation - // so typechecker will treat relExpr as body of outerKeySelector lambda parameter in Join method - mkJoinExpr relExpr (arbExpr ("_keySelector2", relExpr.Range)) secondSourceSimplePats, - varSpaceWithGroupJoinVars - - | None, None when customOperationIsLikeZip nm -> mkZipExpr, varSpaceWithSecondVars - - | _ -> - assert false - failwith "unreachable" - - // Case from C# spec: A query expression with a join clause with an into followed by something other than a select clause - // Case from C# spec: A query expression with a join clause without an into followed by something other than a select clause - let valsInner, _env = varSpaceInner.Force mOpCore - let varSpaceExpr = mkExprForVarSpace mOpCore valsInner - let varSpacePat = mkPatForVarSpace mOpCore valsInner - let joinExpr = mkOverallExprGivenVarSpaceExpr varSpaceExpr - - let consumingExpr = - SynExpr.ForEach( - DebugPointAtFor.No, - DebugPointAtInOrTo.No, - SeqExprOnly false, - false, - varSpacePat, - joinExpr, - innerComp, - mOpCore - ) - - Some(trans CompExprTranslationPass.Initial q varSpaceInner consumingExpr translatedCtxt) - - | SynExpr.ForEach(spFor, spIn, SeqExprOnly _seqExprOnly, isFromSource, pat, sourceExpr, innerComp, _mEntireForEach) -> - let sourceExpr = - match RewriteRangeExpr sourceExpr with - | Some e -> e - | None -> sourceExpr - - let wrappedSourceExpr = mkSourceExprConditional isFromSource sourceExpr - - let mFor = - match spFor with - | DebugPointAtFor.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.For) - | DebugPointAtFor.No -> pat.Range - - // For computation expressions, 'in' or 'to' is hit on each MoveNext. - // To support this a named debug point for the "in" keyword is available to inlined code. - match spIn with - | DebugPointAtInOrTo.Yes mIn -> - cenv.namedDebugPointsForInlinedCode[{ - Range = mFor - Name = "ForLoop.InOrToKeyword" - }] <- mIn - | _ -> () - - let mPat = pat.Range - - if - isNil (TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mFor ad "For" builderTy) - then - error (Error(FSComp.SR.tcRequireBuilderMethod ("For"), mFor)) - - // Add the variables to the query variable space, on demand - let varSpace = - addVarsToVarSpace varSpace (fun _mCustomOp env -> - use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink - - let _, _, vspecs, envinner, _ = - TcMatchPattern cenv (NewInferenceType g) env tpenv pat None - - vspecs, envinner) - - Some( - trans CompExprTranslationPass.Initial q varSpace innerComp (fun innerCompR -> - - let forCall = - mkSynCall - "For" - mFor - [ - wrappedSourceExpr - SynExpr.MatchLambda( - false, - mPat, - [ - SynMatchClause(pat, None, innerCompR, mPat, DebugPointAtTarget.Yes, SynMatchClauseTrivia.Zero) - ], - DebugPointAtBinding.NoneAtInvisible, - mFor - ) - ] - - let forCall = - match spFor with - | DebugPointAtFor.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mFor, false, forCall) - | DebugPointAtFor.No -> forCall - - translatedCtxt forCall) - ) - - | SynExpr.For( - forDebugPoint = spFor - toDebugPoint = spTo - ident = id - identBody = start - direction = dir - toBody = finish - doBody = innerComp - range = m) -> - let mFor = - match spFor with - | DebugPointAtFor.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.For) - | _ -> m - - if isQuery then - errorR (Error(FSComp.SR.tcNoIntegerForLoopInQuery (), mFor)) - - let reduced = - elimFastIntegerForLoop (spFor, spTo, id, start, dir, finish, innerComp, m) - - Some(trans CompExprTranslationPass.Initial q varSpace reduced translatedCtxt) - - | SynExpr.While(spWhile, guardExpr, innerComp, _) -> - let mGuard = guardExpr.Range - - let mWhile = - match spWhile with - | DebugPointAtWhile.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.While) - | _ -> mGuard - - if isQuery then - error (Error(FSComp.SR.tcNoWhileInQuery (), mWhile)) - - if - isNil ( - TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mWhile ad "While" builderTy - ) - then - error (Error(FSComp.SR.tcRequireBuilderMethod ("While"), mWhile)) - - if - isNil ( - TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mWhile ad "Delay" builderTy - ) - then - error (Error(FSComp.SR.tcRequireBuilderMethod ("Delay"), mWhile)) - - // 'while' is hit just before each time the guard is called - let guardExpr = - match spWhile with - | DebugPointAtWhile.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mWhile, false, guardExpr) - | DebugPointAtWhile.No -> guardExpr - - Some( - trans CompExprTranslationPass.Initial q varSpace innerComp (fun holeFill -> - translatedCtxt ( - mkSynCall - "While" - mWhile - [ - mkSynDelay2 guardExpr - mkSynCall "Delay" mWhile [ mkSynDelay innerComp.Range holeFill ] - ] - )) - ) - - | SynExpr.WhileBang(spWhile, guardExpr, innerComp, mOrig) -> - let mGuard = guardExpr.Range - - let mWhile = - match spWhile with - | DebugPointAtWhile.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.While) - | _ -> mGuard - - let mGuard = mGuard.MakeSynthetic() - - // 'while!' is hit just before each time the guard is called - let guardExpr = - match spWhile with - | DebugPointAtWhile.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mWhile, false, guardExpr) - | DebugPointAtWhile.No -> guardExpr - - let rewrittenWhileExpr = - let idFirst = mkSynId mGuard (CompilerGeneratedName "first") - let patFirst = mkSynPatVar None idFirst - - let body = - let idCond = mkSynId mGuard (CompilerGeneratedName "cond") - let patCond = mkSynPatVar None idCond - - let condBinding = - mkSynBinding - (Xml.PreXmlDoc.Empty, patCond) - (None, - false, - true, - mGuard, - DebugPointAtBinding.NoneAtSticky, - None, - SynExpr.Ident idFirst, - mGuard, - [], - [], - None, - SynBindingTrivia.Zero) - - let setCondExpr = SynExpr.Set(SynExpr.Ident idCond, SynExpr.Ident idFirst, mGuard) - - let bindCondExpr = - SynExpr.LetOrUseBang( - DebugPointAtBinding.NoneAtSticky, - false, - true, - patFirst, - guardExpr, - [], - setCondExpr, - mGuard, - SynExprLetOrUseBangTrivia.Zero - ) - - let whileExpr = - SynExpr.While( - DebugPointAtWhile.No, - SynExpr.Ident idCond, - SynExpr.Sequential( - DebugPointAtSequential.SuppressBoth, - true, - innerComp, - bindCondExpr, - mWhile, - SynExprSequentialTrivia.Zero - ), - mOrig - ) - - SynExpr.LetOrUse(false, false, [ condBinding ], whileExpr, mGuard, SynExprLetOrUseTrivia.Zero) - - SynExpr.LetOrUseBang( - DebugPointAtBinding.NoneAtSticky, - false, - true, - patFirst, - guardExpr, - [], - body, - mGuard, - SynExprLetOrUseBangTrivia.Zero - ) - - tryTrans CompExprTranslationPass.Initial q varSpace rewrittenWhileExpr translatedCtxt - - | SynExpr.TryFinally(innerComp, unwindExpr, _mTryToLast, spTry, spFinally, trivia) -> - - let mTry = - match spTry with - | DebugPointAtTry.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.Try) - | _ -> trivia.TryKeyword - - let mFinally = - match spFinally with - | DebugPointAtFinally.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.Finally) - | _ -> trivia.FinallyKeyword - - // Put down a debug point for the 'finally' - let unwindExpr2 = - match spFinally with - | DebugPointAtFinally.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mFinally, true, unwindExpr) - | DebugPointAtFinally.No -> unwindExpr - - if isQuery then - error (Error(FSComp.SR.tcNoTryFinallyInQuery (), mTry)) - - if - isNil ( - TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mTry ad "TryFinally" builderTy - ) - then - error (Error(FSComp.SR.tcRequireBuilderMethod ("TryFinally"), mTry)) - - if - isNil (TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mTry ad "Delay" builderTy) - then - error (Error(FSComp.SR.tcRequireBuilderMethod ("Delay"), mTry)) - - let innerExpr = transNoQueryOps innerComp - - let innerExpr = - match spTry with - | DebugPointAtTry.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mTry, true, innerExpr) - | _ -> innerExpr - - Some( - translatedCtxt ( - mkSynCall - "TryFinally" - mTry - [ - mkSynCall "Delay" mTry [ mkSynDelay innerComp.Range innerExpr ] - mkSynDelay2 unwindExpr2 - ] - ) - ) - - | SynExpr.Paren(range = m) -> error (Error(FSComp.SR.tcConstructIsAmbiguousInComputationExpression (), m)) - - // In some cases the node produced by `mkSynCall "Zero" m []` may be discarded in the case - // of implicit yields - for example "list { 1; 2 }" when each expression checks as an implicit yield. - // If it is not discarded, the syntax node will later be checked and the existence/non-existence of the Zero method - // will be checked/reported appropriately (though the error message won't mention computation expressions - // like our other error messages for missing methods). - | SynExpr.ImplicitZero m -> - if - (not enableImplicitYield) - && isNil (TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env m ad "Zero" builderTy) - then - error (Error(FSComp.SR.tcRequireBuilderMethod ("Zero"), m)) - - Some(translatedCtxt (mkSynCall "Zero" m [])) - - | OptionalSequential(JoinOrGroupJoinOrZipClause(_, _, _, _, _, mClause), _) when firstTry = CompExprTranslationPass.Initial -> - - // 'join' clauses preceded by 'let' and other constructs get processed by repackaging with a 'for' loop. - let patvs, _env = varSpace.Force comp.Range - let varSpaceExpr = mkExprForVarSpace mClause patvs - let varSpacePat = mkPatForVarSpace mClause patvs - - let dataCompPrior = - translatedCtxt (transNoQueryOps (SynExpr.YieldOrReturn((true, false), varSpaceExpr, mClause))) - - // Rebind using for ... - let rebind = - SynExpr.ForEach( - DebugPointAtFor.No, - DebugPointAtInOrTo.No, - SeqExprOnly false, - false, - varSpacePat, - dataCompPrior, - comp, - comp.Range - ) - - // Retry with the 'for' loop packaging. Set firstTry=false just in case 'join' processing fails - tryTrans CompExprTranslationPass.Subsequent q varSpace rebind id - - | OptionalSequential(CustomOperationClause(nm, _, opExpr, mClause, _), _) -> - - if q = CustomOperationsMode.Denied then - error (Error(FSComp.SR.tcCustomOperationMayNotBeUsedHere (), opExpr.Range)) - - let patvs, _env = varSpace.Force comp.Range - let varSpaceExpr = mkExprForVarSpace mClause patvs - - let dataCompPriorToOp = - let isYield = not (customOperationMaintainsVarSpaceUsingBind nm) - translatedCtxt (transNoQueryOps (SynExpr.YieldOrReturn((isYield, false), varSpaceExpr, mClause))) - - // Now run the consumeCustomOpClauses - Some(consumeCustomOpClauses q varSpace dataCompPriorToOp comp false mClause) - - | SynExpr.Sequential(sp, true, innerComp1, innerComp2, m, _) -> - - // Check for 'where x > y' and other mis-applications of infix operators. If detected, give a good error message, and just ignore innerComp1 - if isQuery && checkForBinaryApp innerComp1 then - Some(trans CompExprTranslationPass.Initial q varSpace innerComp2 translatedCtxt) - - else - - if isQuery && not (innerComp1.IsArbExprAndThusAlreadyReportedError) then - match innerComp1 with - | SynExpr.JoinIn _ -> () // an error will be reported later when we process innerComp1 as a sequential - | _ -> errorR (Error(FSComp.SR.tcUnrecognizedQueryOperator (), innerComp1.RangeOfFirstPortion)) - - match tryTrans CompExprTranslationPass.Initial CustomOperationsMode.Denied varSpace innerComp1 id with - | Some c -> - // "cexpr; cexpr" is treated as builder.Combine(cexpr1, cexpr1) - let m1 = rangeForCombine innerComp1 - - if - isNil ( - TryFindIntrinsicOrExtensionMethInfo - ResultCollectionSettings.AtMostOneResult - cenv - env - m - ad - "Combine" - builderTy - ) - then - error (Error(FSComp.SR.tcRequireBuilderMethod ("Combine"), m)) - - if - isNil ( - TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env m ad "Delay" builderTy - ) - then - error (Error(FSComp.SR.tcRequireBuilderMethod ("Delay"), m)) - - let combineCall = - mkSynCall - "Combine" - m1 - [ - c - mkSynCall "Delay" m1 [ mkSynDelay innerComp2.Range (transNoQueryOps innerComp2) ] - ] - - Some(translatedCtxt combineCall) - - | None -> - // "do! expr; cexpr" is treated as { let! () = expr in cexpr } - match innerComp1 with - | SynExpr.DoBang(rhsExpr, m) -> - let sp = - match sp with - | DebugPointAtSequential.SuppressExpr -> DebugPointAtBinding.NoneAtDo - | DebugPointAtSequential.SuppressBoth -> DebugPointAtBinding.NoneAtDo - | DebugPointAtSequential.SuppressStmt -> DebugPointAtBinding.Yes m - | DebugPointAtSequential.SuppressNeither -> DebugPointAtBinding.Yes m - - Some( - trans - CompExprTranslationPass.Initial - q - varSpace - (SynExpr.LetOrUseBang( - sp, - false, - true, - SynPat.Const(SynConst.Unit, rhsExpr.Range), - rhsExpr, - [], - innerComp2, - m, - SynExprLetOrUseBangTrivia.Zero - )) - translatedCtxt - ) - - // "expr; cexpr" is treated as sequential execution - | _ -> - Some( - trans CompExprTranslationPass.Initial q varSpace innerComp2 (fun holeFill -> - let fillExpr = - if enableImplicitYield then - // When implicit yields are enabled, then if the 'innerComp1' checks as type - // 'unit' we interpret the expression as a sequential, and when it doesn't - // have type 'unit' we interpret it as a 'Yield + Combine'. - let combineExpr = - let m1 = rangeForCombine innerComp1 - let implicitYieldExpr = mkSynCall "Yield" comp.Range [ innerComp1 ] - - mkSynCall - "Combine" - m1 - [ - implicitYieldExpr - mkSynCall "Delay" m1 [ mkSynDelay holeFill.Range holeFill ] - ] - - SynExpr.SequentialOrImplicitYield(sp, innerComp1, holeFill, combineExpr, m) - else - SynExpr.Sequential(sp, true, innerComp1, holeFill, m, SynExprSequentialTrivia.Zero) - - translatedCtxt fillExpr) - ) - - | SynExpr.IfThenElse(guardExpr, thenComp, elseCompOpt, spIfToThen, isRecovery, mIfToEndOfElseBranch, trivia) -> - match elseCompOpt with - | Some elseComp -> - if isQuery then - error (Error(FSComp.SR.tcIfThenElseMayNotBeUsedWithinQueries (), trivia.IfToThenRange)) - - Some( - translatedCtxt ( - SynExpr.IfThenElse( - guardExpr, - transNoQueryOps thenComp, - Some(transNoQueryOps elseComp), - spIfToThen, - isRecovery, - mIfToEndOfElseBranch, - trivia - ) - ) - ) - | None -> - let elseComp = - if - isNil ( - TryFindIntrinsicOrExtensionMethInfo - ResultCollectionSettings.AtMostOneResult - cenv - env - trivia.IfToThenRange - ad - "Zero" - builderTy - ) - then - error (Error(FSComp.SR.tcRequireBuilderMethod ("Zero"), trivia.IfToThenRange)) - - mkSynCall "Zero" trivia.IfToThenRange [] - - Some( - trans CompExprTranslationPass.Initial q varSpace thenComp (fun holeFill -> - translatedCtxt ( - SynExpr.IfThenElse( - guardExpr, - holeFill, - Some elseComp, - spIfToThen, - isRecovery, - mIfToEndOfElseBranch, - trivia - ) - )) - ) - - // 'let binds in expr' - | SynExpr.LetOrUse(isRec, false, binds, innerComp, m, trivia) -> - - // For 'query' check immediately - if isQuery then - match (List.map (BindingNormalization.NormalizeBinding ValOrMemberBinding cenv env) binds) with - | [ NormalizedBinding(_, SynBindingKind.Normal, false, false, _, _, _, _, _, _, _, _) ] when not isRec -> () - | normalizedBindings -> - let failAt m = - error (Error(FSComp.SR.tcNonSimpleLetBindingInQuery (), m)) - - match normalizedBindings with - | NormalizedBinding(mBinding = mBinding) :: _ -> failAt mBinding - | _ -> failAt m - - // Add the variables to the query variable space, on demand - let varSpace = - addVarsToVarSpace varSpace (fun mQueryOp env -> - // Normalize the bindings before detecting the bound variables - match (List.map (BindingNormalization.NormalizeBinding ValOrMemberBinding cenv env) binds) with - | [ NormalizedBinding(kind = SynBindingKind.Normal; shouldInline = false; isMutable = false; pat = pat) ] -> - // successful case - use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink - - let _, _, vspecs, envinner, _ = - TcMatchPattern cenv (NewInferenceType g) env tpenv pat None - - vspecs, envinner - | _ -> - // error case - error (Error(FSComp.SR.tcCustomOperationMayNotBeUsedInConjunctionWithNonSimpleLetBindings (), mQueryOp))) - - Some( - trans CompExprTranslationPass.Initial q varSpace innerComp (fun holeFill -> - translatedCtxt (SynExpr.LetOrUse(isRec, false, binds, holeFill, m, trivia))) - ) - - // 'use x = expr in expr' - | SynExpr.LetOrUse( - isUse = true - bindings = [ SynBinding(kind = SynBindingKind.Normal; headPat = pat; expr = rhsExpr; debugPoint = spBind) ] - body = innerComp) -> - let mBind = - match spBind with - | DebugPointAtBinding.Yes m -> m - | _ -> rhsExpr.Range - - if isQuery then - error (Error(FSComp.SR.tcUseMayNotBeUsedInQueries (), mBind)) - - let innerCompRange = innerComp.Range - - let consumeExpr = - SynExpr.MatchLambda( - false, - innerCompRange, - [ - SynMatchClause( - pat, - None, - transNoQueryOps innerComp, - innerCompRange, - DebugPointAtTarget.Yes, - SynMatchClauseTrivia.Zero - ) - ], - DebugPointAtBinding.NoneAtInvisible, - innerCompRange - ) - - if - isNil (TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBind ad "Using" builderTy) - then - error (Error(FSComp.SR.tcRequireBuilderMethod ("Using"), mBind)) - - Some( - translatedCtxt (mkSynCall "Using" mBind [ rhsExpr; consumeExpr ]) - |> addBindDebugPoint spBind - ) - - // 'let! pat = expr in expr' - // --> build.Bind(e1, (fun _argN -> match _argN with pat -> expr)) - // or - // --> build.BindReturn(e1, (fun _argN -> match _argN with pat -> expr-without-return)) - | SynExpr.LetOrUseBang( - bindDebugPoint = spBind - isUse = false - isFromSource = isFromSource - pat = pat - rhs = rhsExpr - andBangs = [] - body = innerComp) -> - - let mBind = - match spBind with - | DebugPointAtBinding.Yes m -> m - | _ -> rhsExpr.Range - - if isQuery then - error (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), mBind)) - - // Add the variables to the query variable space, on demand - let varSpace = - addVarsToVarSpace varSpace (fun _mCustomOp env -> - use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink - - let _, _, vspecs, envinner, _ = - TcMatchPattern cenv (NewInferenceType g) env tpenv pat None - - vspecs, envinner) - - let rhsExpr = mkSourceExprConditional isFromSource rhsExpr - Some(transBind q varSpace mBind (addBindDebugPoint spBind) "Bind" [ rhsExpr ] pat innerComp translatedCtxt) - - // 'use! pat = e1 in e2' --> build.Bind(e1, (function _argN -> match _argN with pat -> build.Using(x, (fun _argN -> match _argN with pat -> e2)))) - | SynExpr.LetOrUseBang( - bindDebugPoint = spBind - isUse = true - isFromSource = isFromSource - pat = SynPat.Named(ident = SynIdent(id, _); isThisVal = false) as pat - rhs = rhsExpr - andBangs = [] - body = innerComp) - | SynExpr.LetOrUseBang( - bindDebugPoint = spBind - isUse = true - isFromSource = isFromSource - pat = SynPat.LongIdent(longDotId = SynLongIdent(id = [ id ])) as pat - rhs = rhsExpr - andBangs = [] - body = innerComp) -> - - let mBind = - match spBind with - | DebugPointAtBinding.Yes m -> m - | _ -> rhsExpr.Range - - if isQuery then - error (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), mBind)) - - if - isNil (TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBind ad "Using" builderTy) - then - error (Error(FSComp.SR.tcRequireBuilderMethod ("Using"), mBind)) - - if - isNil (TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBind ad "Bind" builderTy) - then - error (Error(FSComp.SR.tcRequireBuilderMethod ("Bind"), mBind)) - - let bindExpr = - let consumeExpr = - SynExpr.MatchLambda( - false, - mBind, - [ - SynMatchClause( - pat, - None, - transNoQueryOps innerComp, - innerComp.Range, - DebugPointAtTarget.Yes, - SynMatchClauseTrivia.Zero - ) - ], - DebugPointAtBinding.NoneAtInvisible, - mBind - ) - - let consumeExpr = mkSynCall "Using" mBind [ SynExpr.Ident id; consumeExpr ] - - let consumeExpr = - SynExpr.MatchLambda( - false, - mBind, - [ - SynMatchClause(pat, None, consumeExpr, id.idRange, DebugPointAtTarget.No, SynMatchClauseTrivia.Zero) - ], - DebugPointAtBinding.NoneAtInvisible, - mBind - ) - - let rhsExpr = mkSourceExprConditional isFromSource rhsExpr - mkSynCall "Bind" mBind [ rhsExpr; consumeExpr ] |> addBindDebugPoint spBind - - Some(translatedCtxt bindExpr) - - // 'use! pat = e1 ... in e2' where 'pat' is not a simple name --> error - | SynExpr.LetOrUseBang(isUse = true; pat = pat; andBangs = andBangs) -> - if isNil andBangs then - error (Error(FSComp.SR.tcInvalidUseBangBinding (), pat.Range)) - else - error (Error(FSComp.SR.tcInvalidUseBangBindingNoAndBangs (), comp.Range)) - - // 'let! pat1 = expr1 and! pat2 = expr2 in ...' --> - // build.BindN(expr1, expr2, ...) - // or - // build.BindNReturn(expr1, expr2, ...) - // or - // build.Bind(build.MergeSources(expr1, expr2), ...) - | SynExpr.LetOrUseBang( - bindDebugPoint = spBind - isUse = false - isFromSource = isFromSource - pat = letPat - rhs = letRhsExpr - andBangs = andBangBindings - body = innerComp - range = letBindRange) -> - if not (cenv.g.langVersion.SupportsFeature LanguageFeature.AndBang) then - error (Error(FSComp.SR.tcAndBangNotSupported (), comp.Range)) - - if isQuery then - error (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), letBindRange)) - - let mBind = - match spBind with - | DebugPointAtBinding.Yes m -> m - | _ -> letRhsExpr.Range - - let sources = - (letRhsExpr - :: [ for SynExprAndBang(body = andExpr) in andBangBindings -> andExpr ]) - |> List.map (mkSourceExprConditional isFromSource) - - let pats = - letPat :: [ for SynExprAndBang(pat = andPat) in andBangBindings -> andPat ] - - let sourcesRange = sources |> List.map (fun e -> e.Range) |> List.reduce unionRanges - - let numSources = sources.Length - let bindReturnNName = "Bind" + string numSources + "Return" - let bindNName = "Bind" + string numSources - - // Check if this is a Bind2Return etc. - let hasBindReturnN = - not ( - isNil ( - TryFindIntrinsicOrExtensionMethInfo - ResultCollectionSettings.AtMostOneResult - cenv - env - mBind - ad - bindReturnNName - builderTy - ) - ) - - if hasBindReturnN && Option.isSome (convertSimpleReturnToExpr varSpace innerComp) then - let consumePat = SynPat.Tuple(false, pats, [], letPat.Range) - - // Add the variables to the query variable space, on demand - let varSpace = - addVarsToVarSpace varSpace (fun _mCustomOp env -> - use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink - - let _, _, vspecs, envinner, _ = - TcMatchPattern cenv (NewInferenceType g) env tpenv consumePat None - - vspecs, envinner) - - Some(transBind q varSpace mBind (addBindDebugPoint spBind) bindNName sources consumePat innerComp translatedCtxt) - - else - - // Check if this is a Bind2 etc. - let hasBindN = - not ( - isNil ( - TryFindIntrinsicOrExtensionMethInfo - ResultCollectionSettings.AtMostOneResult - cenv - env - mBind - ad - bindNName - builderTy - ) - ) - - if hasBindN then - let consumePat = SynPat.Tuple(false, pats, [], letPat.Range) - - // Add the variables to the query variable space, on demand - let varSpace = - addVarsToVarSpace varSpace (fun _mCustomOp env -> - use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink - - let _, _, vspecs, envinner, _ = - TcMatchPattern cenv (NewInferenceType g) env tpenv consumePat None - - vspecs, envinner) - - Some(transBind q varSpace mBind (addBindDebugPoint spBind) bindNName sources consumePat innerComp translatedCtxt) - else - - // Look for the maximum supported MergeSources, MergeSources3, ... - let mkMergeSourcesName n = - if n = 2 then - "MergeSources" - else - "MergeSources" + (string n) - - let maxMergeSources = - let rec loop (n: int) = - let mergeSourcesName = mkMergeSourcesName n - - if - isNil ( - TryFindIntrinsicOrExtensionMethInfo - ResultCollectionSettings.AtMostOneResult - cenv - env - mBind - ad - mergeSourcesName - builderTy - ) - then - (n - 1) - else - loop (n + 1) - - loop 2 - - if maxMergeSources = 1 then - error (Error(FSComp.SR.tcRequireMergeSourcesOrBindN (bindNName), mBind)) - - let rec mergeSources (sourcesAndPats: (SynExpr * SynPat) list) = - let numSourcesAndPats = sourcesAndPats.Length - assert (numSourcesAndPats <> 0) - - if numSourcesAndPats = 1 then - sourcesAndPats[0] - - elif numSourcesAndPats <= maxMergeSources then - - // Call MergeSources2(e1, e2), MergeSources3(e1, e2, e3) etc - let mergeSourcesName = mkMergeSourcesName numSourcesAndPats - - if - isNil ( - TryFindIntrinsicOrExtensionMethInfo - ResultCollectionSettings.AtMostOneResult - cenv - env - mBind - ad - mergeSourcesName - builderTy - ) - then - error (Error(FSComp.SR.tcRequireMergeSourcesOrBindN (bindNName), mBind)) - - let source = mkSynCall mergeSourcesName sourcesRange (List.map fst sourcesAndPats) - let pat = SynPat.Tuple(false, List.map snd sourcesAndPats, [], letPat.Range) - source, pat - - else - - // Call MergeSourcesMax(e1, e2, e3, e4, (...)) - let nowSourcesAndPats, laterSourcesAndPats = - List.splitAt (maxMergeSources - 1) sourcesAndPats - - let mergeSourcesName = mkMergeSourcesName maxMergeSources - - if - isNil ( - TryFindIntrinsicOrExtensionMethInfo - ResultCollectionSettings.AtMostOneResult - cenv - env - mBind - ad - mergeSourcesName - builderTy - ) - then - error (Error(FSComp.SR.tcRequireMergeSourcesOrBindN (bindNName), mBind)) - - let laterSource, laterPat = mergeSources laterSourcesAndPats - - let source = - mkSynCall mergeSourcesName sourcesRange (List.map fst nowSourcesAndPats @ [ laterSource ]) - - let pat = - SynPat.Tuple(false, List.map snd nowSourcesAndPats @ [ laterPat ], [], letPat.Range) - - source, pat - - let mergedSources, consumePat = mergeSources (List.zip sources pats) - - // Add the variables to the query variable space, on demand - let varSpace = - addVarsToVarSpace varSpace (fun _mCustomOp env -> - use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink - - let _, _, vspecs, envinner, _ = - TcMatchPattern cenv (NewInferenceType g) env tpenv consumePat None - - vspecs, envinner) - - // Build the 'Bind' call - Some( - transBind - q - varSpace - mBind - (addBindDebugPoint spBind) - "Bind" - [ mergedSources ] - consumePat - innerComp - translatedCtxt - ) - - | SynExpr.Match(spMatch, expr, clauses, m, trivia) -> - if isQuery then - error (Error(FSComp.SR.tcMatchMayNotBeUsedWithQuery (), trivia.MatchKeyword)) - - let clauses = - clauses - |> List.map (fun (SynMatchClause(pat, cond, innerComp, patm, sp, trivia)) -> - SynMatchClause(pat, cond, transNoQueryOps innerComp, patm, sp, trivia)) - - Some(translatedCtxt (SynExpr.Match(spMatch, expr, clauses, m, trivia))) - - // 'match! expr with pats ...' --> build.Bind(e1, (function pats ...)) - // FUTURE: consider allowing translation to BindReturn - | SynExpr.MatchBang(spMatch, expr, clauses, _m, trivia) -> - let inputExpr = mkSourceExpr expr - - if isQuery then - error (Error(FSComp.SR.tcMatchMayNotBeUsedWithQuery (), trivia.MatchBangKeyword)) - - if - isNil ( - TryFindIntrinsicOrExtensionMethInfo - ResultCollectionSettings.AtMostOneResult - cenv - env - trivia.MatchBangKeyword - ad - "Bind" - builderTy - ) - then - error (Error(FSComp.SR.tcRequireBuilderMethod ("Bind"), trivia.MatchBangKeyword)) - - let clauses = - clauses - |> List.map (fun (SynMatchClause(pat, cond, innerComp, patm, sp, trivia)) -> - SynMatchClause(pat, cond, transNoQueryOps innerComp, patm, sp, trivia)) - - let consumeExpr = - SynExpr.MatchLambda( - false, - trivia.MatchBangKeyword, - clauses, - DebugPointAtBinding.NoneAtInvisible, - trivia.MatchBangKeyword - ) - - let callExpr = - mkSynCall "Bind" trivia.MatchBangKeyword [ inputExpr; consumeExpr ] - |> addBindDebugPoint spMatch - - Some(translatedCtxt callExpr) - - | SynExpr.TryWith(innerComp, clauses, mTryToLast, spTry, spWith, trivia) -> - let mTry = - match spTry with - | DebugPointAtTry.Yes _ -> trivia.TryKeyword.NoteSourceConstruct(NotedSourceConstruct.Try) - | _ -> trivia.TryKeyword - - let spWith2 = - match spWith with - | DebugPointAtWith.Yes _ -> DebugPointAtBinding.Yes trivia.WithKeyword - | _ -> DebugPointAtBinding.NoneAtInvisible - - if isQuery then - error (Error(FSComp.SR.tcTryWithMayNotBeUsedInQueries (), mTry)) - - let clauses = - clauses - |> List.map (fun (SynMatchClause(pat, cond, clauseComp, patm, sp, trivia)) -> - SynMatchClause(pat, cond, transNoQueryOps clauseComp, patm, sp, trivia)) - - let consumeExpr = - SynExpr.MatchLambda(true, mTryToLast, clauses, spWith2, mTryToLast) - - if - isNil ( - TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mTry ad "TryWith" builderTy - ) - then - error (Error(FSComp.SR.tcRequireBuilderMethod ("TryWith"), mTry)) - - if - isNil (TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mTry ad "Delay" builderTy) - then - error (Error(FSComp.SR.tcRequireBuilderMethod ("Delay"), mTry)) - - let innerExpr = transNoQueryOps innerComp - - let innerExpr = - match spTry with - | DebugPointAtTry.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mTry, true, innerExpr) - | _ -> innerExpr - - let callExpr = - mkSynCall "TryWith" mTry [ mkSynCall "Delay" mTry [ mkSynDelay2 innerExpr ]; consumeExpr ] - - Some(translatedCtxt callExpr) - - | SynExpr.YieldOrReturnFrom((true, _), synYieldExpr, m) -> - let yieldFromExpr = mkSourceExpr synYieldExpr - - if - isNil (TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env m ad "YieldFrom" builderTy) - then - error (Error(FSComp.SR.tcRequireBuilderMethod ("YieldFrom"), m)) - - let yieldFromCall = mkSynCall "YieldFrom" m [ yieldFromExpr ] - - let yieldFromCall = - if IsControlFlowExpression synYieldExpr then - yieldFromCall - else - SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes m, false, yieldFromCall) - - Some(translatedCtxt yieldFromCall) - - | SynExpr.YieldOrReturnFrom((false, _), synReturnExpr, m) -> - let returnFromExpr = mkSourceExpr synReturnExpr - - if isQuery then - error (Error(FSComp.SR.tcReturnMayNotBeUsedInQueries (), m)) - - if - isNil ( - TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env m ad "ReturnFrom" builderTy - ) - then - error (Error(FSComp.SR.tcRequireBuilderMethod ("ReturnFrom"), m)) - - let returnFromCall = mkSynCall "ReturnFrom" m [ returnFromExpr ] - - let returnFromCall = - if IsControlFlowExpression synReturnExpr then - returnFromCall - else - SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes m, false, returnFromCall) - - Some(translatedCtxt returnFromCall) - - | SynExpr.YieldOrReturn((isYield, _), synYieldOrReturnExpr, m) -> - let methName = (if isYield then "Yield" else "Return") - - if isQuery && not isYield then - error (Error(FSComp.SR.tcReturnMayNotBeUsedInQueries (), m)) - - if - isNil (TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env m ad methName builderTy) - then - error (Error(FSComp.SR.tcRequireBuilderMethod (methName), m)) - - let yieldOrReturnCall = mkSynCall methName m [ synYieldOrReturnExpr ] - - let yieldOrReturnCall = - if IsControlFlowExpression synYieldOrReturnExpr then - yieldOrReturnCall - else - SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes m, false, yieldOrReturnCall) - - Some(translatedCtxt yieldOrReturnCall) - - | _ -> None - - and consumeCustomOpClauses q (varSpace: LazyWithContext<_, _>) dataCompPrior compClausesExpr lastUsesBind mClause = - - // Substitute 'yield ' into the context - - let patvs, _env = varSpace.Force comp.Range - let varSpaceSimplePat = mkSimplePatForVarSpace mClause patvs - let varSpacePat = mkPatForVarSpace mClause patvs - - match compClausesExpr with - - // Detect one custom operation... This clause will always match at least once... - | OptionalSequential(CustomOperationClause(nm, opDatas, opExpr, mClause, optionalIntoPat), optionalCont) -> - - let opName, _, _, _, _, _, _, _, methInfo = opDatas[0] - let isLikeZip = customOperationIsLikeZip nm - let isLikeJoin = customOperationIsLikeJoin nm - let isLikeGroupJoin = customOperationIsLikeZip nm - - // Record the resolution of the custom operation for posterity - let item = - Item.CustomOperation(opName, (fun () -> customOpUsageText nm), Some methInfo) - - // FUTURE: consider whether we can do better than emptyTyparInst here, in order to display instantiations - // of type variables in the quick info provided in the IDE. - CallNameResolutionSink cenv.tcSink (nm.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, env.eAccessRights) - - if isLikeZip || isLikeJoin || isLikeGroupJoin then - errorR (Error(FSComp.SR.tcBinaryOperatorRequiresBody (nm.idText, Option.get (customOpUsageText nm)), nm.idRange)) - - match optionalCont with - | None -> - // we are about to drop the 'opExpr' AST on the floor. we've already reported an error. attempt to get name resolutions before dropping it - RecordNameAndTypeResolutions cenv env tpenv opExpr - dataCompPrior - | Some contExpr -> consumeCustomOpClauses q varSpace dataCompPrior contExpr lastUsesBind mClause - else - - let maintainsVarSpace = customOperationMaintainsVarSpace nm - let maintainsVarSpaceUsingBind = customOperationMaintainsVarSpaceUsingBind nm - - let expectedArgCount = tryExpectedArgCountForCustomOperator nm - - let dataCompAfterOp = - match opExpr with - | StripApps(SingleIdent nm, args) -> - let argCountsMatch = - match expectedArgCount with - | Some n -> n = args.Length - | None -> cenv.g.langVersion.SupportsFeature LanguageFeature.OverloadsForCustomOperations - - if argCountsMatch then - // Check for the [] attribute on each argument position - let args = - args - |> List.mapi (fun i arg -> - if isCustomOperationProjectionParameter (i + 1) nm then - SynExpr.Lambda( - false, - false, - varSpaceSimplePat, - arg, - None, - arg.Range.MakeSynthetic(), - SynExprLambdaTrivia.Zero - ) - else - arg) - - mkSynCall methInfo.DisplayName mClause (dataCompPrior :: args) - else - let expectedArgCount = defaultArg expectedArgCount 0 - - errorR ( - Error( - FSComp.SR.tcCustomOperationHasIncorrectArgCount (nm.idText, expectedArgCount, args.Length), - nm.idRange - ) - ) - - mkSynCall - methInfo.DisplayName - mClause - ([ dataCompPrior ] - @ List.init expectedArgCount (fun i -> arbExpr ("_arg" + string i, mClause))) - | _ -> failwith "unreachable" - - match optionalCont with - | None -> - match optionalIntoPat with - | Some intoPat -> errorR (Error(FSComp.SR.tcIntoNeedsRestOfQuery (), intoPat.Range)) - | None -> () - - dataCompAfterOp - - | Some contExpr -> - - // select a.Name into name; ... - // distinct into d; ... - // - // Rebind the into pattern and process the rest of the clauses - match optionalIntoPat with - | Some intoPat -> - if not (customOperationAllowsInto nm) then - error (Error(FSComp.SR.tcOperatorDoesntAcceptInto (nm.idText), intoPat.Range)) - - // Rebind using either for ... or let!.... - let rebind = - if maintainsVarSpaceUsingBind then - SynExpr.LetOrUseBang( - DebugPointAtBinding.NoneAtLet, - false, - false, - intoPat, - dataCompAfterOp, - [], - contExpr, - intoPat.Range, - SynExprLetOrUseBangTrivia.Zero - ) - else - SynExpr.ForEach( - DebugPointAtFor.No, - DebugPointAtInOrTo.No, - SeqExprOnly false, - false, - intoPat, - dataCompAfterOp, - contExpr, - intoPat.Range - ) - - trans CompExprTranslationPass.Initial q emptyVarSpace rebind id - - // select a.Name; ... - // distinct; ... - // - // Process the rest of the clauses - | None -> - if maintainsVarSpace || maintainsVarSpaceUsingBind then - consumeCustomOpClauses q varSpace dataCompAfterOp contExpr maintainsVarSpaceUsingBind mClause - else - consumeCustomOpClauses q emptyVarSpace dataCompAfterOp contExpr false mClause - - // No more custom operator clauses in compClausesExpr, but there may be clauses like join, yield etc. - // Bind/iterate the dataCompPrior and use compClausesExpr as the body. - | _ -> - // Rebind using either for ... or let!.... - let rebind = - if lastUsesBind then - SynExpr.LetOrUseBang( - DebugPointAtBinding.NoneAtLet, - false, - false, - varSpacePat, - dataCompPrior, - [], - compClausesExpr, - compClausesExpr.Range, - SynExprLetOrUseBangTrivia.Zero - ) - else - SynExpr.ForEach( - DebugPointAtFor.No, - DebugPointAtInOrTo.No, - SeqExprOnly false, - false, - varSpacePat, - dataCompPrior, - compClausesExpr, - compClausesExpr.Range - ) - - trans CompExprTranslationPass.Initial q varSpace rebind id - - and transNoQueryOps comp = - trans CompExprTranslationPass.Initial CustomOperationsMode.Denied emptyVarSpace comp id - - and trans firstTry q varSpace comp translatedCtxt = - cenv.stackGuard.Guard - <| fun () -> - match tryTrans firstTry q varSpace comp translatedCtxt with - | Some e -> e - | None -> - // This only occurs in final position in a sequence - match comp with - // "do! expr;" in final position is treated as { let! () = expr in return () } when Return is provided (and no Zero with Default attribute is available) or as { let! () = expr in zero } otherwise - | SynExpr.DoBang(rhsExpr, m) -> - let mUnit = rhsExpr.Range - let rhsExpr = mkSourceExpr rhsExpr - - if isQuery then - error (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), m)) - - let bodyExpr = - if - isNil ( - TryFindIntrinsicOrExtensionMethInfo - ResultCollectionSettings.AtMostOneResult - cenv - env - m - ad - "Return" - builderTy - ) - then - SynExpr.ImplicitZero m - else - match - TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env m ad "Zero" builderTy - with - | minfo :: _ when MethInfoHasAttribute cenv.g m cenv.g.attrib_DefaultValueAttribute minfo -> - SynExpr.ImplicitZero m - | _ -> SynExpr.YieldOrReturn((false, true), SynExpr.Const(SynConst.Unit, m), m) - - let letBangBind = - SynExpr.LetOrUseBang( - DebugPointAtBinding.NoneAtDo, - false, - false, - SynPat.Const(SynConst.Unit, mUnit), - rhsExpr, - [], - bodyExpr, - m, - SynExprLetOrUseBangTrivia.Zero - ) - - trans CompExprTranslationPass.Initial q varSpace letBangBind translatedCtxt - - // "expr;" in final position is treated as { expr; zero } - // Suppress the sequence point on the "zero" - | _ -> - // Check for 'where x > y' and other mis-applications of infix operators. If detected, give a good error message, and just ignore comp - if isQuery && checkForBinaryApp comp then - trans CompExprTranslationPass.Initial q varSpace (SynExpr.ImplicitZero comp.Range) translatedCtxt - else - if isQuery && not comp.IsArbExprAndThusAlreadyReportedError then - match comp with - | SynExpr.JoinIn _ -> () // an error will be reported later when we process innerComp1 as a sequential - | _ -> errorR (Error(FSComp.SR.tcUnrecognizedQueryOperator (), comp.RangeOfFirstPortion)) - - trans CompExprTranslationPass.Initial q varSpace (SynExpr.ImplicitZero comp.Range) (fun holeFill -> - let fillExpr = - if enableImplicitYield then - let implicitYieldExpr = mkSynCall "Yield" comp.Range [ comp ] - - SynExpr.SequentialOrImplicitYield( - DebugPointAtSequential.SuppressExpr, - comp, - holeFill, - implicitYieldExpr, - comp.Range - ) - else - SynExpr.Sequential( - DebugPointAtSequential.SuppressExpr, - true, - comp, - holeFill, - comp.Range, - SynExprSequentialTrivia.Zero - ) - - translatedCtxt fillExpr) - - and transBind q varSpace bindRange addBindDebugPoint bindName bindArgs (consumePat: SynPat) (innerComp: SynExpr) translatedCtxt = - - let innerRange = innerComp.Range - - let innerCompReturn = - if cenv.g.langVersion.SupportsFeature LanguageFeature.AndBang then - convertSimpleReturnToExpr varSpace innerComp - else - None - - match innerCompReturn with - | Some(innerExpr, customOpInfo) when - (let bindName = bindName + "Return" - - not ( - isNil ( - TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env bindRange ad bindName builderTy - ) - )) - -> - - let bindName = bindName + "Return" - - // Build the `BindReturn` call - let dataCompPriorToOp = - let consumeExpr = - SynExpr.MatchLambda( - false, - consumePat.Range, - [ - SynMatchClause(consumePat, None, innerExpr, innerRange, DebugPointAtTarget.Yes, SynMatchClauseTrivia.Zero) - ], - DebugPointAtBinding.NoneAtInvisible, - innerRange - ) - - translatedCtxt (mkSynCall bindName bindRange (bindArgs @ [ consumeExpr ])) - - match customOpInfo with - | None -> dataCompPriorToOp - | Some(innerComp, mClause) -> - // If the `BindReturn` was forced by a custom operation, continue to process the clauses of the CustomOp - consumeCustomOpClauses q varSpace dataCompPriorToOp innerComp false mClause - - | _ -> - - if - isNil ( - TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env bindRange ad bindName builderTy - ) - then - error (Error(FSComp.SR.tcRequireBuilderMethod (bindName), bindRange)) - - // Build the `Bind` call - trans CompExprTranslationPass.Initial q varSpace innerComp (fun holeFill -> - let consumeExpr = - SynExpr.MatchLambda( - false, - consumePat.Range, - [ - SynMatchClause(consumePat, None, holeFill, innerRange, DebugPointAtTarget.Yes, SynMatchClauseTrivia.Zero) - ], - DebugPointAtBinding.NoneAtInvisible, - innerRange - ) - - let bindCall = mkSynCall bindName bindRange (bindArgs @ [ consumeExpr ]) - translatedCtxt (bindCall |> addBindDebugPoint)) - - /// This function is for desugaring into .Bind{N}Return calls if possible - /// The outer option indicates if .BindReturn is possible. When it returns None, .BindReturn cannot be used - /// The inner option indicates if a custom operation is involved inside - and convertSimpleReturnToExpr varSpace innerComp = - match innerComp with - | SynExpr.YieldOrReturn((false, _), returnExpr, m) -> - let returnExpr = SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes m, false, returnExpr) - Some(returnExpr, None) - - | SynExpr.Match(spMatch, expr, clauses, m, trivia) -> - let clauses = - clauses - |> List.map (fun (SynMatchClause(pat, cond, innerComp2, patm, sp, trivia)) -> - match convertSimpleReturnToExpr varSpace innerComp2 with - | None -> None // failure - | Some(_, Some _) -> None // custom op on branch = failure - | Some(innerExpr2, None) -> Some(SynMatchClause(pat, cond, innerExpr2, patm, sp, trivia))) - - if clauses |> List.forall Option.isSome then - Some(SynExpr.Match(spMatch, expr, (clauses |> List.map Option.get), m, trivia), None) - else - None - - | SynExpr.IfThenElse(guardExpr, thenComp, elseCompOpt, spIfToThen, isRecovery, mIfToEndOfElseBranch, trivia) -> - match convertSimpleReturnToExpr varSpace thenComp with - | None -> None - | Some(_, Some _) -> None - | Some(thenExpr, None) -> - let elseExprOptOpt = - match elseCompOpt with - // When we are missing an 'else' part alltogether in case of 'if cond then return exp', we fallback from BindReturn into regular Bind+Return - | None -> None - | Some elseComp -> - match convertSimpleReturnToExpr varSpace elseComp with - | None -> None // failure - | Some(_, Some _) -> None // custom op on branch = failure - | Some(elseExpr, None) -> Some(Some elseExpr) - - match elseExprOptOpt with - | None -> None - | Some elseExprOpt -> - Some(SynExpr.IfThenElse(guardExpr, thenExpr, elseExprOpt, spIfToThen, isRecovery, mIfToEndOfElseBranch, trivia), None) - - | SynExpr.LetOrUse(isRec, false, binds, innerComp, m, trivia) -> - match convertSimpleReturnToExpr varSpace innerComp with - | None -> None - | Some(_, Some _) -> None - | Some(innerExpr, None) -> Some(SynExpr.LetOrUse(isRec, false, binds, innerExpr, m, trivia), None) - - | OptionalSequential(CustomOperationClause(nm, _, _, mClause, _), _) when customOperationMaintainsVarSpaceUsingBind nm -> - - let patvs, _env = varSpace.Force comp.Range - let varSpaceExpr = mkExprForVarSpace mClause patvs - - Some(varSpaceExpr, Some(innerComp, mClause)) - - | SynExpr.Sequential(sp, true, innerComp1, innerComp2, m, trivia) -> - - // Check the first part isn't a computation expression construct - if isSimpleExpr innerComp1 then - // Check the second part is a simple return - match convertSimpleReturnToExpr varSpace innerComp2 with - | None -> None - | Some(innerExpr2, optionalCont) -> Some(SynExpr.Sequential(sp, true, innerComp1, innerExpr2, m, trivia), optionalCont) - else - None - - | _ -> None - - /// Check if an expression has no computation expression constructs - and isSimpleExpr comp = - - match comp with - | ForEachThenJoinOrGroupJoinOrZipClause false _ -> false - | SynExpr.ForEach _ -> false - | SynExpr.For _ -> false - | SynExpr.While _ -> false - | SynExpr.WhileBang _ -> false - | SynExpr.TryFinally _ -> false - | SynExpr.ImplicitZero _ -> false - | OptionalSequential(JoinOrGroupJoinOrZipClause _, _) -> false - | OptionalSequential(CustomOperationClause _, _) -> false - | SynExpr.Sequential(expr1 = innerComp1; expr2 = innerComp2) -> isSimpleExpr innerComp1 && isSimpleExpr innerComp2 - | SynExpr.IfThenElse(thenExpr = thenComp; elseExpr = elseCompOpt) -> - isSimpleExpr thenComp - && (match elseCompOpt with - | None -> true - | Some c -> isSimpleExpr c) - | SynExpr.LetOrUse(body = innerComp) -> isSimpleExpr innerComp - | SynExpr.LetOrUseBang _ -> false - | SynExpr.Match(clauses = clauses) -> - clauses - |> List.forall (fun (SynMatchClause(resultExpr = innerComp)) -> isSimpleExpr innerComp) - | SynExpr.MatchBang _ -> false - | SynExpr.TryWith(tryExpr = innerComp; withCases = clauses) -> - isSimpleExpr innerComp - && clauses - |> List.forall (fun (SynMatchClause(resultExpr = clauseComp)) -> isSimpleExpr clauseComp) - | SynExpr.YieldOrReturnFrom _ -> false - | SynExpr.YieldOrReturn _ -> false - | SynExpr.DoBang _ -> false - | _ -> true - - let basicSynExpr = - trans CompExprTranslationPass.Initial (hasCustomOperations ()) (LazyWithContext.NotLazy([], env)) comp id - - let mDelayOrQuoteOrRun = - mBuilderVal - .NoteSourceConstruct(NotedSourceConstruct.DelayOrQuoteOrRun) - .MakeSynthetic() - - // Add a call to 'Delay' if the method is present - let delayedExpr = - match TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBuilderVal ad "Delay" builderTy with - | [] -> basicSynExpr - | _ -> mkSynCall "Delay" mDelayOrQuoteOrRun [ (mkSynDelay2 basicSynExpr) ] - - // Add a call to 'Quote' if the method is present - let quotedSynExpr = - if isAutoQuote then - SynExpr.Quote(mkSynIdGet mDelayOrQuoteOrRun (CompileOpName "<@ @>"), false, delayedExpr, true, mWhole) - else - delayedExpr - - // Add a call to 'Run' if the method is present - let runExpr = - match TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBuilderVal ad "Run" builderTy with - | [] -> quotedSynExpr - | _ -> mkSynCall "Run" mDelayOrQuoteOrRun [ quotedSynExpr ] - - let lambdaExpr = - SynExpr.Lambda( - false, - false, - SynSimplePats.SimplePats([ mkSynSimplePatVar false (mkSynId mBuilderVal builderValName) ], [], mBuilderVal), - runExpr, - None, - mBuilderVal, - SynExprLambdaTrivia.Zero - ) - - let env = - match comp with - | SynExpr.YieldOrReturn(flags = (true, _)) -> - { env with - eContextInfo = ContextInfo.YieldInComputationExpression - } - | SynExpr.YieldOrReturn(flags = (_, true)) -> - { env with - eContextInfo = ContextInfo.ReturnInComputationExpression - } - | _ -> env - - let lambdaExpr, tpenv = - TcExpr cenv (MustEqual(mkFunTy g builderTy overallTy)) env tpenv lambdaExpr - - // beta-var-reduce to bind the builder using a 'let' binding - let coreExpr = - mkApps cenv.g ((lambdaExpr, tyOfExpr cenv.g lambdaExpr), [], [ interpExpr ], mBuilderVal) - - coreExpr, tpenv - -let mkSeqEmpty (cenv: cenv) env m genTy = - // We must discover the 'zero' of the monadic algebra being generated in order to compile failing matches. - let g = cenv.g - let genResultTy = NewInferenceType g - UnifyTypes cenv env m genTy (mkSeqTy g genResultTy) - mkCallSeqEmpty g m genResultTy - -let mkSeqCollect (cenv: cenv) env m enumElemTy genTy lam enumExpr = - let g = cenv.g - let genResultTy = NewInferenceType g - UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) - - let enumExpr = - mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g enumElemTy) (tyOfExpr cenv.g enumExpr) enumExpr - - mkCallSeqCollect cenv.g m enumElemTy genResultTy lam enumExpr - -let mkSeqUsing (cenv: cenv) (env: TcEnv) m resourceTy genTy resourceExpr lam = - let g = cenv.g - AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css m NoTrace cenv.g.system_IDisposable_ty resourceTy - let genResultTy = NewInferenceType g - UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) - mkCallSeqUsing cenv.g m resourceTy genResultTy resourceExpr lam - -let mkSeqDelay (cenv: cenv) env m genTy lam = - let g = cenv.g - let genResultTy = NewInferenceType g - UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) - mkCallSeqDelay cenv.g m genResultTy (mkUnitDelayLambda cenv.g m lam) - -let mkSeqAppend (cenv: cenv) env m genTy e1 e2 = - let g = cenv.g - let genResultTy = NewInferenceType g - UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) - - let e1 = - mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g genResultTy) (tyOfExpr cenv.g e1) e1 - - let e2 = - mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g genResultTy) (tyOfExpr cenv.g e2) e2 - - mkCallSeqAppend cenv.g m genResultTy e1 e2 - -let mkSeqFromFunctions (cenv: cenv) env m genTy e1 e2 = - let g = cenv.g - let genResultTy = NewInferenceType g - UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) - - let e2 = - mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g genResultTy) (tyOfExpr cenv.g e2) e2 - - mkCallSeqGenerated cenv.g m genResultTy e1 e2 - -let mkSeqFinally (cenv: cenv) env m genTy e1 e2 = - let g = cenv.g - let genResultTy = NewInferenceType g - UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) - - let e1 = - mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g genResultTy) (tyOfExpr cenv.g e1) e1 - - mkCallSeqFinally cenv.g m genResultTy e1 e2 - -let mkSeqTryWith (cenv: cenv) env m genTy origSeq exnFilter exnHandler = - let g = cenv.g - let genResultTy = NewInferenceType g - UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) - - let origSeq = - mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g genResultTy) (tyOfExpr cenv.g origSeq) origSeq - - mkCallSeqTryWith cenv.g m genResultTy origSeq exnFilter exnHandler - -let mkSeqExprMatchClauses (pat, vspecs) innerExpr = - [ MatchClause(pat, None, TTarget(vspecs, innerExpr, None), pat.Range) ] - -let compileSeqExprMatchClauses (cenv: cenv) env inputExprMark (pat: Pattern, vspecs) innerExpr inputExprOpt bindPatTy genInnerTy = - let patMark = pat.Range - let tclauses = mkSeqExprMatchClauses (pat, vspecs) innerExpr - - CompilePatternForMatchClauses - cenv - env - inputExprMark - patMark - false - ThrowIncompleteMatchException - inputExprOpt - bindPatTy - genInnerTy - tclauses - -/// This case is used for computation expressions which are sequence expressions. Technically the code path is different because it -/// typechecks rather than doing a shallow syntactic translation, and generates calls into the Seq.* library -/// and helpers rather than to the builder methods (there is actually no builder for 'seq' in the library). -/// These are later detected by state machine compilation. -/// -/// Also "ienumerable extraction" is performed on arguments to "for". -let TcSequenceExpression (cenv: cenv) env tpenv comp (overallTy: OverallTy) m = - - let g = cenv.g - let genEnumElemTy = NewInferenceType g - UnifyTypes cenv env m overallTy.Commit (mkSeqTy cenv.g genEnumElemTy) - - // Allow subsumption at 'yield' if the element type is nominal prior to the analysis of the body of the sequence expression - let flex = not (isTyparTy cenv.g genEnumElemTy) - - // If there are no 'yield' in the computation expression then allow the type-directed rule - // interpreting non-unit-typed expressions in statement positions as 'yield'. 'yield!' may be - // present in the computation expression. - let enableImplicitYield = - cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield - && (YieldFree cenv comp) - - let mkSeqDelayedExpr m (coreExpr: Expr) = - let overallTy = tyOfExpr cenv.g coreExpr - mkSeqDelay cenv env m overallTy coreExpr - - let rec tryTcSequenceExprBody env genOuterTy tpenv comp = - match comp with - | SynExpr.ForEach(spFor, spIn, SeqExprOnly _seqExprOnly, _isFromSource, pat, pseudoEnumExpr, innerComp, _m) -> - let pseudoEnumExpr = - match RewriteRangeExpr pseudoEnumExpr with - | Some e -> e - | None -> pseudoEnumExpr - // This expression is not checked with the knowledge it is an IEnumerable, since we permit other enumerable types with GetEnumerator/MoveNext methods, as does C# - let pseudoEnumExpr, arbitraryTy, tpenv = - TcExprOfUnknownType cenv env tpenv pseudoEnumExpr - - let enumExpr, enumElemTy = - ConvertArbitraryExprToEnumerable cenv arbitraryTy env pseudoEnumExpr - - let patR, _, vspecs, envinner, tpenv = - TcMatchPattern cenv enumElemTy env tpenv pat None - - let innerExpr, tpenv = - let envinner = { envinner with eIsControlFlow = true } - tcSequenceExprBody envinner genOuterTy tpenv innerComp - - let enumExprRange = enumExpr.Range - - // We attach the debug point to the lambda expression so we can fetch it out again in LowerComputedListOrArraySeqExpr - let mFor = - match spFor with - | DebugPointAtFor.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.For) - | _ -> enumExprRange - - // We attach the debug point to the lambda expression so we can fetch it out again in LowerComputedListOrArraySeqExpr - let mIn = - match spIn with - | DebugPointAtInOrTo.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.InOrTo) - | _ -> pat.Range - - match patR, vspecs, innerExpr with - // Legacy peephole optimization: - // "seq { .. for x in e1 -> e2 .. }" == "e1 |> Seq.map (fun x -> e2)" - // "seq { .. for x in e1 do yield e2 .. }" == "e1 |> Seq.map (fun x -> e2)" - // - // This transformation is visible in quotations and thus needs to remain. - | (TPat_as(TPat_wild _, PatternValBinding(v, _), _), - [ _ ], - DebugPoints(Expr.App(Expr.Val(vref, _, _), _, [ genEnumElemTy ], [ yieldExpr ], _mYield), recreate)) when - valRefEq cenv.g vref cenv.g.seq_singleton_vref - -> - - // The debug point mFor is attached to the 'map' - // The debug point mIn is attached to the lambda - // Note: the 'yield' part of the debug point for 'yield expr' is currently lost in debug points. - let lam = mkLambda mIn v (recreate yieldExpr, genEnumElemTy) - - let enumExpr = - mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g enumElemTy) (tyOfExpr cenv.g enumExpr) enumExpr - - Some(mkCallSeqMap cenv.g mFor enumElemTy genEnumElemTy lam enumExpr, tpenv) - - | _ -> - // The debug point mFor is attached to the 'collect' - // The debug point mIn is attached to the lambda - let matchv, matchExpr = - compileSeqExprMatchClauses cenv env enumExprRange (patR, vspecs) innerExpr None enumElemTy genOuterTy - - let lam = mkLambda mIn matchv (matchExpr, tyOfExpr cenv.g matchExpr) - Some(mkSeqCollect cenv env mFor enumElemTy genOuterTy lam enumExpr, tpenv) - - | SynExpr.For( - forDebugPoint = spFor - toDebugPoint = spTo - ident = id - identBody = start - direction = dir - toBody = finish - doBody = innerComp - range = m) -> - Some(tcSequenceExprBody env genOuterTy tpenv (elimFastIntegerForLoop (spFor, spTo, id, start, dir, finish, innerComp, m))) - - | SynExpr.While(spWhile, guardExpr, innerComp, _m) -> - let guardExpr, tpenv = - let env = { env with eIsControlFlow = false } - TcExpr cenv (MustEqual cenv.g.bool_ty) env tpenv guardExpr - - let innerExpr, tpenv = - let env = { env with eIsControlFlow = true } - tcSequenceExprBody env genOuterTy tpenv innerComp - - let guardExprMark = guardExpr.Range - let guardLambdaExpr = mkUnitDelayLambda cenv.g guardExprMark guardExpr - - // We attach the debug point to the lambda expression so we can fetch it out again in LowerComputedListOrArraySeqExpr - let mWhile = - match spWhile with - | DebugPointAtWhile.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.While) - | _ -> guardExprMark - - let innerDelayedExpr = mkSeqDelayedExpr mWhile innerExpr - Some(mkSeqFromFunctions cenv env guardExprMark genOuterTy guardLambdaExpr innerDelayedExpr, tpenv) - - | SynExpr.TryFinally(innerComp, unwindExpr, mTryToLast, spTry, spFinally, trivia) -> - let env = { env with eIsControlFlow = true } - let innerExpr, tpenv = tcSequenceExprBody env genOuterTy tpenv innerComp - let unwindExpr, tpenv = TcExpr cenv (MustEqual cenv.g.unit_ty) env tpenv unwindExpr - - // We attach the debug points to the lambda expressions so we can fetch it out again in LowerComputedListOrArraySeqExpr - let mTry = - match spTry with - | DebugPointAtTry.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.Try) - | _ -> trivia.TryKeyword - - let mFinally = - match spFinally with - | DebugPointAtFinally.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.Finally) - | _ -> trivia.FinallyKeyword - - let innerExpr = mkSeqDelayedExpr mTry innerExpr - let unwindExpr = mkUnitDelayLambda cenv.g mFinally unwindExpr - - Some(mkSeqFinally cenv env mTryToLast genOuterTy innerExpr unwindExpr, tpenv) - - | SynExpr.Paren(range = m) when not (cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield) -> - error (Error(FSComp.SR.tcConstructIsAmbiguousInSequenceExpression (), m)) - - | SynExpr.ImplicitZero m -> Some(mkSeqEmpty cenv env m genOuterTy, tpenv) - - | SynExpr.DoBang(_rhsExpr, m) -> error (Error(FSComp.SR.tcDoBangIllegalInSequenceExpression (), m)) - - | SynExpr.Sequential(sp, true, innerComp1, innerComp2, m, _) -> - let env1 = - { env with - eIsControlFlow = - (match sp with - | DebugPointAtSequential.SuppressNeither - | DebugPointAtSequential.SuppressExpr -> true - | _ -> false) - } - - let res, tpenv = - tcSequenceExprBodyAsSequenceOrStatement env1 genOuterTy tpenv innerComp1 - - let env2 = - { env with - eIsControlFlow = - (match sp with - | DebugPointAtSequential.SuppressNeither - | DebugPointAtSequential.SuppressStmt -> true - | _ -> false) - } - - // "expr; cexpr" is treated as sequential execution - // "cexpr; cexpr" is treated as append - match res with - | Choice1Of2 innerExpr1 -> - let innerExpr2, tpenv = tcSequenceExprBody env2 genOuterTy tpenv innerComp2 - let innerExpr2 = mkSeqDelayedExpr innerExpr2.Range innerExpr2 - Some(mkSeqAppend cenv env innerComp1.Range genOuterTy innerExpr1 innerExpr2, tpenv) - | Choice2Of2 stmt1 -> - let innerExpr2, tpenv = tcSequenceExprBody env2 genOuterTy tpenv innerComp2 - Some(Expr.Sequential(stmt1, innerExpr2, NormalSeq, m), tpenv) - - | SynExpr.IfThenElse(guardExpr, thenComp, elseCompOpt, spIfToThen, _isRecovery, mIfToEndOfElseBranch, trivia) -> - let guardExpr', tpenv = TcExpr cenv (MustEqual cenv.g.bool_ty) env tpenv guardExpr - let env = { env with eIsControlFlow = true } - let thenExpr, tpenv = tcSequenceExprBody env genOuterTy tpenv thenComp - - let elseComp = - (match elseCompOpt with - | Some c -> c - | None -> SynExpr.ImplicitZero trivia.IfToThenRange) - - let elseExpr, tpenv = tcSequenceExprBody env genOuterTy tpenv elseComp - Some(mkCond spIfToThen mIfToEndOfElseBranch genOuterTy guardExpr' thenExpr elseExpr, tpenv) - - // 'let x = expr in expr' - | SynExpr.LetOrUse(isUse = false) -> - TcLinearExprs - (fun overallTy envinner tpenv e -> tcSequenceExprBody envinner overallTy.Commit tpenv e) - cenv - env - overallTy - tpenv - true - comp - id - |> Some - - // 'use x = expr in expr' - | SynExpr.LetOrUse( - isUse = true - bindings = [ SynBinding(kind = SynBindingKind.Normal; headPat = pat; expr = rhsExpr; debugPoint = spBind) ] - body = innerComp - range = wholeExprMark) -> - - let bindPatTy = NewInferenceType g - let inputExprTy = NewInferenceType g - - let pat', _, vspecs, envinner, tpenv = - TcMatchPattern cenv bindPatTy env tpenv pat None - - UnifyTypes cenv env m inputExprTy bindPatTy - - let inputExpr, tpenv = - let env = { env with eIsControlFlow = true } - TcExpr cenv (MustEqual inputExprTy) env tpenv rhsExpr - - let innerExpr, tpenv = - let envinner = { envinner with eIsControlFlow = true } - tcSequenceExprBody envinner genOuterTy tpenv innerComp - - let mBind = - match spBind with - | DebugPointAtBinding.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.Binding) - | _ -> inputExpr.Range - - let inputExprMark = inputExpr.Range - - let matchv, matchExpr = - compileSeqExprMatchClauses cenv envinner inputExprMark (pat', vspecs) innerExpr (Some inputExpr) bindPatTy genOuterTy - - let consumeExpr = mkLambda mBind matchv (matchExpr, genOuterTy) - - // The 'mBind' is attached to the lambda - Some(mkSeqUsing cenv env wholeExprMark bindPatTy genOuterTy inputExpr consumeExpr, tpenv) - - | SynExpr.LetOrUseBang(range = m) -> error (Error(FSComp.SR.tcUseForInSequenceExpression (), m)) - - | SynExpr.Match(spMatch, expr, clauses, _m, _trivia) -> - let inputExpr, inputTy, tpenv = TcExprOfUnknownType cenv env tpenv expr - - let tclauses, tpenv = - (tpenv, clauses) - ||> List.mapFold (fun tpenv (SynMatchClause(pat, cond, innerComp, _, sp, _)) -> - let patR, condR, vspecs, envinner, tpenv = - TcMatchPattern cenv inputTy env tpenv pat cond - - let envinner = - match sp with - | DebugPointAtTarget.Yes -> { envinner with eIsControlFlow = true } - | DebugPointAtTarget.No -> envinner - - let innerExpr, tpenv = tcSequenceExprBody envinner genOuterTy tpenv innerComp - MatchClause(patR, condR, TTarget(vspecs, innerExpr, None), patR.Range), tpenv) - - let inputExprTy = tyOfExpr cenv.g inputExpr - let inputExprMark = inputExpr.Range - - let matchv, matchExpr = - CompilePatternForMatchClauses - cenv - env - inputExprMark - inputExprMark - true - ThrowIncompleteMatchException - (Some inputExpr) - inputExprTy - genOuterTy - tclauses - - Some(mkLet spMatch inputExprMark matchv inputExpr matchExpr, tpenv) - - | SynExpr.TryWith(innerTry, withList, mTryToWith, _spTry, _spWith, trivia) -> - if not (g.langVersion.SupportsFeature(LanguageFeature.TryWithInSeqExpression)) then - error (Error(FSComp.SR.tcTryIllegalInSequenceExpression (), mTryToWith)) - - let env = { env with eIsControlFlow = true } - - let tryExpr, tpenv = - let inner, tpenv = tcSequenceExprBody env genOuterTy tpenv innerTry - mkSeqDelayedExpr mTryToWith inner, tpenv - - // Compile the pattern twice, once as a filter with all succeeding targets returning "1", and once as a proper catch block. - let clauses, tpenv = - (tpenv, withList) - ||> List.mapFold (fun tpenv (SynMatchClause(pat, cond, innerComp, m, sp, _)) -> - let patR, condR, vspecs, envinner, tpenv = - TcMatchPattern cenv g.exn_ty env tpenv pat cond - - let envinner = - match sp with - | DebugPointAtTarget.Yes -> { envinner with eIsControlFlow = true } - | DebugPointAtTarget.No -> envinner - - let matchBody, tpenv = tcSequenceExprBody envinner genOuterTy tpenv innerComp - - let handlerClause = - MatchClause(patR, condR, TTarget(vspecs, matchBody, None), patR.Range) - - let filterClause = - MatchClause(patR, condR, TTarget([], Expr.Const(Const.Int32 1, m, g.int_ty), None), patR.Range) - - (handlerClause, filterClause), tpenv) - - let handlers, filterClauses = List.unzip clauses - let withRange = trivia.WithToEndRange - - let v1, filterExpr = - CompilePatternForMatchClauses cenv env withRange withRange true FailFilter None g.exn_ty g.int_ty filterClauses - - let v2, handlerExpr = - CompilePatternForMatchClauses cenv env withRange withRange true FailFilter None g.exn_ty genOuterTy handlers - - let filterLambda = mkLambda filterExpr.Range v1 (filterExpr, genOuterTy) - let handlerLambda = mkLambda handlerExpr.Range v2 (handlerExpr, genOuterTy) - - let combinatorExpr = - mkSeqTryWith cenv env mTryToWith genOuterTy tryExpr filterLambda handlerLambda - - Some(combinatorExpr, tpenv) - - | SynExpr.YieldOrReturnFrom((isYield, _), synYieldExpr, m) -> - let env = { env with eIsControlFlow = false } - let resultExpr, genExprTy, tpenv = TcExprOfUnknownType cenv env tpenv synYieldExpr - - if not isYield then - errorR (Error(FSComp.SR.tcUseYieldBangForMultipleResults (), m)) - - AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css m NoTrace genOuterTy genExprTy - - let resultExpr = mkCoerceExpr (resultExpr, genOuterTy, m, genExprTy) - - let resultExpr = - if IsControlFlowExpression synYieldExpr then - resultExpr - else - mkDebugPoint m resultExpr - - Some(resultExpr, tpenv) - - | SynExpr.YieldOrReturn((isYield, _), synYieldExpr, m) -> - let env = { env with eIsControlFlow = false } - let genResultTy = NewInferenceType g - - if not isYield then - errorR (Error(FSComp.SR.tcSeqResultsUseYield (), m)) - - UnifyTypes cenv env m genOuterTy (mkSeqTy cenv.g genResultTy) - - let resultExpr, tpenv = TcExprFlex cenv flex true genResultTy env tpenv synYieldExpr - - let resultExpr = mkCallSeqSingleton cenv.g m genResultTy resultExpr - - let resultExpr = - if IsControlFlowExpression synYieldExpr then - resultExpr - else - mkDebugPoint m resultExpr - - Some(resultExpr, tpenv) - - | _ -> None - - and tcSequenceExprBody env (genOuterTy: TType) tpenv comp = - let res, tpenv = tcSequenceExprBodyAsSequenceOrStatement env genOuterTy tpenv comp - - match res with - | Choice1Of2 expr -> expr, tpenv - | Choice2Of2 stmt -> - let m = comp.Range - let resExpr = Expr.Sequential(stmt, mkSeqEmpty cenv env m genOuterTy, NormalSeq, m) - resExpr, tpenv - - and tcSequenceExprBodyAsSequenceOrStatement env genOuterTy tpenv comp = - match tryTcSequenceExprBody env genOuterTy tpenv comp with - | Some(expr, tpenv) -> Choice1Of2 expr, tpenv - | None -> - - let env = - { env with - eContextInfo = ContextInfo.SequenceExpression genOuterTy - } - - if enableImplicitYield then - let hasTypeUnit, _ty, expr, tpenv = TryTcStmt cenv env tpenv comp - - if hasTypeUnit then - Choice2Of2 expr, tpenv - else - let genResultTy = NewInferenceType g - let mExpr = expr.Range - UnifyTypes cenv env mExpr genOuterTy (mkSeqTy cenv.g genResultTy) - let expr, tpenv = TcExprFlex cenv flex true genResultTy env tpenv comp - let exprTy = tyOfExpr cenv.g expr - AddCxTypeMustSubsumeType env.eContextInfo env.DisplayEnv cenv.css mExpr NoTrace genResultTy exprTy - - let resExpr = - mkCallSeqSingleton cenv.g mExpr genResultTy (mkCoerceExpr (expr, genResultTy, mExpr, exprTy)) - - Choice1Of2 resExpr, tpenv - else - let stmt, tpenv = TcStmtThatCantBeCtorBody cenv env tpenv comp - Choice2Of2 stmt, tpenv - - let coreExpr, tpenv = tcSequenceExprBody env overallTy.Commit tpenv comp - let delayedExpr = mkSeqDelayedExpr coreExpr.Range coreExpr - delayedExpr, tpenv - -let TcSequenceExpressionEntry (cenv: cenv) env (overallTy: OverallTy) tpenv (hasBuilder, comp) m = - match RewriteRangeExpr comp with - | Some replacementExpr -> TcExpr cenv overallTy env tpenv replacementExpr - | None -> - - let implicitYieldEnabled = - cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield - - let validateObjectSequenceOrRecordExpression = not implicitYieldEnabled - - match comp with - | SynExpr.New _ -> - try - TcExprUndelayed cenv overallTy env tpenv comp |> ignore - with RecoverableException e -> - errorRecovery e m - - errorR (Error(FSComp.SR.tcInvalidObjectExpressionSyntaxForm (), m)) - | SimpleSemicolonSequence cenv false _ when validateObjectSequenceOrRecordExpression -> - errorR (Error(FSComp.SR.tcInvalidObjectSequenceOrRecordExpression (), m)) - | _ -> () - - if not hasBuilder && not cenv.g.compilingFSharpCore then - error (Error(FSComp.SR.tcInvalidSequenceExpressionSyntaxForm (), m)) - - TcSequenceExpression cenv env tpenv comp overallTy m - -let TcArrayOrListComputedExpression (cenv: cenv) env (overallTy: OverallTy) tpenv (isArray, comp) m = - let g = cenv.g - - // The syntax '[ n .. m ]' and '[ n .. step .. m ]' is not really part of array or list syntax. - // It could be in the future, e.g. '[ 1; 2..30; 400 ]' - // - // The elaborated form of '[ n .. m ]' is 'List.ofSeq (seq (op_Range n m))' and this shouldn't change - match RewriteRangeExpr comp with - | Some replacementExpr -> - let genCollElemTy = NewInferenceType g - - let genCollTy = (if isArray then mkArrayType else mkListTy) cenv.g genCollElemTy - - UnifyTypes cenv env m overallTy.Commit genCollTy - - let exprTy = mkSeqTy cenv.g genCollElemTy - - let expr, tpenv = TcExpr cenv (MustEqual exprTy) env tpenv replacementExpr - - let expr = - if cenv.g.compilingFSharpCore then - expr - else - // We add a call to 'seq ... ' to make sure sequence expression compilation gets applied to the contents of the - // comprehension. But don't do this in FSharp.Core.dll since 'seq' may not yet be defined. - mkCallSeq cenv.g m genCollElemTy expr - - let expr = mkCoerceExpr (expr, exprTy, expr.Range, overallTy.Commit) - - let expr = - if isArray then - mkCallSeqToArray cenv.g m genCollElemTy expr - else - mkCallSeqToList cenv.g m genCollElemTy expr - - expr, tpenv - - | None -> - - // LanguageFeatures.ImplicitYield do not require this validation - let implicitYieldEnabled = - cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield - - let validateExpressionWithIfRequiresParenthesis = not implicitYieldEnabled - let acceptDeprecatedIfThenExpression = not implicitYieldEnabled - - match comp with - | SimpleSemicolonSequence cenv acceptDeprecatedIfThenExpression elems -> - match comp with - | SimpleSemicolonSequence cenv false _ -> () - | _ when validateExpressionWithIfRequiresParenthesis -> - errorR (Deprecated(FSComp.SR.tcExpressionWithIfRequiresParenthesis (), m)) - | _ -> () - - let replacementExpr = - if isArray then - // This are to improve parsing/processing speed for parser tables by converting to an array blob ASAP - let nelems = elems.Length - - if - nelems > 0 - && List.forall - (function - | SynExpr.Const(SynConst.UInt16 _, _) -> true - | _ -> false) - elems - then - SynExpr.Const( - SynConst.UInt16s( - Array.ofList ( - List.map - (function - | SynExpr.Const(SynConst.UInt16 x, _) -> x - | _ -> failwith "unreachable") - elems - ) - ), - m - ) - elif - nelems > 0 - && List.forall - (function - | SynExpr.Const(SynConst.Byte _, _) -> true - | _ -> false) - elems - then - SynExpr.Const( - SynConst.Bytes( - Array.ofList ( - List.map - (function - | SynExpr.Const(SynConst.Byte x, _) -> x - | _ -> failwith "unreachable") - elems - ), - SynByteStringKind.Regular, - m - ), - m - ) - else - SynExpr.ArrayOrList(isArray, elems, m) - else if cenv.g.langVersion.SupportsFeature(LanguageFeature.ReallyLongLists) then - SynExpr.ArrayOrList(isArray, elems, m) - else - if elems.Length > 500 then - error (Error(FSComp.SR.tcListLiteralMaxSize (), m)) - - SynExpr.ArrayOrList(isArray, elems, m) - - TcExprUndelayed cenv overallTy env tpenv replacementExpr - | _ -> - - let genCollElemTy = NewInferenceType g - - let genCollTy = (if isArray then mkArrayType else mkListTy) cenv.g genCollElemTy - - // Propagating type directed conversion, e.g. for - // let x : seq = [ yield 1; if true then yield 2 ] - TcPropagatingExprLeafThenConvert cenv overallTy genCollTy env (* canAdhoc *) m (fun () -> - - let exprTy = mkSeqTy cenv.g genCollElemTy - - // Check the comprehension - let expr, tpenv = TcSequenceExpression cenv env tpenv comp (MustEqual exprTy) m - - let expr = mkCoerceIfNeeded cenv.g exprTy (tyOfExpr cenv.g expr) expr - - let expr = - if cenv.g.compilingFSharpCore then - //warning(Error(FSComp.SR.fslibUsingComputedListOrArray(), expr.Range)) - expr - else - // We add a call to 'seq ... ' to make sure sequence expression compilation gets applied to the contents of the - // comprehension. But don't do this in FSharp.Core.dll since 'seq' may not yet be defined. - mkCallSeq cenv.g m genCollElemTy expr - - let expr = mkCoerceExpr (expr, exprTy, expr.Range, overallTy.Commit) - - let expr = - if isArray then - mkCallSeqToArray cenv.g m genCollElemTy expr - else - mkCallSeqToList cenv.g m genCollElemTy expr - - expr, tpenv) diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index be083e74871..e739169ea9c 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -11,13 +11,16 @@ open Internal.Utilities.Collections open Internal.Utilities.Library open Internal.Utilities.Library.Extras open Internal.Utilities.Library.ResultOrException -open FSharp.Compiler -open FSharp.Compiler.AbstractIL.IL +open FSharp.Compiler +open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AccessibilityLogic open FSharp.Compiler.AttributeChecking open FSharp.Compiler.CheckComputationExpressions open FSharp.Compiler.CheckExpressions +open FSharp.Compiler.CheckSequenceExpressions +open FSharp.Compiler.CheckArrayOrListComputedExpressions open FSharp.Compiler.CheckBasics +open FSharp.Compiler.CheckExpressionsOps open FSharp.Compiler.CheckIncrementalClasses open FSharp.Compiler.CheckPatterns open FSharp.Compiler.ConstraintSolver @@ -279,7 +282,7 @@ let AddModuleAbbreviationAndReport tcSink scopem id modrefs env = CallEnvSink tcSink (scopem, env.NameEnv, env.eAccessRights) let item = Item.ModuleOrNamespaces modrefs - CallNameResolutionSink tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, env.AccessRights) + CallNameResolutionSink tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, env.AccessRights) env /// Adjust the TcEnv to account for opening the set of modules or namespaces implied by an `open` declaration @@ -401,7 +404,7 @@ let private CheckDuplicatesArgNames (synVal: SynValSig) m = for name in argNames do errorR(Error((FSComp.SR.chkDuplicatedMethodParameter(name), m))) -let private CheckDuplicatesAbstractMethodParmsSig (typeSpecs: SynTypeDefnSig list) = +let private CheckDuplicatesAbstractMethodParamsSig (typeSpecs: SynTypeDefnSig list) = for SynTypeDefnSig(typeRepr= trepr) in typeSpecs do match trepr with | SynTypeDefnSigRepr.ObjectModel(_, synMemberSigs, _) -> @@ -413,6 +416,7 @@ let private CheckDuplicatesAbstractMethodParmsSig (typeSpecs: SynTypeDefnSig li | _ -> () module TcRecdUnionAndEnumDeclarations = + open CheckExpressionsOps let CombineReprAccess parent vis = match parent with @@ -427,11 +431,12 @@ module TcRecdUnionAndEnumDeclarations = let TcFieldDecl (cenv: cenv) env parent isIncrClass tpenv (isStatic, synAttrs, id: Ident, nameGenerated, ty, isMutable, xmldoc, vis) = let g = cenv.g let m = id.idRange - let attrs, _ = TcAttributesWithPossibleTargets false cenv env AttributeTargets.FieldDecl synAttrs + let attrs, _ = TcAttributesWithPossibleTargets TcCanFail.ReportAllErrors cenv env AttributeTargets.FieldDecl synAttrs + let attrsForProperty, attrsForField = attrs |> List.partition (fun (attrTargets, _) -> (attrTargets &&& AttributeTargets.Property) <> enum 0) let attrsForProperty = (List.map snd attrsForProperty) let attrsForField = (List.map snd attrsForField) - let tyR, _ = TcTypeAndRecover cenv NoNewTypars CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv ty + let tyR, _ = TcTypeAndRecover cenv NoNewTypars CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv ty let zeroInit = HasFSharpAttribute g g.attrib_DefaultValueAttribute attrsForField let isVolatile = HasFSharpAttribute g g.attrib_VolatileFieldAttribute attrsForField @@ -450,7 +455,7 @@ module TcRecdUnionAndEnumDeclarations = match parent with | Parent tcref when useGenuineField tcref.Deref rfspec -> // Recheck the attributes for errors if the definition only generates a field - TcAttributesWithPossibleTargets false cenv env AttributeTargets.FieldDeclRestricted synAttrs |> ignore + TcAttributesWithPossibleTargets TcCanFail.ReportAllErrors cenv env AttributeTargets.FieldDeclRestricted synAttrs |> ignore | _ -> () rfspec @@ -495,18 +500,26 @@ module TcRecdUnionAndEnumDeclarations = if not (String.isLeadingIdentifierCharacterUpperCase name) && name <> opNameCons && name <> opNameNil then errorR(NotUpperCaseConstructor(id.idRange)) - let ValidateFieldNames (synFields: SynField list, tastFields: RecdField list) = + let private CheckUnionDuplicateFields (elems: Ident list) = + elems |> List.iteri (fun i (uc1: Ident) -> + elems |> List.iteri (fun j (uc2: Ident) -> + if j > i && uc1.idText = uc2.idText then + errorR(Error(FSComp.SR.tcFieldNameIsUsedModeThanOnce(uc1.idText), uc1.idRange)))) + + let ValidateFieldNames (synFields: SynField list, tastFields: RecdField list) = + let fields = synFields |> List.choose (function SynField(idOpt = Some ident) -> Some ident | _ -> None) + if fields.Length > 1 then + CheckUnionDuplicateFields fields + let seen = Dictionary() (synFields, tastFields) ||> List.iter2 (fun sf f -> match seen.TryGetValue f.LogicalName with | true, synField -> match sf, synField with - | SynField(idOpt = Some id), SynField(idOpt = Some _) -> - error(Error(FSComp.SR.tcFieldNameIsUsedModeThanOnce(id.idText), id.idRange)) | SynField(idOpt = Some id), SynField(idOpt = None) | SynField(idOpt = None), SynField(idOpt = Some id) -> - error(Error(FSComp.SR.tcFieldNameConflictsWithGeneratedNameForAnonymousField(id.idText), id.idRange)) - | _ -> assert false + errorR(Error(FSComp.SR.tcFieldNameConflictsWithGeneratedNameForAnonymousField(id.idText), id.idRange)) + | _ -> () | _ -> seen.Add(f.LogicalName, sf)) @@ -527,7 +540,7 @@ module TcRecdUnionAndEnumDeclarations = match idOpt, parent with | Some fieldId, Parent tcref -> let item = Item.UnionCaseField (UnionCaseInfo (thisTyInst, UnionCaseRef (tcref, id.idText)), i) - CallNameResolutionSink cenv.tcSink (fieldId.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Binding, env.AccessRights) + CallNameResolutionSink cenv.tcSink (fieldId.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Binding, env.AccessRights) TcNamedFieldDecl cenv env parent false tpenv fld | _ -> Some(TcAnonFieldDecl cenv env parent tpenv (mkUnionCaseFieldName nFields i) fld) @@ -539,7 +552,7 @@ module TcRecdUnionAndEnumDeclarations = rfields, thisTy | SynUnionCaseKind.FullType (ty, arity) -> - let tyR, _ = TcTypeAndRecover cenv NoNewTypars CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv ty + let tyR, _ = TcTypeAndRecover cenv NoNewTypars CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv ty let curriedArgTys, recordTy = GetTopTauTypeInFSharpForm g (arity |> TranslateSynValInfo cenv m (TcAttributes cenv env) |> TranslatePartialValReprInfo []).ArgInfos tyR m if curriedArgTys.Length > 1 then @@ -611,7 +624,7 @@ module TcRecdUnionAndEnumDeclarations = | _ -> let expr, actualTy, _ = TcExprOfUnknownType cenv env tpenv valueExpr UnifyTypes cenv env valueRange fieldTy actualTy - + match EvalLiteralExprOrAttribArg cenv.g expr with | Expr.Const (konst, _, _) -> MakeEnumCaseSpec g cenv env parent attrs thisTy caseRange id xmldoc konst | _ -> error(Error(FSComp.SR.tcInvalidEnumerationLiteral(), valueRange)) @@ -730,7 +743,7 @@ let TcOpenTypeDecl (cenv: cenv) mOpenDecl scopem env (synType: SynType, m) = checkLanguageFeatureError g.langVersion LanguageFeature.OpenTypeDeclaration mOpenDecl - let ty, _tpenv = TcType cenv NoNewTypars CheckCxs ItemOccurence.Open WarnOnIWSAM.Yes env emptyUnscopedTyparEnv synType + let ty, _tpenv = TcType cenv NoNewTypars CheckCxs ItemOccurrence.Open WarnOnIWSAM.Yes env emptyUnscopedTyparEnv synType if not (isAppTy g ty) then error(Error(FSComp.SR.tcNamedTypeRequired("open type"), m)) @@ -776,7 +789,7 @@ module AddAugmentationDeclarations = let tcaug = tycon.TypeContents let ty = if tcref.Deref.IsFSharpException then g.exn_ty else generalizedTyconRef g tcref let m = tycon.Range - let genericIComparableTy = mkAppTy g.system_GenericIComparable_tcref [ty] + let genericIComparableTy = mkWoNullAppTy g.system_GenericIComparable_tcref [ty] let hasExplicitIComparable = tycon.HasInterface g g.mk_IComparable_ty @@ -866,7 +879,7 @@ module AddAugmentationDeclarations = let m = tycon.Range // Note: tycon.HasOverride only gives correct results after we've done the type augmentation - let hasExplicitObjectEqualsOverride = tycon.HasOverride g "Equals" [g.obj_ty] + let hasExplicitObjectEqualsOverride = tycon.HasOverride g "Equals" [g.obj_ty_ambivalent] let hasExplicitGenericIEquatable = tcaugHasNominalInterface g tcaug g.system_GenericIEquatable_tcref if hasExplicitGenericIEquatable then @@ -880,7 +893,7 @@ module AddAugmentationDeclarations = let vspec1, vspec2 = AugmentTypeDefinitions.MakeValsForEqualsAugmentation g tcref tcaug.SetEquals (mkLocalValRef vspec1, mkLocalValRef vspec2) if not tycon.IsFSharpException then - PublishInterface cenv env.DisplayEnv tcref m true (mkAppTy g.system_GenericIEquatable_tcref [ty]) + PublishInterface cenv env.DisplayEnv tcref m true (mkWoNullAppTy g.system_GenericIEquatable_tcref [ty]) PublishValueDefn cenv env ModuleOrMemberBinding vspec1 PublishValueDefn cenv env ModuleOrMemberBinding vspec2 AugmentTypeDefinitions.MakeBindingsForEqualsAugmentation g tycon @@ -1174,7 +1187,7 @@ module MutRecBindingChecking = [ PropInfo.FSProp(g, apparentEnclosingType, Some (mkLocalValRef vGet), Some (mkLocalValRef vSet)) ], Some getIdent.idRange ) - CallNameResolutionSink cenv.tcSink (getIdent.idRange, envForTycon.NameEnv, item, emptyTyparInst, ItemOccurence.Binding, envForTycon.eAccessRights) + CallNameResolutionSink cenv.tcSink (getIdent.idRange, envForTycon.NameEnv, item, emptyTyparInst, ItemOccurrence.Binding, envForTycon.eAccessRights) | _ -> () // If no constructor call, insert Phase2AIncrClassCtorJustAfterSuperInit at start @@ -1345,7 +1358,7 @@ module MutRecBindingChecking = | Phase2AInherit (synBaseTy, arg, baseValOpt, m) -> let inheritsExpr, tpenv = try - let baseTy, tpenv = TcType cenv NoNewTypars CheckCxs ItemOccurence.Use WarnOnIWSAM.Yes envInstance tpenv synBaseTy + let baseTy, tpenv = TcType cenv NoNewTypars CheckCxs ItemOccurrence.Use WarnOnIWSAM.Yes envInstance tpenv synBaseTy let baseTy = baseTy |> convertToTypeWithMetadataIfPossible g TcNewExpr cenv envInstance tpenv baseTy (Some synBaseTy.Range) true arg m with RecoverableException e -> @@ -1591,7 +1604,7 @@ module MutRecBindingChecking = if tcref.IsStructOrEnumTycon then Some (incrCtorInfo, mkUnit g tcref.Range, false), defnCs else - let inheritsExpr, _ = TcNewExpr cenv envForDecls tpenv g.obj_ty None true (SynExpr.Const (SynConst.Unit, tcref.Range)) tcref.Range + let inheritsExpr, _ = TcNewExpr cenv envForDecls tpenv g.obj_ty_noNulls None true (SynExpr.Const (SynConst.Unit, tcref.Range)) tcref.Range // If there is no 'inherits' and no simple non-static 'let' of a non-method then add a debug point at the entry to the constructor over the type name itself. let addDebugPointAtImplicitCtorArguments = @@ -1962,7 +1975,7 @@ let TcMutRecDefns_Phase2 (cenv: cenv) envInitial mBinds scopem mutRecNSInfo (env let intfTyR = let envinner = AddDeclaredTypars CheckForDuplicateTypars declaredTyconTypars envForTycon - TcTypeAndRecover cenv NoNewTypars CheckCxs ItemOccurence.UseInType WarnOnIWSAM.No envinner emptyUnscopedTyparEnv intfTy |> fst + TcTypeAndRecover cenv NoNewTypars CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.No envinner emptyUnscopedTyparEnv intfTy |> fst if not (tcref.HasInterface g intfTyR) then error(Error(FSComp.SR.tcAllImplementedInterfacesShouldBeDeclared(), intfTy.Range)) @@ -1973,8 +1986,8 @@ let TcMutRecDefns_Phase2 (cenv: cenv) envInitial mBinds scopem mutRecNSInfo (env if (generatedCompareToValues && typeEquiv g intfTyR g.mk_IComparable_ty) || (generatedCompareToWithComparerValues && typeEquiv g intfTyR g.mk_IStructuralComparable_ty) || - (generatedCompareToValues && typeEquiv g intfTyR (mkAppTy g.system_GenericIComparable_tcref [ty])) || - (generatedHashAndEqualsWithComparerValues && typeEquiv g intfTyR (mkAppTy g.system_GenericIEquatable_tcref [ty])) || + (generatedCompareToValues && typeEquiv g intfTyR (mkWoNullAppTy g.system_GenericIComparable_tcref [ty])) || + (generatedHashAndEqualsWithComparerValues && typeEquiv g intfTyR (mkWoNullAppTy g.system_GenericIEquatable_tcref [ty])) || (generatedHashAndEqualsWithComparerValues && typeEquiv g intfTyR g.mk_IStructuralEquatable_ty) then errorR(Error(FSComp.SR.tcDefaultImplementationForInterfaceHasAlreadyBeenAdded(), intfTy.Range)) @@ -2413,7 +2426,7 @@ module TcExceptionDeclarations = let tcref = mkLocalTyconRef exnc let thisTypInst, _ = generalizeTyconRef g tcref let item = Item.RecdField (RecdFieldInfo (thisTypInst, RecdFieldRef (tcref, fieldId.idText))) - CallNameResolutionSink cenv.tcSink (fieldId.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Binding, env.AccessRights) + CallNameResolutionSink cenv.tcSink (fieldId.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Binding, env.AccessRights) | _ -> () TcRecdUnionAndEnumDeclarations.TcAnonFieldDecl cenv env parent emptyUnscopedTyparEnv (mkExceptionFieldName i) fdef) @@ -2456,7 +2469,7 @@ module TcExceptionDeclarations = exnc.SetExceptionInfo repr let item = Item.ExnCase(mkLocalTyconRef exnc) - CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Binding, env.AccessRights) + CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Binding, env.AccessRights) args' let private TcExnDefnCore (cenv: cenv) env parent synExnDefnRepr = @@ -2600,11 +2613,11 @@ module EstablishTypeDefinitionCores = match args with | SynUnionCaseKind.Fields flds -> for SynField(fieldType = ty; range = m) in flds do - let tyR, _ = TcTypeAndRecover cenv NoNewTypars NoCheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv ty + let tyR, _ = TcTypeAndRecover cenv NoNewTypars NoCheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv ty yield (tyR, m) | SynUnionCaseKind.FullType (ty, arity) -> - let tyR, _ = TcTypeAndRecover cenv NoNewTypars NoCheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv ty + let tyR, _ = TcTypeAndRecover cenv NoNewTypars NoCheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv ty let curriedArgTys, _ = GetTopTauTypeInFSharpForm g (arity |> TranslateSynValInfo cenv m (TcAttributes cenv env) |> TranslatePartialValReprInfo []).ArgInfos tyR m if curriedArgTys.Length > 1 then @@ -2618,7 +2631,7 @@ module EstablishTypeDefinitionCores = for field in fields do let (SynField(isStatic = isStatic; fieldType = ty; range = m)) = field if not isStatic then - let tyR, _ = TcTypeAndRecover cenv NoNewTypars NoCheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv ty + let tyR, _ = TcTypeAndRecover cenv NoNewTypars NoCheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv ty yield (tyR, m) match implicitCtorSynPats with @@ -2637,7 +2650,7 @@ module EstablishTypeDefinitionCores = | SynTypeDefnSimpleRepr.Record (_, fields, _) -> for SynField(fieldType = ty; range = m) in fields do - let tyR, _ = TcTypeAndRecover cenv NoNewTypars NoCheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv ty + let tyR, _ = TcTypeAndRecover cenv NoNewTypars NoCheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv ty yield (tyR, m) | _ -> @@ -2840,12 +2853,28 @@ module EstablishTypeDefinitionCores = // Allow failure of constructor resolution because Vals for members in the same recursive group are not yet available let attrs, getFinalAttrs = TcAttributesCanFail cenv envinner AttributeTargets.TyconDecl synAttrs let hasMeasureAttr = HasFSharpAttribute g g.attrib_MeasureAttribute attrs + let hasStructAttr = HasFSharpAttribute g g.attrib_StructAttribute attrs + let hasCLIMutable = HasFSharpAttribute g g.attrib_CLIMutableAttribute attrs + let hasAllowNullLiteralAttr = HasFSharpAttribute g g.attrib_AllowNullLiteralAttribute attrs + let hasSealedAttr = HasFSharpAttribute g g.attrib_SealedAttribute attrs + let structLayoutAttr = HasFSharpAttribute g g.attrib_StructLayoutAttribute attrs + + // We want to keep these special attributes treatment and avoid having two errors for the same attribute. + let reportAttributeTargetsErrors = + g.langVersion.SupportsFeature(LanguageFeature.EnforceAttributeTargets) + && not hasCLIMutable // CLIMutableAttribute has a special treatment(specific error FS3132) + && not hasAllowNullLiteralAttr // AllowNullLiteralAttribute has a special treatment(specific errors FS0934, FS093) + && not hasSealedAttr // SealedAttribute has a special treatment(specific error FS942) + && not structLayoutAttr // StructLayoutAttribute has a special treatment(specific error FS0937) + + let noCLIMutableAttributeCheck() = + if hasCLIMutable then errorR (Error(FSComp.SR.tcThisTypeMayNotHaveACLIMutableAttribute(), m)) let isStructRecordOrUnionType = match synTyconRepr with | SynTypeDefnSimpleRepr.Record _ | TyconCoreAbbrevThatIsReallyAUnion (hasMeasureAttr, envinner, id) _ - | SynTypeDefnSimpleRepr.Union _ -> + | SynTypeDefnSimpleRepr.Union _ -> HasFSharpAttribute g g.attrib_StructAttribute attrs | _ -> false @@ -2874,9 +2903,15 @@ module EstablishTypeDefinitionCores = | TyconCoreAbbrevThatIsReallyAUnion (hasMeasureAttr, envinner, id) (_, m) | SynTypeDefnSimpleRepr.Union (_, _, m) -> - + noCLIMutableAttributeCheck() // Run InferTyconKind to raise errors on inconsistent attribute sets InferTyconKind g (SynTypeDefnKind.Union, attrs, [], [], inSig, true, m) |> ignore + + if reportAttributeTargetsErrors then + if hasStructAttr then + TcAttributesWithPossibleTargets TcCanFail.IgnoreMemberResoutionError cenv envinner AttributeTargets.Struct synAttrs |> ignore + else + TcAttributesWithPossibleTargets TcCanFail.IgnoreMemberResoutionError cenv envinner AttributeTargets.Class synAttrs |> ignore // Note: the table of union cases is initially empty Construct.MakeUnionRepr [] @@ -2888,20 +2923,27 @@ module EstablishTypeDefinitionCores = | SynTypeDefnSimpleRepr.LibraryOnlyILAssembly (s, m) -> let s = (s :?> ILType) + noCLIMutableAttributeCheck() // Run InferTyconKind to raise errors on inconsistent attribute sets InferTyconKind g (SynTypeDefnKind.IL, attrs, [], [], inSig, true, m) |> ignore TAsmRepr s | SynTypeDefnSimpleRepr.Record (_, _, m) -> - // Run InferTyconKind to raise errors on inconsistent attribute sets InferTyconKind g (SynTypeDefnKind.Record, attrs, [], [], inSig, true, m) |> ignore + + if reportAttributeTargetsErrors then + if hasStructAttr then + TcAttributesWithPossibleTargets TcCanFail.IgnoreMemberResoutionError cenv envinner AttributeTargets.Struct synAttrs |> ignore + else + TcAttributesWithPossibleTargets TcCanFail.IgnoreMemberResoutionError cenv envinner AttributeTargets.Class synAttrs |> ignore // Note: the table of record fields is initially empty TFSharpTyconRepr (Construct.NewEmptyFSharpTyconData TFSharpRecord) | SynTypeDefnSimpleRepr.General (kind, _, slotsigs, fields, isConcrete, _, _, _) -> let kind = InferTyconKind g (kind, attrs, slotsigs, fields, inSig, isConcrete, m) + noCLIMutableAttributeCheck() match kind with | SynTypeDefnKind.Opaque -> TNoRepr @@ -2909,28 +2951,29 @@ module EstablishTypeDefinitionCores = let kind = match kind with | SynTypeDefnKind.Class -> - if g.langVersion.SupportsFeature(LanguageFeature.EnforceAttributeTargets) then - TcAttributesWithPossibleTargets false cenv envinner AttributeTargets.Class synAttrs |> ignore + if reportAttributeTargetsErrors then + TcAttributesWithPossibleTargets TcCanFail.IgnoreMemberResoutionError cenv envinner AttributeTargets.Class synAttrs |> ignore TFSharpClass | SynTypeDefnKind.Interface -> - if g.langVersion.SupportsFeature(LanguageFeature.EnforceAttributeTargets) then - TcAttributesWithPossibleTargets false cenv envinner AttributeTargets.Interface synAttrs |> ignore + if reportAttributeTargetsErrors then + TcAttributesWithPossibleTargets TcCanFail.IgnoreMemberResoutionError cenv envinner AttributeTargets.Interface synAttrs |> ignore TFSharpInterface | SynTypeDefnKind.Delegate _ -> - if g.langVersion.SupportsFeature(LanguageFeature.EnforceAttributeTargets) then - TcAttributesWithPossibleTargets false cenv envinner AttributeTargets.Delegate synAttrs |> ignore + if reportAttributeTargetsErrors then + TcAttributesWithPossibleTargets TcCanFail.IgnoreMemberResoutionError cenv envinner AttributeTargets.Delegate synAttrs |> ignore TFSharpDelegate (MakeSlotSig("Invoke", g.unit_ty, [], [], [], None)) | SynTypeDefnKind.Struct -> - if g.langVersion.SupportsFeature(LanguageFeature.EnforceAttributeTargets) then - TcAttributesWithPossibleTargets false cenv envinner AttributeTargets.Struct synAttrs |> ignore + if reportAttributeTargetsErrors then + TcAttributesWithPossibleTargets TcCanFail.IgnoreMemberResoutionError cenv envinner AttributeTargets.Struct synAttrs |> ignore TFSharpStruct | _ -> error(InternalError("should have inferred tycon kind", m)) TFSharpTyconRepr (Construct.NewEmptyFSharpTyconData kind) | SynTypeDefnSimpleRepr.Enum _ -> - if g.langVersion.SupportsFeature(LanguageFeature.EnforceAttributeTargets) then - TcAttributesWithPossibleTargets false cenv envinner AttributeTargets.Enum synAttrs |> ignore + noCLIMutableAttributeCheck() + if reportAttributeTargetsErrors then + TcAttributesWithPossibleTargets TcCanFail.IgnoreMemberResoutionError cenv envinner AttributeTargets.Enum synAttrs |> ignore TFSharpTyconRepr (Construct.NewEmptyFSharpTyconData TFSharpEnum) // OK, now fill in the (partially computed) type representation @@ -2954,7 +2997,7 @@ module EstablishTypeDefinitionCores = | None -> None | Some (tc, args, m) -> let ad = envinner.AccessRights - match ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurence.UseInType OpenQualified envinner.NameEnv ad tc TypeNameResolutionStaticArgsInfo.DefiniteEmpty PermitDirectReferenceToGeneratedType.Yes with + match ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurrence.UseInType OpenQualified envinner.NameEnv ad tc TypeNameResolutionStaticArgsInfo.DefiniteEmpty PermitDirectReferenceToGeneratedType.Yes with | Result (_, tcrefBeforeStaticArguments, _) when tcrefBeforeStaticArguments.IsProvided && not tcrefBeforeStaticArguments.IsErased -> @@ -3182,7 +3225,7 @@ module EstablishTypeDefinitionCores = // This case deals with ordinary type and measure abbreviations if not hasMeasureableAttr then let kind = if hasMeasureAttr then TyparKind.Measure else TyparKind.Type - let ty, _ = TcTypeOrMeasureAndRecover (Some kind) cenv NoNewTypars checkConstraints ItemOccurence.UseInType WarnOnIWSAM.No envinner tpenv rhsType + let ty, _ = TcTypeOrMeasureAndRecover (Some kind) cenv NoNewTypars checkConstraints ItemOccurrence.UseInType WarnOnIWSAM.No envinner tpenv rhsType // Give a warning if `AutoOpenAttribute` is being aliased. // If the user were to alias the `Microsoft.FSharp.Core.AutoOpenAttribute` type, it would not be detected by the project graph dependency resolution algorithm. @@ -3227,7 +3270,7 @@ module EstablishTypeDefinitionCores = let envinner = AddDeclaredTypars CheckForDuplicateTypars (tycon.Typars m) envinner let envinner = MakeInnerEnvForTyconRef envinner tcref false - let implementedTys, _ = List.mapFold (mapFoldFst (TcTypeAndRecover cenv NoNewTypars checkConstraints ItemOccurence.UseInType WarnOnIWSAM.No envinner)) tpenv explicitImplements + let implementedTys, _ = List.mapFold (mapFoldFst (TcTypeAndRecover cenv NoNewTypars checkConstraints ItemOccurrence.UseInType WarnOnIWSAM.No envinner)) tpenv explicitImplements if firstPass then tycon.entity_attribs <- attrs @@ -3239,7 +3282,7 @@ module EstablishTypeDefinitionCores = let kind = InferTyconKind g (kind, attrs, slotsigs, fields, inSig, isConcrete, m) let inherits = inherits |> List.map (fun (ty, m, _) -> (ty, m)) - let inheritedTys = fst (List.mapFold (mapFoldFst (TcTypeAndRecover cenv NoNewTypars checkConstraints ItemOccurence.UseInType WarnOnIWSAM.No envinner)) tpenv inherits) + let inheritedTys = fst (List.mapFold (mapFoldFst (TcTypeAndRecover cenv NoNewTypars checkConstraints ItemOccurrence.UseInType WarnOnIWSAM.No envinner)) tpenv inherits) let implementedTys, inheritedTys = match kind with | SynTypeDefnKind.Interface -> @@ -3297,7 +3340,7 @@ module EstablishTypeDefinitionCores = if isTyparTy g ty then if firstPass then errorR(Error(FSComp.SR.tcCannotInheritFromVariableType(), m)) - Some g.obj_ty // a "super" that is a variable type causes grief later + Some g.obj_ty_noNulls // a "super" that is a variable type causes grief later else Some ty | _ -> @@ -3312,7 +3355,7 @@ module EstablishTypeDefinitionCores = super |> Option.map (fun ty -> if isFunTy g ty then let a,b = destFunTy g ty - mkAppTy g.fastFunc_tcr [a; b] + mkWoNullAppTy g.fastFunc_tcr [a; b] else ty) // Publish the super type @@ -3342,7 +3385,6 @@ module EstablishTypeDefinitionCores = // REVIEW: for hasMeasureableAttr we need to be stricter about checking these // are only used on exactly the right kinds of type definitions and not in conjunction with other attributes. let hasMeasureableAttr = HasFSharpAttribute g g.attrib_MeasureableAttribute attrs - let hasCLIMutable = HasFSharpAttribute g g.attrib_CLIMutableAttribute attrs let structLayoutAttr = TryFindFSharpInt32Attribute g g.attrib_StructLayoutAttribute attrs let hasAllowNullLiteralAttr = TryFindFSharpBoolAttribute g g.attrib_AllowNullLiteralAttribute attrs = Some true @@ -3363,7 +3405,6 @@ module EstablishTypeDefinitionCores = tycon.TypeContents.tcaug_super |> Option.iter (fun ty -> if not (TypeNullIsExtraValue g m ty) then errorR (Error(FSComp.SR.tcAllowNullTypesMayOnlyInheritFromAllowNullTypes(), m))) tycon.ImmediateInterfaceTypesOfFSharpTycon |> List.iter (fun ty -> if not (TypeNullIsExtraValue g m ty) then errorR (Error(FSComp.SR.tcAllowNullTypesMayOnlyInheritFromAllowNullTypes(), m))) - let structLayoutAttributeCheck allowed = let explicitKind = int32 System.Runtime.InteropServices.LayoutKind.Explicit match structLayoutAttr with @@ -3387,9 +3428,6 @@ module EstablishTypeDefinitionCores = let noMeasureAttributeCheck() = if hasMeasureAttr then errorR (Error(FSComp.SR.tcOnlyTypesRepresentingUnitsOfMeasureCanHaveMeasure(), m)) - let noCLIMutableAttributeCheck() = - if hasCLIMutable then errorR (Error(FSComp.SR.tcThisTypeMayNotHaveACLIMutableAttribute(), m)) - let noSealedAttributeCheck k = if hasSealedAttr = Some true then errorR (Error(k(), m)) @@ -3440,7 +3478,7 @@ module EstablishTypeDefinitionCores = for fspec in fields do if not fspec.IsCompilerGenerated then let item = Item.RecdField(FreshenRecdFieldRef cenv.nameResolver m (thisTyconRef.MakeNestedRecdFieldRef fspec)) - CallNameResolutionSink cenv.tcSink (fspec.Range, nenv, item, emptyTyparInst, ItemOccurence.Binding, ad) + CallNameResolutionSink cenv.tcSink (fspec.Range, nenv, item, emptyTyparInst, ItemOccurrence.Binding, ad) // Notify the Language Service about constructors in discriminated union declaration let writeFakeUnionCtorsToSink (unionCases: UnionCase list) = @@ -3449,7 +3487,7 @@ module EstablishTypeDefinitionCores = for unionCase in unionCases do let info = UnionCaseInfo(thisTyInst, mkUnionCaseRef thisTyconRef unionCase.Id.idText) let item = Item.UnionCase(info, false) - CallNameResolutionSink cenv.tcSink (unionCase.Range, nenv, item, emptyTyparInst, ItemOccurence.Binding, ad) + CallNameResolutionSink cenv.tcSink (unionCase.Range, nenv, item, emptyTyparInst, ItemOccurrence.Binding, ad) let typeRepr, baseValOpt, safeInitInfo = match synTyconRepr with @@ -3493,7 +3531,7 @@ module EstablishTypeDefinitionCores = noAllowNullLiteralAttributeCheck() if hasMeasureableAttr then let kind = if hasMeasureAttr then TyparKind.Measure else TyparKind.Type - let theTypeAbbrev, _ = TcTypeOrMeasureAndRecover (Some kind) cenv NoNewTypars CheckCxs ItemOccurence.UseInType WarnOnIWSAM.No envinner tpenv rhsType + let theTypeAbbrev, _ = TcTypeOrMeasureAndRecover (Some kind) cenv NoNewTypars CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.No envinner tpenv rhsType TMeasureableRepr theTypeAbbrev, None, NoSafeInitInfo // If we already computed a representation, e.g. for a generative type definition, then don't change it here. @@ -3503,7 +3541,6 @@ module EstablishTypeDefinitionCores = TNoRepr, None, NoSafeInitInfo | SynTypeDefnSimpleRepr.Union (_, unionCases, mRepr) -> - noCLIMutableAttributeCheck() noMeasureAttributeCheck() noSealedAttributeCheck FSComp.SR.tcTypesAreAlwaysSealedDU noAbstractClassAttributeCheck() @@ -3543,7 +3580,6 @@ module EstablishTypeDefinitionCores = | SynTypeDefnSimpleRepr.LibraryOnlyILAssembly (s, _) -> let s = (s :?> ILType) - noCLIMutableAttributeCheck() noMeasureAttributeCheck() noSealedAttributeCheck FSComp.SR.tcTypesAreAlwaysSealedAssemblyCode noAllowNullLiteralAttributeCheck() @@ -3609,7 +3645,6 @@ module EstablishTypeDefinitionCores = let kind = match kind with | SynTypeDefnKind.Struct -> - noCLIMutableAttributeCheck() noSealedAttributeCheck FSComp.SR.tcTypesAreAlwaysSealedStruct noAbstractClassAttributeCheck() noAllowNullLiteralAttributeCheck() @@ -3620,14 +3655,12 @@ module EstablishTypeDefinitionCores = TFSharpStruct | SynTypeDefnKind.Interface -> if hasSealedAttr = Some true then errorR (Error(FSComp.SR.tcInterfaceTypesCannotBeSealed(), m)) - noCLIMutableAttributeCheck() structLayoutAttributeCheck false noAbstractClassAttributeCheck() allowNullLiteralAttributeCheck() noFieldsCheck userFields TFSharpInterface | SynTypeDefnKind.Class -> - noCLIMutableAttributeCheck() structLayoutAttributeCheck(not isIncrClass) allowNullLiteralAttributeCheck() for slot in abstractSlots do @@ -3635,14 +3668,13 @@ module EstablishTypeDefinitionCores = errorR(Error(FSComp.SR.chkStaticAbstractMembersOnClasses(), slot.Range)) TFSharpClass | SynTypeDefnKind.Delegate (ty, arity) -> - noCLIMutableAttributeCheck() noSealedAttributeCheck FSComp.SR.tcTypesAreAlwaysSealedDelegate structLayoutAttributeCheck false noAllowNullLiteralAttributeCheck() noAbstractClassAttributeCheck() noFieldsCheck userFields primaryConstructorInDelegateCheck(implicitCtorSynPats) - let tyR, _ = TcTypeAndRecover cenv NoNewTypars CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes envinner tpenv ty + let tyR, _ = TcTypeAndRecover cenv NoNewTypars CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes envinner tpenv ty let _, _, curriedArgInfos, returnTy, _ = GetValReprTypeInCompiledForm g (arity |> TranslateSynValInfo cenv m (TcAttributes cenv envinner) |> TranslatePartialValReprInfo []) 0 tyR m if curriedArgInfos.Length < 1 then error(Error(FSComp.SR.tcInvalidDelegateSpecification(), m)) if curriedArgInfos.Length > 1 then error(Error(FSComp.SR.tcDelegatesCannotBeCurried(), m)) @@ -3686,7 +3718,6 @@ module EstablishTypeDefinitionCores = let fieldTy, fields' = TcRecdUnionAndEnumDeclarations.TcEnumDecls cenv envinner tpenv innerParent thisTy decls let kind = TFSharpEnum structLayoutAttributeCheck false - noCLIMutableAttributeCheck() noSealedAttributeCheck FSComp.SR.tcTypesAreAlwaysSealedEnum noAllowNullLiteralAttributeCheck() let vid = ident("value__", m) @@ -3715,7 +3746,7 @@ module EstablishTypeDefinitionCores = // validate ConditionalAttribute, should it be applied (it's only valid on a type if the type is an attribute type) match attrs |> List.tryFind (IsMatchingFSharpAttribute g g.attrib_ConditionalAttribute) with | Some _ -> - if not(ExistsInEntireHierarchyOfType (fun t -> typeEquiv g t (mkAppTy g.tcref_System_Attribute [])) g cenv.amap m AllowMultiIntfInstantiations.Yes thisTy) then + if not(ExistsInEntireHierarchyOfType (fun t -> typeEquiv g t (mkWoNullAppTy g.tcref_System_Attribute [])) g cenv.amap m AllowMultiIntfInstantiations.Yes thisTy) then errorR(Error(FSComp.SR.tcConditionalAttributeUsage(), m)) | _ -> () @@ -3837,12 +3868,12 @@ module EstablishTypeDefinitionCores = | _ -> acc - // collect edges from an a struct field (which is struct-contained in tycon) + // collect edges from a struct field (which is struct-contained in tycon) let rec accStructField (structTycon: Tycon) structTyInst (fspec: RecdField) (doneTypes, acc) = let fieldTy = actualTyOfRecdFieldForTycon structTycon structTyInst fspec accStructFieldType structTycon structTyInst fspec fieldTy (doneTypes, acc) - // collect edges from an a struct field (given the field type, which may be expanded if it is a type abbreviation) + // collect edges from a struct field (given the field type, which may be expanded if it is a type abbreviation) and accStructFieldType structTycon structTyInst fspec fieldTy (doneTypes, acc) = let fieldTy = stripTyparEqns fieldTy match fieldTy with @@ -3940,7 +3971,7 @@ module EstablishTypeDefinitionCores = let thisTyconRef = mkLocalTyconRef tycon let envForTycon = MakeInnerEnvForTyconRef envForTycon thisTyconRef false try - TcTyparConstraints cenv NoNewTypars checkConstraints ItemOccurence.UseInType envForTycon tpenv synTyconConstraints |> ignore + TcTyparConstraints cenv NoNewTypars checkConstraints ItemOccurrence.UseInType envForTycon tpenv synTyconConstraints |> ignore with RecoverableException exn -> errorRecovery exn m | _ -> ()) @@ -4004,7 +4035,7 @@ module EstablishTypeDefinitionCores = // Phase 1B. Establish the kind of each type constructor // Here we run InferTyconKind and record partial information about the kind of the type constructor. // This means FSharpTyconKind is set, which means isSealedTy, isInterfaceTy etc. give accurate results. - let withAttrs = + let withAttrs = (envMutRecPrelim, withEnvs) ||> MutRecShapes.mapTyconsWithEnv (fun envForDecls (origInfo, tyconOpt) -> let res = match origInfo, tyconOpt with @@ -4127,7 +4158,7 @@ module TcDeclarations = // This records a name resolution of the type at the location let resInfo = TypeNameResolutionStaticArgsInfo.FromTyArgs synTypars.Length - ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurence.Binding OpenQualified envForDecls.NameEnv ad longPath resInfo PermitDirectReferenceToGeneratedType.No + ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurrence.Binding OpenQualified envForDecls.NameEnv ad longPath resInfo PermitDirectReferenceToGeneratedType.No |> ignore mkLocalTyconRef tycon @@ -4135,7 +4166,7 @@ module TcDeclarations = | _ -> let resInfo = TypeNameResolutionStaticArgsInfo.FromTyArgs synTypars.Length let tcref = - match ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurence.Binding OpenQualified envForDecls.NameEnv ad longPath resInfo PermitDirectReferenceToGeneratedType.No with + match ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurrence.Binding OpenQualified envForDecls.NameEnv ad longPath resInfo PermitDirectReferenceToGeneratedType.No with | Result res -> // Update resolved type parameters with the names from the source. let _, tcref, _ = res @@ -4188,7 +4219,7 @@ module TcDeclarations = let declaredTypars = TcTyparDecls cenv envForDecls synTypars let envForTycon = AddDeclaredTypars CheckForDuplicateTypars declaredTypars envForDecls - let _tpenv = TcTyparConstraints cenv NoNewTypars CheckCxs ItemOccurence.UseInType envForTycon emptyUnscopedTyparEnv synTyparCxs + let _tpenv = TcTyparConstraints cenv NoNewTypars CheckCxs ItemOccurrence.UseInType envForTycon emptyUnscopedTyparEnv synTyparCxs declaredTypars |> List.iter (SetTyparRigid envForDecls.DisplayEnv m) if isInSameModuleOrNamespace && not isInterfaceOrDelegateOrEnum then @@ -4308,7 +4339,7 @@ module TcDeclarations = | _ -> () /// Split auto-properties into 'let' and 'member' bindings - let private SplitAutoProps members = + let private SplitAutoProps (g: TcGlobals) members = let membersIncludingAutoProps, vals_Inherits_Abstractslots = members |> List.partition (fun memb -> match memb with @@ -4358,7 +4389,7 @@ module TcDeclarations = let rec postAutoProps memb = match memb with | SynMemberDefn.AutoProperty(ident = id) when String.IsNullOrEmpty(id.idText) -> [] - | SynMemberDefn.AutoProperty(attributes=Attributes attribs; isStatic=isStatic; ident=id; typeOpt=tyOpt; propKind=propKind; memberFlags=memberFlags; memberFlagsForSet=memberFlagsForSet; xmlDoc=xmlDoc; accessibility=access; trivia = { GetSetKeywords = mGetSetOpt }) -> + | SynMemberDefn.AutoProperty(attributes=Attributes attribs; isStatic=isStatic; ident=id; typeOpt=tyOpt; propKind=propKind; memberFlags=memberFlags; memberFlagsForSet=memberFlagsForSet; xmlDoc=xmlDoc; trivia = { GetSetKeywords = mGetSetOpt }; accessibility = access) -> let mMemberPortion = id.idRange // Only the keep the non-field-targeted attributes let attribs = attribs |> List.filter (fun a -> match a.Target with Some t when t.idText = "field" -> false | _ -> true) @@ -4371,7 +4402,8 @@ module TcDeclarations = match propKind, mGetSetOpt with | SynMemberKind.PropertySet, Some getSetKeywords -> errorR(Error(FSComp.SR.parsMutableOnAutoPropertyShouldBeGetSetNotJustSet(), getSetKeywords.Range)) | _ -> () - + + let getterAccess, setterAccess = getGetterSetterAccess access propKind g.langVersion [ match propKind with | SynMemberKind.Member @@ -4381,7 +4413,7 @@ module TcDeclarations = let rhsExpr = SynExpr.Ident fldId let retInfo = match tyOpt with None -> None | Some ty -> Some (None, SynReturnInfo((ty, SynInfo.unnamedRetVal), ty.Range)) let attribs = mkAttributeList attribs mMemberPortion - let binding = mkSynBinding (xmlDoc, headPat) (access, false, false, mMemberPortion, DebugPointAtBinding.NoneAtInvisible, retInfo, rhsExpr, rhsExpr.Range, [], attribs, Some memberFlags, SynBindingTrivia.Zero) + let binding = mkSynBinding (xmlDoc, headPat) (getterAccess, false, false, mMemberPortion, DebugPointAtBinding.NoneAtInvisible, retInfo, rhsExpr, rhsExpr.Range, [], attribs, Some memberFlags, SynBindingTrivia.Zero) SynMemberDefn.Member (binding, mMemberPortion) yield getter | _ -> () @@ -4393,7 +4425,7 @@ module TcDeclarations = let vId = ident("v", mMemberPortion) let headPat = SynPat.LongIdent (SynLongIdent(headPatIds, [], List.replicate headPatIds.Length None), None, Some noInferredTypars, SynArgPats.Pats [mkSynPatVar None vId], None, mMemberPortion) let rhsExpr = mkSynAssign (SynExpr.Ident fldId) (SynExpr.Ident vId) - let binding = mkSynBinding (xmlDoc, headPat) (access, false, false, mMemberPortion, DebugPointAtBinding.NoneAtInvisible, None, rhsExpr, rhsExpr.Range, [], [], Some memberFlagsForSet, SynBindingTrivia.Zero) + let binding = mkSynBinding (xmlDoc, headPat) (setterAccess, false, false, mMemberPortion, DebugPointAtBinding.NoneAtInvisible, None, rhsExpr, rhsExpr.Range, [], [], Some memberFlagsForSet, SynBindingTrivia.Zero) SynMemberDefn.Member (binding, mMemberPortion) yield setter | _ -> ()] @@ -4417,9 +4449,9 @@ module TcDeclarations = /// where simpleRepr can contain inherit type, declared fields and virtual slots. /// body = members /// where members contain methods/overrides, also implicit ctor, inheritCall and local definitions. - let rec private SplitTyconDefn (SynTypeDefn(typeInfo=synTyconInfo;typeRepr=trepr; members=extraMembers)) = + let rec private SplitTyconDefn g (SynTypeDefn(typeInfo=synTyconInfo;typeRepr=trepr; members=extraMembers)) = let extraMembers = desugarGetSetMembers extraMembers - let extraMembers, extra_vals_Inherits_Abstractslots = SplitAutoProps extraMembers + let extraMembers, extra_vals_Inherits_Abstractslots = SplitAutoProps g extraMembers let implements1 = extraMembers |> List.choose (function SynMemberDefn.Interface (interfaceType=ty) -> Some(ty, ty.Range) | _ -> None) match trepr with @@ -4440,7 +4472,7 @@ module TcDeclarations = let slotsigs = members |> List.choose (function SynMemberDefn.AbstractSlot (slotSig = x; flags = y) -> Some(x, y) | _ -> None) - let members, _vals_Inherits_Abstractslots = SplitAutoProps members + let members, _vals_Inherits_Abstractslots = SplitAutoProps g members let isConcrete = members |> List.exists (function @@ -4494,7 +4526,6 @@ module TcDeclarations = core, extra_vals_Inherits_Abstractslots @ extraMembers //------------------------------------------------------------------------- - /// Bind a collection of mutually recursive definitions in an implementation file let TcMutRecDefinitions (cenv: cenv) envInitial parent typeNames tpenv m scopem mutRecNSInfo (mutRecDefns: MutRecDefnsInitialData) isMutRec = @@ -4502,7 +4533,7 @@ module TcDeclarations = // Split the definitions into "core representations" and "members". The code to process core representations // is shared between processing of signature files and implementation files. - let mutRecDefnsAfterSplit = mutRecDefns |> MutRecShapes.mapTycons SplitTyconDefn + let mutRecDefnsAfterSplit = mutRecDefns |> MutRecShapes.mapTycons (fun i -> SplitTyconDefn g i) // Create the entities for each module and type definition, and process the core representation of each type definition. let tycons, envMutRecPrelim, mutRecDefnsAfterCore = @@ -4804,7 +4835,7 @@ let rec TcSignatureElementNonMutRec (cenv: cenv) parent typeNames endm (env: TcE return env | SynModuleSigDecl.Types (typeSpecs, m) -> - CheckDuplicatesAbstractMethodParmsSig typeSpecs + CheckDuplicatesAbstractMethodParamsSig typeSpecs let scopem = unionRanges m endm let mutRecDefns = typeSpecs |> List.map MutRecShape.Tycon let env = TcDeclarations.TcMutRecSignatureDecls cenv env parent typeNames emptyUnscopedTyparEnv m scopem None mutRecDefns @@ -4913,7 +4944,7 @@ let rec TcSignatureElementNonMutRec (cenv: cenv) parent typeNames endm (env: TcE modulNSs |> List.iter (fun moduleEntity -> let modref = mkLocalModuleRef moduleEntity let item = Item.ModuleOrNamespaces [modref] - CallNameResolutionSink cenv.tcSink (moduleEntity.Range, env.NameEnv, item, emptyTyparInst, ItemOccurence.Binding, env.AccessRights)) + CallNameResolutionSink cenv.tcSink (moduleEntity.Range, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Binding, env.AccessRights)) // For 'namespace rec' and 'module rec' we add the thing being defined let envNS = if isRec then AddLocalRootModuleOrNamespace cenv.tcSink g cenv.amap m envNS modTyRoot else envNS @@ -4978,7 +5009,7 @@ and TcSignatureElementsMutRec cenv parent typeNames m mutRecNSInfo envInitial (d ((true, true), defs) ||> List.collectFold (fun (openOk, moduleAbbrevOk) def -> match def with | SynModuleSigDecl.Types (typeSpecs, _) -> - CheckDuplicatesAbstractMethodParmsSig typeSpecs + CheckDuplicatesAbstractMethodParamsSig typeSpecs let decls = typeSpecs |> List.map MutRecShape.Tycon decls, (false, false) @@ -5082,8 +5113,106 @@ let CheckLetOrDoInNamespace binds m = | _ -> error(Error(FSComp.SR.tcNamespaceCannotContainValues(), binds.Head.RangeOfHeadPattern)) +let rec TcMutRecDefsFinish cenv defs m = + let opens = + [ for def in defs do + match def with + | MutRecShape.Open (MutRecDataForOpen (_target, _m, _moduleRange, openDeclsRef)) -> + yield! openDeclsRef.Value + | _ -> () ] + + let tycons = defs |> List.choose (function MutRecShape.Tycon (Some tycon, _) -> Some tycon | _ -> None) + + let binds = + defs |> List.collect (function + | MutRecShape.Open _ -> [] + | MutRecShape.ModuleAbbrev _ -> [] + | MutRecShape.Tycon (_, binds) + | MutRecShape.Lets binds -> + binds |> List.map ModuleOrNamespaceBinding.Binding + | MutRecShape.Module ((MutRecDefnsPhase2DataForModule(moduleTyAcc, moduleEntity), _), moduleDefs) -> + let moduleContents = TcMutRecDefsFinish cenv moduleDefs m + moduleEntity.entity_modul_type <- MaybeLazy.Strict moduleTyAcc.Value + [ ModuleOrNamespaceBinding.Module(moduleEntity, moduleContents) ]) + + TMDefRec(true, opens, tycons, binds, m) + +/// The mutually recursive case for a sequence of declarations (and nested modules) +let TcModuleOrNamespaceElementsMutRec (cenv: cenv) parent typeNames m envInitial mutRecNSInfo (defs: SynModuleDecl list) = + let m = match defs with [] -> m | _ -> defs |> List.map (fun d -> d.Range) |> List.reduce unionRanges + let scopem = (defs, m) ||> List.foldBack (fun h m -> unionRanges h.Range m) + + let mutRecDefns, (_, _, Attributes synAttrs) = + let rec loop isNamespace moduleRange attrs defs: MutRecDefnsInitialData * _ = + ((true, true, attrs), defs) ||> List.collectFold (fun (openOk, moduleAbbrevOk, attrs) def -> + match ElimSynModuleDeclExpr def with + + | SynModuleDecl.Types (typeDefs, _) -> + let decls = typeDefs |> List.map MutRecShape.Tycon + decls, (false, false, attrs) + + | SynModuleDecl.Let (letrec, binds, m) -> + let binds = + if isNamespace then + CheckLetOrDoInNamespace binds m; [] + else + if letrec then [MutRecShape.Lets binds] + else List.map (List.singleton >> MutRecShape.Lets) binds + binds, (false, false, attrs) + + | SynModuleDecl.NestedModule(moduleInfo = (SynComponentInfo(longId = []))) -> + [], (openOk, moduleAbbrevOk, attrs) + + | SynModuleDecl.NestedModule(moduleInfo=compInfo; isRecursive=isRec; decls=synDefs; range=moduleRange) -> + if isRec then warning(Error(FSComp.SR.tcRecImplied(), compInfo.Range)) + let mutRecDefs, (_, _, attrs) = loop false moduleRange attrs synDefs + let decls = [MutRecShape.Module (compInfo, mutRecDefs)] + decls, (false, false, attrs) + + | SynModuleDecl.Open (target, m) -> + if not openOk then errorR(Error(FSComp.SR.tcOpenFirstInMutRec(), m)) + let decls = [ MutRecShape.Open (MutRecDataForOpen(target, m, moduleRange, ref [])) ] + decls, (openOk, moduleAbbrevOk, attrs) + + | SynModuleDecl.Exception (SynExceptionDefn(repr, _, members, _), _m) -> + let members = desugarGetSetMembers members + let (SynExceptionDefnRepr(synAttrs, SynUnionCase(ident=SynIdent(id,_)), _repr, xmlDoc, vis, m)) = repr + let compInfo = SynComponentInfo(synAttrs, None, [], [id], xmlDoc, false, vis, id.idRange) + let decls = [ MutRecShape.Tycon(SynTypeDefn(compInfo, SynTypeDefnRepr.Exception repr, members, None, m, SynTypeDefnTrivia.Zero)) ] + decls, (false, false, attrs) + + | SynModuleDecl.HashDirective _ -> + [ ], (openOk, moduleAbbrevOk, attrs) + + | SynModuleDecl.Attributes (synAttrs, _) -> + [ ], (false, false, synAttrs) + + | SynModuleDecl.ModuleAbbrev (id, p, m) -> + if not moduleAbbrevOk then errorR(Error(FSComp.SR.tcModuleAbbrevFirstInMutRec(), m)) + let decls = [ MutRecShape.ModuleAbbrev (MutRecDataForModuleAbbrev(id, p, m)) ] + decls, (false, moduleAbbrevOk, attrs) + + | SynModuleDecl.Expr _ -> failwith "unreachable: SynModuleDecl.Expr - ElimSynModuleDeclExpr" + + | SynModuleDecl.NamespaceFragment _ as d -> error(Error(FSComp.SR.tcUnsupportedMutRecDecl(), d.Range))) + + loop (match parent with ParentNone -> true | Parent _ -> false) m [] defs + + let tpenv = emptyUnscopedTyparEnv + let mutRecDefnsChecked, envAfter = TcDeclarations.TcMutRecDefinitions cenv envInitial parent typeNames tpenv m scopem mutRecNSInfo mutRecDefns true + + // Check the assembly attributes + let attrs, _ = TcAttributesWithPossibleTargets TcCanFail.ReportAllErrors cenv envAfter AttributeTargets.Top synAttrs + + // Check the non-escaping condition as we build the list of module expressions on the way back up + let moduleContents = TcMutRecDefsFinish cenv mutRecDefnsChecked m + let escapeCheck () = + TcMutRecDefnsEscapeCheck mutRecDefnsChecked envInitial + + ([ moduleContents ], [ escapeCheck ], attrs), envAfter, envAfter + /// The non-mutually recursive case for a declaration -let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem env synDecl = +let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem env synDecl = cancellable { let g = cenv.g cenv.synArgNameGenerator.Reset() @@ -5150,7 +5279,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem return! failwith "unreachable" | SynModuleDecl.Attributes (Attributes synAttrs, _) -> - let attrs, _ = TcAttributesWithPossibleTargets false cenv env AttributeTargets.Top synAttrs + let attrs, _ = TcAttributesWithPossibleTargets TcCanFail.ReportAllErrors cenv env AttributeTargets.Top synAttrs return ([], [], attrs), env, env | SynModuleDecl.HashDirective _ -> @@ -5165,7 +5294,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem if isRec then assert (not isContinuingModule) let modDecl = SynModuleDecl.NestedModule(compInfo, false, moduleDefs, isContinuingModule, m, trivia) - return! TcModuleOrNamespaceElementsMutRec cenv parent typeNames m env None [modDecl] + return TcModuleOrNamespaceElementsMutRec cenv parent typeNames m env None [modDecl] else let (SynComponentInfo(Attributes attribs, _, _, longPath, xml, _, vis, im)) = compInfo let id = ComputeModuleName longPath @@ -5193,7 +5322,9 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem let moduleEntity = Construct.NewModuleOrNamespace (Some env.eCompPath) vis id xmlDoc modAttrs (MaybeLazy.Strict moduleTy) // Now typecheck. - let! moduleContents, topAttrsNew, envAtEnd = TcModuleOrNamespaceElements cenv (Parent (mkLocalModuleRef moduleEntity)) endm envForModule xml None [] moduleDefs + let! moduleContents, topAttrsNew, envAtEnd = + TcModuleOrNamespaceElements cenv (Parent (mkLocalModuleRef moduleEntity)) endm envForModule xml None [] moduleDefs + |> cenv.stackGuard.GuardCancellable // Get the inferred type of the decls and record it in the modul. moduleEntity.entity_modul_type <- MaybeLazy.Strict moduleTyAcc.Value @@ -5275,14 +5406,16 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem modulNSs |> List.iter (fun moduleEntity -> let modref = mkLocalModuleRef moduleEntity let item = Item.ModuleOrNamespaces [modref] - CallNameResolutionSink cenv.tcSink (moduleEntity.Range, env.NameEnv, item, emptyTyparInst, ItemOccurence.Binding, env.AccessRights)) + CallNameResolutionSink cenv.tcSink (moduleEntity.Range, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Binding, env.AccessRights)) // For 'namespace rec' and 'module rec' we add the thing being defined let envNS = if isRec then AddLocalRootModuleOrNamespace cenv.tcSink g cenv.amap m envNS modTyRoot else envNS let nsInfo = Some (modulNSOpt, envNS.eModuleOrNamespaceTypeAccumulator) let mutRecNSInfo = if isRec then nsInfo else None - let! moduleContents, topAttrs, envAtEnd = TcModuleOrNamespaceElements cenv parent endm envNS xml mutRecNSInfo [] defs + let! moduleContents, topAttrs, envAtEnd = + TcModuleOrNamespaceElements cenv parent endm envNS xml mutRecNSInfo [] defs + |> cenv.stackGuard.GuardCancellable MutRecBindingChecking.TcMutRecDefns_UpdateNSContents nsInfo let env, openDecls = @@ -5334,7 +5467,7 @@ and [] TcModuleOrNamespaceElementsNonMutRec cenv parent typeNames endm else unionRanges (List.head otherDefs).Range endm - let result = Cancellable.run ct (TcModuleOrNamespaceElementNonMutRec cenv parent typeNames scopem env firstDef) + let result = Cancellable.run ct (TcModuleOrNamespaceElementNonMutRec cenv parent typeNames scopem env firstDef |> cenv.stackGuard.GuardCancellable) match result with | ValueOrCancelled.Cancelled x -> @@ -5342,107 +5475,6 @@ and [] TcModuleOrNamespaceElementsNonMutRec cenv parent typeNames endm | ValueOrCancelled.Value(firstDef, env, envAtEnd) -> TcModuleOrNamespaceElementsNonMutRec cenv parent typeNames endm ((firstDef :: defsSoFar), env, envAtEnd) otherDefs ct -/// The mutually recursive case for a sequence of declarations (and nested modules) -and TcModuleOrNamespaceElementsMutRec (cenv: cenv) parent typeNames m envInitial mutRecNSInfo (defs: SynModuleDecl list) = - cancellable { - - let m = match defs with [] -> m | _ -> defs |> List.map (fun d -> d.Range) |> List.reduce unionRanges - let scopem = (defs, m) ||> List.foldBack (fun h m -> unionRanges h.Range m) - - let mutRecDefns, (_, _, Attributes synAttrs) = - let rec loop isNamespace moduleRange attrs defs: MutRecDefnsInitialData * _ = - ((true, true, attrs), defs) ||> List.collectFold (fun (openOk, moduleAbbrevOk, attrs) def -> - match ElimSynModuleDeclExpr def with - - | SynModuleDecl.Types (typeDefs, _) -> - let decls = typeDefs |> List.map MutRecShape.Tycon - decls, (false, false, attrs) - - | SynModuleDecl.Let (letrec, binds, m) -> - let binds = - if isNamespace then - CheckLetOrDoInNamespace binds m; [] - else - if letrec then [MutRecShape.Lets binds] - else List.map (List.singleton >> MutRecShape.Lets) binds - binds, (false, false, attrs) - - | SynModuleDecl.NestedModule(moduleInfo = (SynComponentInfo(longId = []))) -> - [], (openOk, moduleAbbrevOk, attrs) - - | SynModuleDecl.NestedModule(moduleInfo=compInfo; isRecursive=isRec; decls=synDefs; range=moduleRange) -> - if isRec then warning(Error(FSComp.SR.tcRecImplied(), compInfo.Range)) - let mutRecDefs, (_, _, attrs) = loop false moduleRange attrs synDefs - let decls = [MutRecShape.Module (compInfo, mutRecDefs)] - decls, (false, false, attrs) - - | SynModuleDecl.Open (target, m) -> - if not openOk then errorR(Error(FSComp.SR.tcOpenFirstInMutRec(), m)) - let decls = [ MutRecShape.Open (MutRecDataForOpen(target, m, moduleRange, ref [])) ] - decls, (openOk, moduleAbbrevOk, attrs) - - | SynModuleDecl.Exception (SynExceptionDefn(repr, _, members, _), _m) -> - let members = desugarGetSetMembers members - let (SynExceptionDefnRepr(synAttrs, SynUnionCase(ident=SynIdent(id,_)), _repr, xmlDoc, vis, m)) = repr - let compInfo = SynComponentInfo(synAttrs, None, [], [id], xmlDoc, false, vis, id.idRange) - let decls = [ MutRecShape.Tycon(SynTypeDefn(compInfo, SynTypeDefnRepr.Exception repr, members, None, m, SynTypeDefnTrivia.Zero)) ] - decls, (false, false, attrs) - - | SynModuleDecl.HashDirective _ -> - [ ], (openOk, moduleAbbrevOk, attrs) - - | SynModuleDecl.Attributes (synAttrs, _) -> - [ ], (false, false, synAttrs) - - | SynModuleDecl.ModuleAbbrev (id, p, m) -> - if not moduleAbbrevOk then errorR(Error(FSComp.SR.tcModuleAbbrevFirstInMutRec(), m)) - let decls = [ MutRecShape.ModuleAbbrev (MutRecDataForModuleAbbrev(id, p, m)) ] - decls, (false, moduleAbbrevOk, attrs) - - | SynModuleDecl.Expr _ -> failwith "unreachable: SynModuleDecl.Expr - ElimSynModuleDeclExpr" - - | SynModuleDecl.NamespaceFragment _ as d -> error(Error(FSComp.SR.tcUnsupportedMutRecDecl(), d.Range))) - - loop (match parent with ParentNone -> true | Parent _ -> false) m [] defs - - let tpenv = emptyUnscopedTyparEnv - let mutRecDefnsChecked, envAfter = TcDeclarations.TcMutRecDefinitions cenv envInitial parent typeNames tpenv m scopem mutRecNSInfo mutRecDefns true - - // Check the assembly attributes - let attrs, _ = TcAttributesWithPossibleTargets false cenv envAfter AttributeTargets.Top synAttrs - - // Check the non-escaping condition as we build the list of module expressions on the way back up - let moduleContents = TcMutRecDefsFinish cenv mutRecDefnsChecked m - let escapeCheck () = - TcMutRecDefnsEscapeCheck mutRecDefnsChecked envInitial - - return ([ moduleContents ], [ escapeCheck ], attrs), envAfter, envAfter - - } - -and TcMutRecDefsFinish cenv defs m = - let opens = - [ for def in defs do - match def with - | MutRecShape.Open (MutRecDataForOpen (_target, _m, _moduleRange, openDeclsRef)) -> - yield! openDeclsRef.Value - | _ -> () ] - - let tycons = defs |> List.choose (function MutRecShape.Tycon (Some tycon, _) -> Some tycon | _ -> None) - - let binds = - defs |> List.collect (function - | MutRecShape.Open _ -> [] - | MutRecShape.ModuleAbbrev _ -> [] - | MutRecShape.Tycon (_, binds) - | MutRecShape.Lets binds -> - binds |> List.map ModuleOrNamespaceBinding.Binding - | MutRecShape.Module ((MutRecDefnsPhase2DataForModule(moduleTyAcc, moduleEntity), _), moduleDefs) -> - let moduleContents = TcMutRecDefsFinish cenv moduleDefs m - moduleEntity.entity_modul_type <- MaybeLazy.Strict moduleTyAcc.Value - [ ModuleOrNamespaceBinding.Module(moduleEntity, moduleContents) ]) - - TMDefRec(true, opens, tycons, binds, m) and TcModuleOrNamespaceElements cenv parent endm env xml mutRecNSInfo openDecls0 synModuleDecls = cancellable { @@ -5457,7 +5489,8 @@ and TcModuleOrNamespaceElements cenv parent endm env xml mutRecNSInfo openDecls0 match mutRecNSInfo with | Some _ -> - let! (moduleDefs, escapeChecks, topAttrsNew), _, envAtEnd = TcModuleOrNamespaceElementsMutRec cenv parent typeNames endm env mutRecNSInfo synModuleDecls + let (moduleDefs, escapeChecks, topAttrsNew), _, envAtEnd = + TcModuleOrNamespaceElementsMutRec cenv parent typeNames endm env mutRecNSInfo synModuleDecls let moduleContents = TMDefs(moduleDefs) // Run the escape checks (for compat run in reverse order) do @@ -5540,7 +5573,7 @@ let emptyTcEnv g = eCallerMemberName = None eLambdaArgInfos = [] eIsControlFlow = false - eCachedImplicitYieldExpressions = HashMultiMap(HashIdentity.Structural) } + eCachedImplicitYieldExpressions = HashMultiMap(HashIdentity.Structural, useConcurrentDictionary = true) } let CreateInitialTcEnv(g, amap, scopem, assemblyName, ccus) = (emptyTcEnv g, ccus) ||> List.collectFold (fun env (ccu, autoOpens, internalsVisible) -> @@ -5715,7 +5748,9 @@ let CheckOneImplFile let envinner, moduleTyAcc = MakeInitialEnv env let defs = [ for x in implFileFrags -> SynModuleDecl.NamespaceFragment x ] - let! moduleContents, topAttrs, envAtEnd = TcModuleOrNamespaceElements cenv ParentNone qualNameOfFile.Range envinner PreXmlDoc.Empty None openDecls0 defs + let! moduleContents, topAttrs, envAtEnd = + TcModuleOrNamespaceElements cenv ParentNone qualNameOfFile.Range envinner PreXmlDoc.Empty None openDecls0 defs + |> cenv.stackGuard.GuardCancellable let implFileTypePriorToSig = moduleTyAcc.Value @@ -5856,12 +5891,12 @@ let CheckOneSigFile (g, amap, thisCcu, checkForErrors, conditionalDefines, tcSin tcComputationExpression=TcComputationExpression) let envinner, moduleTyAcc = MakeInitialEnv tcEnv - + let m = sigFile.QualifiedName.Range let specs = [ for x in sigFile.Contents -> SynModuleSigDecl.NamespaceFragment x ] - let! tcEnv = TcSignatureElements cenv ParentNone sigFile.QualifiedName.Range envinner PreXmlDoc.Empty None specs - - let sigFileType = moduleTyAcc.Value + let! tcEnv = TcSignatureElements cenv ParentNone m envinner PreXmlDoc.Empty None specs + let sigFileType = moduleTyAcc.Value + if not (checkForErrors()) then try sigFileType |> IterTyconsOfModuleOrNamespaceType (fun tycon -> diff --git a/src/Compiler/Checking/CheckFormatStrings.fs b/src/Compiler/Checking/CheckFormatStrings.fs index ec8b4ae2b91..e0555ef2a79 100644 --- a/src/Compiler/Checking/CheckFormatStrings.fs +++ b/src/Compiler/Checking/CheckFormatStrings.fs @@ -359,10 +359,10 @@ let parseFormatStringInternal let acc = if widthArg then (Option.map ((+)1) posi, g.int_ty) :: acc else acc let checkOtherFlags c = - if info.precision then failwith (FSComp.SR.forFormatDoesntSupportPrecision(c.ToString())) - if info.addZeros then failwith (FSComp.SR.forDoesNotSupportZeroFlag(c.ToString())) + if info.precision then failwith (FSComp.SR.forFormatDoesntSupportPrecision(c.ToString() |> string)) + if info.addZeros then failwith (FSComp.SR.forDoesNotSupportZeroFlag(c.ToString() |> string)) match info.numPrefixIfPos with - | Some n -> failwith (FSComp.SR.forDoesNotSupportPrefixFlag(c.ToString(), n.ToString())) + | Some n -> failwith (FSComp.SR.forDoesNotSupportPrefixFlag(c.ToString() |> string, n.ToString())) | None -> () let skipPossibleInterpolationHole pos = Parse.skipPossibleInterpolationHole isInterpolated isFormattableString fmt pos @@ -449,7 +449,8 @@ let parseFormatStringInternal checkOtherFlags ch collectSpecifierLocation fragLine fragCol 1 let i = skipPossibleInterpolationHole (i+1) - parseLoop ((posi, g.string_ty) :: acc) (i, fragLine, fragCol+1) fragments + let stringTy = if g.checkNullness && g.langFeatureNullness then g.string_ty_ambivalent else g.string_ty + parseLoop ((posi, stringTy) :: acc) (i, fragLine, fragCol+1) fragments | 'O' -> checkOtherFlags ch diff --git a/src/Compiler/Checking/CheckIncrementalClasses.fs b/src/Compiler/Checking/CheckIncrementalClasses.fs index 014e3144717..5630fc2d4cc 100644 --- a/src/Compiler/Checking/CheckIncrementalClasses.fs +++ b/src/Compiler/Checking/CheckIncrementalClasses.fs @@ -448,7 +448,7 @@ type IncrClassReprInfo = | InMethod(isStatic, methodVal, valReprInfo), _ -> //dprintfn "Rewriting application of %s to be call to method %s" v.LogicalName methodVal.LogicalName let expr, exprTy = AdjustValForExpectedValReprInfo g m (mkLocalValRef methodVal) NormalValUse valReprInfo - // Prepend the the type arguments for the class + // Prepend the type arguments for the class let tyargs = tinst @ tyargs let thisArgs = if isStatic then [] diff --git a/src/Compiler/Checking/CheckPatterns.fs b/src/Compiler/Checking/CheckPatterns.fs index 79758a01327..54419016859 100644 --- a/src/Compiler/Checking/CheckPatterns.fs +++ b/src/Compiler/Checking/CheckPatterns.fs @@ -27,6 +27,7 @@ open FSharp.Compiler.Text.Range open FSharp.Compiler.TypedTree open FSharp.Compiler.TypedTreeBasics open FSharp.Compiler.TypedTreeOps +open FSharp.Compiler.CheckExpressionsOps type cenv = TcFileState @@ -97,7 +98,7 @@ and TcSimplePat optionalArgsOK checkConstraints (cenv: cenv) ty env patEnv p = id.idText, patEnvR | SynSimplePat.Typed (p, cty, m) -> - let ctyR, tpenv = TcTypeAndRecover cenv NewTyparsOK checkConstraints ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv cty + let ctyR, tpenv = TcTypeAndRecover cenv NewTyparsOK checkConstraints ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv cty match p with // Optional arguments on members @@ -209,7 +210,7 @@ and TcPatBindingName cenv env id ty isMemberThis vis1 valReprInfo (vFlags: TcPat // For non-left-most paths, we register the name resolutions here if not isLeftMost && not vspec.IsCompilerGenerated && not (vspec.LogicalName.StartsWithOrdinal("_")) then let item = Item.Value(mkLocalValRef vspec) - CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Binding, env.AccessRights) + CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Binding, env.AccessRights) PatternValBinding(vspec, typeScheme) @@ -273,7 +274,7 @@ and TcPat warnOnUpper (cenv: cenv) env valReprInfo vFlags (patEnv: TcPatLinearEn | SynPat.Typed (p, cty, m) -> let (TcPatLinearEnv(tpenv, names, takenNames)) = patEnv - let ctyR, tpenvR = TcTypeAndRecover cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv cty + let ctyR, tpenvR = TcTypeAndRecover cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv cty UnifyTypes cenv env m ty ctyR let patEnvR = TcPatLinearEnv(tpenvR, names, takenNames) TcPat warnOnUpper cenv env valReprInfo vFlags patEnvR ty p @@ -369,7 +370,7 @@ and TcPatNamed warnOnUpper cenv env vFlags patEnv id ty isMemberThis vis valRepr and TcPatIsInstance warnOnUpper cenv env valReprInfo vFlags patEnv srcTy synPat synTargetTy m = let (TcPatLinearEnv(tpenv, names, takenNames)) = patEnv - let tgtTy, tpenv = TcTypeAndRecover cenv NewTyparsOKButWarnIfNotRigid CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv synTargetTy + let tgtTy, tpenv = TcTypeAndRecover cenv NewTyparsOKButWarnIfNotRigid CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv synTargetTy TcRuntimeTypeTest false true cenv env.DisplayEnv m tgtTy srcTy let patEnv = TcPatLinearEnv(tpenv, names, takenNames) match synPat with @@ -446,7 +447,7 @@ and TcRecordPat warnOnUpper cenv env vFlags patEnv ty fieldPats m = | None -> (fun _ -> TPat_error m), patEnv | Some(tinst, tcref, fldsmap, _fldsList) -> - let gtyp = mkAppTy tcref tinst + let gtyp = mkWoNullAppTy tcref tinst let inst = List.zip (tcref.Typars m) tinst UnifyTypes cenv env m ty gtyp @@ -602,7 +603,7 @@ and TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (m let g = cenv.g // Report information about the case occurrence to IDE - CallNameResolutionSink cenv.tcSink (mLongId, env.NameEnv, item, emptyTyparInst, ItemOccurence.Pattern, env.eAccessRights) + CallNameResolutionSink cenv.tcSink (mLongId, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Pattern, env.eAccessRights) let mkf, argTys, argNames = ApplyUnionCaseOrExn m cenv env ty item let numArgTys = argTys.Length @@ -651,11 +652,11 @@ and TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (m | Item.ExnCase tref -> Item.RecdField (RecdFieldInfo ([], RecdFieldRef (tref, id.idText))) | _ -> failwithf "Expecting union case or exception item, got: %O" item - CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, argItem, emptyTyparInst, ItemOccurence.Pattern, ad) + CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, argItem, emptyTyparInst, ItemOccurrence.Pattern, ad) match box result[idx] with - | Null -> result[idx] <- pat - | NonNull _ -> + | null -> result[idx] <- pat + | _ -> extraPatterns.Add pat errorR (Error (FSComp.SR.tcUnionCaseFieldCannotBeUsedMoreThanOnce id.idText, id.idRange)) @@ -742,7 +743,7 @@ and TcPatLongIdentILField warnOnUpper (cenv: cenv) env vFlags patEnv ty (mLongId UnifyTypes cenv env m ty (finfo.FieldType (cenv.amap, m)) let c' = TcFieldInit mLongId lit let item = Item.ILField finfo - CallNameResolutionSink cenv.tcSink (mLongId, env.NameEnv, item, emptyTyparInst, ItemOccurence.Pattern, env.AccessRights) + CallNameResolutionSink cenv.tcSink (mLongId, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Pattern, env.AccessRights) (fun _ -> TPat_const (c', m)), acc /// Check a long identifier that has been resolved to a record field @@ -762,7 +763,7 @@ and TcPatLongIdentRecdField warnOnUpper cenv env vFlags patEnv ty (mLongId, rfin let item = Item.RecdField rfinfo // FUTURE: can we do better than emptyTyparInst here, in order to display instantiations // of type variables in the quick info provided in the IDE. - CallNameResolutionSink cenv.tcSink (mLongId, env.NameEnv, item, emptyTyparInst, ItemOccurence.Pattern, env.AccessRights) + CallNameResolutionSink cenv.tcSink (mLongId, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Pattern, env.AccessRights) (fun _ -> TPat_const (lit, m)), acc /// Check a long identifier that has been resolved to an F# value that is a literal @@ -781,10 +782,9 @@ and TcPatLongIdentLiteral warnOnUpper (cenv: cenv) env vFlags patEnv ty (mLongId UnifyTypes cenv env m ty vexpty let item = Item.Value vref - CallNameResolutionSink cenv.tcSink (mLongId, env.NameEnv, item, emptyTyparInst, ItemOccurence.Pattern, env.AccessRights) + CallNameResolutionSink cenv.tcSink (mLongId, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Pattern, env.AccessRights) (fun _ -> TPat_const (lit, m)), acc and TcPatterns warnOnUpper cenv env vFlags s argTys args = assert (List.length args = List.length argTys) List.mapFold (fun s (ty, pat) -> TcPat warnOnUpper cenv env None vFlags s ty pat) s (List.zip argTys args) - diff --git a/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs b/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs index 5f59e1ac3ec..8783da1031f 100644 --- a/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs +++ b/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs @@ -90,26 +90,26 @@ let TransformAstForNestedUpdates (cenv: TcFileState) (env: TcEnv) overallTy (lid let totalRange (origId: Ident) (id: Ident) = withStartEnd origId.idRange.End id.idRange.Start origId.idRange - let rangeOfBlockSeperator (id: Ident) = + let rangeOfBlockSeparator (id: Ident) = let idEnd = id.idRange.End - let blockSeperatorStartCol = idEnd.Column - let blockSeperatorEndCol = blockSeperatorStartCol + 4 - let blockSeperatorStartPos = mkPos idEnd.Line blockSeperatorStartCol - let blockSeporatorEndPos = mkPos idEnd.Line blockSeperatorEndCol + let blockSeparatorStartCol = idEnd.Column + let blockSeparatorEndCol = blockSeparatorStartCol + 4 + let blockSeparatorStartPos = mkPos idEnd.Line blockSeparatorStartCol + let blockSeparatorEndPos = mkPos idEnd.Line blockSeparatorEndCol - withStartEnd blockSeperatorStartPos blockSeporatorEndPos id.idRange + withStartEnd blockSeparatorStartPos blockSeparatorEndPos id.idRange match withExpr with | SynExpr.Ident origId, (sepRange, _) -> let lid, rng = upToId sepRange id (origId :: ids) - Some(SynExpr.LongIdent(false, LongIdentWithDots(lid, rng), None, totalRange origId id), (rangeOfBlockSeperator id, None)) + Some(SynExpr.LongIdent(false, LongIdentWithDots(lid, rng), None, totalRange origId id), (rangeOfBlockSeparator id, None)) | _ -> None let rec synExprRecd copyInfo (outerFieldId: Ident) innerFields exprBeingAssigned = match innerFields with | [] -> failwith "unreachable" | (fieldId: Ident, item) :: rest -> - CallNameResolutionSink cenv.tcSink (fieldId.idRange, env.NameEnv, item, [], ItemOccurence.Use, env.AccessRights) + CallNameResolutionSink cenv.tcSink (fieldId.idRange, env.NameEnv, item, [], ItemOccurrence.Use, env.AccessRights) let fieldId = ident (fieldId.idText, fieldId.idRange.MakeSynthetic()) @@ -143,7 +143,7 @@ let TransformAstForNestedUpdates (cenv: TcFileState) (env: TcEnv) overallTy (lid | accessIds, (outerFieldId, item) :: rest -> checkLanguageFeatureAndRecover cenv.g.langVersion LanguageFeature.NestedCopyAndUpdate (rangeOfLid lid) - CallNameResolutionSink cenv.tcSink (outerFieldId.idRange, env.NameEnv, item, [], ItemOccurence.Use, env.AccessRights) + CallNameResolutionSink cenv.tcSink (outerFieldId.idRange, env.NameEnv, item, [], ItemOccurrence.Use, env.AccessRights) let outerFieldId = ident (outerFieldId.idText, outerFieldId.idRange.MakeSynthetic()) diff --git a/src/Compiler/Checking/ConstraintSolver.fs b/src/Compiler/Checking/ConstraintSolver.fs index 1cdfe136f7d..196a62c3fec 100644 --- a/src/Compiler/Checking/ConstraintSolver.fs +++ b/src/Compiler/Checking/ConstraintSolver.fs @@ -69,6 +69,64 @@ open FSharp.Compiler.TypedTreeOps open FSharp.Compiler.TypeHierarchy open FSharp.Compiler.TypeRelations +#if !NO_TYPEPROVIDERS +open FSharp.Compiler.TypeProviders +#endif + +//------------------------------------------------------------------------- +// Generate type variables and record them in within the scope of the +// compilation environment, which currently corresponds to the scope +// of the constraint resolution carried out by type checking. +//------------------------------------------------------------------------- + +let compgenId = mkSynId Range.range0 unassignedTyparName + +let NewCompGenTypar (kind, rigid, staticReq, dynamicReq, error) = + Construct.NewTypar(kind, rigid, SynTypar(compgenId, staticReq, true), error, dynamicReq, [], false, false) + +let AnonTyparId m = mkSynId m unassignedTyparName + +let NewAnonTypar (kind, m, rigid, var, dyn) = + Construct.NewTypar (kind, rigid, SynTypar(AnonTyparId m, var, true), false, dyn, [], false, false) + +let NewNamedInferenceMeasureVar (_m, rigid, var, id) = + Construct.NewTypar(TyparKind.Measure, rigid, SynTypar(id, var, false), false, TyparDynamicReq.No, [], false, false) + +let NewInferenceMeasurePar () = + NewCompGenTypar (TyparKind.Measure, TyparRigidity.Flexible, TyparStaticReq.None, TyparDynamicReq.No, false) + +let NewErrorTypar () = + NewCompGenTypar (TyparKind.Type, TyparRigidity.Flexible, TyparStaticReq.None, TyparDynamicReq.No, true) + +let NewErrorType () = + mkTyparTy (NewErrorTypar ()) + +let FreshenTypar (g: TcGlobals) rigid (tp: Typar) = + let clearStaticReq = g.langVersion.SupportsFeature LanguageFeature.InterfacesWithAbstractStaticMembers + let staticReq = if clearStaticReq then TyparStaticReq.None else tp.StaticReq + let dynamicReq = if rigid = TyparRigidity.Rigid then TyparDynamicReq.Yes else TyparDynamicReq.No + NewCompGenTypar (tp.Kind, rigid, staticReq, dynamicReq, false) + +// QUERY: should 'rigid' ever really be 'true'? We set this when we know +// we are going to have to generalize a typar, e.g. when implementing a +// abstract generic method slot. But we later check the generalization +// condition anyway, so we could get away with a non-rigid typar. This +// would sort of be cleaner, though give errors later. +let FreshenAndFixupTypars g m rigid fctps tinst tpsorig = + let tps = tpsorig |> List.map (FreshenTypar g rigid) + let renaming, tinst = FixupNewTypars m fctps tinst tpsorig tps + tps, renaming, tinst + +let FreshenTypeInst g m tpsorig = + FreshenAndFixupTypars g m TyparRigidity.Flexible [] [] tpsorig + +let FreshMethInst g m fctps tinst tpsorig = + FreshenAndFixupTypars g m TyparRigidity.Flexible fctps tinst tpsorig + +let FreshenMethInfo m (minfo: MethInfo) = + let _, _, tpTys = FreshMethInst minfo.TcGlobals m (minfo.GetFormalTyparsOfDeclaringType m) minfo.DeclaringTypeInst minfo.FormalMethodTypars + tpTys + //------------------------------------------------------------------------- // Unification of types: solve/record equality constraints // Subsumption of types: solve/record subtyping constraints @@ -161,7 +219,15 @@ exception ConstraintSolverTypesNotInEqualityRelation of displayEnv: DisplayEnv * exception ConstraintSolverTypesNotInSubsumptionRelation of displayEnv: DisplayEnv * argTy: TType * paramTy: TType * callRange: range * parameterRange: range -exception ConstraintSolverMissingConstraint of displayEnv: DisplayEnv * Typar * TyparConstraint * range * range +exception ConstraintSolverMissingConstraint of displayEnv: DisplayEnv * Typar * TyparConstraint * range * range + +exception ConstraintSolverNullnessWarningEquivWithTypes of DisplayEnv * TType * TType * NullnessInfo * NullnessInfo * range * range + +exception ConstraintSolverNullnessWarningWithTypes of DisplayEnv * TType * TType * NullnessInfo * NullnessInfo * range * range + +exception ConstraintSolverNullnessWarningWithType of DisplayEnv * TType * NullnessInfo * range * range + +exception ConstraintSolverNullnessWarning of string * range * range exception ConstraintSolverError of string * range * range @@ -202,6 +268,7 @@ type ConstraintSolverState = /// Checks to run after all inference is complete. PostInferenceChecksFinal: ResizeArray unit> + WarnWhenUsingWithoutNullOnAWithNullTarget: string option } static member New(g, amap, infoReader, tcVal) = @@ -211,7 +278,8 @@ type ConstraintSolverState = InfoReader = infoReader TcVal = tcVal PostInferenceChecksPreDefaults = ResizeArray() - PostInferenceChecksFinal = ResizeArray() } + PostInferenceChecksFinal = ResizeArray() + WarnWhenUsingWithoutNullOnAWithNullTarget = None } member this.PushPostInferenceCheck (preDefaults, check) = if preDefaults then @@ -240,6 +308,9 @@ type ConstraintSolverEnv = // Is this speculative, with a trace allowing undo, and trial method overload resolution IsSpeculativeForMethodOverloading: bool + // Can this ignore the 'must support null' constraint, e.g. in a mutable assignment scenario + IsSupportsNullFlex: bool + /// Indicates that when unifying ty1 = ty2, only type variables in ty1 may be solved. Constraints /// can't be added to type variables in ty2 MatchingOnly: bool @@ -276,6 +347,7 @@ let MakeConstraintSolverEnv contextInfo css m denv = EquivEnv = TypeEquivEnv.Empty DisplayEnv = denv IsSpeculativeForMethodOverloading = false + IsSupportsNullFlex = false ExtraRigidTypars = emptyFreeTypars } @@ -298,7 +370,7 @@ let rec occursCheck g un ty = //------------------------------------------------------------------------- /// Some additional solutions are forced prior to generalization (permitWeakResolution=true). These are, roughly speaking, rules -/// for binary-operand constraints arising from constructs such as "1.0 + x" where "x" is an unknown type. THe constraint here +/// for binary-operand constraints arising from constructs such as "1.0 + x" where "x" is an unknown type. The constraint here /// involves two type parameters - one for the left, and one for the right. The left is already known to be Double. /// In this situation (and in the absence of other evidence prior to generalization), constraint solving forces an assumption that /// the right is also Double - this is "weak" because there is only weak evidence for it. @@ -650,22 +722,23 @@ let SolveTypIsCompatFlex (csenv: ConstraintSolverEnv) trace req ty = else CompleteD -let SubstMeasureWarnIfRigid (csenv: ConstraintSolverEnv) trace (v: Typar) ms = trackErrors { - if v.Rigidity.WarnIfUnified && not (isAnyParTy csenv.g (TType_measure ms)) then - // NOTE: we grab the name eagerly to make sure the type variable prints as a type variable - let tpnmOpt = if v.IsCompilerGenerated then None else Some v.Name - do! SolveTypStaticReq csenv trace v.StaticReq (TType_measure ms) - SubstMeasure v ms - return! WarnD(NonRigidTypar(csenv.DisplayEnv, tpnmOpt, v.Range, TType_measure (Measure.Var v), TType_measure ms, csenv.m)) - else - // Propagate static requirements from 'tp' to 'ty' - do! SolveTypStaticReq csenv trace v.StaticReq (TType_measure ms) - SubstMeasure v ms - if v.Rigidity = TyparRigidity.Anon && measureEquiv csenv.g ms Measure.One then - return! WarnD(Error(FSComp.SR.csCodeLessGeneric(), v.Range)) - else - () - } +let SubstMeasureWarnIfRigid (csenv: ConstraintSolverEnv) trace (v: Typar) ms = + trackErrors { + if v.Rigidity.WarnIfUnified && not (isAnyParTy csenv.g (TType_measure ms)) then + // NOTE: we grab the name eagerly to make sure the type variable prints as a type variable + let tpnmOpt = if v.IsCompilerGenerated then None else Some v.Name + do! SolveTypStaticReq csenv trace v.StaticReq (TType_measure ms) + SubstMeasure v ms + return! WarnD(NonRigidTypar(csenv.DisplayEnv, tpnmOpt, v.Range, TType_measure (Measure.Var v), TType_measure ms, csenv.m)) + else + // Propagate static requirements from 'tp' to 'ty' + do! SolveTypStaticReq csenv trace v.StaticReq (TType_measure ms) + SubstMeasure v ms + if v.Rigidity = TyparRigidity.Anon && measureEquiv csenv.g ms Measure.One then + return! WarnD(Error(FSComp.SR.csCodeLessGeneric(), v.Range)) + else + () + } let IsRigid (csenv: ConstraintSolverEnv) (tp: Typar) = tp.Rigidity = TyparRigidity.Rigid @@ -873,111 +946,198 @@ let CheckWarnIfRigid (csenv: ConstraintSolverEnv) ty1 (r: Typar) ty = /// Add the constraint "ty1 = ty" to the constraint problem, where ty1 is a type variable. /// Propagate all effects of adding this constraint, e.g. to solve other variables -let rec SolveTyparEqualsTypePart1 (csenv: ConstraintSolverEnv) m2 (trace: OptionalTrace) ty1 r ty = trackErrors { - // The types may still be equivalent due to abbreviations, which we are trying not to eliminate - if typeEquiv csenv.g ty1 ty then () else - // The famous 'occursCheck' check to catch "infinite types" like 'a = list<'a> - see also https://github.com/dotnet/fsharp/issues/1170 - if occursCheck csenv.g r ty then return! ErrorD (ConstraintSolverInfiniteTypes(csenv.DisplayEnv, csenv.eContextInfo, ty1, ty, csenv.m, m2)) else - // Note: warn _and_ continue! - do! CheckWarnIfRigid csenv ty1 r ty - // Record the solution before we solve the constraints, since - // We may need to make use of the equation when solving the constraints. - // Record a entry in the undo trace if one is provided - trace.Exec (fun () -> r.typar_solution <- Some ty) (fun () -> r.typar_solution <- None) - } - -and SolveTyparEqualsTypePart2 (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace) (r: Typar) ty = trackErrors { - // Only solve constraints if this is not an error var - if r.IsFromError then () else - - // Check to see if this type variable is relevant to any trait constraints. - // If so, re-solve the relevant constraints. - if csenv.SolverState.ExtraCxs.ContainsKey r.Stamp then - do! RepeatWhileD ndeep (fun ndeep -> SolveRelevantMemberConstraintsForTypar csenv ndeep PermitWeakResolution.No trace r) - - // Re-solve the other constraints associated with this type variable - return! SolveTypMeetsTyparConstraints csenv ndeep m2 trace ty r +let rec SolveTyparEqualsTypePart1 (csenv: ConstraintSolverEnv) m2 (trace: OptionalTrace) ty1 r ty = + trackErrors { + // The types may still be equivalent due to abbreviations, which we are trying not to eliminate + if typeEquiv csenv.g ty1 ty then () else + // The famous 'occursCheck' check to catch "infinite types" like 'a = list<'a> - see also https://github.com/dotnet/fsharp/issues/1170 + if occursCheck csenv.g r ty then return! ErrorD (ConstraintSolverInfiniteTypes(csenv.DisplayEnv, csenv.eContextInfo, ty1, ty, csenv.m, m2)) else + // Note: warn _and_ continue! + do! CheckWarnIfRigid csenv ty1 r ty + // Record the solution before we solve the constraints, since + // We may need to make use of the equation when solving the constraints. + // Record a entry in the undo trace if one is provided + + //let ty1AllowsNull = r.Constraints |> List.exists (function | TyparConstraint.SupportsNull _ -> true | _ -> false ) + //let tyAllowsNull() = TypeNullIsExtraValueNew csenv.g m2 ty + //if ty1AllowsNull && not (tyAllowsNull()) then + // trace.Exec (fun () -> r.typar_solution <- Some (ty |> replaceNullnessOfTy csenv.g.knownWithNull)) (fun () -> r.typar_solution <- None) + //else + // trace.Exec (fun () -> r.typar_solution <- Some ty) (fun () -> r.typar_solution <- None) + trace.Exec (fun () -> r.typar_solution <- Some ty) (fun () -> r.typar_solution <- None) + } + +and SolveTyparEqualsTypePart2 (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace) (r: Typar) ty = + trackErrors { + // Only solve constraints if this is not an error var + if r.IsFromError then () else - } + // Check to see if this type variable is relevant to any trait constraints. + // If so, re-solve the relevant constraints. + if csenv.SolverState.ExtraCxs.ContainsKey r.Stamp then + do! RepeatWhileD ndeep (fun ndeep -> SolveRelevantMemberConstraintsForTypar csenv ndeep PermitWeakResolution.No trace r) -/// Apply the constraints on 'typar' to the type 'ty' -and SolveTypMeetsTyparConstraints (csenv: ConstraintSolverEnv) ndeep m2 trace ty (r: Typar) = trackErrors { - let g = csenv.g + // Re-solve the other constraints associated with this type variable + return! SolveTypMeetsTyparConstraints csenv ndeep m2 trace ty r - // Propagate compat flex requirements from 'tp' to 'ty' - do! SolveTypIsCompatFlex csenv trace r.IsCompatFlex ty + } - // Propagate dynamic requirements from 'tp' to 'ty' - do! SolveTypDynamicReq csenv trace r.DynamicReq ty +/// Apply the constraints on 'typar' to the type 'ty' +and SolveTypMeetsTyparConstraints (csenv: ConstraintSolverEnv) ndeep m2 trace ty (r: Typar) = + trackErrors { + let g = csenv.g - // Propagate static requirements from 'tp' to 'ty' - do! SolveTypStaticReq csenv trace r.StaticReq ty + // Propagate compat flex requirements from 'tp' to 'ty' + do! SolveTypIsCompatFlex csenv trace r.IsCompatFlex ty - if not (g.langVersion.SupportsFeature LanguageFeature.InterfacesWithAbstractStaticMembers) then - // Propagate static requirements from 'tp' to 'ty' - // - // If IWSAMs are not supported then this is done on a per-type-variable basis when constraints - // are applied - see other calls to SolveTypStaticReq + // Propagate dynamic requirements from 'tp' to 'ty' + do! SolveTypDynamicReq csenv trace r.DynamicReq ty + + // Propagate static requirements from 'tp' to 'ty' do! SolveTypStaticReq csenv trace r.StaticReq ty - // Solve constraints on 'tp' w.r.t. 'ty' - for e in r.Constraints do - do! - match e with - | TyparConstraint.DefaultsTo (priority, dty, m) -> - if typeEquiv g ty dty then - CompleteD - else - match tryDestTyparTy g ty with - | ValueNone -> CompleteD - | ValueSome destTypar -> - AddConstraint csenv ndeep m2 trace destTypar (TyparConstraint.DefaultsTo(priority, dty, m)) - - | TyparConstraint.SupportsNull m2 -> SolveTypeUseSupportsNull csenv ndeep m2 trace ty - | TyparConstraint.IsEnum(underlyingTy, m2) -> SolveTypeIsEnum csenv ndeep m2 trace ty underlyingTy - | TyparConstraint.SupportsComparison(m2) -> SolveTypeSupportsComparison csenv ndeep m2 trace ty - | TyparConstraint.SupportsEquality(m2) -> SolveTypeSupportsEquality csenv ndeep m2 trace ty - | TyparConstraint.IsDelegate(aty, bty, m2) -> SolveTypeIsDelegate csenv ndeep m2 trace ty aty bty - | TyparConstraint.IsNonNullableStruct m2 -> SolveTypeIsNonNullableValueType csenv ndeep m2 trace ty - | TyparConstraint.IsUnmanaged m2 -> SolveTypeIsUnmanaged csenv ndeep m2 trace ty - | TyparConstraint.IsReferenceType m2 -> SolveTypeIsReferenceType csenv ndeep m2 trace ty - | TyparConstraint.RequiresDefaultConstructor m2 -> SolveTypeRequiresDefaultConstructor csenv ndeep m2 trace ty - | TyparConstraint.SimpleChoice(tys, m2) -> SolveTypeChoice csenv ndeep m2 trace ty tys - | TyparConstraint.CoercesTo(ty2, m2) -> SolveTypeSubsumesTypeKeepAbbrevs csenv ndeep m2 trace None ty2 ty - | TyparConstraint.MayResolveMember(traitInfo, m2) -> - SolveMemberConstraint csenv false PermitWeakResolution.No ndeep m2 trace traitInfo |> OperationResult.ignore - } + if not (g.langVersion.SupportsFeature LanguageFeature.InterfacesWithAbstractStaticMembers) then + // Propagate static requirements from 'tp' to 'ty' + // + // If IWSAMs are not supported then this is done on a per-type-variable basis when constraints + // are applied - see other calls to SolveTypStaticReq + do! SolveTypStaticReq csenv trace r.StaticReq ty + + // Solve constraints on 'tp' w.r.t. 'ty' + for e in r.Constraints do + do! + match e with + | TyparConstraint.DefaultsTo (priority, dty, m) -> + if typeEquiv g ty dty then + CompleteD + else + match tryDestTyparTy g ty with + | ValueNone -> CompleteD + | ValueSome destTypar -> + AddConstraint csenv ndeep m2 trace destTypar (TyparConstraint.DefaultsTo(priority, dty, m)) + + | TyparConstraint.NotSupportsNull m2 -> SolveTypeUseNotSupportsNull csenv ndeep m2 trace ty + | TyparConstraint.SupportsNull m2 -> SolveTypeUseSupportsNull csenv ndeep m2 trace ty + | TyparConstraint.IsEnum(underlyingTy, m2) -> SolveTypeIsEnum csenv ndeep m2 trace ty underlyingTy + | TyparConstraint.SupportsComparison(m2) -> SolveTypeSupportsComparison csenv ndeep m2 trace ty + | TyparConstraint.SupportsEquality(m2) -> SolveTypeSupportsEquality csenv ndeep m2 trace ty + | TyparConstraint.IsDelegate(aty, bty, m2) -> SolveTypeIsDelegate csenv ndeep m2 trace ty aty bty + | TyparConstraint.IsNonNullableStruct m2 -> SolveTypeIsNonNullableValueType csenv ndeep m2 trace ty + | TyparConstraint.IsUnmanaged m2 -> SolveTypeIsUnmanaged csenv ndeep m2 trace ty + | TyparConstraint.IsReferenceType m2 -> SolveTypeIsReferenceType csenv ndeep m2 trace ty + | TyparConstraint.RequiresDefaultConstructor m2 -> SolveTypeRequiresDefaultConstructor csenv ndeep m2 trace ty + | TyparConstraint.SimpleChoice(tys, m2) -> SolveTypeChoice csenv ndeep m2 trace ty tys + | TyparConstraint.CoercesTo(ty2, m2) -> SolveTypeSubsumesTypeKeepAbbrevs csenv ndeep m2 trace None ty2 ty + | TyparConstraint.MayResolveMember(traitInfo, m2) -> + SolveMemberConstraint csenv false PermitWeakResolution.No ndeep m2 trace traitInfo |> OperationResult.ignore + } + +and shouldWarnUselessNullCheck (csenv:ConstraintSolverEnv) = + csenv.g.checkNullness && + csenv.IsSpeculativeForMethodOverloading = false && + csenv.SolverState.WarnWhenUsingWithoutNullOnAWithNullTarget.IsSome +// nullness1: actual +// nullness2: expected +and SolveNullnessEquiv (csenv: ConstraintSolverEnv) m2 (trace: OptionalTrace) ty1 ty2 nullness1 nullness2 = + match nullness1, nullness2 with + | Nullness.Variable nv1, Nullness.Variable nv2 when nv1 === nv2 -> + CompleteD + | Nullness.Variable nv1, _ when nv1.IsSolved -> + SolveNullnessEquiv csenv m2 trace ty1 ty2 nv1.Solution nullness2 + | _, Nullness.Variable nv2 when nv2.IsSolved -> + SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nv2.Solution + | Nullness.Variable nv1, _ -> + trace.Exec (fun () -> nv1.Set nullness2) (fun () -> nv1.Unset()) + CompleteD + | _, Nullness.Variable nv2 -> + trace.Exec (fun () -> nv2.Set nullness1) (fun () -> nv2.Unset()) + CompleteD + | Nullness.Known n1, Nullness.Known n2 -> + match n1, n2 with + | NullnessInfo.AmbivalentToNull, _ -> CompleteD + | _, NullnessInfo.AmbivalentToNull -> CompleteD + | NullnessInfo.WithNull, NullnessInfo.WithNull -> CompleteD + | NullnessInfo.WithoutNull, NullnessInfo.WithoutNull -> CompleteD + // Warn for 'strict "must pass null"` APIs like Option.ofObj + | NullnessInfo.WithNull, NullnessInfo.WithoutNull when shouldWarnUselessNullCheck csenv -> + WarnD(Error(FSComp.SR.tcPassingWithoutNullToANullableExpectingFunc (csenv.SolverState.WarnWhenUsingWithoutNullOnAWithNullTarget.Value),m2)) + // Allow expected of WithNull and actual of WithoutNull except for specially marked APIs (handled above) + | NullnessInfo.WithNull, NullnessInfo.WithoutNull -> CompleteD + | _ -> + if csenv.g.checkNullness then + WarnD(ConstraintSolverNullnessWarningEquivWithTypes(csenv.DisplayEnv, ty1, ty2, n1, n2, csenv.m, m2)) + else + CompleteD -and SolveTyparEqualsType (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace) ty1 ty = trackErrors { - let m = csenv.m - do! DepthCheck ndeep m - match ty1 with - | TType_var (r, _) - | TType_measure (Measure.Var r) -> - do! SolveTyparEqualsTypePart1 csenv m2 trace ty1 r ty - do! SolveTyparEqualsTypePart2 csenv ndeep m2 trace r ty - | _ -> failwith "SolveTyparEqualsType" +// nullness1: target +// nullness2: source +and SolveNullnessSubsumesNullness (csenv: ConstraintSolverEnv) m2 (trace: OptionalTrace) ty1 ty2 nullness1 nullness2 = + match nullness1, nullness2 with + | Nullness.Variable nv1, Nullness.Variable nv2 when nv1 === nv2 -> + CompleteD + | Nullness.Variable nv1, _ when nv1.IsSolved -> + SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 nv1.Solution nullness2 + | _, Nullness.Variable nv2 when nv2.IsSolved -> + SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 nullness1 nv2.Solution + | Nullness.Variable _nv1, Nullness.Known NullnessInfo.WithoutNull -> + CompleteD + | Nullness.Variable nv1, _ -> + trace.Exec (fun () -> nv1.Set nullness2) (fun () -> nv1.Unset()) + CompleteD + | _, Nullness.Variable nv2 -> + trace.Exec (fun () -> nv2.Set nullness1) (fun () -> nv2.Unset()) + CompleteD + | Nullness.Known n1, Nullness.Known n2 -> + match n1, n2 with + | NullnessInfo.AmbivalentToNull, _ -> CompleteD + | _, NullnessInfo.AmbivalentToNull -> CompleteD + | NullnessInfo.WithNull, NullnessInfo.WithNull -> CompleteD + | NullnessInfo.WithoutNull, NullnessInfo.WithoutNull -> CompleteD + // Warn for 'strict "must pass null"` APIs like Option.ofObj + | NullnessInfo.WithNull, NullnessInfo.WithoutNull when shouldWarnUselessNullCheck csenv -> + WarnD(Error(FSComp.SR.tcPassingWithoutNullToANullableExpectingFunc (csenv.SolverState.WarnWhenUsingWithoutNullOnAWithNullTarget.Value),m2)) + // Allow target of WithNull and actual of WithoutNull + | NullnessInfo.WithNull, NullnessInfo.WithoutNull -> + CompleteD + | NullnessInfo.WithoutNull, NullnessInfo.WithNull -> + if csenv.g.checkNullness && not csenv.IsSpeculativeForMethodOverloading then + WarnD(ConstraintSolverNullnessWarningWithTypes(csenv.DisplayEnv, ty1, ty2, n1, n2, csenv.m, m2)) + else + CompleteD + +and SolveTyparEqualsType (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace) ty1 ty = + trackErrors { + let m = csenv.m + do! DepthCheck ndeep m + match ty1 with + | TType_var (r, _) + | TType_measure (Measure.Var r) -> + do! SolveTyparEqualsTypePart1 csenv m2 trace ty1 r ty + do! SolveTyparEqualsTypePart2 csenv ndeep m2 trace r ty + | _ -> failwith "SolveTyparEqualsType" } // Like SolveTyparEqualsType but asserts all typar equalities simultaneously instead of one by one -and SolveTyparsEqualTypes (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace) tpTys tys = trackErrors { - do! (tpTys, tys) ||> Iterate2D (fun tpTy ty -> - match tpTy with - | TType_var (r, _) - | TType_measure (Measure.Var r) -> - SolveTyparEqualsTypePart1 csenv m2 trace tpTy r ty - | _ -> - failwith "SolveTyparsEqualTypes") - - do! (tpTys, tys) ||> Iterate2D (fun tpTy ty -> - match tpTy with - | TType_var (r, _) - | TType_measure (Measure.Var r) -> - SolveTyparEqualsTypePart2 csenv ndeep m2 trace r ty - | _ -> - failwith "SolveTyparsEqualTypes") - } +and SolveTyparsEqualTypes (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace) tpTys tys = + trackErrors { + do! Iterate2D ( + fun tpTy ty -> + match tpTy with + | TType_var (r, _) + | TType_measure (Measure.Var r) -> + SolveTyparEqualsTypePart1 csenv m2 trace tpTy r ty + | _ -> + failwith "SolveTyparsEqualTypes") tpTys tys + do! Iterate2D ( + fun tpTy ty -> + match tpTy with + | TType_var (r, _) + | TType_measure (Measure.Var r) -> + SolveTyparEqualsTypePart2 csenv ndeep m2 trace r ty + | _ -> + failwith "SolveTyparsEqualTypes") tpTys tys + } and SolveAnonInfoEqualsAnonInfo (csenv: ConstraintSolverEnv) m2 (anonInfo1: AnonRecdTypeInfo) (anonInfo2: AnonRecdTypeInfo) = if evalTupInfoIsStruct anonInfo1.TupInfo <> evalTupInfoIsStruct anonInfo2.TupInfo then @@ -1070,59 +1230,153 @@ and SolveTypeEqualsType (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTr let sty1 = stripTyEqnsA csenv.g canShortcut ty1 let sty2 = stripTyEqnsA csenv.g canShortcut ty2 - match sty1, sty2 with + let csenv = + match ty1 with + | TType.TType_var(r,_) when r.typar_flags.IsSupportsNullFlex -> + { csenv with IsSupportsNullFlex = true} + | _ -> csenv + match sty1, sty2 with // type vars inside forall-types may be alpha-equivalent - | TType_var (tp1, _), TType_var (tp2, _) when typarEq tp1 tp2 || (match aenv.EquivTypars.TryFind tp1 with | Some tpTy1 when typeEquiv g tpTy1 ty2 -> true | _ -> false) -> - CompleteD + | TType_var (tp1, nullness1), TType_var (tp2, nullness2) when typarEq tp1 tp2 || (match aenv.EquivTypars.TryFind tp1 with | Some tpTy1 when typeEquiv g tpTy1 ty2 -> true | _ -> false) -> + SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nullness2 + + | TType_var (tp1, nullness1), TType_var (tp2, nullness2) when PreferUnifyTypar tp1 tp2 -> + match nullness1.TryEvaluate(), nullness2.TryEvaluate() with + // Unifying 'T1? and 'T2? + | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithNull -> + SolveTyparEqualsType csenv ndeep m2 trace sty1 (TType_var (tp2, g.knownWithoutNull)) + | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithoutNull -> + let tpNew = NewCompGenTypar(TyparKind.Type, TyparRigidity.Flexible, TyparStaticReq.None, TyparDynamicReq.No, false) + trackErrors { + do! SolveTypeEqualsType csenv ndeep m2 trace cxsln sty2 (TType_var(tpNew, g.knownWithNull)) + do! SolveTypeEqualsType csenv ndeep m2 trace cxsln (TType_var(tpNew, g.knownWithoutNull)) sty1 + } + //// Unifying 'T1 % and 'T2 % + //| ValueSome NullnessInfo.AmbivalentToNull, ValueSome NullnessInfo.AmbivalentToNull -> + // SolveTyparEqualsType csenv ndeep m2 trace sty1 (TType_var (tp2, g.knownWithoutNull)) + | _ -> + trackErrors { + do! SolveTyparEqualsType csenv ndeep m2 trace sty1 ty2 + let nullnessAfterSolution1 = combineNullness (nullnessOfTy g sty1) nullness1 + do! SolveNullnessEquiv csenv m2 trace ty1 ty2 nullnessAfterSolution1 nullness2 + } - // 'v1 = 'v2 - | TType_var (tp1, _), TType_var (tp2, _) when PreferUnifyTypar tp1 tp2 -> - SolveTyparEqualsType csenv ndeep m2 trace sty1 ty2 - // 'v1 = 'v2 - | TType_var (tp1, _), TType_var (tp2, _) when not csenv.MatchingOnly && PreferUnifyTypar tp2 tp1 -> - SolveTyparEqualsType csenv ndeep m2 trace sty2 ty1 + | TType_var (tp1, nullness1), TType_var (tp2, nullness2) when not csenv.MatchingOnly && PreferUnifyTypar tp2 tp1 -> + match nullness1.TryEvaluate(), nullness2.TryEvaluate() with + // Unifying 'T1? and 'T2? + | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithNull -> + SolveTyparEqualsType csenv ndeep m2 trace sty2 (TType_var (tp1, g.knownWithoutNull)) + | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithoutNull -> + let tpNew = NewCompGenTypar(TyparKind.Type, TyparRigidity.Flexible, TyparStaticReq.None, TyparDynamicReq.No, false) + trackErrors { + do! SolveTypeEqualsType csenv ndeep m2 trace cxsln sty2 (TType_var(tpNew, g.knownWithNull)) + do! SolveTypeEqualsType csenv ndeep m2 trace cxsln (TType_var(tpNew, g.knownWithoutNull)) sty1 + } + //// Unifying 'T1 % and 'T2 % + //| ValueSome NullnessInfo.AmbivalentToNull, ValueSome NullnessInfo.AmbivalentToNull -> + // SolveTyparEqualsType csenv ndeep m2 trace sty2 (TType_var (tp1, g.knownWithoutNull)) + | _ -> + // Unifying 'T1 ? and 'T2 % + // Unifying 'T1 % and 'T2 ? + trackErrors { + do! SolveTyparEqualsType csenv ndeep m2 trace sty2 ty1 + let nullnessAfterSolution2 = combineNullness (nullnessOfTy g sty2) nullness2 + do! SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nullnessAfterSolution2 + } - | TType_var (r, _), _ when not (IsRigid csenv r) -> - SolveTyparEqualsType csenv ndeep m2 trace sty1 ty2 + | TType_var (tp1, nullness1), _ when not (IsRigid csenv tp1) -> + match nullness1.TryEvaluate(), (nullnessOfTy g sty2).TryEvaluate() with + // Unifying 'T1? and 'T2? + | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithNull -> + SolveTyparEqualsType csenv ndeep m2 trace sty1 (replaceNullnessOfTy g.knownWithoutNull sty2) + | ValueSome NullnessInfo.WithoutNull, ValueSome NullnessInfo.WithoutNull when + csenv.IsSupportsNullFlex && + isAppTy g sty2 && + tp1.Constraints |> List.exists (function TyparConstraint.SupportsNull _ -> true | _ -> false) -> + let tpNew = NewCompGenTypar(TyparKind.Type, TyparRigidity.Flexible, TyparStaticReq.None, TyparDynamicReq.No, false) + trackErrors { + do! SolveTypeEqualsType csenv ndeep m2 trace cxsln (TType_var(tpNew, g.knownWithoutNull)) sty2 + do! SolveTypeEqualsType csenv ndeep m2 trace cxsln ty1 (TType_var(tpNew, g.knownWithNull)) + } + // Unifying 'T1 % and 'T2 % + //| ValueSome NullnessInfo.AmbivalentToNull, ValueSome NullnessInfo.AmbivalentToNull -> + // SolveTyparEqualsType csenv ndeep m2 trace sty1 (replaceNullnessOfTy g.knownWithoutNull sty2) + | _ -> + trackErrors { + do! SolveTyparEqualsType csenv ndeep m2 trace sty1 ty2 + let nullnessAfterSolution1 = combineNullness (nullnessOfTy g sty1) nullness1 + do! SolveNullnessEquiv csenv m2 trace ty1 ty2 nullnessAfterSolution1 (nullnessOfTy g sty2) + } - | _, TType_var (r, _) when not csenv.MatchingOnly && not (IsRigid csenv r) -> - SolveTyparEqualsType csenv ndeep m2 trace sty2 ty1 + | _, TType_var (tp2, nullness2) when not csenv.MatchingOnly && not (IsRigid csenv tp2) -> + match (nullnessOfTy g sty1).TryEvaluate(), nullness2.TryEvaluate() with + // Unifying 'T1? and 'T2? + | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithNull -> + SolveTyparEqualsType csenv ndeep m2 trace sty2 (replaceNullnessOfTy g.knownWithoutNull sty1) + // Unifying 'T1 % and 'T2 % + //| ValueSome NullnessInfo.AmbivalentToNull, ValueSome NullnessInfo.AmbivalentToNull -> + // SolveTyparEqualsType csenv ndeep m2 trace sty2 (replaceNullnessOfTy g.knownWithoutNull sty1) + | _ -> + trackErrors { + do! SolveTyparEqualsType csenv ndeep m2 trace sty2 ty1 + let nullnessAfterSolution2 = combineNullness (nullnessOfTy g sty2) nullness2 + do! SolveNullnessEquiv csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) nullnessAfterSolution2 + } // Catch float<_>=float<1>, float32<_>=float32<1> and decimal<_>=decimal<1> - | _, TType_app (tc2, [ms], _) when (tc2.IsMeasureableReprTycon && typeEquiv csenv.g sty1 (reduceTyconRefMeasureableOrProvided csenv.g tc2 [ms])) -> - SolveTypeEqualsType csenv ndeep m2 trace None ms (TType_measure Measure.One) + | (_, TType_app (tc2, [ms2], _)) when (tc2.IsMeasureableReprTycon && typeEquiv csenv.g sty1 (reduceTyconRefMeasureableOrProvided csenv.g tc2 [ms2])) -> + trackErrors { + do! SolveTypeEqualsType csenv ndeep m2 trace None (TType_measure Measure.One) ms2 + do! SolveNullnessEquiv csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) (nullnessOfTy g sty2) + } - | TType_app (tc2, [ms], _), _ when (tc2.IsMeasureableReprTycon && typeEquiv csenv.g sty2 (reduceTyconRefMeasureableOrProvided csenv.g tc2 [ms])) -> - SolveTypeEqualsType csenv ndeep m2 trace None ms (TType_measure Measure.One) + | (TType_app (tc1, [ms1], _), _) when (tc1.IsMeasureableReprTycon && typeEquiv csenv.g sty2 (reduceTyconRefMeasureableOrProvided csenv.g tc1 [ms1])) -> + trackErrors { + do! SolveTypeEqualsType csenv ndeep m2 trace None ms1 (TType_measure Measure.One) + do! SolveNullnessEquiv csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) (nullnessOfTy g sty2) + } | TType_app (tc1, l1, _), TType_app (tc2, l2, _) when tyconRefEq g tc1 tc2 -> - SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 - + trackErrors { + do! SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 + do! SolveNullnessEquiv csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) (nullnessOfTy g sty2) + } | TType_app _, TType_app _ -> localAbortD - | TType_tuple (tupInfo1, l1), TType_tuple (tupInfo2, l2) -> - if evalTupInfoIsStruct tupInfo1 <> evalTupInfoIsStruct tupInfo2 then ErrorD (ConstraintSolverError(FSComp.SR.tcTupleStructMismatch(), csenv.m, m2)) else - SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 + | TType_tuple (tupInfo1, l1), TType_tuple (tupInfo2, l2) -> + if evalTupInfoIsStruct tupInfo1 <> evalTupInfoIsStruct tupInfo2 then + ErrorD (ConstraintSolverError(FSComp.SR.tcTupleStructMismatch(), csenv.m, m2)) + else + SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 - | TType_anon (anonInfo1, l1),TType_anon (anonInfo2, l2) -> trackErrors { + | TType_anon (anonInfo1, l1),TType_anon (anonInfo2, l2) -> + trackErrors { do! SolveAnonInfoEqualsAnonInfo csenv m2 anonInfo1 anonInfo2 do! SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 - } - | TType_fun (domainTy1, rangeTy1, _), TType_fun (domainTy2, rangeTy2, _) -> - SolveFunTypeEqn csenv ndeep m2 trace None domainTy1 domainTy2 rangeTy1 rangeTy2 + } + + | TType_fun (domainTy1, rangeTy1, nullness1), TType_fun (domainTy2, rangeTy2, nullness2) -> + trackErrors { + do! SolveFunTypeEqn csenv ndeep m2 trace None domainTy1 domainTy2 rangeTy1 rangeTy2 + do! SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nullness2 + } | TType_measure ms1, TType_measure ms2 -> UnifyMeasures csenv trace ms1 ms2 - | TType_forall(tps1, bodyTy1), TType_forall(tps2, bodyTy2) -> - if tps1.Length <> tps2.Length then localAbortD else - let aenv = aenv.BindEquivTypars tps1 tps2 - let csenv = {csenv with EquivEnv = aenv } - if not (typarsAEquiv g aenv tps1 tps2) then localAbortD else - SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace bodyTy1 bodyTy2 + | TType_forall(tps1, bodyTy1), TType_forall(tps2, bodyTy2) -> + if tps1.Length <> tps2.Length then + localAbortD + else + let aenv = aenv.BindEquivTypars tps1 tps2 + let csenv = {csenv with EquivEnv = aenv } + if not (typarsAEquiv g aenv tps1 tps2) then + localAbortD + else + SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace bodyTy1 bodyTy2 | TType_ucase (uc1, l1), TType_ucase (uc2, l2) when g.unionCaseRefEq uc1 uc2 -> SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 @@ -1140,14 +1394,14 @@ and private SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln t | LocallyAbortOperationThatLosesAbbrevs -> ErrorD(ConstraintSolverTypesNotInEqualityRelation(csenv.DisplayEnv, ty1, ty2, csenv.m, m2, csenv.eContextInfo)) | err -> ErrorD err) -and SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln origl1 origl2 = - match origl1, origl2 with - | [], [] -> CompleteD - | _ -> +and SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln origl1 origl2 = + match origl1, origl2 with + | [], [] -> CompleteD + | _ -> // We unwind Iterate2D by hand here for performance reasons. - let rec loop l1 l2 = - match l1, l2 with - | [], [] -> CompleteD + let rec loop l1 l2 = + match l1, l2 with + | [], [] -> CompleteD | h1 :: t1, h2 :: t2 when t1.Length = t2.Length -> trackErrors { do! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln h1 h2 @@ -1157,10 +1411,43 @@ and SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln origl1 origl2 = ErrorD(ConstraintSolverTupleDiffLengths(csenv.DisplayEnv, csenv.eContextInfo, origl1, origl2, csenv.m, m2)) loop origl1 origl2 -and SolveFunTypeEqn csenv ndeep m2 trace cxsln domainTy1 domainTy2 rangeTy1 rangeTy2 = trackErrors { - do! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln domainTy1 domainTy2 - return! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln rangeTy1 rangeTy2 - } +and SolveTypeEqualsTypeWithContravarianceEqns (csenv:ConstraintSolverEnv) ndeep m2 trace cxsln origl1 origl2 typars = + let isContravariant (t:Typar) = + t.typar_opt_data + |> Option.map (fun d -> d.typar_is_contravariant) + |> Option.defaultValue(false) + + match origl1, origl2, typars with + | [], [], [] -> CompleteD + | _ -> + // We unwind Iterate2D by hand here for performance reasons. + let rec loop l1 l2 tps = + match l1, l2, tps with + | [], [], [] -> CompleteD + | h1 :: t1, h2 :: t2, hTp :: tTps when t1.Length = t2.Length && t1.Length = tTps.Length -> + trackErrors { + let h1 = + // For contravariant typars (` in C#'), if the required type is WithNull, the actual type can have any nullness it wants + // Without this added logic, their nullness would be forced to be equal. + if isContravariant hTp && (nullnessOfTy csenv.g h2).TryEvaluate() = ValueSome NullnessInfo.WithNull then + replaceNullnessOfTy csenv.g.knownWithNull h1 + else + h1 + + do! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln h1 h2 + do! loop t1 t2 tTps + } + | _ -> + ErrorD(ConstraintSolverTupleDiffLengths(csenv.DisplayEnv, csenv.eContextInfo, origl1, origl2, csenv.m, m2)) + loop origl1 origl2 typars + +and SolveFunTypeEqn csenv ndeep m2 trace cxsln domainTy1 domainTy2 rangeTy1 rangeTy2 = + trackErrors { + let g = csenv.g + let domainTy2 = reqTyForArgumentNullnessInference g domainTy1 domainTy2 + do! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln domainTy2 domainTy1 + return! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln rangeTy1 rangeTy2 + } // ty1: expected // ty2: actual @@ -1181,60 +1468,83 @@ and SolveTypeSubsumesType (csenv: ConstraintSolverEnv) ndeep m2 (trace: Optional let denv = csenv.DisplayEnv match sty1, sty2 with - | TType_var (tp1, _), _ -> + | TType_var (tp1, nullness1) , _ -> match aenv.EquivTypars.TryFind tp1 with | Some tpTy1 -> SolveTypeSubsumesType csenv ndeep m2 trace cxsln tpTy1 ty2 | _ -> match sty2 with - | TType_var (r2, _) when typarEq tp1 r2 -> CompleteD - | TType_var (r, _) when not csenv.MatchingOnly -> SolveTyparSubtypeOfType csenv ndeep m2 trace r ty1 + | TType_var (r2, nullness2) when typarEq tp1 r2 -> + SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nullness2 + | TType_var (r2, nullness2) when not csenv.MatchingOnly -> + trackErrors { + do! SolveTyparSubtypeOfType csenv ndeep m2 trace r2 ty1 + let nullnessAfterSolution2 = combineNullness (nullnessOfTy g sty2) nullness2 + do! SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 nullness1 nullnessAfterSolution2 + } | _ -> SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ty1 ty2 - | _, TType_var (r, _) when not csenv.MatchingOnly -> - SolveTyparSubtypeOfType csenv ndeep m2 trace r ty1 - - | TType_tuple (tupInfo1, l1), TType_tuple (tupInfo2, l2) -> - if evalTupInfoIsStruct tupInfo1 <> evalTupInfoIsStruct tupInfo2 then ErrorD (ConstraintSolverError(FSComp.SR.tcTupleStructMismatch(), csenv.m, m2)) else - SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2 (* nb. can unify since no variance *) + | _, TType_var (r2, nullness2) when not csenv.MatchingOnly -> + trackErrors { + do! SolveTyparSubtypeOfType csenv ndeep m2 trace r2 ty1 + let nullnessAfterSolution2 = combineNullness (nullnessOfTy g sty2) nullness2 + do! SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) nullnessAfterSolution2 + } - | TType_anon (anonInfo1, l1), TType_anon (anonInfo2, l2) -> trackErrors { + | TType_tuple (tupInfo1, l1), TType_tuple (tupInfo2, l2) -> + if evalTupInfoIsStruct tupInfo1 <> evalTupInfoIsStruct tupInfo2 then + ErrorD (ConstraintSolverError(FSComp.SR.tcTupleStructMismatch(), csenv.m, m2)) + else + SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2 (* nb. can unify since no variance *) + | TType_fun (domainTy1, rangeTy1, nullness1), TType_fun (domainTy2, rangeTy2, nullness2) -> + // nb. can unify since no variance + trackErrors { + do! SolveFunTypeEqn csenv ndeep m2 trace cxsln domainTy1 domainTy2 rangeTy1 rangeTy2 + do! SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 nullness1 nullness2 + } + | TType_anon (anonInfo1, l1), TType_anon (anonInfo2, l2) -> + trackErrors { do! SolveAnonInfoEqualsAnonInfo csenv m2 anonInfo1 anonInfo2 - do! SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2 (* nb. can unify since no variance *) + do! SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2 } - - | TType_fun (domainTy1, rangeTy1, _), TType_fun (domainTy2, rangeTy2, _) -> - SolveFunTypeEqn csenv ndeep m2 trace cxsln domainTy1 domainTy2 rangeTy1 rangeTy2 (* nb. can unify since no variance *) - | TType_measure ms1, TType_measure ms2 -> UnifyMeasures csenv trace ms1 ms2 // Enforce the identities float=float<1>, float32=float32<1> and decimal=decimal<1> - | _, TType_app (tc2, [ms], _) when (tc2.IsMeasureableReprTycon && typeEquiv csenv.g sty1 (reduceTyconRefMeasureableOrProvided csenv.g tc2 [ms])) -> - SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ms (TType_measure Measure.One) + | _, TType_app (tc2, [ms2], _) when tc2.IsMeasureableReprTycon && typeEquiv csenv.g sty1 (reduceTyconRefMeasureableOrProvided csenv.g tc2 [ms2]) -> + trackErrors { + do! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ms2 (TType_measure Measure.One) + do! SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) (nullnessOfTy g sty2) + } - | TType_app (tc2, [ms], _), _ when (tc2.IsMeasureableReprTycon && typeEquiv csenv.g sty2 (reduceTyconRefMeasureableOrProvided csenv.g tc2 [ms])) -> - SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ms (TType_measure Measure.One) + | TType_app (tc1, [ms1], _), _ when tc1.IsMeasureableReprTycon && typeEquiv csenv.g sty2 (reduceTyconRefMeasureableOrProvided csenv.g tc1 [ms1]) -> + trackErrors { + do! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ms1 (TType_measure Measure.One) + do! SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) (nullnessOfTy g sty2) + } // Special subsumption rule for byref tags - | TType_app (tc1, l1, _), TType_app (tc2, l2, _) when tyconRefEq g tc1 tc2 && g.byref2_tcr.CanDeref && tyconRefEq g g.byref2_tcr tc1 -> - match l1, l2 with + | TType_app (tc1, l1, _) , TType_app (tc2, l2, _) when tyconRefEq g tc1 tc2 && g.byref2_tcr.CanDeref && tyconRefEq g g.byref2_tcr tc1 -> + match l1, l2 with | [ h1; tag1 ], [ h2; tag2 ] -> trackErrors { do! SolveTypeEqualsType csenv ndeep m2 trace None h1 h2 - match stripTyEqnsA csenv.g canShortcut tag1, stripTyEqnsA csenv.g canShortcut tag2 with - | TType_app(tagc1, [], _), TType_app(tagc2, [], _) - when (tyconRefEq g tagc2 g.byrefkind_InOut_tcr && + match stripTyEqnsA csenv.g canShortcut tag1, stripTyEqnsA csenv.g canShortcut tag2 with + | TType_app(tagc1, [], _), TType_app(tagc2, [], _) + when (tyconRefEq g tagc2 g.byrefkind_InOut_tcr && (tyconRefEq g tagc1 g.byrefkind_In_tcr || tyconRefEq g tagc1 g.byrefkind_Out_tcr) ) -> () | _ -> return! SolveTypeEqualsType csenv ndeep m2 trace cxsln tag1 tag2 } - | _ -> SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2 + | _ -> SolveTypeEqualsTypeWithContravarianceEqns csenv ndeep m2 trace cxsln l1 l2 tc1.TyparsNoRange - | TType_app (tc1, l1, _), TType_app (tc2, l2, _) when tyconRefEq g tc1 tc2 -> - SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2 + | TType_app (tc1, l1, _) , TType_app (tc2, l2, _) when tyconRefEq g tc1 tc2 -> + trackErrors { + do! SolveTypeEqualsTypeWithContravarianceEqns csenv ndeep m2 trace cxsln l1 l2 tc1.TyparsNoRange + do! SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) (nullnessOfTy g sty2) + } | TType_ucase (uc1, l1), TType_ucase (uc2, l2) when g.unionCaseRefEq uc1 uc2 -> SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2 - | _ -> + | _ -> // By now we know the type is not a variable type // C :> obj ---> @@ -1298,7 +1608,7 @@ and DepthCheck ndeep m = and SolveDimensionlessNumericType (csenv: ConstraintSolverEnv) ndeep m2 trace ty = match getMeasureOfType csenv.g ty with | Some (tcref, _) -> - SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace ty (mkAppTy tcref [TType_measure Measure.One]) + SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace ty (mkWoNullAppTy tcref [TType_measure Measure.One]) | None -> CompleteD @@ -1310,434 +1620,439 @@ and SolveDimensionlessNumericType (csenv: ConstraintSolverEnv) ndeep m2 trace ty /// will deal with the problem. /// /// 2. Some additional solutions are forced prior to generalization (permitWeakResolution= Yes or YesDuringCodeGen). See above -and SolveMemberConstraint (csenv: ConstraintSolverEnv) ignoreUnresolvedOverload permitWeakResolution ndeep m2 trace traitInfo : OperationResult = trackErrors { - let (TTrait(supportTys, nm, memFlags, traitObjAndArgTys, retTy, source, sln)) = traitInfo - // Do not re-solve if already solved - if sln.Value.IsSome then return true else +and SolveMemberConstraint (csenv: ConstraintSolverEnv) ignoreUnresolvedOverload permitWeakResolution ndeep m2 trace traitInfo : OperationResult = + trackErrors { + let (TTrait(supportTys, nm, memFlags, traitObjAndArgTys, retTy, source, sln)) = traitInfo + // Do not re-solve if already solved + if sln.Value.IsSome then return true else - let g = csenv.g - let m = csenv.m - let amap = csenv.amap - let aenv = csenv.EquivEnv - let denv = csenv.DisplayEnv + let g = csenv.g + let m = csenv.m + let amap = csenv.amap + let aenv = csenv.EquivEnv + let denv = csenv.DisplayEnv - let ndeep = ndeep + 1 - do! DepthCheck ndeep m + let ndeep = ndeep + 1 + do! DepthCheck ndeep m - // Remove duplicates from the set of types in the support - let supportTys = ListSet.setify (typeAEquiv g aenv) supportTys + // Remove duplicates from the set of types in the support + let supportTys = ListSet.setify (typeAEquiv g aenv) supportTys - // Rebuild the trait info after removing duplicates - let traitInfo = traitInfo.WithSupportTypes supportTys - let retTy = GetFSharpViewOfReturnType g retTy - - // Assert the object type if the constraint is for an instance member - if memFlags.IsInstance then - match supportTys, traitObjAndArgTys with - | [ty], h :: _ -> do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace h ty - | _ -> do! ErrorD (ConstraintSolverError(FSComp.SR.csExpectedArguments(), m, m2)) - - // Trait calls are only supported on pseudo type (variables) - if not (g.langVersion.SupportsFeature LanguageFeature.InterfacesWithAbstractStaticMembers) then - for e in supportTys do - do! SolveTypStaticReq csenv trace TyparStaticReq.HeadType e - - // SRTP constraints on rigid type parameters do not need to be solved - let isRigid = - supportTys |> List.forall (fun ty -> - match tryDestTyparTy g ty with - | ValueSome tp -> - match tp.Rigidity with - | TyparRigidity.Rigid - | TyparRigidity.WillBeRigid -> true - | _ -> false - | ValueNone -> false) + // Rebuild the trait info after removing duplicates + let traitInfo = traitInfo.WithSupportTypes supportTys + let retTy = GetFSharpViewOfReturnType g retTy + + // Assert the object type if the constraint is for an instance member + if memFlags.IsInstance then + match supportTys, traitObjAndArgTys with + | [ty], h :: _ -> do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace h ty + | _ -> do! ErrorD (ConstraintSolverError(FSComp.SR.csExpectedArguments(), m, m2)) + + // Trait calls are only supported on pseudo type (variables) + if not (g.langVersion.SupportsFeature LanguageFeature.InterfacesWithAbstractStaticMembers) then + for e in supportTys do + do! SolveTypStaticReq csenv trace TyparStaticReq.HeadType e + + // SRTP constraints on rigid type parameters do not need to be solved + let isRigid = + supportTys |> List.forall (fun ty -> + match tryDestTyparTy g ty with + | ValueSome tp -> + match tp.Rigidity with + | TyparRigidity.Rigid + | TyparRigidity.WillBeRigid -> true + | _ -> false + | ValueNone -> false) - let argTys = if memFlags.IsInstance then List.tail traitObjAndArgTys else traitObjAndArgTys + let argTys = if memFlags.IsInstance then List.tail traitObjAndArgTys else traitObjAndArgTys - let minfos = GetRelevantMethodsForTrait csenv permitWeakResolution nm traitInfo - - let! res = - trackErrors { - match minfos, supportTys, memFlags.IsInstance, nm, argTys with - | _, _, false, ("op_Division" | "op_Multiply"), [argTy1;argTy2] - when - // This simulates the existence of - // float * float -> float - // float32 * float32 -> float32 - // float<'u> * float<'v> -> float<'u 'v> - // float32<'u> * float32<'v> -> float32<'u 'v> - // decimal<'u> * decimal<'v> -> decimal<'u 'v> - // decimal<'u> * decimal -> decimal<'u> - // float32<'u> * float32<'v> -> float32<'u 'v> - // int * int -> int - // int64 * int64 -> int64 - // - // The rule is triggered by these sorts of inputs when permitWeakResolution=false - // float * float - // float * float32 // will give error - // decimal * decimal - // decimal * decimal <-- Note this one triggers even though "decimal" has some possibly-relevant methods - // float * Matrix // the rule doesn't trigger for this one since Matrix has overloads we can use and we prefer those instead - // float * Matrix // the rule doesn't trigger for this one since Matrix has overloads we can use and we prefer those instead - // - // The rule is triggered by these sorts of inputs when permitWeakResolution=true - // float * 'a - // 'a * float - // decimal<'u> * 'a - (let checkRuleAppliesInPreferenceToMethods argTy1 argTy2 = - // Check that at least one of the argument types is numeric - IsNumericOrIntegralEnumType g argTy1 && - // Check the other type is nominal, unless using weak resolution - IsBinaryOpOtherArgType g permitWeakResolution argTy2 && - // This next condition checks that either - // - Neither type contributes any methods OR - // - We have the special case "decimal<_> * decimal". In this case we have some - // possibly-relevant methods from "decimal" but we ignore them in this case. - (isNil minfos || (Option.isSome (getMeasureOfType g argTy1) && isDecimalTy g argTy2)) in - - checkRuleAppliesInPreferenceToMethods argTy1 argTy2 || - checkRuleAppliesInPreferenceToMethods argTy2 argTy1) -> - - match getMeasureOfType g argTy1 with - | Some (tcref, ms1) -> - let ms2 = freshMeasure () - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 (mkAppTy tcref [TType_measure ms2]) - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy (mkAppTy tcref [TType_measure (Measure.Prod(ms1, if nm = "op_Multiply" then ms2 else Measure.Inv ms2))]) - return TTraitBuiltIn - - | _ -> - - match getMeasureOfType g argTy2 with - | Some (tcref, ms2) -> - let ms1 = freshMeasure () - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy1 (mkAppTy tcref [TType_measure ms1]) - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy (mkAppTy tcref [TType_measure (Measure.Prod(ms1, if nm = "op_Multiply" then ms2 else Measure.Inv ms2))]) - return TTraitBuiltIn + let minfos = GetRelevantMethodsForTrait csenv permitWeakResolution nm traitInfo - | _ -> + let! res = + trackErrors { + match minfos, supportTys, memFlags.IsInstance, nm, argTys with + | _, _, false, ("op_Division" | "op_Multiply"), [argTy1;argTy2] + when + // This simulates the existence of + // float * float -> float + // float32 * float32 -> float32 + // float<'u> * float<'v> -> float<'u 'v> + // float32<'u> * float32<'v> -> float32<'u 'v> + // decimal<'u> * decimal<'v> -> decimal<'u 'v> + // decimal<'u> * decimal -> decimal<'u> + // float32<'u> * float32<'v> -> float32<'u 'v> + // int * int -> int + // int64 * int64 -> int64 + // + // The rule is triggered by these sorts of inputs when permitWeakResolution=false + // float * float + // float * float32 // will give error + // decimal * decimal + // decimal * decimal <-- Note this one triggers even though "decimal" has some possibly-relevant methods + // float * Matrix // the rule doesn't trigger for this one since Matrix has overloads we can use and we prefer those instead + // float * Matrix // the rule doesn't trigger for this one since Matrix has overloads we can use and we prefer those instead + // + // The rule is triggered by these sorts of inputs when permitWeakResolution=true + // float * 'a + // 'a * float + // decimal<'u> * 'a + (let checkRuleAppliesInPreferenceToMethods argTy1 argTy2 = + // Check that at least one of the argument types is numeric + IsNumericOrIntegralEnumType g argTy1 && + // Check the other type is nominal, unless using weak resolution + IsBinaryOpOtherArgType g permitWeakResolution argTy2 && + // This next condition checks that either + // - Neither type contributes any methods OR + // - We have the special case "decimal<_> * decimal". In this case we have some + // possibly-relevant methods from "decimal" but we ignore them in this case. + (isNil minfos || (Option.isSome (getMeasureOfType g argTy1) && isDecimalTy g argTy2)) in + + checkRuleAppliesInPreferenceToMethods argTy1 argTy2 || + checkRuleAppliesInPreferenceToMethods argTy2 argTy1) -> + + match getMeasureOfType g argTy1 with + | Some (tcref, ms1) -> + let ms2 = freshMeasure () + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 (mkWoNullAppTy tcref [TType_measure ms2]) + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy (mkWoNullAppTy tcref [TType_measure (Measure.Prod(ms1, if nm = "op_Multiply" then ms2 else Measure.Inv ms2))]) + return TTraitBuiltIn - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 - return TTraitBuiltIn - - | _, _, false, ("op_Addition" | "op_Subtraction" | "op_Modulus"), [argTy1;argTy2] - when // Ignore any explicit +/- overloads from any basic integral types - (minfos |> List.forall (fun (_, minfo) -> isIntegerTy g minfo.ApparentEnclosingType ) && - ( IsAddSubModType nm g argTy1 && IsBinaryOpOtherArgType g permitWeakResolution argTy2 - || IsAddSubModType nm g argTy2 && IsBinaryOpOtherArgType g permitWeakResolution argTy1)) -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 - return TTraitBuiltIn - - | _, _, false, ("op_LessThan" | "op_LessThanOrEqual" | "op_GreaterThan" | "op_GreaterThanOrEqual" | "op_Equality" | "op_Inequality" ), [argTy1;argTy2] - when // Ignore any explicit overloads from any basic integral types - (minfos |> List.forall (fun (_, minfo) -> isIntegerTy g minfo.ApparentEnclosingType ) && - ( IsRelationalType g argTy1 && IsBinaryOpOtherArgType g permitWeakResolution argTy2 - || IsRelationalType g argTy2 && IsBinaryOpOtherArgType g permitWeakResolution argTy1)) -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy g.bool_ty - return TTraitBuiltIn - - // We pretend for uniformity that the numeric types have a static property called Zero and One - // As with constants, only zero is polymorphic in its units - | [], [ty], false, "get_Zero", [] - when isNumericType g ty || isCharTy g ty -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy ty - return TTraitBuiltIn - - | [], [ty], false, "get_One", [] - when isNumericType g ty || isCharTy g ty -> - do! SolveDimensionlessNumericType csenv ndeep m2 trace ty - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy ty - return TTraitBuiltIn - - | [], _, false, "DivideByInt", [argTy1;argTy2] - when isFpTy g argTy1 || isDecimalTy g argTy1 -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 g.int_ty - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 - return TTraitBuiltIn - - // We pretend for uniformity that the 'string' and 'array' types have an indexer property called 'Item' - | [], [ty], true, "get_Item", [argTy1] - when isStringTy g ty -> - - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy1 g.int_ty - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy g.char_ty - return TTraitBuiltIn - - | [], [ty], true, "get_Item", argTys - when isArrayTy g ty -> - - if rankOfArrayTy g ty <> argTys.Length then - do! ErrorD(ConstraintSolverError(FSComp.SR.csIndexArgumentMismatch((rankOfArrayTy g ty), argTys.Length), m, m2)) - - for argTy in argTys do - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy g.int_ty - - let ety = destArrayTy g ty - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy ety - return TTraitBuiltIn - - | [], [ty], true, "set_Item", argTys - when isArrayTy g ty -> - - if rankOfArrayTy g ty <> argTys.Length - 1 then - do! ErrorD(ConstraintSolverError(FSComp.SR.csIndexArgumentMismatch((rankOfArrayTy g ty), (argTys.Length - 1)), m, m2)) - let argTys, lastTy = List.frontAndBack argTys - - for argTy in argTys do - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy g.int_ty - - let elemTy = destArrayTy g ty - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace lastTy elemTy - return TTraitBuiltIn - - | [], _, false, ("op_BitwiseAnd" | "op_BitwiseOr" | "op_ExclusiveOr"), [argTy1;argTy2] - when IsBitwiseOpType g argTy1 && IsBinaryOpOtherArgType g permitWeakResolution argTy2 - || IsBitwiseOpType g argTy2 && IsBinaryOpOtherArgType g permitWeakResolution argTy1 -> - - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 - do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy1 - return TTraitBuiltIn - - | [], _, false, ("op_LeftShift" | "op_RightShift"), [argTy1;argTy2] - when IsIntegerOrIntegerEnumTy g argTy1 -> - - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 g.int_ty - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 - do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy1 - return TTraitBuiltIn - - | _, _, false, "op_UnaryPlus", [argTy] - when IsNumericOrIntegralEnumType g argTy -> - - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy - return TTraitBuiltIn - - | _, _, false, "op_UnaryNegation", [argTy] - when isSignedIntegerTy g argTy || isFpTy g argTy || isDecimalTy g argTy -> - - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy - return TTraitBuiltIn - - | _, _, true, "get_Sign", [] - when IsSignType g supportTys.Head -> - - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy g.int32_ty - return TTraitBuiltIn - - | _, _, false, ("op_LogicalNot" | "op_OnesComplement"), [argTy] - when IsIntegerOrIntegerEnumTy g argTy -> - - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy - do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy - return TTraitBuiltIn - - | _, _, false, "Abs", [argTy] - when isSignedIntegerTy g argTy || isFpTy g argTy || isDecimalTy g argTy -> - - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy - return TTraitBuiltIn - - | _, _, false, "Sqrt", [argTy1] - when isFpTy g argTy1 -> - match getMeasureOfType g argTy1 with - | Some (tcref, _) -> - let ms1 = freshMeasure () - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy1 (mkAppTy tcref [TType_measure (Measure.Prod (ms1, ms1))]) - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy (mkAppTy tcref [TType_measure ms1]) - return TTraitBuiltIn - | None -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 - return TTraitBuiltIn - - | _, _, false, ("Sin" | "Cos" | "Tan" | "Sinh" | "Cosh" | "Tanh" | "Atan" | "Acos" | "Asin" | "Exp" | "Ceiling" | "Floor" | "Round" | "Truncate" | "Log10" | "Log" | "Sqrt"), [argTy] - when isFpTy g argTy -> - - do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy - return TTraitBuiltIn - - // Conversions from non-decimal numbers / strings / chars to non-decimal numbers / chars are built-in - | _, _, false, "op_Explicit", [argTy] - when (// The input type. - (IsNonDecimalNumericOrIntegralEnumType g argTy || isStringTy g argTy || isCharTy g argTy) && - // The output type - (IsNonDecimalNumericOrIntegralEnumType g retTy || isCharTy g retTy)) -> - - return TTraitBuiltIn - - // Conversions from (including decimal) numbers / strings / chars to decimals are built-in - | _, _, false, "op_Explicit", [argTy] - when (// The input type. - (IsNumericOrIntegralEnumType g argTy || isStringTy g argTy || isCharTy g argTy) && - // The output type - (isDecimalTy g retTy)) -> - return TTraitBuiltIn - - // Conversions from decimal numbers to native integers are built-in - // The rest of decimal conversions are handled via op_Explicit lookup on System.Decimal (which also looks for op_Implicit) - | _, _, false, "op_Explicit", [argTy] - when (// The input type. - (isDecimalTy g argTy) && - // The output type - (isNativeIntegerTy g retTy)) -> - return TTraitBuiltIn - - | [], _, false, "Pow", [argTy1; argTy2] - when isFpTy g argTy1 -> - - do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy1 - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 - return TTraitBuiltIn - - | _, _, false, "Atan2", [argTy1; argTy2] - when isFpTy g argTy1 -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 - match getMeasureOfType g argTy1 with - | None -> do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 - | Some (tcref, _) -> do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy (mkAppTy tcref [TType_measure Measure.One]) - return TTraitBuiltIn + | _ -> - | _ -> - // OK, this is not solved by a built-in constraint. - // Now look for real solutions - - // First look for a solution by a record property - let recdPropSearch = - let isGetProp = nm.StartsWithOrdinal("get_") - let isSetProp = nm.StartsWithOrdinal("set_") - if not isRigid && ((argTys.IsEmpty && isGetProp) || isSetProp) then - let propName = nm[4..] - let props = - supportTys |> List.choose (fun ty -> - match TryFindIntrinsicNamedItemOfType csenv.InfoReader (propName, AccessibleFromEverywhere, false) FindMemberFlag.IgnoreOverrides m ty with - | Some (RecdFieldItem rfinfo) - when (isGetProp || rfinfo.RecdField.IsMutable) && - (rfinfo.IsStatic = not memFlags.IsInstance) && - IsRecdFieldAccessible amap m AccessibleFromEverywhere rfinfo.RecdFieldRef && - not rfinfo.LiteralValue.IsSome && - not rfinfo.RecdField.IsCompilerGenerated -> - Some (rfinfo, isSetProp) - | _ -> None) - match props with - | [ prop ] -> Some prop - | _ -> None - else - None - - let anonRecdPropSearch = - let isGetProp = nm.StartsWithOrdinal("get_") - if not isRigid && isGetProp && memFlags.IsInstance then - let propName = nm[4..] - let props = - supportTys |> List.choose (fun ty -> - match TryFindAnonRecdFieldOfType g ty propName with - | Some (Item.AnonRecdField(anonInfo, tinst, i, _)) -> Some (anonInfo, tinst, i) - | _ -> None) - match props with - | [ prop ] -> Some prop - | _ -> None - else - None - - // Now check if there are no feasible solutions at all - match minfos, recdPropSearch, anonRecdPropSearch with - | [], None, None when MemberConstraintIsReadyForStrongResolution csenv traitInfo -> - if supportTys |> List.exists (isFunTy g) then - return! ErrorD (ConstraintSolverError(FSComp.SR.csExpectTypeWithOperatorButGivenFunction(ConvertValLogicalNameToDisplayNameCore nm), m, m2)) - elif supportTys |> List.exists (isAnyTupleTy g) then - return! ErrorD (ConstraintSolverError(FSComp.SR.csExpectTypeWithOperatorButGivenTuple(ConvertValLogicalNameToDisplayNameCore nm), m, m2)) - else - match nm, argTys with - | "op_Explicit", [argTy] -> - let argTyString = NicePrint.prettyStringOfTy denv argTy - let rtyString = NicePrint.prettyStringOfTy denv retTy - return! ErrorD (ConstraintSolverError(FSComp.SR.csTypeDoesNotSupportConversion(argTyString, rtyString), m, m2)) - | _ -> - let tyString = - match supportTys with - | [ty] -> NicePrint.minimalStringOfType denv ty - | _ -> supportTys |> List.map (NicePrint.minimalStringOfType denv) |> String.concat ", " - let opName = ConvertValLogicalNameToDisplayNameCore nm - let err = - match opName with - | "?>=" | "?>" | "?<=" | "?<" | "?=" | "?<>" - | ">=?" | ">?" | "<=?" | "?" - | "?>=?" | "?>?" | "?<=?" | "??" -> - if List.isSingleton supportTys then FSComp.SR.csTypeDoesNotSupportOperatorNullable(tyString, opName) - else FSComp.SR.csTypesDoNotSupportOperatorNullable(tyString, opName) - | _ -> - match supportTys, source.Value with - | [_], Some s when s.StartsWith("Operators.") -> - let opSource = s[10..] - if opSource = nm then FSComp.SR.csTypeDoesNotSupportOperator(tyString, opName) - else FSComp.SR.csTypeDoesNotSupportOperator(tyString, opSource) - | [_], Some s -> - FSComp.SR.csFunctionDoesNotSupportType(s, tyString, nm) - | [_], _ - -> FSComp.SR.csTypeDoesNotSupportOperator(tyString, opName) - | _, _ - -> FSComp.SR.csTypesDoNotSupportOperator(tyString, opName) - return! ErrorD(ConstraintSolverError(err, m, m2)) + match getMeasureOfType g argTy2 with + | Some (tcref, ms2) -> + let ms1 = freshMeasure () + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy1 (mkWoNullAppTy tcref [TType_measure ms1]) + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy (mkWoNullAppTy tcref [TType_measure (Measure.Prod(ms1, if nm = "op_Multiply" then ms2 else Measure.Inv ms2))]) + return TTraitBuiltIn - | _ -> - let dummyExpr = mkUnit g m - let calledMethGroup = - minfos - // curried members may not be used to satisfy constraints - |> List.choose (fun (staticTy, minfo) -> - if minfo.IsCurried then None else - let callerArgs = - { Unnamed = [ (argTys |> List.map (fun argTy -> CallerArg(argTy, m, false, dummyExpr))) ] - Named = [ [ ] ] } - let minst = FreshenMethInfo m minfo - let objtys = minfo.GetObjArgTypes(amap, m, minst) - Some(CalledMeth(csenv.InfoReader, None, false, FreshenMethInfo, m, AccessibleFromEverywhere, minfo, minst, minst, None, objtys, callerArgs, false, false, None, Some staticTy))) - - let methOverloadResult, errors = - trace.CollectThenUndoOrCommit - (fun (a, _) -> Option.isSome a) - (fun trace -> ResolveOverloading csenv (WithTrace trace) nm ndeep (Some traitInfo) CallerArgs.Empty AccessibleFromEverywhere calledMethGroup false (Some (MustEqual retTy))) - - match anonRecdPropSearch, recdPropSearch, methOverloadResult with - | Some (anonInfo, tinst, i), None, None -> - // OK, the constraint is solved by a record property. Assert that the return types match. - let rty2 = List.item i tinst - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy rty2 - return TTraitSolvedAnonRecdProp(anonInfo, tinst, i) - - | None, Some (rfinfo, isSetProp), None -> - // OK, the constraint is solved by a record property. Assert that the return types match. - let rty2 = if isSetProp then g.unit_ty else rfinfo.FieldType - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy rty2 - return TTraitSolvedRecdProp(rfinfo, isSetProp) - - | None, None, Some (calledMeth: CalledMeth<_>) -> - // OK, the constraint is solved. - let minfo = calledMeth.Method - - do! errors - let isInstance = minfo.IsInstance - if isInstance <> memFlags.IsInstance then - return! - if isInstance then - ErrorD(ConstraintSolverError(FSComp.SR.csMethodFoundButIsNotStatic((NicePrint.minimalStringOfType denv minfo.ApparentEnclosingType), (ConvertValLogicalNameToDisplayNameCore nm), nm), m, m2 )) - else - ErrorD(ConstraintSolverError(FSComp.SR.csMethodFoundButIsStatic((NicePrint.minimalStringOfType denv minfo.ApparentEnclosingType), (ConvertValLogicalNameToDisplayNameCore nm), nm), m, m2 )) - else - do! CheckMethInfoAttributes g m None minfo - return TTraitSolved (minfo, calledMeth.CalledTyArgs, calledMeth.OptionalStaticType) - - | _ -> - do! AddUnsolvedMemberConstraint csenv ndeep m2 trace permitWeakResolution ignoreUnresolvedOverload traitInfo errors - return TTraitUnsolved - } - return! RecordMemberConstraintSolution csenv.SolverState m trace traitInfo res - } + | _ -> + + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 + return TTraitBuiltIn + + | _, _, false, ("op_Addition" | "op_Subtraction" | "op_Modulus"), [argTy1;argTy2] + when // Ignore any explicit +/- overloads from any basic integral types + (minfos |> List.forall (fun (_, minfo) -> isIntegerTy g minfo.ApparentEnclosingType ) && + ( IsAddSubModType nm g argTy1 && IsBinaryOpOtherArgType g permitWeakResolution argTy2 + || IsAddSubModType nm g argTy2 && IsBinaryOpOtherArgType g permitWeakResolution argTy1)) -> + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 + return TTraitBuiltIn + + | _, _, false, ("op_LessThan" | "op_LessThanOrEqual" | "op_GreaterThan" | "op_GreaterThanOrEqual" | "op_Equality" | "op_Inequality" ), [argTy1;argTy2] + when // Ignore any explicit overloads from any basic integral types + (minfos |> List.forall (fun (_, minfo) -> isIntegerTy g minfo.ApparentEnclosingType ) && + ( IsRelationalType g argTy1 && IsBinaryOpOtherArgType g permitWeakResolution argTy2 + || IsRelationalType g argTy2 && IsBinaryOpOtherArgType g permitWeakResolution argTy1)) -> + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy g.bool_ty + return TTraitBuiltIn + + // We pretend for uniformity that the numeric types have a static property called Zero and One + // As with constants, only zero is polymorphic in its units + | [], [ty], false, "get_Zero", [] + when isNumericType g ty || isCharTy g ty -> + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy ty + return TTraitBuiltIn + + | [], [ty], false, "get_One", [] + when isNumericType g ty || isCharTy g ty -> + do! SolveDimensionlessNumericType csenv ndeep m2 trace ty + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy ty + return TTraitBuiltIn + + | [], _, false, "DivideByInt", [argTy1;argTy2] + when isFpTy g argTy1 || isDecimalTy g argTy1 -> + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 g.int_ty + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 + return TTraitBuiltIn + + // We pretend for uniformity that the 'string' and 'array' types have an indexer property called 'Item' + | [], [ty], true, "get_Item", [argTy1] + when isStringTy g ty -> + + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy1 g.int_ty + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy g.char_ty + return TTraitBuiltIn + + | [], [ty], true, "get_Item", argTys + when isArrayTy g ty -> + + if rankOfArrayTy g ty <> argTys.Length then + do! ErrorD(ConstraintSolverError(FSComp.SR.csIndexArgumentMismatch((rankOfArrayTy g ty), argTys.Length), m, m2)) + + for argTy in argTys do + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy g.int_ty + + let ety = destArrayTy g ty + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy ety + return TTraitBuiltIn + + | [], [ty], true, "set_Item", argTys + when isArrayTy g ty -> + + if rankOfArrayTy g ty <> argTys.Length - 1 then + do! ErrorD(ConstraintSolverError(FSComp.SR.csIndexArgumentMismatch((rankOfArrayTy g ty), (argTys.Length - 1)), m, m2)) + let argTys, lastTy = List.frontAndBack argTys + + for argTy in argTys do + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy g.int_ty + + let elemTy = destArrayTy g ty + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace lastTy elemTy + return TTraitBuiltIn + + | [], _, false, ("op_BitwiseAnd" | "op_BitwiseOr" | "op_ExclusiveOr"), [argTy1;argTy2] + when IsBitwiseOpType g argTy1 && IsBinaryOpOtherArgType g permitWeakResolution argTy2 + || IsBitwiseOpType g argTy2 && IsBinaryOpOtherArgType g permitWeakResolution argTy1 -> + + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 + do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy1 + return TTraitBuiltIn + + | [], _, false, ("op_LeftShift" | "op_RightShift"), [argTy1;argTy2] + when IsIntegerOrIntegerEnumTy g argTy1 -> + + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 g.int_ty + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 + do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy1 + return TTraitBuiltIn + + | _, _, false, "op_UnaryPlus", [argTy] + when IsNumericOrIntegralEnumType g argTy -> + + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy + return TTraitBuiltIn + + | _, _, false, "op_UnaryNegation", [argTy] + when isSignedIntegerTy g argTy || isFpTy g argTy || isDecimalTy g argTy -> + + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy + return TTraitBuiltIn + + | _, _, true, "get_Sign", [] + when IsSignType g supportTys.Head -> + + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy g.int32_ty + return TTraitBuiltIn + + | _, _, false, ("op_LogicalNot" | "op_OnesComplement"), [argTy] + when IsIntegerOrIntegerEnumTy g argTy -> + + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy + do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy + return TTraitBuiltIn + + | _, _, false, "Abs", [argTy] + when isSignedIntegerTy g argTy || isFpTy g argTy || isDecimalTy g argTy -> + + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy + return TTraitBuiltIn + + | _, _, false, "Sqrt", [argTy1] + when isFpTy g argTy1 -> + match getMeasureOfType g argTy1 with + | Some (tcref, _) -> + let ms1 = freshMeasure () + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy1 (mkWoNullAppTy tcref [TType_measure (Measure.Prod (ms1, ms1))]) + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy (mkWoNullAppTy tcref [TType_measure ms1]) + return TTraitBuiltIn + | None -> + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 + return TTraitBuiltIn + + | _, _, false, ("Sin" | "Cos" | "Tan" | "Sinh" | "Cosh" | "Tanh" | "Atan" | "Acos" | "Asin" | "Exp" | "Ceiling" | "Floor" | "Round" | "Truncate" | "Log10" | "Log" | "Sqrt"), [argTy] + when isFpTy g argTy -> + + do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy + return TTraitBuiltIn + + // Conversions from non-decimal numbers / strings / chars to non-decimal numbers / chars are built-in + | _, _, false, "op_Explicit", [argTy] + when (// The input type. + (IsNonDecimalNumericOrIntegralEnumType g argTy || isStringTy g argTy || isCharTy g argTy) && + // The output type + (IsNonDecimalNumericOrIntegralEnumType g retTy || isCharTy g retTy)) -> + + return TTraitBuiltIn + + // Conversions from (including decimal) numbers / strings / chars to decimals are built-in + | _, _, false, "op_Explicit", [argTy] + when (// The input type. + (IsNumericOrIntegralEnumType g argTy || isStringTy g argTy || isCharTy g argTy) && + // The output type + (isDecimalTy g retTy)) -> + return TTraitBuiltIn + + // Conversions from decimal numbers to native integers are built-in + // The rest of decimal conversions are handled via op_Explicit lookup on System.Decimal (which also looks for op_Implicit) + | _, _, false, "op_Explicit", [argTy] + when (// The input type. + (isDecimalTy g argTy) && + // The output type + (isNativeIntegerTy g retTy)) -> + return TTraitBuiltIn + + | [], _, false, "Pow", [argTy1; argTy2] + when isFpTy g argTy1 -> + + do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy1 + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 + return TTraitBuiltIn + + | _, _, false, "Atan2", [argTy1; argTy2] + when isFpTy g argTy1 -> + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 + match getMeasureOfType g argTy1 with + | None -> do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 + | Some (tcref, _) -> do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy (mkWoNullAppTy tcref [TType_measure Measure.One]) + return TTraitBuiltIn + + | _ -> + // OK, this is not solved by a built-in constraint. + // Now look for real solutions + + // First look for a solution by a record property + let recdPropSearch = + let isGetProp = nm.StartsWithOrdinal("get_") + let isSetProp = nm.StartsWithOrdinal("set_") + if not isRigid && ((argTys.IsEmpty && isGetProp) || isSetProp) then + let propName = nm[4..] + let props = + supportTys |> List.choose (fun ty -> + match TryFindIntrinsicNamedItemOfType csenv.InfoReader (propName, AccessibleFromEverywhere, false) FindMemberFlag.IgnoreOverrides m ty with + | Some (RecdFieldItem rfinfo) + when (isGetProp || rfinfo.RecdField.IsMutable) && + (rfinfo.IsStatic = not memFlags.IsInstance) && + IsRecdFieldAccessible amap m AccessibleFromEverywhere rfinfo.RecdFieldRef && + not rfinfo.LiteralValue.IsSome && + not rfinfo.RecdField.IsCompilerGenerated -> + Some (rfinfo, isSetProp) + | _ -> None) + match props with + | [ prop ] -> Some prop + | _ -> None + else + None + + let anonRecdPropSearch = + let isGetProp = nm.StartsWithOrdinal("get_") + if not isRigid && isGetProp && memFlags.IsInstance then + let propName = nm[4..] + let props = + supportTys |> List.choose (fun ty -> + match TryFindAnonRecdFieldOfType g ty propName with + | Some (Item.AnonRecdField(anonInfo, tinst, i, _)) -> Some (anonInfo, tinst, i) + | _ -> None) + match props with + | [ prop ] -> Some prop + | _ -> None + else + None + + // Now check if there are no feasible solutions at all + match minfos, recdPropSearch, anonRecdPropSearch with + | [], None, None when MemberConstraintIsReadyForStrongResolution csenv traitInfo -> + if supportTys |> List.exists (isFunTy g) then + return! ErrorD (ConstraintSolverError(FSComp.SR.csExpectTypeWithOperatorButGivenFunction(ConvertValLogicalNameToDisplayNameCore nm), m, m2)) + elif supportTys |> List.exists (isAnyTupleTy g) then + return! ErrorD (ConstraintSolverError(FSComp.SR.csExpectTypeWithOperatorButGivenTuple(ConvertValLogicalNameToDisplayNameCore nm), m, m2)) + else + match nm, argTys with + | "op_Explicit", [argTy] -> + let argTyString = NicePrint.prettyStringOfTy denv argTy + let rtyString = NicePrint.prettyStringOfTy denv retTy + return! ErrorD (ConstraintSolverError(FSComp.SR.csTypeDoesNotSupportConversion(argTyString, rtyString), m, m2)) + | _ -> + let tyString = + match supportTys with + | [ty] -> NicePrint.minimalStringOfType denv ty + | _ -> supportTys |> List.map (NicePrint.minimalStringOfType denv) |> String.concat ", " + let opName = ConvertValLogicalNameToDisplayNameCore nm + let err = + match opName with + | "?>=" | "?>" | "?<=" | "?<" | "?=" | "?<>" + | ">=?" | ">?" | "<=?" | "?" + | "?>=?" | "?>?" | "?<=?" | "??" -> + if List.isSingleton supportTys then FSComp.SR.csTypeDoesNotSupportOperatorNullable(tyString, opName) + else FSComp.SR.csTypesDoNotSupportOperatorNullable(tyString, opName) + | _ -> + match supportTys, source.Value with + | [_], Some s when s.StartsWith("Operators.") -> + let opSource = s[10..] + if opSource = nm then FSComp.SR.csTypeDoesNotSupportOperator(tyString, opName) + else FSComp.SR.csTypeDoesNotSupportOperator(tyString, opSource) + | [_], Some s -> + FSComp.SR.csFunctionDoesNotSupportType(s, tyString, nm) + | [_], _ + -> FSComp.SR.csTypeDoesNotSupportOperator(tyString, opName) + | _, _ + -> FSComp.SR.csTypesDoNotSupportOperator(tyString, opName) + return! ErrorD(ConstraintSolverError(err, m, m2)) + + | _ -> + let dummyExpr = mkUnit g m + let calledMethGroup = + minfos + // curried members may not be used to satisfy constraints + |> List.choose (fun (staticTy, minfo) -> + if minfo.IsCurried then + None + else + let callerArgs = + { + Unnamed = [ (argTys |> List.map (fun argTy -> CallerArg(argTy, m, false, dummyExpr))) ] + Named = [ [ ] ] + } + let minst = FreshenMethInfo m minfo + let objtys = minfo.GetObjArgTypes(amap, m, minst) + Some(CalledMeth(csenv.InfoReader, None, false, FreshenMethInfo, m, AccessibleFromEverywhere, minfo, minst, minst, None, objtys, callerArgs, false, false, None, Some staticTy))) + + let methOverloadResult, errors = + trace.CollectThenUndoOrCommit + (fun (a, _) -> Option.isSome a) + (fun trace -> ResolveOverloading csenv (WithTrace trace) nm ndeep (Some traitInfo) CallerArgs.Empty AccessibleFromEverywhere calledMethGroup false (Some (MustEqual retTy))) + + match anonRecdPropSearch, recdPropSearch, methOverloadResult with + | Some (anonInfo, tinst, i), None, None -> + // OK, the constraint is solved by a record property. Assert that the return types match. + let rty2 = List.item i tinst + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy rty2 + return TTraitSolvedAnonRecdProp(anonInfo, tinst, i) + + | None, Some (rfinfo, isSetProp), None -> + // OK, the constraint is solved by a record property. Assert that the return types match. + let rty2 = if isSetProp then g.unit_ty else rfinfo.FieldType + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy rty2 + return TTraitSolvedRecdProp(rfinfo, isSetProp) + + | None, None, Some (calledMeth: CalledMeth<_>) -> + // OK, the constraint is solved. + let minfo = calledMeth.Method + + do! errors + let isInstance = minfo.IsInstance + if isInstance <> memFlags.IsInstance then + return! + if isInstance then + ErrorD(ConstraintSolverError(FSComp.SR.csMethodFoundButIsNotStatic((NicePrint.minimalStringOfType denv minfo.ApparentEnclosingType), (ConvertValLogicalNameToDisplayNameCore nm), nm), m, m2 )) + else + ErrorD(ConstraintSolverError(FSComp.SR.csMethodFoundButIsStatic((NicePrint.minimalStringOfType denv minfo.ApparentEnclosingType), (ConvertValLogicalNameToDisplayNameCore nm), nm), m, m2 )) + else + do! CheckMethInfoAttributes g m None minfo + return TTraitSolved (minfo, calledMeth.CalledTyArgs, calledMeth.OptionalStaticType) + + | _ -> + do! AddUnsolvedMemberConstraint csenv ndeep m2 trace permitWeakResolution ignoreUnresolvedOverload traitInfo errors + return TTraitUnsolved + } + return! RecordMemberConstraintSolution csenv.SolverState m trace traitInfo res + } and AddUnsolvedMemberConstraint csenv ndeep m2 trace permitWeakResolution ignoreUnresolvedOverload traitInfo errors = trackErrors { @@ -1817,6 +2132,8 @@ and MemberConstraintSolutionOfMethInfo css m minfo minst staticTyOpt = | FSMeth(_, ty, vref, _) -> FSMethSln(ty, vref, minst, staticTyOpt) + | MethInfoWithModifiedReturnType(mi,_) -> MemberConstraintSolutionOfMethInfo css m mi minst staticTyOpt + | MethInfo.DefaultStructCtor _ -> error(InternalError("the default struct constructor was the unexpected solution to a trait constraint", m)) @@ -1835,7 +2152,7 @@ and MemberConstraintSolutionOfMethInfo css m minfo minst staticTyOpt = match callMethInfoOpt, callExpr with | Some methInfo, Expr.Op (TOp.ILCall (_, _, _, _, NormalValUse, _, _, ilMethRef, _, methInst, _), [], args, m) when (args, (objArgVars@allArgVars)) ||> List.lengthsEqAndForall2 (fun a b -> match a with Expr.Val (v, _, _) -> valEq v.Deref b | _ -> false) -> - let declaringTy = ImportProvidedType amap m (methInfo.PApply((fun x -> x.DeclaringType), m)) + let declaringTy = ImportProvidedType amap m (methInfo.PApply((fun x -> nonNull x.DeclaringType), m)) if isILAppTy g declaringTy then let extOpt = None // EXTENSION METHODS FROM TYPE PROVIDERS: for extension methods coming from the type providers we would have something here. ILMethSln(declaringTy, extOpt, ilMethRef, methInst, staticTyOpt) @@ -2047,75 +2364,79 @@ and TraitsAreRelated (csenv: ConstraintSolverEnv) retry traitInfo1 traitInfo2 = // The 'retry' flag is passed when a rigid type variable is about to raise a missing constraint error // and the lengths of the support types are not equal (i.e. one is length 1, the other is length 2). // In this case the support types are first forced to be equal. -and EnforceConstraintConsistency (csenv: ConstraintSolverEnv) ndeep m2 trace retry tpc1 tpc2 = trackErrors { - let g = csenv.g - let amap = csenv.amap - let m = csenv.m - match tpc1, tpc2 with - | TyparConstraint.MayResolveMember(traitInfo1, _), TyparConstraint.MayResolveMember(traitInfo2, _) - when TraitsAreRelated csenv retry traitInfo1 traitInfo2 -> - let (TTrait(tys=tys1; objAndArgTys=argTys1; returnTyOpt=rty1)) = traitInfo1 - let (TTrait(tys=tys2; objAndArgTys=argTys2; returnTyOpt=rty2)) = traitInfo2 - if retry then - match tys1, tys2 with - | [ty1], [ty2] -> do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace ty1 ty2 - | [ty1], _ -> do! IterateD (SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace ty1) tys2 - | _, [ty2] -> do! IterateD (SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace ty2) tys1 - | _ -> () - do! Iterate2D (SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace) argTys1 argTys2 - let rty1 = GetFSharpViewOfReturnType g rty1 - let rty2 = GetFSharpViewOfReturnType g rty2 - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace rty1 rty2 - - | TyparConstraint.CoercesTo(ty1, _), TyparConstraint.CoercesTo(ty2, _) -> - // Record at most one subtype constraint for each head type. - // That is, we forbid constraints by both I and I. - // This works because the types on the r.h.s. of subtype - // constraints are head-types and so any further inferences are equational. - let collect ty = - let mutable res = [] - IterateEntireHierarchyOfType (fun x -> res <- x :: res) g amap m AllowMultiIntfInstantiations.No ty - List.rev res - let parents1 = collect ty1 - let parents2 = collect ty2 - for ty1Parent in parents1 do - for ty2Parent in parents2 do - if HaveSameHeadType g ty1Parent ty2Parent then - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace ty1Parent ty2Parent - - | TyparConstraint.IsEnum (unerlyingTy1, _), - TyparConstraint.IsEnum (unerlyingTy2, m2) -> - return! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace unerlyingTy1 unerlyingTy2 - - | TyparConstraint.IsDelegate (argsTy1, retTy1, _), - TyparConstraint.IsDelegate (argsTy2, retTy2, m2) -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argsTy1 argsTy2 - return! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy1 retTy2 - - | TyparConstraint.SupportsComparison _, TyparConstraint.IsDelegate _ - | TyparConstraint.IsDelegate _, TyparConstraint.SupportsComparison _ - | TyparConstraint.IsNonNullableStruct _, TyparConstraint.IsReferenceType _ - | TyparConstraint.IsReferenceType _, TyparConstraint.IsNonNullableStruct _ -> - return! ErrorD (Error(FSComp.SR.csStructConstraintInconsistent(), m)) - - | TyparConstraint.IsUnmanaged _, TyparConstraint.IsReferenceType _ - | TyparConstraint.IsReferenceType _, TyparConstraint.IsUnmanaged _ -> - return! ErrorD (Error(FSComp.SR.csUnmanagedConstraintInconsistent(), m)) - - | TyparConstraint.SupportsComparison _, TyparConstraint.SupportsComparison _ - | TyparConstraint.SupportsEquality _, TyparConstraint.SupportsEquality _ - | TyparConstraint.SupportsNull _, TyparConstraint.SupportsNull _ - | TyparConstraint.IsNonNullableStruct _, TyparConstraint.IsNonNullableStruct _ - | TyparConstraint.IsUnmanaged _, TyparConstraint.IsUnmanaged _ - | TyparConstraint.IsReferenceType _, TyparConstraint.IsReferenceType _ - | TyparConstraint.RequiresDefaultConstructor _, TyparConstraint.RequiresDefaultConstructor _ - | TyparConstraint.SimpleChoice _, TyparConstraint.SimpleChoice _ -> - () - - | _ -> () - } +and EnforceConstraintConsistency (csenv: ConstraintSolverEnv) ndeep m2 trace retry tpc1 tpc2 = + trackErrors { + let g = csenv.g + let amap = csenv.amap + let m = csenv.m + match tpc1, tpc2 with + | TyparConstraint.MayResolveMember(traitInfo1, _), TyparConstraint.MayResolveMember(traitInfo2, _) + when TraitsAreRelated csenv retry traitInfo1 traitInfo2 -> + let (TTrait(tys=tys1; objAndArgTys=argTys1; returnTyOpt=rty1)) = traitInfo1 + let (TTrait(tys=tys2; objAndArgTys=argTys2; returnTyOpt=rty2)) = traitInfo2 + if retry then + match tys1, tys2 with + | [ty1], [ty2] -> do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace ty1 ty2 + | [ty1], _ -> do! IterateD (SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace ty1) tys2 + | _, [ty2] -> do! IterateD (SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace ty2) tys1 + | _ -> () + do! Iterate2D (SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace) argTys1 argTys2 + let rty1 = GetFSharpViewOfReturnType g rty1 + let rty2 = GetFSharpViewOfReturnType g rty2 + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace rty1 rty2 + + | TyparConstraint.CoercesTo(ty1, _), TyparConstraint.CoercesTo(ty2, _) -> + // Record at most one subtype constraint for each head type. + // That is, we forbid constraints by both I and I. + // This works because the types on the r.h.s. of subtype + // constraints are head-types and so any further inferences are equational. + let collect ty = + let mutable res = [] + IterateEntireHierarchyOfType (fun x -> res <- x :: res) g amap m AllowMultiIntfInstantiations.No ty + List.rev res + let parents1 = collect ty1 + let parents2 = collect ty2 + for ty1Parent in parents1 do + for ty2Parent in parents2 do + if HaveSameHeadType g ty1Parent ty2Parent then + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace ty1Parent ty2Parent + + | TyparConstraint.IsEnum (underlyingTy1, _), TyparConstraint.IsEnum (underlyingTy2, m2) -> + return! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace underlyingTy1 underlyingTy2 + + | TyparConstraint.IsDelegate (argsTy1, retTy1, _), TyparConstraint.IsDelegate (argsTy2, retTy2, m2) -> + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argsTy1 argsTy2 + return! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy1 retTy2 + + | TyparConstraint.SupportsComparison _, TyparConstraint.IsDelegate _ + | TyparConstraint.IsDelegate _, TyparConstraint.SupportsComparison _ + | TyparConstraint.IsNonNullableStruct _, TyparConstraint.IsReferenceType _ + | TyparConstraint.IsReferenceType _, TyparConstraint.IsNonNullableStruct _ -> + return! ErrorD (Error(FSComp.SR.csStructConstraintInconsistent(), m)) + + | TyparConstraint.SupportsNull _, TyparConstraint.NotSupportsNull _ + | TyparConstraint.NotSupportsNull _, TyparConstraint.SupportsNull _ -> + return! ErrorD (Error(FSComp.SR.csNullNotNullConstraintInconsistent(), m)) + + | TyparConstraint.IsUnmanaged _, TyparConstraint.IsReferenceType _ + | TyparConstraint.IsReferenceType _, TyparConstraint.IsUnmanaged _ -> + return! ErrorD (Error(FSComp.SR.csUnmanagedConstraintInconsistent(), m)) + + | TyparConstraint.SupportsComparison _, TyparConstraint.SupportsComparison _ + | TyparConstraint.SupportsEquality _, TyparConstraint.SupportsEquality _ + | TyparConstraint.SupportsNull _, TyparConstraint.SupportsNull _ + | TyparConstraint.NotSupportsNull _, TyparConstraint.NotSupportsNull _ + | TyparConstraint.IsNonNullableStruct _, TyparConstraint.IsNonNullableStruct _ + | TyparConstraint.IsUnmanaged _, TyparConstraint.IsUnmanaged _ + | TyparConstraint.IsReferenceType _, TyparConstraint.IsReferenceType _ + | TyparConstraint.RequiresDefaultConstructor _, TyparConstraint.RequiresDefaultConstructor _ + | TyparConstraint.SimpleChoice _, TyparConstraint.SimpleChoice _ -> + () + + | _ -> () + } -// See when one constraint implies implies another. +// See when one constraint implies another. // 'a :> ty1 implies 'a :> 'ty2 if the head type name of ty2 (say T2) occursCheck anywhere in the hierarchy of ty1 // If it does occur, e.g. at instantiation T2, then the check above will have enforced that // T2 = ty2 @@ -2141,6 +2462,7 @@ and CheckConstraintImplication (csenv: ConstraintSolverEnv) tpc1 tpc2 = // comparison implies equality | TyparConstraint.SupportsComparison _, TyparConstraint.SupportsEquality _ | TyparConstraint.SupportsNull _, TyparConstraint.SupportsNull _ + | TyparConstraint.NotSupportsNull _, TyparConstraint.NotSupportsNull _ | TyparConstraint.IsNonNullableStruct _, TyparConstraint.IsNonNullableStruct _ | TyparConstraint.IsUnmanaged _, TyparConstraint.IsUnmanaged _ | TyparConstraint.IsReferenceType _, TyparConstraint.IsReferenceType _ @@ -2231,20 +2553,165 @@ and AddConstraint (csenv: ConstraintSolverEnv) ndeep m2 trace tp newConstraint () } -and SolveTypeUseSupportsNull (csenv: ConstraintSolverEnv) ndeep m2 trace ty = - let g = csenv.g - let m = csenv.m - let denv = csenv.DisplayEnv - match tryDestTyparTy g ty with - | ValueSome destTypar -> - AddConstraint csenv ndeep m2 trace destTypar (TyparConstraint.SupportsNull m) - | ValueNone -> - if TypeSatisfiesNullConstraint g m ty then CompleteD else - match ty with - | NullableTy g _ -> - ErrorD (ConstraintSolverError(FSComp.SR.csNullableTypeDoesNotHaveNull(NicePrint.minimalStringOfType denv ty), m, m2)) - | _ -> - ErrorD (ConstraintSolverError(FSComp.SR.csTypeDoesNotHaveNull(NicePrint.minimalStringOfType denv ty), m, m2)) +// preferConstraint: if the type is a type variable with an uncertain nullness, then +// this indicates whether we prefer to add a nullness constraint to the type variable itself, +// or whether we prefer to solve the nullness annotation. +// +// This is relevant for code like this: +// +// let isNull (value : 'T when 'T : null) = +// match box value with +// | null -> true +// | _ -> false +// +// let checkNonNull argName arg = +// if isNull arg then +// failwith (argName + " is null") +// +// Here the `'T: null` constraint is propagated by inference to checkNonNull. Which of these two types do we expect? +// +// val checkNonNull1: argName: string -> arg: 'T -> unit when 'T: null +// +// val checkNonNull2: argName: string -> arg: 'T | null -> unit +// +// When null checking is fully enabled, we prefer the latter. We can't always prefer it because it is a breaking change. +// +// Likewise consider +// +// let x = null +// +// What's the generalized type? +// val x: 'a when 'a: null +// val x: 'a | null when 'a: not null +// +// When null checking is fully enabled, we prefer the latter. We can't always prefer it because it is a breaking change. +and SolveTypeUseSupportsNull (csenv: ConstraintSolverEnv) ndeep m2 trace ty = + trackErrors { + let g = csenv.g + let m = csenv.m + let denv = csenv.DisplayEnv + if g.langFeatureNullness then + if TypeNullIsExtraValueNew g m ty then + () + elif isNullableTy g ty then + return! ErrorD (ConstraintSolverError(FSComp.SR.csNullableTypeDoesNotHaveNull(NicePrint.minimalStringOfType denv ty), m, m2)) + else + match tryDestTyparTy g ty with + | ValueSome tp -> + let nullness = nullnessOfTy g ty + match nullness.TryEvaluate() with + // NULLNESS TODO: This rule means turning on checkNullness changes type inference results for the cases + // mentioned in the comment above. THat's OK but needs to be documented in the RFC. + | ValueNone when not g.checkNullness -> + return! AddConstraint csenv ndeep m2 trace tp (TyparConstraint.SupportsNull m) + | ValueSome NullnessInfo.WithoutNull -> + return! AddConstraint csenv ndeep m2 trace tp (TyparConstraint.SupportsNull m) + | _ -> + if tp.Constraints |> List.exists (function | TyparConstraint.IsReferenceType _ -> true | _ -> false) |> not then + do! AddConstraint csenv ndeep m2 trace tp (TyparConstraint.IsReferenceType m) + return! SolveNullnessSupportsNull csenv ndeep m2 trace ty nullness + | _ -> + let nullness = nullnessOfTy g ty + do! SolveNullnessSupportsNull csenv ndeep m2 trace ty nullness + + // If checkNullness is off give the same errors as F# 4.5 + if not g.checkNullness && not (TypeNullIsExtraValue g m ty) then + return! ErrorD (ConstraintSolverError(FSComp.SR.csTypeDoesNotHaveNull(NicePrint.minimalStringOfType denv ty), m, m2)) + else + if TypeNullIsExtraValue g m ty then + () + elif isNullableTy g ty then + return! ErrorD (ConstraintSolverError(FSComp.SR.csNullableTypeDoesNotHaveNull(NicePrint.minimalStringOfType denv ty), m, m2)) + else + match tryDestTyparTy g ty with + | ValueSome tp -> + do! AddConstraint csenv ndeep m2 trace tp (TyparConstraint.SupportsNull m) + | ValueNone -> + return! ErrorD (ConstraintSolverError(FSComp.SR.csTypeDoesNotHaveNull(NicePrint.minimalStringOfType denv ty), m, m2)) + } + +and SolveNullnessSupportsNull (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace) ty nullness = + trackErrors { + let g = csenv.g + let m = csenv.m + let denv = csenv.DisplayEnv + match nullness with + | Nullness.Variable nv -> + if nv.IsSolved then + do! SolveNullnessSupportsNull csenv ndeep m2 trace ty nv.Solution + else + trace.Exec (fun () -> nv.Set KnownWithNull) (fun () -> nv.Unset()) + | Nullness.Known n1 -> + match n1 with + | NullnessInfo.AmbivalentToNull -> () + | NullnessInfo.WithNull -> () + | NullnessInfo.WithoutNull -> + if g.checkNullness then + // If a type would allow null in older rules of F#, we can just emit a warning. + // In the opposite case, we keep this as an error to avoid generating incorrect code (e.g. assigning null to an int) + if (TypeNullIsExtraValue g m ty) then + return! WarnD(ConstraintSolverNullnessWarningWithType(denv, ty, n1, m, m2)) + else + return! ErrorD (ConstraintSolverError(FSComp.SR.csTypeDoesNotHaveNull(NicePrint.minimalStringOfType denv ty), m, m2)) + } + +and SolveTypeUseNotSupportsNull (csenv: ConstraintSolverEnv) ndeep m2 trace ty = + trackErrors { + let g = csenv.g + let m = csenv.m + let denv = csenv.DisplayEnv + + if TypeNullIsTrueValue g ty then + // We can only give warnings here as F# 5.0 introduces these constraints into existing + // code via Option.ofObj and Option.toObj + do! WarnD (ConstraintSolverNullnessWarning(FSComp.SR.csTypeHasNullAsTrueValue(NicePrint.minimalStringOfType denv ty), m, m2)) + elif TypeNullIsExtraValueNew g m ty then + if g.checkNullness then + let denv = { denv with showNullnessAnnotations = Some true } + do! WarnD (ConstraintSolverNullnessWarning(FSComp.SR.csTypeHasNullAsExtraValue(NicePrint.minimalStringOfType denv ty), m, m2)) + else + match tryDestTyparTy g ty with + | ValueSome tp -> + do! AddConstraint csenv ndeep m2 trace tp (TyparConstraint.NotSupportsNull m) + | ValueNone -> + let nullness = nullnessOfTy g ty + do! SolveNullnessNotSupportsNull csenv ndeep m2 trace ty nullness + } + +and SolveNullnessNotSupportsNull (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace) ty nullness = + trackErrors { + let g = csenv.g + let m = csenv.m + let denv = csenv.DisplayEnv + match nullness with + | Nullness.Variable nv -> + if nv.IsSolved then + do! SolveNullnessNotSupportsNull csenv ndeep m2 trace ty nv.Solution + else + trace.Exec (fun () -> nv.Set KnownWithoutNull) (fun () -> nv.Unset()) + | Nullness.Known n1 -> + match n1 with + | NullnessInfo.AmbivalentToNull -> () + | NullnessInfo.WithoutNull -> () + | NullnessInfo.WithNull -> + if g.checkNullness && TypeNullIsExtraValueNew g m ty then + let denv = { denv with showNullnessAnnotations = Some true } + return! WarnD(ConstraintSolverNullnessWarning(FSComp.SR.csTypeHasNullAsExtraValue(NicePrint.minimalStringOfType denv ty), m, m2)) + } + +and SolveTypeCanCarryNullness (csenv: ConstraintSolverEnv) ty nullness = + trackErrors { + let g = csenv.g + let m = csenv.m + let strippedTy = stripTyEqnsA g true ty + match tryAddNullnessToTy nullness strippedTy with + | Some _ -> + if isTyparTy g strippedTy && not (isReferenceTyparTy g strippedTy) then + return! AddConstraint csenv 0 m NoTrace (destTyparTy g strippedTy) (TyparConstraint.IsReferenceType m) + | None -> + let tyString = NicePrint.minimalStringOfType csenv.DisplayEnv strippedTy + return! ErrorD(Error(FSComp.SR.tcTypeDoesNotHaveAnyNull(tyString), m)) + } and SolveTypeSupportsComparison (csenv: ConstraintSolverEnv) ndeep m2 trace ty = let g = csenv.g @@ -2261,8 +2728,8 @@ and SolveTypeSupportsComparison (csenv: ConstraintSolverEnv) ndeep m2 trace ty = ErrorD (ConstraintSolverError(FSComp.SR.csTypeDoesNotSupportComparison1(NicePrint.minimalStringOfType denv ty), m, m2)) | _ -> match ty with - | SpecialComparableHeadType g tinst -> - tinst |> IterateD (SolveTypeSupportsComparison (csenv: ConstraintSolverEnv) ndeep m2 trace) + | SpecialComparableHeadType g tinst -> + IterateD (SolveTypeSupportsComparison (csenv: ConstraintSolverEnv) ndeep m2 trace) tinst | _ -> // Check the basic requirement - IComparable or IStructuralComparable or assumed if ExistsSameHeadTypeInHierarchy g amap m2 ty g.mk_IComparable_ty || @@ -2442,7 +2909,7 @@ and SolveTypeRequiresDefaultConstructor (csenv: ConstraintSolverEnv) ndeep m2 tr | ValueSome tp -> AddConstraint csenv ndeep m2 trace tp (TyparConstraint.RequiresDefaultConstructor m) | _ -> - if isStructTy g ty then + if isStructTy g ty && (isStructTupleTy g ty || isStructAnonRecdTy g ty || TypeHasDefaultValue g m ty) then if isStructTupleTy g ty then destStructTupleTy g ty |> IterateD (SolveTypeRequiresDefaultValue csenv ndeep m trace) elif isStructAnonRecdTy g ty then @@ -2544,7 +3011,13 @@ and CanMemberSigsMatchUpToCheck else ErrorD(Error (FSComp.SR.csMemberIsNotInstance(minfo.LogicalName), m)) else - MapCombineTDC2D subsumeTypes calledObjArgTys callerObjArgTys + // The object types must be non-null + let nonNullCalledObjArgTys = + if not calledMeth.Method.IsExtensionMember then + calledObjArgTys |> List.map (replaceNullnessOfTy g.knownWithoutNull) + else + calledObjArgTys + MapCombineTDC2D subsumeTypes nonNullCalledObjArgTys callerObjArgTys let! usesTDC3 = calledMeth.ArgSets |> MapCombineTDCD (fun argSet -> @@ -2669,25 +3142,27 @@ and ArgsMustSubsumeOrConvert isConstraint enforceNullableOptionalsKnownTypes // use known types from nullable optional args? (calledArg: CalledArg) - (callerArg: CallerArg<'T>) = trackErrors { + (callerArg: CallerArg<'T>) = + trackErrors { + let g = csenv.g + let m = callerArg.Range + let calledArgTy, usesTDC, eqn = AdjustCalledArgType csenv.InfoReader ad isConstraint enforceNullableOptionalsKnownTypes calledArg callerArg + + match eqn with + | Some (ty1, ty2, msg) -> + do! SolveTypeEqualsTypeWithReport csenv ndeep m trace cxsln ty1 ty2 + msg csenv.DisplayEnv + | None -> () - let g = csenv.g - let m = callerArg.Range - let calledArgTy, usesTDC, eqn = AdjustCalledArgType csenv.InfoReader ad isConstraint enforceNullableOptionalsKnownTypes calledArg callerArg - match eqn with - | Some (ty1, ty2, msg) -> - do! SolveTypeEqualsTypeWithReport csenv ndeep m trace cxsln ty1 ty2 - msg csenv.DisplayEnv - | None -> () - match usesTDC with - | TypeDirectedConversionUsed.Yes(warn, _, _) -> do! WarnD(warn csenv.DisplayEnv) - | TypeDirectedConversionUsed.No -> () - do! SolveTypeSubsumesTypeWithReport csenv ndeep m trace cxsln (Some calledArg.CalledArgumentType) calledArgTy callerArg.CallerArgumentType - if calledArg.IsParamArray && isArray1DTy g calledArgTy && not (isArray1DTy g callerArg.CallerArgumentType) then - return! ErrorD(Error(FSComp.SR.csMethodExpectsParams(), m)) - else - return usesTDC - } + match usesTDC with + | TypeDirectedConversionUsed.Yes(warn, _, _) -> do! WarnD(warn csenv.DisplayEnv) + | TypeDirectedConversionUsed.No -> () + do! SolveTypeSubsumesTypeWithReport csenv ndeep m trace cxsln (Some calledArg.CalledArgumentType) calledArgTy callerArg.CallerArgumentType + if calledArg.IsParamArray && isArray1DTy g calledArgTy && not (isArray1DTy g callerArg.CallerArgumentType) then + return! ErrorD(Error(FSComp.SR.csMethodExpectsParams(), m)) + else + return usesTDC + } // This is a slight variation on ArgsMustSubsumeOrConvert that adds contextual error report to the // subsumption check. The two could likely be combines. @@ -3248,7 +3723,7 @@ and GetMostApplicableOverload csenv ndeep candidates applicableMeths calledMethG // F# 5.0 rule - prior to F# 5.0 named arguments (on the caller side) were not being taken // into account when comparing overloads. So adding a name to an argument might mean - // overloads ould no longer be distinguished. We thus look at *all* arguments (whether + // overloads could no longer be distinguished. We thus look at *all* arguments (whether // optional or not) as an additional comparison technique. let c = if g.langVersion.SupportsFeature(LanguageFeature.NullableOptionalInterop) then @@ -3272,7 +3747,13 @@ and GetMostApplicableOverload csenv ndeep candidates applicableMeths calledMethG 0 if c <> 0 then c else - 0 + // Properties are kept incl. almost-duplicates because of the partial-override possibility. + // E.g. base can have get,set and derived only get => we keep both props around until method resolution time. + // Now is the type to pick the better (more derived) one. + match candidate.AssociatedPropertyInfo,other.AssociatedPropertyInfo,candidate.Method.IsExtensionMember,other.Method.IsExtensionMember with + | Some p1, Some p2, false, false -> compareTypes p1.ApparentEnclosingType p2.ApparentEnclosingType + | _ -> 0 + let bestMethods = let indexedApplicableMeths = applicableMeths |> List.indexed @@ -3482,6 +3963,13 @@ let AddCxMethodConstraint denv css m trace traitInfo = (fun res -> ErrorD (ErrorFromAddingConstraint(denv, res, m))) |> RaiseOperationResult +let AddCxTypeDefnNotSupportsNull denv css m trace ty = + let csenv = MakeConstraintSolverEnv ContextInfo.NoContext css m denv + PostponeOnFailedMemberConstraintResolution csenv trace + (fun csenv -> SolveTypeUseNotSupportsNull csenv 0 m trace ty) + (fun res -> ErrorD (ErrorFromAddingConstraint(denv, res, m))) + |> RaiseOperationResult + let AddCxTypeUseSupportsNull denv css m trace ty = let csenv = MakeConstraintSolverEnv ContextInfo.NoContext css m denv PostponeOnFailedMemberConstraintResolution csenv trace @@ -3489,6 +3977,12 @@ let AddCxTypeUseSupportsNull denv css m trace ty = (fun res -> ErrorD (ErrorFromAddingConstraint(denv, res, m))) |> RaiseOperationResult +let AddCxTypeCanCarryNullnessInfo denv css m ty nullness = + let csenv = MakeConstraintSolverEnv ContextInfo.NoContext css m denv + let canCarryNullnessCheck() = SolveTypeCanCarryNullness csenv ty nullness |> RaiseOperationResult + csenv.SolverState.PushPostInferenceCheck (preDefaults=false, check = canCarryNullnessCheck) + + let AddCxTypeMustSupportComparison denv css m trace ty = let csenv = MakeConstraintSolverEnv ContextInfo.NoContext css m denv PostponeOnFailedMemberConstraintResolution csenv trace @@ -3581,46 +4075,53 @@ let CreateCodegenState tcVal g amap = ExtraCxs = HashMultiMap(10, HashIdentity.Structural) InfoReader = InfoReader(g, amap) PostInferenceChecksPreDefaults = ResizeArray() - PostInferenceChecksFinal = ResizeArray() } + PostInferenceChecksFinal = ResizeArray() + WarnWhenUsingWithoutNullOnAWithNullTarget = None} /// Determine if a codegen witness for a trait will require witness args to be available, e.g. in generic code -let CodegenWitnessExprForTraitConstraintWillRequireWitnessArgs tcVal g amap m (traitInfo:TraitConstraintInfo) = trackErrors { - let css = CreateCodegenState tcVal g amap - let csenv = MakeConstraintSolverEnv ContextInfo.NoContext css m (DisplayEnv.Empty g) - let! _res = SolveMemberConstraint csenv true PermitWeakResolution.Yes 0 m NoTrace traitInfo - let res = - match traitInfo.Solution with - | None - | Some BuiltInSln -> true - | _ -> false - return res - } +let CodegenWitnessExprForTraitConstraintWillRequireWitnessArgs tcVal g amap m (traitInfo:TraitConstraintInfo) = + trackErrors { + let css = CreateCodegenState tcVal g amap + let csenv = MakeConstraintSolverEnv ContextInfo.NoContext css m (DisplayEnv.Empty g) + + let! _res = SolveMemberConstraint csenv true PermitWeakResolution.Yes 0 m NoTrace traitInfo + + let res = + match traitInfo.Solution with + | None + | Some BuiltInSln -> true + | _ -> false + return res + } /// Generate a witness expression if none is otherwise available, e.g. in legacy non-witness-passing code -let CodegenWitnessExprForTraitConstraint tcVal g amap m (traitInfo:TraitConstraintInfo) argExprs = trackErrors { - let css = CreateCodegenState tcVal g amap - let csenv = MakeConstraintSolverEnv ContextInfo.NoContext css m (DisplayEnv.Empty g) - let! _res = SolveMemberConstraint csenv true PermitWeakResolution.Yes 0 m NoTrace traitInfo - return GenWitnessExpr amap g m traitInfo argExprs - } +let CodegenWitnessExprForTraitConstraint tcVal g amap m (traitInfo:TraitConstraintInfo) argExprs = + trackErrors { + let css = CreateCodegenState tcVal g amap + let csenv = MakeConstraintSolverEnv ContextInfo.NoContext css m (DisplayEnv.Empty g) + let! _res = SolveMemberConstraint csenv true PermitWeakResolution.Yes 0 m NoTrace traitInfo + return GenWitnessExpr amap g m traitInfo argExprs + } /// Generate the lambda argument passed for a use of a generic construct that accepts trait witnesses -let CodegenWitnessesForTyparInst tcVal g amap m typars tyargs = trackErrors { - let css = CreateCodegenState tcVal g amap - let csenv = MakeConstraintSolverEnv ContextInfo.NoContext css m (DisplayEnv.Empty g) - let ftps, _renaming, tinst = FreshenTypeInst g m typars - let traitInfos = GetTraitConstraintInfosOfTypars g ftps - do! SolveTyparsEqualTypes csenv 0 m NoTrace tinst tyargs - return GenWitnessArgs amap g m traitInfos - } +let CodegenWitnessesForTyparInst tcVal g amap m typars tyargs = + trackErrors { + let css = CreateCodegenState tcVal g amap + let csenv = MakeConstraintSolverEnv ContextInfo.NoContext css m (DisplayEnv.Empty g) + let ftps, _renaming, tinst = FreshenTypeInst g m typars + let traitInfos = GetTraitConstraintInfosOfTypars g ftps + let! _res = SolveTyparsEqualTypes csenv 0 m NoTrace tinst tyargs + return GenWitnessArgs amap g m traitInfos + } /// Generate the lambda argument passed for a use of a generic construct that accepts trait witnesses -let CodegenWitnessArgForTraitConstraint tcVal g amap m traitInfo = trackErrors { - let css = CreateCodegenState tcVal g amap - let csenv = MakeConstraintSolverEnv ContextInfo.NoContext css m (DisplayEnv.Empty g) - let! _res = SolveMemberConstraint csenv true PermitWeakResolution.Yes 0 m NoTrace traitInfo - return GenWitnessExprLambda amap g m traitInfo - } +let CodegenWitnessArgForTraitConstraint tcVal g amap m traitInfo = + trackErrors { + let css = CreateCodegenState tcVal g amap + let csenv = MakeConstraintSolverEnv ContextInfo.NoContext css m (DisplayEnv.Empty g) + let! _res = SolveMemberConstraint csenv true PermitWeakResolution.Yes 0 m NoTrace traitInfo + return GenWitnessExprLambda amap g m traitInfo + } /// For some code like "let f() = ([] = [])", a free choice is made for a type parameter /// for an interior type variable. This chooses a solution for a type parameter subject @@ -3670,7 +4171,8 @@ let IsApplicableMethApprox g amap m (minfo: MethInfo) availObjTy = ExtraCxs = HashMultiMap(10, HashIdentity.Structural) InfoReader = InfoReader(g, amap) PostInferenceChecksPreDefaults = ResizeArray() - PostInferenceChecksFinal = ResizeArray() } + PostInferenceChecksFinal = ResizeArray() + WarnWhenUsingWithoutNullOnAWithNullTarget = None} let csenv = MakeConstraintSolverEnv ContextInfo.NoContext css m (DisplayEnv.Empty g) let minst = FreshenMethInfo m minfo match minfo.GetObjArgTypes(amap, m, minst) with @@ -3685,4 +4187,4 @@ let IsApplicableMethApprox g amap m (minfo: MethInfo) availObjTy = |> CommitOperationResult | _ -> true else - true + true \ No newline at end of file diff --git a/src/Compiler/Checking/ConstraintSolver.fsi b/src/Compiler/Checking/ConstraintSolver.fsi index aab7c04dfec..4c29d684c31 100644 --- a/src/Compiler/Checking/ConstraintSolver.fsi +++ b/src/Compiler/Checking/ConstraintSolver.fsi @@ -119,6 +119,28 @@ exception ConstraintSolverTypesNotInSubsumptionRelation of exception ConstraintSolverMissingConstraint of displayEnv: DisplayEnv * Typar * TyparConstraint * range * range +exception ConstraintSolverNullnessWarningEquivWithTypes of + DisplayEnv * + TType * + TType * + NullnessInfo * + NullnessInfo * + range * + range + +exception ConstraintSolverNullnessWarningWithTypes of + DisplayEnv * + TType * + TType * + NullnessInfo * + NullnessInfo * + range * + range + +exception ConstraintSolverNullnessWarningWithType of DisplayEnv * TType * NullnessInfo * range * range + +exception ConstraintSolverNullnessWarning of string * range * range + exception ConstraintSolverError of string * range * range exception ErrorFromApplyingDefault of @@ -166,8 +188,32 @@ exception ArgDoesNotMatchError of /// A function that denotes captured tcVal, Used in constraint solver and elsewhere to get appropriate expressions for a ValRef. type TcValF = ValRef -> ValUseFlag -> TType list -> range -> Expr * TType -[] type ConstraintSolverState = + { + g: TcGlobals + + amap: ImportMap + + InfoReader: InfoReader + + /// The function used to freshen values we encounter during trait constraint solving + TcVal: TcValF + + /// This table stores all unsolved, ungeneralized trait constraints, indexed by free type variable. + /// That is, there will be one entry in this table for each free type variable in + /// each outstanding, unsolved, ungeneralized trait constraint. Constraints are removed from the table and resolved + /// each time a solution to an index variable is found. + mutable ExtraCxs: Internal.Utilities.Collections.HashMultiMap + + /// Checks to run after all inference is complete, but before defaults are applied and internal unknowns solved + PostInferenceChecksPreDefaults: ResizeArray unit> + + /// Checks to run after all inference is complete. + PostInferenceChecksFinal: ResizeArray unit> + + WarnWhenUsingWithoutNullOnAWithNullTarget: string option + } + static member New: TcGlobals * ImportMap * InfoReader * TcValF -> ConstraintSolverState /// Add a post-inference check to run at the end of inference @@ -241,8 +287,12 @@ val AddCxTypeMustSubsumeTypeMatchingOnlyUndoIfFailed: val AddCxMethodConstraint: DisplayEnv -> ConstraintSolverState -> range -> OptionalTrace -> TraitConstraintInfo -> unit +val AddCxTypeDefnNotSupportsNull: DisplayEnv -> ConstraintSolverState -> range -> OptionalTrace -> TType -> unit + val AddCxTypeUseSupportsNull: DisplayEnv -> ConstraintSolverState -> range -> OptionalTrace -> TType -> unit +val AddCxTypeCanCarryNullnessInfo: DisplayEnv -> ConstraintSolverState -> range -> TType -> Nullness -> unit + val AddCxTypeMustSupportComparison: DisplayEnv -> ConstraintSolverState -> range -> OptionalTrace -> TType -> unit val AddCxTypeMustSupportEquality: DisplayEnv -> ConstraintSolverState -> range -> OptionalTrace -> TType -> unit diff --git a/src/Compiler/Checking/Expressions/CheckArrayOrListComputedExpressions.fs b/src/Compiler/Checking/Expressions/CheckArrayOrListComputedExpressions.fs new file mode 100644 index 00000000000..f8a2abd7d73 --- /dev/null +++ b/src/Compiler/Checking/Expressions/CheckArrayOrListComputedExpressions.fs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +/// Sequence expressions checking +module internal FSharp.Compiler.CheckArrayOrListComputedExpressions + +open FSharp.Compiler.CheckBasics +open FSharp.Compiler.ConstraintSolver +open FSharp.Compiler.CheckExpressionsOps +open FSharp.Compiler.CheckExpressions +open FSharp.Compiler.NameResolution +open FSharp.Compiler.TypedTreeOps +open FSharp.Compiler.Features +open FSharp.Compiler.DiagnosticsLogger +open FSharp.Compiler.Syntax +open FSharp.Compiler.CheckSequenceExpressions + +let TcArrayOrListComputedExpression (cenv: TcFileState) env (overallTy: OverallTy) tpenv (isArray, comp) m = + let g = cenv.g + + // The syntax '[ n .. m ]' and '[ n .. step .. m ]' is not really part of array or list syntax. + // It could be in the future, e.g. '[ 1; 2..30; 400 ]' + // + // The elaborated form of '[ n .. m ]' is 'List.ofSeq (seq (op_Range n m))' and this shouldn't change + match RewriteRangeExpr comp with + | Some replacementExpr -> + let genCollElemTy = NewInferenceType g + + let genCollTy = (if isArray then mkArrayType else mkListTy) cenv.g genCollElemTy + + UnifyTypes cenv env m overallTy.Commit genCollTy + + let exprTy = mkSeqTy cenv.g genCollElemTy + + let expr, tpenv = TcExpr cenv (MustEqual exprTy) env tpenv replacementExpr + + let expr = + if cenv.g.compilingFSharpCore then + expr + else + // We add a call to 'seq ... ' to make sure sequence expression compilation gets applied to the contents of the + // comprehension. But don't do this in FSharp.Core.dll since 'seq' may not yet be defined. + mkCallSeq cenv.g m genCollElemTy expr + + let expr = mkCoerceExpr (expr, exprTy, expr.Range, overallTy.Commit) + + let expr = + if isArray then + mkCallSeqToArray cenv.g m genCollElemTy expr + else + mkCallSeqToList cenv.g m genCollElemTy expr + + expr, tpenv + + | None -> + + // LanguageFeatures.ImplicitYield do not require this validation + let implicitYieldEnabled = + cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield + + let validateExpressionWithIfRequiresParenthesis = not implicitYieldEnabled + let acceptDeprecatedIfThenExpression = not implicitYieldEnabled + + match comp with + | SimpleSemicolonSequence cenv acceptDeprecatedIfThenExpression elems -> + match comp with + | SimpleSemicolonSequence cenv false _ -> () + | _ when validateExpressionWithIfRequiresParenthesis -> + errorR (Deprecated(FSComp.SR.tcExpressionWithIfRequiresParenthesis (), m)) + | _ -> () + + let replacementExpr = + if isArray then + // This are to improve parsing/processing speed for parser tables by converting to an array blob ASAP + let nelems = elems.Length + + if + nelems > 0 + && List.forall + (function + | SynExpr.Const(SynConst.UInt16 _, _) -> true + | _ -> false) + elems + then + SynExpr.Const( + SynConst.UInt16s( + Array.ofList ( + List.map + (function + | SynExpr.Const(SynConst.UInt16 x, _) -> x + | _ -> failwith "unreachable") + elems + ) + ), + m + ) + elif + nelems > 0 + && List.forall + (function + | SynExpr.Const(SynConst.Byte _, _) -> true + | _ -> false) + elems + then + SynExpr.Const( + SynConst.Bytes( + Array.ofList ( + List.map + (function + | SynExpr.Const(SynConst.Byte x, _) -> x + | _ -> failwith "unreachable") + elems + ), + SynByteStringKind.Regular, + m + ), + m + ) + else + SynExpr.ArrayOrList(isArray, elems, m) + else if cenv.g.langVersion.SupportsFeature(LanguageFeature.ReallyLongLists) then + SynExpr.ArrayOrList(isArray, elems, m) + else + if elems.Length > 500 then + error (Error(FSComp.SR.tcListLiteralMaxSize (), m)) + + SynExpr.ArrayOrList(isArray, elems, m) + + TcExprUndelayed cenv overallTy env tpenv replacementExpr + | _ -> + + let genCollElemTy = NewInferenceType g + + let genCollTy = (if isArray then mkArrayType else mkListTy) cenv.g genCollElemTy + + // Propagating type directed conversion, e.g. for + // let x : seq = [ yield 1; if true then yield 2 ] + TcPropagatingExprLeafThenConvert cenv overallTy genCollTy env (* canAdhoc *) m (fun () -> + + let exprTy = mkSeqTy cenv.g genCollElemTy + + // Check the comprehension + let expr, tpenv = TcSequenceExpression cenv env tpenv comp (MustEqual exprTy) m + + let expr = mkCoerceIfNeeded cenv.g exprTy (tyOfExpr cenv.g expr) expr + + let expr = + if cenv.g.compilingFSharpCore then + //warning(Error(FSComp.SR.fslibUsingComputedListOrArray(), expr.Range)) + expr + else + // We add a call to 'seq ... ' to make sure sequence expression compilation gets applied to the contents of the + // comprehension. But don't do this in FSharp.Core.dll since 'seq' may not yet be defined. + mkCallSeq cenv.g m genCollElemTy expr + + let expr = mkCoerceExpr (expr, exprTy, expr.Range, overallTy.Commit) + + let expr = + if isArray then + mkCallSeqToArray cenv.g m genCollElemTy expr + else + mkCallSeqToList cenv.g m genCollElemTy expr + + expr, tpenv) diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs new file mode 100644 index 00000000000..3a3682fbf53 --- /dev/null +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -0,0 +1,3138 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +/// The typechecker. Left-to-right constrained type checking +/// with generalization at appropriate points. +module internal FSharp.Compiler.CheckComputationExpressions + +open Internal.Utilities.Library +open FSharp.Compiler.AccessibilityLogic +open FSharp.Compiler.AttributeChecking +open FSharp.Compiler.CheckExpressionsOps +open FSharp.Compiler.CheckExpressions +open FSharp.Compiler.CheckBasics +open FSharp.Compiler.ConstraintSolver +open FSharp.Compiler.DiagnosticsLogger +open FSharp.Compiler.Features +open FSharp.Compiler.Infos +open FSharp.Compiler.InfoReader +open FSharp.Compiler.NameResolution +open FSharp.Compiler.Syntax.PrettyNaming +open FSharp.Compiler.Syntax +open FSharp.Compiler.SyntaxTrivia +open FSharp.Compiler.SyntaxTreeOps +open FSharp.Compiler.Text +open FSharp.Compiler.Text.Range +open FSharp.Compiler.TypedTree +open FSharp.Compiler.TypedTreeOps +open System.Collections.Generic + +type cenv = TcFileState + +/// Used to flag if this is the first or a subsequent translation pass through a computation expression +[] +type CompExprTranslationPass = + | Initial + | Subsequent + +/// Used to flag if computation expression custom operations are allowed in a given context +[] +type CustomOperationsMode = + | Allowed + | Denied + +[] +type ComputationExpressionContext<'a> = + { + cenv: TcFileState + env: TcEnv + tpenv: UnscopedTyparEnv + customOperationMethodsIndexedByKeyword: + IDictionary * MethInfo>> + customOperationMethodsIndexedByMethodName: + IDictionary * MethInfo>> + sourceMethInfo: 'a list + builderValName: string + ad: AccessorDomain + builderTy: TType + isQuery: bool + enableImplicitYield: bool + origComp: SynExpr + mWhole: range + emptyVarSpace: LazyWithContext * TcEnv, range> + } + +let inline TryFindIntrinsicOrExtensionMethInfo collectionSettings (cenv: cenv) (env: TcEnv) m ad nm ty = + AllMethInfosOfTypeInScope collectionSettings cenv.infoReader env.NameEnv (Some nm) ad IgnoreOverrides m ty + +/// Ignores an attribute +let inline IgnoreAttribute _ = None + +let inline arbPat (m: range) = + mkSynPatVar None (mkSynId (m.MakeSynthetic()) "_missingVar") + +let inline arbKeySelectors m = + mkSynBifix m "=" (arbExpr ("_keySelectors", m)) (arbExpr ("_keySelector2", m)) + +// Flag that a debug point should get emitted prior to both the evaluation of 'rhsExpr' and the call to Using +let inline addBindDebugPoint spBind e = + match spBind with + | DebugPointAtBinding.Yes m -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes m, false, e) + | _ -> e + +let inline mkSynDelay2 (e: SynExpr) = mkSynDelay (e.Range.MakeSynthetic()) e + +/// Make a builder.Method(...) call +let mkSynCall nm (m: range) args builderValName = + let m = m.MakeSynthetic() // Mark as synthetic so the language service won't pick it up. + + let args = + match args with + | [] -> SynExpr.Const(SynConst.Unit, m) + | [ arg ] -> SynExpr.Paren(SynExpr.Paren(arg, range0, None, m), range0, None, m) + | args -> SynExpr.Paren(SynExpr.Tuple(false, args, [], m), range0, None, m) + + let builderVal = mkSynIdGet m builderValName + mkSynApp1 (SynExpr.DotGet(builderVal, range0, SynLongIdent([ mkSynId m nm ], [], [ None ]), m)) args m + +// Optionally wrap sources of "let!", "yield!", "use!" in "query.Source" +let mkSourceExpr callExpr sourceMethInfo builderValName = + match sourceMethInfo with + | [] -> callExpr + | _ -> mkSynCall "Source" callExpr.Range [ callExpr ] builderValName + +let mkSourceExprConditional isFromSource callExpr sourceMethInfo builderValName = + if isFromSource then + mkSourceExpr callExpr sourceMethInfo builderValName + else + callExpr + +let inline mkSynLambda p e m = + SynExpr.Lambda(false, false, p, e, None, m, SynExprLambdaTrivia.Zero) + +let mkExprForVarSpace m (patvs: Val list) = + match patvs with + | [] -> SynExpr.Const(SynConst.Unit, m) + | [ v ] -> SynExpr.Ident v.Id + | vs -> SynExpr.Tuple(false, (vs |> List.map (fun v -> SynExpr.Ident(v.Id))), [], m) + +let mkSimplePatForVarSpace m (patvs: Val list) = + let spats = + match patvs with + | [] -> [] + | [ v ] -> [ mkSynSimplePatVar false v.Id ] + | vs -> vs |> List.map (fun v -> mkSynSimplePatVar false v.Id) + + SynSimplePats.SimplePats(spats, [], m) + +let mkPatForVarSpace m (patvs: Val list) = + match patvs with + | [] -> SynPat.Const(SynConst.Unit, m) + | [ v ] -> mkSynPatVar None v.Id + | vs -> SynPat.Tuple(false, (vs |> List.map (fun x -> mkSynPatVar None x.Id)), [], m) + +let hasMethInfo nm cenv env mBuilderVal ad builderTy = + match TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBuilderVal ad nm builderTy with + | [] -> false + | _ -> true + +let getCustomOperationMethods (cenv: TcFileState) (env: TcEnv) ad mBuilderVal builderTy = + let allMethInfos = + AllMethInfosOfTypeInScope + ResultCollectionSettings.AllResults + cenv.infoReader + env.NameEnv + None + ad + IgnoreOverrides + mBuilderVal + builderTy + + [ + for methInfo in allMethInfos do + if IsMethInfoAccessible cenv.amap mBuilderVal ad methInfo then + let nameSearch = + TryBindMethInfoAttribute + cenv.g + mBuilderVal + cenv.g.attrib_CustomOperationAttribute + methInfo + IgnoreAttribute // We do not respect this attribute for IL methods + (fun attr -> + // NOTE: right now, we support of custom operations with spaces in them ([]) + // In the parameterless CustomOperationAttribute - we use the method name, and also allow it to be ````-quoted (member _.``foo bar`` _ = ...) + match attr with + // Empty string and parameterless constructor - we use the method name + | Attrib(unnamedArgs = [ AttribStringArg "" ]) // Empty string as parameter + | Attrib(unnamedArgs = []) -> // No parameters, same as empty string for compat reasons. + Some methInfo.LogicalName + // Use the specified name + | Attrib(unnamedArgs = [ AttribStringArg msg ]) -> Some msg + | _ -> None) + IgnoreAttribute // We do not respect this attribute for provided methods + + match nameSearch with + | None -> () + | Some nm -> + let joinConditionWord = + TryBindMethInfoAttribute + cenv.g + mBuilderVal + cenv.g.attrib_CustomOperationAttribute + methInfo + IgnoreAttribute // We do not respect this attribute for IL methods + (function + | Attrib(propVal = ExtractAttribNamedArg "JoinConditionWord" (AttribStringArg s)) -> Some s + | _ -> None) + IgnoreAttribute // We do not respect this attribute for provided methods + + let flagSearch (propName: string) = + TryBindMethInfoAttribute + cenv.g + mBuilderVal + cenv.g.attrib_CustomOperationAttribute + methInfo + IgnoreAttribute // We do not respect this attribute for IL methods + (function + | Attrib(propVal = ExtractAttribNamedArg propName (AttribBoolArg b)) -> Some b + | _ -> None) + IgnoreAttribute // We do not respect this attribute for provided methods + + let maintainsVarSpaceUsingBind = + defaultArg (flagSearch "MaintainsVariableSpaceUsingBind") false + + let maintainsVarSpace = defaultArg (flagSearch "MaintainsVariableSpace") false + let allowInto = defaultArg (flagSearch "AllowIntoPattern") false + let isLikeZip = defaultArg (flagSearch "IsLikeZip") false + let isLikeJoin = defaultArg (flagSearch "IsLikeJoin") false + let isLikeGroupJoin = defaultArg (flagSearch "IsLikeGroupJoin") false + + nm, + maintainsVarSpaceUsingBind, + maintainsVarSpace, + allowInto, + isLikeZip, + isLikeJoin, + isLikeGroupJoin, + joinConditionWord, + methInfo + ] + +/// Decide if the identifier represents a use of a custom query operator +let tryGetDataForCustomOperation (nm: Ident) ceenv = + let isOpDataCountAllowed opDatas = + match opDatas with + | [ _ ] -> true + | _ :: _ -> ceenv.cenv.g.langVersion.SupportsFeature LanguageFeature.OverloadsForCustomOperations + | _ -> false + + match ceenv.customOperationMethodsIndexedByKeyword.TryGetValue nm.idText with + | true, opDatas when isOpDataCountAllowed opDatas -> + for opData in opDatas do + let (opName, + maintainsVarSpaceUsingBind, + maintainsVarSpace, + _allowInto, + isLikeZip, + isLikeJoin, + isLikeGroupJoin, + _joinConditionWord, + methInfo) = + opData + + if + (maintainsVarSpaceUsingBind && maintainsVarSpace) + || (isLikeZip && isLikeJoin) + || (isLikeZip && isLikeGroupJoin) + || (isLikeJoin && isLikeGroupJoin) + then + errorR (Error(FSComp.SR.tcCustomOperationInvalid opName, nm.idRange)) + + if not (ceenv.cenv.g.langVersion.SupportsFeature LanguageFeature.OverloadsForCustomOperations) then + match ceenv.customOperationMethodsIndexedByMethodName.TryGetValue methInfo.LogicalName with + | true, [ _ ] -> () + | _ -> errorR (Error(FSComp.SR.tcCustomOperationMayNotBeOverloaded nm.idText, nm.idRange)) + + Some opDatas + | true, opData :: _ -> + errorR (Error(FSComp.SR.tcCustomOperationMayNotBeOverloaded nm.idText, nm.idRange)) + Some [ opData ] + | _ -> None + +let isCustomOperation ceenv nm = + tryGetDataForCustomOperation nm ceenv |> Option.isSome + +let customOperationCheckValidity m f opDatas = + let vs = List.map f opDatas + let v0 = vs[0] + + let (opName, + _maintainsVarSpaceUsingBind, + _maintainsVarSpace, + _allowInto, + _isLikeZip, + _isLikeJoin, + _isLikeGroupJoin, + _joinConditionWord, + _methInfo) = + opDatas[0] + + if not (List.allEqual vs) then + errorR (Error(FSComp.SR.tcCustomOperationInvalid opName, m)) + + v0 + +// Check for the MaintainsVariableSpace on custom operation +let customOperationMaintainsVarSpace ceenv (nm: Ident) = + match tryGetDataForCustomOperation nm ceenv with + | None -> false + | Some opDatas -> + opDatas + |> customOperationCheckValidity + nm.idRange + (fun + (_nm, + _maintainsVarSpaceUsingBind, + maintainsVarSpace, + _allowInto, + _isLikeZip, + _isLikeJoin, + _isLikeGroupJoin, + _joinConditionWord, + _methInfo) -> maintainsVarSpace) + +let customOperationMaintainsVarSpaceUsingBind ceenv (nm: Ident) = + match tryGetDataForCustomOperation nm ceenv with + | None -> false + | Some opDatas -> + opDatas + |> customOperationCheckValidity + nm.idRange + (fun + (_nm, + maintainsVarSpaceUsingBind, + _maintainsVarSpace, + _allowInto, + _isLikeZip, + _isLikeJoin, + _isLikeGroupJoin, + _joinConditionWord, + _methInfo) -> maintainsVarSpaceUsingBind) + +let customOperationIsLikeZip ceenv (nm: Ident) = + match tryGetDataForCustomOperation nm ceenv with + | None -> false + | Some opDatas -> + opDatas + |> customOperationCheckValidity + nm.idRange + (fun + (_nm, + _maintainsVarSpaceUsingBind, + _maintainsVarSpace, + _allowInto, + isLikeZip, + _isLikeJoin, + _isLikeGroupJoin, + _joinConditionWord, + _methInfo) -> isLikeZip) + +let customOperationIsLikeJoin ceenv (nm: Ident) = + match tryGetDataForCustomOperation nm ceenv with + | None -> false + | Some opDatas -> + opDatas + |> customOperationCheckValidity + nm.idRange + (fun + (_nm, + _maintainsVarSpaceUsingBind, + _maintainsVarSpace, + _allowInto, + _isLikeZip, + isLikeJoin, + _isLikeGroupJoin, + _joinConditionWord, + _methInfo) -> isLikeJoin) + +let customOperationIsLikeGroupJoin ceenv (nm: Ident) = + match tryGetDataForCustomOperation nm ceenv with + | None -> false + | Some opDatas -> + opDatas + |> customOperationCheckValidity + nm.idRange + (fun + (_nm, + _maintainsVarSpaceUsingBind, + _maintainsVarSpace, + _allowInto, + _isLikeZip, + _isLikeJoin, + isLikeGroupJoin, + _joinConditionWord, + _methInfo) -> isLikeGroupJoin) + +let customOperationJoinConditionWord ceenv (nm: Ident) = + match tryGetDataForCustomOperation nm ceenv with + | Some opDatas -> + opDatas + |> customOperationCheckValidity + nm.idRange + (fun + (_nm, + _maintainsVarSpaceUsingBind, + _maintainsVarSpace, + _allowInto, + _isLikeZip, + _isLikeJoin, + _isLikeGroupJoin, + joinConditionWord, + _methInfo) -> joinConditionWord) + |> function + | None -> "on" + | Some v -> v + | _ -> "on" + +let customOperationAllowsInto ceenv (nm: Ident) = + match tryGetDataForCustomOperation nm ceenv with + | None -> false + | Some opDatas -> + opDatas + |> customOperationCheckValidity + nm.idRange + (fun + (_nm, + _maintainsVarSpaceUsingBind, + _maintainsVarSpace, + allowInto, + _isLikeZip, + _isLikeJoin, + _isLikeGroupJoin, + _joinConditionWord, + _methInfo) -> allowInto) + +let customOpUsageText ceenv nm = + match tryGetDataForCustomOperation nm ceenv with + | Some((_nm, + _maintainsVarSpaceUsingBind, + _maintainsVarSpace, + _allowInto, + isLikeZip, + isLikeJoin, + isLikeGroupJoin, + _joinConditionWord, + _methInfo) :: _) -> + if isLikeGroupJoin then + Some( + FSComp.SR.customOperationTextLikeGroupJoin ( + nm.idText, + customOperationJoinConditionWord ceenv nm, + customOperationJoinConditionWord ceenv nm + ) + ) + elif isLikeJoin then + Some( + FSComp.SR.customOperationTextLikeJoin ( + nm.idText, + customOperationJoinConditionWord ceenv nm, + customOperationJoinConditionWord ceenv nm + ) + ) + elif isLikeZip then + Some(FSComp.SR.customOperationTextLikeZip (nm.idText)) + else + None + | _ -> None + +let tryGetArgAttribsForCustomOperator ceenv (nm: Ident) = + match tryGetDataForCustomOperation nm ceenv with + | Some argInfos -> + argInfos + |> List.map + (fun + (_nm, + __maintainsVarSpaceUsingBind, + _maintainsVarSpace, + _allowInto, + _isLikeZip, + _isLikeJoin, + _isLikeGroupJoin, + _joinConditionWord, + methInfo) -> + match methInfo.GetParamAttribs(ceenv.cenv.amap, ceenv.mWhole) with + | [ curriedArgInfo ] -> Some curriedArgInfo // one for the actual argument group + | _ -> None) + |> Some + | _ -> None + +let tryGetArgInfosForCustomOperator ceenv (nm: Ident) = + match tryGetDataForCustomOperation nm ceenv with + | Some argInfos -> + argInfos + |> List.map + (fun + (_nm, + __maintainsVarSpaceUsingBind, + _maintainsVarSpace, + _allowInto, + _isLikeZip, + _isLikeJoin, + _isLikeGroupJoin, + _joinConditionWord, + methInfo) -> + match methInfo with + | FSMeth(_, _, vref, _) -> + match ArgInfosOfMember ceenv.cenv.g vref with + | [ curriedArgInfo ] -> Some curriedArgInfo + | _ -> None + | _ -> None) + |> Some + | _ -> None + +let tryExpectedArgCountForCustomOperator ceenv (nm: Ident) = + match tryGetArgAttribsForCustomOperator ceenv nm with + | None -> None + | Some argInfosForOverloads -> + let nums = + argInfosForOverloads + |> List.map (function + | None -> -1 + | Some argInfos -> List.length argInfos) + + // Prior to 'OverloadsForCustomOperations' we count exact arguments. + // + // With 'OverloadsForCustomOperations' we don't compute an exact expected argument count + // if any arguments are optional, out or ParamArray. + let isSpecial = + if ceenv.cenv.g.langVersion.SupportsFeature LanguageFeature.OverloadsForCustomOperations then + argInfosForOverloads + |> List.exists (fun info -> + match info with + | None -> false + | Some args -> + args + |> List.exists (fun (ParamAttribs(isParamArrayArg, _isInArg, isOutArg, optArgInfo, _callerInfo, _reflArgInfo)) -> + isParamArrayArg || isOutArg || optArgInfo.IsOptional)) + else + false + + if not isSpecial && nums |> List.forall (fun v -> v >= 0 && v = nums[0]) then + Some(max (nums[0] - 1) 0) // drop the computation context argument + else + None + +// Check for the [] attribute on an argument position +let isCustomOperationProjectionParameter ceenv i (nm: Ident) = + match tryGetArgInfosForCustomOperator ceenv nm with + | None -> false + | Some argInfosForOverloads -> + let vs = + argInfosForOverloads + |> List.map (function + | None -> false + | Some argInfos -> + i < argInfos.Length + && let _, argInfo = List.item i argInfos in + HasFSharpAttribute ceenv.cenv.g ceenv.cenv.g.attrib_ProjectionParameterAttribute argInfo.Attribs) + + if List.allEqual vs then + vs[0] + else + let opDatas = (tryGetDataForCustomOperation nm ceenv).Value + + let opName, _, _, _, _, _, _, _j, _ = opDatas[0] + errorR (Error(FSComp.SR.tcCustomOperationInvalid opName, nm.idRange)) + false + +[] +let (|ExprAsPat|_|) (f: SynExpr) = + match f with + | SingleIdent v1 + | SynExprParen(SingleIdent v1, _, _, _) -> ValueSome(mkSynPatVar None v1) + | SynExprParen(SynExpr.Tuple(false, elems, commas, _), _, _, _) -> + let elems = elems |> List.map (|SingleIdent|_|) + + if elems |> List.forall (fun x -> x.IsSome) then + ValueSome(SynPat.Tuple(false, (elems |> List.map (fun x -> mkSynPatVar None x.Value)), commas, f.Range)) + else + ValueNone + | _ -> ValueNone + +// For join clauses that join on nullable, we syntactically insert the creation of nullable values on the appropriate side of the condition, +// then pull the syntax apart again +[] +let (|JoinRelation|_|) ceenv (expr: SynExpr) = + let m = expr.Range + let ad = ceenv.env.eAccessRights + + let isOpName opName vref s = + (s = opName) + && match + ResolveExprLongIdent + ceenv.cenv.tcSink + ceenv.cenv.nameResolver + m + ad + ceenv.env.eNameResEnv + TypeNameResolutionInfo.Default + [ ident (opName, m) ] + None + with + | Result(_, Item.Value vref2, []) -> valRefEq ceenv.cenv.g vref vref2 + | _ -> false + + match expr with + | BinOpExpr(opId, a, b) when isOpName opNameEquals ceenv.cenv.g.equals_operator_vref opId.idText -> ValueSome(a, b) + + | BinOpExpr(opId, a, b) when isOpName opNameEqualsNullable ceenv.cenv.g.equals_nullable_operator_vref opId.idText -> + + let a = + SynExpr.App(ExprAtomicFlag.Atomic, false, mkSynLidGet a.Range [ MangledGlobalName; "System" ] "Nullable", a, a.Range) + + ValueSome(a, b) + + | BinOpExpr(opId, a, b) when isOpName opNameNullableEquals ceenv.cenv.g.nullable_equals_operator_vref opId.idText -> + + let b = + SynExpr.App(ExprAtomicFlag.Atomic, false, mkSynLidGet b.Range [ MangledGlobalName; "System" ] "Nullable", b, b.Range) + + ValueSome(a, b) + + | BinOpExpr(opId, a, b) when isOpName opNameNullableEqualsNullable ceenv.cenv.g.nullable_equals_nullable_operator_vref opId.idText -> + + ValueSome(a, b) + + | _ -> ValueNone + +let (|ForEachThen|_|) synExpr = + match synExpr with + | SynExpr.ForEach(_spFor, + _spIn, + SeqExprOnly false, + isFromSource, + pat1, + expr1, + SynExpr.Sequential(isTrueSeq = true; expr1 = clause; expr2 = rest), + _) -> Some(isFromSource, pat1, expr1, clause, rest) + | _ -> None + +let (|CustomOpId|_|) isCustomOperation predicate synExpr = + match synExpr with + | SingleIdent nm when isCustomOperation nm && predicate nm -> Some nm + | _ -> None + +// e1 in e2 ('in' is parsed as 'JOIN_IN') +let (|InExpr|_|) synExpr = + match synExpr with + | SynExpr.JoinIn(e1, _, e2, mApp) -> Some(e1, e2, mApp) + | _ -> None + +// e1 on e2 (note: 'on' is the 'JoinConditionWord') +let (|OnExpr|_|) ceenv nm synExpr = + match tryGetDataForCustomOperation nm ceenv with + | None -> None + | Some _ -> + match synExpr with + | SynExpr.App(funcExpr = SynExpr.App(funcExpr = e1; argExpr = SingleIdent opName); argExpr = e2) when + opName.idText = customOperationJoinConditionWord ceenv nm + -> + let item = Item.CustomOperation(opName.idText, (fun () -> None), None) + + CallNameResolutionSink + ceenv.cenv.tcSink + (opName.idRange, ceenv.env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, ceenv.env.AccessRights) + + Some(e1, e2) + | _ -> None + +// e1 into e2 +let (|IntoSuffix|_|) (e: SynExpr) = + match e with + | SynExpr.App(funcExpr = SynExpr.App(funcExpr = x; argExpr = SingleIdent nm2); argExpr = ExprAsPat intoPat) when + nm2.idText = CustomOperations.Into + -> + Some(x, nm2.idRange, intoPat) + | _ -> None + +let JoinOrGroupJoinOp ceenv detector synExpr = + match synExpr with + | SynExpr.App(_, _, CustomOpId (isCustomOperation ceenv) detector nm, ExprAsPat innerSourcePat, mJoinCore) -> + Some(nm, innerSourcePat, mJoinCore, false) + // join with bad pattern (gives error on "join" and continues) + | SynExpr.App(_, _, CustomOpId (isCustomOperation ceenv) detector nm, _innerSourcePatExpr, mJoinCore) -> + errorR (Error(FSComp.SR.tcBinaryOperatorRequiresVariable (nm.idText, Option.get (customOpUsageText ceenv nm)), nm.idRange)) + + Some(nm, arbPat mJoinCore, mJoinCore, true) + // join (without anything after - gives error on "join" and continues) + | CustomOpId (isCustomOperation ceenv) detector nm -> + errorR (Error(FSComp.SR.tcBinaryOperatorRequiresVariable (nm.idText, Option.get (customOpUsageText ceenv nm)), nm.idRange)) + + Some(nm, arbPat synExpr.Range, synExpr.Range, true) + | _ -> None +// JoinOrGroupJoinOp customOperationIsLikeJoin + +let (|JoinOp|_|) ceenv synExpr = + JoinOrGroupJoinOp ceenv (customOperationIsLikeJoin ceenv) synExpr + +let (|GroupJoinOp|_|) ceenv synExpr = + JoinOrGroupJoinOp ceenv (customOperationIsLikeGroupJoin ceenv) synExpr + +let MatchIntoSuffixOrRecover ceenv alreadyGivenError (nm: Ident) synExpr = + match synExpr with + | IntoSuffix(x, intoWordRange, intoPat) -> + // record the "into" as a custom operation for colorization + let item = Item.CustomOperation("into", (fun () -> None), None) + + CallNameResolutionSink + ceenv.cenv.tcSink + (intoWordRange, ceenv.env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, ceenv.env.eAccessRights) + + (x, intoPat, alreadyGivenError) + | _ -> + if not alreadyGivenError then + errorR (Error(FSComp.SR.tcOperatorIncorrectSyntax (nm.idText, Option.get (customOpUsageText ceenv nm)), nm.idRange)) + + (synExpr, arbPat synExpr.Range, true) + +let MatchOnExprOrRecover ceenv alreadyGivenError nm (onExpr: SynExpr) = + match onExpr with + | OnExpr ceenv nm (innerSource, SynExprParen(keySelectors, _, _, _)) -> (innerSource, keySelectors) + | _ -> + if not alreadyGivenError then + suppressErrorReporting (fun () -> TcExprOfUnknownType ceenv.cenv ceenv.env ceenv.tpenv onExpr) + |> ignore + + errorR (Error(FSComp.SR.tcOperatorIncorrectSyntax (nm.idText, Option.get (customOpUsageText ceenv nm)), nm.idRange)) + + (arbExpr ("_innerSource", onExpr.Range), + mkSynBifix onExpr.Range "=" (arbExpr ("_keySelectors", onExpr.Range)) (arbExpr ("_keySelector2", onExpr.Range))) + +let (|JoinExpr|_|) (ceenv: ComputationExpressionContext<'a>) synExpr = + match synExpr with + | InExpr(JoinOp ceenv (nm, innerSourcePat, _, alreadyGivenError), onExpr, mJoinCore) -> + let innerSource, keySelectors = + MatchOnExprOrRecover ceenv alreadyGivenError nm onExpr + + Some(nm, innerSourcePat, innerSource, keySelectors, mJoinCore) + | JoinOp ceenv (nm, innerSourcePat, mJoinCore, alreadyGivenError) -> + if alreadyGivenError then + errorR (Error(FSComp.SR.tcOperatorRequiresIn (nm.idText, Option.get (customOpUsageText ceenv nm)), nm.idRange)) + + Some(nm, innerSourcePat, arbExpr ("_innerSource", synExpr.Range), arbKeySelectors synExpr.Range, mJoinCore) + | _ -> None + +let (|GroupJoinExpr|_|) ceenv synExpr = + match synExpr with + | InExpr(GroupJoinOp ceenv (nm, innerSourcePat, _, alreadyGivenError), intoExpr, mGroupJoinCore) -> + let onExpr, intoPat, alreadyGivenError = + MatchIntoSuffixOrRecover ceenv alreadyGivenError nm intoExpr + + let innerSource, keySelectors = + MatchOnExprOrRecover ceenv alreadyGivenError nm onExpr + + Some(nm, innerSourcePat, innerSource, keySelectors, intoPat, mGroupJoinCore) + | GroupJoinOp ceenv (nm, innerSourcePat, mGroupJoinCore, alreadyGivenError) -> + if alreadyGivenError then + errorR (Error(FSComp.SR.tcOperatorRequiresIn (nm.idText, Option.get (customOpUsageText ceenv nm)), nm.idRange)) + + Some( + nm, + innerSourcePat, + arbExpr ("_innerSource", synExpr.Range), + arbKeySelectors synExpr.Range, + arbPat synExpr.Range, + mGroupJoinCore + ) + | _ -> None + +let (|JoinOrGroupJoinOrZipClause|_|) (ceenv: ComputationExpressionContext<'a>) synExpr = + + match synExpr with + // join innerSourcePat in innerSource on (keySelector1 = keySelector2) + | JoinExpr ceenv (nm, innerSourcePat, innerSource, keySelectors, mJoinCore) -> + Some(nm, innerSourcePat, innerSource, Some keySelectors, None, mJoinCore) + + // groupJoin innerSourcePat in innerSource on (keySelector1 = keySelector2) into intoPat + | GroupJoinExpr ceenv (nm, innerSourcePat, innerSource, keySelectors, intoPat, mGroupJoinCore) -> + Some(nm, innerSourcePat, innerSource, Some keySelectors, Some intoPat, mGroupJoinCore) + + // zip intoPat in secondSource + | InExpr(SynExpr.App(_, _, CustomOpId (isCustomOperation ceenv) (customOperationIsLikeZip ceenv) nm, ExprAsPat secondSourcePat, _), + secondSource, + mZipCore) -> Some(nm, secondSourcePat, secondSource, None, None, mZipCore) + + // zip (without secondSource or in - gives error) + | CustomOpId (isCustomOperation ceenv) (customOperationIsLikeZip ceenv) nm -> + errorR (Error(FSComp.SR.tcOperatorIncorrectSyntax (nm.idText, Option.get (customOpUsageText ceenv nm)), nm.idRange)) + + Some(nm, arbPat synExpr.Range, arbExpr ("_secondSource", synExpr.Range), None, None, synExpr.Range) + + // zip secondSource (without in - gives error) + | SynExpr.App(_, _, CustomOpId (isCustomOperation ceenv) (customOperationIsLikeZip ceenv) nm, ExprAsPat secondSourcePat, mZipCore) -> + errorR (Error(FSComp.SR.tcOperatorIncorrectSyntax (nm.idText, Option.get (customOpUsageText ceenv nm)), mZipCore)) + + Some(nm, secondSourcePat, arbExpr ("_innerSource", synExpr.Range), None, None, mZipCore) + + | _ -> None + +let (|ForEachThenJoinOrGroupJoinOrZipClause|_|) (ceenv: ComputationExpressionContext<'a>) strict synExpr = + match synExpr with + | ForEachThen(isFromSource, + firstSourcePat, + firstSource, + JoinOrGroupJoinOrZipClause ceenv (nm, secondSourcePat, secondSource, keySelectorsOpt, pat3opt, mOpCore), + innerComp) when + (let _firstSourceSimplePats, later1 = + use _holder = TemporarilySuspendReportingTypecheckResultsToSink ceenv.cenv.tcSink + SimplePatsOfPat ceenv.cenv.synArgNameGenerator firstSourcePat + + Option.isNone later1) + -> + Some(isFromSource, firstSourcePat, firstSource, nm, secondSourcePat, secondSource, keySelectorsOpt, pat3opt, mOpCore, innerComp) + + | JoinOrGroupJoinOrZipClause ceenv (nm, pat2, expr2, expr3, pat3opt, mOpCore) when strict -> + errorR (Error(FSComp.SR.tcBinaryOperatorRequiresBody (nm.idText, Option.get (customOpUsageText ceenv nm)), nm.idRange)) + + Some( + true, + arbPat synExpr.Range, + arbExpr ("_outerSource", synExpr.Range), + nm, + pat2, + expr2, + expr3, + pat3opt, + mOpCore, + arbExpr ("_innerComp", synExpr.Range) + ) + + | _ -> None + +let (|StripApps|) e = + let rec strip e = + match e with + | SynExpr.FromParseError(SynExpr.App(funcExpr = f; argExpr = arg), _) + | SynExpr.App(funcExpr = f; argExpr = arg) -> + let g, acc = strip f + g, (arg :: acc) + | _ -> e, [] + + let g, acc = strip e + g, List.rev acc + +let (|OptionalIntoSuffix|) e = + match e with + | IntoSuffix(body, intoWordRange, intoInfo) -> (body, Some(intoWordRange, intoInfo)) + | body -> (body, None) + +let (|CustomOperationClause|_|) ceenv e = + match e with + | OptionalIntoSuffix(StripApps(SingleIdent nm, _) as core, intoOpt) when isCustomOperation ceenv nm -> + // Now we know we have a custom operation, commit the name resolution + let intoInfoOpt = + match intoOpt with + | Some(intoWordRange, intoInfo) -> + let item = Item.CustomOperation("into", (fun () -> None), None) + + CallNameResolutionSink + ceenv.cenv.tcSink + (intoWordRange, ceenv.env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, ceenv.env.eAccessRights) + + Some intoInfo + | None -> None + + Some(nm, Option.get (tryGetDataForCustomOperation nm ceenv), core, core.Range, intoInfoOpt) + | _ -> None + +let (|OptionalSequential|) e = + match e with + | SynExpr.Sequential(debugPoint = _sp; isTrueSeq = true; expr1 = dataComp1; expr2 = dataComp2) -> (dataComp1, Some dataComp2) + | _ -> (e, None) + +// "cexpr; cexpr" is treated as builder.Combine(cexpr1, cexpr1) +// This is not pretty - we have to decide which range markers we use for the calls to Combine and Delay +// NOTE: we should probably suppress these sequence points altogether +let rangeForCombine innerComp1 = + let m = + match innerComp1 with + | SynExpr.IfThenElse(trivia = { IfToThenRange = mIfToThen }) -> mIfToThen + | SynExpr.Match(matchDebugPoint = DebugPointAtBinding.Yes mMatch) -> mMatch + | SynExpr.TryWith(trivia = { TryKeyword = mTry }) -> mTry + | SynExpr.TryFinally(trivia = { TryKeyword = mTry }) -> mTry + | SynExpr.For(forDebugPoint = DebugPointAtFor.Yes mBind) -> mBind + | SynExpr.ForEach(forDebugPoint = DebugPointAtFor.Yes mBind) -> mBind + | SynExpr.While(whileDebugPoint = DebugPointAtWhile.Yes mWhile) -> mWhile + | _ -> innerComp1.Range + + m.NoteSourceConstruct(NotedSourceConstruct.Combine) + +// Check for 'where x > y', 'select x, y' and other mis-applications of infix operators, give a good error message, and return a flag +let checkForBinaryApp ceenv comp = + match comp with + | StripApps(SingleIdent nm, [ StripApps(SingleIdent nm2, args); arg2 ]) when + IsLogicalInfixOpName nm.idText + && (match tryExpectedArgCountForCustomOperator ceenv nm2 with + | Some n -> n > 0 + | _ -> false) + && not (List.isEmpty args) + -> + let estimatedRangeOfIntendedLeftAndRightArguments = + unionRanges (List.last args).Range arg2.Range + + errorR (Error(FSComp.SR.tcUnrecognizedQueryBinaryOperator (), estimatedRangeOfIntendedLeftAndRightArguments)) + true + | SynExpr.Tuple(false, StripApps(SingleIdent nm2, args) :: _, _, m) when + (match tryExpectedArgCountForCustomOperator ceenv nm2 with + | Some n -> n > 0 + | _ -> false) + && not (List.isEmpty args) + -> + let estimatedRangeOfIntendedLeftAndRightArguments = + unionRanges (List.last args).Range m.EndRange + + errorR (Error(FSComp.SR.tcUnrecognizedQueryBinaryOperator (), estimatedRangeOfIntendedLeftAndRightArguments)) + true + | _ -> false + +let inline addVarsToVarSpace (varSpace: LazyWithContext) f = + LazyWithContext.Create( + (fun m -> + let (patvs: Val list, env) = varSpace.Force m + let vs, envinner = f m env + + let patvs = + List.append + patvs + (vs + |> List.filter (fun v -> not (patvs |> List.exists (fun v2 -> v.LogicalName = v2.LogicalName)))) + + patvs, envinner), + id + ) + +/// +/// Try translate the syntax sugar +/// +/// Computation expression context (carrying caches, environments, ranges, etc) +/// Flag if it's inital check +/// a flag indicating if custom operators are allowed. They are not allowed inside try/with, try/finally, if/then/else etc. +/// a lazy data structure indicating the variables bound so far in the overall computation +/// the computation expression being analyzed +/// represents the translation of the context in which the computation expression 'comp' occurs, +/// up to a hole to be filled by (part of) the results of translating 'comp'. +/// +/// +let rec TryTranslateComputationExpression + (ceenv: ComputationExpressionContext<'a>) + (firstTry: CompExprTranslationPass) + (q: CustomOperationsMode) + (varSpace: LazyWithContext<(Val list * TcEnv), range>) + (comp: SynExpr) + (translatedCtxt: SynExpr -> SynExpr) + : SynExpr option = + // Guard the stack for deeply nested computation expressions + + let cenv = ceenv.cenv + + cenv.stackGuard.Guard + <| fun () -> + + match comp with + + // for firstSourcePat in firstSource do + // join secondSourcePat in expr2 on (expr3 = expr4) + // ... + // --> + // join expr1 expr2 (fun firstSourcePat -> expr3) (fun secondSourcePat -> expr4) (fun firstSourcePat secondSourcePat -> ...) + + // for firstSourcePat in firstSource do + // groupJoin secondSourcePat in expr2 on (expr3 = expr4) into groupPat + // ... + // --> + // groupJoin expr1 expr2 (fun firstSourcePat -> expr3) (fun secondSourcePat -> expr4) (fun firstSourcePat groupPat -> ...) + + // for firstSourcePat in firstSource do + // zip secondSource into secondSourcePat + // ... + // --> + // zip expr1 expr2 (fun pat1 pat3 -> ...) + | ForEachThenJoinOrGroupJoinOrZipClause ceenv true (isFromSource, + firstSourcePat, + firstSource, + nm, + secondSourcePat, + secondSource, + keySelectorsOpt, + secondResultPatOpt, + mOpCore, + innerComp) -> + match q with + | CustomOperationsMode.Denied -> error (Error(FSComp.SR.tcCustomOperationMayNotBeUsedHere (), nm.idRange)) + | CustomOperationsMode.Allowed -> + + let firstSource = + mkSourceExprConditional isFromSource firstSource ceenv.sourceMethInfo ceenv.builderValName + + let secondSource = + mkSourceExpr secondSource ceenv.sourceMethInfo ceenv.builderValName + + // Add the variables to the variable space, on demand + let varSpaceWithFirstVars = + addVarsToVarSpace varSpace (fun _mCustomOp env -> + use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink + + let _, _, vspecs, envinner, _ = + TcMatchPattern cenv (NewInferenceType cenv.g) env ceenv.tpenv firstSourcePat None + + vspecs, envinner) + + let varSpaceWithSecondVars = + addVarsToVarSpace varSpaceWithFirstVars (fun _mCustomOp env -> + use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink + + let _, _, vspecs, envinner, _ = + TcMatchPattern cenv (NewInferenceType cenv.g) env ceenv.tpenv secondSourcePat None + + vspecs, envinner) + + let varSpaceWithGroupJoinVars = + match secondResultPatOpt with + | Some pat3 -> + addVarsToVarSpace varSpaceWithFirstVars (fun _mCustomOp env -> + use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink + + let _, _, vspecs, envinner, _ = + TcMatchPattern cenv (NewInferenceType cenv.g) env ceenv.tpenv pat3 None + + vspecs, envinner) + | None -> varSpace + + let firstSourceSimplePats, later1 = + SimplePatsOfPat cenv.synArgNameGenerator firstSourcePat + + let secondSourceSimplePats, later2 = + SimplePatsOfPat cenv.synArgNameGenerator secondSourcePat + + if Option.isSome later1 then + errorR (Error(FSComp.SR.tcJoinMustUseSimplePattern (nm.idText), firstSourcePat.Range)) + + if Option.isSome later2 then + errorR (Error(FSComp.SR.tcJoinMustUseSimplePattern (nm.idText), secondSourcePat.Range)) + + // check 'join' or 'groupJoin' or 'zip' is permitted for this builder + match tryGetDataForCustomOperation nm ceenv with + | None -> error (Error(FSComp.SR.tcMissingCustomOperation (nm.idText), nm.idRange)) + | Some opDatas -> + let opName, _, _, _, _, _, _, _, methInfo = opDatas[0] + + // Record the resolution of the custom operation for posterity + let item = + Item.CustomOperation(opName, (fun () -> customOpUsageText ceenv nm), Some methInfo) + + // FUTURE: consider whether we can do better than emptyTyparInst here, in order to display instantiations + // of type variables in the quick info provided in the IDE. + CallNameResolutionSink + cenv.tcSink + (nm.idRange, ceenv.env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, ceenv.env.eAccessRights) + + let mkJoinExpr keySelector1 keySelector2 innerPat e = + let mSynthetic = mOpCore.MakeSynthetic() + + mkSynCall + methInfo.DisplayName + mOpCore + [ + firstSource + secondSource + mkSynLambda firstSourceSimplePats keySelector1 mSynthetic + mkSynLambda secondSourceSimplePats keySelector2 mSynthetic + mkSynLambda firstSourceSimplePats (mkSynLambda innerPat e mSynthetic) mSynthetic + ] + + let mkZipExpr e = + let mSynthetic = mOpCore.MakeSynthetic() + + mkSynCall + methInfo.DisplayName + mOpCore + [ + firstSource + secondSource + mkSynLambda firstSourceSimplePats (mkSynLambda secondSourceSimplePats e mSynthetic) mSynthetic + ] + + // wraps given expression into sequence with result produced by arbExpr so result will look like: + // l; SynExpr.ArbitraryAfterError (...) + // this allows to handle cases like 'on (a > b)' // '>' is not permitted as correct join relation + // after wrapping a and b can still be typechecked (so we'll have correct completion inside 'on' part) + // but presence of SynExpr.ArbitraryAfterError allows to avoid errors about incompatible types in cases like + // query { + // for a in [1] do + // join b in [""] on (a > b) + // } + // if we typecheck raw 'a' and 'b' then we'll end up with 2 errors: + // 1. incorrect join relation + // 2. incompatible types: int and string + // with SynExpr.ArbitraryAfterError we have only first one + let wrapInArbErrSequence l caption = + SynExpr.Sequential( + DebugPointAtSequential.SuppressNeither, + true, + l, + (arbExpr (caption, l.Range.EndRange)), + l.Range, + SynExprSequentialTrivia.Zero + ) + + let mkOverallExprGivenVarSpaceExpr, varSpaceInner = + + let isNullableOp opId = + match ConvertValLogicalNameToDisplayNameCore opId with + | "?=" + | "=?" + | "?=?" -> true + | _ -> false + + match secondResultPatOpt, keySelectorsOpt with + // groupJoin + | Some secondResultPat, Some relExpr when customOperationIsLikeGroupJoin ceenv nm -> + let secondResultSimplePats, later3 = + SimplePatsOfPat cenv.synArgNameGenerator secondResultPat + + if Option.isSome later3 then + errorR (Error(FSComp.SR.tcJoinMustUseSimplePattern (nm.idText), secondResultPat.Range)) + + match relExpr with + | JoinRelation ceenv (keySelector1, keySelector2) -> + mkJoinExpr keySelector1 keySelector2 secondResultSimplePats, varSpaceWithGroupJoinVars + | BinOpExpr(opId, l, r) -> + if isNullableOp opId.idText then + // When we cannot resolve NullableOps, recommend the relevant namespace to be added + errorR ( + Error( + FSComp.SR.cannotResolveNullableOperators (ConvertValLogicalNameToDisplayNameCore opId.idText), + relExpr.Range + ) + ) + else + errorR (Error(FSComp.SR.tcInvalidRelationInJoin (nm.idText), relExpr.Range)) + + let l = wrapInArbErrSequence l "_keySelector1" + let r = wrapInArbErrSequence r "_keySelector2" + // this is not correct JoinRelation but it is still binary operation + // we've already reported error now we can use operands of binary operation as join components + mkJoinExpr l r secondResultSimplePats, varSpaceWithGroupJoinVars + | _ -> + errorR (Error(FSComp.SR.tcInvalidRelationInJoin (nm.idText), relExpr.Range)) + // since the shape of relExpr doesn't match our expectations (JoinRelation) + // then we assume that this is l.h.s. of the join relation + // so typechecker will treat relExpr as body of outerKeySelector lambda parameter in GroupJoin method + mkJoinExpr relExpr (arbExpr ("_keySelector2", relExpr.Range)) secondResultSimplePats, + varSpaceWithGroupJoinVars + + | None, Some relExpr when customOperationIsLikeJoin ceenv nm -> + match relExpr with + | JoinRelation ceenv (keySelector1, keySelector2) -> + mkJoinExpr keySelector1 keySelector2 secondSourceSimplePats, varSpaceWithSecondVars + | BinOpExpr(opId, l, r) -> + if isNullableOp opId.idText then + // When we cannot resolve NullableOps, recommend the relevant namespace to be added + errorR ( + Error( + FSComp.SR.cannotResolveNullableOperators (ConvertValLogicalNameToDisplayNameCore opId.idText), + relExpr.Range + ) + ) + else + errorR (Error(FSComp.SR.tcInvalidRelationInJoin (nm.idText), relExpr.Range)) + // this is not correct JoinRelation but it is still binary operation + // we've already reported error now we can use operands of binary operation as join components + let l = wrapInArbErrSequence l "_keySelector1" + let r = wrapInArbErrSequence r "_keySelector2" + mkJoinExpr l r secondSourceSimplePats, varSpaceWithGroupJoinVars + | _ -> + errorR (Error(FSComp.SR.tcInvalidRelationInJoin (nm.idText), relExpr.Range)) + // since the shape of relExpr doesn't match our expectations (JoinRelation) + // then we assume that this is l.h.s. of the join relation + // so typechecker will treat relExpr as body of outerKeySelector lambda parameter in Join method + mkJoinExpr relExpr (arbExpr ("_keySelector2", relExpr.Range)) secondSourceSimplePats, + varSpaceWithGroupJoinVars + + | None, None when customOperationIsLikeZip ceenv nm -> mkZipExpr, varSpaceWithSecondVars + + | _ -> + assert false + failwith "unreachable" + + // Case from C# spec: A query expression with a join clause with an into followed by something other than a select clause + // Case from C# spec: A query expression with a join clause without an into followed by something other than a select clause + let valsInner, _env = varSpaceInner.Force mOpCore + let varSpaceExpr = mkExprForVarSpace mOpCore valsInner + let varSpacePat = mkPatForVarSpace mOpCore valsInner + let joinExpr = mkOverallExprGivenVarSpaceExpr varSpaceExpr ceenv.builderValName + + let consumingExpr = + SynExpr.ForEach( + DebugPointAtFor.No, + DebugPointAtInOrTo.No, + SeqExprOnly false, + false, + varSpacePat, + joinExpr, + innerComp, + mOpCore + ) + + Some(TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpaceInner consumingExpr translatedCtxt) + + | SynExpr.ForEach(spFor, spIn, SeqExprOnly _seqExprOnly, isFromSource, pat, sourceExpr, innerComp, _mEntireForEach) -> + let sourceExpr = + match RewriteRangeExpr sourceExpr with + | Some e -> e + | None -> sourceExpr + + let wrappedSourceExpr = + mkSourceExprConditional isFromSource sourceExpr ceenv.sourceMethInfo ceenv.builderValName + + let mFor = + match spFor with + | DebugPointAtFor.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.For) + | DebugPointAtFor.No -> pat.Range + + // For computation expressions, 'in' or 'to' is hit on each MoveNext. + // To support this a named debug point for the "in" keyword is available to inlined code. + match spIn with + | DebugPointAtInOrTo.Yes mIn -> + cenv.namedDebugPointsForInlinedCode[{ + Range = mFor + Name = "ForLoop.InOrToKeyword" + }] <- mIn + | _ -> () + + let mPat = pat.Range + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + mFor + ceenv.ad + "For" + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireBuilderMethod ("For"), mFor)) + + // Add the variables to the query variable space, on demand + let varSpace = + addVarsToVarSpace varSpace (fun _mCustomOp env -> + use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink + + let _, _, vspecs, envinner, _ = + TcMatchPattern cenv (NewInferenceType cenv.g) env ceenv.tpenv pat None + + vspecs, envinner) + + Some( + TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace innerComp (fun innerCompR -> + + let forCall = + mkSynCall + "For" + mFor + [ + wrappedSourceExpr + SynExpr.MatchLambda( + false, + mPat, + [ + SynMatchClause(pat, None, innerCompR, mPat, DebugPointAtTarget.Yes, SynMatchClauseTrivia.Zero) + ], + DebugPointAtBinding.NoneAtInvisible, + mFor + ) + ] + ceenv.builderValName + + let forCall = + match spFor with + | DebugPointAtFor.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mFor, false, forCall) + | DebugPointAtFor.No -> forCall + + translatedCtxt forCall) + ) + + | SynExpr.For( + forDebugPoint = spFor + toDebugPoint = spTo + ident = id + identBody = start + direction = dir + toBody = finish + doBody = innerComp + range = m) -> + let mFor = + match spFor with + | DebugPointAtFor.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.For) + | _ -> m + + if ceenv.isQuery then + errorR (Error(FSComp.SR.tcNoIntegerForLoopInQuery (), mFor)) + + let reduced = + elimFastIntegerForLoop (spFor, spTo, id, start, dir, finish, innerComp, m) + + Some(TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace reduced translatedCtxt) + | SynExpr.While(spWhile, guardExpr, innerComp, _) -> + let mGuard = guardExpr.Range + + let mWhile = + match spWhile with + | DebugPointAtWhile.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.While) + | _ -> mGuard + + if ceenv.isQuery then + error (Error(FSComp.SR.tcNoWhileInQuery (), mWhile)) + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + mWhile + ceenv.ad + "While" + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireBuilderMethod ("While"), mWhile)) + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + mWhile + ceenv.ad + "Delay" + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireBuilderMethod ("Delay"), mWhile)) + + // 'while' is hit just before each time the guard is called + let guardExpr = + match spWhile with + | DebugPointAtWhile.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mWhile, false, guardExpr) + | DebugPointAtWhile.No -> guardExpr + + Some( + TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace innerComp (fun holeFill -> + translatedCtxt ( + mkSynCall + "While" + mWhile + [ + mkSynDelay2 guardExpr + mkSynCall "Delay" mWhile [ mkSynDelay innerComp.Range holeFill ] ceenv.builderValName + ] + ceenv.builderValName + )) + ) + + | SynExpr.WhileBang(spWhile, guardExpr, innerComp, mOrig) -> + let mGuard = guardExpr.Range + + let mWhile = + match spWhile with + | DebugPointAtWhile.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.While) + | _ -> mGuard + + let mGuard = mGuard.MakeSynthetic() + + // 'while!' is hit just before each time the guard is called + let guardExpr = + match spWhile with + | DebugPointAtWhile.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mWhile, false, guardExpr) + | DebugPointAtWhile.No -> guardExpr + + let rewrittenWhileExpr = + let idFirst = mkSynId mGuard (CompilerGeneratedName "first") + let patFirst = mkSynPatVar None idFirst + + let body = + let idCond = mkSynId mGuard (CompilerGeneratedName "cond") + let patCond = mkSynPatVar None idCond + + let condBinding = + mkSynBinding + (Xml.PreXmlDoc.Empty, patCond) + (None, + false, + true, + mGuard, + DebugPointAtBinding.NoneAtSticky, + None, + SynExpr.Ident idFirst, + mGuard, + [], + [], + None, + SynBindingTrivia.Zero) + + let setCondExpr = SynExpr.Set(SynExpr.Ident idCond, SynExpr.Ident idFirst, mGuard) + + let bindCondExpr = + SynExpr.LetOrUseBang( + DebugPointAtBinding.NoneAtSticky, + false, + true, + patFirst, + guardExpr, + [], + setCondExpr, + mGuard, + SynExprLetOrUseBangTrivia.Zero + ) + + let whileExpr = + SynExpr.While( + DebugPointAtWhile.No, + SynExpr.Ident idCond, + SynExpr.Sequential( + DebugPointAtSequential.SuppressBoth, + true, + innerComp, + bindCondExpr, + mWhile, + SynExprSequentialTrivia.Zero + ), + mOrig + ) + + SynExpr.LetOrUse(false, false, [ condBinding ], whileExpr, mGuard, SynExprLetOrUseTrivia.Zero) + + SynExpr.LetOrUseBang( + DebugPointAtBinding.NoneAtSticky, + false, + true, + patFirst, + guardExpr, + [], + body, + mGuard, + SynExprLetOrUseBangTrivia.Zero + ) + + TryTranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace rewrittenWhileExpr translatedCtxt + + | SynExpr.TryFinally(innerComp, unwindExpr, _mTryToLast, spTry, spFinally, trivia) -> + + let mTry = + match spTry with + | DebugPointAtTry.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.Try) + | _ -> trivia.TryKeyword + + let mFinally = + match spFinally with + | DebugPointAtFinally.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.Finally) + | _ -> trivia.FinallyKeyword + + // Put down a debug point for the 'finally' + let unwindExpr2 = + match spFinally with + | DebugPointAtFinally.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mFinally, true, unwindExpr) + | DebugPointAtFinally.No -> unwindExpr + + if ceenv.isQuery then + error (Error(FSComp.SR.tcNoTryFinallyInQuery (), mTry)) + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + mTry + ceenv.ad + "TryFinally" + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireBuilderMethod ("TryFinally"), mTry)) + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + mTry + ceenv.ad + "Delay" + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireBuilderMethod ("Delay"), mTry)) + + let innerExpr = TranslateComputationExpressionNoQueryOps ceenv innerComp + + let innerExpr = + match spTry with + | DebugPointAtTry.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mTry, true, innerExpr) + | _ -> innerExpr + + Some( + translatedCtxt ( + mkSynCall + "TryFinally" + mTry + [ + mkSynCall "Delay" mTry [ mkSynDelay innerComp.Range innerExpr ] ceenv.builderValName + mkSynDelay2 unwindExpr2 + ] + ceenv.builderValName + ) + ) + + | SynExpr.Paren(range = m) -> error (Error(FSComp.SR.tcConstructIsAmbiguousInComputationExpression (), m)) + + // In some cases the node produced by `mkSynCall "Zero" m []` may be discarded in the case + // of implicit yields - for example "list { 1; 2 }" when each expression checks as an implicit yield. + // If it is not discarded, the syntax node will later be checked and the existence/non-existence of the Zero method + // will be checked/reported appropriately (though the error message won't mention computation expressions + // like our other error messages for missing methods). + | SynExpr.ImplicitZero m -> + if + (not ceenv.enableImplicitYield) + && isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + m + ceenv.ad + "Zero" + ceenv.builderTy + ) + then + match ceenv.origComp with + // builder { } + // + // The compiler inserts a dummy () in CheckExpressions.fs for + // empty-bodied computation expressions. In this case, the user + // has not actually written any "control construct" in the body, + // and so we use a more specific error message for clarity. + | SynExpr.Const(SynConst.Unit, mUnit) when + cenv.g.langVersion.SupportsFeature LanguageFeature.EmptyBodiedComputationExpressions + && Range.equals mUnit range0 + -> + error (Error(FSComp.SR.tcEmptyBodyRequiresBuilderZeroMethod (), ceenv.mWhole)) + | _ -> error (Error(FSComp.SR.tcRequireBuilderMethod ("Zero"), m)) + + Some(translatedCtxt (mkSynCall "Zero" m [] ceenv.builderValName)) + + | OptionalSequential(JoinOrGroupJoinOrZipClause ceenv (_, _, _, _, _, mClause), _) when firstTry = CompExprTranslationPass.Initial -> + + // 'join' clauses preceded by 'let' and other constructs get processed by repackaging with a 'for' loop. + let patvs, _env = varSpace.Force comp.Range + let varSpaceExpr = mkExprForVarSpace mClause patvs + let varSpacePat = mkPatForVarSpace mClause patvs + + let dataCompPrior = + translatedCtxt ( + TranslateComputationExpressionNoQueryOps ceenv (SynExpr.YieldOrReturn((true, false), varSpaceExpr, mClause)) + ) + + // Rebind using for ... + let rebind = + SynExpr.ForEach( + DebugPointAtFor.No, + DebugPointAtInOrTo.No, + SeqExprOnly false, + false, + varSpacePat, + dataCompPrior, + comp, + comp.Range + ) + + // Retry with the 'for' loop packaging. Set firstTry=false just in case 'join' processing fails + TryTranslateComputationExpression ceenv CompExprTranslationPass.Subsequent q varSpace rebind id + + | OptionalSequential(CustomOperationClause ceenv (nm, _, opExpr, mClause, _), _) -> + + match q with + | CustomOperationsMode.Denied -> error (Error(FSComp.SR.tcCustomOperationMayNotBeUsedHere (), opExpr.Range)) + | CustomOperationsMode.Allowed -> + let patvs, _env = varSpace.Force comp.Range + let varSpaceExpr = mkExprForVarSpace mClause patvs + + let dataCompPriorToOp = + let isYield = not (customOperationMaintainsVarSpaceUsingBind ceenv nm) + + translatedCtxt ( + TranslateComputationExpressionNoQueryOps ceenv (SynExpr.YieldOrReturn((isYield, false), varSpaceExpr, mClause)) + ) + + // Now run the consumeCustomOpClauses + Some(ConsumeCustomOpClauses ceenv comp q varSpace dataCompPriorToOp comp false mClause) + + | SynExpr.Sequential(sp, true, innerComp1, innerComp2, m, _) -> + + // Check for 'where x > y' and other mis-applications of infix operators. If detected, give a good error message, and just ignore innerComp1 + if ceenv.isQuery && checkForBinaryApp ceenv innerComp1 then + Some(TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace innerComp2 translatedCtxt) + + else + + if ceenv.isQuery && not (innerComp1.IsArbExprAndThusAlreadyReportedError) then + match innerComp1 with + | SynExpr.JoinIn _ -> () // an error will be reported later when we process innerComp1 as a sequential + | _ -> errorR (Error(FSComp.SR.tcUnrecognizedQueryOperator (), innerComp1.RangeOfFirstPortion)) + + match + TryTranslateComputationExpression + ceenv + CompExprTranslationPass.Initial + CustomOperationsMode.Denied + varSpace + innerComp1 + id + with + | Some c -> + // "cexpr; cexpr" is treated as builder.Combine(cexpr1, cexpr1) + let m1 = rangeForCombine innerComp1 + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + m + ceenv.ad + "Combine" + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireBuilderMethod ("Combine"), m)) + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + m + ceenv.ad + "Delay" + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireBuilderMethod ("Delay"), m)) + + let combineCall = + mkSynCall + "Combine" + m1 + [ + c + mkSynCall + "Delay" + m1 + [ + mkSynDelay innerComp2.Range (TranslateComputationExpressionNoQueryOps ceenv innerComp2) + ] + ceenv.builderValName + ] + ceenv.builderValName + + Some(translatedCtxt combineCall) + + | None -> + // "do! expr; cexpr" is treated as { let! () = expr in cexpr } + match innerComp1 with + | SynExpr.DoBang(rhsExpr, m) -> + let sp = + match sp with + | DebugPointAtSequential.SuppressExpr -> DebugPointAtBinding.NoneAtDo + | DebugPointAtSequential.SuppressBoth -> DebugPointAtBinding.NoneAtDo + | DebugPointAtSequential.SuppressStmt -> DebugPointAtBinding.Yes m + | DebugPointAtSequential.SuppressNeither -> DebugPointAtBinding.Yes m + + Some( + TranslateComputationExpression + ceenv + CompExprTranslationPass.Initial + q + varSpace + (SynExpr.LetOrUseBang( + sp, + false, + true, + SynPat.Const(SynConst.Unit, rhsExpr.Range), + rhsExpr, + [], + innerComp2, + m, + SynExprLetOrUseBangTrivia.Zero + )) + translatedCtxt + ) + + // "expr; cexpr" is treated as sequential execution + | _ -> + Some( + TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace innerComp2 (fun holeFill -> + let fillExpr = + if ceenv.enableImplicitYield then + // When implicit yields are enabled, then if the 'innerComp1' checks as type + // 'unit' we interpret the expression as a sequential, and when it doesn't + // have type 'unit' we interpret it as a 'Yield + Combine'. + let combineExpr = + let m1 = rangeForCombine innerComp1 + + let implicitYieldExpr = + mkSynCall "Yield" comp.Range [ innerComp1 ] ceenv.builderValName + + mkSynCall + "Combine" + m1 + [ + implicitYieldExpr + mkSynCall "Delay" m1 [ mkSynDelay holeFill.Range holeFill ] ceenv.builderValName + ] + ceenv.builderValName + + SynExpr.SequentialOrImplicitYield(sp, innerComp1, holeFill, combineExpr, m) + else + SynExpr.Sequential(sp, true, innerComp1, holeFill, m, SynExprSequentialTrivia.Zero) + + translatedCtxt fillExpr) + ) + + | SynExpr.IfThenElse(guardExpr, thenComp, elseCompOpt, spIfToThen, isRecovery, mIfToEndOfElseBranch, trivia) -> + match elseCompOpt with + | Some elseComp -> + if ceenv.isQuery then + error (Error(FSComp.SR.tcIfThenElseMayNotBeUsedWithinQueries (), trivia.IfToThenRange)) + + Some( + translatedCtxt ( + SynExpr.IfThenElse( + guardExpr, + TranslateComputationExpressionNoQueryOps ceenv thenComp, + Some(TranslateComputationExpressionNoQueryOps ceenv elseComp), + spIfToThen, + isRecovery, + mIfToEndOfElseBranch, + trivia + ) + ) + ) + | None -> + let elseComp = + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + trivia.IfToThenRange + ceenv.ad + "Zero" + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireBuilderMethod ("Zero"), trivia.IfToThenRange)) + + mkSynCall "Zero" trivia.IfToThenRange [] ceenv.builderValName + + Some( + TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace thenComp (fun holeFill -> + translatedCtxt ( + SynExpr.IfThenElse(guardExpr, holeFill, Some elseComp, spIfToThen, isRecovery, mIfToEndOfElseBranch, trivia) + )) + ) + + // 'let binds in expr' + | SynExpr.LetOrUse(isRec, false, binds, innerComp, m, trivia) -> + + // For 'query' check immediately + if ceenv.isQuery then + match (List.map (BindingNormalization.NormalizeBinding ValOrMemberBinding cenv ceenv.env) binds) with + | [ NormalizedBinding(_, SynBindingKind.Normal, false, false, _, _, _, _, _, _, _, _) ] when not isRec -> () + | normalizedBindings -> + let failAt m = + error (Error(FSComp.SR.tcNonSimpleLetBindingInQuery (), m)) + + match normalizedBindings with + | NormalizedBinding(mBinding = mBinding) :: _ -> failAt mBinding + | _ -> failAt m + + // Add the variables to the query variable space, on demand + let varSpace = + addVarsToVarSpace varSpace (fun mQueryOp env -> + // Normalize the bindings before detecting the bound variables + match (List.map (BindingNormalization.NormalizeBinding ValOrMemberBinding cenv env) binds) with + | [ NormalizedBinding(kind = SynBindingKind.Normal; shouldInline = false; isMutable = false; pat = pat) ] -> + // successful case + use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink + + let _, _, vspecs, envinner, _ = + TcMatchPattern cenv (NewInferenceType cenv.g) env ceenv.tpenv pat None + + vspecs, envinner + | _ -> + // error case + error (Error(FSComp.SR.tcCustomOperationMayNotBeUsedInConjunctionWithNonSimpleLetBindings (), mQueryOp))) + + Some( + TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace innerComp (fun holeFill -> + translatedCtxt (SynExpr.LetOrUse(isRec, false, binds, holeFill, m, trivia))) + ) + + // 'use x = expr in expr' + | SynExpr.LetOrUse( + isUse = true + bindings = [ SynBinding(kind = SynBindingKind.Normal; headPat = pat; expr = rhsExpr; debugPoint = spBind) ] + body = innerComp) -> + let mBind = + match spBind with + | DebugPointAtBinding.Yes m -> m + | _ -> rhsExpr.Range + + if ceenv.isQuery then + error (Error(FSComp.SR.tcUseMayNotBeUsedInQueries (), mBind)) + + let innerCompRange = innerComp.Range + + let consumeExpr = + SynExpr.MatchLambda( + false, + innerCompRange, + [ + SynMatchClause( + pat, + None, + TranslateComputationExpressionNoQueryOps ceenv innerComp, + innerCompRange, + DebugPointAtTarget.Yes, + SynMatchClauseTrivia.Zero + ) + ], + DebugPointAtBinding.NoneAtInvisible, + innerCompRange + ) + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + mBind + ceenv.ad + "Using" + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireBuilderMethod ("Using"), mBind)) + + Some( + translatedCtxt (mkSynCall "Using" mBind [ rhsExpr; consumeExpr ] ceenv.builderValName) + |> addBindDebugPoint spBind + ) + + // 'let! pat = expr in expr' + // --> build.Bind(e1, (fun _argN -> match _argN with pat -> expr)) + // or + // --> build.BindReturn(e1, (fun _argN -> match _argN with pat -> expr-without-return)) + | SynExpr.LetOrUseBang( + bindDebugPoint = spBind; isUse = false; isFromSource = isFromSource; pat = pat; rhs = rhsExpr; andBangs = []; body = innerComp) -> + + let mBind = + match spBind with + | DebugPointAtBinding.Yes m -> m + | _ -> rhsExpr.Range + + if ceenv.isQuery then + error (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), mBind)) + + // Add the variables to the query variable space, on demand + let varSpace = + addVarsToVarSpace varSpace (fun _mCustomOp env -> + use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink + + let _, _, vspecs, envinner, _ = + TcMatchPattern cenv (NewInferenceType cenv.g) env ceenv.tpenv pat None + + vspecs, envinner) + + let rhsExpr = + mkSourceExprConditional isFromSource rhsExpr ceenv.sourceMethInfo ceenv.builderValName + + Some( + TranslateComputationExpressionBind + ceenv + comp + q + varSpace + mBind + (addBindDebugPoint spBind) + "Bind" + [ rhsExpr ] + pat + innerComp + translatedCtxt + ) + + // 'use! pat = e1 in e2' --> build.Bind(e1, (function _argN -> match _argN with pat -> build.Using(x, (fun _argN -> match _argN with pat -> e2)))) + | SynExpr.LetOrUseBang( + bindDebugPoint = spBind + isUse = true + isFromSource = isFromSource + pat = SynPat.Named(ident = SynIdent(id, _); isThisVal = false) as pat + rhs = rhsExpr + andBangs = [] + body = innerComp) + | SynExpr.LetOrUseBang( + bindDebugPoint = spBind + isUse = true + isFromSource = isFromSource + pat = SynPat.LongIdent(longDotId = SynLongIdent(id = [ id ])) as pat + rhs = rhsExpr + andBangs = [] + body = innerComp) -> + + let mBind = + match spBind with + | DebugPointAtBinding.Yes m -> m + | _ -> rhsExpr.Range + + if ceenv.isQuery then + error (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), mBind)) + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + mBind + ceenv.ad + "Using" + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireBuilderMethod ("Using"), mBind)) + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + mBind + ceenv.ad + "Bind" + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireBuilderMethod ("Bind"), mBind)) + + let bindExpr = + let consumeExpr = + SynExpr.MatchLambda( + false, + mBind, + [ + SynMatchClause( + pat, + None, + TranslateComputationExpressionNoQueryOps ceenv innerComp, + innerComp.Range, + DebugPointAtTarget.Yes, + SynMatchClauseTrivia.Zero + ) + ], + DebugPointAtBinding.NoneAtInvisible, + mBind + ) + + let consumeExpr = + mkSynCall "Using" mBind [ SynExpr.Ident id; consumeExpr ] ceenv.builderValName + + let consumeExpr = + SynExpr.MatchLambda( + false, + mBind, + [ + SynMatchClause(pat, None, consumeExpr, id.idRange, DebugPointAtTarget.No, SynMatchClauseTrivia.Zero) + ], + DebugPointAtBinding.NoneAtInvisible, + mBind + ) + + let rhsExpr = + mkSourceExprConditional isFromSource rhsExpr ceenv.sourceMethInfo ceenv.builderValName + + mkSynCall "Bind" mBind [ rhsExpr; consumeExpr ] ceenv.builderValName + |> addBindDebugPoint spBind + + Some(translatedCtxt bindExpr) + + // 'use! pat = e1 ... in e2' where 'pat' is not a simple name -> error + | SynExpr.LetOrUseBang(isUse = true; pat = pat; andBangs = andBangs) -> + if isNil andBangs then + error (Error(FSComp.SR.tcInvalidUseBangBinding (), pat.Range)) + else + let m = + match andBangs with + | [] -> comp.Range + | h :: _ -> h.Trivia.AndBangKeyword + + error (Error(FSComp.SR.tcInvalidUseBangBindingNoAndBangs (), m)) + + // 'let! pat1 = expr1 and! pat2 = expr2 in ...' --> + // build.BindN(expr1, expr2, ...) + // or + // build.BindNReturn(expr1, expr2, ...) + // or + // build.Bind(build.MergeSources(expr1, expr2), ...) + | SynExpr.LetOrUseBang( + bindDebugPoint = spBind + isUse = false + isFromSource = isFromSource + pat = letPat + rhs = letRhsExpr + andBangs = andBangBindings + body = innerComp + range = letBindRange) -> + if not (cenv.g.langVersion.SupportsFeature LanguageFeature.AndBang) then + error (Error(FSComp.SR.tcAndBangNotSupported (), comp.Range)) + + if ceenv.isQuery then + error (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), letBindRange)) + + let mBind = + match spBind with + | DebugPointAtBinding.Yes m -> m + | _ -> letRhsExpr.Range + + let sources = + (letRhsExpr + :: [ for SynExprAndBang(body = andExpr) in andBangBindings -> andExpr ]) + |> List.map (fun expr -> mkSourceExprConditional isFromSource expr ceenv.sourceMethInfo ceenv.builderValName) + + let pats = + letPat :: [ for SynExprAndBang(pat = andPat) in andBangBindings -> andPat ] + + let sourcesRange = sources |> List.map (fun e -> e.Range) |> List.reduce unionRanges + + let numSources = sources.Length + let bindReturnNName = "Bind" + string numSources + "Return" + let bindNName = "Bind" + string numSources + + // Check if this is a Bind2Return etc. + let hasBindReturnN = + not ( + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + mBind + ceenv.ad + bindReturnNName + ceenv.builderTy + ) + ) + + if + hasBindReturnN + && Option.isSome (convertSimpleReturnToExpr ceenv comp varSpace innerComp) + then + let consumePat = SynPat.Tuple(false, pats, [], letPat.Range) + + // Add the variables to the query variable space, on demand + let varSpace = + addVarsToVarSpace varSpace (fun _mCustomOp env -> + use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink + + let _, _, vspecs, envinner, _ = + TcMatchPattern cenv (NewInferenceType cenv.g) env ceenv.tpenv consumePat None + + vspecs, envinner) + + Some( + TranslateComputationExpressionBind + ceenv + comp + q + varSpace + mBind + (addBindDebugPoint spBind) + bindNName + sources + consumePat + innerComp + translatedCtxt + ) + + else + + // Check if this is a Bind2 etc. + let hasBindN = + not ( + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + mBind + ceenv.ad + bindNName + ceenv.builderTy + ) + ) + + if hasBindN then + let consumePat = SynPat.Tuple(false, pats, [], letPat.Range) + + // Add the variables to the query variable space, on demand + let varSpace = + addVarsToVarSpace varSpace (fun _mCustomOp env -> + use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink + + let _, _, vspecs, envinner, _ = + TcMatchPattern cenv (NewInferenceType cenv.g) env ceenv.tpenv consumePat None + + vspecs, envinner) + + Some( + TranslateComputationExpressionBind + ceenv + comp + q + varSpace + mBind + (addBindDebugPoint spBind) + bindNName + sources + consumePat + innerComp + translatedCtxt + ) + else + + // Look for the maximum supported MergeSources, MergeSources3, ... + let mkMergeSourcesName n = + if n = 2 then + "MergeSources" + else + "MergeSources" + (string n) + + let maxMergeSources = + let rec loop (n: int) = + let mergeSourcesName = mkMergeSourcesName n + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + mBind + ceenv.ad + mergeSourcesName + ceenv.builderTy + ) + then + (n - 1) + else + loop (n + 1) + + loop 2 + + if maxMergeSources = 1 then + error (Error(FSComp.SR.tcRequireMergeSourcesOrBindN (bindNName), mBind)) + + let rec mergeSources (sourcesAndPats: (SynExpr * SynPat) list) = + let numSourcesAndPats = sourcesAndPats.Length + assert (numSourcesAndPats <> 0) + + if numSourcesAndPats = 1 then + sourcesAndPats[0] + + elif numSourcesAndPats <= maxMergeSources then + + // Call MergeSources2(e1, e2), MergeSources3(e1, e2, e3) etc + let mergeSourcesName = mkMergeSourcesName numSourcesAndPats + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + mBind + ceenv.ad + mergeSourcesName + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireMergeSourcesOrBindN (bindNName), mBind)) + + let source = + mkSynCall mergeSourcesName sourcesRange (List.map fst sourcesAndPats) ceenv.builderValName + + let pat = SynPat.Tuple(false, List.map snd sourcesAndPats, [], letPat.Range) + source, pat + + else + + // Call MergeSourcesMax(e1, e2, e3, e4, (...)) + let nowSourcesAndPats, laterSourcesAndPats = + List.splitAt (maxMergeSources - 1) sourcesAndPats + + let mergeSourcesName = mkMergeSourcesName maxMergeSources + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + mBind + ceenv.ad + mergeSourcesName + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireMergeSourcesOrBindN (bindNName), mBind)) + + let laterSource, laterPat = mergeSources laterSourcesAndPats + + let source = + mkSynCall + mergeSourcesName + sourcesRange + (List.map fst nowSourcesAndPats @ [ laterSource ]) + ceenv.builderValName + + let pat = + SynPat.Tuple(false, List.map snd nowSourcesAndPats @ [ laterPat ], [], letPat.Range) + + source, pat + + let mergedSources, consumePat = mergeSources (List.zip sources pats) + + // Add the variables to the query variable space, on demand + let varSpace = + addVarsToVarSpace varSpace (fun _mCustomOp env -> + use _holder = TemporarilySuspendReportingTypecheckResultsToSink cenv.tcSink + + let _, _, vspecs, envinner, _ = + TcMatchPattern cenv (NewInferenceType cenv.g) env ceenv.tpenv consumePat None + + vspecs, envinner) + + // Build the 'Bind' call + Some( + TranslateComputationExpressionBind + ceenv + comp + q + varSpace + mBind + (addBindDebugPoint spBind) + "Bind" + [ mergedSources ] + consumePat + innerComp + translatedCtxt + ) + + | SynExpr.Match(spMatch, expr, clauses, m, trivia) -> + if ceenv.isQuery then + error (Error(FSComp.SR.tcMatchMayNotBeUsedWithQuery (), trivia.MatchKeyword)) + + let clauses = + clauses + |> List.map (fun (SynMatchClause(pat, cond, innerComp, patm, sp, trivia)) -> + SynMatchClause(pat, cond, TranslateComputationExpressionNoQueryOps ceenv innerComp, patm, sp, trivia)) + + Some(translatedCtxt (SynExpr.Match(spMatch, expr, clauses, m, trivia))) + + // 'match! expr with pats ...' --> build.Bind(e1, (function pats ...)) + // FUTURE: consider allowing translation to BindReturn + | SynExpr.MatchBang(spMatch, expr, clauses, _m, trivia) -> + let inputExpr = mkSourceExpr expr ceenv.sourceMethInfo ceenv.builderValName + + if ceenv.isQuery then + error (Error(FSComp.SR.tcMatchMayNotBeUsedWithQuery (), trivia.MatchBangKeyword)) + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + trivia.MatchBangKeyword + ceenv.ad + "Bind" + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireBuilderMethod ("Bind"), trivia.MatchBangKeyword)) + + let clauses = + clauses + |> List.map (fun (SynMatchClause(pat, cond, innerComp, patm, sp, trivia)) -> + SynMatchClause(pat, cond, TranslateComputationExpressionNoQueryOps ceenv innerComp, patm, sp, trivia)) + + let consumeExpr = + SynExpr.MatchLambda(false, trivia.MatchBangKeyword, clauses, DebugPointAtBinding.NoneAtInvisible, trivia.MatchBangKeyword) + + let callExpr = + mkSynCall "Bind" trivia.MatchBangKeyword [ inputExpr; consumeExpr ] ceenv.builderValName + |> addBindDebugPoint spMatch + + Some(translatedCtxt callExpr) + + | SynExpr.TryWith(innerComp, clauses, mTryToLast, spTry, spWith, trivia) -> + let mTry = + match spTry with + | DebugPointAtTry.Yes _ -> trivia.TryKeyword.NoteSourceConstruct(NotedSourceConstruct.Try) + | _ -> trivia.TryKeyword + + let spWith2 = + match spWith with + | DebugPointAtWith.Yes _ -> DebugPointAtBinding.Yes trivia.WithKeyword + | _ -> DebugPointAtBinding.NoneAtInvisible + + if ceenv.isQuery then + error (Error(FSComp.SR.tcTryWithMayNotBeUsedInQueries (), mTry)) + + let clauses = + clauses + |> List.map (fun (SynMatchClause(pat, cond, clauseComp, patm, sp, trivia)) -> + SynMatchClause(pat, cond, TranslateComputationExpressionNoQueryOps ceenv clauseComp, patm, sp, trivia)) + + let consumeExpr = + SynExpr.MatchLambda(true, mTryToLast, clauses, spWith2, mTryToLast) + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + mTry + ceenv.ad + "TryWith" + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireBuilderMethod ("TryWith"), mTry)) + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + mTry + ceenv.ad + "Delay" + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireBuilderMethod ("Delay"), mTry)) + + let innerExpr = TranslateComputationExpressionNoQueryOps ceenv innerComp + + let innerExpr = + match spTry with + | DebugPointAtTry.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mTry, true, innerExpr) + | _ -> innerExpr + + let callExpr = + mkSynCall + "TryWith" + mTry + [ + mkSynCall "Delay" mTry [ mkSynDelay2 innerExpr ] ceenv.builderValName + consumeExpr + ] + ceenv.builderValName + + Some(translatedCtxt callExpr) + + | SynExpr.YieldOrReturnFrom((true, _), synYieldExpr, m) -> + let yieldFromExpr = + mkSourceExpr synYieldExpr ceenv.sourceMethInfo ceenv.builderValName + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + m + ceenv.ad + "YieldFrom" + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireBuilderMethod ("YieldFrom"), m)) + + let yieldFromCall = mkSynCall "YieldFrom" m [ yieldFromExpr ] ceenv.builderValName + + let yieldFromCall = + if IsControlFlowExpression synYieldExpr then + yieldFromCall + else + SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes m, false, yieldFromCall) + + Some(translatedCtxt yieldFromCall) + + | SynExpr.YieldOrReturnFrom((false, _), synReturnExpr, m) -> + let returnFromExpr = + mkSourceExpr synReturnExpr ceenv.sourceMethInfo ceenv.builderValName + + if ceenv.isQuery then + error (Error(FSComp.SR.tcReturnMayNotBeUsedInQueries (), m)) + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + m + ceenv.ad + "ReturnFrom" + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireBuilderMethod ("ReturnFrom"), m)) + + let returnFromCall = + mkSynCall "ReturnFrom" m [ returnFromExpr ] ceenv.builderValName + + let returnFromCall = + if IsControlFlowExpression synReturnExpr then + returnFromCall + else + SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes m, false, returnFromCall) + + Some(translatedCtxt returnFromCall) + + | SynExpr.YieldOrReturn((isYield, _), synYieldOrReturnExpr, m) -> + let methName = (if isYield then "Yield" else "Return") + + if ceenv.isQuery && not isYield then + error (Error(FSComp.SR.tcReturnMayNotBeUsedInQueries (), m)) + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + cenv + ceenv.env + m + ceenv.ad + methName + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireBuilderMethod (methName), m)) + + let yieldOrReturnCall = + mkSynCall methName m [ synYieldOrReturnExpr ] ceenv.builderValName + + let yieldOrReturnCall = + if IsControlFlowExpression synYieldOrReturnExpr then + yieldOrReturnCall + else + SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes m, false, yieldOrReturnCall) + + Some(translatedCtxt yieldOrReturnCall) + + | _ -> None + +and ConsumeCustomOpClauses + (ceenv: ComputationExpressionContext<'a>) + (comp: SynExpr) + q + (varSpace: LazyWithContext<_, _>) + dataCompPrior + compClausesExpr + lastUsesBind + mClause + = + + // Substitute 'yield ' into the context + + let patvs, _env = varSpace.Force comp.Range + let varSpaceSimplePat = mkSimplePatForVarSpace mClause patvs + let varSpacePat = mkPatForVarSpace mClause patvs + + match compClausesExpr with + + // Detect one custom operation... This clause will always match at least once... + | OptionalSequential(CustomOperationClause ceenv (nm, opDatas, opExpr, mClause, optionalIntoPat), optionalCont) -> + + let opName, _, _, _, _, _, _, _, methInfo = opDatas[0] + + let isLikeZip = customOperationIsLikeZip ceenv nm + + let isLikeJoin = customOperationIsLikeJoin ceenv nm + + let isLikeGroupJoin = customOperationIsLikeZip ceenv nm + + // Record the resolution of the custom operation for posterity + let item = + Item.CustomOperation(opName, (fun () -> customOpUsageText ceenv nm), Some methInfo) + + // FUTURE: consider whether we can do better than emptyTyparInst here, in order to display instantiations + // of type variables in the quick info provided in the IDE. + CallNameResolutionSink + ceenv.cenv.tcSink + (nm.idRange, ceenv.env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, ceenv.env.eAccessRights) + + if isLikeZip || isLikeJoin || isLikeGroupJoin then + errorR (Error(FSComp.SR.tcBinaryOperatorRequiresBody (nm.idText, Option.get (customOpUsageText ceenv nm)), nm.idRange)) + + match optionalCont with + | None -> + // we are about to drop the 'opExpr' AST on the floor. we've already reported an error. attempt to get name resolutions before dropping it + RecordNameAndTypeResolutions ceenv.cenv ceenv.env ceenv.tpenv opExpr + dataCompPrior + | Some contExpr -> ConsumeCustomOpClauses ceenv comp q varSpace dataCompPrior contExpr lastUsesBind mClause + else + + let maintainsVarSpace = customOperationMaintainsVarSpace ceenv nm + + let maintainsVarSpaceUsingBind = customOperationMaintainsVarSpaceUsingBind ceenv nm + + let expectedArgCount = tryExpectedArgCountForCustomOperator ceenv nm + + let dataCompAfterOp = + match opExpr with + | StripApps(SingleIdent nm, args) -> + let argCountsMatch = + match expectedArgCount with + | Some n -> n = args.Length + | None -> ceenv.cenv.g.langVersion.SupportsFeature LanguageFeature.OverloadsForCustomOperations + + if argCountsMatch then + // Check for the [] attribute on each argument position + let args = + args + |> List.mapi (fun i arg -> + if isCustomOperationProjectionParameter ceenv (i + 1) nm then + SynExpr.Lambda( + false, + false, + varSpaceSimplePat, + arg, + None, + arg.Range.MakeSynthetic(), + SynExprLambdaTrivia.Zero + ) + else + arg) + + mkSynCall methInfo.DisplayName mClause (dataCompPrior :: args) ceenv.builderValName + else + let expectedArgCount = defaultArg expectedArgCount 0 + + errorR ( + Error(FSComp.SR.tcCustomOperationHasIncorrectArgCount (nm.idText, expectedArgCount, args.Length), nm.idRange) + ) + + mkSynCall + methInfo.DisplayName + mClause + ([ dataCompPrior ] + @ List.init expectedArgCount (fun i -> arbExpr ("_arg" + string i, mClause))) + ceenv.builderValName + | _ -> failwith "unreachable" + + match optionalCont with + | None -> + match optionalIntoPat with + | Some intoPat -> errorR (Error(FSComp.SR.tcIntoNeedsRestOfQuery (), intoPat.Range)) + | None -> () + + dataCompAfterOp + + | Some contExpr -> + + // select a.Name into name; ... + // distinct into d; ... + // + // Rebind the into pattern and process the rest of the clauses + match optionalIntoPat with + | Some intoPat -> + if not (customOperationAllowsInto ceenv nm) then + error (Error(FSComp.SR.tcOperatorDoesntAcceptInto (nm.idText), intoPat.Range)) + + // Rebind using either for ... or let!.... + let rebind = + if maintainsVarSpaceUsingBind then + SynExpr.LetOrUseBang( + DebugPointAtBinding.NoneAtLet, + false, + false, + intoPat, + dataCompAfterOp, + [], + contExpr, + intoPat.Range, + SynExprLetOrUseBangTrivia.Zero + ) + else + SynExpr.ForEach( + DebugPointAtFor.No, + DebugPointAtInOrTo.No, + SeqExprOnly false, + false, + intoPat, + dataCompAfterOp, + contExpr, + intoPat.Range + ) + + TranslateComputationExpression ceenv CompExprTranslationPass.Initial q ceenv.emptyVarSpace rebind id + + // select a.Name; ... + // distinct; ... + // + // Process the rest of the clauses + | None -> + if maintainsVarSpace || maintainsVarSpaceUsingBind then + ConsumeCustomOpClauses ceenv comp q varSpace dataCompAfterOp contExpr maintainsVarSpaceUsingBind mClause + else + ConsumeCustomOpClauses ceenv comp q ceenv.emptyVarSpace dataCompAfterOp contExpr false mClause + + // No more custom operator clauses in compClausesExpr, but there may be clauses like join, yield etc. + // Bind/iterate the dataCompPrior and use compClausesExpr as the body. + | _ -> + // Rebind using either for ... or let!.... + let rebind = + if lastUsesBind then + SynExpr.LetOrUseBang( + DebugPointAtBinding.NoneAtLet, + false, + false, + varSpacePat, + dataCompPrior, + [], + compClausesExpr, + compClausesExpr.Range, + SynExprLetOrUseBangTrivia.Zero + ) + else + SynExpr.ForEach( + DebugPointAtFor.No, + DebugPointAtInOrTo.No, + SeqExprOnly false, + false, + varSpacePat, + dataCompPrior, + compClausesExpr, + compClausesExpr.Range + ) + + TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace rebind id + +and TranslateComputationExpressionNoQueryOps ceenv comp = + TranslateComputationExpression ceenv CompExprTranslationPass.Initial CustomOperationsMode.Denied ceenv.emptyVarSpace comp id + +and TranslateComputationExpressionBind + (ceenv: ComputationExpressionContext<'a>) + comp + q + varSpace + bindRange + addBindDebugPoint + bindName + (bindArgs: SynExpr list) + (consumePat: SynPat) + (innerComp: SynExpr) + translatedCtxt + = + + let innerRange = innerComp.Range + + let innerCompReturn = + if ceenv.cenv.g.langVersion.SupportsFeature LanguageFeature.AndBang then + convertSimpleReturnToExpr ceenv comp varSpace innerComp + else + None + + match innerCompReturn with + | Some(innerExpr, customOpInfo) when + (let bindName = bindName + "Return" + + not ( + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + ceenv.cenv + ceenv.env + bindRange + ceenv.ad + bindName + ceenv.builderTy + ) + )) + -> + + let bindName = bindName + "Return" + + // Build the `BindReturn` call + let dataCompPriorToOp = + let consumeExpr = + SynExpr.MatchLambda( + false, + consumePat.Range, + [ + SynMatchClause(consumePat, None, innerExpr, innerRange, DebugPointAtTarget.Yes, SynMatchClauseTrivia.Zero) + ], + DebugPointAtBinding.NoneAtInvisible, + innerRange + ) + + translatedCtxt (mkSynCall bindName bindRange (bindArgs @ [ consumeExpr ]) ceenv.builderValName) + + match customOpInfo with + | None -> dataCompPriorToOp + | Some(innerComp, mClause) -> + // If the `BindReturn` was forced by a custom operation, continue to process the clauses of the CustomOp + ConsumeCustomOpClauses ceenv comp q varSpace dataCompPriorToOp innerComp false mClause + + | _ -> + + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + ceenv.cenv + ceenv.env + bindRange + ceenv.ad + bindName + ceenv.builderTy + ) + then + error (Error(FSComp.SR.tcRequireBuilderMethod (bindName), bindRange)) + + // Build the `Bind` call + TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace innerComp (fun holeFill -> + let consumeExpr = + SynExpr.MatchLambda( + false, + consumePat.Range, + [ + SynMatchClause(consumePat, None, holeFill, innerRange, DebugPointAtTarget.Yes, SynMatchClauseTrivia.Zero) + ], + DebugPointAtBinding.NoneAtInvisible, + innerRange + ) + + let bindCall = + mkSynCall bindName bindRange (bindArgs @ [ consumeExpr ]) ceenv.builderValName + + translatedCtxt (bindCall |> addBindDebugPoint)) + +/// This function is for desugaring into .Bind{N}Return calls if possible +/// The outer option indicates if .BindReturn is possible. When it returns None, .BindReturn cannot be used +/// The inner option indicates if a custom operation is involved inside +and convertSimpleReturnToExpr (ceenv: ComputationExpressionContext<'a>) comp varSpace innerComp = + match innerComp with + | SynExpr.YieldOrReturn((false, _), returnExpr, m) -> + let returnExpr = SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes m, false, returnExpr) + Some(returnExpr, None) + + | SynExpr.Match(spMatch, expr, clauses, m, trivia) -> + let clauses = + clauses + |> List.map (fun (SynMatchClause(pat, cond, innerComp2, patm, sp, trivia)) -> + match convertSimpleReturnToExpr ceenv comp varSpace innerComp2 with + | None -> None // failure + | Some(_, Some _) -> None // custom op on branch = failure + | Some(innerExpr2, None) -> Some(SynMatchClause(pat, cond, innerExpr2, patm, sp, trivia))) + + if clauses |> List.forall Option.isSome then + Some(SynExpr.Match(spMatch, expr, (clauses |> List.map Option.get), m, trivia), None) + else + None + + | SynExpr.IfThenElse(guardExpr, thenComp, elseCompOpt, spIfToThen, isRecovery, mIfToEndOfElseBranch, trivia) -> + match convertSimpleReturnToExpr ceenv comp varSpace thenComp with + | None -> None + | Some(_, Some _) -> None + | Some(thenExpr, None) -> + let elseExprOptOpt = + match elseCompOpt with + // When we are missing an 'else' part alltogether in case of 'if cond then return exp', we fallback from BindReturn into regular Bind+Return + | None -> None + | Some elseComp -> + match convertSimpleReturnToExpr ceenv comp varSpace elseComp with + | None -> None // failure + | Some(_, Some _) -> None // custom op on branch = failure + | Some(elseExpr, None) -> Some(Some elseExpr) + + match elseExprOptOpt with + | None -> None + | Some elseExprOpt -> + Some(SynExpr.IfThenElse(guardExpr, thenExpr, elseExprOpt, spIfToThen, isRecovery, mIfToEndOfElseBranch, trivia), None) + + | SynExpr.LetOrUse(isRec, false, binds, innerComp, m, trivia) -> + match convertSimpleReturnToExpr ceenv comp varSpace innerComp with + | None -> None + | Some(_, Some _) -> None + | Some(innerExpr, None) -> Some(SynExpr.LetOrUse(isRec, false, binds, innerExpr, m, trivia), None) + + | OptionalSequential(CustomOperationClause ceenv (nm, _, _, mClause, _), _) when customOperationMaintainsVarSpaceUsingBind ceenv nm -> + + let patvs, _env = varSpace.Force comp.Range + let varSpaceExpr = mkExprForVarSpace mClause patvs + + Some(varSpaceExpr, Some(innerComp, mClause)) + + | SynExpr.Sequential(sp, true, innerComp1, innerComp2, m, trivia) -> + + // Check the first part isn't a computation expression construct + if (isSimpleExpr ceenv innerComp1) then + // Check the second part is a simple return + match convertSimpleReturnToExpr ceenv comp varSpace innerComp2 with + | None -> None + | Some(innerExpr2, optionalCont) -> Some(SynExpr.Sequential(sp, true, innerComp1, innerExpr2, m, trivia), optionalCont) + else + None + + | _ -> None + +/// Check if an expression has no computation expression constructs +and isSimpleExpr ceenv comp = + + match comp with + | ForEachThenJoinOrGroupJoinOrZipClause ceenv false _ -> false + | SynExpr.ForEach _ -> false + | SynExpr.For _ -> false + | SynExpr.While _ -> false + | SynExpr.WhileBang _ -> false + | SynExpr.TryFinally _ -> false + | SynExpr.ImplicitZero _ -> false + | OptionalSequential(JoinOrGroupJoinOrZipClause ceenv _, _) -> false + | OptionalSequential(CustomOperationClause ceenv _, _) -> false + | SynExpr.Sequential(expr1 = innerComp1; expr2 = innerComp2) -> isSimpleExpr ceenv innerComp1 && isSimpleExpr ceenv innerComp2 + | SynExpr.IfThenElse(thenExpr = thenComp; elseExpr = elseCompOpt) -> + isSimpleExpr ceenv thenComp + && (match elseCompOpt with + | None -> true + | Some c -> isSimpleExpr ceenv c) + | SynExpr.LetOrUse(body = innerComp) -> isSimpleExpr ceenv innerComp + | SynExpr.LetOrUseBang _ -> false + | SynExpr.Match(clauses = clauses) -> + clauses + |> List.forall (fun (SynMatchClause(resultExpr = innerComp)) -> isSimpleExpr ceenv innerComp) + | SynExpr.MatchBang _ -> false + | SynExpr.TryWith(tryExpr = innerComp; withCases = clauses) -> + isSimpleExpr ceenv innerComp + && clauses + |> List.forall (fun (SynMatchClause(resultExpr = clauseComp)) -> isSimpleExpr ceenv clauseComp) + | SynExpr.YieldOrReturnFrom _ -> false + | SynExpr.YieldOrReturn _ -> false + | SynExpr.DoBang _ -> false + | _ -> true + +and TranslateComputationExpression (ceenv: ComputationExpressionContext<'a>) firstTry q varSpace comp translatedCtxt = + + ceenv.cenv.stackGuard.Guard + <| fun () -> + match TryTranslateComputationExpression ceenv firstTry q varSpace comp translatedCtxt with + | Some e -> e + | None -> + // This only occurs in final position in a sequence + match comp with + // "do! expr;" in final position is treated as { let! () = expr in return () } when Return is provided (and no Zero with Default attribute is available) or as { let! () = expr in zero } otherwise + | SynExpr.DoBang(rhsExpr, m) -> + let mUnit = rhsExpr.Range + let rhsExpr = mkSourceExpr rhsExpr ceenv.sourceMethInfo ceenv.builderValName + + if ceenv.isQuery then + error (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), m)) + + let bodyExpr = + if + isNil ( + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + ceenv.cenv + ceenv.env + m + ceenv.ad + "Return" + ceenv.builderTy + ) + then + SynExpr.ImplicitZero m + else + match + TryFindIntrinsicOrExtensionMethInfo + ResultCollectionSettings.AtMostOneResult + ceenv.cenv + ceenv.env + m + ceenv.ad + "Zero" + ceenv.builderTy + with + | minfo :: _ when MethInfoHasAttribute ceenv.cenv.g m ceenv.cenv.g.attrib_DefaultValueAttribute minfo -> + SynExpr.ImplicitZero m + | _ -> SynExpr.YieldOrReturn((false, true), SynExpr.Const(SynConst.Unit, m), m) + + let letBangBind = + SynExpr.LetOrUseBang( + DebugPointAtBinding.NoneAtDo, + false, + false, + SynPat.Const(SynConst.Unit, mUnit), + rhsExpr, + [], + bodyExpr, + m, + SynExprLetOrUseBangTrivia.Zero + ) + + TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace letBangBind translatedCtxt + + // "expr;" in final position is treated as { expr; zero } + // Suppress the sequence point on the "zero" + | _ -> + // Check for 'where x > y' and other mis-applications of infix operators. If detected, give a good error message, and just ignore comp + if ceenv.isQuery && checkForBinaryApp ceenv comp then + TranslateComputationExpression + ceenv + CompExprTranslationPass.Initial + q + varSpace + (SynExpr.ImplicitZero comp.Range) + translatedCtxt + else + if ceenv.isQuery && not comp.IsArbExprAndThusAlreadyReportedError then + match comp with + | SynExpr.JoinIn _ -> () // an error will be reported later when we process innerComp1 as a sequential + | _ -> errorR (Error(FSComp.SR.tcUnrecognizedQueryOperator (), comp.RangeOfFirstPortion)) + + TranslateComputationExpression + ceenv + CompExprTranslationPass.Initial + q + varSpace + (SynExpr.ImplicitZero comp.Range) + (fun holeFill -> + let fillExpr = + if ceenv.enableImplicitYield then + let implicitYieldExpr = mkSynCall "Yield" comp.Range [ comp ] ceenv.builderValName + + SynExpr.SequentialOrImplicitYield( + DebugPointAtSequential.SuppressExpr, + comp, + holeFill, + implicitYieldExpr, + comp.Range + ) + else + SynExpr.Sequential( + DebugPointAtSequential.SuppressExpr, + true, + comp, + holeFill, + comp.Range, + SynExprSequentialTrivia.Zero + ) + + translatedCtxt fillExpr) + +/// Used for all computation expressions except sequence expressions +let TcComputationExpression (cenv: TcFileState) env (overallTy: OverallTy) tpenv (mWhole, interpExpr: Expr, builderTy, comp: SynExpr) = + let overallTy = overallTy.Commit + + let ad = env.eAccessRights + + let builderValName = CompilerGeneratedName "builder" + let mBuilderVal = interpExpr.Range + + // Give bespoke error messages for the FSharp.Core "query" builder + let isQuery = + match stripDebugPoints interpExpr with + // An unparameterized custom builder, e.g., `query`, `async`. + | Expr.Val(vref, _, m) + // A parameterized custom builder, e.g., `builder<…>`, `builder ()`. + | Expr.App(funcExpr = Expr.Val(vref, _, m)) when not vref.IsMember || vref.IsConstructor -> + let item = Item.CustomBuilder(vref.DisplayName, vref) + CallNameResolutionSink cenv.tcSink (m, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, env.eAccessRights) + valRefEq cenv.g vref cenv.g.query_value_vref + | _ -> false + + let sourceMethInfo = + TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBuilderVal ad "Source" builderTy + + /// Decide if the builder is an auto-quote builder + let isAutoQuote = hasMethInfo "Quote" cenv env mBuilderVal ad builderTy + + let customOperationMethods = + getCustomOperationMethods cenv env ad mBuilderVal builderTy + + /// Decide if the identifier represents a use of a custom query operator + let hasCustomOperations = + match customOperationMethods with + | [] -> CustomOperationsMode.Denied + | _ -> CustomOperationsMode.Allowed + + let customOperationMethodsIndexedByKeyword = + if cenv.g.langVersion.SupportsFeature LanguageFeature.OverloadsForCustomOperations then + customOperationMethods + |> Seq.groupBy (fun (nm, _, _, _, _, _, _, _, _) -> nm) + |> Seq.map (fun (nm, group) -> (nm, Seq.toList group)) + else + customOperationMethods + |> Seq.groupBy (fun (nm, _, _, _, _, _, _, _, _) -> nm) + |> Seq.map (fun (nm, group) -> (nm, Seq.toList group)) + |> dict + + // Check for duplicates by method name (keywords and method names must be 1:1) + let customOperationMethodsIndexedByMethodName = + if cenv.g.langVersion.SupportsFeature LanguageFeature.OverloadsForCustomOperations then + customOperationMethods + |> Seq.groupBy (fun (_, _, _, _, _, _, _, _, methInfo) -> methInfo.LogicalName) + |> Seq.map (fun (nm, group) -> (nm, Seq.toList group)) + else + customOperationMethods + |> Seq.groupBy (fun (_, _, _, _, _, _, _, _, methInfo) -> methInfo.LogicalName) + |> Seq.map (fun (nm, group) -> (nm, Seq.toList group)) + |> dict + + // If there are no 'yield' in the computation expression, and the builder supports 'Yield', + // then allow the type-directed rule interpreting non-unit-typed expressions in statement + // positions as 'yield'. 'yield!' may be present in the computation expression. + let enableImplicitYield = + cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield + && (hasMethInfo "Yield" cenv env mBuilderVal ad builderTy + && hasMethInfo "Combine" cenv env mBuilderVal ad builderTy + && hasMethInfo "Delay" cenv env mBuilderVal ad builderTy + && YieldFree cenv comp) + + let origComp = comp + + let ceenv = + { + cenv = cenv + env = env + tpenv = tpenv + customOperationMethodsIndexedByKeyword = customOperationMethodsIndexedByKeyword + customOperationMethodsIndexedByMethodName = customOperationMethodsIndexedByMethodName + sourceMethInfo = sourceMethInfo + builderValName = builderValName + ad = ad + builderTy = builderTy + isQuery = isQuery + enableImplicitYield = enableImplicitYield + origComp = origComp + mWhole = mWhole + emptyVarSpace = LazyWithContext.NotLazy([], env) + } + + /// Inside the 'query { ... }' use a modified name environment that contains fake 'CustomOperation' entries + /// for all custom operations. This adds them to the completion lists and prevents them being used as values inside + /// the query. + let env = + if List.isEmpty customOperationMethods then + env + else + { env with + eNameResEnv = + (env.eNameResEnv, customOperationMethods) + ||> Seq.fold (fun nenv (nm, _, _, _, _, _, _, _, methInfo) -> + AddFakeNameToNameEnv + nm + nenv + (Item.CustomOperation(nm, (fun () -> customOpUsageText ceenv (ident (nm, mBuilderVal))), Some methInfo))) + } + + // Environment is needed for completions + CallEnvSink cenv.tcSink (comp.Range, env.NameEnv, ad) + + let ceenv = { ceenv with env = env } + + let basicSynExpr = + TranslateComputationExpression ceenv CompExprTranslationPass.Initial hasCustomOperations (LazyWithContext.NotLazy([], env)) comp id + + let mDelayOrQuoteOrRun = + mBuilderVal + .NoteSourceConstruct(NotedSourceConstruct.DelayOrQuoteOrRun) + .MakeSynthetic() + + // Add a call to 'Delay' if the method is present + let delayedExpr = + match TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBuilderVal ad "Delay" builderTy with + | [] -> basicSynExpr + | _ -> mkSynCall "Delay" mDelayOrQuoteOrRun [ (mkSynDelay2 basicSynExpr) ] builderValName + + // Add a call to 'Quote' if the method is present + let quotedSynExpr = + if isAutoQuote then + SynExpr.Quote(mkSynIdGet mDelayOrQuoteOrRun (CompileOpName "<@ @>"), false, delayedExpr, true, mWhole) + else + delayedExpr + + // Add a call to 'Run' if the method is present + let runExpr = + match TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBuilderVal ad "Run" builderTy with + | [] -> quotedSynExpr + | _ -> mkSynCall "Run" mDelayOrQuoteOrRun [ quotedSynExpr ] builderValName + + let lambdaExpr = + SynExpr.Lambda( + false, + false, + SynSimplePats.SimplePats([ mkSynSimplePatVar false (mkSynId mBuilderVal builderValName) ], [], mBuilderVal), + runExpr, + None, + mBuilderVal, + SynExprLambdaTrivia.Zero + ) + + let env = + match comp with + | SynExpr.YieldOrReturn(flags = (true, _)) -> + { env with + eContextInfo = ContextInfo.YieldInComputationExpression + } + | SynExpr.YieldOrReturn(flags = (_, true)) -> + { env with + eContextInfo = ContextInfo.ReturnInComputationExpression + } + | _ -> env + + let lambdaExpr, tpenv = + TcExpr cenv (MustEqual(mkFunTy cenv.g builderTy overallTy)) env tpenv lambdaExpr + + // beta-var-reduce to bind the builder using a 'let' binding + let coreExpr = + mkApps cenv.g ((lambdaExpr, tyOfExpr cenv.g lambdaExpr), [], [ interpExpr ], mBuilderVal) + + coreExpr, tpenv diff --git a/src/Compiler/Checking/CheckComputationExpressions.fsi b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fsi similarity index 55% rename from src/Compiler/Checking/CheckComputationExpressions.fsi rename to src/Compiler/Checking/Expressions/CheckComputationExpressions.fsi index e9f24dfb15e..ac9554252f3 100644 --- a/src/Compiler/Checking/CheckComputationExpressions.fsi +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fsi @@ -8,24 +8,6 @@ open FSharp.Compiler.Syntax open FSharp.Compiler.Text open FSharp.Compiler.TypedTree -val TcSequenceExpressionEntry: - cenv: TcFileState -> - env: TcEnv -> - overallTy: OverallTy -> - tpenv: UnscopedTyparEnv -> - hasBuilder: bool * comp: SynExpr -> - m: range -> - Expr * UnscopedTyparEnv - -val TcArrayOrListComputedExpression: - cenv: TcFileState -> - env: TcEnv -> - overallTy: OverallTy -> - tpenv: UnscopedTyparEnv -> - isArray: bool * comp: SynExpr -> - m: range -> - Expr * UnscopedTyparEnv - val TcComputationExpression: cenv: TcFileState -> env: TcEnv -> diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs similarity index 95% rename from src/Compiler/Checking/CheckExpressions.fs rename to src/Compiler/Checking/Expressions/CheckExpressions.fs index 89253bd6783..615e4251893 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -18,6 +18,7 @@ open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AccessibilityLogic open FSharp.Compiler.AttributeChecking open FSharp.Compiler.CheckBasics +open FSharp.Compiler.CheckExpressionsOps open FSharp.Compiler.CheckRecordSyntaxHelpers open FSharp.Compiler.ConstraintSolver open FSharp.Compiler.DiagnosticsLogger @@ -449,7 +450,7 @@ type CheckedBindingInfo = valAttribs: Attribs * xmlDoc: XmlDoc * tcPatPhase2: (TcPatPhase2Input -> Pattern) * - exlicitTyparInfo: ExplicitTyparInfo * + explicitTyparInfo: ExplicitTyparInfo * nameToPrelimValSchemeMap: NameMap * rhsExprChecked: Expr * argAndRetAttribs: ArgAndRetAttribs * @@ -466,13 +467,6 @@ type CheckedBindingInfo = type cenv = TcFileState -let CopyAndFixupTypars g m rigid tpsorig = - FreshenAndFixupTypars g m rigid [] [] tpsorig - -let UnifyTypes (cenv: cenv) (env: TcEnv) m expectedTy actualTy = - let g = cenv.g - AddCxTypeEqualsType env.eContextInfo env.DisplayEnv cenv.css m (tryNormalizeMeasureInType g expectedTy) (tryNormalizeMeasureInType g actualTy) - // If the overall type admits subsumption or type directed conversion, and the original unify would have failed, // then allow subsumption or type directed conversion. // @@ -484,7 +478,8 @@ let UnifyOverallType (cenv: cenv) (env: TcEnv) m overallTy actualTy = | MustConvertTo(isMethodArg, reqdTy) when g.langVersion.SupportsFeature LanguageFeature.AdditionalTypeDirectedConversions -> let actualTy = tryNormalizeMeasureInType g actualTy let reqdTy = tryNormalizeMeasureInType g reqdTy - if AddCxTypeEqualsTypeUndoIfFailed env.DisplayEnv cenv.css m reqdTy actualTy then + let reqTyForUnification = reqTyForArgumentNullnessInference g actualTy reqdTy + if AddCxTypeEqualsTypeUndoIfFailed env.DisplayEnv cenv.css m reqTyForUnification actualTy then () else // try adhoc type-directed conversions @@ -675,7 +670,7 @@ let UnifyFunctionTypeUndoIfFailed (cenv: cenv) denv m ty = | ValueNone -> let domainTy = NewInferenceType g let resultTy = NewInferenceType g - if AddCxTypeEqualsTypeUndoIfFailed denv cenv.css m ty (mkFunTy g domainTy resultTy) then + if AddCxTypeEqualsTypeUndoIfFailed denv cenv.css m ty (mkFunTy g domainTy resultTy) then ValueSome(domainTy, resultTy) else ValueNone @@ -737,7 +732,7 @@ let UnifyUnitType (cenv: cenv) (env: TcEnv) m ty expr = else let domainTy = NewInferenceType g let resultTy = NewInferenceType g - if AddCxTypeEqualsTypeUndoIfFailed denv cenv.css m ty (mkFunTy g domainTy resultTy) then + if AddCxTypeEqualsTypeUndoIfFailed denv cenv.css m ty (mkFunTy g domainTy resultTy) then warning (FunctionValueUnexpected(denv, ty, m)) else let reportImplicitlyDiscardError() = @@ -778,7 +773,7 @@ module AttributeTargets = let ForNewConstructors tcSink (env: TcEnv) mObjTy methodName meths = let origItem = Item.CtorGroup(methodName, meths) - let callSink (item, minst) = CallMethodGroupNameResolutionSink tcSink (mObjTy, env.NameEnv, item, origItem, minst, ItemOccurence.Use, env.AccessRights) + let callSink (item, minst) = CallMethodGroupNameResolutionSink tcSink (mObjTy, env.NameEnv, item, origItem, minst, ItemOccurrence.Use, env.AccessRights) let sendToSink minst refinedMeths = callSink (Item.CtorGroup(methodName, refinedMeths), minst) match meths with | [] -> @@ -805,7 +800,7 @@ let TcConst (cenv: cenv) (overallTy: TType) m env synConst = | SynMeasure.One _ -> Measure.One | SynMeasure.Named(tc, m) -> let ad = env.eAccessRights - let _, tcref, _ = ForceRaise(ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurence.Use OpenQualified env.eNameResEnv ad tc TypeNameResolutionStaticArgsInfo.DefiniteEmpty PermitDirectReferenceToGeneratedType.No) + let _, tcref, _ = ForceRaise(ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurrence.Use OpenQualified env.eNameResEnv ad tc TypeNameResolutionStaticArgsInfo.DefiniteEmpty PermitDirectReferenceToGeneratedType.No) match tcref.TypeOrMeasureKind with | TyparKind.Type -> error(Error(FSComp.SR.tcExpectedUnitOfMeasureNotType(), m)) | TyparKind.Measure -> Measure.Const tcref @@ -830,10 +825,10 @@ let TcConst (cenv: cenv) (overallTy: TType) m env synConst = let measureTy = match synConst with | SynConst.Measure(synMeasure = SynMeasure.Anon _) -> - (mkAppTy tcr [TType_measure (Measure.Var (NewAnonTypar (TyparKind.Measure, m, TyparRigidity.Anon, (if iszero then TyparStaticReq.None else TyparStaticReq.HeadType), TyparDynamicReq.No)))]) + (mkWoNullAppTy tcr [TType_measure (Measure.Var (NewAnonTypar (TyparKind.Measure, m, TyparRigidity.Anon, (if iszero then TyparStaticReq.None else TyparStaticReq.HeadType), TyparDynamicReq.No)))]) - | SynConst.Measure(synMeasure = ms) -> mkAppTy tcr [TType_measure (tcMeasure ms)] - | _ -> mkAppTy tcr [TType_measure Measure.One] + | SynConst.Measure(synMeasure = ms) -> mkWoNullAppTy tcr [TType_measure (tcMeasure ms)] + | _ -> mkWoNullAppTy tcr [TType_measure Measure.One] unif measureTy let expandedMeasurablesEnabled = @@ -853,7 +848,7 @@ let TcConst (cenv: cenv) (overallTy: TType) m env synConst = unif g.float_ty Const.Double f | SynConst.Decimal f -> - unif (mkAppTy g.decimal_tcr []) + unif (mkWoNullAppTy g.decimal_tcr []) Const.Decimal f | SynConst.SByte i -> unif g.sbyte_ty @@ -1015,6 +1010,56 @@ let TranslatePartialValReprInfo tps (PrelimValReprInfo (argsData, retData)) = // Members //------------------------------------------------------------------------- + +[] +type TcCanFail = + | IgnoreMemberResoutionError + | IgnoreAllErrors + | ReportAllErrors + +let TcAddNullnessToType (warn: bool) (cenv: cenv) (env: TcEnv) nullness innerTyC m = + let g = cenv.g + if g.langFeatureNullness then + if TypeNullNever g innerTyC then + let tyString = NicePrint.minimalStringOfType env.DisplayEnv innerTyC + errorR(Error(FSComp.SR.tcTypeDoesNotHaveAnyNull(tyString), m)) + + match tryAddNullnessToTy nullness innerTyC with + + | None -> + let tyString = NicePrint.minimalStringOfType env.DisplayEnv innerTyC + errorR(Error(FSComp.SR.tcTypeDoesNotHaveAnyNull(tyString), m)) + innerTyC + + | Some innerTyCWithNull -> + // The inner type is not allowed to support null or use null as a representation value. + // For example "int option?" is not allowed, nor "string??". + // + // For variable types in FSharp.Core we make an exception because we must allow + // val toObj: value: 'T option -> 'T | null when 'T : not struct (* and 'T : not null *) + // without implying 'T is not null. This is because it is legitimate to use this + // function to "collapse" null and obj-null-coming-from-option using such a function. + + if not g.compilingFSharpCore || not (isTyparTy g innerTyC) then + AddCxTypeDefnNotSupportsNull env.DisplayEnv cenv.css m NoTrace innerTyC + AddCxTypeIsReferenceType env.DisplayEnv cenv.css m NoTrace innerTyC + + if not g.compilingFSharpCore && isTyparTy g innerTyC then + // A typar might be later inferred into a type not supporting `| null|, like tuple or anon. + // Repeat the check in post inference + AddCxTypeCanCarryNullnessInfo env.DisplayEnv cenv.css m innerTyC nullness + + innerTyCWithNull + + else + if warn then + warning(Error(FSComp.SR.tcNullnessCheckingNotEnabled(), m)) + innerTyC + +//------------------------------------------------------------------------- +// Members +//------------------------------------------------------------------------- + let ComputeLogicalName (id: Ident) (memberFlags: SynMemberFlags) = match memberFlags.MemberKind with | SynMemberKind.ClassConstructor -> ".cctor" @@ -1118,7 +1163,7 @@ let PublishModuleDefn (cenv: cenv) env mspec = if intoFslibCcu then mty else mty.AddEntity mspec) let item = Item.ModuleOrNamespaces([mkLocalModuleRef mspec]) - CallNameResolutionSink cenv.tcSink (mspec.Range, env.NameEnv, item, emptyTyparInst, ItemOccurence.Binding, env.AccessRights) + CallNameResolutionSink cenv.tcSink (mspec.Range, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Binding, env.AccessRights) let PublishTypeDefn (cenv: cenv) env mspec = UpdateAccModuleOrNamespaceType cenv env (fun _ mty -> @@ -1237,7 +1282,7 @@ let CheckForAbnormalOperatorNames (cenv: cenv) (idRange: range) coreDisplayName let CheckInitProperties (g: TcGlobals) (minfo: MethInfo) methodName mItem = if g.langVersion.SupportsFeature(LanguageFeature.InitPropertiesSupport) then - // Check, wheter this method has external init, emit an error diagnostic in this case. + // Check, whether this method has external init, emit an error diagnostic in this case. if minfo.HasExternalInit then errorR (Error (FSComp.SR.tcSetterForInitOnlyPropertyCannotBeCalled1 methodName, mItem)) @@ -1274,7 +1319,7 @@ let CheckRequiredProperties (g:TcGlobals) (env: TcEnv) (cenv: TcFileState) (minf let details = NicePrint.multiLineStringOfPropInfos g cenv.amap mMethExpr env.DisplayEnv missingProps errorR(Error(FSComp.SR.tcMissingRequiredMembers details, mMethExpr)) -let private HasMethodImplNoInliningAttribute g attrs = +let private HasMethodImplNoInliningAttribute g attrs = match TryFindFSharpAttribute g g.attrib_MethodImplAttribute attrs with // NO_INLINING = 8 | Some (Attrib(_, _, [ AttribInt32Arg flags ], _, _, _, _)) -> (flags &&& 0x8) <> 0x0 @@ -1322,16 +1367,16 @@ let MakeAndPublishVal (cenv: cenv) env (altActualParent, inSig, declKind, valRec let vis, _ = ComputeAccessAndCompPath g env (Some declKind) id.idRange vis overrideVis actualParent - let inlineFlag = - if HasFSharpAttributeOpt g g.attrib_DllImportAttribute attrs then - if inlineFlag = ValInline.Always then - errorR(Error(FSComp.SR.tcDllImportStubsCannotBeInlined(), m)) - ValInline.Never - else - if HasMethodImplNoInliningAttribute g attrs - then ValInline.Never - else inlineFlag - + let inlineFlag = + if HasFSharpAttributeOpt g g.attrib_DllImportAttribute attrs then + if inlineFlag = ValInline.Always then + errorR(Error(FSComp.SR.tcDllImportStubsCannotBeInlined(), m)) + ValInline.Never + else + if HasMethodImplNoInliningAttribute g attrs + then ValInline.Never + else inlineFlag + // CompiledName not allowed on virtual/abstract/override members let compiledNameAttrib = TryFindFSharpStringAttribute g g.attrib_CompiledNameAttribute attrs @@ -1411,7 +1456,7 @@ let MakeAndPublishVal (cenv: cenv) env (altActualParent, inSig, declKind, valRec let nenv = AddFakeNamedValRefToNameEnv vspec.DisplayName env.NameEnv (mkLocalValRef vspec) CallEnvSink cenv.tcSink (vspec.Range, nenv, env.eAccessRights) let item = Item.Value(mkLocalValRef vspec) - CallNameResolutionSink cenv.tcSink (vspec.Range, nenv, item, emptyTyparInst, ItemOccurence.Binding, env.eAccessRights) + CallNameResolutionSink cenv.tcSink (vspec.Range, nenv, item, emptyTyparInst, ItemOccurrence.Binding, env.eAccessRights) | _ -> () vspec @@ -1649,9 +1694,9 @@ let CombineSyntacticAndInferredValReprInfo g rhsExpr prelimScheme = | _ when memberInfoOpt.IsSome -> partialValReprInfoOpt // Don't use any expression information for 'let' bindings where return attributes are present - | _ when retAttribs.Length > 0 -> + | _ when retAttribs.Length > 0 -> partialValReprInfoOpt - | Some partialValReprInfoFromSyntax -> + | Some partialValReprInfoFromSyntax -> let (PrelimValReprInfo(curriedArgInfosFromSyntax, retInfoFromSyntax)) = partialValReprInfoFromSyntax let partialArityInfo = if isMutable then @@ -1728,20 +1773,20 @@ let MakeAndPublishSimpleValsForMergedScope (cenv: cenv) env m (names: NameMap<_> else let nameResolutions = ResizeArray() - let notifyNameResolution (pos, item, itemGroup, itemTyparInst, occurence, nenv, ad, m: range, replacing) = + let notifyNameResolution (pos, item, itemGroup, itemTyparInst, occurrence, nenv, ad, m: range, replacing) = if not m.IsSynthetic then - nameResolutions.Add(pos, item, itemGroup, itemTyparInst, occurence, nenv, ad, m, replacing) + nameResolutions.Add(pos, item, itemGroup, itemTyparInst, occurrence, nenv, ad, m, replacing) let values, vspecMap = let sink = { new ITypecheckResultsSink with member _.NotifyEnvWithScope(_, _, _) = () // ignore EnvWithScope reports - member _.NotifyNameResolution(pos, item, itemTyparInst, occurence, nenv, ad, m, replacing) = - notifyNameResolution (pos, item, item, itemTyparInst, occurence, nenv, ad, m, replacing) + member _.NotifyNameResolution(pos, item, itemTyparInst, occurrence, nenv, ad, m, replacing) = + notifyNameResolution (pos, item, item, itemTyparInst, occurrence, nenv, ad, m, replacing) - member _.NotifyMethodGroupNameResolution(pos, item, itemGroup, itemTyparInst, occurence, nenv, ad, m, replacing) = - notifyNameResolution (pos, item, itemGroup, itemTyparInst, occurence, nenv, ad, m, replacing) + member _.NotifyMethodGroupNameResolution(pos, item, itemGroup, itemTyparInst, occurrence, nenv, ad, m, replacing) = + notifyNameResolution (pos, item, itemGroup, itemTyparInst, occurrence, nenv, ad, m, replacing) member _.NotifyExprHasType(_, _, _, _) = assert false // no expr typings in MakeAndPublishSimpleVals @@ -1769,8 +1814,8 @@ let MakeAndPublishSimpleValsForMergedScope (cenv: cenv) env m (names: NameMap<_> // send notification about mergedNameEnv CallEnvSink cenv.tcSink (mergedRange, mergedNameEnv, ad) // call CallNameResolutionSink for all captured name resolutions using mergedNameEnv - for _, item, itemGroup, itemTyparInst, occurence, _nenv, ad, m, _replacing in nameResolutions do - CallMethodGroupNameResolutionSink cenv.tcSink (m, mergedNameEnv, item, itemGroup, itemTyparInst, occurence, ad) + for _, item, itemGroup, itemTyparInst, occurrence, _nenv, ad, m, _replacing in nameResolutions do + CallMethodGroupNameResolutionSink cenv.tcSink (m, mergedNameEnv, item, itemGroup, itemTyparInst, occurrence, ad) values, vspecMap @@ -1782,7 +1827,7 @@ let MakeAndPublishSimpleValsForMergedScope (cenv: cenv) env m (names: NameMap<_> // to C<_> occurs then generate C for a fresh type inference variable ?ty. //------------------------------------------------------------------------- -let FreshenTyconRef (g: TcGlobals) m rigid (tcref: TyconRef) declaredTyconTypars = +let FreshenTyconRef (g: TcGlobals) m rigid (tcref: TyconRef) declaredTyconTypars = let origTypars = declaredTyconTypars let clearStaticReq = g.langVersion.SupportsFeature LanguageFeature.InterfacesWithAbstractStaticMembers let freshTypars = copyTypars clearStaticReq origTypars @@ -1795,7 +1840,7 @@ let FreshenTyconRef (g: TcGlobals) m rigid (tcref: TyconRef) declaredTyconTypars let freshTy = TType_app(tcref, tinst, g.knownWithoutNull) origTy, freshTypars, renaming, freshTy -let FreshenPossibleForallTy g m rigid ty = +let FreshenPossibleForallTy g m rigid ty = let origTypars, tau = tryDestForallTy g ty if isNil origTypars then [], [], [], tau @@ -1805,7 +1850,7 @@ let FreshenPossibleForallTy g m rigid ty = let tps, renaming, tinst = CopyAndFixupTypars g m rigid origTypars origTypars, tps, tinst, instType renaming tau -let FreshenTyconRef2 (g: TcGlobals) m (tcref: TyconRef) = +let FreshenTyconRef2 (g: TcGlobals) m (tcref: TyconRef) = let tps, renaming, tinst = FreshenTypeInst g m (tcref.Typars m) tps, renaming, tinst, TType_app (tcref, tinst, g.knownWithoutNull) @@ -1841,9 +1886,9 @@ let FreshenAbstractSlot g amap m synTyparDecls absMethInfo = typarsFromAbsSlotAreRigid, typarsFromAbsSlot, argTysFromAbsSlot, retTyFromAbsSlot let CheckRecdExprDuplicateFields (elems: Ident list) = - elems |> List.iteri (fun i (uc1: Ident) -> - elems |> List.iteri (fun j (uc2: Ident) -> - if j > i && uc1.idText = uc2.idText then + elems |> List.iteri (fun i (uc1: Ident) -> + elems |> List.iteri (fun j (uc2: Ident) -> + if j > i && uc1.idText = uc2.idText then errorR (Error(FSComp.SR.tcMultipleFieldsInRecord(uc1.idText), uc1.idRange)))) //------------------------------------------------------------------------- @@ -1908,7 +1953,7 @@ let BuildFieldMap (cenv: cenv) env isPartial ty (flds: ((Ident list * Ident) * ' // Record the precise resolution of the field for intellisense let item = Item.RecdField(rfinfo2) - CallNameResolutionSink cenv.tcSink (ident.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, ad) + CallNameResolutionSink cenv.tcSink (ident.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, ad) let fref2 = rfinfo2.RecdFieldRef @@ -2088,12 +2133,12 @@ module GeneralizationHelpers = /// Recursively knock out typars we can't generalize. /// For non-generalized type variables be careful to iteratively knock out /// both the typars and any typars free in the constraints of the typars - /// into the set that are considered free in the environment. - let rec TrimUngeneralizableTypars genConstrainedTyparFlag inlineFlag (generalizedTypars: Typar list) freeInEnv = - // Do not generalize type variables with a static requirement unless function is marked 'inline' - let generalizedTypars, ungeneralizableTypars1 = + /// into the set that are considered free in the environment. + let rec TrimUngeneralizableTypars genConstrainedTyparFlag inlineFlag (generalizedTypars: Typar list) freeInEnv = + // Do not generalize type variables with a static requirement unless function is marked 'inline' + let generalizedTypars, ungeneralizableTypars1 = if inlineFlag = ValInline.Always then generalizedTypars, [] - else generalizedTypars |> List.partition (fun tp -> tp.StaticReq = TyparStaticReq.None) + else generalizedTypars |> List.partition (fun tp -> tp.StaticReq = TyparStaticReq.None) // Do not generalize type variables which would escape their scope // because they are free in the environment @@ -2101,7 +2146,7 @@ module GeneralizationHelpers = List.partition (fun x -> not (Zset.contains x freeInEnv)) generalizedTypars // Some situations, e.g. implicit class constructions that represent functions as fields, - // do not allow generalisation over constrained typars. (since they can not be represented as fields) + // do not allow generalisation over constrained typars. (since they cannot be represented as fields) // // Don't generalize IsCompatFlex type parameters to avoid changing inferred types. let generalizedTypars, ungeneralizableTypars3 = @@ -2140,7 +2185,7 @@ module GeneralizationHelpers = match tp.Constraints |> List.partition (function TyparConstraint.CoercesTo _ -> true | _ -> false) with | [TyparConstraint.CoercesTo(tgtTy, _)], others -> // Throw away null constraints if they are implied - if others |> List.exists (function TyparConstraint.SupportsNull _ -> not (TypeSatisfiesNullConstraint g m tgtTy) | _ -> true) + if others |> List.exists (function TyparConstraint.SupportsNull _ -> not (TypeNullIsExtraValue g m tgtTy) | _ -> true) then None else Some tgtTy | _ -> None @@ -2236,7 +2281,7 @@ module GeneralizationHelpers = // to C<_> occurs then generate C for a fresh type inference variable ?ty. //------------------------------------------------------------------------- - let CheckDeclaredTyparsPermitted (memFlagsOpt: SynMemberFlags option, declaredTypars, m) = + let CheckDeclaredTyparsPermitted (memFlagsOpt: SynMemberFlags option, declaredTypars: Typars, m) = match memFlagsOpt with | None -> () | Some memberFlags -> @@ -2246,7 +2291,13 @@ module GeneralizationHelpers = | SynMemberKind.PropertySet | SynMemberKind.PropertyGetSet -> if not (isNil declaredTypars) then - errorR(Error(FSComp.SR.tcPropertyRequiresExplicitTypeParameters(), m)) + let declaredTyparsRange = + declaredTypars + |> List.map(fun typar -> typar.Range) + + let m = declaredTyparsRange |> List.fold (fun r a -> unionRanges r a) range.Zero + + errorR(Error(FSComp.SR.tcPropertyRequiresExplicitTypeParameters(), m)) | SynMemberKind.Constructor -> if not (isNil declaredTypars) then errorR(Error(FSComp.SR.tcConstructorCannotHaveTypeParameters(), m)) @@ -2279,7 +2330,7 @@ module GeneralizationHelpers = //------------------------------------------------------------------------- let ComputeInlineFlag (memFlagsOption: SynMemberFlags option) isInline isMutable g attrs m = - let hasNoCompilerInliningAttribute () = HasFSharpAttribute g g.attrib_NoCompilerInliningAttribute attrs + let hasNoCompilerInliningAttribute () = HasFSharpAttribute g g.attrib_NoCompilerInliningAttribute attrs let isCtorOrAbstractSlot () = match memFlagsOption with @@ -2296,7 +2347,7 @@ let ComputeInlineFlag (memFlagsOption: SynMemberFlags option) isInline isMutable if isMutable || isCtorOrAbstractSlot() || hasNoCompilerInliningAttribute() || isExtern () then ValInline.Never, errorR elif HasMethodImplNoInliningAttribute g attrs then - ValInline.Never, + ValInline.Never, if g.langVersion.SupportsFeature LanguageFeature.WarningWhenInliningMethodImplNoInlineMarkedFunction then warning else ignore @@ -2305,7 +2356,7 @@ let ComputeInlineFlag (memFlagsOption: SynMemberFlags option) isInline isMutable else ValInline.Optional, ignore - if isInline && (inlineFlag <> ValInline.Always) then + if isInline && (inlineFlag <> ValInline.Always) then reportIncorrectInlineKeywordUsage (Error(FSComp.SR.tcThisValueMayNotBeInlined(), m)) inlineFlag @@ -2382,9 +2433,9 @@ type IsObjExprBinding = | ValOrMemberBinding module BindingNormalization = - /// Push a bunch of pats at once. They may contain patterns, e.g. let f (A x) (B y) = ... - /// In this case the semantics is let f a b = let A x = a in let B y = b - let private PushMultiplePatternsToRhs (cenv: cenv) isMember pats (NormalizedBindingRhs(spatsL, rtyOpt, rhsExpr)) = + /// Push a bunch of pats at once. They may contain patterns, e.g. let f (A x) (B y) = ... + /// In this case the semantics is let f a b = let A x = a in let B y = b + let private PushMultiplePatternsToRhs (cenv: cenv) isMember pats (NormalizedBindingRhs(spatsL, rtyOpt, rhsExpr)) = let spatsL2, rhsExpr = PushCurriedPatternsToExpr cenv.synArgNameGenerator rhsExpr.Range isMember pats None rhsExpr NormalizedBindingRhs(spatsL2@spatsL, rtyOpt, rhsExpr) @@ -2778,10 +2829,7 @@ let TcVal checkAttributes (cenv: cenv) env (tpenv: UnscopedTyparEnv) (vref: ValR let exprForVal = Expr.Val (vref, vrefFlags, m) let exprForVal = mkTyAppExpr m (exprForVal, vTy) tinst let isSpecial = - (match vrefFlags with NormalValUse | PossibleConstrainedCall _ -> false | _ -> true) || - valRefEq g vref g.splice_expr_vref || - valRefEq g vref g.splice_raw_expr_vref - + (match vrefFlags with NormalValUse | PossibleConstrainedCall _ -> false | _ -> true) || g.isSpliceOperator vref let exprForVal = RecordUseOfRecValue cenv valRecInfo vref exprForVal m tpsorig, exprForVal, isSpecial, tau, tinst, tpenv @@ -2791,34 +2839,6 @@ let TcVal checkAttributes (cenv: cenv) env (tpenv: UnscopedTyparEnv) (vref: ValR | Some AfterResolution.DoNothing | None -> () res -/// simplified version of TcVal used in calls to BuildMethodCall (typrelns.fs) -/// this function is used on typechecking step for making calls to provided methods and on optimization step (for the same purpose). -let LightweightTcValForUsingInBuildMethodCall g (vref: ValRef) vrefFlags (vrefTypeInst: TTypes) m = - let v = vref.Deref - let vTy = vref.Type - // byref-typed values get dereferenced - if isByrefTy g vTy then - mkAddrGet m vref, destByrefTy g vTy - else - match v.LiteralValue with - | Some literalConst -> - let _, _, _, tau = FreshenPossibleForallTy g m TyparRigidity.Flexible vTy - Expr.Const (literalConst, m, tau), tau - - | None -> - // Instantiate the value - let tau = - // If we have got an explicit instantiation then use that - let _, tps, tpTys, tau = FreshenPossibleForallTy g m TyparRigidity.Flexible vTy - - if tpTys.Length <> vrefTypeInst.Length then error(Error(FSComp.SR.tcTypeParameterArityMismatch(tps.Length, vrefTypeInst.Length), m)) - - instType (mkTyparInst tps vrefTypeInst) tau - - let exprForVal = Expr.Val (vref, vrefFlags, m) - let exprForVal = mkTyAppExpr m (exprForVal, vTy) vrefTypeInst - exprForVal, tau - /// Mark points where we decide whether an expression will support automatic /// decondensation or not. type ApplicableExpr = @@ -2953,7 +2973,7 @@ let TcRuntimeTypeTest isCast isOperator (cenv: cenv) denv m tgtTy srcTy = else error(Error(FSComp.SR.tcTypeTestErased(NicePrint.minimalStringOfType denv tgtTy, NicePrint.minimalStringOfType denv (stripTyEqnsWrtErasure EraseAll g tgtTy)), m)) else - for ety in getErasedTypes g tgtTy do + for ety in getErasedTypes g tgtTy true do if isMeasureTy g ety then warning(Error(FSComp.SR.tcTypeTestLosesMeasures(NicePrint.minimalStringOfType denv ety), m)) else @@ -3059,7 +3079,7 @@ let BuildDisposableCleanup (cenv: cenv) env m (v: Val) = else let disposeObjVar, disposeObjExpr = mkCompGenLocal m "objectToDispose" g.system_IDisposable_ty let disposeExpr, _ = BuildPossiblyConditionalMethodCall cenv env PossiblyMutates m false disposeMethod NormalValUse [] [disposeObjExpr] [] None - let inputExpr = mkCoerceExpr(exprForVal v.Range v, g.obj_ty, m, v.Type) + let inputExpr = mkCoerceExpr(exprForVal v.Range v, g.obj_ty_ambivalent, m, v.Type) mkIsInstConditional g m g.system_IDisposable_ty inputExpr disposeObjVar disposeExpr (mkUnit g m) /// Build call to get_OffsetToStringData as part of 'fixed' @@ -3198,30 +3218,6 @@ let GetMethodArgs arg = unnamedCallerArgs, namedCallerArgs - -//------------------------------------------------------------------------- -// Helpers dealing with pattern match compilation -//------------------------------------------------------------------------- - -let CompilePatternForMatch (cenv: cenv) (env: TcEnv) mExpr mMatch warnOnUnused actionOnFailure (inputVal, generalizedTypars, inputExprOpt) clauses inputTy resultTy = - let g = cenv.g - let dtree, targets = CompilePattern g env.DisplayEnv cenv.amap (LightweightTcValForUsingInBuildMethodCall g) cenv.infoReader mExpr mMatch warnOnUnused actionOnFailure (inputVal, generalizedTypars, inputExprOpt) clauses inputTy resultTy - mkAndSimplifyMatch DebugPointAtBinding.NoneAtInvisible mExpr mMatch resultTy dtree targets - -/// Compile a pattern -let CompilePatternForMatchClauses (cenv: cenv) env mExpr mMatch warnOnUnused actionOnFailure inputExprOpt inputTy resultTy tclauses = - // Avoid creating a dummy in the common cases where we are about to bind a name for the expression - // CLEANUP: avoid code duplication with code further below, i.e.all callers should call CompilePatternForMatch - match tclauses with - | [MatchClause(TPat_as (pat1, PatternValBinding (asVal, GeneralizedType(generalizedTypars, _)), _), None, TTarget(vs, targetExpr, _), m2)] -> - let vs2 = ListSet.remove valEq asVal vs - let expr = CompilePatternForMatch cenv env mExpr mMatch warnOnUnused actionOnFailure (asVal, generalizedTypars, None) [MatchClause(pat1, None, TTarget(vs2, targetExpr, None), m2)] inputTy resultTy - asVal, expr - | _ -> - let matchValueTmp, _ = mkCompGenLocal mExpr "matchValue" inputTy - let expr = CompilePatternForMatch cenv env mExpr mMatch warnOnUnused actionOnFailure (matchValueTmp, [], inputExprOpt) tclauses inputTy resultTy - matchValueTmp, expr - //------------------------------------------------------------------------- // Helpers dealing with sequence expressions //------------------------------------------------------------------------- @@ -3299,7 +3295,7 @@ let AnalyzeArbitraryExprAsEnumerable (cenv: cenv) (env: TcEnv) localAlloc m expr // e.g. MatchCollection typeEquiv g g.int32_ty ty || // e.g. EnvDTE.Documents.Item - typeEquiv g g.obj_ty ty + typeEquiv g g.obj_ty_ambivalent ty | _ -> false match TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AllResults cenv env m ad "get_Item" tyToSearchForGetEnumeratorAndItem with @@ -3377,7 +3373,7 @@ let AnalyzeArbitraryExprAsEnumerable (cenv: cenv) (env: TcEnv) localAlloc m expr match probe exprTyAsSeq with | Some res -> res | None -> - let ienumerable = mkAppTy g.tcref_System_Collections_IEnumerable [] + let ienumerable = mkWoNullAppTy g.tcref_System_Collections_IEnumerable [] match probe ienumerable with | Some res -> res | None -> @@ -3479,9 +3475,9 @@ let EliminateInitializationGraphs | Expr.TyLambda (_, _, b, _, _) -> CheckExpr st b | Expr.Obj (_, ty, _, e, overrides, extraImpls, _) -> - // NOTE: we can't fixup recursive references inside delegates since the closure delegee of a delegate is not accessible - // from outside. Object expressions implementing interfaces can, on the other hand, be fixed up. See FSharp 1.0 bug 1469 - if isInterfaceTy g ty then + // NOTE: we can't fixup recursive references inside delegates since the closure delegee of a delegate is not accessible + // from outside. Object expressions implementing interfaces can, on the other hand, be fixed up. See FSharp 1.0 bug 1469 + if isInterfaceTy g ty then List.iter (fun (TObjExprMethod(_, _, _, _, e, _)) -> checkDelayed st e) overrides List.iter (snd >> List.iter (fun (TObjExprMethod(_, _, _, _, e, _)) -> checkDelayed st e)) extraImpls else @@ -3523,7 +3519,7 @@ let EliminateInitializationGraphs | Expr.Quote _ -> () | Expr.WitnessArg (_witnessInfo, _m) -> () - and CheckBinding st (TBind(_, e, _)) = CheckExpr st e + and CheckBinding st (TBind(_, e, _)) = CheckExpr st e and CheckDecisionTree st dt = match dt with @@ -3599,7 +3595,7 @@ let EliminateInitializationGraphs let vTy = mkLazyTy g ty let fty = mkFunTy g g.unit_ty ty - let flazy, felazy = mkCompGenLocal m v.LogicalName fty + let flazy, felazy = mkCompGenLocal m v.LogicalName fty let frhs = mkUnitDelayLambda g m e if mustHaveValReprInfo then @@ -3684,7 +3680,7 @@ let CheckAndRewriteObjectCtor g env (ctorLambdaExpr: Expr) = // = "let pat = expr in " | Expr.Let (bind, body, m, _) -> mkLetBind m bind (checkAndRewrite body) - // The constructor is a sequence "let pat = expr in " + // The constructor is a sequence "let pat = expr in " | Expr.Match (debugPoint, a, b, targets, c, d) -> let targets = targets |> Array.map (fun (TTarget(vs, body, flags)) -> TTarget(vs, checkAndRewrite body, flags)) Expr.Match (debugPoint, a, b, targets, c, d) @@ -3827,22 +3823,22 @@ let buildApp (cenv: cenv) expr resultTy arg m = type DelayedItem = /// Represents the in "item" - | DelayedTypeApp of - typeArgs: SynType list * - mTypeArgs: range * + | DelayedTypeApp of + typeArgs: SynType list * + mTypeArgs: range * mExprAndTypeArgs: range /// Represents the args in "item args", or "item.Property(args)". - | DelayedApp of - isAtomic: ExprAtomicFlag * - isSugar: bool * - synLeftExprOpt: SynExpr option * - argExpr: SynExpr * + | DelayedApp of + isAtomic: ExprAtomicFlag * + isSugar: bool * + synLeftExprOpt: SynExpr option * + argExpr: SynExpr * mFuncAndArg: range /// Represents the long identifiers in "item.Ident1", or "item.Ident1.Ident2" etc. - | DelayedDotLookup of - idents: Ident list * + | DelayedDotLookup of + idents: Ident list * range /// Represents an incomplete "item." @@ -3852,7 +3848,7 @@ type DelayedItem = | DelayedSet of SynExpr * range module DelayedItem = - let maybeAppliedArgForPreferExtensionOverProperty delayed = + let maybeAppliedArgForPreferExtensionOverProperty delayed = match delayed with | [] -> None | DelayedItem.DelayedApp(argExpr=argExpr) :: _ -> Some argExpr @@ -4029,7 +4025,7 @@ let rec TcTyparConstraint ridx (cenv: cenv) newOk checkConstraints occ (env: TcE tpenv | SynTypeConstraint.WhereTyparSubtypeOfType(tp, ty, m) -> - let tyR, tpenv = TcTypeAndRecover cenv newOk checkConstraints ItemOccurence.UseInType WarnOnIWSAM.No env tpenv ty + let tyR, tpenv = TcTypeAndRecover cenv newOk checkConstraints ItemOccurrence.UseInType WarnOnIWSAM.No env tpenv ty let tpR, tpenv = TcTypar cenv env newOk tpenv tp if newOk = NoNewTypars && isSealedTy g tyR then errorR(Error(FSComp.SR.tcInvalidConstraintTypeSealed(), m)) @@ -4039,6 +4035,13 @@ let rec TcTyparConstraint ridx (cenv: cenv) newOk checkConstraints occ (env: TcE | SynTypeConstraint.WhereTyparSupportsNull(tp, m) -> TcSimpleTyparConstraint cenv env newOk tpenv tp m AddCxTypeUseSupportsNull + | SynTypeConstraint.WhereTyparNotSupportsNull(tp, m, _) -> + if g.langFeatureNullness then + TcSimpleTyparConstraint cenv env newOk tpenv tp m AddCxTypeDefnNotSupportsNull + else + warning(Error(FSComp.SR.tcNullnessCheckingNotEnabled(), m)) + tpenv + | SynTypeConstraint.WhereTyparIsComparable(tp, m) -> TcSimpleTyparConstraint cenv env newOk tpenv tp m AddCxTypeMustSupportComparison @@ -4065,7 +4068,7 @@ let rec TcTyparConstraint ridx (cenv: cenv) newOk checkConstraints occ (env: TcE | SynTypeConstraint.WhereSelfConstrained(ty, m) -> checkLanguageFeatureAndRecover g.langVersion LanguageFeature.SelfTypeConstraints m - let tyR, tpenv = TcTypeAndRecover cenv newOk checkConstraints ItemOccurence.UseInType WarnOnIWSAM.No env tpenv ty + let tyR, tpenv = TcTypeAndRecover cenv newOk checkConstraints ItemOccurrence.UseInType WarnOnIWSAM.No env tpenv ty match tyR with | TType_app(tcref, tinst, _) when (tcref.IsTypeAbbrev && (isTyparTy g tcref.TypeAbbrev.Value) && tinst |> List.forall (isTyparTy g)) -> match checkConstraints with @@ -4088,7 +4091,7 @@ and TcConstraintWhereTyparIsEnum cenv env newOk checkConstraints tpenv tp synUnd let tpenv = match synUnderlingTys with | [synUnderlyingTy] -> - let underlyingTy, tpenv = TcTypeAndRecover cenv newOk checkConstraints ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv synUnderlyingTy + let underlyingTy, tpenv = TcTypeAndRecover cenv newOk checkConstraints ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv synUnderlyingTy AddCxTypeIsEnum env.DisplayEnv cenv.css m NoTrace (mkTyparTy tpR) underlyingTy tpenv | _ -> @@ -4133,7 +4136,7 @@ and TcSimpleTyparConstraint cenv env newOk tpenv tp m constraintAdder = and TcPseudoMemberSpec cenv newOk env synTypes tpenv synMemberSig m = let g = cenv.g - let tys, tpenv = List.mapFold (TcTypeAndRecover cenv newOk CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env) tpenv synTypes + let tys, tpenv = List.mapFold (TcTypeAndRecover cenv newOk CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env) tpenv synTypes match synMemberSig with | SynMemberSig.Member (synValSig, memberFlags, m, _) -> @@ -4142,6 +4145,20 @@ and TcPseudoMemberSpec cenv newOk env synTypes tpenv synMemberSig m = let members, tpenv = TcValSpec cenv env ModuleOrMemberBinding newOk ExprContainerInfo (Some memberFlags) (Some (List.head tys)) tpenv synValSig [] match members with | [ValSpecResult(_, _, id, _, _, memberConstraintTy, prelimValReprInfo, _)] -> + + match synValSig with + | SynValSig(accessibility = access) -> + match access with + | SynValSigAccess.Single(Some access) + | SynValSigAccess.GetSet(Some access, _, _) + | SynValSigAccess.GetSet(_, Some access, _) + | SynValSigAccess.GetSet(_, _, Some access) -> + if g.langVersion.SupportsFeature(LanguageFeature.AllowAccessModifiersToAutoPropertiesGettersAndSetters) then + errorR(Error(FSComp.SR.tcAccessModifiersNotAllowedInSRTPConstraint(), access.Range)) + else + warning(Error(FSComp.SR.tcAccessModifiersNotAllowedInSRTPConstraint(), access.Range)) + | _ -> () + let memberConstraintTypars, _ = tryDestForallTy g memberConstraintTy let valReprInfo = TranslatePartialValReprInfo memberConstraintTypars prelimValReprInfo let _, _, curriedArgInfos, returnTy, _ = GetValReprTypeInCompiledForm g valReprInfo 0 memberConstraintTy m @@ -4160,7 +4177,7 @@ and TcPseudoMemberSpec cenv newOk env synTypes tpenv synMemberSig m = warning(Error(FSComp.SR.tcTraitMayNotUseComplexThings(), m)) let item = Item.OtherName (Some id, memberConstraintTy, None, None, id.idRange) - CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, env.AccessRights) + CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, env.AccessRights) TTrait(tys, logicalCompiledName, memberFlags, argTys, returnTy, ref None, ref None), tpenv @@ -4192,7 +4209,7 @@ and TcValSpec (cenv: cenv) env declKind newOk containerInfo memFlagsOpt thisTyOp let allDeclaredTypars = enclosingDeclaredTypars @ declaredTypars let envinner = AddDeclaredTypars NoCheckForDuplicateTypars allDeclaredTypars env let checkConstraints = CheckCxs - let tpenv = TcTyparConstraints cenv newOk checkConstraints ItemOccurence.UseInType envinner tpenv synTyparConstraints + let tpenv = TcTyparConstraints cenv newOk checkConstraints ItemOccurrence.UseInType envinner tpenv synTyparConstraints // Treat constraints at the "end" of the type as if they are declared. // This is by far the most convenient place to locate the constraints. @@ -4201,7 +4218,7 @@ and TcValSpec (cenv: cenv) env declKind newOk containerInfo memFlagsOpt thisTyOp let tpenv = match ty with | SynType.WithGlobalConstraints(_, synConstraints, _) -> - TcTyparConstraints cenv newOk checkConstraints ItemOccurence.UseInType envinner tpenv synConstraints + TcTyparConstraints cenv newOk checkConstraints ItemOccurrence.UseInType envinner tpenv synConstraints | _ -> tpenv @@ -4209,7 +4226,7 @@ and TcValSpec (cenv: cenv) env declKind newOk containerInfo memFlagsOpt thisTyOp allDeclaredTypars |> List.iter (SetTyparRigid env.DisplayEnv m) // Process the type, including any constraints - let declaredTy, tpenv = TcTypeAndRecover cenv newOk checkConstraints ItemOccurence.UseInType WarnOnIWSAM.Yes envinner tpenv ty + let declaredTy, tpenv = TcTypeAndRecover cenv newOk checkConstraints ItemOccurrence.UseInType WarnOnIWSAM.Yes envinner tpenv ty match memFlagsOpt, thisTyOpt with | Some memberFlags, Some thisTy -> @@ -4229,12 +4246,12 @@ and TcValSpec (cenv: cenv) env declKind newOk containerInfo memFlagsOpt thisTyOp if arginfos.Length > 1 then error(Error(FSComp.SR.tcInvalidPropertyType(), m)) match memberFlags.MemberKind with | SynMemberKind.PropertyGet -> - if SynInfo.HasNoArgs valSynInfo then + if SynInfo.HasNoArgs valSynInfo then let getterTy = mkFunTy g g.unit_ty declaredTy getterTy, (SynInfo.IncorporateEmptyTupledArgForPropertyGetter valSynInfo) else declaredTy, valSynInfo - | _ -> + | _ -> let setterArgTys = List.map fst (List.concat arginfos) @ [returnTy] let setterArgTy = mkRefTupledTy g setterArgTys let setterTy = mkFunTy g setterArgTy cenv.g.unit_ty @@ -4328,7 +4345,7 @@ and TcTypeOrMeasureParameter kindOpt cenv (env: TcEnv) newOk tpenv (SynTypar(id, | Some TyparKind.Type, TyparKind.Measure -> error (Error(FSComp.SR.tcExpectedTypeParameter(), id.idRange)); res, tpenv | _, _ -> let item = Item.TypeVar(id.idText, res) - CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.UseInType, env.AccessRights) + CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.UseInType, env.AccessRights) res, tpenv let key = id.idText @@ -4363,7 +4380,7 @@ and TcTypeOrMeasureParameter kindOpt cenv (env: TcEnv) newOk tpenv (SynTypar(id, let tpR = Construct.NewTypar (kind, TyparRigidity.WarnIfNotRigid, tp, false, TyparDynamicReq.Yes, [], false, false) let item = Item.TypeVar(id.idText, tpR) - CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.UseInType, env.AccessRights) + CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.UseInType, env.AccessRights) tpR, AddUnscopedTypar key tpR tpenv @@ -4390,7 +4407,7 @@ and TcTyparDecl (cenv: cenv) env synTyparDecl = () let item = Item.TypeVar(id.idText, tp) - CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.UseInType, env.eAccessRights) + CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.UseInType, env.eAccessRights) tp @@ -4408,14 +4425,14 @@ and TcTypeOrMeasure kindOpt (cenv: cenv) newOk checkConstraints occ (iwsam: Warn match synTy with | SynType.LongIdent(SynLongIdent([], _, _)) -> // special case when type name is absent - i.e. empty inherit part in type declaration - g.obj_ty, tpenv + g.obj_ty_ambivalent, tpenv | SynType.LongIdent synLongId -> TcLongIdentType kindOpt cenv newOk checkConstraints occ iwsam env tpenv synLongId | MultiDimensionArrayType (rank, elemTy, m) -> TcArrayType cenv newOk checkConstraints occ env tpenv rank elemTy m - + | SynType.App (StripParenTypes (SynType.LongIdent longId), _, args, _, _, postfix, m) -> TcLongIdentAppType kindOpt cenv newOk checkConstraints occ iwsam env tpenv longId postfix args m @@ -4456,21 +4473,28 @@ and TcTypeOrMeasure kindOpt (cenv: cenv) newOk checkConstraints occ (iwsam: Warn | SynType.StaticConstant (synConst, m) -> TcTypeStaticConstant kindOpt tpenv synConst m + | SynType.StaticConstantNull m | SynType.StaticConstantNamed (_, _, m) | SynType.StaticConstantExpr (_, m) -> errorR(Error(FSComp.SR.parsInvalidLiteralInType(), m)) NewErrorType (), tpenv + | SynType.WithNull(innerTy, ambivalent, m, _) -> + let innerTyC, tpenv = TcTypeAndRecover cenv newOk checkConstraints occ WarnOnIWSAM.Yes env tpenv innerTy + let nullness = if ambivalent then KnownAmbivalentToNull else KnownWithNull + let tyWithNull = TcAddNullnessToType false cenv env nullness innerTyC m + tyWithNull, tpenv + | SynType.MeasurePower(ty, exponent, m) -> TcTypeMeasurePower kindOpt cenv newOk checkConstraints occ env tpenv ty exponent m | SynType.App(arg1, _, args, _, _, postfix, m) -> - TcTypeMeasureApp kindOpt cenv newOk checkConstraints occ env tpenv arg1 args postfix m + TcTypeMeasureApp kindOpt cenv newOk checkConstraints occ env tpenv arg1 args postfix m | SynType.Paren(innerType, _) | SynType.SignatureParameter(usedType = innerType) -> TcTypeOrMeasure kindOpt cenv newOk checkConstraints occ iwsam env tpenv innerType - + | SynType.Or(range = m) -> // The inner types are expected to be collected by (|TypesForTypar|) at this point. error(Error((FSComp.SR.tcSynTypeOrInvalidInDeclaration()), m)) @@ -4518,7 +4542,7 @@ and TcLongIdentAppType kindOpt (cenv: cenv) newOk checkConstraints occ iwsam env let tinstEnclosing, tcref, inst = let tyResInfo = TypeNameResolutionStaticArgsInfo.FromTyArgs args.Length - ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurence.UseInType OpenQualified env.eNameResEnv ad tc tyResInfo PermitDirectReferenceToGeneratedType.No + ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurrence.UseInType OpenQualified env.eNameResEnv ad tc tyResInfo PermitDirectReferenceToGeneratedType.No |> ForceRaise CheckIWSAM cenv env checkConstraints iwsam m tcref @@ -4570,18 +4594,18 @@ and TcTupleType kindOpt (cenv: cenv) newOk checkConstraints occ env tpenv isStru | Some TyparKind.Measure -> true | None -> args |> List.exists(function | SynTupleTypeSegment.Slash _ -> true | _ -> false) | Some _ -> false - + if isMeasure then let ms,tpenv = TcMeasuresAsTuple cenv newOk checkConstraints occ env tpenv args m TType_measure ms,tpenv else let argsR,tpenv = TcTypesAsTuple cenv newOk checkConstraints occ env tpenv args m TType_tuple(tupInfo, argsR), tpenv - + and CheckAnonRecdTypeDuplicateFields (elems: Ident array) = - elems |> Array.iteri (fun i (uc1: Ident) -> - elems |> Array.iteri (fun j (uc2: Ident) -> - if j > i && uc1.idText = uc2.idText then + elems |> Array.iteri (fun i (uc1: Ident) -> + elems |> Array.iteri (fun j (uc2: Ident) -> + if j > i && uc1.idText = uc2.idText then errorR(Error(FSComp.SR.tcAnonRecdTypeDuplicateFieldId(uc1.idText), uc1.idRange)))) and TcAnonRecdType (cenv: cenv) newOk checkConstraints occ env tpenv isStruct args m = @@ -4598,7 +4622,7 @@ and TcAnonRecdType (cenv: cenv) newOk checkConstraints occ env tpenv isStruct ar sortedFieldTys |> List.iteri (fun i (x,_) -> let item = Item.AnonRecdField(anonInfo, sortedCheckedArgTys, i, x.idRange) - CallNameResolutionSink cenv.tcSink (x.idRange,env.NameEnv,item,emptyTyparInst,ItemOccurence.UseInType,env.eAccessRights)) + CallNameResolutionSink cenv.tcSink (x.idRange,env.NameEnv,item,emptyTyparInst,ItemOccurrence.UseInType,env.eAccessRights)) TType_anon(anonInfo, sortedCheckedArgTys),tpenv @@ -4612,7 +4636,7 @@ and TcFunctionType (cenv: cenv) newOk checkConstraints occ env tpenv domainTy re and TcArrayType (cenv: cenv) newOk checkConstraints occ env tpenv rank elemTy m = let g = cenv.g let elemTy, tpenv = TcTypeAndRecover cenv newOk checkConstraints occ WarnOnIWSAM.Yes env tpenv elemTy - let tyR = mkArrayTy g rank elemTy m + let tyR = mkArrayTy g rank g.knownWithoutNull elemTy m tyR, tpenv and TcTypeParameter kindOpt (cenv: cenv) env newOk tpenv tp = @@ -4637,8 +4661,9 @@ and TcTypeWithConstraints (cenv: cenv) env newOk checkConstraints occ tpenv synT and TcTypeHashConstraint (cenv: cenv) env newOk checkConstraints occ tpenv synTy m = let tp = TcAnonTypeOrMeasure (Some TyparKind.Type) cenv TyparRigidity.WarnIfNotRigid TyparDynamicReq.Yes newOk m let ty, tpenv = TcTypeAndRecover cenv newOk checkConstraints occ WarnOnIWSAM.No env tpenv synTy - AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css m NoTrace ty (mkTyparTy tp) - tp.AsType, tpenv + let tpTy = mkTyparTy tp + AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css m NoTrace ty tpTy + tpTy, tpenv // (x: 't & #I1 & #I2) // (x: #I1 & #I2) @@ -4661,7 +4686,8 @@ and TcIntersectionConstraint (cenv: cenv) env newOk checkConstraints occ tpenv s | _ -> tpenv ) tpenv - tp.AsType, tpenv + let tpTy = tp.AsType KnownAmbivalentToNull // TODO: NULLNESS + tpTy, tpenv and TcTypeStaticConstant kindOpt tpenv c m = match c, kindOpt with @@ -4741,9 +4767,9 @@ and TcTypesAsTuple (cenv: cenv) newOk checkConstraints occ env tpenv (args: SynT let hasASlash = args |> List.exists(function | SynTupleTypeSegment.Slash _ -> true | _ -> false) - + if hasASlash then errorR(Error(FSComp.SR.tcUnexpectedSlashInType(), m)) - + let args : SynType list = getTypeFromTuplePath args match args with | [] -> error(InternalError("empty tuple type", m)) @@ -4795,7 +4821,7 @@ and TcStaticConstantParameter (cenv: cenv) (env: TcEnv) tpenv kind (StripParenTy match idOpt with | Some id -> let item = Item.OtherName (Some id, ttype, None, Some container, id.idRange) - CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, env.AccessRights) + CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, env.AccessRights) | _ -> () match v with @@ -4815,7 +4841,7 @@ and TcStaticConstantParameter (cenv: cenv) (env: TcEnv) tpenv kind (StripParenTy | SynConst.Double n when typeEquiv g g.float_ty kind -> record(g.float_ty); box (n: double) | SynConst.Char n when typeEquiv g g.char_ty kind -> record(g.char_ty); box (n: char) | SynConst.String (s, _, _) - | SynConst.SourceIdentifier (_, s, _) when (not (isNull s)) && typeEquiv g g.string_ty kind -> record(g.string_ty); box (s: string) + | SynConst.SourceIdentifier (_, s, _) when typeEquiv g g.string_ty kind -> record(g.string_ty); box (s: string) | SynConst.Bool b when typeEquiv g g.bool_ty kind -> record(g.bool_ty); box (b: bool) | _ -> fail() v, tpenv @@ -4844,7 +4870,6 @@ and TcStaticConstantParameter (cenv: cenv) (env: TcEnv) tpenv kind (StripParenTy | Const.Single n -> record(g.float32_ty); box (n: single) | Const.Double n -> record(g.float_ty); box (n: double) | Const.Char n -> record(g.char_ty); box (n: char) - | Const.String null -> fail() | Const.String s -> record(g.string_ty); box (s: string) | Const.Bool b -> record(g.bool_ty); box (b: bool) | _ -> fail() @@ -4901,8 +4926,8 @@ and CrackStaticConstantArgs (cenv: cenv) env tpenv (staticParameters: Tainted if sp.PUntaint((fun sp -> sp.IsOptional), m) then match sp.PUntaint((fun sp -> sp.RawDefaultValue), m) with - | Null -> error (Error(FSComp.SR.etStaticParameterRequiresAValue (spName, containerName, containerName, spName), m)) - | NonNull v -> v + | null -> error (Error(FSComp.SR.etStaticParameterRequiresAValue (spName, containerName, containerName, spName), m)) + | v -> v else error (Error(FSComp.SR.etStaticParameterRequiresAValue (spName, containerName, containerName, spName), m)) | ps -> @@ -4968,7 +4993,7 @@ and TcProvidedTypeApp (cenv: cenv) env tpenv tcref args m = // We put the type name check after the 'isDirectReferenceToGenerated' check because we need the 'isDirectReferenceToGenerated' error to be shown for generated types checkTypeName() if hasNoArgs then - mkAppTy tcref [], tpenv + mkWoNullAppTy tcref [], tpenv else let ty = Import.ImportProvidedType cenv.amap m providedTypeAfterStaticArguments ty, tpenv @@ -5019,7 +5044,7 @@ and TcTypeApp (cenv: cenv) newOk checkConstraints occ env tpenv m tcref pathType List.iter2 (UnifyTypes cenv env m) tinst actualArgTys // Try to decode System.Tuple --> F# tuple types etc. - let ty = g.decompileType tcref actualArgTys + let ty = g.decompileType tcref actualArgTys g.knownWithoutNull ty, tpenv @@ -5034,7 +5059,7 @@ and TcTypeOrMeasureAndRecover kindOpt (cenv: cenv) newOk checkConstraints occ iw match kindOpt, newOk with | Some TyparKind.Measure, NoNewTypars -> TType_measure Measure.One | Some TyparKind.Measure, _ -> TType_measure (NewErrorMeasure ()) - | _, NoNewTypars -> g.obj_ty + | _, NoNewTypars -> g.obj_ty_ambivalent | _ -> NewErrorType () recoveryTy, tpenv @@ -5106,12 +5131,16 @@ and ConvSynPatToSynExpr synPat = /// Check a long identifier 'Case' or 'Case argsR' that has been resolved to an active pattern case and TcPatLongIdentActivePatternCase warnOnUpper (cenv: cenv) (env: TcEnv) vFlags patEnv ty (mLongId, item, apref, args, m) = let g = cenv.g - let (TcPatLinearEnv(tpenv, names, takenNames)) = patEnv let (APElemRef (apinfo, vref, idx, isStructRetTy)) = apref + let cenv = + match g.checkNullness,TryFindLocalizedFSharpStringAttribute g g.attrib_WarnOnWithoutNullArgumentAttribute vref.Attribs with + | true, (Some _ as warnMsg) -> {cenv with css.WarnWhenUsingWithoutNullOnAWithNullTarget = warnMsg} + | _ -> cenv + // Report information about the 'active recognizer' occurrence to IDE - CallNameResolutionSink cenv.tcSink (mLongId, env.NameEnv, item, emptyTyparInst, ItemOccurence.Pattern, env.eAccessRights) + CallNameResolutionSink cenv.tcSink (mLongId, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Pattern, env.eAccessRights) // TOTAL/PARTIAL ACTIVE PATTERNS let _, vExpr, _, _, tinst, _ = TcVal true cenv env tpenv vref None None m @@ -5119,7 +5148,7 @@ and TcPatLongIdentActivePatternCase warnOnUpper (cenv: cenv) (env: TcEnv) vFlags let vExprTy = vExpr.Type let activePatArgsAsSynPats, patArg = - // only cases which return unit or unresolved type (in AP definition) compatible with unit can omit output arg + // only cases which return unit or unresolved type (in AP definition) compatible with unit can omit output arg let canOmit retTy = let couldResolveToUnit ty = tryDestTyparTy g ty @@ -5142,9 +5171,11 @@ and TcPatLongIdentActivePatternCase warnOnUpper (cenv: cenv) (env: TcEnv) vFlags | TyparConstraint.IsDelegate _ | TyparConstraint.IsEnum _ | TyparConstraint.IsNonNullableStruct _ + | TyparConstraint.NotSupportsNull _ | TyparConstraint.IsUnmanaged _ | TyparConstraint.RequiresDefaultConstructor _ | TyparConstraint.SimpleChoice _ + | TyparConstraint.NotSupportsNull _ | TyparConstraint.SupportsNull _ -> false)) let caseRetTy = @@ -5166,7 +5197,7 @@ and TcPatLongIdentActivePatternCase warnOnUpper (cenv: cenv) (env: TcEnv) vFlags if i > paramCount then sb.ToString() elif i > cutoff then sb.Append("...").ToString() else loop (i + 1) (sb.Append(" e").Append i) - + loop 1 (Text.StringBuilder()) let caseName = apinfo.ActiveTags[idx] @@ -5191,14 +5222,14 @@ and TcPatLongIdentActivePatternCase warnOnUpper (cenv: cenv) (env: TcEnv) vFlags elif apinfo.IsTotal && apinfo.ActiveTags.Length = 1 && dtys.Length >= args.Length && not args.IsEmpty then List.frontAndBack args - // active pattern cases returning unit or unknown things (in AP definition) can omit output arg + // active pattern cases returning unit or unknown things (in AP definition) can omit output arg elif paramCount = args.Length then - // only cases which return unit or unresolved type (in AP definition) can omit output arg + // only cases which return unit or unresolved type (in AP definition) can omit output arg if canOmit retTy then args, SynPat.Const(SynConst.Unit, m) else showErrMsg 1 - + // active pattern in function param (e.g. let f (|P|_|) = ...) elif tryDestTyparTy g vExprTy |> ValueOption.exists (fun typar -> not typar.IsSolved) then List.frontAndBack args @@ -5279,6 +5310,7 @@ and TcExprFlex (cenv: cenv) flex compat (desiredTy: TType) (env: TcEnv) tpenv (s if flex then let argTy = NewInferenceType g + (destTyparTy g argTy).SetSupportsNullFlex(true) if compat then (destTyparTy g argTy).SetIsCompatFlex(true) @@ -5386,11 +5418,11 @@ and CheckForAdjacentListExpression (cenv: cenv) synExpr hpa isInfix delayed (arg let g = cenv.g // func (arg)[arg2] gives warning that .[ must be used. match delayed with - | DelayedApp (hpa2, isSugar2, _, arg2, _) :: _ when not isInfix && (hpa = ExprAtomicFlag.NonAtomic) && isAdjacentListExpr isSugar2 hpa2 (Some synExpr) arg2 -> + | DelayedApp (hpa2, isSugar2, _, arg2, _) :: _ when not isInfix && (hpa = ExprAtomicFlag.NonAtomic) && isAdjacentListExpr isSugar2 hpa2 (Some synExpr) arg2 -> let mWarning = unionRanges arg.Range arg2.Range - match arg with - | SynExpr.Paren _ -> + match arg with + | SynExpr.Paren _ -> if g.langVersion.SupportsFeature LanguageFeature.IndexerNotationWithoutDot then warning(Error(FSComp.SR.tcParenThenAdjacentListArgumentNeedsAdjustment(), mWarning)) elif not (g.langVersion.IsExplicitlySpecifiedAs50OrBefore()) then @@ -5403,7 +5435,7 @@ and CheckForAdjacentListExpression (cenv: cenv) synExpr hpa isInfix delayed (arg elif not (g.langVersion.IsExplicitlySpecifiedAs50OrBefore()) then informationalWarning(Error(FSComp.SR.tcListThenAdjacentListArgumentReserved(), mWarning)) - | _ -> + | _ -> if g.langVersion.SupportsFeature LanguageFeature.IndexerNotationWithoutDot then warning(Error(FSComp.SR.tcOtherThenAdjacentListArgumentNeedsAdjustment(), mWarning)) elif not (g.langVersion.IsExplicitlySpecifiedAs50OrBefore()) then @@ -5416,19 +5448,19 @@ and CheckForAdjacentListExpression (cenv: cenv) synExpr hpa isInfix delayed (arg /// method applications and other item-based syntax. and TcExprThen (cenv: cenv) overallTy env tpenv isArg synExpr delayed = let g = cenv.g - - let cachedExpression = + + let cachedExpression = env.eCachedImplicitYieldExpressions.FindAll synExpr.Range |> List.tryPick (fun (se, ty, e) -> if obj.ReferenceEquals(se, synExpr) then Some (ty, e) else None ) - + match cachedExpression with | Some (ty, expr) -> UnifyOverallType cenv env synExpr.Range overallTy ty expr, tpenv | _ -> - + match synExpr with @@ -5447,7 +5479,7 @@ and TcExprThen (cenv: cenv) overallTy env tpenv isArg synExpr delayed = // Check to see if pattern translation decided to use an alternative identifier. match altNameRefCellOpt with - | Some {contents = SynSimplePatAlternativeIdInfo.Decided altId} -> + | Some {contents = SynSimplePatAlternativeIdInfo.Decided altId} -> TcExprThen cenv overallTy env tpenv isArg (SynExpr.LongIdent (isOpt, SynLongIdent([altId], [], [None]), None, mLongId)) delayed | _ -> TcLongIdentThen cenv overallTy env tpenv longId delayed @@ -5455,7 +5487,7 @@ and TcExprThen (cenv: cenv) overallTy env tpenv isArg synExpr delayed = // f?x<-v | SynExpr.Set(SynExpr.Dynamic(e1, _, e2, _) , rhsExpr, m) -> TcExprThenSetDynamic cenv overallTy env tpenv isArg e1 e2 rhsExpr m delayed - + // f x // f(x) // hpa=true // f[x] // hpa=true @@ -5465,7 +5497,7 @@ and TcExprThen (cenv: cenv) overallTy env tpenv isArg synExpr delayed = | _ -> () TcNonControlFlowExpr env <| fun env -> - + CheckForAdjacentListExpression cenv synExpr hpa isInfix delayed arg TcExprThen cenv overallTy env tpenv false func ((DelayedApp (hpa, isInfix, Some func, arg, mFuncAndArg)) :: delayed) @@ -5531,9 +5563,9 @@ and TcExprThenSetDynamic (cenv: cenv) overallTy env tpenv isArg e1 e2 rhsExpr m and TcExprThenDynamic (cenv: cenv) overallTy env tpenv isArg e1 mQmark e2 delayed = let appExpr = - let argExpr = mkDynamicArgExpr e2 + let argExpr = mkDynamicArgExpr e2 mkSynInfix mQmark e1 "?" argExpr - + TcExprThen cenv overallTy env tpenv isArg appExpr delayed and TcExprsWithFlexes (cenv: cenv) env m tpenv flexes (argTys: TType list) (args: SynExpr list) = @@ -5565,7 +5597,7 @@ and TcExprUndelayedNoType (cenv: cenv) env tpenv synExpr = /// or '_ array') is already sufficiently pre-known, and the information in the overall type /// can be eagerly propagated into the actual type (UnifyOverallType), including pre-calculating /// any type-directed conversion. This must mean that types extracted when processing the expression are not -/// considered in determining any type-directed conversion. +/// considered in determining any type-directed conversion. /// /// Used for: /// - Array or List expressions (both computed and fixed-size), to propagate from the overall type into the array/list type @@ -5630,13 +5662,13 @@ and TcPossiblyPropagatingExprLeafThenConvert isPropagating (cenv: cenv) (overall processExpr overallTy.Commit /// Process a leaf construct where the processing of the construct is initially independent -/// of the overall type. Determine and apply additional type-directed conversions after the processing +/// of the overall type. Determine and apply additional type-directed conversions after the processing /// is complete, as the inferred type of the expression may enable a type-directed conversion. /// /// Used for: -/// - trait call +/// - trait call /// - LibraryOnlyUnionCaseFieldGet -/// - constants +/// - constants and TcNonPropagatingExprLeafThenConvert (cenv: cenv) (overallTy: OverallTy) (env: TcEnv) m processExpr = // Process the construct @@ -5659,11 +5691,11 @@ and TcAdjustExprForTypeDirectedConversions (cenv: cenv) (overallTy: OverallTy) a expr and TcNonControlFlowExpr (env: TcEnv) f = - if env.eIsControlFlow then + if env.eIsControlFlow then let envinner = { env with eIsControlFlow = false } let res, tpenv = f envinner let m = res.Range - + // If the range is associated with calls like `async.For` for computation expression syntax control-flow // desugaring then don't emit a debug point - the debug points are placed separately in CheckComputationExpressions.fs match m.NotedSourceConstruct with @@ -5732,13 +5764,13 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE CallExprHasTypeSink cenv.tcSink (m, env.NameEnv, overallTy.Commit, env.AccessRights) TcConstExpr cenv overallTy env m tpenv synConst | SynExpr.DotLambda (synExpr, m, trivia) -> - match env.NameEnv.eUnqualifiedItems |> Map.tryFind "_arg1" with + match env.NameEnv.eUnqualifiedItems |> Map.tryFind "_arg1" with // Compiler-generated _arg items can have more forms, the real underscore will be 1-character wide | Some (Item.Value(valRef)) when valRef.Range.StartColumn+1 = valRef.Range.EndColumn -> warning(Error(FSComp.SR.tcAmbiguousDiscardDotLambda(), trivia.UnderscoreRange)) | Some _ -> () | None -> () - + let unaryArg = mkSynId trivia.UnderscoreRange (cenv.synArgNameGenerator.New()) let svar = mkSynCompGenSimplePatVar unaryArg let pushedExpr = pushUnaryArg synExpr unaryArg @@ -5750,8 +5782,8 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE | SynExpr.Match (spMatch, synInputExpr, synClauses, _m, _trivia) -> TcExprMatch cenv overallTy env tpenv synInputExpr spMatch synClauses - | SynExpr.MatchLambda (isExnMatch, mArg, clauses, spMatch, m) -> - TcExprMatchLambda cenv overallTy env tpenv (isExnMatch, mArg, clauses, spMatch, m) + | SynExpr.MatchLambda (isExnMatch, mFunction, clauses, spMatch, m) -> + TcExprMatchLambda cenv overallTy env tpenv (isExnMatch, mFunction, clauses, spMatch, m) | SynExpr.Assert (x, m) -> TcNonControlFlowExpr env <| fun env -> @@ -5792,7 +5824,8 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE | SynExpr.Null m -> TcNonControlFlowExpr env <| fun env -> AddCxTypeUseSupportsNull env.DisplayEnv cenv.css m NoTrace overallTy.Commit - mkNull m overallTy.Commit, tpenv + let tyWithNull = addNullnessToTy KnownWithNull overallTy.Commit + mkNull m tyWithNull, tpenv | SynExpr.Lazy (synInnerExpr, m) -> TcNonControlFlowExpr env <| fun env -> @@ -5819,7 +5852,7 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE TcExprArrayOrList cenv overallTy env tpenv (isArray, args, m) | SynExpr.New (superInit, synObjTy, arg, mNewExpr) -> - let objTy, tpenv = TcType cenv NewTyparsOK CheckCxs ItemOccurence.Use WarnOnIWSAM.Yes env tpenv synObjTy + let objTy, tpenv = TcType cenv NewTyparsOK CheckCxs ItemOccurrence.Use WarnOnIWSAM.Yes env tpenv synObjTy TcNonControlFlowExpr env <| fun env -> TcPropagatingExprLeafThenConvert cenv overallTy objTy env (* true *) mNewExpr (fun () -> @@ -6003,17 +6036,18 @@ and TcExprMatch (cenv: cenv) overallTy env tpenv synInputExpr spMatch synClauses // <@ function x -> (x: int) @> // is // Lambda (_arg2, Let (x, _arg2, x)) -and TcExprMatchLambda (cenv: cenv) overallTy env tpenv (isExnMatch, mArg, clauses, spMatch, m) = +and TcExprMatchLambda (cenv: cenv) overallTy env tpenv (isExnMatch, mFunction, clauses, spMatch, m) = let domainTy, resultTy = UnifyFunctionType None cenv env.DisplayEnv m overallTy.Commit - let idv1, idve1 = mkCompGenLocal mArg (cenv.synArgNameGenerator.New()) domainTy + let idv1, idve1 = mkCompGenLocal mFunction (cenv.synArgNameGenerator.New()) domainTy + CallExprHasTypeSink cenv.tcSink (mFunction.StartRange, env.NameEnv, domainTy, env.AccessRights) let envinner = ExitFamilyRegion env let envinner = { envinner with eIsControlFlow = true } - let idv2, matchExpr, tpenv = TcAndPatternCompileMatchClauses m mArg (if isExnMatch then Throw else ThrowIncompleteMatchException) cenv None domainTy (MustConvertTo (false, resultTy)) envinner tpenv clauses + let idv2, matchExpr, tpenv = TcAndPatternCompileMatchClauses m mFunction (if isExnMatch then Throw else ThrowIncompleteMatchException) cenv None domainTy (MustConvertTo (false, resultTy)) envinner tpenv clauses let overallExpr = mkMultiLambda m [idv1] ((mkLet spMatch m idv2 idve1 matchExpr), resultTy) overallExpr, tpenv and TcExprTypeAnnotated (cenv: cenv) overallTy env tpenv (synBodyExpr, synType, m) = - let tgtTy, tpenv = TcTypeAndRecover cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv synType + let tgtTy, tpenv = TcTypeAndRecover cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv synType UnifyOverallType cenv env m overallTy tgtTy let bodyExpr, tpenv = TcExpr cenv (MustConvertTo (false, tgtTy)) env tpenv synBodyExpr let bodyExpr2 = TcAdjustExprForTypeDirectedConversions cenv overallTy tgtTy env m bodyExpr @@ -6023,7 +6057,7 @@ and TcExprTypeTest (cenv: cenv) overallTy env tpenv (synInnerExpr, tgtTy, m) = let g = cenv.g let innerExpr, srcTy, tpenv = TcExprOfUnknownType cenv env tpenv synInnerExpr UnifyTypes cenv env m overallTy.Commit g.bool_ty - let tgtTy, tpenv = TcType cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv tgtTy + let tgtTy, tpenv = TcType cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv tgtTy TcRuntimeTypeTest false true cenv env.DisplayEnv m tgtTy srcTy let expr = mkCallTypeTest g m tgtTy innerExpr expr, tpenv @@ -6033,7 +6067,7 @@ and TcExprUpcast (cenv: cenv) overallTy env tpenv (synExpr, synInnerExpr, m) = let tgtTy, tpenv = match synExpr with | SynExpr.Upcast (_, tgtTy, m) -> - let tgtTy, tpenv = TcType cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv tgtTy + let tgtTy, tpenv = TcType cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv tgtTy UnifyTypes cenv env m tgtTy overallTy.Commit tgtTy, tpenv | SynExpr.InferredUpcast _ -> @@ -6051,7 +6085,7 @@ and TcExprDowncast (cenv: cenv) overallTy env tpenv (synExpr, synInnerExpr, m) = let tgtTy, tpenv, isOperator = match synExpr with | SynExpr.Downcast (_, tgtTy, m) -> - let tgtTy, tpenv = TcType cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv tgtTy + let tgtTy, tpenv = TcType cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv tgtTy UnifyTypes cenv env m tgtTy overallTy.Commit tgtTy, tpenv, true | SynExpr.InferredDowncast _ -> overallTy.Commit, tpenv, false @@ -6106,7 +6140,7 @@ and TcExprArrayOrList (cenv: cenv) overallTy env tpenv (isArray, args, m) = let argTy = NewInferenceType g let actualTy = if isArray then mkArrayType g argTy else mkListTy g argTy - // Propagating type directed conversion, e.g. for + // Propagating type directed conversion, e.g. for // let x : seq = [ 1; 2 ] // Consider also the case where there is no relation but an op_Implicit is enabled from List<_> to C // let x : C = [ B(); B() ] @@ -6147,13 +6181,13 @@ and TcExprObjectExpr (cenv: cenv) overallTy env tpenv (synObjTy, argopt, binds, let mObjTy = synObjTy.Range - let objTy, tpenv = TcType cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv synObjTy + let objTy, tpenv = TcType cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv synObjTy // Work out the type of any interfaces to implement let extraImpls, tpenv = (tpenv, extraImpls) ||> List.mapFold (fun tpenv (SynInterfaceImpl(synIntfTy, _mWith, bindings, members, m)) -> let overrides = unionBindingAndMembers bindings members - let intfTy, tpenv = TcType cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv synIntfTy + let intfTy, tpenv = TcType cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv synIntfTy if not (isInterfaceTy g intfTy) then error(Error(FSComp.SR.tcExpectedInterfaceType(), m)) if isErasedType g intfTy then @@ -6179,7 +6213,7 @@ and TcExprWhileLoop (cenv: cenv) overallTy env tpenv (spWhile, synGuardExpr, syn let g = cenv.g UnifyTypes cenv env m overallTy.Commit g.unit_ty - let guardExpr, tpenv = + let guardExpr, tpenv = let env = { env with eIsControlFlow = false } TcExpr cenv (MustEqual g.bool_ty) env tpenv synGuardExpr @@ -6207,7 +6241,7 @@ and TcExprIntegerForLoop (cenv: cenv) overallTy env tpenv (spFor, spTo, id, star // notify name resolution sink about loop variable let item = Item.Value(mkLocalValRef idv) - CallNameResolutionSink cenv.tcSink (idv.Range, env.NameEnv, item, emptyTyparInst, ItemOccurence.Binding, env.AccessRights) + CallNameResolutionSink cenv.tcSink (idv.Range, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Binding, env.AccessRights) let bodyExpr, tpenv = TcStmt cenv envinner tpenv body mkFastForLoop g (spFor, spTo, m, idv, startExpr, dir, finishExpr, bodyExpr), tpenv @@ -6275,7 +6309,7 @@ and TcExprSequentialOrImplicitYield (cenv: cenv) overallTy env tpenv (sp, synExp match expr1 with | Expr.DebugPoint(_,e) -> e | _ -> expr1 - + env.eCachedImplicitYieldExpressions.Add(synExpr1.Range, (synExpr1, expr1Ty, cachedExpr)) try TcExpr cenv overallTy env tpenv otherExpr finally env.eCachedImplicitYieldExpressions.Remove synExpr1.Range @@ -6298,8 +6332,8 @@ and TcExprDotSet (cenv: cenv) overallTy env tpenv (synExpr1, synLongId, synExpr2 and TcExprDotNamedIndexedPropertySet (cenv: cenv) overallTy env tpenv (synExpr1, synLongId, synExpr2, expr3, mStmt) = let (SynLongIdent(longId, _, _)) = synLongId let mExprAndDotLookup = unionRanges synExpr1.Range (rangeOfLid longId) - TcExprThen cenv overallTy env tpenv false synExpr1 - [ DelayedDotLookup(longId, mExprAndDotLookup); + TcExprThen cenv overallTy env tpenv false synExpr1 + [ DelayedDotLookup(longId, mExprAndDotLookup); DelayedApp(ExprAtomicFlag.Atomic, false, None, synExpr2, mStmt) MakeDelayedSet(expr3, mStmt)] @@ -6308,7 +6342,7 @@ and TcExprLongIdentSet (cenv: cenv) overallTy env tpenv (synLongId, synExpr2, m) // Type.Items(synExpr1) <- synExpr2 and TcExprNamedIndexPropertySet (cenv: cenv) overallTy env tpenv (synLongId, synExpr1, synExpr2, mStmt) = - TcLongIdentThen cenv overallTy env tpenv synLongId + TcLongIdentThen cenv overallTy env tpenv synLongId [ DelayedApp(ExprAtomicFlag.Atomic, false, None, synExpr1, mStmt) MakeDelayedSet(synExpr2, mStmt) ] @@ -6360,10 +6394,10 @@ and TcExprILAssembly (cenv: cenv) overallTy env tpenv (ilInstrs, synTyArgs, synA let g = cenv.g let ilInstrs = (ilInstrs :?> ILInstr[]) let argTys = NewInferenceTypes g synArgs - let tyargs, tpenv = TcTypes cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv synTyArgs + let tyargs, tpenv = TcTypes cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv synTyArgs // No subsumption at uses of IL assembly code let args, tpenv = TcExprsNoFlexes cenv env m tpenv argTys synArgs - let retTys, tpenv = TcTypes cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv synRetTys + let retTys, tpenv = TcTypes cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv synRetTys let returnTy = match retTys with | [] -> g.unit_ty @@ -6372,29 +6406,6 @@ and TcExprILAssembly (cenv: cenv) overallTy env tpenv (ilInstrs, synTyArgs, synA UnifyTypes cenv env m overallTy.Commit returnTy mkAsmExpr (Array.toList ilInstrs, tyargs, args, retTys, m), tpenv -// Converts 'a..b' to a call to the '(..)' operator in FSharp.Core -// Converts 'a..b..c' to a call to the '(.. ..)' operator in FSharp.Core -// -// NOTE: we could eliminate these more efficiently in LowerComputedCollections.fs, since -// [| 1..4 |] -// becomes [| for i in (..) 1 4 do yield i |] -// instead of generating the array directly from the ranges -and RewriteRangeExpr synExpr = - match synExpr with - // a..b..c (parsed as (a..b)..c ) - | SynExpr.IndexRange(Some (SynExpr.IndexRange(Some synExpr1, _, Some synStepExpr, _, _, _)), _, Some synExpr2, _m1, _m2, mWhole) -> - let mWhole = mWhole.MakeSynthetic() - Some (mkSynTrifix mWhole ".. .." synExpr1 synStepExpr synExpr2) - // a..b - | SynExpr.IndexRange (Some synExpr1, mOperator, Some synExpr2, _m1, _m2, mWhole) -> - let otherExpr = - let mWhole = mWhole.MakeSynthetic() - match mkSynInfix mOperator synExpr1 ".." synExpr2 with - | SynExpr.App (a, b, c, d, _) -> SynExpr.App (a, b, c, d, mWhole) - | _ -> failwith "impossible" - Some otherExpr - | _ -> None - /// Check lambdas as a group, to catch duplicate names in patterns and TcIteratedLambdas (cenv: cenv) isFirst (env: TcEnv) overallTy takenNames tpenv e = let g = cenv.g @@ -6410,29 +6421,29 @@ and TcIteratedLambdas (cenv: cenv) isFirst (env: TcEnv) overallTy takenNames tpe let byrefs = vspecMap |> Map.map (fun _ v -> isByrefTy g v.Type, v) let envinner = if isMember then envinner else ExitFamilyRegion envinner let vspecs = vs |> List.map (fun nm -> NameMap.find nm vspecMap) - + // Match up the arginfos with the generated arguments and apply any information extracted from the attributes let envinner = - match envinner.eLambdaArgInfos with - | infos :: rest -> - if infos.Length = vspecs.Length then - (vspecs, infos) ||> List.iter2 (fun v argInfo -> + match envinner.eLambdaArgInfos with + | infos :: rest -> + if infos.Length = vspecs.Length then + (vspecs, infos) ||> List.iter2 (fun v argInfo -> v.SetArgReprInfoForDisplay (Some argInfo) let inlineIfLambda = HasFSharpAttribute g g.attrib_InlineIfLambdaAttribute argInfo.Attribs - if inlineIfLambda then + if inlineIfLambda then v.SetInlineIfLambda()) { envinner with eLambdaArgInfos = rest } | [] -> envinner - + let bodyExpr, tpenv = TcIteratedLambdas cenv false envinner (MustConvertTo (false, resultTy)) takenNames tpenv bodyExpr // See bug 5758: Non-monotonicity in inference: need to ensure that parameters are never inferred to have byref type, instead it is always declared byrefs |> Map.iter (fun _ (orig, v) -> if not orig && isByrefTy g v.Type then errorR(Error(FSComp.SR.tcParameterInferredByref v.DisplayName, v.Range))) - mkMultiLambda m vspecs (bodyExpr, resultTy), tpenv + mkMultiLambda m vspecs (bodyExpr, resultTy), tpenv - | e -> + | e -> let env = { env with eIsControlFlow = true } // Dive into the expression to check for syntax errors and suppress them if they show. conditionallySuppressErrorReporting (not isFirst && synExprContainsError e) (fun () -> @@ -6453,7 +6464,7 @@ and TcTyparExprThen (cenv: cenv) overallTy env tpenv synTypar m delayed = match rest with | [] -> delayed2 | _ -> DelayedDotLookup (rest, m2) :: delayed2 - CallNameResolutionSink cenv.tcSink (ident.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, env.AccessRights) + CallNameResolutionSink cenv.tcSink (ident.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, env.AccessRights) TcItemThen cenv overallTy env tpenv ([], item, mExprAndLongId, [], AfterResolution.DoNothing) (Some ty) delayed3 //TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed item mItem rest afterResolution | _ -> @@ -6475,14 +6486,14 @@ and (|IndexArgOptionalFromEnd|) (cenv: cenv) indexArg = and DecodeIndexArg (cenv: cenv) indexArg = match indexArg with | SynExpr.IndexRange (info1, _opm, info2, m1, m2, _) -> - let info1 = - match info1 with + let info1 = + match info1 with | Some (IndexArgOptionalFromEnd cenv (expr1, isFromEnd1, _)) -> Some (expr1, isFromEnd1) - | None -> None - let info2 = - match info2 with + | None -> None + let info2 = + match info2 with | Some (IndexArgOptionalFromEnd cenv (synExpr2, isFromEnd2, _)) -> Some (synExpr2, isFromEnd2) - | None -> None + | None -> None IndexArgRange (info1, info2, m1, m2) | IndexArgOptionalFromEnd cenv (expr, isFromEnd, m) -> IndexArgItem(expr, isFromEnd, m) @@ -6491,7 +6502,7 @@ and DecodeIndexArgs (cenv: cenv) indexArgs = indexArgs |> List.map (DecodeIndexArg cenv) and (|IndexerArgs|) expr = - match expr with + match expr with | SynExpr.Tuple (false, argExprs, _, _) -> argExprs | _ -> [expr] @@ -6507,15 +6518,15 @@ and ExpandIndexArgs (cenv: cenv) (synLeftExprOpt: SynExpr option) indexArgs = let rewriteReverseExpr (rank: int) (offset: SynExpr) (range: range) = let rankExpr = SynExpr.Const(SynConst.Int32 rank, range) let sliceArgs = SynExpr.Paren(SynExpr.Tuple(false, [rankExpr; offset], [], range), range, Some range, range) - match synLeftExprOpt with - | None -> error(Error(FSComp.SR.tcInvalidUseOfReverseIndex(), range)) - | Some xsId -> + match synLeftExprOpt with + | None -> error(Error(FSComp.SR.tcInvalidUseOfReverseIndex(), range)) + | Some xsId -> mkSynApp1 (mkSynDot range range xsId (SynIdent((mkSynId (range.MakeSynthetic()) "GetReverseIndex"), None))) sliceArgs range - let mkSynSomeExpr (m: range) x = + let mkSynSomeExpr (m: range) x = let m = m.MakeSynthetic() SynExpr.App (ExprAtomicFlag.NonAtomic, false, mkSynLidGet m FSharpLib.CorePath "Some", x, m) @@ -6531,12 +6542,12 @@ and ExpandIndexArgs (cenv: cenv) (synLeftExprOpt: SynExpr option) indexArgs = [ if fromEnd then rewriteReverseExpr pos expr range else expr ] | IndexArgRange(info1, info2, range1, range2) -> [ - match info1 with + match info1 with | Some (a1, isFromEnd1) -> yield mkSynSomeExpr range1 (if isFromEnd1 then rewriteReverseExpr pos a1 range1 else a1) - | None -> + | None -> yield mkSynNoneExpr range1 - match info2 with + match info2 with | Some (a2, isFromEnd2) -> yield mkSynSomeExpr range2 (if isFromEnd2 then rewriteReverseExpr pos a2 range2 else a2) | None -> @@ -6777,7 +6788,7 @@ and TcCtorCall isNaked cenv env tpenv (overallTy: OverallTy) objTy mObjTyOpt ite | Item.DelegateCtor ty, [arg] -> // Re-record the name resolution since we now know it's a constructor call match mObjTyOpt with - | Some mObjTy -> CallNameResolutionSink cenv.tcSink (mObjTy, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, env.AccessRights) + | Some mObjTy -> CallNameResolutionSink cenv.tcSink (mObjTy, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, env.AccessRights) | None -> () TcNewDelegateThen cenv (MustEqual objTy) env tpenv mItem mWholeCall ty arg ExprAtomicFlag.NonAtomic delayed @@ -6793,7 +6804,8 @@ and TcRecordConstruction (cenv: cenv) (overallTy: TType) isObjExpr env tpenv wit UnifyTypes cenv env m overallTy objTy // Types with implicit constructors can't use record or object syntax: all constructions must go through the implicit constructor - if tycon.MembersOfFSharpTyconByName |> NameMultiMap.existsInRange (fun v -> v.IsIncrClassConstructor) then + let supportsObjectExpressionWithoutOverrides = isObjExpr && g.langVersion.SupportsFeature(LanguageFeature.AllowObjectExpressionWithoutOverrides) + if not supportsObjectExpressionWithoutOverrides && tycon.MembersOfFSharpTyconByName |> NameMultiMap.existsInRange (fun v -> v.IsIncrClassConstructor) then errorR(Error(FSComp.SR.tcConstructorRequiresCall(tycon.DisplayName), m)) let fspecs = tycon.TrueInstanceFieldsAsList @@ -6973,7 +6985,7 @@ and FreshenObjExprAbstractSlot (cenv: cenv) (env: TcEnv) (implTy: TType) virtNam FreshenAbstractSlot g cenv.amap mBinding synTyparDecls absSlot // Work out the required type of the member - let bindingTy = mkFunTy cenv.g implTy (mkMethodTy cenv.g argTysFromAbsSlot retTyFromAbsSlot) + let bindingTy = mkFunTy cenv.g implTy (mkMethodTy cenv.g argTysFromAbsSlot retTyFromAbsSlot) Some(typarsFromAbsSlotAreRigid, typarsFromAbsSlot, bindingTy) @@ -6997,7 +7009,7 @@ and TcObjectExprBinding (cenv: cenv) (env: TcEnv) implTy tpenv (absSlotInfo, bin let logicalMethId = id let memberFlags = OverrideMemberFlags SynMemberKind.Member bindingRhs, logicalMethId, memberFlags - + | SynPat.Named (SynIdent(id,_), _, _, _), Some memberFlags -> CheckMemberFlags None NewSlotsOK OverridesOK memberFlags mBinding let bindingRhs = PushOnePatternToRhs cenv true (mkSynThisPatVar (ident (CompilerGeneratedName "this", id.idRange))) bindingRhs @@ -7135,12 +7147,15 @@ and CheckSuperType (cenv: cenv) ty m = and TcObjectExpr (cenv: cenv) env tpenv (objTy, realObjTy, argopt, binds, extraImpls, mObjTy, mNewExpr, mWholeExpr) = let g = cenv.g - match tryTcrefOfAppTy g objTy with | ValueNone -> error(Error(FSComp.SR.tcNewMustBeUsedWithNamedType(), mNewExpr)) | ValueSome tcref -> let isRecordTy = tcref.IsRecordTycon - if not isRecordTy && not (isInterfaceTy g objTy) && isSealedTy g objTy then errorR(Error(FSComp.SR.tcCannotCreateExtensionOfSealedType(), mNewExpr)) + let isInterfaceTy = isInterfaceTy g objTy + let isFSharpObjModelTy = isFSharpObjModelTy g objTy + let isOverallTyAbstract = HasFSharpAttribute g g.attrib_AbstractClassAttribute tcref.Attribs || isAbstractTycon tcref.Deref + + if not isRecordTy && not isInterfaceTy && isSealedTy g objTy then errorR(Error(FSComp.SR.tcCannotCreateExtensionOfSealedType(), mNewExpr)) CheckSuperType cenv objTy mObjTy @@ -7151,14 +7166,14 @@ and TcObjectExpr (cenv: cenv) env tpenv (objTy, realObjTy, argopt, binds, extraI let env = EnterFamilyRegion tcref env let ad = env.AccessRights - if // record construction ? + if // record construction ? e.g { A = 1; B = 2 } isRecordTy || - // object construction? - (isFSharpObjModelTy g objTy && not (isInterfaceTy g objTy) && argopt.IsNone) then + // object construction? e.g. new A() { ... } + (isFSharpObjModelTy && not isInterfaceTy && argopt.IsNone) then if argopt.IsSome then error(Error(FSComp.SR.tcNoArgumentsForRecordValue(), mWholeExpr)) if not (isNil extraImpls) then error(Error(FSComp.SR.tcNoInterfaceImplementationForConstructionExpression(), mNewExpr)) - if isFSharpObjModelTy g objTy && GetCtorShapeCounter env <> 1 then + if isFSharpObjModelTy && GetCtorShapeCounter env <> 1 then error(Error(FSComp.SR.tcObjectConstructionCanOnlyBeUsedInClassTypes(), mNewExpr)) let fldsList = binds |> List.map (fun b -> @@ -7168,8 +7183,9 @@ and TcObjectExpr (cenv: cenv) env tpenv (objTy, realObjTy, argopt, binds, extraI TcRecordConstruction cenv objTy true env tpenv None objTy fldsList mWholeExpr else + // object expression construction e.g. { new A() with ... } or { new IA with ... } let ctorCall, baseIdOpt, tpenv = - if isInterfaceTy g objTy then + if isInterfaceTy then match argopt with | None -> BuildObjCtorCall g mWholeExpr, None, tpenv @@ -7178,7 +7194,7 @@ and TcObjectExpr (cenv: cenv) env tpenv (objTy, realObjTy, argopt, binds, extraI else let item = ForceRaise (ResolveObjectConstructor cenv.nameResolver env.DisplayEnv mObjTy ad objTy) - if isFSharpObjModelTy g objTy && GetCtorShapeCounter env = 1 then + if isFSharpObjModelTy && GetCtorShapeCounter env = 1 then error(Error(FSComp.SR.tcObjectsMustBeInitializedWithObjectExpression(), mNewExpr)) match item, argopt with @@ -7205,19 +7221,18 @@ and TcObjectExpr (cenv: cenv) env tpenv (objTy, realObjTy, argopt, binds, extraI let overridesAndVirts, tpenv = ComputeObjectExprOverrides cenv env tpenv impls - // 2. check usage conditions - overridesAndVirts |> List.iter (fun (m, implTy, dispatchSlots, dispatchSlotsKeyed, availPriorOverrides, overrides) -> + // 2. check usage conditions + for ovd in overridesAndVirts do + let (m, implTy, dispatchSlots, dispatchSlotsKeyed, availPriorOverrides, overrides) = ovd let overrideSpecs = overrides |> List.map fst let hasStaticMembers = dispatchSlots |> List.exists (fun reqdSlot -> not reqdSlot.MethodInfo.IsInstance) - if hasStaticMembers then errorR(Error(FSComp.SR.chkStaticMembersOnObjectExpressions(), mObjTy)) DispatchSlotChecking.CheckOverridesAreAllUsedOnce (env.DisplayEnv, g, cenv.infoReader, true, implTy, dispatchSlotsKeyed, availPriorOverrides, overrideSpecs) if not hasStaticMembers then - DispatchSlotChecking.CheckDispatchSlotsAreImplemented (env.DisplayEnv, cenv.infoReader, m, env.NameEnv, cenv.tcSink, false, implTy, dispatchSlots, availPriorOverrides, overrideSpecs) |> ignore - ) + DispatchSlotChecking.CheckDispatchSlotsAreImplemented (env.DisplayEnv, cenv.infoReader, m, env.NameEnv, cenv.tcSink, isOverallTyAbstract, true, implTy, dispatchSlots, availPriorOverrides, overrideSpecs) |> ignore // 3. create the specs of overrides let allTypeImpls = @@ -7249,8 +7264,12 @@ and TcObjectExpr (cenv: cenv) env tpenv (objTy, realObjTy, argopt, binds, extraI let objtyR, overrides' = allTypeImpls.Head assert (typeEquiv g objTy objtyR) let extraImpls = allTypeImpls.Tail + let supportsObjectExpressionWithoutOverrides = g.langVersion.SupportsFeature(LanguageFeature.AllowObjectExpressionWithoutOverrides) + + if not supportsObjectExpressionWithoutOverrides && not isInterfaceTy && overrides'.IsEmpty && extraImpls.IsEmpty then + errorR (Error(FSComp.SR.tcInvalidObjectExpressionSyntaxForm (), mWholeExpr)) - // 7. Build the implementation + // 4. Build the implementation let expr = mkObjExpr(objtyR, baseValOpt, ctorCall, overrides', extraImpls, mWholeExpr) let expr = mkCoerceIfNeeded g realObjTy objtyR expr expr, tpenv @@ -7273,7 +7292,7 @@ and TcConstStringExpr cenv (overallTy: OverallTy) env m tpenv (s: string) litera | _ -> false let g = cenv.g - + match isFormat g overallTy.Commit, literalType with | true, LiteralArgumentType.StaticField -> @@ -7518,15 +7537,15 @@ and TcInterpolatedStringExpr cenv (overallTy: OverallTy) env m tpenv (parts: Syn let concatenableExprs = if canLower then concatenable [] fillExprs parts else [] match concatenableExprs with - | [p1; p2; p3; p4] -> mkStaticCall_String_Concat4 g m p1 p2 p3 p4, tpenv - | [p1; p2; p3] -> mkStaticCall_String_Concat3 g m p1 p2 p3, tpenv - | [p1; p2] -> mkStaticCall_String_Concat2 g m p1 p2, tpenv + | [p1; p2; p3; p4] -> TcPropagatingExprLeafThenConvert cenv overallTy g.string_ty env m (fun () -> mkStaticCall_String_Concat4 g m p1 p2 p3 p4, tpenv) + | [p1; p2; p3] -> TcPropagatingExprLeafThenConvert cenv overallTy g.string_ty env m (fun () -> mkStaticCall_String_Concat3 g m p1 p2 p3, tpenv) + | [p1; p2] -> TcPropagatingExprLeafThenConvert cenv overallTy g.string_ty env m (fun () -> mkStaticCall_String_Concat2 g m p1 p2, tpenv) | [p1] -> p1, tpenv | _ -> let fillExprsBoxed = (argTys, fillExprs) ||> List.map2 (mkCallBox g m) - let argsExpr = mkArray (g.obj_ty, fillExprsBoxed, m) + let argsExpr = mkArray (g.obj_ty_withNulls, fillExprsBoxed, m) let percentATysExpr = if percentATys.Length = 0 then mkNull m (mkArrayType g g.system_Type_ty) @@ -7553,7 +7572,7 @@ and TcInterpolatedStringExpr cenv (overallTy: OverallTy) env m tpenv (parts: Syn let fillExprsBoxed = (argTys, fillExprs) ||> List.map2 (mkCallBox g m) let dotnetFormatStringExpr = mkString g m dotnetFormatString - let argsExpr = mkArray (g.obj_ty, fillExprsBoxed, m) + let argsExpr = mkArray (g.obj_ty_withNulls, fillExprsBoxed, m) // FormattableString are *always* turned into FormattableStringFactory.Create calls, boxing each argument let createExpr, _ = BuildPossiblyConditionalMethodCall cenv env NeverMutates m false createFormattableStringMethod NormalValUse [] [dotnetFormatStringExpr; argsExpr] [] None @@ -7677,7 +7696,7 @@ and TcRecdExpr cenv overallTy env tpenv (inherits, withExprOpt, synRecdFields, m let _, fldId = fld match TryFindAnonRecdFieldOfType g overallTy fldId.idText with | Some item -> - CallNameResolutionSink cenv.tcSink (fldId.idRange, env.eNameResEnv, item, emptyTyparInst, ItemOccurence.UseInType, env.eAccessRights) + CallNameResolutionSink cenv.tcSink (fldId.idRange, env.eNameResEnv, item, emptyTyparInst, ItemOccurrence.UseInType, env.eAccessRights) | None -> () let firstPartRange = withStartEnd mWholeExpr.Start (mkPos mWholeExpr.StartLine (mWholeExpr.StartColumn + 1)) mWholeExpr // Use the left { in the expression @@ -7695,7 +7714,7 @@ and TcRecdExpr cenv overallTy env tpenv (inherits, withExprOpt, synRecdFields, m | None -> [] | Some(tinst, tcref, _, fldsList) -> - let gtyp = mkAppTy tcref tinst + let gtyp = mkWoNullAppTy tcref tinst UnifyTypes cenv env mWholeExpr overallTy gtyp [ for n, v in fldsList do @@ -7756,10 +7775,10 @@ and TcRecdExpr cenv overallTy env tpenv (inherits, withExprOpt, synRecdFields, m | None -> expr expr, tpenv -and CheckAnonRecdExprDuplicateFields (elems: Ident array) = - elems |> Array.iteri (fun i (uc1: Ident) -> - elems |> Array.iteri (fun j (uc2: Ident) -> - if j > i && uc1.idText = uc2.idText then +and CheckAnonRecdExprDuplicateFields (elems: Ident array) = + elems |> Array.iteri (fun i (uc1: Ident) -> + elems |> Array.iteri (fun j (uc2: Ident) -> + if j > i && uc1.idText = uc2.idText then errorR(Error (FSComp.SR.tcAnonRecdDuplicateFieldId(uc1.idText), uc1.idRange)))) // Check '{| .... |}' @@ -7769,7 +7788,7 @@ and TcAnonRecdExpr cenv (overallTy: TType) env tpenv (isStruct, optOrigSynExpr, TcNewAnonRecdExpr cenv overallTy env tpenv (isStruct, unsortedFieldIdsAndSynExprsGiven, mWholeExpr) | Some orig -> - // Ideally we should also check for duplicate field IDs in the TcCopyAndUpdateAnonRecdExpr case, but currently the logic is too complex to garante a proper error reporting + // Ideally we should also check for duplicate field IDs in the TcCopyAndUpdateAnonRecdExpr case, but currently the logic is too complex to guarantee a proper error reporting // So here we error instead errorR to avoid cascading internal errors unsortedFieldIdsAndSynExprsGiven |> List.countBy (fun (fId, _, _) -> textOfLid fId.LongIdent) @@ -7801,7 +7820,7 @@ and TcNewAnonRecdExpr cenv (overallTy: TType) env tpenv (isStruct, unsortedField sortedFieldExprs |> List.iteri (fun j (synLongIdent, _, _) -> let m = rangeOfLid synLongIdent.LongIdent let item = Item.AnonRecdField(anonInfo, sortedFieldTys, j, m) - CallNameResolutionSink cenv.tcSink (m, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, env.eAccessRights)) + CallNameResolutionSink cenv.tcSink (m, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, env.eAccessRights)) let unsortedFieldTys = sortedFieldTys @@ -7895,7 +7914,7 @@ and TcCopyAndUpdateAnonRecdExpr cenv (overallTy: TType) env tpenv (isStruct, (or match expr with | Choice1Of2 _ -> let item = Item.AnonRecdField(anonInfo, sortedFieldTysAll, j, fieldId.idRange) - CallNameResolutionSink cenv.tcSink (fieldId.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, env.eAccessRights) + CallNameResolutionSink cenv.tcSink (fieldId.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, env.eAccessRights) | Choice2Of2 _ -> ()) let unsortedFieldTysAll = @@ -8061,7 +8080,7 @@ and TcForEachExpr cenv overallTy env tpenv (seqExprOnly, isFromSource, synPat, s let valsDefinedByMatching = ListSet.remove valEq elemVar vspecs CompilePatternForMatch cenv env synEnumExpr.Range pat.Range false IgnoreWithWarning (elemVar, [], None) - [MatchClause(pat, None, TTarget(valsDefinedByMatching, bodyExpr, None), mIn)] + [MatchClause(pat, None, TTarget(valsDefinedByMatching, bodyExpr, None), mIn)] enumElemTy overallTy.Commit @@ -8093,7 +8112,7 @@ and TcForEachExpr cenv overallTy env tpenv (seqExprOnly, isFromSource, synPat, s WhileLoopForCompiledForEachExprMarker, guardExpr, mkInvisibleLet mIn elemVar currentExpr bodyExpr, mFor), - BuildDisposableCleanup cenv env mWholeExpr enumeratorVar, + BuildDisposableCleanup cenv env mWholeExpr enumeratorVar, mFor, g.unit_ty, DebugPointAtTry.No, DebugPointAtFinally.No))) let overallExpr = overallExprFixup overallExpr @@ -8124,7 +8143,7 @@ and TcQuotationExpr cenv overallTy env tpenv (_oper, raw, ast, isFromQueryExpres // We serialize the quoted expression to bytes in IlxGen after type inference etc. is complete. expr, tpenv -/// When checking sequence of function applications, +/// When checking sequence of function applications, /// type applications and dot-notation projections, first extract known /// type information from the applications. /// @@ -8189,6 +8208,10 @@ and Propagate (cenv: cenv) (overallTy: OverallTy) (env: TcEnv) tpenv (expr: Appl // seq { ... } | SynExpr.ComputationExpr _ -> () + // async { } + // seq { } + | SynExpr.Record (None, None, [], _) when g.langVersion.SupportsFeature LanguageFeature.EmptyBodiedComputationExpressions -> () + // expr[idx] // expr[idx1, idx2] // expr[idx1..] @@ -8201,7 +8224,7 @@ and Propagate (cenv: cenv) (overallTy: OverallTy) (env: TcEnv) tpenv (expr: Appl () else // This is the error path. The error we give depends on what's enabled. - // + // // First, 'delayed' is about to be dropped on the floor, do rudimentary checking to get name resolutions in its body RecordNameAndTypeResolutionsDelayed cenv env tpenv delayed let vName = @@ -8213,15 +8236,15 @@ and Propagate (cenv: cenv) (overallTy: OverallTy) (env: TcEnv) tpenv (expr: Appl if g.langVersion.IsExplicitlySpecifiedAs50OrBefore() then error (NotAFunctionButIndexer(denv, overallTy.Commit, vName, mExpr, mArg, false)) match vName with - | Some nm -> + | Some nm -> error(Error(FSComp.SR.tcNotAFunctionButIndexerNamedIndexingNotYetEnabled(nm, nm), mExprAndArg)) - | _ -> + | _ -> error(Error(FSComp.SR.tcNotAFunctionButIndexerIndexingNotYetEnabled(), mExprAndArg)) else match vName with - | Some nm -> + | Some nm -> error(Error(FSComp.SR.tcNotAnIndexerNamedIndexingNotYetEnabled(nm), mExprAndArg)) - | _ -> + | _ -> error(Error(FSComp.SR.tcNotAnIndexerIndexingNotYetEnabled(), mExprAndArg)) else if IsIndexerType g cenv.amap expr.Type then @@ -8333,7 +8356,7 @@ and TcNameOfExpr (cenv: cenv) env tpenv (synArg: SynExpr) = // Nameof resolution resolves to a symbol and in general we make that the same symbol as // would resolve if the long ident was used as an expression at the given location. // - // So we first check if the first identifier resolves as an expression, if so commit and and resolve. + // So we first check if the first identifier resolves as an expression, if so commit and resolve. // // However we don't commit for a type names - nameof allows 'naked' type names and thus all type name // resolutions are checked separately in the next step. @@ -8362,11 +8385,11 @@ and TcNameOfExpr (cenv: cenv) env tpenv (synArg: SynExpr) = let resolvedToTypeName = if (match delayed with [DelayedTypeApp _] | [] -> true | _ -> false) then let (TypeNameResolutionInfo(_, staticArgsInfo)) = GetLongIdentTypeNameInfo delayed - match ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurence.UseInAttribute OpenQualified env.eNameResEnv ad longId staticArgsInfo PermitDirectReferenceToGeneratedType.No with + match ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurrence.UseInAttribute OpenQualified env.eNameResEnv ad longId staticArgsInfo PermitDirectReferenceToGeneratedType.No with | Result (tinstEnclosing, tcref, inst) when IsEntityAccessible cenv.amap m ad tcref -> match delayed with | [DelayedTypeApp (tyargs, _, mExprAndTypeArgs)] -> - TcTypeApp cenv NewTyparsOK CheckCxs ItemOccurence.UseInType env tpenv mExprAndTypeArgs tcref tinstEnclosing tyargs inst |> ignore + TcTypeApp cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType env tpenv mExprAndTypeArgs tcref tinstEnclosing tyargs inst |> ignore | _ -> () true // resolved to a type name, done with checks | _ -> @@ -8389,7 +8412,7 @@ and TcNameOfExpr (cenv: cenv) env tpenv (synArg: SynExpr) = if resolvedToModuleOrNamespaceName then result else ForceRaise nameResolutionResult |> ignore - // If that didn't give aan exception then raise a generic error + // If that didn't give an exception then raise a generic error error (Error(FSComp.SR.expressionHasNoName(), m)) // expr allowed, even with qualifications @@ -8407,7 +8430,7 @@ and TcNameOfExpr (cenv: cenv) env tpenv (synArg: SynExpr) = // expr : type" allowed with no subsequent qualifications | SynExpr.Typed (synBodyExpr, synType, _) when delayed.IsEmpty && overallTyOpt.IsNone -> - let tgtTy, _tpenv = TcTypeAndRecover cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv synType + let tgtTy, _tpenv = TcTypeAndRecover cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv synType check (Some (MustEqual tgtTy)) resultOpt synBodyExpr delayed | _ -> @@ -8425,7 +8448,7 @@ and TcNameOfExprResult (cenv: cenv) (lastIdent: Ident) m = // TcApplicationThen: Typecheck "expr x" + projections //------------------------------------------------------------------------- -// leftExpr[idx] gives a warning +// leftExpr[idx] gives a warning and isAdjacentListExpr isSugar atomicFlag (synLeftExprOpt: SynExpr option) (synArg: SynExpr) = not isSugar && if atomicFlag = ExprAtomicFlag.Atomic then @@ -8435,11 +8458,11 @@ and isAdjacentListExpr isSugar atomicFlag (synLeftExprOpt: SynExpr option) (synA | _ -> false else match synLeftExprOpt with - | Some synLeftExpr -> + | Some synLeftExpr -> match synArg with | SynExpr.ArrayOrList (false, _, _) | SynExpr.ArrayOrListComputed (false, _, _) -> - synLeftExpr.Range.IsAdjacentTo synArg.Range + synLeftExpr.Range.IsAdjacentTo synArg.Range | _ -> false | _ -> false @@ -8453,12 +8476,22 @@ and TcApplicationThen (cenv: cenv) (overallTy: OverallTy) env tpenv mExprAndArg let mArg = synArg.Range let mLeftExpr = leftExpr.Range + /// Treat an application of a value to an empty record expression + /// as a computation expression with a single unit expression. + /// Insert a (), i.e., such that builder { } ≡ builder { () }. + /// This transformation is only valid for language + /// versions that support this feature. + let (|EmptyFieldListAsUnit|_|) recordFields = + match recordFields with + | [] when g.langVersion.SupportsFeature LanguageFeature.EmptyBodiedComputationExpressions -> Some (EmptyFieldListAsUnit (SynExpr.Const (SynConst.Unit, range0))) + | _ -> None + // If the type of 'synArg' unifies as a function type, then this is a function application, otherwise // it is an error or a computation expression or indexer or delegate invoke match UnifyFunctionTypeUndoIfFailed cenv denv mLeftExpr exprTy with | ValueSome (domainTy, resultTy) -> - // atomicLeftExpr[idx] unifying as application gives a warning + // atomicLeftExpr[idx] unifying as application gives a warning if not isSugar then checkHighPrecedenceFunctionApplicationToList g [synArg] atomicFlag mExprAndArg @@ -8474,53 +8507,67 @@ and TcApplicationThen (cenv: cenv) (overallTy: OverallTy) env tpenv mExprAndArg // though users don't realise that. let synArg = match synArg with - | SynExpr.ComputationExpr (false, comp, m) when + // seq { comp } + // seq { } + | SynExpr.ComputationExpr (false, comp, m) + | SynExpr.Record (None, None, EmptyFieldListAsUnit comp, m) when (match leftExpr with | ApplicableExpr(expr=Expr.Op(TOp.Coerce, _, [SeqExpr g], _)) -> true | _ -> false) -> SynExpr.ComputationExpr (true, comp, m) + | _ -> synArg - let arg, tpenv = + let (arg, tpenv), cenv = // treat left and right of '||' and '&&' as control flow, so for example // f expr1 && g expr2 // will have debug points on "f expr1" and "g expr2" - let env = + let env,cenv = match leftExpr with | ApplicableExpr(expr=Expr.Val (vref, _, _)) | ApplicableExpr(expr=Expr.App (Expr.Val (vref, _, _), _, _, [_], _)) when valRefEq g vref g.and_vref - || valRefEq g vref g.and2_vref + || valRefEq g vref g.and2_vref || valRefEq g vref g.or_vref || valRefEq g vref g.or2_vref -> - { env with eIsControlFlow = true } - | _ -> env - - TcExprFlex2 cenv domainTy env false tpenv synArg + { env with eIsControlFlow = true },cenv + | ApplicableExpr(expr=Expr.Val (valRef=vref)) + | ApplicableExpr(expr=Expr.App (funcExpr=Expr.Val (valRef=vref))) -> + match TryFindLocalizedFSharpStringAttribute g g.attrib_WarnOnWithoutNullArgumentAttribute vref.Attribs with + | Some _ as msg -> env,{ cenv with css.WarnWhenUsingWithoutNullOnAWithNullTarget = msg} + | None when cenv.css.WarnWhenUsingWithoutNullOnAWithNullTarget <> None -> + env, { cenv with css.WarnWhenUsingWithoutNullOnAWithNullTarget = None} + | None -> env,cenv + | _ -> env,cenv + + TcExprFlex2 cenv domainTy env false tpenv synArg, cenv let exprAndArg, resultTy = buildApp cenv leftExpr resultTy arg mExprAndArg TcDelayed cenv overallTy env tpenv mExprAndArg exprAndArg resultTy atomicFlag delayed | ValueNone -> - // Type-directed invokables + // Type-directed invocables match synArg with // leftExpr[idx] // leftExpr[idx] <- expr2 - | SynExpr.ArrayOrListComputed(false, IndexerArgs indexArgs, m) - when - isAdjacentListExpr isSugar atomicFlag synLeftExprOpt synArg && + | SynExpr.ArrayOrListComputed(false, IndexerArgs indexArgs, m) + when + isAdjacentListExpr isSugar atomicFlag synLeftExprOpt synArg && g.langVersion.SupportsFeature LanguageFeature.IndexerNotationWithoutDot -> let expandedIndexArgs = ExpandIndexArgs cenv synLeftExprOpt indexArgs - let setInfo, delayed = - match delayed with + let setInfo, delayed = + match delayed with | DelayedSet(expr3, _) :: rest -> Some (expr3, unionRanges leftExpr.Range synArg.Range), rest | _ -> None, delayed TcIndexingThen cenv env overallTy mExprAndArg m tpenv setInfo synLeftExprOpt leftExpr.Expr exprTy expandedIndexArgs indexArgs delayed - // Perhaps 'leftExpr' is a computation expression builder, and 'arg' is '{ ... }' - | SynExpr.ComputationExpr (false, comp, _m) -> + // Perhaps 'leftExpr' is a computation expression builder, and 'arg' is '{ ... }' or '{ }': + // leftExpr { comp } + // leftExpr { } + | SynExpr.ComputationExpr (false, comp, _m) + | SynExpr.Record (None, None, EmptyFieldListAsUnit comp, _m) -> let bodyOfCompExpr, tpenv = cenv.TcComputationExpression cenv env overallTy tpenv (mLeftExpr, leftExpr.Expr, exprTy, comp) TcDelayed cenv overallTy env tpenv mExprAndArg (MakeApplicableExprNoFlex cenv bodyOfCompExpr) (tyOfExpr g bodyOfCompExpr) ExprAtomicFlag.NonAtomic delayed @@ -8634,14 +8681,14 @@ and TcUnionCaseOrExnCaseOrActivePatternResultItemThen (cenv: cenv) overallTy env let ucaseAppTy = NewInferenceType g let mkConstrApp, argTys, argNames = match item with - | Item.ActivePatternResult(apinfo, _apOverallTy, n, _) -> + | Item.ActivePatternResult(apinfo, _apOverallTy, n, m) -> let aparity = apinfo.ActiveTags.Length match aparity with | 0 | 1 -> let mkConstrApp _mArgs = function [arg] -> arg | _ -> error(InternalError("ApplyUnionCaseOrExn", mItem)) mkConstrApp, [ucaseAppTy], [ for s, m in apinfo.ActiveTagsWithRanges -> mkSynId m s ] | _ -> - let ucref = mkChoiceCaseRef g mItem aparity n + let ucref = mkChoiceCaseRef g m aparity n let _, _, tinst, _ = FreshenTyconRef2 g mItem ucref.TyconRef let ucinfo = UnionCaseInfo (tinst, ucref) ApplyUnionCaseOrExnTypes mItem cenv env ucaseAppTy (Item.UnionCase(ucinfo, false)) @@ -8706,7 +8753,7 @@ and TcUnionCaseOrExnCaseOrActivePatternResultItemThen (cenv: cenv) overallTy env | Item.UnionCase (uci, _) -> Item.UnionCaseField (uci, i) | Item.ExnCase tref -> Item.RecdField (RecdFieldInfo ([], RecdFieldRef (tref, id.idText))) | _ -> failwithf "Expecting union case or exception item, got: %O" item - CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, argItem, emptyTyparInst, ItemOccurence.Use, ad) + CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, argItem, emptyTyparInst, ItemOccurrence.Use, ad) else error(Error(FSComp.SR.tcUnionCaseFieldCannotBeUsedMoreThanOnce(id.idText), id.idRange)) currentIndex <- SEEN_NAMED_ARGUMENT | None -> @@ -8779,7 +8826,7 @@ and TcUnionCaseOrExnCaseOrActivePatternResultItemThen (cenv: cenv) overallTy env let argName = argNamesIfFeatureEnabled |> List.tryItem i |> Option.map (fun x -> x.idText) |> Option.defaultWith (fun () -> "arg" + string i) mkCompGenLocal mItem argName ty) |> List.unzip - + let constrApp = mkConstrApp mItem args let lam = mkMultiLambda mItem vs (constrApp, tyOfExpr g constrApp) lam) @@ -8796,20 +8843,20 @@ and TcTypeItemThen (cenv: cenv) overallTy env nm ty tpenv mItem tinstEnclosing d // If Item.Types is returned then the ty will be of the form TType_app(tcref, genericTyargs) where tyargs // is a fresh instantiation for tcref. TcNestedTypeApplication will chop off precisely #genericTyargs args // and replace them by 'tyargs' - let ty, tpenv = TcNestedTypeApplication cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv mExprAndTypeArgs ty tinstEnclosing tyargs + let ty, tpenv = TcNestedTypeApplication cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv mExprAndTypeArgs ty tinstEnclosing tyargs // Report information about the whole expression including type arguments to VS let item = Item.Types(nm, [ty]) - CallNameResolutionSink cenv.tcSink (mExprAndTypeArgs, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, env.eAccessRights) + CallNameResolutionSink cenv.tcSink (mExprAndTypeArgs, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, env.eAccessRights) let typeNameResInfo = GetLongIdentTypeNameInfo otherDelayed let item, mItem, rest, afterResolution = ResolveExprDotLongIdentAndComputeRange cenv.tcSink cenv.nameResolver (unionRanges mExprAndTypeArgs mLongId) ad env.eNameResEnv ty longId typeNameResInfo IgnoreOverrides true None TcItemThen cenv overallTy env tpenv ((argsOfAppTy g ty), item, mItem, rest, afterResolution) None otherDelayed | DelayedTypeApp(tyargs, _mTypeArgs, mExprAndTypeArgs) :: _delayed' -> // A case where we have an incomplete name e.g. 'Foo.' - we still want to report it to VS! - let ty, _ = TcNestedTypeApplication cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv mExprAndTypeArgs ty tinstEnclosing tyargs + let ty, _ = TcNestedTypeApplication cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv mExprAndTypeArgs ty tinstEnclosing tyargs let item = Item.Types(nm, [ty]) - CallNameResolutionSink cenv.tcSink (mExprAndTypeArgs, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, env.eAccessRights) + CallNameResolutionSink cenv.tcSink (mExprAndTypeArgs, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, env.eAccessRights) // Same error as in the following case error(Error(FSComp.SR.tcInvalidUseOfTypeName(), mItem)) @@ -8839,7 +8886,7 @@ and TcMethodItemThen (cenv: cenv) overallTy env item methodName minfos tpenv mIt // Replace the resolution including the static parameters, plus the extra information about the original method info let item = Item.MethodGroup(methodName, [minfoAfterStaticArguments], Some minfos[0]) - CallNameResolutionSinkReplacing cenv.tcSink (mItem, env.NameEnv, item, [], ItemOccurence.Use, env.eAccessRights) + CallNameResolutionSinkReplacing cenv.tcSink (mItem, env.NameEnv, item, [], ItemOccurrence.Use, env.eAccessRights) match otherDelayed with | DelayedApp(atomicFlag, _, _, arg, mExprAndArg) :: otherDelayed -> @@ -8850,12 +8897,12 @@ and TcMethodItemThen (cenv: cenv) overallTy env item methodName minfos tpenv mIt | None -> #endif - let tyargs, tpenv = TcTypesOrMeasures None cenv NewTyparsOK CheckCxs ItemOccurence.UseInType env tpenv tys mTypeArgs + let tyargs, tpenv = TcTypesOrMeasures None cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType env tpenv tys mTypeArgs // FUTURE: can we do better than emptyTyparInst here, in order to display instantiations // of type variables in the quick info provided in the IDE? But note we haven't yet even checked if the // number of type arguments is correct... - CallNameResolutionSink cenv.tcSink (mExprAndTypeArgs, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, env.eAccessRights) + CallNameResolutionSink cenv.tcSink (mExprAndTypeArgs, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, env.eAccessRights) match otherDelayed with | DelayedApp(atomicFlag, _, _, arg, mExprAndArg) :: otherDelayed -> @@ -8887,7 +8934,7 @@ and TcCtorItemThen (cenv: cenv) overallTy env item nm minfos tinstEnclosing tpen | DelayedTypeApp(tyargs, _mTypeArgs, mExprAndTypeArgs) :: DelayedApp(_, _, _, arg, mExprAndArg) :: otherDelayed -> - let objTyAfterTyArgs, tpenv = TcNestedTypeApplication cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv mExprAndTypeArgs objTy tinstEnclosing tyargs + let objTyAfterTyArgs, tpenv = TcNestedTypeApplication cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv mExprAndTypeArgs objTy tinstEnclosing tyargs CallExprHasTypeSink cenv.tcSink (mExprAndArg, env.NameEnv, objTyAfterTyArgs, env.eAccessRights) let itemAfterTyArgs, minfosAfterTyArgs = #if !NO_TYPEPROVIDERS @@ -8908,11 +8955,11 @@ and TcCtorItemThen (cenv: cenv) overallTy env item nm minfos tinstEnclosing tpen | DelayedTypeApp(tyargs, _mTypeArgs, mExprAndTypeArgs) :: otherDelayed -> - let objTy, tpenv = TcNestedTypeApplication cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv mExprAndTypeArgs objTy tinstEnclosing tyargs + let objTy, tpenv = TcNestedTypeApplication cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv mExprAndTypeArgs objTy tinstEnclosing tyargs // A case where we have an incomplete name e.g. 'Foo.' - we still want to report it to VS! let resolvedItem = Item.Types(nm, [objTy]) - CallNameResolutionSink cenv.tcSink (mExprAndTypeArgs, env.NameEnv, resolvedItem, emptyTyparInst, ItemOccurence.Use, env.eAccessRights) + CallNameResolutionSink cenv.tcSink (mExprAndTypeArgs, env.NameEnv, resolvedItem, emptyTyparInst, ItemOccurrence.Use, env.eAccessRights) minfos |> List.iter (fun minfo -> UnifyTypes cenv env mExprAndTypeArgs minfo.ApparentEnclosingType objTy) TcCtorCall true cenv env tpenv overallTy objTy (Some mExprAndTypeArgs) item false [] mExprAndTypeArgs otherDelayed (Some afterResolution) @@ -8966,7 +9013,7 @@ and TcTraitItemThen (cenv: cenv) overallTy env objOpt traitInfo tpenv mItem dela applicableExpr, exprTy | _ -> let vs, ves = argTys |> List.mapi (fun i ty -> mkCompGenLocal mItem ("arg" + string i) ty) |> List.unzip - // Account for a unit mismtach in logical v. compiled arguments + // Account for a unit mismatch in logical v. compiled arguments let compiledArgExprs = match argTys, traitInfo.GetCompiledArgumentTypes() with | [_], [] -> [] @@ -8985,7 +9032,7 @@ and TcTraitItemThen (cenv: cenv) overallTy env objOpt traitInfo tpenv mItem dela // Check and apply the arguments let resExpr, tpenv = TcDelayed cenv overallTy env tpenv mItem applicableExpr exprTy ExprAtomicFlag.NonAtomic delayed - // Aply the wrapper to pre-evaluate the object if any + // Apply the wrapper to pre-evaluate the object if any wrapper resExpr, tpenv and TcImplicitOpItemThen (cenv: cenv) overallTy env id sln tpenv mItem delayed = @@ -9119,11 +9166,11 @@ and TcDelegateCtorItemThen cenv overallTy env ty tinstEnclosing tpenv mItem dela | DelayedApp (atomicFlag, _, _, arg, mItemAndArg) :: otherDelayed -> TcNewDelegateThen cenv overallTy env tpenv mItem mItemAndArg ty arg atomicFlag otherDelayed | DelayedTypeApp(tyargs, _mTypeArgs, mItemAndTypeArgs) :: DelayedApp (atomicFlag, _, _, arg, mItemAndArg) :: otherDelayed -> - let ty, tpenv = TcNestedTypeApplication cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv mItemAndTypeArgs ty tinstEnclosing tyargs + let ty, tpenv = TcNestedTypeApplication cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv mItemAndTypeArgs ty tinstEnclosing tyargs // Report information about the whole expression including type arguments to VS let item = Item.DelegateCtor ty - CallNameResolutionSink cenv.tcSink (mItemAndTypeArgs, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, env.eAccessRights) + CallNameResolutionSink cenv.tcSink (mItemAndTypeArgs, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, env.eAccessRights) TcNewDelegateThen cenv overallTy env tpenv mItem mItemAndArg ty arg atomicFlag otherDelayed | _ -> error(Error(FSComp.SR.tcInvalidUseOfDelegate(), mItem)) @@ -9177,7 +9224,7 @@ and TcValueItemThen cenv overallTy env vref tpenv mItem afterResolution delayed | _ -> error (Error(FSComp.SR.expressionHasNoName(), mExprAndTypeArgs)) | _ -> - let checkTys tpenv kinds = TcTypesOrMeasures (Some kinds) cenv NewTyparsOK CheckCxs ItemOccurence.UseInType env tpenv tys mItem + let checkTys tpenv kinds = TcTypesOrMeasures (Some kinds) cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType env tpenv tys mItem let _, vExpr, isSpecial, _, _, tpenv = TcVal true cenv env tpenv vref (Some (NormalValUse, checkTys)) (Some afterResolution) mItem let vexpFlex = (if isSpecial then MakeApplicableExprNoFlex cenv vExpr else MakeApplicableExprWithFlex cenv env vExpr) @@ -9201,7 +9248,7 @@ and TcValueItemThen cenv overallTy env vref tpenv mItem afterResolution delayed and TcPropertyItemThen cenv overallTy env nm pinfos tpenv mItem afterResolution staticTyOpt delayed = let g = cenv.g let ad = env.eAccessRights - + if isNil pinfos then error (InternalError ("Unexpected error: empty property list", mItem)) @@ -9214,7 +9261,7 @@ and TcPropertyItemThen cenv overallTy env nm pinfos tpenv mItem afterResolution GetMemberApplicationArgs delayed cenv env tpenv else ExprAtomicFlag.Atomic, None, [mkSynUnit mItem], delayed, tpenv - + if not pinfo.IsStatic then error (Error (FSComp.SR.tcPropertyIsNotStatic nm, mItem)) @@ -9347,7 +9394,7 @@ and TcMemberTyArgsOpt cenv env tpenv tyArgsOpt = match tyArgsOpt with | None -> None, tpenv | Some (tyargs, mTypeArgs) -> - let tyargsChecked, tpenv = TcTypesOrMeasures None cenv NewTyparsOK CheckCxs ItemOccurence.UseInType env tpenv tyargs mTypeArgs + let tyargsChecked, tpenv = TcTypesOrMeasures None cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType env tpenv tyargs mTypeArgs Some tyargsChecked, tpenv and GetMemberApplicationArgs delayed cenv env tpenv = @@ -9361,15 +9408,18 @@ and TcLookupThen cenv overallTy env tpenv mObjExpr objExpr objExprTy longId dela let objArgs = [objExpr] - // 'base' calls use a different resolution strategy when finding methods. let findFlag = - let baseCall = IsBaseCall objArgs - (if baseCall then PreferOverrides else IgnoreOverrides) + // 'base' calls use a different resolution strategy when finding methods + // nullness checks need the overrides, since those can change nullable semantics (e.g. ToString from BCL) + if (g.checkNullness && g.langFeatureNullness) || IsBaseCall objArgs then + PreferOverrides + else + IgnoreOverrides // Canonicalize inference problem prior to '.' lookup on variable types if isTyparTy g objExprTy then CanonicalizePartialInferenceProblem cenv.css env.DisplayEnv mExprAndLongId (freeInTypeLeftToRight g false objExprTy) - + let maybeAppliedArgExpr = DelayedItem.maybeAppliedArgForPreferExtensionOverProperty delayed let item, mItem, rest, afterResolution = ResolveExprDotLongIdentAndComputeRange cenv.tcSink cenv.nameResolver mExprAndLongId ad env.NameEnv objExprTy longId TypeNameResolutionInfo.Default findFlag false maybeAppliedArgExpr TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed item mItem rest afterResolution @@ -9398,7 +9448,7 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed | Some minfoAfterStaticArguments -> // Replace the resolution including the static parameters, plus the extra information about the original method info let item = Item.MethodGroup(methodName, [minfoAfterStaticArguments], Some minfos[0]) - CallNameResolutionSinkReplacing cenv.tcSink (mExprAndItem, env.NameEnv, item, [], ItemOccurence.Use, env.eAccessRights) + CallNameResolutionSinkReplacing cenv.tcSink (mExprAndItem, env.NameEnv, item, [], ItemOccurrence.Use, env.eAccessRights) TcMethodApplicationThen cenv env overallTy None tpenv None objArgs mExprAndItem mItem methodName ad mutates false [(minfoAfterStaticArguments, None)] afterResolution NormalValUse args atomicFlag None delayed | None -> @@ -9513,7 +9563,7 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed TcTraitItemThen cenv overallTy env (Some objExpr) traitInfo tpenv mItem delayed | Item.DelegateCtor _ -> error (Error (FSComp.SR.tcConstructorsCannotBeFirstClassValues(), mItem)) - + | Item.UnionCase(info, _) -> let clashingNames = info.Tycon.MembersOfFSharpTyconSorted |> List.tryFind(fun mem -> mem.DisplayNameCore = info.DisplayNameCore) match clashingNames with @@ -9555,13 +9605,14 @@ and TcEventItemThen (cenv: cenv) overallTy env tpenv mItem mExprAndItem objDetai | None, false -> error (Error (FSComp.SR.tcEventIsNotStatic nm, mItem)) | _ -> () - let delTy = einfo.GetDelegateType(cenv.amap, mItem) + // The F# wrappers around events are null safe (impl is in FSharp.Core). Therefore, from an F# perspective, the type of the delegate can be considered Not Null. + let delTy = einfo.GetDelegateType(cenv.amap, mItem) |> replaceNullnessOfTy KnownWithoutNull let (SigOfFunctionForDelegate(delInvokeMeth, delArgTys, _, _)) = GetSigOfFunctionForDelegate cenv.infoReader delTy mItem ad let objArgs = Option.toList (Option.map fst objDetails) MethInfoChecks g cenv.amap true None objArgs env.eAccessRights mItem delInvokeMeth - + CheckILEventAttributes g einfo.DeclaringTyconRef (einfo.GetCustomAttrs()) mItem |> CommitOperationResult - + // This checks for and drops the 'object' sender let argsTy = ArgsTypeOfEventInfo cenv.infoReader mItem ad einfo if not (slotSigHasVoidReturnTy (delInvokeMeth.GetSlotSig(cenv.amap, mItem))) then errorR (nonStandardEventError einfo.EventName mItem) @@ -9584,7 +9635,7 @@ and TcEventItemThen (cenv: cenv) overallTy env tpenv mItem mExprAndItem objDetai (let dv, de = mkCompGenLocal mItem "eventDelegate" delTy let callExpr, _ = BuildPossiblyConditionalMethodCall cenv env PossiblyMutates mItem false einfo.RemoveMethod NormalValUse [] objVars [de] None mkLambda mItem dv (callExpr, g.unit_ty)) - (let fvty = mkFunTy g g.obj_ty (mkFunTy g argsTy g.unit_ty) + (let fvty = mkFunTy g g.obj_ty_withNulls (mkFunTy g argsTy g.unit_ty) let fv, fe = mkCompGenLocal mItem "callback" fvty let createExpr = BuildNewDelegateExpr (Some einfo, g, cenv.amap, delTy, delInvokeMeth, delArgTys, fe, fvty, mItem) mkLambda mItem fv (createExpr, delTy))) @@ -9651,22 +9702,36 @@ and TcMethodApplicationThen PropagateThenTcDelayed cenv overallTy env tpenv mWholeExpr (MakeApplicableExprNoFlex cenv expr) exprTy atomicFlag delayed /// Infer initial type information at the callsite from the syntax of an argument, prior to overload resolution. -and GetNewInferenceTypeForMethodArg (cenv: cenv) env tpenv x = +and GetNewInferenceTypeForMethodArg (cenv: cenv) x = let g = cenv.g - match x with - | SynExprParen(a, _, _, _) -> - GetNewInferenceTypeForMethodArg cenv env tpenv a - | SynExpr.AddressOf (true, a, _, m) -> - mkByrefTyWithInference g (GetNewInferenceTypeForMethodArg cenv env tpenv a) (NewByRefKindInferenceType g m) - | SynExpr.Lambda (body = a) - | SynExpr.DotLambda (expr = a) -> - mkFunTy g (NewInferenceType g) (GetNewInferenceTypeForMethodArg cenv env tpenv a) - | SynExpr.Quote (_, raw, a, _, _) -> - if raw then mkRawQuotedExprTy g - else mkQuotedExprTy g (GetNewInferenceTypeForMethodArg cenv env tpenv a) - | _ -> NewInferenceType g + let rec loopExpr expr cont : struct (_ * _) = + match expr with + | SynExprParen (a, _, _, _) -> + loopExpr a cont + | SynExpr.AddressOf (true, a, _, m) -> + loopExpr a (cont << fun struct (depth, ty) -> depth + 1, mkByrefTyWithInference g ty (NewByRefKindInferenceType g m)) + | SynExpr.Lambda (body = a) + | SynExpr.DotLambda (expr = a) -> + loopExpr a (cont << fun struct (depth, ty) -> depth + 1, mkFunTy g (NewInferenceType g) ty) + | SynExpr.MatchLambda (matchClauses = SynMatchClause (resultExpr = a) :: clauses) -> + let loopClause a = loopExpr a (cont << fun struct (depth, ty) -> depth + 1, mkFunTy g (NewInferenceType g) ty) + + // Look at all branches, keeping the one + // that gives us the most syntactic information. + (loopClause a, clauses) + ||> List.fold (fun ((maxClauseDepth, _) as acc) (SynMatchClause (resultExpr = a)) -> + match loopClause a with + | clauseDepth, ty when clauseDepth > maxClauseDepth -> clauseDepth, ty + | _ -> acc) + | SynExpr.Quote (_, raw, a, _, _) -> + if raw then cont (0, mkRawQuotedExprTy g) + else loopExpr a (cont << fun struct (depth, ty) -> depth + 1, mkQuotedExprTy g ty) + | _ -> cont (0, NewInferenceType g) + + let struct (_depth, ty) = loopExpr x id + ty and CalledMethHasSingleArgumentGroupOfThisLength n (calledMeth: MethInfo) = match calledMeth.NumArgs with @@ -9701,7 +9766,7 @@ and UnifyMatchingSimpleArgumentTypes (cenv: cenv) (env: TcEnv) exprTy (calledMet and TcMethodApplication_SplitSynArguments (cenv: cenv) (env: TcEnv) - tpenv + _tpenv isProp (candidates: MethInfo list) (exprTy: OverallTy) @@ -9729,7 +9794,7 @@ and TcMethodApplication_SplitSynArguments else unnamedCurriedCallerArgs, namedCurriedCallerArgs - let MakeUnnamedCallerArgInfo x = (x, GetNewInferenceTypeForMethodArg cenv env tpenv x, x.Range) + let MakeUnnamedCallerArgInfo x = (x, GetNewInferenceTypeForMethodArg cenv x, x.Range) let singleMethodCurriedArgs = match candidates with @@ -9768,7 +9833,7 @@ and TcMethodApplication_SplitSynArguments | _ -> let unnamedCurriedCallerArgs = unnamedCurriedCallerArgs |> List.mapSquared MakeUnnamedCallerArgInfo let namedCurriedCallerArgs = namedCurriedCallerArgs |> List.mapSquared (fun (isOpt, nm, x) -> - let ty = GetNewInferenceTypeForMethodArg cenv env tpenv x + let ty = GetNewInferenceTypeForMethodArg cenv x // #435263: compiler crash with .net optional parameters and F# optional syntax // named optional arguments should always have option type // STRUCT OPTIONS: if we allow struct options as optional arguments then we should relax this and rely @@ -9823,7 +9888,7 @@ and TcMethodApplication_UniqueOverloadInference // "type directed" rule for first-class uses of ambiguous methods. // By context we know a type for the input argument. If it's a tuple - // this gives us the a potential number of arguments expected. Indeed even if it's a variable + // this gives us the potential number of arguments expected. Indeed even if it's a variable // type we assume the number of arguments is just "1". | None, _ -> @@ -9880,7 +9945,7 @@ and TcMethodApplication_CheckArguments callerObjArgTys ad mMethExpr - mItem + mItem tpenv = let g = cenv.g @@ -9921,7 +9986,7 @@ and TcMethodApplication_CheckArguments |> List.mapiSquared (fun i j ty -> let argName = curriedArgNamesIfFeatureEnabled |> List.tryItem i |> Option.bind (List.tryItem j) |> Option.flatten |> Option.defaultWith (fun () -> "arg" + string i + string j) mkCompGenLocal mMethExpr argName ty) - + let unnamedCurriedCallerArgs = lambdaVarsAndExprs |> List.mapSquared (fun (_, e) -> CallerArg(tyOfExpr g e, e.Range, false, e)) let namedCurriedCallerArgs = lambdaVarsAndExprs |> List.map (fun _ -> []) let lambdaVars = List.mapSquared fst lambdaVarsAndExprs @@ -9940,7 +10005,7 @@ and TcMethodApplication_CheckArguments match ExamineMethodForLambdaPropagation g mMethExpr meth ad with | Some (unnamedInfo, namedInfo) -> let calledObjArgTys = meth.CalledObjArgTys mMethExpr - if (calledObjArgTys, callerObjArgTys) ||> Seq.forall2 (fun calledTy callerTy -> + if (calledObjArgTys, callerObjArgTys) ||> Seq.forall2 (fun calledTy callerTy -> let noEagerConstraintApplication = MethInfoHasAttribute g mMethExpr g.attrib_NoEagerConstraintApplicationAttribute meth.Method // The logic associated with NoEagerConstraintApplicationAttribute is part of the @@ -9970,7 +10035,7 @@ and TcAdhocChecksOnLibraryMethods (cenv: cenv) (env: TcEnv) isInstance (finalCal if (isInstance && finalCalledMethInfo.IsInstance && - typeEquiv g finalCalledMethInfo.ApparentEnclosingType g.obj_ty && + typeEquiv g finalCalledMethInfo.ApparentEnclosingType g.obj_ty_ambivalent && (finalCalledMethInfo.LogicalName = "GetHashCode" || finalCalledMethInfo.LogicalName = "Equals")) then for objArg in objArgs do @@ -10095,7 +10160,7 @@ and TcMethodApplication let overriding = match unrefinedItem with - | Item.MethodGroup(_, overridenMeths, _) -> overridenMeths |> List.map (fun minfo -> minfo, None) + | Item.MethodGroup(_, overriddenMeths, _) -> overriddenMeths |> List.map (fun minfo -> minfo, None) | Item.Property(info = pinfos) -> if result.Method.LogicalName.StartsWithOrdinal("set_") then SettersOfPropInfos pinfos @@ -10166,7 +10231,7 @@ and TcMethodApplication | None -> id.idRange let container = ArgumentContainer.Method finalCalledMethInfo let item = Item.OtherName (idOpt, assignedArg.CalledArg.CalledArgumentType, None, Some container, m) - CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, ad)) + CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, ad)) /// STEP 6. Build the call expression, then adjust for byref-returns, out-parameters-as-tuples, post-hoc property assignments, methods-as-first-class-value, @@ -10307,7 +10372,7 @@ and TcSetterArgExpr (cenv: cenv) env denv objExpr ad assignedSetter calledFromCo // Record the resolution for the Language Service let item = Item.SetterArg (id, defnItem) - CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, ad) + CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, ad) argExprPrebinder, action, m @@ -10389,9 +10454,9 @@ and TcMethodArg cenv env (lambdaPropagationInfo, tpenv) (lambdaPropagationInfoFo yield info | CalledArgMatchesType (adjustedCalledArgTy, noEagerConstraintApplication) -> // If matching, we can solve 'tp1 --> tp2' but we can't transfer extra - // constraints from tp1 to tp2. + // constraints from tp1 to tp2. // - // The 'task' feature requires this fix to SRTP resolution. + // The 'task' feature requires this fix to SRTP resolution. let extraRigidTps = if noEagerConstraintApplication then Zset.ofList typarOrder (freeInTypeLeftToRight g true callerArgTy) else emptyFreeTypars if AddCxTypeMustSubsumeTypeMatchingOnlyUndoIfFailed env.DisplayEnv cenv.css mArg extraRigidTps adjustedCalledArgTy callerArgTy then yield info |] @@ -10543,10 +10608,13 @@ and TcMatchPattern cenv inputTy env tpenv (synPat: SynPat) (synWhenExprOpt: SynE and TcMatchClauses cenv inputTy (resultTy: OverallTy) env tpenv clauses = let mutable first = true let isFirst() = if first then first <- false; true else false - List.mapFold (fun clause -> TcMatchClause cenv inputTy resultTy env (isFirst()) clause) tpenv clauses + let resultList,(tpEnv,_input) = + List.mapFold (fun (unscopedTyParEnv,inputTy) -> TcMatchClause cenv inputTy resultTy env (isFirst()) unscopedTyParEnv) (tpenv,inputTy) clauses + resultList,tpEnv and TcMatchClause cenv inputTy (resultTy: OverallTy) env isFirst tpenv synMatchClause = let (SynMatchClause(synPat, synWhenExprOpt, synResultExpr, patm, spTgt, _)) = synMatchClause + let pat, whenExprOpt, vspecs, envinner, tpenv = TcMatchPattern cenv inputTy env tpenv synPat synWhenExprOpt let resultEnv = @@ -10561,8 +10629,37 @@ and TcMatchClause cenv inputTy (resultTy: OverallTy) env isFirst tpenv synMatchC let resultExpr, tpenv = TcExprThatCanBeCtorBody cenv resultTy resultEnv tpenv synResultExpr let target = TTarget(vspecs, resultExpr, None) - - MatchClause(pat, whenExprOpt, target, patm), tpenv + + let inputTypeForNextPatterns= + let removeNull t = + let stripped = stripTyEqns cenv.g t + replaceNullnessOfTy KnownWithoutNull stripped + let rec isWild (p:Pattern) = + match p with + | TPat_wild _ -> true + | TPat_as (p,_,_) -> isWild p + | TPat_disjs(patterns,_) -> patterns |> List.exists isWild + | TPat_conjs(patterns,_) -> patterns |> List.forall isWild + | TPat_tuple (_,pats,_,_) -> pats |> List.forall isWild + | _ -> false + + let rec eliminateNull (ty:TType) (p:Pattern) = + match p with + | TPat_null _ -> removeNull ty + | TPat_as (p,_,_) -> eliminateNull ty p + | TPat_disjs(patterns,_) -> (ty,patterns) ||> List.fold eliminateNull + | TPat_tuple (_,pats,_,_) -> + match stripTyparEqns ty with + // In a tuple of size N, if 1 elem is matched for null and N-1 are wild => subsequent clauses can strip nullness + | TType_tuple(ti,tys) when tys.Length = pats.Length && (pats |> List.count (isWild >> not)) = 1 -> + TType_tuple(ti, List.map2 eliminateNull tys pats) + | _ -> ty + | _ -> ty + match whenExprOpt with + | None -> eliminateNull inputTy pat + | _ -> inputTy + + MatchClause(pat, whenExprOpt, target, patm), (tpenv,inputTypeForNextPatterns) and TcStaticOptimizationConstraint cenv env tpenv c = let g = cenv.g @@ -10571,7 +10668,7 @@ and TcStaticOptimizationConstraint cenv env tpenv c = | SynStaticOptimizationConstraint.WhenTyparTyconEqualsTycon(tp, ty, m) -> if not g.compilingFSharpCore then errorR(Error(FSComp.SR.tcStaticOptimizationConditionalsOnlyForFSharpLibrary(), m)) - let tyR, tpenv = TcType cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv ty + let tyR, tpenv = TcType cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv ty let tpR, tpenv = TcTypar cenv env NewTyparsOK tpenv tp TTyconEqualsTycon(mkTyparTy tpR, tyR), tpenv | SynStaticOptimizationConstraint.WhenTyparIsStruct(tp, m) -> @@ -10599,22 +10696,22 @@ and TcAndBuildFixedExpr (cenv: cenv) env (overallPatTy, fixedExpr, overallExprTy | [[]], retTy when isByrefTy g retTy && mInfo.IsInstance -> true | _ -> false ) - + match getPinnableReferenceMInfo with | Some mInfo -> checkLanguageFeatureAndRecover g.langVersion LanguageFeature.ExtendedFixedBindings mBinding - + let mInst = FreshenMethInfo mBinding mInfo let pinnableReference, actualRetTy = BuildPossiblyConditionalMethodCall cenv env NeverMutates mBinding false mInfo NormalValUse mInst [ fixedExpr ] [] None - + let elemTy = destByrefTy g actualRetTy UnifyTypes cenv env mBinding (mkNativePtrTy g elemTy) overallPatTy - + // For value types: // let ptr: nativeptr = // let pinned x = &(expr: 'a).GetPinnableReference() // (nativeint) x - + // For reference types: // let ptr: nativeptr = // if isNull expr then @@ -10622,12 +10719,12 @@ and TcAndBuildFixedExpr (cenv: cenv) env (overallPatTy, fixedExpr, overallExprTy // else // let pinned x = &(expr: 'a).GetPinnableReference() // (nativeint) x - + let pinnedBinding = mkCompGenLetIn mBinding "pinnedByref" actualRetTy pinnableReference (fun (v, ve) -> v.SetIsFixed() mkConvToNativeInt g ve mBinding) - + if isStructTy g overallExprTy then Some pinnedBinding else @@ -10652,7 +10749,7 @@ and TcAndBuildFixedExpr (cenv: cenv) env (overallPatTy, fixedExpr, overallExprTy | TOp.RefAddrGet _, _, _ -> true | _ -> false | _ -> false - + if not okByRef then errorR (languageFeatureError g.langVersion LanguageFeature.ExtendedFixedBindings mBinding) @@ -10668,7 +10765,7 @@ and TcAndBuildFixedExpr (cenv: cenv) env (overallPatTy, fixedExpr, overallExprTy tryBuildGetPinnableReferenceCall () else None - + match getPinnableRefCall with | Some expr -> expr | None -> @@ -10732,8 +10829,9 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt let envinner = AddDeclaredTypars NoCheckForDuplicateTypars (enclosingDeclaredTypars@declaredTypars) env match bind with - | NormalizedBinding(vis, kind, isInline, isMutable, attrs, xmlDoc, _, valSynData, pat, NormalizedBindingRhs(spatsL, rtyOpt, rhsExpr), mBinding, debugPoint) -> + | NormalizedBinding(vis, kind, isInline, isMutable, attrs, xmlDoc, _, valSynData, pat, NormalizedBindingRhs(spatsL, rtyOpt, rhsExpr), _, debugPoint) -> let (SynValData(memberFlags = memberFlagsOpt)) = valSynData + let mBinding = pat.Range let isClassLetBinding = match declKind, kind with @@ -10763,6 +10861,14 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt let isFixed, rhsExpr, overallPatTy, overallExprTy = match rhsExpr with | SynExpr.Fixed (e, _) -> true, e, NewInferenceType g, overallTy + // { new Foo() } is parsed as a SynExpr.ComputationExpr.(See pars.fsy `objExpr` rule). + // If a SynExpr.ComputationExpr body consists of a single SynExpr.New, and it's not the argument of a computation expression builder type. + // Then we should treat it as a SynExpr.ObjExpr and make it consistent with the other object expressions. e.g. + // { new Foo } -> SynExpr.ObjExpr + // { new Foo() } -> SynExpr.ObjExpr + // { New Foo with ... } -> SynExpr.ObjExpr + | SynExpr.ComputationExpr(false, SynExpr.New(_, targetType, expr, m), _) -> + false, SynExpr.ObjExpr(targetType, Some(expr, None), None, [], [], [], m, rhsExpr.Range), overallTy, overallTy | e -> false, e, overallTy, overallTy // Check the attributes of the binding, parameters or return value @@ -10770,9 +10876,11 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt // For all but attributes positioned at the return value, disallow implicitly // targeting the return value. let tgtEx = if isRet then enum 0 else AttributeTargets.ReturnValue - let attrs, _ = TcAttributesMaybeFailEx false cenv envinner tgt tgtEx attrs + let attrs, _ = TcAttributesMaybeFailEx TcCanFail.ReportAllErrors cenv envinner tgt tgtEx attrs + let attrs: Attrib list = attrs if attrTgt = enum 0 && not (isNil attrs) then - errorR(Error(FSComp.SR.tcAttributesAreNotPermittedOnLetBindings(), mBinding)) + for attr in attrs do + errorR(Error(FSComp.SR.tcAttributesAreNotPermittedOnLetBindings(), attr.Range)) attrs // Rotate [] from binding to return value @@ -10799,10 +10907,10 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt SynValData(valMf, SynValInfo(args, SynArgInfo({Attributes=rotRetSynAttrs; Range=mHead} :: attrs, opt, retId)), valId) retAttribs, valAttribs, valSynData - let isVolatile = HasFSharpAttribute g g.attrib_VolatileFieldAttribute valAttribs + let isVolatile = HasFSharpAttribute g g.attrib_VolatileFieldAttribute valAttribs let inlineFlag = ComputeInlineFlag memberFlagsOpt isInline isMutable g valAttribs mBinding - let argAttribs = + let argAttribs = spatsL |> List.map (SynInfo.InferSynArgInfoFromSimplePats >> List.map (SynInfo.AttribsOfArgData >> TcAttrs AttributeTargets.Parameter false)) // Assert the return type of an active pattern. A [] attribute may be used on a partial active pattern. @@ -10814,16 +10922,16 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt // always be used for empty branches of if/then/else and others let isZeroMethod = match declKind, pat with - | ModuleOrMemberBinding, SynPat.Named(SynIdent(id,_), _, _, _) when id.idText = "Zero" -> + | ModuleOrMemberBinding, SynPat.Named(SynIdent(id,_), _, _, _) when id.idText = "Zero" -> match memberFlagsOpt with | Some memberFlags -> match memberFlags.MemberKind with | SynMemberKind.Member -> true | _ -> false - | _ -> false + | _ -> false | _ -> false - if HasFSharpAttribute g g.attrib_DefaultValueAttribute valAttribs && not isZeroMethod then + if HasFSharpAttribute g g.attrib_DefaultValueAttribute valAttribs && not isZeroMethod then errorR(Error(FSComp.SR.tcDefaultValueAttributeRequiresVal(), mBinding)) let isThreadStatic = isThreadOrContextStatic g valAttribs @@ -10892,12 +11000,16 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt let envinner = match apinfoOpt with | Some (apinfo, apOverallTy, m) -> - if Option.isSome memberFlagsOpt || (not apinfo.IsTotal && apinfo.ActiveTags.Length > 1) then - error(Error(FSComp.SR.tcInvalidActivePatternName(), mBinding)) + let isMultiCasePartialAP = memberFlagsOpt.IsNone && not apinfo.IsTotal && apinfo.ActiveTags.Length > 1 + if isMultiCasePartialAP then + errorR(Error(FSComp.SR.tcPartialActivePattern(), m)) + + if Option.isSome memberFlagsOpt && not spatsL.IsEmpty then + errorR(Error(FSComp.SR.tcInvalidActivePatternName(apinfo.LogicalName), m)) apinfo.ActiveTagsWithRanges |> List.iteri (fun i (_tag, tagRange) -> let item = Item.ActivePatternResult(apinfo, apOverallTy, i, tagRange) - CallNameResolutionSink cenv.tcSink (tagRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Binding, env.AccessRights)) + CallNameResolutionSink cenv.tcSink (tagRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Binding, env.AccessRights)) { envinner with eNameResEnv = AddActivePatternResultTagsToNameEnv apinfo envinner.eNameResEnv apOverallTy m } | None -> @@ -10923,7 +11035,7 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt // The right-hand-side is control flow (has an implicit debug point) in any situation where we // haven't extended the debug point to include the 'let', that is, there is a debug point noted - // at the binding. + // at the binding. // // This includes // let _ = expr @@ -10931,7 +11043,7 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt // which are transformed to sequential expressions in TcLetBinding // let rhsIsControlFlow = - match pat with + match pat with | SynPat.Wild _ | SynPat.Const (SynConst.Unit, _) | SynPat.Paren (SynPat.Const (SynConst.Unit, _), _) -> true @@ -10939,7 +11051,7 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt match debugPoint with | DebugPointAtBinding.Yes _ -> false | _ -> true - + let envinner = { envinner with eLambdaArgInfos = argInfos; eIsControlFlow = rhsIsControlFlow } if isCtor then TcExprThatIsCtorBody (safeThisValOpt, safeInitInfo) cenv (MustEqual overallExprTy) envinner tpenv rhsExpr @@ -10954,18 +11066,18 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt else rhsExprChecked match apinfoOpt with - | Some (apinfo, apOverallTy, _) -> + | Some (apinfo, apOverallTy, m) -> let activePatResTys = NewInferenceTypes g apinfo.ActiveTags let _, apReturnTy = stripFunTy g apOverallTy let apRetTy = - if apinfo.IsTotal then + if apinfo.IsTotal then if isStructRetTy then errorR(Error(FSComp.SR.tcInvalidStructReturn(), mBinding)) ActivePatternReturnKind.RefTypeWrapper else if isStructRetTy || isValueOptionTy cenv.g apReturnTy then ActivePatternReturnKind.StructTypeWrapper elif isBoolTy cenv.g apReturnTy then ActivePatternReturnKind.Boolean else ActivePatternReturnKind.RefTypeWrapper - + match apRetTy with | ActivePatternReturnKind.Boolean -> checkLanguageFeatureError g.langVersion LanguageFeature.BooleanReturningAndReturnTypeDirectedPartialActivePattern mBinding @@ -10975,7 +11087,7 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt checkLanguageFeatureError g.langVersion LanguageFeature.StructActivePattern mBinding | ActivePatternReturnKind.RefTypeWrapper -> () - UnifyTypes cenv env mBinding (apinfo.ResultType g rhsExpr.Range activePatResTys apRetTy) apReturnTy + UnifyTypes cenv env mBinding (apinfo.ResultType g m activePatResTys apRetTy) apReturnTy | None -> if isStructRetTy then @@ -10993,9 +11105,13 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt errorR(Error(FSComp.SR.tcLiteralCannotBeInline(), mBinding)) if not (isNil declaredTypars) then errorR(Error(FSComp.SR.tcLiteralCannotHaveGenericParameters(), mBinding)) - - if g.langVersion.SupportsFeature(LanguageFeature.EnforceAttributeTargets) && memberFlagsOpt.IsNone && not attrs.IsEmpty then - TcAttributeTargetsOnLetBindings cenv env attrs overallPatTy overallExprTy (not declaredTypars.IsEmpty) isClassLetBinding + + let supportEnforceAttributeTargets = + (g.langVersion.SupportsFeature(LanguageFeature.EnforceAttributeTargets) && memberFlagsOpt.IsNone && not attrs.IsEmpty) + && not isVolatile // // VolatileFieldAttribute has a special treatment(specific error FS823) + + if supportEnforceAttributeTargets then + TcAttributeTargetsOnLetBindings { cenv with tcSink = TcResultsSink.NoSink } env attrs overallPatTy overallExprTy (not declaredTypars.IsEmpty) isClassLetBinding CheckedBindingInfo(inlineFlag, valAttribs, xmlDoc, tcPatPhase2, explicitTyparInfo, nameToPrelimValSchemeMap, rhsExprChecked, argAndRetAttribs, overallPatTy, mBinding, debugPoint, isCompGen, literalValue, isFixed), tpenv @@ -11022,7 +11138,7 @@ and TcAttributeTargetsOnLetBindings (cenv: cenv) env attrs overallPatTy overallE else AttributeTargets.ReturnValue ||| AttributeTargets.Field ||| AttributeTargets.Property - TcAttributes cenv env attrTgt attrs |> ignore + TcAttributesWithPossibleTargets TcCanFail.ReportAllErrors cenv env attrTgt attrs |> ignore and TcLiteral (cenv: cenv) overallTy env tpenv (attrs, synLiteralValExpr) = @@ -11048,7 +11164,7 @@ and TcLiteral (cenv: cenv) overallTy env tpenv (attrs, synLiteralValExpr) = and TcBindingTyparDecls alwaysRigid cenv env tpenv (ValTyparDecls(synTypars, synTyparConstraints, infer)) = let declaredTypars = TcTyparDecls cenv env synTypars let envinner = AddDeclaredTypars CheckForDuplicateTypars declaredTypars env - let tpenv = TcTyparConstraints cenv NoNewTypars CheckCxs ItemOccurence.UseInType envinner tpenv synTyparConstraints + let tpenv = TcTyparConstraints cenv NoNewTypars CheckCxs ItemOccurrence.UseInType envinner tpenv synTyparConstraints let rigidCopyOfDeclaredTypars = if alwaysRigid then @@ -11107,10 +11223,10 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn let try1 n = let tyid = mkSynId tyid.idRange n let tycon = (typath @ [tyid]) - - match ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurence.UseInAttribute OpenQualified env.eNameResEnv ad tycon TypeNameResolutionStaticArgsInfo.DefiniteEmpty PermitDirectReferenceToGeneratedType.No with + + match ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurrence.UseInAttribute OpenQualified env.eNameResEnv ad tycon TypeNameResolutionStaticArgsInfo.DefiniteEmpty PermitDirectReferenceToGeneratedType.No with | Exception err -> raze err - | Result(tinstEnclosing, tcref, inst) -> success(TcTypeApp cenv NoNewTypars CheckCxs ItemOccurence.UseInAttribute env tpenv mAttr tcref tinstEnclosing [] inst) + | Result(tinstEnclosing, tcref, inst) -> success(TcTypeApp cenv NoNewTypars CheckCxs ItemOccurrence.UseInAttribute env tpenv mAttr tcref tinstEnclosing [] inst) ForceRaise ((try1 (tyid.idText + "Attribute")) |> otherwise (fun () -> (try1 tyid.idText))) @@ -11182,7 +11298,7 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn error(Error(FSComp.SR.tcAttributeIsNotValidForLanguageElement(), mAttr)) match ResolveObjectConstructor cenv.nameResolver env.DisplayEnv mAttr ad ty with - | Exception _ when canFail -> [ ], true + | Exception _ when canFail = TcCanFail.IgnoreAllErrors || canFail = TcCanFail.IgnoreMemberResoutionError -> [ ], true | res -> let item = ForceRaise res @@ -11229,7 +11345,7 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn errorR(Error(FSComp.SR.tcPropertyOrFieldNotFoundInAttribute(), m)) id.idText, false, g.unit_ty let propNameItem = Item.SetterArg(id, setterItem) - CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, propNameItem, emptyTyparInst, ItemOccurence.Use, ad) + CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, propNameItem, emptyTyparInst, ItemOccurrence.Use, ad) AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css m NoTrace argTy callerArgTy @@ -11287,11 +11403,11 @@ and TcAttributesMaybeFail canFail cenv env attrTgt synAttribs = TcAttributesMaybeFailEx canFail cenv env attrTgt (enum 0) synAttribs and TcAttributesCanFail cenv env attrTgt synAttribs = - let attrs, didFail = TcAttributesMaybeFail true cenv env attrTgt synAttribs + let attrs, didFail = TcAttributesMaybeFail TcCanFail.IgnoreAllErrors cenv env attrTgt synAttribs attrs, (fun () -> if didFail then TcAttributes cenv env attrTgt synAttribs else attrs) and TcAttributes cenv env attrTgt synAttribs = - TcAttributesMaybeFail false cenv env attrTgt synAttribs |> fst + TcAttributesMaybeFail TcCanFail.ReportAllErrors cenv env attrTgt synAttribs |> fst //------------------------------------------------------------------------- // TcLetBinding @@ -11482,7 +11598,7 @@ and ApplyTypesFromArgumentPatterns (cenv: cenv, env, optionalArgsOK, ty, m, tpen match retInfoOpt with | None -> () | Some (SynBindingReturnInfo (typeName = retInfoTy; range = m)) -> - let retInfoTy, _ = TcTypeAndRecover cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv retInfoTy + let retInfoTy, _ = TcTypeAndRecover cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes env tpenv retInfoTy UnifyTypes cenv env m ty retInfoTy // Property setters always have "unit" return type match memberFlagsOpt with @@ -11559,14 +11675,14 @@ and ApplyAbstractSlotInference (cenv: cenv) (envinner: TcEnv) (_: Val option) (a let details = NicePrint.multiLineStringOfMethInfos cenv.infoReader m envinner.DisplayEnv slots errorR(Error(FSComp.SR.tcOverrideArityMismatch details, memberId.idRange)) [] - + match slot with | FSMeth (_, _, valRef, _) -> match valRef.TauType with // https://github.com/dotnet/fsharp/issues/15307 // check if abstract method expects tuple, give better error message | TType_fun(_,TType_fun(TType_tuple _,_,_),_) -> - if not slot.NumArgs.IsEmpty && slot.NumArgs.Head = 1 then + if not slot.NumArgs.IsEmpty && slot.NumArgs.Head = 1 then errorR(Error(FSComp.SR.tcOverrideUsesMultipleArgumentsInsteadOfTuple(), memberId.idRange)) [] else raiseGenericArityMismatch() @@ -11587,6 +11703,10 @@ and ApplyAbstractSlotInference (cenv: cenv) (envinner: TcEnv) (_: Val option) (a let declaredTypars = (if typarsFromAbsSlotAreRigid then typarsFromAbsSlot else declaredTypars) + // Overrides can narrow the retTy from nullable to not-null. + // By changing nullness to be variable we do not get in the way of eliminating nullness (=good). + let retTyFromAbsSlot = retTyFromAbsSlot |> changeWithNullReqTyToVariable g + let absSlotTy = mkMethodTy g argTysFromAbsSlot retTyFromAbsSlot UnifyTypes cenv envinner m argsAndRetTy absSlotTy @@ -11921,7 +12041,7 @@ and AnalyzeRecursiveDecl match pat with | SynPat.FromParseError(innerPat, _) -> analyzeRecursiveDeclPat tpenv innerPat | SynPat.Typed(innerPat, tgtTy, _) -> - let tgtTyR, tpenv = TcTypeAndRecover cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes envinner tpenv tgtTy + let tgtTyR, tpenv = TcTypeAndRecover cenv NewTyparsOK CheckCxs ItemOccurrence.UseInType WarnOnIWSAM.Yes envinner tpenv tgtTy UnifyTypes cenv envinner mBinding ty tgtTyR analyzeRecursiveDeclPat tpenv innerPat | SynPat.Attrib(_innerPat, _attribs, m) -> @@ -11988,7 +12108,7 @@ and AnalyzeAndMakeAndPublishRecursiveValue let bindingAttribs = TcAttributes cenv env attrTgt bindingSynAttribs // Allocate the type inference variable for the inferred type - let ty = NewInferenceType g + let ty = NewInferenceType g let inlineFlag = ComputeInlineFlag memberFlagsOpt isInline isMutable g bindingAttribs mBinding @@ -12042,7 +12162,7 @@ and AnalyzeAndMakeAndPublishRecursiveValue match toolIdOpt with | Some tid when not tid.idRange.IsSynthetic && not (equals tid.idRange bindingId.idRange) -> let item = Item.Value (mkLocalValRef vspec) - CallNameResolutionSink cenv.tcSink (tid.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.RelatedText, env.eAccessRights) + CallNameResolutionSink cenv.tcSink (tid.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.RelatedText, env.eAccessRights) | _ -> () let mangledId = ident(vspec.LogicalName, vspec.Range) @@ -12143,7 +12263,7 @@ and TcLetrecBinding | None -> let reqdThisValTy = if isByrefTy g reqdThisValTy then destByrefTy g reqdThisValTy else reqdThisValTy let enclosingTyconRef = tcrefOfAppTy g reqdThisValTy - reqdThisValTy, (mkAppTy enclosingTyconRef (List.map mkTyparTy enclosingDeclaredTypars)), vspec.Range + reqdThisValTy, (mkWoNullAppTy enclosingTyconRef (List.map mkTyparTy enclosingDeclaredTypars)), vspec.Range | Some thisVal -> reqdThisValTy, thisVal.Type, thisVal.Range if not (AddCxTypeEqualsTypeUndoIfFailed envRec.DisplayEnv cenv.css rangeForCheck actualThisValTy reqdThisValTy) then @@ -12292,7 +12412,7 @@ and TcIncrementalLetRecGeneralization cenv scopem // Some of the bindings may now have been marked as 'generalizable' (which means they now transition // from PreGeneralization --> PostGeneralization, since we won't get any more information on // these bindings by processing later bindings). But this doesn't mean we - // actually generalize all the individual type variables occuring in these bindings - for example, some + // actually generalize all the individual type variables occurring in these bindings - for example, some // type variables may be free in the environment, and some definitions // may be value definitions which can't be generalized, e.g. // let rec f x = g x @@ -12607,7 +12727,7 @@ let private PublishArguments (cenv: cenv) (env: TcEnv) vspec (synValSig: SynValS for (argTy, argReprInfo), ident in argData do let item = Item.OtherName (Some ident, argTy, Some argReprInfo, None, ident.idRange) - CallNameResolutionSink cenv.tcSink (ident.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Binding, env.AccessRights) + CallNameResolutionSink cenv.tcSink (ident.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Binding, env.AccessRights) let TcAndPublishValSpec (cenv: cenv, env, containerInfo: ContainerInfo, declKind : DeclKind, memFlagsOpt, tpenv, synValSig) = @@ -12615,8 +12735,9 @@ let TcAndPublishValSpec (cenv: cenv, env, containerInfo: ContainerInfo, declKind let (SynValSig (attributes=Attributes synAttrs; explicitTypeParams=explicitTypeParams; isInline=isInline; isMutable=mutableFlag; xmlDoc=xmlDoc; accessibility=vis; synExpr=literalExprOpt; range=m)) = synValSig let (ValTyparDecls (synTypars, _, synCanInferTypars)) = explicitTypeParams + let declaredTypars = TcTyparDecls cenv env synTypars - GeneralizationHelpers.CheckDeclaredTyparsPermitted(memFlagsOpt, synTypars, m) + GeneralizationHelpers.CheckDeclaredTyparsPermitted(memFlagsOpt, declaredTypars, m) let canInferTypars = GeneralizationHelpers.ComputeCanInferExtraGeneralizableTypars (containerInfo.ParentRef, synCanInferTypars, memFlagsOpt) @@ -12627,8 +12748,22 @@ let TcAndPublishValSpec (cenv: cenv, env, containerInfo: ContainerInfo, declKind let valinfos, tpenv = TcValSpec cenv env declKind newOk containerInfo memFlagsOpt None tpenv synValSig attrs let denv = env.DisplayEnv + let viss = + match memFlagsOpt with + | Some ({MemberKind = SynMemberKind.PropertyGetSet as propKind}) -> + let getterAccess, setterAccess = getGetterSetterAccess vis propKind g.langVersion + List.init valinfos.Length (fun i -> if i = 0 then getterAccess else setterAccess) + | Some ({MemberKind = SynMemberKind.PropertyGet as propKind}) -> + let getterAccess, _ = getGetterSetterAccess vis propKind g.langVersion + List.init valinfos.Length (fun _ -> getterAccess) + | Some ({MemberKind = SynMemberKind.PropertySet as propKind}) -> + let _, setterAccess = getGetterSetterAccess vis propKind g.langVersion + List.init valinfos.Length (fun _ -> setterAccess) + | _ -> + List.init valinfos.Length (fun _ -> vis.SingleAccess()) + let valinfos = List.zip valinfos viss - (tpenv, valinfos) ||> List.mapFold (fun tpenv valSpecResult -> + (tpenv, valinfos) ||> List.mapFold (fun tpenv (valSpecResult, vis) -> let (ValSpecResult (altActualParent, memberInfoOpt, id, enclosingDeclaredTypars, declaredTypars, ty, prelimValReprInfo, declKind)) = valSpecResult @@ -12672,7 +12807,7 @@ let TcAndPublishValSpec (cenv: cenv, env, containerInfo: ContainerInfo, declKind | None -> None | Some valReprInfo -> Some valReprInfo.ArgNames - let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs + let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs let xmlDoc = xmlDoc.ToXmlDoc(checkXmlDocs, paramNames) let vspec = MakeAndPublishVal cenv env (altActualParent, true, declKind, ValNotInRecScope, valscheme, attrs, xmlDoc, literalValue, false) @@ -12680,4 +12815,4 @@ let TcAndPublishValSpec (cenv: cenv, env, containerInfo: ContainerInfo, declKind assert(vspec.InlineInfo = inlineFlag) - vspec, tpenv) + vspec, tpenv) \ No newline at end of file diff --git a/src/Compiler/Checking/CheckExpressions.fsi b/src/Compiler/Checking/Expressions/CheckExpressions.fsi similarity index 96% rename from src/Compiler/Checking/CheckExpressions.fsi rename to src/Compiler/Checking/Expressions/CheckExpressions.fsi index 40ac1cd20bd..cccb19f8abf 100644 --- a/src/Compiler/Checking/CheckExpressions.fsi +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fsi @@ -123,9 +123,6 @@ exception InvalidInternalsVisibleToAssemblyName of badName: string * fileName: s val TcFieldInit: range -> ILFieldInit -> Const -val LightweightTcValForUsingInBuildMethodCall: - g: TcGlobals -> vref: ValRef -> vrefFlags: ValUseFlag -> vrefTypeInst: TTypes -> m: range -> Expr * TType - /// Indicates whether a syntactic type is allowed to include new type variables /// not declared anywhere, e.g. `let f (x: 'T option) = x.Value` type ImplicitlyBoundTyparsAllowed = @@ -348,6 +345,12 @@ type PostSpecialValsRecursiveBinding = { ValScheme: ValScheme Binding: Binding } +[] +type TcCanFail = + | IgnoreMemberResoutionError + | IgnoreAllErrors + | ReportAllErrors + /// Represents a recursive binding after it has been both checked and generalized, but /// before initialization recursion has been rewritten type PreInitializationGraphEliminationBinding = @@ -413,7 +416,7 @@ val CheckSuperType: cenv: TcFileState -> ty: TType -> m: range -> unit val ChooseCanonicalDeclaredTyparsAfterInference: g: TcGlobals -> denv: DisplayEnv -> declaredTypars: Typar list -> m: range -> Typar list -/// After inference, view a ValSchem in a canonical way. +/// After inference, view a ValScheme in a canonical way. val ChooseCanonicalValSchemeAfterInference: g: TcGlobals -> denv: DisplayEnv -> vscheme: ValScheme -> m: range -> ValScheme @@ -428,7 +431,7 @@ val ComputeAccessRights: eFamilyType: TyconRef option -> AccessorDomain -/// Compute the available access rights and module/entity compilation path for a paricular location in code +/// Compute the available access rights and module/entity compilation path for a particular location in code val ComputeAccessAndCompPath: g: TcGlobals -> env: TcEnv -> @@ -442,20 +445,6 @@ val ComputeAccessAndCompPath: /// Get the expression resulting from turning an expression into an enumerable value, e.g. at 'for' loops val ConvertArbitraryExprToEnumerable: cenv: TcFileState -> ty: TType -> env: TcEnv -> expr: Expr -> Expr * TType -/// Invoke pattern match compilation -val CompilePatternForMatchClauses: - cenv: TcFileState -> - env: TcEnv -> - mExpr: range -> - mMatch: range -> - warnOnUnused: bool -> - actionOnFailure: ActionOnFailure -> - inputExprOpt: Expr option -> - inputTy: TType -> - resultTy: TType -> - tclauses: MatchClause list -> - Val * Expr - /// Process recursive bindings so that initialization is through laziness and is checked. /// The bindings may be either plain 'let rec' bindings or mutually recursive nestings of modules and types. /// The functions must iterate the actual bindings and process them to the overall result. @@ -557,7 +546,7 @@ val MakeInnerEnv: TcEnv * ModuleOrNamespaceType ref /// Return a new environment suitable for processing declarations in the interior of a module definition -/// given that the accumulator for the module type already exisits. +/// given that the accumulator for the module type already exists. val MakeInnerEnvWithAcc: addOpenToNameEnv: bool -> env: TcEnv -> @@ -567,7 +556,7 @@ val MakeInnerEnvWithAcc: TcEnv /// Produce a post-generalization type scheme for a simple type where no type inference generalization -/// is appplied. +/// is applied. val NonGenericTypeScheme: ty: TType -> GeneralizedType /// Publish a module definition to the module/namespace type accumulator. @@ -615,7 +604,7 @@ val TcAttributesCanFail: /// Check a set of attributes which can only target specific elements val TcAttributesWithPossibleTargets: - canFail: bool -> + canFail: TcCanFail -> cenv: TcFileState -> env: TcEnv -> attrTgt: AttributeTargets -> @@ -640,9 +629,8 @@ val TcExpr: val CheckTupleIsCorrectLength: g: TcGlobals -> env: TcEnv -> m: range -> tupleTy: TType -> args: 'a list -> tcArgs: (TType list -> unit) -> unit -/// Converts 'a..b' to a call to the '(..)' operator in FSharp.Core -/// Converts 'a..b..c' to a call to the '(.. ..)' operator in FSharp.Core -val RewriteRangeExpr: synExpr: SynExpr -> SynExpr option +/// Check record names and types for cases like cases like `query { for ... join(for x in f(). }` +val RecordNameAndTypeResolutions: cenv: TcFileState -> env: TcEnv -> tpenv: UnscopedTyparEnv -> expr: SynExpr -> unit /// Check a syntactic expression and convert it to a typed tree expression val TcExprOfUnknownType: @@ -749,7 +737,7 @@ val TcLetrecBinding: UnscopedTyparEnv * Map -/// Get the binding for the implicit safe initialziation check value if it is being used +/// Get the binding for the implicit safe initialization check value if it is being used val TcLetrecComputeCtorSafeThisValBind: cenv: TcFileState -> safeThisValOpt: Val option -> Binding option /// Check a collection of `let rec` bindings @@ -798,7 +786,7 @@ val TcTyparConstraints: cenv: TcFileState -> newOk: ImplicitlyBoundTyparsAllowed -> checkConstraints: CheckConstraints -> - occ: ItemOccurence -> + occ: ItemOccurrence -> env: TcEnv -> tpenv: UnscopedTyparEnv -> synConstraints: SynTypeConstraint list -> @@ -812,7 +800,7 @@ val TcType: cenv: TcFileState -> newOk: ImplicitlyBoundTyparsAllowed -> checkConstraints: CheckConstraints -> - occ: ItemOccurence -> + occ: ItemOccurrence -> iwsam: WarnOnIWSAM -> env: TcEnv -> tpenv: UnscopedTyparEnv -> @@ -825,7 +813,7 @@ val TcTypeOrMeasureAndRecover: cenv: TcFileState -> newOk: ImplicitlyBoundTyparsAllowed -> checkConstraints: CheckConstraints -> - occ: ItemOccurence -> + occ: ItemOccurrence -> iwsam: WarnOnIWSAM -> env: TcEnv -> tpenv: UnscopedTyparEnv -> @@ -837,7 +825,7 @@ val TcTypeAndRecover: cenv: TcFileState -> newOk: ImplicitlyBoundTyparsAllowed -> checkConstraints: CheckConstraints -> - occ: ItemOccurence -> + occ: ItemOccurrence -> iwsam: WarnOnIWSAM -> env: TcEnv -> tpenv: UnscopedTyparEnv -> @@ -872,9 +860,6 @@ val TranslateSynValInfo: /// once type parameters have been fully inferred via generalization. val TranslatePartialValReprInfo: tps: Typar list -> PrelimValReprInfo -> ValReprInfo -/// Constrain two types to be equal within this type checking context -val UnifyTypes: cenv: TcFileState -> env: TcEnv -> m: range -> expectedTy: TType -> actualTy: TType -> unit - val TcRuntimeTypeTest: isCast: bool -> isOperator: bool -> @@ -939,12 +924,12 @@ val TcVal: module GeneralizationHelpers = /// Given an environment, compute the set of inference type variables which may not be - /// generalised, because they appear somewhere in the types of the constructs availabe + /// generalised, because they appear somewhere in the types of the constructs available /// in the environment. val ComputeUngeneralizableTypars: env: TcEnv -> Zset /// Given an environment, compute the set of trait solutions which must appear before - /// the current location, not after (to prevent use-before definitiosn and + /// the current location, not after (to prevent use-before definitions and /// forward calls via type inference filling in trait solutions). val ComputeUnabstractableTraitSolutions: env: TcEnv -> FreeLocals diff --git a/src/Compiler/Checking/Expressions/CheckExpressionsOps.fs b/src/Compiler/Checking/Expressions/CheckExpressionsOps.fs new file mode 100644 index 00000000000..17572c86e4f --- /dev/null +++ b/src/Compiler/Checking/Expressions/CheckExpressionsOps.fs @@ -0,0 +1,381 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +module internal FSharp.Compiler.CheckExpressionsOps + +open Internal.Utilities.Library +open Internal.Utilities.Library.Extras +open FSharp.Compiler.CheckBasics +open FSharp.Compiler.ConstraintSolver +open FSharp.Compiler.DiagnosticsLogger +open FSharp.Compiler.Features +open FSharp.Compiler.NameResolution +open FSharp.Compiler.PatternMatchCompilation +open FSharp.Compiler.Text +open FSharp.Compiler.Text.Range +open FSharp.Compiler.Syntax +open FSharp.Compiler.TypedTree +open FSharp.Compiler.TypedTreeBasics +open FSharp.Compiler.TypedTreeOps +open FSharp.Compiler.SyntaxTreeOps + +let CopyAndFixupTypars g m rigid tpsorig = + FreshenAndFixupTypars g m rigid [] [] tpsorig + +let FreshenPossibleForallTy g m rigid ty = + let origTypars, tau = tryDestForallTy g ty + + if isNil origTypars then + [], [], [], tau + else + // tps may be have been equated to other tps in equi-recursive type inference and units-of-measure type inference. Normalize them here + let origTypars = NormalizeDeclaredTyparsForEquiRecursiveInference g origTypars + let tps, renaming, tinst = CopyAndFixupTypars g m rigid origTypars + origTypars, tps, tinst, instType renaming tau + +/// simplified version of TcVal used in calls to BuildMethodCall (typrelns.fs) +/// this function is used on typechecking step for making calls to provided methods and on optimization step (for the same purpose). +let LightweightTcValForUsingInBuildMethodCall g (vref: ValRef) vrefFlags (vrefTypeInst: TTypes) m = + let v = vref.Deref + let vTy = vref.Type + // byref-typed values get dereferenced + if isByrefTy g vTy then + mkAddrGet m vref, destByrefTy g vTy + else + match v.LiteralValue with + | Some literalConst -> + let _, _, _, tau = FreshenPossibleForallTy g m TyparRigidity.Flexible vTy + Expr.Const(literalConst, m, tau), tau + + | None -> + // Instantiate the value + let tau = + // If we have got an explicit instantiation then use that + let _, tps, tpTys, tau = FreshenPossibleForallTy g m TyparRigidity.Flexible vTy + + if tpTys.Length <> vrefTypeInst.Length then + error (Error(FSComp.SR.tcTypeParameterArityMismatch (tps.Length, vrefTypeInst.Length), m)) + + instType (mkTyparInst tps vrefTypeInst) tau + + let exprForVal = Expr.Val(vref, vrefFlags, m) + let exprForVal = mkTyAppExpr m (exprForVal, vTy) vrefTypeInst + exprForVal, tau + +//------------------------------------------------------------------------- +// Helpers dealing with pattern match compilation +//------------------------------------------------------------------------- + +let CompilePatternForMatch + (cenv: TcFileState) + (env: TcEnv) + mExpr + mMatch + warnOnUnused + actionOnFailure + (inputVal, generalizedTypars, inputExprOpt) + clauses + inputTy + resultTy + = + let g = cenv.g + + let dtree, targets = + CompilePattern + g + env.DisplayEnv + cenv.amap + (LightweightTcValForUsingInBuildMethodCall g) + cenv.infoReader + mExpr + mMatch + warnOnUnused + actionOnFailure + (inputVal, generalizedTypars, inputExprOpt) + clauses + inputTy + resultTy + + mkAndSimplifyMatch DebugPointAtBinding.NoneAtInvisible mExpr mMatch resultTy dtree targets + +/// Invoke pattern match compilation +let CompilePatternForMatchClauses (cenv: TcFileState) env mExpr mMatch warnOnUnused actionOnFailure inputExprOpt inputTy resultTy tclauses = + // Avoid creating a dummy in the common cases where we are about to bind a name for the expression + // CLEANUP: avoid code duplication with code further below, i.e.all callers should call CompilePatternForMatch + match tclauses with + | [ MatchClause(TPat_as(pat1, PatternValBinding(asVal, GeneralizedType(generalizedTypars, _)), _), None, TTarget(vs, targetExpr, _), m2) ] -> + let vs2 = ListSet.remove valEq asVal vs + + let expr = + CompilePatternForMatch + cenv + env + mExpr + mMatch + warnOnUnused + actionOnFailure + (asVal, generalizedTypars, None) + [ MatchClause(pat1, None, TTarget(vs2, targetExpr, None), m2) ] + inputTy + resultTy + + asVal, expr + | _ -> + let matchValueTmp, _ = mkCompGenLocal mExpr "matchValue" inputTy + + let expr = + CompilePatternForMatch + cenv + env + mExpr + mMatch + warnOnUnused + actionOnFailure + (matchValueTmp, [], inputExprOpt) + tclauses + inputTy + resultTy + + matchValueTmp, expr + +/// Constrain two types to be equal within this type checking context +let inline UnifyTypes (cenv: TcFileState) (env: TcEnv) m expectedTy actualTy = + + AddCxTypeEqualsType + env.eContextInfo + env.DisplayEnv + cenv.css + m + (tryNormalizeMeasureInType cenv.g expectedTy) + (tryNormalizeMeasureInType cenv.g actualTy) + +// Converts 'a..b' to a call to the '(..)' operator in FSharp.Core +// Converts 'a..b..c' to a call to the '(.. ..)' operator in FSharp.Core +// +// NOTE: we could eliminate these more efficiently in LowerComputedCollections.fs, since +// [| 1..4 |] +// becomes [| for i in (..) 1 4 do yield i |] +// instead of generating the array directly from the ranges +let RewriteRangeExpr synExpr = + match synExpr with + // a..b..c (parsed as (a..b)..c ) + | SynExpr.IndexRange(Some(SynExpr.IndexRange(Some synExpr1, _, Some synStepExpr, _, _, _)), _, Some synExpr2, _m1, _m2, mWhole) -> + let mWhole = mWhole.MakeSynthetic() + Some(mkSynTrifix mWhole ".. .." synExpr1 synStepExpr synExpr2) + // a..b + | SynExpr.IndexRange(Some synExpr1, mOperator, Some synExpr2, _m1, _m2, mWhole) -> + let otherExpr = + let mWhole = mWhole.MakeSynthetic() + + match mkSynInfix mOperator synExpr1 ".." synExpr2 with + | SynExpr.App(a, b, c, d, _) -> SynExpr.App(a, b, c, d, mWhole) + | _ -> failwith "impossible" + + Some otherExpr + | _ -> None + +/// Check if a computation or sequence expression is syntactically free of 'yield' (though not yield!) +let YieldFree (cenv: TcFileState) expr = + if cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield then + + // Implement yield free logic for F# Language including the LanguageFeature.ImplicitYield + let rec YieldFree expr = + match expr with + | SynExpr.Sequential(expr1 = expr1; expr2 = expr2) -> YieldFree expr1 && YieldFree expr2 + + | SynExpr.IfThenElse(thenExpr = thenExpr; elseExpr = elseExprOpt) -> YieldFree thenExpr && Option.forall YieldFree elseExprOpt + + | SynExpr.TryWith(tryExpr = body; withCases = clauses) -> + YieldFree body + && clauses |> List.forall (fun (SynMatchClause(resultExpr = res)) -> YieldFree res) + + | SynExpr.Match(clauses = clauses) + | SynExpr.MatchBang(clauses = clauses) -> clauses |> List.forall (fun (SynMatchClause(resultExpr = res)) -> YieldFree res) + + | SynExpr.For(doBody = body) + | SynExpr.TryFinally(tryExpr = body) + | SynExpr.LetOrUse(body = body) + | SynExpr.While(doExpr = body) + | SynExpr.WhileBang(doExpr = body) + | SynExpr.ForEach(bodyExpr = body) -> YieldFree body + + | SynExpr.LetOrUseBang(body = body) -> YieldFree body + + | SynExpr.YieldOrReturn(flags = (true, _)) -> false + + | _ -> true + + YieldFree expr + else + // Implement yield free logic for F# Language without the LanguageFeature.ImplicitYield + let rec YieldFree expr = + match expr with + | SynExpr.Sequential(expr1 = expr1; expr2 = expr2) -> YieldFree expr1 && YieldFree expr2 + + | SynExpr.IfThenElse(thenExpr = thenExpr; elseExpr = elseExprOpt) -> YieldFree thenExpr && Option.forall YieldFree elseExprOpt + + | SynExpr.TryWith(tryExpr = e1; withCases = clauses) -> + YieldFree e1 + && clauses |> List.forall (fun (SynMatchClause(resultExpr = res)) -> YieldFree res) + + | SynExpr.Match(clauses = clauses) + | SynExpr.MatchBang(clauses = clauses) -> clauses |> List.forall (fun (SynMatchClause(resultExpr = res)) -> YieldFree res) + + | SynExpr.For(doBody = body) + | SynExpr.TryFinally(tryExpr = body) + | SynExpr.LetOrUse(body = body) + | SynExpr.While(doExpr = body) + | SynExpr.WhileBang(doExpr = body) + | SynExpr.ForEach(bodyExpr = body) -> YieldFree body + + | SynExpr.LetOrUseBang _ + | SynExpr.YieldOrReturnFrom _ + | SynExpr.YieldOrReturn _ + | SynExpr.ImplicitZero _ + | SynExpr.Do _ -> false + + | _ -> true + + YieldFree expr + +let inline IsSimpleSemicolonSequenceElement expr cenv acceptDeprecated = + match expr with + | SynExpr.IfThenElse _ when acceptDeprecated && YieldFree cenv expr -> true + | SynExpr.IfThenElse _ + | SynExpr.TryWith _ + | SynExpr.Match _ + | SynExpr.For _ + | SynExpr.ForEach _ + | SynExpr.TryFinally _ + | SynExpr.YieldOrReturnFrom _ + | SynExpr.YieldOrReturn _ + | SynExpr.LetOrUse _ + | SynExpr.Do _ + | SynExpr.MatchBang _ + | SynExpr.LetOrUseBang _ + | SynExpr.While _ + | SynExpr.WhileBang _ -> false + | _ -> true + +[] +let rec TryGetSimpleSemicolonSequenceOfComprehension expr acc cenv acceptDeprecated = + match expr with + | SynExpr.Sequential(isTrueSeq = true; expr1 = e1; expr2 = e2) -> + if IsSimpleSemicolonSequenceElement e1 cenv acceptDeprecated then + TryGetSimpleSemicolonSequenceOfComprehension e2 (e1 :: acc) cenv acceptDeprecated + else + ValueNone + | _ -> + if IsSimpleSemicolonSequenceElement expr cenv acceptDeprecated then + ValueSome(List.rev (expr :: acc)) + else + ValueNone + +/// Determine if a syntactic expression inside 'seq { ... }' or '[...]' counts as a "simple sequence +/// of semicolon separated values". For example [1;2;3]. +/// 'acceptDeprecated' is true for the '[ ... ]' case, where we allow the syntax '[ if g then t else e ]' but ask it to be parenthesized +[] +let (|SimpleSemicolonSequence|_|) cenv acceptDeprecated cexpr = + TryGetSimpleSemicolonSequenceOfComprehension cexpr [] cenv acceptDeprecated + +let elimFastIntegerForLoop (spFor, spTo, id, start: SynExpr, dir, finish: SynExpr, innerExpr, m: range) = + let mOp = (unionRanges start.Range finish.Range).MakeSynthetic() + + let pseudoEnumExpr = + if dir then + mkSynInfix mOp start ".." finish + else + mkSynTrifix mOp ".. .." start (SynExpr.Const(SynConst.Int32 -1, mOp)) finish + + SynExpr.ForEach(spFor, spTo, SeqExprOnly false, true, mkSynPatVar None id, pseudoEnumExpr, innerExpr, m) + +let mkSeqEmpty (cenv: TcFileState) env m genTy = + // We must discover the 'zero' of the monadic algebra being generated in order to compile failing matches. + let g = cenv.g + let genResultTy = NewInferenceType g + UnifyTypes cenv env m genTy (mkSeqTy g genResultTy) + mkCallSeqEmpty g m genResultTy + +let mkSeqUsing (cenv: TcFileState) (env: TcEnv) m resourceTy genTy resourceExpr lam = + let g = cenv.g + AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css m NoTrace g.system_IDisposable_ty resourceTy + let genResultTy = NewInferenceType g + UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) + mkCallSeqUsing cenv.g m resourceTy genResultTy resourceExpr lam + +let mkSeqAppend (cenv: TcFileState) env m genTy e1 e2 = + let g = cenv.g + let genResultTy = NewInferenceType g + UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) + + let e1 = + mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g genResultTy) (tyOfExpr cenv.g e1) e1 + + let e2 = + mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g genResultTy) (tyOfExpr cenv.g e2) e2 + + mkCallSeqAppend cenv.g m genResultTy e1 e2 + +let mkSeqDelay (cenv: TcFileState) env m genTy lam = + let g = cenv.g + let genResultTy = NewInferenceType g + UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) + mkCallSeqDelay cenv.g m genResultTy (mkUnitDelayLambda cenv.g m lam) + +let mkSeqCollect (cenv: TcFileState) env m enumElemTy genTy lam enumExpr = + let g = cenv.g + let genResultTy = NewInferenceType g + UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) + + let enumExpr = + mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g enumElemTy) (tyOfExpr cenv.g enumExpr) enumExpr + + mkCallSeqCollect cenv.g m enumElemTy genResultTy lam enumExpr + +let mkSeqFromFunctions (cenv: TcFileState) env m genTy e1 e2 = + let g = cenv.g + let genResultTy = NewInferenceType g + UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) + + let e2 = + mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g genResultTy) (tyOfExpr cenv.g e2) e2 + + mkCallSeqGenerated cenv.g m genResultTy e1 e2 + +let mkSeqFinally (cenv: TcFileState) env m genTy e1 e2 = + let g = cenv.g + let genResultTy = NewInferenceType g + UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) + + let e1 = + mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g genResultTy) (tyOfExpr cenv.g e1) e1 + + mkCallSeqFinally cenv.g m genResultTy e1 e2 + +let mkSeqTryWith (cenv: TcFileState) env m genTy origSeq exnFilter exnHandler = + let g = cenv.g + let genResultTy = NewInferenceType g + UnifyTypes cenv env m genTy (mkSeqTy cenv.g genResultTy) + + let origSeq = + mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g genResultTy) (tyOfExpr cenv.g origSeq) origSeq + + mkCallSeqTryWith cenv.g m genResultTy origSeq exnFilter exnHandler + +let inline mkSeqExprMatchClauses (pat, vspecs) innerExpr = + [ MatchClause(pat, None, TTarget(vspecs, innerExpr, None), pat.Range) ] + +let compileSeqExprMatchClauses (cenv: TcFileState) env inputExprMark (pat: Pattern, vspecs) innerExpr inputExprOpt bindPatTy genInnerTy = + let patMark = pat.Range + let tclauses = mkSeqExprMatchClauses (pat, vspecs) innerExpr + + CompilePatternForMatchClauses + cenv + env + inputExprMark + patMark + false + ThrowIncompleteMatchException + inputExprOpt + bindPatTy + genInnerTy + tclauses diff --git a/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs b/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs new file mode 100644 index 00000000000..31be49131ab --- /dev/null +++ b/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs @@ -0,0 +1,460 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +/// Sequence expressions checking +module internal FSharp.Compiler.CheckSequenceExpressions + +open Internal.Utilities.Library +open FSharp.Compiler.CheckBasics +open FSharp.Compiler.CheckExpressions +open FSharp.Compiler.CheckExpressionsOps +open FSharp.Compiler.ConstraintSolver +open FSharp.Compiler.Features +open FSharp.Compiler.NameResolution +open FSharp.Compiler.PatternMatchCompilation +open FSharp.Compiler.Syntax +open FSharp.Compiler.Text +open FSharp.Compiler.TypedTree +open FSharp.Compiler.TypedTreeOps +open FSharp.Compiler.DiagnosticsLogger +open FSharp.Compiler.SyntaxTreeOps + +/// This case is used for computation expressions which are sequence expressions. Technically the code path is different because it +/// typechecks rather than doing a shallow syntactic translation, and generates calls into the Seq.* library +/// and helpers rather than to the builder methods (there is actually no builder for 'seq' in the library). +/// These are later detected by state machine compilation. +/// +/// Also "ienumerable extraction" is performed on arguments to "for". +let TcSequenceExpression (cenv: TcFileState) env tpenv comp (overallTy: OverallTy) m = + + let g = cenv.g + let genEnumElemTy = NewInferenceType g + UnifyTypes cenv env m overallTy.Commit (mkSeqTy cenv.g genEnumElemTy) + + // Allow subsumption at 'yield' if the element type is nominal prior to the analysis of the body of the sequence expression + let flex = not (isTyparTy cenv.g genEnumElemTy) + + // If there are no 'yield' in the computation expression then allow the type-directed rule + // interpreting non-unit-typed expressions in statement positions as 'yield'. 'yield!' may be + // present in the computation expression. + let enableImplicitYield = + cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield + && (YieldFree cenv comp) + + let mkSeqDelayedExpr m (coreExpr: Expr) = + let overallTy = tyOfExpr cenv.g coreExpr + mkSeqDelay cenv env m overallTy coreExpr + + let rec tryTcSequenceExprBody env genOuterTy tpenv comp = + match comp with + | SynExpr.ForEach(spFor, spIn, SeqExprOnly _seqExprOnly, _isFromSource, pat, pseudoEnumExpr, innerComp, _m) -> + let pseudoEnumExpr = + match RewriteRangeExpr pseudoEnumExpr with + | Some e -> e + | None -> pseudoEnumExpr + // This expression is not checked with the knowledge it is an IEnumerable, since we permit other enumerable types with GetEnumerator/MoveNext methods, as does C# + let pseudoEnumExpr, arbitraryTy, tpenv = + TcExprOfUnknownType cenv env tpenv pseudoEnumExpr + + let enumExpr, enumElemTy = + ConvertArbitraryExprToEnumerable cenv arbitraryTy env pseudoEnumExpr + + let patR, _, vspecs, envinner, tpenv = + TcMatchPattern cenv enumElemTy env tpenv pat None + + let innerExpr, tpenv = + let envinner = { envinner with eIsControlFlow = true } + tcSequenceExprBody envinner genOuterTy tpenv innerComp + + let enumExprRange = enumExpr.Range + + // We attach the debug point to the lambda expression so we can fetch it out again in LowerComputedListOrArraySeqExpr + let mFor = + match spFor with + | DebugPointAtFor.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.For) + | _ -> enumExprRange + + // We attach the debug point to the lambda expression so we can fetch it out again in LowerComputedListOrArraySeqExpr + let mIn = + match spIn with + | DebugPointAtInOrTo.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.InOrTo) + | _ -> pat.Range + + match patR, vspecs, innerExpr with + // Legacy peephole optimization: + // "seq { .. for x in e1 -> e2 .. }" == "e1 |> Seq.map (fun x -> e2)" + // "seq { .. for x in e1 do yield e2 .. }" == "e1 |> Seq.map (fun x -> e2)" + // + // This transformation is visible in quotations and thus needs to remain. + | (TPat_as(TPat_wild _, PatternValBinding(v, _), _), + [ _ ], + DebugPoints(Expr.App(Expr.Val(vref, _, _), _, [ genEnumElemTy ], [ yieldExpr ], _mYield), recreate)) when + valRefEq cenv.g vref cenv.g.seq_singleton_vref + -> + + // The debug point mFor is attached to the 'map' + // The debug point mIn is attached to the lambda + // Note: the 'yield' part of the debug point for 'yield expr' is currently lost in debug points. + let lam = mkLambda mIn v (recreate yieldExpr, genEnumElemTy) + + let enumExpr = + mkCoerceIfNeeded cenv.g (mkSeqTy cenv.g enumElemTy) (tyOfExpr cenv.g enumExpr) enumExpr + + Some(mkCallSeqMap cenv.g mFor enumElemTy genEnumElemTy lam enumExpr, tpenv) + + | _ -> + // The debug point mFor is attached to the 'collect' + // The debug point mIn is attached to the lambda + let matchv, matchExpr = + compileSeqExprMatchClauses cenv env enumExprRange (patR, vspecs) innerExpr None enumElemTy genOuterTy + + let lam = mkLambda mIn matchv (matchExpr, tyOfExpr cenv.g matchExpr) + Some(mkSeqCollect cenv env mFor enumElemTy genOuterTy lam enumExpr, tpenv) + + | SynExpr.For( + forDebugPoint = spFor + toDebugPoint = spTo + ident = id + identBody = start + direction = dir + toBody = finish + doBody = innerComp + range = m) -> + Some(tcSequenceExprBody env genOuterTy tpenv (elimFastIntegerForLoop (spFor, spTo, id, start, dir, finish, innerComp, m))) + + | SynExpr.While(spWhile, guardExpr, innerComp, _m) -> + let guardExpr, tpenv = + let env = { env with eIsControlFlow = false } + TcExpr cenv (MustEqual cenv.g.bool_ty) env tpenv guardExpr + + let innerExpr, tpenv = + let env = { env with eIsControlFlow = true } + tcSequenceExprBody env genOuterTy tpenv innerComp + + let guardExprMark = guardExpr.Range + let guardLambdaExpr = mkUnitDelayLambda cenv.g guardExprMark guardExpr + + // We attach the debug point to the lambda expression so we can fetch it out again in LowerComputedListOrArraySeqExpr + let mWhile = + match spWhile with + | DebugPointAtWhile.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.While) + | _ -> guardExprMark + + let innerDelayedExpr = mkSeqDelayedExpr mWhile innerExpr + Some(mkSeqFromFunctions cenv env guardExprMark genOuterTy guardLambdaExpr innerDelayedExpr, tpenv) + + | SynExpr.TryFinally(innerComp, unwindExpr, mTryToLast, spTry, spFinally, trivia) -> + let env = { env with eIsControlFlow = true } + let innerExpr, tpenv = tcSequenceExprBody env genOuterTy tpenv innerComp + let unwindExpr, tpenv = TcExpr cenv (MustEqual cenv.g.unit_ty) env tpenv unwindExpr + + // We attach the debug points to the lambda expressions so we can fetch it out again in LowerComputedListOrArraySeqExpr + let mTry = + match spTry with + | DebugPointAtTry.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.Try) + | _ -> trivia.TryKeyword + + let mFinally = + match spFinally with + | DebugPointAtFinally.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.Finally) + | _ -> trivia.FinallyKeyword + + let innerExpr = mkSeqDelayedExpr mTry innerExpr + let unwindExpr = mkUnitDelayLambda cenv.g mFinally unwindExpr + + Some(mkSeqFinally cenv env mTryToLast genOuterTy innerExpr unwindExpr, tpenv) + + | SynExpr.Paren(range = m) when not (cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield) -> + error (Error(FSComp.SR.tcConstructIsAmbiguousInSequenceExpression (), m)) + + | SynExpr.ImplicitZero m -> Some(mkSeqEmpty cenv env m genOuterTy, tpenv) + + | SynExpr.DoBang(_rhsExpr, m) -> error (Error(FSComp.SR.tcDoBangIllegalInSequenceExpression (), m)) + + | SynExpr.Sequential(sp, true, innerComp1, innerComp2, m, _) -> + let env1 = + { env with + eIsControlFlow = + (match sp with + | DebugPointAtSequential.SuppressNeither + | DebugPointAtSequential.SuppressExpr -> true + | _ -> false) + } + + let res, tpenv = + tcSequenceExprBodyAsSequenceOrStatement env1 genOuterTy tpenv innerComp1 + + let env2 = + { env with + eIsControlFlow = + (match sp with + | DebugPointAtSequential.SuppressNeither + | DebugPointAtSequential.SuppressStmt -> true + | _ -> false) + } + + // "expr; cexpr" is treated as sequential execution + // "cexpr; cexpr" is treated as append + match res with + | Choice1Of2 innerExpr1 -> + let innerExpr2, tpenv = tcSequenceExprBody env2 genOuterTy tpenv innerComp2 + let innerExpr2 = mkSeqDelayedExpr innerExpr2.Range innerExpr2 + Some(mkSeqAppend cenv env innerComp1.Range genOuterTy innerExpr1 innerExpr2, tpenv) + | Choice2Of2 stmt1 -> + let innerExpr2, tpenv = tcSequenceExprBody env2 genOuterTy tpenv innerComp2 + Some(Expr.Sequential(stmt1, innerExpr2, NormalSeq, m), tpenv) + + | SynExpr.IfThenElse(guardExpr, thenComp, elseCompOpt, spIfToThen, _isRecovery, mIfToEndOfElseBranch, trivia) -> + let guardExpr', tpenv = TcExpr cenv (MustEqual cenv.g.bool_ty) env tpenv guardExpr + let env = { env with eIsControlFlow = true } + let thenExpr, tpenv = tcSequenceExprBody env genOuterTy tpenv thenComp + + let elseComp = + (match elseCompOpt with + | Some c -> c + | None -> SynExpr.ImplicitZero trivia.IfToThenRange) + + let elseExpr, tpenv = tcSequenceExprBody env genOuterTy tpenv elseComp + Some(mkCond spIfToThen mIfToEndOfElseBranch genOuterTy guardExpr' thenExpr elseExpr, tpenv) + + // 'let x = expr in expr' + | SynExpr.LetOrUse(isUse = false) -> + TcLinearExprs + (fun overallTy envinner tpenv e -> tcSequenceExprBody envinner overallTy.Commit tpenv e) + cenv + env + overallTy + tpenv + true + comp + id + |> Some + + // 'use x = expr in expr' + | SynExpr.LetOrUse( + isUse = true + bindings = [ SynBinding(kind = SynBindingKind.Normal; headPat = pat; expr = rhsExpr; debugPoint = spBind) ] + body = innerComp + range = wholeExprMark) -> + + let bindPatTy = NewInferenceType g + let inputExprTy = NewInferenceType g + + let pat', _, vspecs, envinner, tpenv = + TcMatchPattern cenv bindPatTy env tpenv pat None + + UnifyTypes cenv env m inputExprTy bindPatTy + + let inputExpr, tpenv = + let env = { env with eIsControlFlow = true } + TcExpr cenv (MustEqual inputExprTy) env tpenv rhsExpr + + let innerExpr, tpenv = + let envinner = { envinner with eIsControlFlow = true } + tcSequenceExprBody envinner genOuterTy tpenv innerComp + + let mBind = + match spBind with + | DebugPointAtBinding.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.Binding) + | _ -> inputExpr.Range + + let inputExprMark = inputExpr.Range + + let matchv, matchExpr = + compileSeqExprMatchClauses cenv envinner inputExprMark (pat', vspecs) innerExpr (Some inputExpr) bindPatTy genOuterTy + + let consumeExpr = mkLambda mBind matchv (matchExpr, genOuterTy) + + // The 'mBind' is attached to the lambda + Some(mkSeqUsing cenv env wholeExprMark bindPatTy genOuterTy inputExpr consumeExpr, tpenv) + + | SynExpr.LetOrUseBang(range = m) -> error (Error(FSComp.SR.tcUseForInSequenceExpression (), m)) + + | SynExpr.Match(spMatch, expr, clauses, _m, _trivia) -> + let inputExpr, inputTy, tpenv = TcExprOfUnknownType cenv env tpenv expr + + let tclauses, tpenv = + (tpenv, clauses) + ||> List.mapFold (fun tpenv (SynMatchClause(pat, cond, innerComp, _, sp, _)) -> + let patR, condR, vspecs, envinner, tpenv = + TcMatchPattern cenv inputTy env tpenv pat cond + + let envinner = + match sp with + | DebugPointAtTarget.Yes -> { envinner with eIsControlFlow = true } + | DebugPointAtTarget.No -> envinner + + let innerExpr, tpenv = tcSequenceExprBody envinner genOuterTy tpenv innerComp + MatchClause(patR, condR, TTarget(vspecs, innerExpr, None), patR.Range), tpenv) + + let inputExprTy = tyOfExpr cenv.g inputExpr + let inputExprMark = inputExpr.Range + + let matchv, matchExpr = + CompilePatternForMatchClauses + cenv + env + inputExprMark + inputExprMark + true + ThrowIncompleteMatchException + (Some inputExpr) + inputExprTy + genOuterTy + tclauses + + Some(mkLet spMatch inputExprMark matchv inputExpr matchExpr, tpenv) + + | SynExpr.TryWith(innerTry, withList, mTryToWith, _spTry, _spWith, trivia) -> + if not (g.langVersion.SupportsFeature(LanguageFeature.TryWithInSeqExpression)) then + error (Error(FSComp.SR.tcTryIllegalInSequenceExpression (), mTryToWith)) + + let env = { env with eIsControlFlow = true } + + let tryExpr, tpenv = + let inner, tpenv = tcSequenceExprBody env genOuterTy tpenv innerTry + mkSeqDelayedExpr mTryToWith inner, tpenv + + // Compile the pattern twice, once as a filter with all succeeding targets returning "1", and once as a proper catch block. + let clauses, tpenv = + (tpenv, withList) + ||> List.mapFold (fun tpenv (SynMatchClause(pat, cond, innerComp, m, sp, _)) -> + let patR, condR, vspecs, envinner, tpenv = + TcMatchPattern cenv g.exn_ty env tpenv pat cond + + let envinner = + match sp with + | DebugPointAtTarget.Yes -> { envinner with eIsControlFlow = true } + | DebugPointAtTarget.No -> envinner + + let matchBody, tpenv = tcSequenceExprBody envinner genOuterTy tpenv innerComp + + let handlerClause = + MatchClause(patR, condR, TTarget(vspecs, matchBody, None), patR.Range) + + let filterClause = + MatchClause(patR, condR, TTarget([], Expr.Const(Const.Int32 1, m, g.int_ty), None), patR.Range) + + (handlerClause, filterClause), tpenv) + + let handlers, filterClauses = List.unzip clauses + let withRange = trivia.WithToEndRange + + let v1, filterExpr = + CompilePatternForMatchClauses cenv env withRange withRange true FailFilter None g.exn_ty g.int_ty filterClauses + + let v2, handlerExpr = + CompilePatternForMatchClauses cenv env withRange withRange true FailFilter None g.exn_ty genOuterTy handlers + + let filterLambda = mkLambda filterExpr.Range v1 (filterExpr, genOuterTy) + let handlerLambda = mkLambda handlerExpr.Range v2 (handlerExpr, genOuterTy) + + let combinatorExpr = + mkSeqTryWith cenv env mTryToWith genOuterTy tryExpr filterLambda handlerLambda + + Some(combinatorExpr, tpenv) + + | SynExpr.YieldOrReturnFrom((isYield, _), synYieldExpr, m) -> + let env = { env with eIsControlFlow = false } + let resultExpr, genExprTy, tpenv = TcExprOfUnknownType cenv env tpenv synYieldExpr + + if not isYield then + errorR (Error(FSComp.SR.tcUseYieldBangForMultipleResults (), m)) + + AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css m NoTrace genOuterTy genExprTy + + let resultExpr = mkCoerceExpr (resultExpr, genOuterTy, m, genExprTy) + + let resultExpr = + if IsControlFlowExpression synYieldExpr then + resultExpr + else + mkDebugPoint m resultExpr + + Some(resultExpr, tpenv) + + | SynExpr.YieldOrReturn((isYield, _), synYieldExpr, m) -> + let env = { env with eIsControlFlow = false } + let genResultTy = NewInferenceType g + + if not isYield then + errorR (Error(FSComp.SR.tcSeqResultsUseYield (), m)) + + UnifyTypes cenv env m genOuterTy (mkSeqTy cenv.g genResultTy) + + let resultExpr, tpenv = TcExprFlex cenv flex true genResultTy env tpenv synYieldExpr + + let resultExpr = mkCallSeqSingleton cenv.g m genResultTy resultExpr + + let resultExpr = + if IsControlFlowExpression synYieldExpr then + resultExpr + else + mkDebugPoint m resultExpr + + Some(resultExpr, tpenv) + + | _ -> None + + and tcSequenceExprBody env (genOuterTy: TType) tpenv comp = + let res, tpenv = tcSequenceExprBodyAsSequenceOrStatement env genOuterTy tpenv comp + + match res with + | Choice1Of2 expr -> expr, tpenv + | Choice2Of2 stmt -> + let m = comp.Range + let resExpr = Expr.Sequential(stmt, mkSeqEmpty cenv env m genOuterTy, NormalSeq, m) + resExpr, tpenv + + and tcSequenceExprBodyAsSequenceOrStatement env genOuterTy tpenv comp = + match tryTcSequenceExprBody env genOuterTy tpenv comp with + | Some(expr, tpenv) -> Choice1Of2 expr, tpenv + | None -> + + let env = + { env with + eContextInfo = ContextInfo.SequenceExpression genOuterTy + } + + if enableImplicitYield then + let hasTypeUnit, _ty, expr, tpenv = TryTcStmt cenv env tpenv comp + + if hasTypeUnit then + Choice2Of2 expr, tpenv + else + let genResultTy = NewInferenceType g + let mExpr = expr.Range + UnifyTypes cenv env mExpr genOuterTy (mkSeqTy cenv.g genResultTy) + let expr, tpenv = TcExprFlex cenv flex true genResultTy env tpenv comp + let exprTy = tyOfExpr cenv.g expr + AddCxTypeMustSubsumeType env.eContextInfo env.DisplayEnv cenv.css mExpr NoTrace genResultTy exprTy + + let resExpr = + mkCallSeqSingleton cenv.g mExpr genResultTy (mkCoerceExpr (expr, genResultTy, mExpr, exprTy)) + + Choice1Of2 resExpr, tpenv + else + let stmt, tpenv = TcStmtThatCantBeCtorBody cenv env tpenv comp + Choice2Of2 stmt, tpenv + + let coreExpr, tpenv = tcSequenceExprBody env overallTy.Commit tpenv comp + let delayedExpr = mkSeqDelayedExpr coreExpr.Range coreExpr + delayedExpr, tpenv + +let TcSequenceExpressionEntry (cenv: TcFileState) env (overallTy: OverallTy) tpenv (hasBuilder, comp) m = + match RewriteRangeExpr comp with + | Some replacementExpr -> TcExpr cenv overallTy env tpenv replacementExpr + | None -> + let implicitYieldEnabled = + cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield + + let validateObjectSequenceOrRecordExpression = not implicitYieldEnabled + + match comp with + | SimpleSemicolonSequence cenv false _ when validateObjectSequenceOrRecordExpression -> + errorR (Error(FSComp.SR.tcInvalidObjectSequenceOrRecordExpression (), m)) + | _ -> () + + if not hasBuilder && not cenv.g.compilingFSharpCore then + error (Error(FSComp.SR.tcInvalidSequenceExpressionSyntaxForm (), m)) + + TcSequenceExpression cenv env tpenv comp overallTy m diff --git a/src/Compiler/Checking/InfoReader.fs b/src/Compiler/Checking/InfoReader.fs index f81d89a900a..f4a9f033c64 100644 --- a/src/Compiler/Checking/InfoReader.fs +++ b/src/Compiler/Checking/InfoReader.fs @@ -26,7 +26,7 @@ open FSharp.Compiler.TypeHierarchy open FSharp.Compiler.TypeRelations /// Use the given function to select some of the member values from the members of an F# type -let SelectImmediateMemberVals g optFilter f (tcref: TyconRef) = +let SelectImmediateMemberVals g optFilter f withExplicitImpl (tcref: TyconRef) = let chooser (vref: ValRef) = match vref.MemberInfo with // The 'when' condition is a workaround for the fact that values providing @@ -34,7 +34,7 @@ let SelectImmediateMemberVals g optFilter f (tcref: TyconRef) = // These cannot be selected directly via the "." notation. // However, it certainly is useful to be able to publish these values, as we can in theory // optimize code to make direct calls to these methods. - | Some membInfo when not (ValRefIsExplicitImpl g vref) -> + | Some membInfo when withExplicitImpl || not (ValRefIsExplicitImpl g vref) -> f membInfo vref | _ -> None @@ -53,7 +53,7 @@ let TrySelectMemberVal g optFilter ty pri _membInfo (vref: ValRef) = else None -let rec GetImmediateIntrinsicMethInfosOfTypeAux (optFilter, ad) g amap m origTy metadataTy = +let rec GetImmediateIntrinsicMethInfosOfTypeAux (optFilter, ad) g amap m withExplicitImpl origTy metadataTy = let minfos = match metadataOfTy g metadataTy with @@ -77,25 +77,28 @@ let rec GetImmediateIntrinsicMethInfosOfTypeAux (optFilter, ad) g amap m origTy // In this case convert to the .NET Tuple type that carries metadata and try again if isAnyTupleTy g metadataTy then let betterMetadataTy = convertToTypeWithMetadataIfPossible g metadataTy - GetImmediateIntrinsicMethInfosOfTypeAux (optFilter, ad) g amap m origTy betterMetadataTy + GetImmediateIntrinsicMethInfosOfTypeAux (optFilter, ad) g amap m withExplicitImpl origTy betterMetadataTy // Function types support methods FSharpFunc<_, _>.FromConverter and friends from .NET metadata, // but not instance methods (you can't write "f.Invoke(x)", you have to write "f x") elif isFunTy g metadataTy then let betterMetadataTy = convertToTypeWithMetadataIfPossible g metadataTy - GetImmediateIntrinsicMethInfosOfTypeAux (optFilter, ad) g amap m origTy betterMetadataTy + GetImmediateIntrinsicMethInfosOfTypeAux (optFilter, ad) g amap m withExplicitImpl origTy betterMetadataTy |> List.filter (fun minfo -> not minfo.IsInstance) else match tryTcrefOfAppTy g metadataTy with | ValueNone -> [] | ValueSome tcref -> - SelectImmediateMemberVals g optFilter (TrySelectMemberVal g optFilter origTy None) tcref + SelectImmediateMemberVals g optFilter (TrySelectMemberVal g optFilter origTy None) withExplicitImpl tcref let minfos = minfos |> List.filter (IsMethInfoAccessible amap m ad) minfos /// Query the immediate methods of an F# type, not taking into account inherited methods. The optFilter /// parameter is an optional name to restrict the set of properties returned. let GetImmediateIntrinsicMethInfosOfType (optFilter, ad) g amap m ty = - GetImmediateIntrinsicMethInfosOfTypeAux (optFilter, ad) g amap m ty ty + GetImmediateIntrinsicMethInfosOfTypeAux (optFilter, ad) g amap m false ty ty + +let GetImmediateIntrinsicMethInfosWithExplicitImplOfType (optFilter, ad) g amap m ty = + GetImmediateIntrinsicMethInfosOfTypeAux (optFilter, ad) g amap m true ty ty /// Query the immediate methods of an F# type, not taking into account inherited methods. The optFilter /// parameter is an optional name to restrict the set of properties returned. @@ -185,7 +188,7 @@ type PropertyCollector(g, amap, m, ty, optFilter, ad) = member _.Close() = [ for KeyValue(_, pinfo) in props -> pinfo ] -let rec GetImmediateIntrinsicPropInfosOfTypeAux (optFilter, ad) g amap m origTy metadataTy = +let rec GetImmediateIntrinsicPropInfosOfTypeAux (optFilter, ad) g amap m withExplicitImpl origTy metadataTy = let pinfos = match metadataOfTy g metadataTy with @@ -216,13 +219,13 @@ let rec GetImmediateIntrinsicPropInfosOfTypeAux (optFilter, ad) g amap m origTy // In this case convert to the .NET Tuple type that carries metadata and try again if isAnyTupleTy g metadataTy || isFunTy g metadataTy then let betterMetadataTy = convertToTypeWithMetadataIfPossible g metadataTy - GetImmediateIntrinsicPropInfosOfTypeAux (optFilter, ad) g amap m origTy betterMetadataTy + GetImmediateIntrinsicPropInfosOfTypeAux (optFilter, ad) g amap m withExplicitImpl origTy betterMetadataTy else match tryTcrefOfAppTy g metadataTy with | ValueNone -> [] | ValueSome tcref -> let propCollector = PropertyCollector(g, amap, m, origTy, optFilter, ad) - SelectImmediateMemberVals g None (fun membInfo vref -> propCollector.Collect(membInfo, vref); None) tcref |> ignore + SelectImmediateMemberVals g None (fun membInfo vref -> propCollector.Collect(membInfo, vref); None) withExplicitImpl tcref |> ignore propCollector.Close() let pinfos = pinfos |> List.filter (IsPropInfoAccessible g amap m ad) @@ -230,8 +233,11 @@ let rec GetImmediateIntrinsicPropInfosOfTypeAux (optFilter, ad) g amap m origTy /// Query the immediate properties of an F# type, not taking into account inherited properties. The optFilter /// parameter is an optional name to restrict the set of properties returned. -let rec GetImmediateIntrinsicPropInfosOfType (optFilter, ad) g amap m ty = - GetImmediateIntrinsicPropInfosOfTypeAux (optFilter, ad) g amap m ty ty +let GetImmediateIntrinsicPropInfosOfType (optFilter, ad) g amap m ty = + GetImmediateIntrinsicPropInfosOfTypeAux (optFilter, ad) g amap m false ty ty + +let GetImmediateIntrinsicPropInfosWithExplicitImplOfType (optFilter, ad) g amap m ty = + GetImmediateIntrinsicPropInfosOfTypeAux (optFilter, ad) g amap m true ty ty // Checks whether the given type has an indexer property. let IsIndexerType g amap ty = @@ -313,7 +319,7 @@ type FindMemberFlag = /// Get overrides instead of abstract slots when measuring whether a class/interface implements all its required slots. | PreferOverrides /// Similar to "IgnoreOverrides", but filters the items bottom-to-top, - /// and discards all when finds first non-virtual member which hides one above it in hirearchy. + /// and discards all when finds first non-virtual member which hides one above it in hierarchy. | DiscardOnFirstNonOverride /// The input list is sorted from most-derived to least-derived type, so any System.Object methods @@ -480,7 +486,7 @@ type InfoReader(g: TcGlobals, amap: Import.ImportMap) as this = // MethodImpls contains a list of methods that override. // OverrideBy is the method that does the overriding. - // Overrides is the method being overriden. + // Overrides is the method being overridden. (acc, mimpls) ||> List.fold (fun acc ilMethImpl -> let overridesName = ilMethImpl.Overrides.MethodRef.Name @@ -644,6 +650,11 @@ type InfoReader(g: TcGlobals, amap: Import.ImportMap) as this = MethInfosEquivByNameAndSig EraseNone true g amap m, (fun minfo -> minfo.LogicalName)) + static let PropsGetterSetterEquiv innerEquality (p1:PropInfo) (p2:PropInfo) : bool = + p1.HasGetter = p2.HasGetter && + p1.HasSetter = p2.HasSetter && + innerEquality p1 p2 + /// Filter the overrides of properties, either keeping the overrides or keeping the dispatch slots. static let FilterOverridesOfPropInfos findFlag g amap m props = props @@ -652,9 +663,47 @@ type InfoReader(g: TcGlobals, amap: Import.ImportMap) as this = (fun pinfo -> pinfo.IsNewSlot), (fun pinfo -> pinfo.IsDefiniteFSharpOverride), (fun _ -> false), - PropInfosEquivByNameAndSig EraseNone g amap m, + PropsGetterSetterEquiv (PropInfosEquivByNameAndSig EraseNone g amap m), (fun pinfo -> pinfo.PropertyName)) + //type A() = + // abstract E: int with get, set + // default val E = 0 with get + // Will get (A::E with get, A::E with get, set) + // ----- + //type A() = + // member val A = 0 with get, set + //type B() = + // inherit A() + // static member val A = 0 + // Will get (static B::A, None) + static let FilterOverridesOfPropInfosWithOverriddenProp findFlag g amap m props = + let checkProp prop prop2 = + not(obj.ReferenceEquals(prop, prop2)) && + PropInfosEquivByNameAndSig EraseNone g amap m prop prop2 && + if prop.HasGetter && prop.HasSetter then false + elif prop.HasGetter then prop2.HasSetter + elif prop.HasSetter then prop2.HasGetter + else false + + let rec findPropBefore prop hasMetTheProp = + function + | props :: t when hasMetTheProp -> + match props |> List.tryFind (checkProp prop) with + | Some p -> ValueSome p + | None -> findPropBefore prop true t + | props :: t -> + if props |> List.exists (fun i -> obj.ReferenceEquals(prop, i)) then + match props |> List.tryFind (checkProp prop) with + | Some p -> ValueSome p + | None -> findPropBefore prop true t + else findPropBefore prop false t + | _ -> ValueNone + + props + |> FilterOverridesOfPropInfos findFlag g amap m + |> List.map (List.map (fun prop -> struct(prop, if findFlag = FindMemberFlag.IgnoreOverrides || prop.IsNewSlot then ValueNone else findPropBefore prop false props))) + /// Exclude methods from super types which have the same signature as a method in a more specific type. static let ExcludeHiddenOfMethInfosImpl g amap m (minfos: MethInfo list list) = minfos @@ -670,7 +719,7 @@ type InfoReader(g: TcGlobals, amap: Import.ImportMap) as this = /// Exclude properties from super types which have the same name as a property in a more specific type. static let ExcludeHiddenOfPropInfosImpl g amap m pinfos = pinfos - |> ExcludeItemsInSuperTypesBasedOnEquivTestWithItemsInSubTypes (fun (pinfo: PropInfo) -> pinfo.PropertyName) (PropInfosEquivByNameAndPartialSig EraseNone g amap m) + |> ExcludeItemsInSuperTypesBasedOnEquivTestWithItemsInSubTypes (fun (pinfo: PropInfo) -> pinfo.PropertyName) (PropsGetterSetterEquiv (PropInfosEquivByNameAndPartialSig EraseNone g amap m)) |> List.concat /// Make a cache for function 'f' keyed by type (plus some additional 'flags') that only @@ -682,25 +731,28 @@ type InfoReader(g: TcGlobals, amap: Import.ImportMap) as this = // Only cache closed, monomorphic types (closed = all members for the type // have been processed). Generic type instantiations could be processed if we had // a decent hash function for these. + + // Nullness of `ty` (TType_app) is not considered here, as the info is used to load members of the type + // It would matter for different generic instantiations of the same type, but we don't cache that here - TType_app is always matched for `[]` typars. canMemoize=(fun (_flags, _: range, ty) -> match stripTyEqns g ty with - | TType_app(tcref, [], _) -> tcref.TypeContents.tcaug_closed + | TType_app(tcref, [], _) -> tcref.TypeContents.tcaug_closed | _ -> false), keyComparer= { new IEqualityComparer<_> with - member _.Equals((flags1, _, ty1), (flags2, _, ty2)) = - // Ignoring the ranges - that's OK. - flagsEq.Equals(flags1, flags2) && - match stripTyEqns g ty1, stripTyEqns g ty2 with - | TType_app(tcref1, [], _), TType_app(tcref2, [], _) -> tyconRefEq g tcref1 tcref2 - | _ -> false member _.GetHashCode((flags, _, ty)) = // Ignoring the ranges - that's OK. flagsEq.GetHashCode flags + (match stripTyEqns g ty with | TType_app(tcref, [], _) -> hash tcref.LogicalName - | _ -> 0) }) + | _ -> 0) + member _.Equals((flags1, _, ty1), (flags2, _, ty2)) = + // Ignoring the ranges - that's OK. + flagsEq.Equals(flags1, flags2) && + match stripTyEqns g ty1, stripTyEqns g ty2 with + | TType_app(tcref1, [], _),TType_app(tcref2, [], _) -> tyconRefEq g tcref1 tcref2 + | _ -> false }) let FindImplicitConversionsUncached (ad, m, ty) = if isTyparTy g ty then @@ -742,7 +794,7 @@ type InfoReader(g: TcGlobals, amap: Import.ImportMap) as this = let hashFlags3 = { new IEqualityComparer with member _.GetHashCode((ad: AccessorDomain)) = AccessorDomain.CustomGetHashCode ad - member _.Equals((ad1), (ad2)) = AccessorDomain.CustomEquals(g, ad1, ad2) } + member _.Equals((ad1), (ad2)) = nullSafeEquality ad1 ad2 (fun ad1 ad2 -> AccessorDomain.CustomEquals(g, ad1, ad2)) } let hashFlags4 = { new IEqualityComparer with @@ -905,6 +957,12 @@ type InfoReader(g: TcGlobals, amap: Import.ImportMap) as this = member infoReader.GetIntrinsicPropInfosOfType optFilter ad allowMultiIntfInst findFlag m ty = infoReader.GetIntrinsicPropInfoSetsOfType optFilter ad allowMultiIntfInst findFlag m ty |> List.concat + /// Get the flattened list of intrinsic properties in the hierarchy + member infoReader.GetIntrinsicPropInfoWithOverriddenPropOfType optFilter ad allowMultiIntfInst findFlag m ty = + infoReader.GetRawIntrinsicPropertySetsOfType(optFilter, ad, allowMultiIntfInst, m, ty) + |> FilterOverridesOfPropInfosWithOverriddenProp findFlag infoReader.g infoReader.amap m + |> List.concat + member _.GetTraitInfosInType optFilter ty = GetImmediateTraitsInfosOfType optFilter g ty @@ -958,6 +1016,9 @@ let GetIntrinsicMethInfosOfType (infoReader: InfoReader) optFilter ad allowMulti let GetIntrinsicPropInfosOfType (infoReader: InfoReader) optFilter ad allowMultiIntfInst findFlag m ty = infoReader.GetIntrinsicPropInfosOfType optFilter ad allowMultiIntfInst findFlag m ty +let GetIntrinsicPropInfoWithOverriddenPropOfType (infoReader: InfoReader) optFilter ad allowMultiIntfInst findFlag m ty = + infoReader.GetIntrinsicPropInfoWithOverriddenPropOfType optFilter ad allowMultiIntfInst findFlag m ty + let TryFindIntrinsicNamedItemOfType (infoReader: InfoReader) (nm, ad, includeConstraints) findFlag m ty = infoReader.TryFindIntrinsicNamedItemOfType (nm, ad, includeConstraints) findFlag m ty @@ -968,7 +1029,7 @@ let TryFindIntrinsicPropInfo (infoReader: InfoReader) m ad nm ty = infoReader.TryFindIntrinsicPropInfo m ad nm ty /// Get a set of most specific override methods. -let GetIntrinisicMostSpecificOverrideMethInfoSetsOfType (infoReader: InfoReader) m ty = +let GetIntrinsicMostSpecificOverrideMethInfoSetsOfType (infoReader: InfoReader) m ty = infoReader.GetIntrinsicMostSpecificOverrideMethodSetsOfType (None, AccessibleFromSomewhere, AllowMultiIntfInstantiations.Yes, m, ty) //------------------------------------------------------------------------- @@ -1072,7 +1133,7 @@ let TryFindMetadataInfoOfExternalEntityRef (infoReader: InfoReader) m eref = // Generalize to get a formal signature let formalTypars = eref.Typars m let formalTypeInst = generalizeTypars formalTypars - let ty = TType_app(eref, formalTypeInst, 0uy) + let ty = TType_app(eref, formalTypeInst, KnownAmbivalentToNull) if isILAppTy g ty then let formalTypeInfo = ILTypeInfo.FromType g ty Some(nlref.Ccu.FileName, formalTypars, formalTypeInfo) @@ -1130,7 +1191,8 @@ let GetXmlDocSigOfUnionCaseRef (ucref: UnionCaseRef) = ucref.UnionCase.XmlDocSig <- XmlDocSigOfUnionCase [tcref.CompiledRepresentationForNamedType.FullName; ucref.CaseName] Some (ccuFileName, ucref.UnionCase.XmlDocSig) -let GetXmlDocSigOfMethInfo (infoReader: InfoReader) m (minfo: MethInfo) = +[] +let rec GetXmlDocSigOfMethInfo (infoReader: InfoReader) m (minfo: MethInfo) = let amap = infoReader.amap match minfo with | FSMeth (g, _, vref, _) -> @@ -1143,7 +1205,7 @@ let GetXmlDocSigOfMethInfo (infoReader: InfoReader) m (minfo: MethInfo) = match TryFindMetadataInfoOfExternalEntityRef infoReader m ilminfo.DeclaringTyconRef with | None -> None | Some (ccuFileName, formalTypars, formalTypeInfo) -> - let filminfo = ILMethInfo(g, formalTypeInfo.ToType, None, ilminfo.RawMetadata, fmtps) + let filminfo = ILMethInfo(g, IlType formalTypeInfo, ilminfo.RawMetadata, fmtps) let args = if ilminfo.IsILExtensionMethod then filminfo.GetRawArgTypes(amap, m, minfo.FormalMethodInst) @@ -1158,6 +1220,7 @@ let GetXmlDocSigOfMethInfo (infoReader: InfoReader) m (minfo: MethInfo) = Some (ccuFileName, "M:"+actualTypeName+"."+normalizedName+genericArity+XmlDocArgsEnc g (formalTypars, fmtps) args) + | MethInfoWithModifiedReturnType(mi,_) -> GetXmlDocSigOfMethInfo infoReader m mi | DefaultStructCtor(g, ty) -> match tryTcrefOfAppTy g ty with | ValueSome tcref -> diff --git a/src/Compiler/Checking/InfoReader.fsi b/src/Compiler/Checking/InfoReader.fsi index 3e8ceb927ca..f96c1757add 100644 --- a/src/Compiler/Checking/InfoReader.fsi +++ b/src/Compiler/Checking/InfoReader.fsi @@ -34,6 +34,16 @@ val GetImmediateIntrinsicMethInfosOfType: ty: TType -> MethInfo list +/// Query the immediate methods of an F# type, not taking into account inherited methods. The optFilter +/// parameter is an optional name to restrict the set of properties returned. +val GetImmediateIntrinsicMethInfosWithExplicitImplOfType: + optFilter: string option * ad: AccessorDomain -> + g: TcGlobals -> + amap: ImportMap -> + m: range -> + ty: TType -> + MethInfo list + /// A helper type to help collect properties. /// /// Join up getters and setters which are not associated in the F# data structure @@ -55,6 +65,16 @@ val GetImmediateIntrinsicPropInfosOfType: ty: TType -> PropInfo list +/// Query the immediate properties of an F# type, not taking into account inherited properties. The optFilter +/// parameter is an optional name to restrict the set of properties returned. +val GetImmediateIntrinsicPropInfosWithExplicitImplOfType: + optFilter: string option * ad: AccessorDomain -> + g: TcGlobals -> + amap: ImportMap -> + m: range -> + ty: TType -> + PropInfo list + /// Checks whether the given type has an indexer property. val IsIndexerType: g: TcGlobals -> amap: ImportMap -> ty: TType -> bool @@ -91,7 +111,7 @@ type FindMemberFlag = | PreferOverrides /// Similar to "IgnoreOverrides", but filters the items bottom-to-top, - /// and discards all when finds first non-virtual member which hides one above it in hirearchy. + /// and discards all when finds first non-virtual member which hides one above it in hierarchy. | DiscardOnFirstNonOverride /// An InfoReader is an object to help us read and cache infos. @@ -261,6 +281,17 @@ val GetIntrinsicPropInfosOfType: ty: TType -> PropInfo list +/// Get the flattened list of intrinsic properties in the hierarchy. If the PropInfo is get-only or set-only, try to find its setter or getter from the hierarchy. +val GetIntrinsicPropInfoWithOverriddenPropOfType: + infoReader: InfoReader -> + optFilter: string option -> + ad: AccessorDomain -> + allowMultiIntfInst: AllowMultiIntfInstantiations -> + findFlag: FindMemberFlag -> + m: range -> + ty: TType -> + struct (PropInfo * PropInfo voption) list + /// Perform type-directed name resolution of a particular named member in an F# type val TryFindIntrinsicNamedItemOfType: infoReader: InfoReader -> @@ -280,7 +311,7 @@ val TryFindIntrinsicPropInfo: infoReader: InfoReader -> m: range -> ad: AccessorDomain -> nm: string -> ty: TType -> PropInfo list /// Get a set of most specific override methods. -val GetIntrinisicMostSpecificOverrideMethInfoSetsOfType: +val GetIntrinsicMostSpecificOverrideMethInfoSetsOfType: infoReader: InfoReader -> m: range -> ty: TType -> NameMultiMap /// Represents information about the delegate - the Invoke MethInfo, the delegate argument types, the delegate return type diff --git a/src/Compiler/Checking/MethodCalls.fs b/src/Compiler/Checking/MethodCalls.fs index 46f32c53431..72363943549 100644 --- a/src/Compiler/Checking/MethodCalls.fs +++ b/src/Compiler/Checking/MethodCalls.fs @@ -155,8 +155,8 @@ let AdjustDelegateTy (infoReader: InfoReader) actualTy reqdTy m = // NOTE: // no generic method op_Implicit as yet // -// Search for an adhoc conversion based on op_Implicit, optionally returing a new equational type constraint to -// eliminate articifical constrained type variables. +// Search for an adhoc conversion based on op_Implicit, optionally returning a new equational type constraint to +// eliminate artificial constrained type variables. // // Allow adhoc for X --> Y where there is an op_Implicit from X to Y, and there is // no feasible subtype relationship between X and Y. @@ -308,8 +308,8 @@ let rec AdjustRequiredTypeForTypeDirectedConversions (infoReader: InfoReader) ad else reqdTy, TypeDirectedConversionUsed.No, None - // Adhoc based on op_Implicit, perhaps returing a new equational type constraint to - // eliminate articifical constrained type variables. + // Adhoc based on op_Implicit, perhaps returning a new equational type constraint to + // eliminate artificial constrained type variables. elif g.langVersion.SupportsFeature LanguageFeature.AdditionalTypeDirectedConversions then match TryFindRelevantImplicitConversion infoReader ad reqdTy actualTy m with | Some (minfo, _staticTy, eqn) -> actualTy, TypeDirectedConversionUsed.Yes(warn (TypeDirectedConversion.Implicit minfo), false, false), Some eqn @@ -480,7 +480,7 @@ let MakeCalledArgs amap m (minfo: MethInfo) minst = IsOutArg=isOutArg ReflArgInfo=reflArgInfo NameOpt=nmOpt - CalledArgumentType=calledArgTy }) + CalledArgumentType= changeWithNullReqTyToVariable amap.g calledArgTy}) /// /// Represents the syntactic matching between a caller of a method and the called method. @@ -523,6 +523,19 @@ type CalledMeth<'T> staticTyOpt: TType option) = let g = infoReader.g + + let minfo = + match callerObjArgTys,minfo with + | objTy :: [], ILMeth _ when + g.checkNullness + && minfo.DisplayName = "ToString" + && minfo.IsNullary + && (isAnonRecdTy g objTy || isRecdTy g objTy || isUnionTy g objTy) + && ( typeEquiv g g.obj_ty_noNulls minfo.ApparentEnclosingAppType + || typeEquiv g g.system_Value_ty minfo.ApparentEnclosingAppType) -> + MethInfoWithModifiedReturnType(minfo, g.string_ty) + | _ -> minfo + let methodRetTy = if minfo.IsConstructor then minfo.ApparentEnclosingType else minfo.GetFSharpReturnType(infoReader.amap, m, calledTyArgs) let fullCurriedCalledArgs = MakeCalledArgs infoReader.amap m minfo calledTyArgs @@ -1039,7 +1052,7 @@ let BuildFSharpMethodCall g m (ty, vref: ValRef) valUseFlags minst args = /// Make a call to a method info. Used by the optimizer and code generator to build /// calls to the type-directed solutions to member constraints. -let MakeMethInfoCall (amap: ImportMap) m (minfo: MethInfo) minst args staticTyOpt = +let rec MakeMethInfoCall (amap: ImportMap) m (minfo: MethInfo) minst args staticTyOpt = let g = amap.g let ccallInfo = ComputeConstrainedCallInfo g amap m staticTyOpt args minfo let valUseFlags = @@ -1059,6 +1072,8 @@ let MakeMethInfoCall (amap: ImportMap) m (minfo: MethInfo) minst args staticTyOp | FSMeth(g, ty, vref, _) -> BuildFSharpMethodCall g m (ty, vref) valUseFlags minst args |> fst + | MethInfoWithModifiedReturnType(mi,_) -> MakeMethInfoCall amap m mi minst args staticTyOpt + | DefaultStructCtor(_, ty) -> mkDefault (m, ty) @@ -1108,7 +1123,7 @@ let TryImportProvidedMethodBaseAsLibraryIntrinsic (amap: Import.ImportMap, m: ra // minst: the instantiation to apply for a generic method // objArgs: the 'this' argument, if any // args: the arguments, if any -let BuildMethodCall tcVal g amap isMutable m isProp minfo valUseFlags minst objArgs args staticTyOpt = +let rec BuildMethodCall tcVal g amap isMutable m isProp minfo valUseFlags minst objArgs args staticTyOpt = let direct = IsBaseCall objArgs TakeObjAddrForMethodCall g amap minfo isMutable m staticTyOpt objArgs (fun ccallInfo objArgs -> @@ -1181,10 +1196,24 @@ let BuildMethodCall tcVal g amap isMutable m isProp minfo valUseFlags minst objA let vExpr, vExprTy = tcVal vref valUseFlags (minfo.DeclaringTypeInst @ minst) m BuildFSharpMethodApp g m vref vExpr vExprTy allArgs + | MethInfoWithModifiedReturnType(mi,retTy) -> + let expr, exprTy = BuildMethodCall tcVal g amap isMutable m isProp mi valUseFlags minst objArgs args staticTyOpt + let expr = mkCoerceExpr(expr, retTy, m, exprTy) + expr, retTy + // Build a 'call' to a struct default constructor | DefaultStructCtor (g, ty) -> - if not (TypeHasDefaultValue g m ty) then - errorR(Error(FSComp.SR.tcDefaultStructConstructorCall(), m)) + if g.langFeatureNullness && g.checkNullness then + if not (TypeHasDefaultValueNew g m ty) then + // If the condition is detected because of a variation in logic introduced because + // of nullness checking, then only a warning is emitted. + if not (TypeHasDefaultValue g m ty) then + errorR(Error(FSComp.SR.tcDefaultStructConstructorCall(), m)) + else + warning(Error(FSComp.SR.tcDefaultStructConstructorCall(), m)) + else + if not (TypeHasDefaultValue g m ty) then + errorR(Error(FSComp.SR.tcDefaultStructConstructorCall(), m)) mkDefault (m, ty), ty) let ILFieldStaticChecks g amap infoReader ad m (finfo : ILFieldInfo) = @@ -1228,7 +1257,7 @@ let MethInfoChecks g amap isInstance tyargsOpt objArgs ad m (minfo: MethInfo) = AccessibleFrom(paths, None) | _ -> ad - if not (IsTypeAndMethInfoAccessible amap m adOriginal ad minfo) then + if not (minfo.IsProtectedAccessibility && minfo.LogicalName.StartsWithOrdinal("set_")) && not(IsTypeAndMethInfoAccessible amap m adOriginal ad minfo) then error (Error (FSComp.SR.tcMethodNotAccessible(minfo.LogicalName), m)) if isAnyTupleTy g minfo.ApparentEnclosingType && not minfo.IsExtensionMember && @@ -1244,7 +1273,7 @@ let MethInfoChecks g amap isInstance tyargsOpt objArgs ad m (minfo: MethInfo) = /// Build a call to the System.Object constructor taking no arguments, let BuildObjCtorCall (g: TcGlobals) m = let ilMethRef = (mkILCtorMethSpecForTy(g.ilg.typ_Object, [])).MethodRef - Expr.Op (TOp.ILCall (false, false, false, false, CtorValUsedAsSuperInit, false, true, ilMethRef, [], [], [g.obj_ty]), [], [], m) + Expr.Op (TOp.ILCall (false, false, false, false, CtorValUsedAsSuperInit, false, true, ilMethRef, [], [], [g.obj_ty_noNulls]), [], [], m) /// Implements the elaborated form of adhoc conversions from functions to delegates at member callsites let BuildNewDelegateExpr (eventInfoOpt: EventInfo option, g, amap, delegateTy, delInvokeMeth: MethInfo, delArgTys, delFuncExpr, delFuncTy, m) = @@ -1425,7 +1454,7 @@ let rec GetDefaultExpressionForCallerSideOptionalArg tcFieldInit g (calledArg: C | Some tref -> let ty = mkILNonGenericBoxedTy tref let mref = mkILCtorMethSpecForTy(ty, [g.ilg.typ_Object]).MethodRef - let expr = Expr.Op (TOp.ILCall (false, false, false, true, NormalValUse, false, false, mref, [], [], [g.obj_ty]), [], [mkDefault(mMethExpr, currCalledArgTy)], mMethExpr) + let expr = Expr.Op (TOp.ILCall (false, false, false, true, NormalValUse, false, false, mref, [], [], [g.obj_ty_noNulls]), [], [mkDefault(mMethExpr, currCalledArgTy)], mMethExpr) emptyPreBinder, expr | WrapperForIUnknown -> @@ -1434,7 +1463,7 @@ let rec GetDefaultExpressionForCallerSideOptionalArg tcFieldInit g (calledArg: C | Some tref -> let ty = mkILNonGenericBoxedTy tref let mref = mkILCtorMethSpecForTy(ty, [g.ilg.typ_Object]).MethodRef - let expr = Expr.Op (TOp.ILCall (false, false, false, true, NormalValUse, false, false, mref, [], [], [g.obj_ty]), [], [mkDefault(mMethExpr, currCalledArgTy)], mMethExpr) + let expr = Expr.Op (TOp.ILCall (false, false, false, true, NormalValUse, false, false, mref, [], [], [g.obj_ty_noNulls]), [], [mkDefault(mMethExpr, currCalledArgTy)], mMethExpr) emptyPreBinder, expr | PassByRef (ty, dfltVal2) -> @@ -1674,7 +1703,7 @@ let AdjustCallerArgs tcVal tcFieldInit eCallerMemberName (infoReader: InfoReader AdjustOutCallerArgs g calledMeth mMethExpr let adjustedNormalUnnamedArgs, setterValueArgs = - // IsIndexParamArraySetter onlye occurs for + // IsIndexParamArraySetter only occurs for // expr.[indexes] <- value // where the 'value' arg to the setter is always the last unnamed argument (there is no syntax to use a named argument for it) // Indeed in this case there will be no named/optional/out arguments. @@ -1718,7 +1747,7 @@ let AdjustCallerArgs tcVal tcFieldInit eCallerMemberName (infoReader: InfoReader // This file is not a great place for this functionality to sit, it's here because of BuildMethodCall module ProvidedMethodCalls = - let private convertConstExpr g amap m (constant : Tainted) = + let private convertConstExpr g amap m (constant : Tainted) = let obj, objTy = constant.PApply2(id, m) let ty = Import.ImportProvidedType amap m objTy let normTy = normalizeEnumTy g ty @@ -2218,12 +2247,12 @@ let GenWitnessExpr amap g m (traitInfo: TraitConstraintInfo) argExprs = match traitInfo.Solution with | None -> None // the trait has been generalized | Some _-> - // For these operators, the witness is just a call to the coresponding FSharp.Core operator + // For these operators, the witness is just a call to the corresponding FSharp.Core operator match g.TryMakeOperatorAsBuiltInWitnessInfo isStringTy isArrayTy traitInfo argExprs with | Some (info, tyargs, actualArgExprs) -> tryMkCallCoreFunctionAsBuiltInWitness g info tyargs actualArgExprs m | None -> - // For all other built-in operators, the witness is a call to the coresponding BuiltInWitnesses operator + // For all other built-in operators, the witness is a call to the corresponding BuiltInWitnesses operator // These are called as F# methods not F# functions tryMkCallBuiltInWitness g traitInfo argExprs m diff --git a/src/Compiler/Checking/MethodCalls.fsi b/src/Compiler/Checking/MethodCalls.fsi index 60a5ace7201..f167fbe3b03 100644 --- a/src/Compiler/Checking/MethodCalls.fsi +++ b/src/Compiler/Checking/MethodCalls.fsi @@ -481,7 +481,7 @@ exception FieldNotMutable of TypedTreeOps.DisplayEnv * RecdFieldRef * range val CheckRecdFieldMutation: m: range -> denv: TypedTreeOps.DisplayEnv -> rfinfo: RecdFieldInfo -> unit -/// Generate a witness for the given (solved) constraint. Five possiblilities are taken +/// Generate a witness for the given (solved) constraint. Five possibilities are taken /// into account. /// 1. The constraint is solved by a .NET-declared method or an F#-declared method /// 2. The constraint is solved by an F# record field diff --git a/src/Compiler/Checking/MethodOverrides.fs b/src/Compiler/Checking/MethodOverrides.fs index 7e36d12ed9c..b9eaa2c6687 100644 --- a/src/Compiler/Checking/MethodOverrides.fs +++ b/src/Compiler/Checking/MethodOverrides.fs @@ -148,6 +148,12 @@ module DispatchSlotChecking = let _, _, argInfos, retTy, _ = GetTypeOfMemberInMemberForm g overrideBy let nm = overrideBy.LogicalName + if g.checkNullness && nm = "ToString" && (argInfos |> List.sumBy _.Length) = 0 && retTy.IsSome then + let returnsString = typeEquiv g retTy.Value g.string_ty + let retTyNullness = (nullnessOfTy g retTy.Value).TryEvaluate() + if returnsString && retTyNullness = ValueSome(NullnessInfo.WithNull) then + warning(Error(FSComp.SR.tcNullableToStringOverride(), overrideBy.Range)) + let argTys = argInfos |> List.mapSquared fst let memberMethodTypars, memberToParentInst, argTys, retTy = @@ -324,6 +330,7 @@ module DispatchSlotChecking = let CheckDispatchSlotsAreImplemented (denv, infoReader: InfoReader, m, nenv, sink: TcResultsSink, isOverallTyAbstract, + isObjExpr, reqdTy, dispatchSlots: RequiredSlot list, availPriorOverrides: OverrideInfo list, @@ -332,7 +339,7 @@ module DispatchSlotChecking = let amap = infoReader.amap let isReqdTyInterface = isInterfaceTy g reqdTy - let showMissingMethodsAndRaiseErrors = (isReqdTyInterface || not isOverallTyAbstract) + let showMissingMethodsAndRaiseErrors = (isReqdTyInterface || not isOverallTyAbstract) || (isOverallTyAbstract && isObjExpr) let mutable res = true let fail exn = @@ -344,7 +351,7 @@ module DispatchSlotChecking = let availPriorOverridesKeyed = availPriorOverrides |> NameMultiMap.initBy (fun ov -> ov.LogicalName) let overridesKeyed = overrides |> NameMultiMap.initBy (fun ov -> ov.LogicalName) - // we accumulate those to compose a more complete error message, see noimpl() bellow. + // we accumulate those to compose a more complete error message, see noimpl() below. let missingOverloadImplementation = ResizeArray() for reqdSlot in dispatchSlots do @@ -362,7 +369,7 @@ module DispatchSlotChecking = | [ovd] -> if not ovd.IsCompilerGenerated then let item = Item.MethodGroup(ovd.LogicalName, [dispatchSlot],None) - CallNameResolutionSink sink (ovd.Range, nenv, item, dispatchSlot.FormalMethodTyparInst, ItemOccurence.Implemented, AccessorDomain.AccessibleFromSomewhere) + CallNameResolutionSink sink (ovd.Range, nenv, item, dispatchSlot.FormalMethodTyparInst, ItemOccurrence.Implemented, AccessorDomain.AccessibleFromSomewhere) | [] -> if not reqdSlot.IsOptional && // Check that no available prior override implements this dispatch slot @@ -478,7 +485,7 @@ module DispatchSlotChecking = // Get the most specific method overrides for each interface type. |> List.choose (fun (ty, m) -> - let mostSpecificOverrides = GetIntrinisicMostSpecificOverrideMethInfoSetsOfType infoReader m ty + let mostSpecificOverrides = GetIntrinsicMostSpecificOverrideMethInfoSetsOfType infoReader m ty if mostSpecificOverrides.IsEmpty then None else Some mostSpecificOverrides) @@ -502,8 +509,8 @@ module DispatchSlotChecking = let overrideBy = GetInheritedMemberOverrideInfo g amap m OverrideCanImplement.CanImplementAnyInterfaceSlot minfo let minfoTy = generalizedTyconRef g minfo.ApparentEnclosingTyconRef NameMultiMap.find minfo.LogicalName mostSpecificOverrides - |> List.filter (fun (overridenTy, minfo2) -> - typeEquiv g overridenTy minfoTy && + |> List.filter (fun (overriddenTy, minfo2) -> + typeEquiv g overriddenTy minfoTy && IsSigExactMatch g amap m minfo2 overrideBy) /// Get a collection of slots for the given interface type. @@ -824,7 +831,7 @@ module DispatchSlotChecking = if isImplementation && not (isInterfaceTy g overallTy) then let overrides = allImmediateMembersThatMightImplementDispatchSlots |> List.map snd - let allCorrect = CheckDispatchSlotsAreImplemented (denv, infoReader, m, nenv, sink, tcaug.tcaug_abstract, reqdTy, dispatchSlots, availPriorOverrides, overrides) + let allCorrect = CheckDispatchSlotsAreImplemented (denv, infoReader, m, nenv, sink, tcaug.tcaug_abstract, false, reqdTy, dispatchSlots, availPriorOverrides, overrides) // Tell the user to mark the thing abstract if it was missing implementations if not allCorrect && not tcaug.tcaug_abstract && (isClassTy g reqdTy) then @@ -844,14 +851,14 @@ module DispatchSlotChecking = allImmediateMembersThatMightImplementDispatchSlots |> List.iter (fun overrideBy -> let isFakeEventProperty = overrideBy.IsFSharpEventProperty(g) - let overriden = + let overridden = if isFakeEventProperty then let slotsigs = overrideBy.MemberInfo.Value.ImplementedSlotSigs slotsigs |> List.map (ReparentSlotSigToUseMethodTypars g overrideBy.Range overrideBy) else [ for (reqdTy, m), SlotImplSet(_dispatchSlots, dispatchSlotsKeyed, _, _) in allImpls do let overrideByInfo = GetTypeMemberOverrideInfo g reqdTy overrideBy - let overridenForThisSlotImplSet = + let overriddenForThisSlotImplSet = [ for reqdSlot in NameMultiMap.find overrideByInfo.LogicalName dispatchSlotsKeyed do let dispatchSlot = reqdSlot.MethodInfo if OverrideImplementsDispatchSlot g amap m dispatchSlot overrideByInfo then @@ -872,10 +879,10 @@ module DispatchSlotChecking = // Record the slotsig via mutation yield slotsig ] //if mustOverrideSomething reqdTy overrideBy then - // assert nonNil overridenForThisSlotImplSet - yield! overridenForThisSlotImplSet ] + // assert nonNil overriddenForThisSlotImplSet + yield! overriddenForThisSlotImplSet ] - overrideBy.MemberInfo.Value.ImplementedSlotSigs <- overriden) + overrideBy.MemberInfo.Value.ImplementedSlotSigs <- overridden) /// "Type Completion" inference and a few other checks at the end of the inference scope let FinalTypeDefinitionChecksAtEndOfInferenceScope (infoReader: InfoReader, nenv, sink, isImplementation, denv, tycon: Tycon) = @@ -893,7 +900,7 @@ let FinalTypeDefinitionChecksAtEndOfInferenceScope (infoReader: InfoReader, nenv #endif Option.isNone tycon.GeneratedCompareToValues && tycon.HasInterface g g.mk_IComparable_ty && - not (tycon.HasOverride g "Equals" [g.obj_ty]) && + not (tycon.HasOverride g "Equals" [g.obj_ty_ambivalent]) && not tycon.IsFSharpInterfaceTycon then (* Warn when we're doing this for class types *) @@ -912,7 +919,7 @@ let FinalTypeDefinitionChecksAtEndOfInferenceScope (infoReader: InfoReader, nenv let tcaug = tycon.TypeContents let m = tycon.Range let hasExplicitObjectGetHashCode = tycon.HasOverride g "GetHashCode" [] - let hasExplicitObjectEqualsOverride = tycon.HasOverride g "Equals" [g.obj_ty] + let hasExplicitObjectEqualsOverride = tycon.HasOverride g "Equals" [g.obj_ty_ambivalent] if (Option.isSome tycon.GeneratedHashAndEqualsWithComparerValues) && (hasExplicitObjectGetHashCode || hasExplicitObjectEqualsOverride) then diff --git a/src/Compiler/Checking/MethodOverrides.fsi b/src/Compiler/Checking/MethodOverrides.fsi index 6468c03e8b1..b06fb16e499 100644 --- a/src/Compiler/Checking/MethodOverrides.fsi +++ b/src/Compiler/Checking/MethodOverrides.fsi @@ -113,6 +113,7 @@ module DispatchSlotChecking = nenv: NameResolutionEnv * sink: TcResultsSink * isOverallTyAbstract: bool * + isObjExpr: bool * reqdTy: TType * dispatchSlots: RequiredSlot list * availPriorOverrides: OverrideInfo list * diff --git a/src/Compiler/Checking/NameResolution.fs b/src/Compiler/Checking/NameResolution.fs index 6605ae861f2..2eb5b14fa02 100644 --- a/src/Compiler/Checking/NameResolution.fs +++ b/src/Compiler/Checking/NameResolution.fs @@ -678,13 +678,14 @@ let IntrinsicMethInfosOfType (infoReader: InfoReader) optFilter ad allowMultiInt let minfos = minfos |> ExcludeHiddenOfMethInfos g amap m minfos -let TrySelectExtensionMethInfoOfILExtMem m amap apparentTy (actualParent, minfo, pri) = +let rec TrySelectExtensionMethInfoOfILExtMem m amap apparentTy (actualParent, minfo, pri) = match minfo with | ILMeth(_,ilminfo,_) -> MethInfo.CreateILExtensionMeth (amap, m, apparentTy, actualParent, Some pri, ilminfo.RawMetadata) |> Some // F#-defined IL-style extension methods are not seen as extension methods in F# code | FSMeth(g,_,vref,_) -> FSMeth(g, apparentTy, vref, Some pri) |> Some + | MethInfoWithModifiedReturnType(mi,_) -> TrySelectExtensionMethInfoOfILExtMem m amap apparentTy (actualParent, mi, pri) #if !NO_TYPEPROVIDERS // // Provided extension methods are not yet supported | ProvidedMeth(amap,providedMeth,_,m) -> @@ -1000,7 +1001,7 @@ let ResolveProvidedTypeNameInEntity (amap, m, typeName, modref: ModuleOrNamespac //------------------------------------------------------------------------- /// Qualified lookups of type names where the number of generic arguments is known -/// from context, e.g. Module.Type. The full names suh as ``List`1`` can +/// from context, e.g. Module.Type. The full names such as ``List`1`` can /// be used to qualify access if needed let LookupTypeNameInEntityHaveArity nm (typeNameResInfo: TypeNameResolutionStaticArgsInfo) (mty: ModuleOrNamespaceType) = let attempt1 = mty.TypesByMangledName.TryFind (typeNameResInfo.MangledNameForType nm) @@ -1110,7 +1111,7 @@ let GetNestedTyconRefsOfType (infoReader: InfoReader) (amap: Import.ImportMap) ( let MakeNestedType (ncenv: NameResolver) (tinst: TType list) m (tcrefNested: TyconRef) = let tps = match tcrefNested.Typars m with [] -> [] | l -> l[tinst.Length..] let tinstNested = ncenv.InstantiationGenerator m tps - mkAppTy tcrefNested (tinst @ tinstNested) + mkWoNullAppTy tcrefNested (tinst @ tinstNested) /// Get all the accessible nested types of an existing type. let GetNestedTypesOfType (ad, ncenv: NameResolver, optFilter, staticResInfo, checkForGenerated, m) ty = @@ -1157,11 +1158,11 @@ let ChooseEventInfosForNameEnv g ty (einfos: EventInfo list) = /// Rules: /// 1. Add nested types - access to their constructors. /// 2. Add static parts of type - i.e. C# style extension members, record labels, and union cases. -/// 3. Add static extention methods. +/// 3. Add static extension methods. /// 4. Add static extension properties. /// 5. Add static events. /// 6. Add static fields. -/// 7. Add static properies. +/// 7. Add static properties. /// 8. Add static methods and combine extension methods of the same group. let rec AddStaticContentOfTypeToNameEnv (g:TcGlobals) (amap: Import.ImportMap) ad m (nenv: NameResolutionEnv) (ty: TType) = let infoReader = InfoReader(g,amap) @@ -1170,7 +1171,7 @@ let rec AddStaticContentOfTypeToNameEnv (g:TcGlobals) (amap: Import.ImportMap) a let nenv = AddStaticPartsOfTypeToNameEnv amap m nenv ty // The order of items matter such as intrinsic members will always be favored over extension members of the same name. - // Extension property members will always be favored over extenion methods of the same name. + // Extension property members will always be favored over extension methods of the same name. let items = [| // Extension methods @@ -1281,7 +1282,7 @@ and private AddStaticPartsOfTyconRefToNameEnv bulkAddMode ownDefinition g amap m if isILOrRequiredQualifiedAccess || List.isEmpty ucrefs then tab else - // Union cases for unqualfied + // Union cases for unqualified AddUnionCases2 bulkAddMode tab ucrefs let ePatItems = @@ -1528,7 +1529,7 @@ let AddDeclaredTyparsToNameEnv check nenv typars = /// a fresh set of inference type variables for the type parameters. let FreshenTycon (ncenv: NameResolver) m (tcref: TyconRef) = let tinst = ncenv.InstantiationGenerator m (tcref.Typars m) - let improvedTy = ncenv.g.decompileType tcref tinst + let improvedTy = ncenv.g.decompileType tcref tinst ncenv.g.knownWithoutNull improvedTy /// Convert a reference to a named type into a type that includes @@ -1536,7 +1537,7 @@ let FreshenTycon (ncenv: NameResolver) m (tcref: TyconRef) = let FreshenTyconWithEnclosingTypeInst (ncenv: NameResolver) m (tinstEnclosing: TypeInst) (tcref: TyconRef) = let tps = ncenv.InstantiationGenerator m (tcref.Typars m) let tinst = List.skip tinstEnclosing.Length tps - let improvedTy = ncenv.g.decompileType tcref (tinstEnclosing @ tinst) + let improvedTy = ncenv.g.decompileType tcref (tinstEnclosing @ tinst) ncenv.g.knownWithoutNull improvedTy /// Convert a reference to a union case into a UnionCaseInfo that includes @@ -1754,7 +1755,7 @@ let LookupTypeNameInEnvMaybeHaveArity fq nm (typeNameResInfo: TypeNameResolution /// Represents the kind of the occurrence when reporting a name in name resolution [] -type ItemOccurence = +type ItemOccurrence = /// This is a binding / declaration of the item | Binding /// This is a usage of the item @@ -1785,9 +1786,9 @@ type ITypecheckResultsSink = abstract NotifyExprHasType: TType * NameResolutionEnv * AccessorDomain * range -> unit - abstract NotifyNameResolution: pos * item: Item * TyparInstantiation * ItemOccurence * NameResolutionEnv * AccessorDomain * range * replace: bool -> unit + abstract NotifyNameResolution: pos * item: Item * TyparInstantiation * ItemOccurrence * NameResolutionEnv * AccessorDomain * range * replace: bool -> unit - abstract NotifyMethodGroupNameResolution : pos * item: Item * itemMethodGroup: Item * TyparInstantiation * ItemOccurence * NameResolutionEnv * AccessorDomain * range * replace: bool -> unit + abstract NotifyMethodGroupNameResolution : pos * item: Item * itemMethodGroup: Item * TyparInstantiation * ItemOccurrence * NameResolutionEnv * AccessorDomain * range * replace: bool -> unit abstract NotifyFormatSpecifierLocation: range * int -> unit @@ -2018,7 +2019,7 @@ let ItemsAreEffectivelyEqualHash (g: TcGlobals) orig = | _ -> 389329 [] -type CapturedNameResolution(i: Item, tpinst, io: ItemOccurence, nre: NameResolutionEnv, ad: AccessorDomain, m: range) = +type CapturedNameResolution(i: Item, tpinst, io: ItemOccurrence, nre: NameResolutionEnv, ad: AccessorDomain, m: range) = member _.Pos = m.End @@ -2026,7 +2027,7 @@ type CapturedNameResolution(i: Item, tpinst, io: ItemOccurence, nre: NameResolut member _.ItemWithInst = ({ Item = i; TyparInstantiation = tpinst } : ItemWithInst) - member _.ItemOccurence = io + member _.ItemOccurrence = io member _.DisplayEnv = nre.DisplayEnv @@ -2061,7 +2062,7 @@ type TcResolutions [] type TcSymbolUseData = { ItemWithInst: ItemWithInst - ItemOccurence: ItemOccurence + ItemOccurrence: ItemOccurrence DisplayEnv: DisplayEnv Range: range } @@ -2075,7 +2076,7 @@ type TcSymbolUses(g, capturedNameResolutions: ResizeArray ResizeArray.mapToSmallArrayChunks (fun cnr -> { ItemWithInst=cnr.ItemWithInst; ItemOccurence=cnr.ItemOccurence; DisplayEnv=cnr.DisplayEnv; Range=cnr.Range }) + |> ResizeArray.mapToSmallArrayChunks (fun cnr -> { ItemWithInst=cnr.ItemWithInst; ItemOccurrence=cnr.ItemOccurrence; DisplayEnv=cnr.DisplayEnv; Range=cnr.Range }) let capturedNameResolutions = () do capturedNameResolutions // don't capture this! @@ -2186,22 +2187,22 @@ type TcResultsSinkImpl(tcGlobals, ?sourceText: ISourceText) = if allowedRange m then capturedExprTypings.Add((ty, nenv, ad, m)) - member sink.NotifyNameResolution(endPos, item, tpinst, occurenceType, nenv, ad, m, replace) = + member sink.NotifyNameResolution(endPos, item, tpinst, occurrenceType, nenv, ad, m, replace) = if allowedRange m then if replace then remove m if not (isAlreadyDone endPos item m) then - capturedNameResolutions.Add(CapturedNameResolution(item, tpinst, occurenceType, nenv, ad, m)) + capturedNameResolutions.Add(CapturedNameResolution(item, tpinst, occurrenceType, nenv, ad, m)) - member sink.NotifyMethodGroupNameResolution(endPos, item, itemMethodGroup, tpinst, occurenceType, nenv, ad, m, replace) = + member sink.NotifyMethodGroupNameResolution(endPos, item, itemMethodGroup, tpinst, occurrenceType, nenv, ad, m, replace) = if allowedRange m then if replace then remove m if not (isAlreadyDone endPos item m) then - capturedNameResolutions.Add(CapturedNameResolution(item, tpinst, occurenceType, nenv, ad, m)) - capturedMethodGroupResolutions.Add(CapturedNameResolution(itemMethodGroup, [], occurenceType, nenv, ad, m)) + capturedNameResolutions.Add(CapturedNameResolution(item, tpinst, occurrenceType, nenv, ad, m)) + capturedMethodGroupResolutions.Add(CapturedNameResolution(itemMethodGroup, [], occurrenceType, nenv, ad, m)) member sink.NotifyFormatSpecifierLocation(m, numArgs) = capturedFormatSpecifierLocations.Add((m, numArgs)) @@ -2240,20 +2241,20 @@ let CallEnvSink (sink: TcResultsSink) (scopem, nenv, ad) = | Some sink -> sink.NotifyEnvWithScope(scopem, nenv, ad) /// Report a specific name resolution at a source range -let CallNameResolutionSink (sink: TcResultsSink) (m: range, nenv, item, tpinst, occurenceType, ad) = +let CallNameResolutionSink (sink: TcResultsSink) (m: range, nenv, item, tpinst, occurrenceType, ad) = match sink.CurrentSink with | None -> () - | Some sink -> sink.NotifyNameResolution(m.End, item, tpinst, occurenceType, nenv, ad, m, false) + | Some sink -> sink.NotifyNameResolution(m.End, item, tpinst, occurrenceType, nenv, ad, m, false) -let CallMethodGroupNameResolutionSink (sink: TcResultsSink) (m: range, nenv, item, itemMethodGroup, tpinst, occurenceType, ad) = +let CallMethodGroupNameResolutionSink (sink: TcResultsSink) (m: range, nenv, item, itemMethodGroup, tpinst, occurrenceType, ad) = match sink.CurrentSink with | None -> () - | Some sink -> sink.NotifyMethodGroupNameResolution(m.End, item, itemMethodGroup, tpinst, occurenceType, nenv, ad, m, false) + | Some sink -> sink.NotifyMethodGroupNameResolution(m.End, item, itemMethodGroup, tpinst, occurrenceType, nenv, ad, m, false) -let CallNameResolutionSinkReplacing (sink: TcResultsSink) (m: range, nenv, item, tpinst, occurenceType, ad) = +let CallNameResolutionSinkReplacing (sink: TcResultsSink) (m: range, nenv, item, tpinst, occurrenceType, ad) = match sink.CurrentSink with | None -> () - | Some sink -> sink.NotifyNameResolution(m.End, item, tpinst, occurenceType, nenv, ad, m, true) + | Some sink -> sink.NotifyNameResolution(m.End, item, tpinst, occurrenceType, nenv, ad, m, true) /// Report a specific expression typing at a source range let CallExprHasTypeSink (sink: TcResultsSink) (m: range, nenv, ty, ad) = @@ -2482,8 +2483,8 @@ let rec ResolveLongIdentAsModuleOrNamespace sink (amap: Import.ImportMap) m firs let notifyNameResolution (modref: ModuleOrNamespaceRef) m = let item = Item.ModuleOrNamespaces [modref] - let occurence = if isOpenDecl then ItemOccurence.Open else ItemOccurence.Use - CallNameResolutionSink sink (m, nenv, item, emptyTyparInst, occurence, ad) + let occurrence = if isOpenDecl then ItemOccurrence.Open else ItemOccurrence.Use + CallNameResolutionSink sink (m, nenv, item, emptyTyparInst, occurrence, ad) match moduleOrNamespaces.TryGetValue id.idText with | true, modrefs when not modrefs.IsEmpty -> @@ -2892,7 +2893,7 @@ let ResolveLongIdentInType sink (ncenv: NameResolver) nenv lookupKind m ad id fi |> AtMostOneResult m |> ForceRaise - ResolutionInfo.SendEntityPathToSink (sink, ncenv, nenv, ItemOccurence.UseInType, ad, resInfo, ResultTyparChecker(fun () -> CheckAllTyparsInferrable ncenv.amap m item)) + ResolutionInfo.SendEntityPathToSink (sink, ncenv, nenv, ItemOccurrence.UseInType, ad, resInfo, ResultTyparChecker(fun () -> CheckAllTyparsInferrable ncenv.amap m item)) item, rest let private ResolveLongIdentInTyconRef (ncenv: NameResolver) nenv lookupKind (resInfo: ResolutionInfo) depth m ad id rest typeNameResInfo tcref maybeAppliedArgExpr = @@ -3042,7 +3043,7 @@ let ChooseTyconRefInExpr (ncenv: NameResolver, m, ad, nenv, id: Ident, typeNameR success (tys |> List.map (fun (resInfo, ty) -> (resInfo, Item.Types(id.idText, [ty])))) /// Resolves the given tycons. -/// For each tycon, return resolution info that could contain enclosing type instantations. +/// For each tycon, return resolution info that could contain enclosing type instantiations. let ResolveUnqualifiedTyconRefs nenv tcrefs = let resInfo = ResolutionInfo.Empty @@ -3100,7 +3101,7 @@ let rec ResolveExprLongIdentPrim sink (ncenv: NameResolver) first fullyQualified let search = ChooseTyconRefInExpr (ncenv, m, ad, nenv, id, typeNameResInfo, tcrefs) match AtMostOneResult m search with | Result (resInfo, item) -> - ResolutionInfo.SendEntityPathToSink(sink, ncenv, nenv, ItemOccurence.Use, ad, resInfo, ResultTyparChecker(fun () -> CheckAllTyparsInferrable ncenv.amap m item)) + ResolutionInfo.SendEntityPathToSink(sink, ncenv, nenv, ItemOccurrence.Use, ad, resInfo, ResultTyparChecker(fun () -> CheckAllTyparsInferrable ncenv.amap m item)) Some(resInfo.EnclosingTypeInst, item, rest) | Exception e -> typeError <- Some e @@ -3190,7 +3191,7 @@ let rec ResolveExprLongIdentPrim sink (ncenv: NameResolver) first fullyQualified match res with | Exception e -> raze e | Result (resInfo, item) -> - ResolutionInfo.SendEntityPathToSink(sink, ncenv, nenv, ItemOccurence.Use, ad, resInfo, ResultTyparChecker(fun () -> CheckAllTyparsInferrable ncenv.amap m item)) + ResolutionInfo.SendEntityPathToSink(sink, ncenv, nenv, ItemOccurrence.Use, ad, resInfo, ResultTyparChecker(fun () -> CheckAllTyparsInferrable ncenv.amap m item)) success (resInfo.EnclosingTypeInst, item, rest) // A compound identifier. @@ -3280,7 +3281,7 @@ let rec ResolveExprLongIdentPrim sink (ncenv: NameResolver) first fullyQualified match res with | Exception e -> raze e | Result (resInfo, item, rest) -> - ResolutionInfo.SendEntityPathToSink(sink, ncenv, nenv, ItemOccurence.Use, ad, resInfo, ResultTyparChecker(fun () -> CheckAllTyparsInferrable ncenv.amap m item)) + ResolutionInfo.SendEntityPathToSink(sink, ncenv, nenv, ItemOccurrence.Use, ad, resInfo, ResultTyparChecker(fun () -> CheckAllTyparsInferrable ncenv.amap m item)) success (resInfo.EnclosingTypeInst, item, rest) let ResolveExprLongIdent sink (ncenv: NameResolver) m ad nenv typeNameResInfo lid maybeAppliedArgExpr = @@ -3402,13 +3403,13 @@ let rec ResolvePatternLongIdentPrim sink (ncenv: NameResolver) fullyQualified wa match LookupTypeNameInEnvNoArity fullyQualified id.idText nenv with | tcref :: _ when tcref.IsUnionTycon -> let res = ResolutionInfo.Empty.AddEntity (id.idRange, tcref) - ResolutionInfo.SendEntityPathToSink (sink, ncenv, nenv, ItemOccurence.Pattern, ad, res, ResultTyparChecker(fun () -> true)) - Item.Types (id.idText, [ mkAppTy tcref [] ]) + ResolutionInfo.SendEntityPathToSink (sink, ncenv, nenv, ItemOccurrence.Pattern, ad, res, ResultTyparChecker(fun () -> true)) + Item.Types (id.idText, [ mkWoNullAppTy tcref [] ]) | _ -> match ResolveLongIdentAsModuleOrNamespace sink ncenv.amap id.idRange true fullyQualified nenv ad id [] false ShouldNotifySink.Yes with | Result ((_, mref, _) :: _) -> let res = ResolutionInfo.Empty.AddEntity (id.idRange, mref) - ResolutionInfo.SendEntityPathToSink (sink, ncenv, nenv, ItemOccurence.Pattern, ad, res, ResultTyparChecker(fun () -> true)) + ResolutionInfo.SendEntityPathToSink (sink, ncenv, nenv, ItemOccurrence.Pattern, ad, res, ResultTyparChecker(fun () -> true)) Item.ModuleOrNamespaces [ mref ] | _ -> Item.NewDef id @@ -3440,7 +3441,7 @@ let rec ResolvePatternLongIdentPrim sink (ncenv: NameResolver) fullyQualified wa |> AtMostOneResult m |> ForceRaise - ResolutionInfo.SendEntityPathToSink(sink, ncenv, nenv, ItemOccurence.Use, ad, resInfo, ResultTyparChecker(fun () -> true)) + ResolutionInfo.SendEntityPathToSink(sink, ncenv, nenv, ItemOccurrence.Use, ad, resInfo, ResultTyparChecker(fun () -> true)) match rest with | [] -> res @@ -3523,11 +3524,11 @@ let ResolveTypeLongIdentInTyconRef sink (ncenv: NameResolver) nenv typeNameResIn error(Error(FSComp.SR.nrUnexpectedEmptyLongId(), m)) | id :: rest -> ForceRaise (ResolveTypeLongIdentInTyconRefPrim ncenv typeNameResInfo ad ResolutionInfo.Empty PermitDirectReferenceToGeneratedType.No 0 m tcref id rest) - ResolutionInfo.SendEntityPathToSink(sink, ncenv, nenv, ItemOccurence.Use, ad, resInfo, ResultTyparChecker(fun () -> true)) + ResolutionInfo.SendEntityPathToSink(sink, ncenv, nenv, ItemOccurrence.Use, ad, resInfo, ResultTyparChecker(fun () -> true)) let _, tinst, tyargs = FreshenTypeInst ncenv.g m (tcref.Typars m) let item = Item.Types(tcref.DisplayName, [TType_app(tcref, tyargs, ncenv.g.knownWithoutNull)]) - CallNameResolutionSink sink (rangeOfLid lid, nenv, item, tinst, ItemOccurence.UseInType, ad) + CallNameResolutionSink sink (rangeOfLid lid, nenv, item, tinst, ItemOccurrence.UseInType, ad) tcref, tyargs @@ -3556,7 +3557,7 @@ let rec private ResolveTypeLongIdentInModuleOrNamespace sink nenv (ncenv: NameRe match modref.ModuleOrNamespaceType.ModulesAndNamespacesByDemangledName.TryGetValue id.idText with | true, AccessibleEntityRef ncenv.amap m ad modref submodref -> let item = Item.ModuleOrNamespaces [submodref] - CallNameResolutionSink sink (id.idRange, nenv, item, emptyTyparInst, ItemOccurence.Use, ad) + CallNameResolutionSink sink (id.idRange, nenv, item, emptyTyparInst, ItemOccurrence.Use, ad) let resInfo = resInfo.AddEntity(id.idRange, submodref) ResolveTypeLongIdentInModuleOrNamespace sink nenv ncenv typeNameResInfo ad genOk resInfo (depth+1) m submodref submodref.ModuleOrNamespaceType id2 rest2 | _ -> @@ -3581,14 +3582,14 @@ let rec private ResolveTypeLongIdentInModuleOrNamespace sink nenv (ncenv: NameRe AddResults tyconSearch modulSearch /// Resolve a long identifier representing a type -let rec ResolveTypeLongIdentPrim sink (ncenv: NameResolver) occurence first fullyQualified m nenv ad (id: Ident) (rest: Ident list) (staticResInfo: TypeNameResolutionStaticArgsInfo) genOk = +let rec ResolveTypeLongIdentPrim sink (ncenv: NameResolver) occurrence first fullyQualified m nenv ad (id: Ident) (rest: Ident list) (staticResInfo: TypeNameResolutionStaticArgsInfo) genOk = let typeNameResInfo = TypeNameResolutionInfo.ResolveToTypeRefs staticResInfo if first && id.idText = MangledGlobalName then match rest with | [] -> error (Error(FSComp.SR.nrGlobalUsedOnlyAsFirstName(), id.idRange)) | id2 :: rest2 -> - ResolveTypeLongIdentPrim sink ncenv occurence false FullyQualified m nenv ad id2 rest2 staticResInfo genOk + ResolveTypeLongIdentPrim sink ncenv occurrence false FullyQualified m nenv ad id2 rest2 staticResInfo genOk else match rest with | [] -> @@ -3618,8 +3619,8 @@ let rec ResolveTypeLongIdentPrim sink (ncenv: NameResolver) occurence first full for kv in nenv.TyconsByDemangledNameAndArity fullyQualified do if IsEntityAccessible ncenv.amap m ad kv.Value then addToBuffer kv.Value.DisplayName - match occurence with - | ItemOccurence.UseInAttribute -> + match occurrence with + | ItemOccurrence.UseInAttribute -> if kv.Value.DisplayName.EndsWithOrdinal("Attribute") then addToBuffer (kv.Value.DisplayName.Replace("Attribute", "")) | _ -> () @@ -3674,23 +3675,23 @@ let rec ResolveTypeLongIdentPrim sink (ncenv: NameResolver) occurence first full AtMostOneResult m2 (r |?> (fun tcrefs -> CheckForTypeLegitimacyAndMultipleGenericTypeAmbiguities (tcrefs, typeNameResInfo, genOk, m))) /// Resolve a long identifier representing a type and report it -let ResolveTypeLongIdentAux sink (ncenv: NameResolver) occurence fullyQualified nenv ad (lid: Ident list) staticResInfo genOk = +let ResolveTypeLongIdentAux sink (ncenv: NameResolver) occurrence fullyQualified nenv ad (lid: Ident list) staticResInfo genOk = let m = rangeOfLid lid let res = match lid with | [] -> error(Error(FSComp.SR.nrUnexpectedEmptyLongId(), m)) | id :: rest -> - ResolveTypeLongIdentPrim sink ncenv occurence true fullyQualified m nenv ad id rest staticResInfo genOk + ResolveTypeLongIdentPrim sink ncenv occurrence true fullyQualified m nenv ad id rest staticResInfo genOk // Register the result as a name resolution match res with | Result (resInfo, tcref) -> - ResolutionInfo.SendEntityPathToSink(sink, ncenv, nenv, ItemOccurence.UseInType, ad, resInfo, ResultTyparChecker(fun () -> true)) + ResolutionInfo.SendEntityPathToSink(sink, ncenv, nenv, ItemOccurrence.UseInType, ad, resInfo, ResultTyparChecker(fun () -> true)) let _, tinst, tyargs = FreshenTypeInst ncenv.g m (tcref.Typars m) let item = Item.Types(tcref.DisplayName, [TType_app(tcref, tyargs, ncenv.g.knownWithoutNull)]) - CallNameResolutionSink sink (m, nenv, item, tinst, occurence, ad) + CallNameResolutionSink sink (m, nenv, item, tinst, occurrence, ad) Result(resInfo, tcref, tyargs) @@ -3698,8 +3699,8 @@ let ResolveTypeLongIdentAux sink (ncenv: NameResolver) occurence fullyQualified Exception exn /// Resolve a long identifier representing a type and report it -let ResolveTypeLongIdent sink ncenv occurence fullyQualified nenv ad lid staticResInfo genOk = - let res = ResolveTypeLongIdentAux sink ncenv occurence fullyQualified nenv ad lid staticResInfo genOk +let ResolveTypeLongIdent sink ncenv occurrence fullyQualified nenv ad lid staticResInfo genOk = + let res = ResolveTypeLongIdentAux sink ncenv occurrence fullyQualified nenv ad lid staticResInfo genOk res |?> fun (resInfo, tcref, ttypes) -> (resInfo.EnclosingTypeInst, tcref, ttypes) //------------------------------------------------------------------------- @@ -3884,7 +3885,7 @@ let ResolveField sink ncenv nenv ad ty mp id allFields = let checker = ResultTyparChecker(fun () -> true) res |> List.map (fun (resInfo, rfref) -> - ResolutionInfo.SendEntityPathToSink(sink, ncenv, nenv, ItemOccurence.UseInType, ad, resInfo, checker) + ResolutionInfo.SendEntityPathToSink(sink, ncenv, nenv, ItemOccurrence.UseInType, ad, resInfo, checker) rfref) /// Resolve a long identifier representing a nested record field. @@ -4020,7 +4021,7 @@ let ResolveNestedField sink (ncenv: NameResolver) nenv ad recdTy lid = match item with | Item.RecdField info -> info.FieldType | Item.AnonRecdField (_, tys, index, _) -> tys[index] - | _ -> g.obj_ty + | _ -> g.obj_ty_ambivalent idsBeforeField, (fieldId, item) :: (nestedFieldSearch [] fieldTy rest) @@ -4136,15 +4137,15 @@ let ResolveLongIdentAsExprAndComputeRange (sink: TcResultsSink) (ncenv: NameReso let callSink (refinedItem, tpinst) = if not isFakeIdents then - let occurence = + let occurrence = match item with // It's r.h.s. `Case1` in `let (|Case1|Case1|) _ = if true then Case1 else Case2` // We return `Binding` for it because it's actually not usage, but definition. If we did not // it confuses detecting unused definitions. - | Item.ActivePatternResult _ -> ItemOccurence.Binding - | _ -> ItemOccurence.Use + | Item.ActivePatternResult _ -> ItemOccurrence.Binding + | _ -> ItemOccurrence.Use - CallMethodGroupNameResolutionSink sink (itemRange, nenv, refinedItem, item, tpinst, occurence, ad) + CallMethodGroupNameResolutionSink sink (itemRange, nenv, refinedItem, item, tpinst, occurrence, ad) let callSinkWithSpecificOverload (minfo: MethInfo, pinfoOpt: PropInfo option, tpinst) = let refinedItem = @@ -4163,7 +4164,7 @@ let ResolveLongIdentAsExprAndComputeRange (sink: TcResultsSink) (ncenv: NameReso AfterResolution.RecordResolution(None, (fun tpinst -> callSink(item, tpinst)), callSinkWithSpecificOverload, (fun () -> callSink (item, emptyTyparInst))) elif isWrongItemInExpr item then - CallNameResolutionSink sink (itemRange, nenv, item, emptyTyparInst, ItemOccurence.InvalidUse, ad) + CallNameResolutionSink sink (itemRange, nenv, item, emptyTyparInst, ItemOccurrence.InvalidUse, ad) AfterResolution.DoNothing else @@ -4193,7 +4194,7 @@ let ResolveExprDotLongIdentAndComputeRange (sink: TcResultsSink) (ncenv: NameRes // "true" resolution let resInfo, item, rest, itemRange = resolveExpr findFlag - ResolutionInfo.SendEntityPathToSink(sink, ncenv, nenv, ItemOccurence.Use, ad, resInfo, ResultTyparChecker(fun () -> CheckAllTyparsInferrable ncenv.amap itemRange item)) + ResolutionInfo.SendEntityPathToSink(sink, ncenv, nenv, ItemOccurrence.Use, ad, resInfo, ResultTyparChecker(fun () -> CheckAllTyparsInferrable ncenv.amap itemRange item)) // Record the precise resolution of the field for intellisense/goto definition let afterResolution = @@ -4213,7 +4214,7 @@ let ResolveExprDotLongIdentAndComputeRange (sink: TcResultsSink) (ncenv: NameRes let callSink (refinedItem, tpinst) = let refinedItem = FilterMethodGroups ncenv itemRange refinedItem staticOnly let unrefinedItem = FilterMethodGroups ncenv itemRange unrefinedItem staticOnly - CallMethodGroupNameResolutionSink sink (itemRange, nenv, refinedItem, unrefinedItem, tpinst, ItemOccurence.Use, ad) + CallMethodGroupNameResolutionSink sink (itemRange, nenv, refinedItem, unrefinedItem, tpinst, ItemOccurrence.Use, ad) let callSinkWithSpecificOverload (minfo: MethInfo, pinfoOpt: PropInfo option, tpinst) = let refinedItem = @@ -4296,7 +4297,7 @@ let ItemOfTy g x = Item.Types (nm, [x]) // Filter out 'PrivateImplementationDetail' classes -let IsInterestingModuleName nm = not (System.String.IsNullOrEmpty nm) && nm[0] <> '<' +let IsInterestingModuleName nm = not (System.String.IsNullOrEmpty nm) && (!!nm)[0] <> '<' let rec PartialResolveLookupInModuleOrNamespaceAsModuleOrNamespaceThen f plid (modref: ModuleOrNamespaceRef) = let mty = modref.ModuleOrNamespaceType diff --git a/src/Compiler/Checking/NameResolution.fsi b/src/Compiler/Checking/NameResolution.fsi index c80125f1862..d3870b251c8 100755 --- a/src/Compiler/Checking/NameResolution.fsi +++ b/src/Compiler/Checking/NameResolution.fsi @@ -373,7 +373,7 @@ type TypeNameResolutionInfo = /// Represents the kind of the occurrence when reporting a name in name resolution [] -type internal ItemOccurence = +type internal ItemOccurrence = | Binding | Use | UseInType @@ -402,7 +402,7 @@ type internal CapturedNameResolution = member ItemWithInst: ItemWithInst /// Information about the occurrence of the symbol - member ItemOccurence: ItemOccurence + member ItemOccurrence: ItemOccurrence /// Information about printing. For example, should redundant keywords be hidden? member DisplayEnv: DisplayEnv @@ -441,7 +441,7 @@ type internal TcResolutions = [] type TcSymbolUseData = { ItemWithInst: ItemWithInst - ItemOccurence: ItemOccurence + ItemOccurrence: ItemOccurrence DisplayEnv: DisplayEnv Range: range } @@ -482,17 +482,17 @@ type ITypecheckResultsSink = /// Record that a name resolution occurred at a specific location in the source abstract NotifyNameResolution: - pos * Item * TyparInstantiation * ItemOccurence * NameResolutionEnv * AccessorDomain * range * bool -> unit + pos * Item * TyparInstantiation * ItemOccurrence * NameResolutionEnv * AccessorDomain * range * bool -> unit /// Record that a method group name resolution occurred at a specific location in the source abstract NotifyMethodGroupNameResolution: - pos * Item * Item * TyparInstantiation * ItemOccurence * NameResolutionEnv * AccessorDomain * range * bool -> + pos * Item * Item * TyparInstantiation * ItemOccurrence * NameResolutionEnv * AccessorDomain * range * bool -> unit /// Record that a printf format specifier occurred at a specific location in the source abstract NotifyFormatSpecifierLocation: range * int -> unit - /// Record that an open declaration occured in a given scope range + /// Record that an open declaration occurred in a given scope range abstract NotifyOpenDeclaration: OpenDeclaration -> unit /// Get the current source @@ -613,17 +613,17 @@ val internal CallEnvSink: TcResultsSink -> range * NameResolutionEnv * AccessorD /// Report a specific name resolution at a source range val internal CallNameResolutionSink: - TcResultsSink -> range * NameResolutionEnv * Item * TyparInstantiation * ItemOccurence * AccessorDomain -> unit + TcResultsSink -> range * NameResolutionEnv * Item * TyparInstantiation * ItemOccurrence * AccessorDomain -> unit /// Report a specific method group name resolution at a source range val internal CallMethodGroupNameResolutionSink: TcResultsSink -> - range * NameResolutionEnv * Item * Item * TyparInstantiation * ItemOccurence * AccessorDomain -> + range * NameResolutionEnv * Item * Item * TyparInstantiation * ItemOccurrence * AccessorDomain -> unit /// Report a specific name resolution at a source range, replacing any previous resolutions val internal CallNameResolutionSinkReplacing: - TcResultsSink -> range * NameResolutionEnv * Item * TyparInstantiation * ItemOccurence * AccessorDomain -> unit + TcResultsSink -> range * NameResolutionEnv * Item * TyparInstantiation * ItemOccurrence * AccessorDomain -> unit /// Report a specific name resolution at a source range val internal CallExprHasTypeSink: TcResultsSink -> range * NameResolutionEnv * TType * AccessorDomain -> unit @@ -800,7 +800,7 @@ val internal ResolveTypeLongIdentInTyconRef: val internal ResolveTypeLongIdent: sink: TcResultsSink -> ncenv: NameResolver -> - occurence: ItemOccurence -> + occurrence: ItemOccurrence -> fullyQualified: FullyQualifiedFlag -> nenv: NameResolutionEnv -> ad: AccessorDomain -> @@ -845,7 +845,7 @@ val internal ResolveExprLongIdent: val internal getRecordFieldsInScope: NameResolutionEnv -> Item list -/// Resolve a (possibly incomplete) long identifier to a loist of possible class or record fields +/// Resolve a (possibly incomplete) long identifier to a list of possible class or record fields val internal ResolvePartialLongIdentToClassOrRecdFields: NameResolver -> NameResolutionEnv -> range -> AccessorDomain -> string list -> bool -> bool -> Item list diff --git a/src/Compiler/Checking/NicePrint.fs b/src/Compiler/Checking/NicePrint.fs index cec9d12f6ac..ccb99f12139 100644 --- a/src/Compiler/Checking/NicePrint.fs +++ b/src/Compiler/Checking/NicePrint.fs @@ -38,6 +38,8 @@ module internal PrintUtilities = let squareAngleL x = LeftL.leftBracketAngle ^^ x ^^ RightL.rightBracketAngle + let squareAngleReturn x = LeftL.leftBracketAngle ^^ WordL.keywordReturn ^^ SepL.colon ^^ x ^^ RightL.rightBracketAngle + let angleL x = SepL.leftAngle ^^ x ^^ RightL.rightAngle let braceL x = wordL leftBrace ^^ x ^^ wordL rightBrace @@ -261,7 +263,7 @@ module internal PrintUtilities = if possibleXmlDoc.IsEmpty then match info with | Some(Some ccuFileName, xmlDocSig) -> - infoReader.amap.assemblyLoader.TryFindXmlDocumentationInfo(Path.GetFileNameWithoutExtension ccuFileName) + infoReader.amap.assemblyLoader.TryFindXmlDocumentationInfo(!!Path.GetFileNameWithoutExtension(ccuFileName)) |> Option.bind (fun xmlDocInfo -> xmlDocInfo.TryGetXmlDocBySig(xmlDocSig) ) @@ -333,6 +335,13 @@ module internal PrintUtilities = | Some w -> Display.squashTo w layout | None -> layout + // When showing types in diagnostics, we don't show nullness annotations by default + // unless the diagnostic is specifically about nullness. + let suppressNullnessAnnotations denv = + match denv.showNullnessAnnotations with + | None -> { denv with showNullnessAnnotations = Some false } + | _ -> denv + module PrintIL = let fullySplitILTypeRef (tref: ILTypeRef) = @@ -492,7 +501,7 @@ module PrintTypes = | Const.Zero -> tagKeyword(if isRefTy g ty then "null" else "default") wordL str - let layoutAccessibilityCore (denv: DisplayEnv) accessibility = + let layoutAccessibilityCoreWithProtected (denv: DisplayEnv) isProtected accessibility = let isInternalCompPath x = match x with | CompPath(ILScopeRef.Local, _, []) -> true @@ -503,11 +512,15 @@ module PrintTypes = | _ when List.forall isInternalCompPath p -> Internal | _ -> Private match denv.contextAccessibility, accessibility with + | _ when isProtected -> wordL (tagKeyword "protected") | Public, Internal -> WordL.keywordInternal | Public, Private -> WordL.keywordPrivate | Internal, Private -> WordL.keywordPrivate | _ -> emptyL - + + let layoutAccessibilityCore (denv: DisplayEnv) accessibility = + layoutAccessibilityCoreWithProtected denv false accessibility + let layoutAccessibility (denv: DisplayEnv) accessibility itemL = layoutAccessibilityCore denv accessibility ++ itemL @@ -631,6 +644,23 @@ module PrintTypes = let argsL = bracketL (sepListL RightL.comma (List.map (layoutILAttribElement denv) args)) PrintIL.layoutILType denv [] ty ++ argsL + /// Layout nullness attributes for C# flow-analysis + /// F# does not process them, this way we can at least show them. + and layoutCsharpCodeAnalysisIlAttributes denv (attrs:ILAttributes) (layoutCombinator: Layout -> Layout -> Layout) restL = + let denvShortNames() = { denv with shortTypeNames = true } + let attrsL = + [ for a in attrs.AsArray() do + let name = a.Method.DeclaringType.BasicQualifiedName + if name.StartsWith("System.Diagnostics.CodeAnalysis") then + let params_, _args = decodeILAttribData a + layoutILAttrib (denvShortNames()) (a.Method.DeclaringType, params_) + ] + match attrsL with + | [] -> restL + | _ -> + let separated = sepListL RightL.semicolon attrsL + layoutCombinator separated restL + /// Layout '[]' above another block and layoutAttribs denv startOpt isLiteral kind attrs restL = @@ -790,6 +820,9 @@ module PrintTypes = | TyparConstraint.SupportsNull _ -> [wordL (tagKeyword "null") |> longConstraintPrefix] + | TyparConstraint.NotSupportsNull _ -> + [(wordL (tagKeyword "not null") (* ^^ wordL(tagKeyword "null") *) ) |> longConstraintPrefix] + | TyparConstraint.IsNonNullableStruct _ -> if denv.shortConstraints then [wordL (tagText "value type")] @@ -895,6 +928,16 @@ module PrintTypes = | [] -> tcL | [arg] -> layoutTypeWithInfoAndPrec denv env 2 arg ^^ tcL | args -> bracketIfL (prec <= 1) (bracketL (layoutTypesWithInfoAndPrec denv env 2 SepL.comma args) --- tcL) + + and layoutNullness (denv: DisplayEnv) part2 (nullness: Nullness) = + // Show nullness annotations unless explicitly turned off + if denv.showNullnessAnnotations <> Some false then + match nullness.Evaluate() with + | NullnessInfo.WithNull -> part2 ^^ wordL (tagText "| null") + | NullnessInfo.WithoutNull -> part2 + | NullnessInfo.AmbivalentToNull -> part2 //^^ wordL (tagText "__maybenull") + else + part2 /// Layout a type, taking precedence into account to insert brackets where needed and layoutTypeWithInfoAndPrec denv env prec ty = @@ -915,46 +958,52 @@ module PrintTypes = // Always prefer 'float' to 'float<1>' | TType_app (tc, args, _) when tc.IsMeasureableReprTycon && List.forall (isDimensionless g) args -> - layoutTypeWithInfoAndPrec denv env prec (reduceTyconRefMeasureableOrProvided g tc args) + layoutTypeWithInfoAndPrec denv env prec (reduceTyconRefMeasureableOrProvided g tc args) // Layout a type application - | TType_ucase (UnionCaseRef(tc, _), args) - | TType_app (tc, args, _) -> - let prefix = usePrefix denv tc - let demangledCompilationPathOpt, args = - if not denv.includeStaticParametersInTypeNames then - None, args - else - let regex = System.Text.RegularExpressions.Regex(@"\`\d+") - let path, skip = - (0, tc.CompilationPath.DemangledPath) - ||> List.mapFold (fun skip path -> - // Verify the path does not contain a generic parameter count. - // For example Foo`3 indicates that there are three parameters in args that belong to this path. - let m = regex.Match(path) - if not m.Success then - path, skip - else - let take = m.Value.Replace("`", "") |> int - let genericArgs = - List.skip skip args - |> List.take take - |> List.map (layoutTypeWithInfoAndPrec denv env prec >> showL) - |> String.concat "," - |> sprintf "<%s>" - String.Concat(path.Substring(0, m.Index), genericArgs), (skip + take) - ) - - Some path, List.skip skip args - - layoutTypeAppWithInfoAndPrec - denv - env - (layoutTyconRefImpl false denv tc demangledCompilationPathOpt) - prec - prefix - args + | TType_ucase (UnionCaseRef(tc, _), args) -> + let prefix = usePrefix denv tc + layoutTypeAppWithInfoAndPrec denv env (layoutTyconRefImpl false denv tc None) prec prefix args + | TType_app (tc, args, nullness) -> + let prefix = usePrefix denv tc + let demangledCompilationPathOpt, args = + if not denv.includeStaticParametersInTypeNames then + None, args + else + let regex = System.Text.RegularExpressions.Regex(@"\`\d+") + let path, skip = + (0, tc.CompilationPath.DemangledPath) + ||> List.mapFold (fun skip path -> + // Verify the path does not contain a generic parameter count. + // For example Foo`3 indicates that there are three parameters in args that belong to this path. + let m = regex.Match(path) + if not m.Success then + path, skip + else + let take = m.Value.Replace("`", "") |> int + let genericArgs = + List.skip skip args + |> List.take take + |> List.map (layoutTypeWithInfoAndPrec denv env prec >> showL) + |> String.concat "," + |> sprintf "<%s>" + String.Concat(path.Substring(0, m.Index), genericArgs), (skip + take) + ) + + Some path, List.skip skip args + + let part1 = + layoutTypeAppWithInfoAndPrec + denv + env + (layoutTyconRefImpl false denv tc demangledCompilationPathOpt) + prec + prefix + args + + let part2 = layoutNullness denv part1 nullness + part2 // Layout a tuple type | TType_anon (anonInfo, tys) -> let core = sepListL RightL.semicolon (List.map2 (fun nm ty -> wordL (tagField nm) ^^ RightL.colon ^^ layoutTypeWithInfoAndPrec denv env prec ty) (Array.toList anonInfo.SortedNames) tys) @@ -979,16 +1028,20 @@ module PrintTypes = | [h] -> layoutTyparRefWithInfo denv env h ^^ rightL dot --- tauL | h :: t -> spaceListL (List.map (layoutTyparRefWithInfo denv env) (h :: t)) ^^ rightL dot --- tauL - | TType_fun _ -> + | TType_fun (_, _, nullness) -> let argTys, retTy = stripFunTy g ty let retTyL = layoutTypeWithInfoAndPrec denv env 5 retTy let argTysL = argTys |> List.map (layoutTypeWithInfoAndPrec denv env 4) let funcTyL = curriedLayoutsL arrow argTysL retTyL - bracketIfL (prec <= 4) funcTyL + let part1 = bracketIfL (prec <= 4) funcTyL + let part2 = layoutNullness denv part1 nullness + part2 // Layout a type variable . - | TType_var (r, _) -> - layoutTyparRefWithInfo denv env r + | TType_var (r, nullness) -> + let part1 = layoutTyparRefWithInfo denv env r + let part2 = layoutNullness denv part1 nullness + part2 | TType_measure unt -> layoutMeasure denv unt @@ -1168,7 +1221,7 @@ module PrintTypes = (nameL |> addColonL) ^^ tauL /// layouts the elements of an unresolved overloaded method call: - /// argInfos: unammed and named arguments + /// argInfos: unnamed and named arguments /// retTy: return type /// genParamTy: generic parameter types let prettyLayoutsOfUnresolvedOverloading denv argInfos retTy genParamTys = @@ -1185,7 +1238,7 @@ module PrintTypes = // using 0, 1, 2 as discriminant for return, arguments and generic parameters // respectively, in order to easily retrieve each of the types with their // expected quality below. - let typesWithDiscrimants = + let typesWithDiscriminants = [ yield 0, retTy for ty,_ in argInfos do @@ -1193,14 +1246,14 @@ module PrintTypes = for ty in genParamTys do yield 2, ty ] - let typesWithDiscrimants,typarsAndCxs = PrettyTypes.PrettifyDiscriminantAndTypePairs denv.g typesWithDiscrimants - let retTy = typesWithDiscrimants |> List.find (function 0, _ -> true | _ -> false) |> snd + let typesWithDiscriminants,typarsAndCxs = PrettyTypes.PrettifyDiscriminantAndTypePairs denv.g typesWithDiscriminants + let retTy = typesWithDiscriminants |> List.find (function 0, _ -> true | _ -> false) |> snd let argInfos = - typesWithDiscrimants + typesWithDiscriminants |> List.choose (function 1,ty -> Some ty | _ -> None) |> List.map2 (fun (_, argInfo) tTy -> tTy, argInfo) argInfos let genParamTys = - typesWithDiscrimants + typesWithDiscriminants |> List.choose (function 2,ty -> Some ty | _ -> None) argInfos, retTy, genParamTys, typarsAndCxs @@ -1259,7 +1312,7 @@ module PrintTastMemberOrVals = else nameL - let layoutMemberName (denv: DisplayEnv) (vref: ValRef) niceMethodTypars argInfos tagFunction name = + let layoutMemberName (denv: DisplayEnv) (vref: ValRef) niceMethodTypars argInfos tagFunction name withAccessibility = let nameL = ConvertValLogicalNameToDisplayLayout vref.IsBaseVal (tagFunction >> mkNav vref.DefinitionRange >> wordL) name let nameL = if denv.showMemberContainers then @@ -1281,10 +1334,11 @@ module PrintTastMemberOrVals = layoutTyparDecls denv nameL true niceMethodTypars else nameL - let nameL = layoutAccessibility denv vref.Accessibility nameL - nameL + if withAccessibility then layoutAccessibility denv vref.Accessibility nameL + else nameL let prettyLayoutOfMemberShortOption denv typarInst (v: Val) short = + let denv = suppressNullnessAnnotations denv let vref = mkLocalValRef v let membInfo = Option.get vref.MemberInfo let stat = layoutMemberFlags membInfo.MemberFlags @@ -1295,6 +1349,8 @@ module PrintTastMemberOrVals = for _,info in argInfo do info.Attribs <- [] info.Name <- None + let supportAccessModifiersBeforeGetSet = + denv.g.langVersion.SupportsFeature Features.LanguageFeature.AllowAccessModifiersToAutoPropertiesGettersAndSetters let prettyTyparInst, memberL = match membInfo.MemberFlags.MemberKind with @@ -1303,7 +1359,7 @@ module PrintTastMemberOrVals = let resL = if short then tauL else - let nameL = layoutMemberName denv vref niceMethodTypars argInfos tagMember vref.DisplayNameCoreMangled + let nameL = layoutMemberName denv vref niceMethodTypars argInfos tagMember vref.DisplayNameCoreMangled true let nameL = if short then nameL else mkInlineL denv vref.Deref nameL stat --- ((nameL |> addColonL) ^^ tauL) prettyTyparInst, resL @@ -1322,14 +1378,19 @@ module PrintTastMemberOrVals = emptyTyparInst, stat | SynMemberKind.PropertyGet -> + let prefixAccessModifier, withGet = + if supportAccessModifiersBeforeGetSet then + false, WordL.keywordWith ^^ layoutAccessibilityCore denv vref.Accessibility ^^ wordL (tagText "get") + else + true, WordL.keywordWith ^^ wordL (tagText "get") if isNil argInfos then // use error recovery because intellisense on an incomplete file will show this errorR(Error(FSComp.SR.tastInvalidFormForPropertyGetter(), vref.Id.idRange)) - let nameL = layoutMemberName denv vref [] argInfos tagProperty vref.DisplayNameCoreMangled + let nameL = layoutMemberName denv vref [] argInfos tagProperty vref.DisplayNameCoreMangled prefixAccessModifier let nameL = if short then nameL else mkInlineL denv vref.Deref nameL let resL = - if short then nameL --- (WordL.keywordWith ^^ WordL.keywordGet) - else stat --- nameL --- (WordL.keywordWith ^^ WordL.keywordGet) + if short then nameL --- withGet + else stat --- nameL --- withGet emptyTyparInst, resL else let argInfos = @@ -1339,21 +1400,25 @@ module PrintTastMemberOrVals = let prettyTyparInst, niceMethodTypars,tauL = prettyLayoutOfMemberType denv vref typarInst argInfos retTy let resL = if short then - if isNil argInfos then tauL - else tauL --- (WordL.keywordWith ^^ WordL.keywordGet) + tauL --- withGet else - let nameL = layoutMemberName denv vref niceMethodTypars argInfos tagProperty vref.DisplayNameCoreMangled + let nameL = layoutMemberName denv vref niceMethodTypars argInfos tagProperty vref.DisplayNameCoreMangled prefixAccessModifier let nameL = if short then nameL else mkInlineL denv vref.Deref nameL - stat --- ((nameL |> addColonL) ^^ (if isNil argInfos then tauL else tauL --- (WordL.keywordWith ^^ WordL.keywordGet))) + stat --- ((nameL |> addColonL) ^^ (if isNil argInfos && not supportAccessModifiersBeforeGetSet then tauL else tauL --- withGet)) prettyTyparInst, resL | SynMemberKind.PropertySet -> + let prefixAccessModifier, withSet = + if supportAccessModifiersBeforeGetSet then + false, WordL.keywordWith ^^ layoutAccessibilityCore denv vref.Accessibility ^^ wordL (tagText "set") + else + true, WordL.keywordWith ^^ wordL (tagText "set") if argInfos.Length <> 1 || isNil argInfos.Head then // use error recovery because intellisense on an incomplete file will show this errorR(Error(FSComp.SR.tastInvalidFormForPropertySetter(), vref.Id.idRange)) - let nameL = layoutMemberName denv vref [] argInfos tagProperty vref.DisplayNameCoreMangled + let nameL = layoutMemberName denv vref [] argInfos tagProperty vref.DisplayNameCoreMangled prefixAccessModifier let nameL = if short then nameL else mkInlineL denv vref.Deref nameL - let resL = stat --- nameL --- (WordL.keywordWith ^^ WordL.keywordSet) + let resL = stat --- nameL --- withSet emptyTyparInst, resL else let curriedArgInfos = argInfos @@ -1361,11 +1426,11 @@ module PrintTastMemberOrVals = let prettyTyparInst, niceMethodTypars, tauL = prettyLayoutOfMemberType denv vref typarInst (if isNil argInfos then [] else [argInfos]) (fst valueInfo) let resL = if short then - (tauL --- (WordL.keywordWith ^^ WordL.keywordSet)) + (tauL --- withSet) else - let nameL = layoutMemberName denv vref niceMethodTypars curriedArgInfos tagProperty vref.DisplayNameCoreMangled + let nameL = layoutMemberName denv vref niceMethodTypars curriedArgInfos tagProperty vref.DisplayNameCoreMangled prefixAccessModifier let nameL = if short then nameL else mkInlineL denv vref.Deref nameL - stat --- ((nameL |> addColonL) ^^ (tauL --- (WordL.keywordWith ^^ WordL.keywordSet))) + stat --- ((nameL |> addColonL) ^^ (tauL --- withSet)) prettyTyparInst, resL prettyTyparInst, memberL @@ -1607,22 +1672,44 @@ module InfoMemberPrinting = let idL = ConvertValLogicalNameToDisplayLayout false (tagMethod >> tagNavArbValRef minfo.ArbitraryValRef >> wordL) minfo.LogicalName SepL.dot ^^ PrintTypes.layoutTyparDecls denv idL true minfo.FormalMethodTypars ^^ - SepL.leftParen + SepL.leftParen + + let layout,paramLayouts = + match denv.showCsharpCodeAnalysisAttributes, minfo with + | true, ILMeth(_g,mi,_e) -> + let methodLayout = + // Render Method attributes and [return:..] attributes on separate lines above (@@) the method definition + PrintTypes.layoutCsharpCodeAnalysisIlAttributes denv (minfo.GetCustomAttrs()) (squareAngleL >> (@@)) layout + |> PrintTypes.layoutCsharpCodeAnalysisIlAttributes denv (mi.RawMetadata.Return.CustomAttrs) (squareAngleReturn >> (@@)) + let paramLayouts = + minfo.GetParamDatas (amap, m, minst) + |> List.head + |> List.zip (mi.ParamMetadata) + |> List.map(fun (ilParams,paramData) -> + layoutParamData denv paramData + // Render parameter attributes next to (^^) the parameter definition + |> PrintTypes.layoutCsharpCodeAnalysisIlAttributes denv (ilParams.CustomAttrs) (squareAngleL >> (^^)) ) + methodLayout,paramLayouts + | _ -> + layout, + minfo.GetParamDatas (amap, m, minst) + |> List.concat + |> List.map (layoutParamData denv) - let paramDatas = minfo.GetParamDatas (amap, m, minst) - let layout = layout ^^ sepListL RightL.comma ((List.concat >> List.map (layoutParamData denv)) paramDatas) - layout ^^ RightL.rightParen ^^ WordL.colon ^^ PrintTypes.layoutType denv retTy + + let layout = layout ^^ sepListL RightL.comma paramLayouts + layout ^^ RightL.rightParen ^^ WordL.colon ^^ PrintTypes.layoutType denv retTy // Todo enrich return type // Prettify an ILMethInfo let prettifyILMethInfo (amap: Import.ImportMap) m (minfo: MethInfo) typarInst ilMethInfo = - let (ILMethInfo(_, apparentTy, dty, mdef, _)) = ilMethInfo - let (prettyTyparInst, prettyTys), _ = PrettyTypes.PrettifyInstAndTypes amap.g (typarInst, (apparentTy :: minfo.FormalMethodInst)) + let (ILMethInfo(_, methodsType, mdef, _)) = ilMethInfo + let (prettyTyparInst, prettyTys), _ = PrettyTypes.PrettifyInstAndTypes amap.g (typarInst, (methodsType.ToType :: minfo.FormalMethodInst)) match prettyTys with | prettyApparentTy :: prettyFormalMethInst -> let prettyMethInfo = - match dty with - | None -> MethInfo.CreateILMeth (amap, m, prettyApparentTy, mdef) - | Some declaringTyconRef -> MethInfo.CreateILExtensionMeth(amap, m, prettyApparentTy, declaringTyconRef, minfo.ExtensionMemberPriorityOption, mdef) + match methodsType with + | IlType _ -> MethInfo.CreateILMeth (amap, m, prettyApparentTy, mdef) + | CSharpStyleExtension(declaring=declaringTyconRef) -> MethInfo.CreateILExtensionMeth(amap, m, prettyApparentTy, declaringTyconRef, minfo.ExtensionMemberPriorityOption, mdef) prettyTyparInst, prettyMethInfo, prettyFormalMethInst | _ -> failwith "prettifyILMethInfo - prettyTys empty" @@ -1647,7 +1734,7 @@ module InfoMemberPrinting = // // For C# extension members: // ApparentContainer.Method(argName1: argType1, ..., argNameN: argTypeN) : retType - let prettyLayoutOfMethInfoFreeStyle (infoReader: InfoReader) m denv typarInst methInfo = + let rec prettyLayoutOfMethInfoFreeStyle (infoReader: InfoReader) m denv typarInst methInfo = let amap = infoReader.amap match methInfo with @@ -1658,6 +1745,12 @@ module InfoMemberPrinting = | FSMeth(_, _, vref, _) -> let prettyTyparInst, resL = PrintTastMemberOrVals.prettyLayoutOfValOrMember { denv with showMemberContainers=true } infoReader typarInst vref prettyTyparInst, resL + | MethInfoWithModifiedReturnType(ILMeth(_, ilminfo, _) as wrappedInfo,retTy) -> + let prettyTyparInst, prettyMethInfo, minst = prettifyILMethInfo amap m wrappedInfo typarInst ilminfo + let prettyMethInfo = MethInfoWithModifiedReturnType(prettyMethInfo,retTy) + let resL = layoutMethInfoCSharpStyle amap m denv prettyMethInfo minst + prettyTyparInst, resL + | MethInfoWithModifiedReturnType(mi,_) -> prettyLayoutOfMethInfoFreeStyle infoReader m denv typarInst mi | ILMeth(_, ilminfo, _) -> let prettyTyparInst, prettyMethInfo, minst = prettifyILMethInfo amap m methInfo typarInst ilminfo let resL = layoutMethInfoCSharpStyle amap m denv prettyMethInfo minst @@ -1673,14 +1766,20 @@ module InfoMemberPrinting = let retTy = if pinfo.IsIndexer then mkFunTy g (mkRefTupledTy g (pinfo.GetParamTypes(amap, m))) retTy else retTy let retTy, _ = PrettyTypes.PrettifyType g retTy let nameL = ConvertValLogicalNameToDisplayLayout false (tagProperty >> tagNavArbValRef pinfo.ArbitraryValRef >> wordL) pinfo.PropertyName + let struct(isGetterProtect, isSetterProtect) = pinfo.IsProtectedAccessibility + let getterAccess, setterAccess = + if denv.g.langVersion.SupportsFeature Features.LanguageFeature.AllowAccessModifiersToAutoPropertiesGettersAndSetters then + PrintTypes.layoutAccessibilityCoreWithProtected denv isGetterProtect (Option.defaultValue taccessPublic pinfo.GetterAccessibility), + PrintTypes.layoutAccessibilityCoreWithProtected denv isSetterProtect (Option.defaultValue taccessPublic pinfo.SetterAccessibility) + else emptyL, emptyL let getterSetter = match pinfo.HasGetter, pinfo.HasSetter with | true, false -> - WordL.keywordWith ^^ WordL.keywordGet + WordL.keywordWith ^^ getterAccess ^^ wordL (tagText "get") | false, true -> - WordL.keywordWith ^^ WordL.keywordSet + WordL.keywordWith ^^ setterAccess ^^ wordL (tagText "set") | true, true -> - WordL.keywordWith ^^ wordL (tagText "get, set") + WordL.keywordWith ^^ getterAccess ^^ wordL (tagText "get") ^^ RightL.comma ++ setterAccess ^^ wordL (tagText "set") | false, false -> emptyL @@ -1817,14 +1916,11 @@ module TastDefinitionPrinting = let layoutPropInfo denv (infoReader: InfoReader) m (pinfo: PropInfo) : Layout list = let amap = infoReader.amap - let isPublicGetterSetter (getter: MethInfo) (setter: MethInfo) = - let isPublicAccess access = access = TAccess [] - match getter.ArbitraryValRef, setter.ArbitraryValRef with - | Some gRef, Some sRef -> isPublicAccess gRef.Accessibility && isPublicAccess sRef.Accessibility - | _ -> false - + let supportAccessModifiersBeforeGetSet = + denv.g.langVersion.SupportsFeature Features.LanguageFeature.AllowAccessModifiersToAutoPropertiesGettersAndSetters + match pinfo.ArbitraryValRef with - | Some vref -> + | Some vref when not supportAccessModifiersBeforeGetSet -> match pinfo with | DifferentGetterAndSetter(getValRef, setValRef) -> let getSuffix = if pinfo.IsIndexer then emptyL else WordL.keywordWith ^^ WordL.keywordGet @@ -1833,11 +1929,37 @@ module TastDefinitionPrinting = PrintTastMemberOrVals.prettyLayoutOfValOrMemberNoInst denv infoReader setValRef ] | _ -> + let isPublicGetterSetter (getter: MethInfo) (setter: MethInfo) = + let isPublicAccess access = access = TAccess [] + match getter.ArbitraryValRef, setter.ArbitraryValRef with + | Some gRef, Some sRef -> isPublicAccess gRef.Accessibility && isPublicAccess sRef.Accessibility + | _ -> false + let propL = PrintTastMemberOrVals.prettyLayoutOfValOrMemberNoInst denv infoReader vref - if pinfo.HasGetter && pinfo.HasSetter && not pinfo.IsIndexer && isPublicGetterSetter pinfo.GetterMethod pinfo.SetterMethod then + if pinfo.HasGetter && pinfo.HasSetter && not pinfo.IsIndexer && isPublicGetterSetter pinfo.GetterMethod pinfo.SetterMethod then [ propL ^^ WordL.keywordWith ^^ wordL (tagText "get, set") ] else [ propL ] + + | Some vref -> + let propL = PrintTastMemberOrVals.prettyLayoutOfValOrMemberNoInst denv infoReader vref + if pinfo.HasGetter && pinfo.HasSetter then + let rec ``replace 'with'`` layout newLayout = + match layout with + | Node(Leaf (text = text), _, _) when text.Text = "with" -> newLayout + | Node(l, r, i) -> Node(l, ``replace 'with'`` r newLayout , i) + | Attr(text, attr, l) -> Attr(text, attr, ``replace 'with'`` l newLayout ) + | Leaf _ + | ObjLeaf _ -> layout + + let getterAccess, setterAccess = + pinfo.GetterMethod.ArbitraryValRef |> Option.map _.Accessibility |> Option.defaultValue taccessPublic, + pinfo.SetterMethod.ArbitraryValRef |> Option.map _.Accessibility |> Option.defaultValue taccessPublic + let getSet = + WordL.keywordWith ^^ layoutAccessibilityCore denv getterAccess ^^ wordL (tagText "get") ^^ RightL.comma --- layoutAccessibilityCore denv setterAccess ^^ wordL (tagText "set") + [ ``replace 'with'`` propL getSet ] + else + [ propL ] | None -> let modifierAndMember = @@ -2747,6 +2869,8 @@ let prettyLayoutOfInstAndSig denv x = PrintTypes.prettyLayoutOfInstAndSig denv x let minimalStringsOfTwoTypes denv ty1 ty2 = let (ty1, ty2), tpcs = PrettyTypes.PrettifyTypePair denv.g (ty1, ty2) + let denv = suppressNullnessAnnotations denv + // try denv + no type annotations let attempt1 = let denv = { denv with showInferenceTyparAnnotations=false; showStaticallyResolvedTyparAnnotations=false } @@ -2769,6 +2893,7 @@ let minimalStringsOfTwoTypes denv ty1 ty2 = | Some res -> res | None -> + // try denv let attempt3 = let min1 = stringOfTy denv ty1 let min2 = stringOfTy denv ty2 @@ -2794,13 +2919,14 @@ let minimalStringsOfTwoTypes denv ty1 ty2 = let denv = denv.SetOpenPaths [] let denv = { denv with includeStaticParametersInTypeNames=true } let makeName t = - let assemblyName = PrintTypes.layoutAssemblyName denv t |> fun name -> if String.IsNullOrEmpty(name) then "" else sprintf " (%s)" name + let assemblyName = PrintTypes.layoutAssemblyName denv t |> function Null | NonNull "" -> "" | NonNull name -> sprintf " (%s)" name sprintf "%s%s" (stringOfTy denv t) assemblyName (makeName ty1, makeName ty2, stringOfTyparConstraints denv tpcs) // Note: Always show imperative annotations when comparing value signatures let minimalStringsOfTwoValues denv infoReader vref1 vref2 = + let denv = suppressNullnessAnnotations denv let denvMin = { denv with showInferenceTyparAnnotations=true; showStaticallyResolvedTyparAnnotations=false } let min1 = buildString (fun buf -> outputQualifiedValOrMember denvMin infoReader buf vref1) let min2 = buildString (fun buf -> outputQualifiedValOrMember denvMin infoReader buf vref2) @@ -2814,5 +2940,6 @@ let minimalStringsOfTwoValues denv infoReader vref1 vref2 = let minimalStringOfType denv ty = let ty, _cxs = PrettyTypes.PrettifyType denv.g ty + let denv = suppressNullnessAnnotations denv let denvMin = { denv with showInferenceTyparAnnotations=false; showStaticallyResolvedTyparAnnotations=false } showL (PrintTypes.layoutTypeWithInfoAndPrec denvMin SimplifyTypes.typeSimplificationInfo0 2 ty) diff --git a/src/Compiler/Checking/PatternMatchCompilation.fs b/src/Compiler/Checking/PatternMatchCompilation.fs index a1e9009798d..b45f23407ea 100644 --- a/src/Compiler/Checking/PatternMatchCompilation.fs +++ b/src/Compiler/Checking/PatternMatchCompilation.fs @@ -471,7 +471,7 @@ let computeWhatSuccessfulNullTestImpliesAboutTypeTest g tgtTy2 = Implication.Fails /// Work out what a failing null test implies about a type test (against tgtTy2) for the same -/// input balue. The answer is "nothing" but it's included for symmetry. +/// input value. The answer is "nothing" but it's included for symmetry. let computeWhatFailingNullTestImpliesAboutTypeTest _g _tgtTy2 = Implication.Nothing @@ -509,7 +509,7 @@ let computeWhatSuccessfulTypeTestImpliesAboutTypeTest g amap m tgtTy1 tgtTy2 = // For any inputs where ':? int' succeeds, ':? string' will fail // // - // This only applies if tgtTy2 is not potetnially related to the sealed type tgtTy1: + // This only applies if tgtTy2 is not potentially related to the sealed type tgtTy1: // match x with // | :? int when false -> ... // note: "when false" used so type test succeeds but proceed to next type test // | :? IComparable -> ... @@ -611,7 +611,7 @@ let getDiscrimOfPattern (g: TcGlobals) tpinst t = | TPat_isinst (srcTy, tgtTy, _, _m) -> Some(DecisionTreeTest.IsInst (instType tpinst srcTy, instType tpinst tgtTy)) | TPat_exnconstr(tcref, _, _m) -> - Some(DecisionTreeTest.IsInst (g.exn_ty, mkAppTy tcref [])) + Some(DecisionTreeTest.IsInst (g.exn_ty, mkWoNullAppTy tcref [])) | TPat_const (c, _m) -> Some(DecisionTreeTest.Const c) | TPat_unioncase (c, tyargs', _, _m) -> @@ -1467,7 +1467,7 @@ let CompilePatternBasic | TPat_exnconstr (ecref, argpats, _) -> let srcTy1 = g.exn_ty - let tgtTy1 = mkAppTy ecref [] + let tgtTy1 = mkWoNullAppTy ecref [] if taken |> List.exists (discrimsEq g (DecisionTreeTest.IsInst (srcTy1, tgtTy1))) then [] else match discrim with diff --git a/src/Compiler/Checking/PostInferenceChecks.fs b/src/Compiler/Checking/PostInferenceChecks.fs index c7090709cca..06ef1b9766a 100644 --- a/src/Compiler/Checking/PostInferenceChecks.fs +++ b/src/Compiler/Checking/PostInferenceChecks.fs @@ -28,6 +28,7 @@ open FSharp.Compiler.TypedTreeBasics open FSharp.Compiler.TypedTreeOps open FSharp.Compiler.TypeHierarchy open FSharp.Compiler.TypeRelations +open Import //-------------------------------------------------------------------------- // NOTES: reraise safety checks @@ -334,7 +335,20 @@ let RecordAnonRecdInfo cenv (anonInfo: AnonRecdTypeInfo) = // approx walk of type //-------------------------------------------------------------------------- -let rec CheckTypeDeep (cenv: cenv) (visitTy, visitTyconRefOpt, visitAppTyOpt, visitTraitSolutionOpt, visitTyparOpt as f) (g: TcGlobals) env isInner ty = +/// Represents the container for nester type instantions, carrying information about the parent (generic type) and data about correspinding generic typar definition. +/// For current use, IlGenericParameterDef was enough. For other future use cases, conversion into F# Typar might be needed. +type TypeInstCtx = + | NoInfo + | IlGenericInst of parent:TyconRef * genericArg:ILGenericParameterDef + | TyparInst of parent:TyconRef + | TopLevelAllowingByRef + + with member x.TyparAllowsRefStruct() = + match x with + | IlGenericInst(_,ilTypar) -> ilTypar.HasAllowsRefStruct + | _ -> false + +let rec CheckTypeDeep (cenv: cenv) (visitTy, visitTyconRefOpt, visitAppTyOpt, visitTraitSolutionOpt, visitTyparOpt as f) (g: TcGlobals) env (typeInstParentOpt:TypeInstCtx) ty = // We iterate the _solved_ constraints as well, to pick up any record of trait constraint solutions // This means we walk _all_ the constraints _everywhere_ in a type, including // those attached to _solved_ type variables. This is used by PostTypeCheckSemanticChecks to detect uses of @@ -366,22 +380,30 @@ let rec CheckTypeDeep (cenv: cenv) (visitTy, visitTyconRefOpt, visitAppTyOpt, vi match ty with | TType_forall (tps, body) -> let env = BindTypars g env tps - CheckTypeDeep cenv f g env isInner body + CheckTypeDeep cenv f g env typeInstParentOpt body tps |> List.iter (fun tp -> tp.Constraints |> List.iter (CheckTypeConstraintDeep cenv f g env)) | TType_measure _ -> () | TType_app (tcref, tinst, _) -> match visitTyconRefOpt with - | Some visitTyconRef -> visitTyconRef isInner tcref + | Some visitTyconRef -> visitTyconRef typeInstParentOpt tcref | None -> () // If it's a 'byref<'T>', don't check 'T as an inner. This allows byref>. // 'byref>' is invalid and gets checked in visitAppTy. - if isByrefTyconRef g tcref then - CheckTypesDeepNoInner cenv f g env tinst + //if isByrefTyconRef g tcref then + // CheckTypesDeepNoInner cenv f g env tinst + + if tcref.CanDeref && tcref.IsILTycon && tinst.Length = tcref.ILTyconRawMetadata.GenericParams.Length then + (tinst,tcref.ILTyconRawMetadata.GenericParams) + ||> List.iter2 (fun ty ilGenericParam -> + let typeInstParent = IlGenericInst(tcref, ilGenericParam) + CheckTypeDeep cenv f g env typeInstParent ty) else - CheckTypesDeep cenv f g env tinst + let parentRef = TyparInst(tcref) + for ty in tinst do + CheckTypeDeep cenv f g env parentRef ty match visitAppTyOpt with | Some visitAppTy -> visitAppTy (tcref, tinst) @@ -398,8 +420,8 @@ let rec CheckTypeDeep (cenv: cenv) (visitTy, visitTyconRefOpt, visitAppTyOpt, vi CheckTypesDeep cenv f g env tys | TType_fun (s, t, _) -> - CheckTypeDeep cenv f g env true s - CheckTypeDeep cenv f g env true t + CheckTypeDeep cenv f g env NoInfo s + CheckTypeDeep cenv f g env NoInfo t | TType_var (tp, _) -> if not tp.IsSolved then @@ -410,23 +432,20 @@ let rec CheckTypeDeep (cenv: cenv) (visitTy, visitTyconRefOpt, visitAppTyOpt, vi and CheckTypesDeep cenv f g env tys = for ty in tys do - CheckTypeDeep cenv f g env true ty - -and CheckTypesDeepNoInner cenv f g env tys = - for ty in tys do - CheckTypeDeep cenv f g env false ty + CheckTypeDeep cenv f g env NoInfo ty and CheckTypeConstraintDeep cenv f g env x = match x with - | TyparConstraint.CoercesTo(ty, _) -> CheckTypeDeep cenv f g env true ty + | TyparConstraint.CoercesTo(ty, _) -> CheckTypeDeep cenv f g env NoInfo ty | TyparConstraint.MayResolveMember(traitInfo, _) -> CheckTraitInfoDeep cenv f g env traitInfo - | TyparConstraint.DefaultsTo(_, ty, _) -> CheckTypeDeep cenv f g env true ty + | TyparConstraint.DefaultsTo(_, ty, _) -> CheckTypeDeep cenv f g env NoInfo ty | TyparConstraint.SimpleChoice(tys, _) -> CheckTypesDeep cenv f g env tys - | TyparConstraint.IsEnum(underlyingTy, _) -> CheckTypeDeep cenv f g env true underlyingTy - | TyparConstraint.IsDelegate(argTys, retTy, _) -> CheckTypeDeep cenv f g env true argTys; CheckTypeDeep cenv f g env true retTy + | TyparConstraint.IsEnum(underlyingTy, _) -> CheckTypeDeep cenv f g env NoInfo underlyingTy + | TyparConstraint.IsDelegate(argTys, retTy, _) -> CheckTypeDeep cenv f g env NoInfo argTys; CheckTypeDeep cenv f g env NoInfo retTy | TyparConstraint.SupportsComparison _ | TyparConstraint.SupportsEquality _ | TyparConstraint.SupportsNull _ + | TyparConstraint.NotSupportsNull _ | TyparConstraint.IsNonNullableStruct _ | TyparConstraint.IsUnmanaged _ | TyparConstraint.IsReferenceType _ @@ -435,18 +454,18 @@ and CheckTypeConstraintDeep cenv f g env x = and CheckTraitInfoDeep cenv (_, _, _, visitTraitSolutionOpt, _ as f) g env traitInfo = CheckTypesDeep cenv f g env traitInfo.SupportTypes CheckTypesDeep cenv f g env traitInfo.CompiledObjectAndArgumentTypes - Option.iter (CheckTypeDeep cenv f g env true ) traitInfo.CompiledReturnType + Option.iter (CheckTypeDeep cenv f g env NoInfo ) traitInfo.CompiledReturnType match visitTraitSolutionOpt, traitInfo.Solution with | Some visitTraitSolution, Some sln -> visitTraitSolution sln | _ -> () /// Check for byref-like types let CheckForByrefLikeType cenv env m ty check = - CheckTypeDeep cenv (ignore, Some (fun _deep tcref -> if isByrefLikeTyconRef cenv.g m tcref then check()), None, None, None) cenv.g env false ty + CheckTypeDeep cenv (ignore, Some (fun ctx tcref -> if (isByrefLikeTyconRef cenv.g m tcref && not(ctx.TyparAllowsRefStruct())) then check()), None, None, None) cenv.g env NoInfo ty /// Check for byref types let CheckForByrefType cenv env ty check = - CheckTypeDeep cenv (ignore, Some (fun _deep tcref -> if isByrefTyconRef cenv.g tcref then check()), None, None, None) cenv.g env false ty + CheckTypeDeep cenv (ignore, Some (fun _ctx tcref -> if isByrefTyconRef cenv.g tcref then check()), None, None, None) cenv.g env NoInfo ty /// check captures under lambdas /// @@ -457,7 +476,7 @@ let CheckEscapes cenv allowProtected m syntacticArgs body = (* m is a range suit if cenv.reportErrors then let cantBeFree (v: Val) = // If v is a syntactic argument, then it can be free since it was passed in. - // The following can not be free: + // The following cannot be free: // a) BaseVal can never escape. // b) Byref typed values can never escape. // Note that: Local mutables can be free, as they will be boxed later. @@ -478,7 +497,7 @@ let CheckEscapes cenv allowProtected m syntacticArgs body = (* m is a range suit if (isByrefLikeTy cenv.g m v.Type) then // Inner functions are not guaranteed to compile to method with a predictable arity (number of arguments). // As such, partial applications involving byref arguments could lead to closures containing byrefs. - // For safety, such functions are assumed to have no known arity, and so can not accept byrefs. + // For safety, such functions are assumed to have no known arity, and so cannot accept byrefs. errorR(Error(FSComp.SR.chkByrefUsedInInvalidWay(v.DisplayName), m)) elif v.IsBaseVal then @@ -515,7 +534,7 @@ let CheckTypeForAccess (cenv: cenv) env objName valAcc m ty = if isLessAccessible tyconAcc valAcc then errorR(Error(FSComp.SR.chkTypeLessAccessibleThanType(tcref.DisplayName, (objName())), m)) - CheckTypeDeep cenv (visitType, None, None, None, None) cenv.g env false ty + CheckTypeDeep cenv (visitType, None, None, None, None) cenv.g env NoInfo ty let WarnOnWrongTypeForAccess (cenv: cenv) env objName valAcc m ty = if cenv.reportErrors then @@ -533,7 +552,7 @@ let WarnOnWrongTypeForAccess (cenv: cenv) env objName valAcc m ty = let warningText = errorText + Environment.NewLine + FSComp.SR.tcTypeAbbreviationsCheckedAtCompileTime() warning(AttributeChecking.ObsoleteWarning(warningText, m)) - CheckTypeDeep cenv (visitType, None, None, None, None) cenv.g env false ty + CheckTypeDeep cenv (visitType, None, None, None, None) cenv.g env NoInfo ty /// Indicates whether a byref or byref-like type is permitted at a particular location [] @@ -628,16 +647,26 @@ let CheckTypeAux permitByRefLike (cenv: cenv) env m ty onInnerByrefError = else errorR (Error(FSComp.SR.checkNotSufficientlyGenericBecauseOfScope(tp.DisplayName), m)) - let visitTyconRef isInner tcref = + let visitTyconRef (ctx:TypeInstCtx) tcref = + let checkInner() = + match ctx with + | TopLevelAllowingByRef -> false + | TyparInst(parentTcRef) + | IlGenericInst(parentTcRef,_) when isByrefTyconRef cenv.g parentTcRef -> false + | _ -> true + + let isInnerByRefLike() = checkInner() && isByrefLikeTyconRef cenv.g m tcref + + let permitByRefLike = + if ctx.TyparAllowsRefStruct() then PermitByRefType.All else permitByRefLike - let isInnerByRefLike = isInner && isByrefLikeTyconRef cenv.g m tcref match permitByRefLike with | PermitByRefType.None when isByrefLikeTyconRef cenv.g m tcref -> errorR(Error(FSComp.SR.chkErrorUseOfByref(), m)) - | PermitByRefType.NoInnerByRefLike when isInnerByRefLike -> + | PermitByRefType.NoInnerByRefLike when isInnerByRefLike() -> onInnerByrefError () - | PermitByRefType.SpanLike when isByrefTyconRef cenv.g tcref || isInnerByRefLike -> + | PermitByRefType.SpanLike when isByrefTyconRef cenv.g tcref || isInnerByRefLike() -> onInnerByrefError () | _ -> () @@ -664,7 +693,13 @@ let CheckTypeAux permitByRefLike (cenv: cenv) env m ty onInnerByrefError = cenv.potentialUnboundUsesOfVals <- cenv.potentialUnboundUsesOfVals.Add(vref.Stamp, m) | _ -> () - CheckTypeDeep cenv (ignore, Some visitTyconRef, Some visitAppTy, Some visitTraitSolution, Some visitTyar) cenv.g env false ty + let initialCtx = + match permitByRefLike with + | PermitByRefType.SpanLike + | PermitByRefType.NoInnerByRefLike -> TopLevelAllowingByRef + | _ -> NoInfo + + CheckTypeDeep cenv (ignore, Some visitTyconRef, Some visitAppTy, Some visitTraitSolution, Some visitTyar) cenv.g env initialCtx ty let CheckType permitByRefLike cenv env m ty = CheckTypeAux permitByRefLike cenv env m ty (fun () -> errorR(Error(FSComp.SR.chkErrorUseOfByref(), m))) @@ -702,10 +737,6 @@ let CheckNoReraise cenv freesOpt (body: Expr) = if fvs.UsesUnboundRethrow then errorR(Error(FSComp.SR.chkErrorContainsCallToRethrow(), body.Range)) -/// Check if a function is a quotation splice operator -let isSpliceOperator g v = valRefEq g v g.splice_expr_vref || valRefEq g v g.splice_raw_expr_vref - - /// Examples: /// I & I => ExactlyEqual. /// I & I => NotEqual. @@ -775,8 +806,8 @@ let rec CheckExprNoByrefs cenv env expr = and CheckValRef (cenv: cenv) (env: env) v m (ctxt: PermitByRefExpr) = if cenv.reportErrors then - if isSpliceOperator cenv.g v && not env.quote then errorR(Error(FSComp.SR.chkSplicingOnlyInQuotations(), m)) - if isSpliceOperator cenv.g v then errorR(Error(FSComp.SR.chkNoFirstClassSplicing(), m)) + if cenv.g.isSpliceOperator v && not env.quote then errorR(Error(FSComp.SR.chkSplicingOnlyInQuotations(), m)) + if cenv.g.isSpliceOperator v then errorR(Error(FSComp.SR.chkNoFirstClassSplicing(), m)) if valRefEq cenv.g v cenv.g.addrof_vref then errorR(Error(FSComp.SR.chkNoFirstClassAddressOf(), m)) if valRefEq cenv.g v cenv.g.reraise_vref then errorR(Error(FSComp.SR.chkNoFirstClassRethrow(), m)) if valRefEq cenv.g v cenv.g.nameof_vref then errorR(Error(FSComp.SR.chkNoFirstClassNameOf(), m)) @@ -1191,7 +1222,7 @@ and CheckExpr (cenv: cenv) (env: env) origExpr (ctxt: PermitByRefExpr) : Limit = NoLimit // Allow '%expr' in quotations - | Expr.App (Expr.Val (vref, _, _), _, tinst, [arg], m) when isSpliceOperator g vref && env.quote -> + | Expr.App (Expr.Val (vref, _, _), _, tinst, [arg], m) when g.isSpliceOperator vref && env.quote -> CheckSpliceApplication cenv env (tinst, arg, m) // Check an application @@ -1461,9 +1492,31 @@ and CheckExprOp cenv env (op, tyargs, args, m) ctxt expr = CombineTwoLimits limit1 limit2 | TOp.ILCall (_, _, _, _, _, _, _, ilMethRef, enclTypeInst, methInst, retTypes), _, _ -> + CheckTypeInstNoByrefs cenv env m tyargs - CheckTypeInstNoByrefs cenv env m enclTypeInst - CheckTypeInstNoByrefs cenv env m methInst + + match enclTypeInst,methInst with + | [],[] -> () + | enclTypeInst,methInst -> + let tyconRef = ImportILTypeRef cenv.amap m ilMethRef.DeclaringTypeRef + match tyconRef.TypeReprInfo with + | TILObjectRepr(TILObjectReprData(scoref, _, tdef)) -> + (enclTypeInst,tdef.GenericParams) + ||> List.iter2 (fun typeInst typeGeneric -> + if not typeGeneric.HasAllowsRefStruct then + CheckTypeNoByrefs cenv env m typeInst) + + match methInst with + | [] -> () + | methInst -> + let methDef = resolveILMethodRefWithRescope (rescopeILType scoref) tdef ilMethRef + (methInst,methDef.GenericParams) + ||> List.iter2 (fun methInst methGeneric -> + if not methGeneric.HasAllowsRefStruct then + CheckTypeNoByrefs cenv env m methInst) + + | _ -> () + CheckTypeInstNoInnerByrefs cenv env m retTypes // permit byref returns let hasReceiver = @@ -2348,25 +2401,25 @@ let CheckEntityDefn cenv env (tycon: Entity) = ignore isInArg match (optArgInfo, callerInfo) with | _, NoCallerInfo -> () - | NotOptional, _ -> errorR(Error(FSComp.SR.tcCallerInfoNotOptional(callerInfo.ToString()), m)) + | NotOptional, _ -> errorR(Error(FSComp.SR.tcCallerInfoNotOptional(callerInfo |> string), m)) | CallerSide _, CallerLineNumber -> if not (typeEquiv g g.int32_ty ty) then - errorR(Error(FSComp.SR.tcCallerInfoWrongType(callerInfo.ToString(), "int", NicePrint.minimalStringOfType cenv.denv ty), m)) + errorR(Error(FSComp.SR.tcCallerInfoWrongType(callerInfo |> string, "int", NicePrint.minimalStringOfType cenv.denv ty), m)) | CalleeSide, CallerLineNumber -> if not ((isOptionTy g ty) && (typeEquiv g g.int32_ty (destOptionTy g ty))) then - errorR(Error(FSComp.SR.tcCallerInfoWrongType(callerInfo.ToString(), "int", NicePrint.minimalStringOfType cenv.denv (destOptionTy g ty)), m)) + errorR(Error(FSComp.SR.tcCallerInfoWrongType(callerInfo |> string, "int", NicePrint.minimalStringOfType cenv.denv (destOptionTy g ty)), m)) | CallerSide _, CallerFilePath -> if not (typeEquiv g g.string_ty ty) then - errorR(Error(FSComp.SR.tcCallerInfoWrongType(callerInfo.ToString(), "string", NicePrint.minimalStringOfType cenv.denv ty), m)) + errorR(Error(FSComp.SR.tcCallerInfoWrongType(callerInfo |> string, "string", NicePrint.minimalStringOfType cenv.denv ty), m)) | CalleeSide, CallerFilePath -> if not ((isOptionTy g ty) && (typeEquiv g g.string_ty (destOptionTy g ty))) then - errorR(Error(FSComp.SR.tcCallerInfoWrongType(callerInfo.ToString(), "string", NicePrint.minimalStringOfType cenv.denv (destOptionTy g ty)), m)) + errorR(Error(FSComp.SR.tcCallerInfoWrongType(callerInfo |> string, "string", NicePrint.minimalStringOfType cenv.denv (destOptionTy g ty)), m)) | CallerSide _, CallerMemberName -> if not (typeEquiv g g.string_ty ty) then - errorR(Error(FSComp.SR.tcCallerInfoWrongType(callerInfo.ToString(), "string", NicePrint.minimalStringOfType cenv.denv ty), m)) + errorR(Error(FSComp.SR.tcCallerInfoWrongType(callerInfo |> string, "string", NicePrint.minimalStringOfType cenv.denv ty), m)) | CalleeSide, CallerMemberName -> if not ((isOptionTy g ty) && (typeEquiv g g.string_ty (destOptionTy g ty))) then - errorR(Error(FSComp.SR.tcCallerInfoWrongType(callerInfo.ToString(), "string", NicePrint.minimalStringOfType cenv.denv (destOptionTy g ty)), m))) + errorR(Error(FSComp.SR.tcCallerInfoWrongType(callerInfo |> string, "string", NicePrint.minimalStringOfType cenv.denv (destOptionTy g ty)), m))) for pinfo in immediateProps do let nm = pinfo.PropertyName @@ -2532,13 +2585,30 @@ let CheckEntityDefn cenv env (tycon: Entity) = // Check fields. We check these late because we have to have first checked that the structs are // free of cycles - if tycon.IsStructOrEnumTycon then + if g.langFeatureNullness && g.checkNullness then + for f in tycon.AllInstanceFieldsAsList do + let m = f.Range + // Check if it's marked unsafe + let zeroInitUnsafe = TryFindFSharpBoolAttribute g g.attrib_DefaultValueAttribute f.FieldAttribs + if zeroInitUnsafe = Some true then + let ty = f.FormalType + // If the condition is detected because of a variation in logic introduced because + // of nullness checking, then only a warning is emitted. + if not (TypeHasDefaultValueNew g m ty) then + if not (TypeHasDefaultValue g m ty) then + errorR(Error(FSComp.SR.chkValueWithDefaultValueMustHaveDefaultValue(), m)) + else + warning(Error(FSComp.SR.chkValueWithDefaultValueMustHaveDefaultValue(), m)) + + // These are the old rules (not g.langFeatureNullness or not g.checkNullness), mistakenly only applied to structs + elif tycon.IsStructOrEnumTycon then for f in tycon.AllInstanceFieldsAsList do + let m = f.Range // Check if it's marked unsafe let zeroInitUnsafe = TryFindFSharpBoolAttribute g g.attrib_DefaultValueAttribute f.FieldAttribs if zeroInitUnsafe = Some true then - if not (TypeHasDefaultValue g m ty) then - errorR(Error(FSComp.SR.chkValueWithDefaultValueMustHaveDefaultValue(), m)) + if not (TypeHasDefaultValue g m f.FormalType) then + errorR(Error(FSComp.SR.chkValueWithDefaultValueMustHaveDefaultValue(), m)) // Check type abbreviations match tycon.TypeAbbrev with diff --git a/src/Compiler/Checking/QuotationTranslator.fs b/src/Compiler/Checking/QuotationTranslator.fs index 8173c13755f..d5daa377540 100644 --- a/src/Compiler/Checking/QuotationTranslator.fs +++ b/src/Compiler/Checking/QuotationTranslator.fs @@ -214,8 +214,6 @@ let (|ObjectInitializationCheck|_|) g expr = isUnitTy g resultTy -> ValueSome() | _ -> ValueNone -let isSplice g vref = valRefEq g vref g.splice_expr_vref || valRefEq g vref g.splice_raw_expr_vref - let rec EmitDebugInfoIfNecessary cenv env m astExpr : ExprData = // do not emit debug info if emitDebugInfoInQuotations = false or it was already written for the given expression if cenv.emitDebugInfoInQuotations && not (QP.isAttributedExpression astExpr) then @@ -298,7 +296,7 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. match expr with // Detect expression tree exprSplices | Expr.App (InnerExprPat(Expr.Val (vref, _, _)), _, _, x0 :: rest, m) - when isSplice g vref -> + when g.isSpliceOperator vref -> let idx = cenv.exprSplices.Count let ty = tyOfExpr g expr @@ -311,7 +309,7 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. (hole, rest) ||> List.fold (fun fR arg -> QP.mkApp (fR, ConvExpr cenv env arg)) | ModuleValueOrMemberUse g (vref, vFlags, _f, _fTy, tyargs, curriedArgs) - when not (isSplice g vref) -> + when not (g.isSpliceOperator vref) -> let m = expr.Range let numEnclTypeArgs, _, isNewObj, valUseFlags, isSelfInit, takesInstanceArg, isPropGet, isPropSet = @@ -584,7 +582,7 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP. | TOp.ExnConstr tcref, _, args -> let _rgtypR = ConvTyconRef cenv tcref m - let _typ = mkAppTy tcref [] + let _typ = mkWoNullAppTy tcref [] let parentTyconR = ConvTyconRef cenv tcref m let argTys = tcref |> recdFieldsOfExnDefRef |> List.map (fun rfld -> rfld.FormalType) let methArgTypesR = ConvTypes cenv env m argTys @@ -1223,7 +1221,7 @@ and ConvILType cenv env m ty = and TryElimErasableTyconRef cenv m (tcref: TyconRef) = match tcref.TypeReprInfo with // Get the base type - | TProvidedTypeRepr info when info.IsErased -> Some (info.BaseTypeForErased (m, cenv.g.obj_ty)) + | TProvidedTypeRepr info when info.IsErased -> Some (info.BaseTypeForErased (m, cenv.g.obj_ty_withNulls)) | _ -> None #endif diff --git a/src/Compiler/Checking/QuotationTranslator.fsi b/src/Compiler/Checking/QuotationTranslator.fsi index 25567f51a63..1958dde4dc3 100644 --- a/src/Compiler/Checking/QuotationTranslator.fsi +++ b/src/Compiler/Checking/QuotationTranslator.fsi @@ -53,5 +53,3 @@ val (|SimpleArrayLoopBody|_|): TcGlobals -> Expr -> (Expr * TType * Expr) voptio [] val (|ObjectInitializationCheck|_|): TcGlobals -> Expr -> unit voption - -val isSplice: TcGlobals -> ValRef -> bool diff --git a/src/Compiler/Checking/SignatureConformance.fs b/src/Compiler/Checking/SignatureConformance.fs index 08a3be709b4..8e8dc84eb2b 100644 --- a/src/Compiler/Checking/SignatureConformance.fs +++ b/src/Compiler/Checking/SignatureConformance.fs @@ -239,7 +239,7 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = else let aNull2 = TypeNullIsExtraValue g m (generalizedTyconRef g (mkLocalTyconRef implTycon)) - let fNull2 = TypeNullIsExtraValue g m (generalizedTyconRef g (mkLocalTyconRef implTycon)) + let fNull2 = TypeNullIsExtraValue g m (generalizedTyconRef g (mkLocalTyconRef implTycon)) // TODO: should be sigTycon, raises extra errors if aNull2 && not fNull2 then errorR(Error(FSComp.SR.DefinitionsInSigAndImplNotCompatibleImplementationSaysNull2(implTycon.TypeOrMeasureKind.ToString(), implTycon.DisplayName), m)) false diff --git a/src/Compiler/Checking/SignatureHash.fs b/src/Compiler/Checking/SignatureHash.fs index 4acd53e0fad..f3f81b2fee3 100644 --- a/src/Compiler/Checking/SignatureHash.fs +++ b/src/Compiler/Checking/SignatureHash.fs @@ -30,7 +30,7 @@ module internal HashingPrimitives = for i in items do let valHash = func i - // We are calling hashListOrderMatters for things like list of types, list of properties, list of fields etc. The ones which are visibility-hidden will return 0, and are ommited. + // We are calling hashListOrderMatters for things like list of types, list of properties, list of fields etc. The ones which are visibility-hidden will return 0, and are omitted. if valHash <> 0 then acc <- combineHash acc valHash @@ -164,6 +164,7 @@ module rec HashTypes = | TyparConstraint.IsReferenceType _ -> tpHash @@ 11 | TyparConstraint.SimpleChoice(tys, _) -> tpHash @@ 12 @@ (tys |> hashListOrderIndependent (hashTType g)) | TyparConstraint.RequiresDefaultConstructor _ -> tpHash @@ 13 + | TyparConstraint.NotSupportsNull(_) -> tpHash @@ 14 /// Hash type parameter constraints let private hashConstraints (g: TcGlobals) cxs = diff --git a/src/Compiler/Checking/TailCallChecks.fs b/src/Compiler/Checking/TailCallChecks.fs index c373be9eb8a..d23b50716af 100644 --- a/src/Compiler/Checking/TailCallChecks.fs +++ b/src/Compiler/Checking/TailCallChecks.fs @@ -47,8 +47,16 @@ type TailCall = static member YesFromVal (g: TcGlobals) (v: Val) = TailCall.Yes(TailCall.IsVoidRet g v) static member YesFromExpr (g: TcGlobals) (expr: Expr) = + let yesFromTType (t: TType) = + if isUnitTy g t then + TailCall.Yes TailCallReturnType.MustReturnVoid + else + TailCall.Yes TailCallReturnType.NonVoid + match expr with | ValUseAtApp(valRef, _) -> TailCall.Yes(TailCall.IsVoidRet g valRef.Deref) + | Expr.Const(constType = constType) -> yesFromTType constType + | Expr.Match(exprType = exprType) -> yesFromTType exprType | _ -> TailCall.Yes TailCallReturnType.NonVoid member x.AtExprLambda = @@ -195,7 +203,7 @@ let CheckForNonTailRecCall (cenv: cenv) expr (tailCall: TailCall) = && not isCCall && not hasByrefArg - noTailCallBlockers // blockers that will prevent the IL level from emmiting a tail instruction + noTailCallBlockers // blockers that will prevent the IL level from emitting a tail instruction else true diff --git a/src/Compiler/Checking/TailCallChecks.fsi b/src/Compiler/Checking/TailCallChecks.fsi index 2fa3b163755..0600900eb24 100644 --- a/src/Compiler/Checking/TailCallChecks.fsi +++ b/src/Compiler/Checking/TailCallChecks.fsi @@ -6,7 +6,7 @@ open FSharp.Compiler.TypedTree /// Perform the TailCall analysis on the optimized TAST for a file. /// The TAST is traversed analogously to the PostInferenceChecks phase. -/// For functions that are annotated with the [] attribute, a warning is emmitted if they are called in a +/// For functions that are annotated with the [] attribute, a warning is emitted if they are called in a /// non-tailrecursive manner in the recursive scope of the function. /// The ModuleOrNamespaceContents aren't mutated in any way by performing this check. val CheckImplFile: diff --git a/src/Compiler/Checking/TypeHierarchy.fs b/src/Compiler/Checking/TypeHierarchy.fs index a778b516d99..102f36908fe 100644 --- a/src/Compiler/Checking/TypeHierarchy.fs +++ b/src/Compiler/Checking/TypeHierarchy.fs @@ -9,6 +9,7 @@ open FSharp.Compiler open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.DiagnosticsLogger open FSharp.Compiler.Import +open FSharp.Compiler.Import.Nullness open FSharp.Compiler.Features open FSharp.Compiler.Syntax open FSharp.Compiler.SyntaxTreeOps @@ -55,7 +56,10 @@ let GetSuperTypeOfType g amap m ty = let tinst = argsOfAppTy g ty match tdef.Extends with | None -> None - | Some ilTy -> Some (RescopeAndImportILType scoref amap m tinst ilTy) + | Some ilTy -> // 'inherit' can refer to a type which has nullable type arguments (e.g. List) + let typeAttrs = AttributesFromIL(tdef.MetadataIndex,tdef.CustomAttrsStored) + let nullness = {DirectAttributes = typeAttrs; Fallback = FromClass typeAttrs} + Some (RescopeAndImportILType scoref amap m tinst nullness ilTy) | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata -> if isFSharpObjModelTy g ty || isFSharpExceptionTy g ty then @@ -64,7 +68,7 @@ let GetSuperTypeOfType g amap m ty = elif isArrayTy g ty then Some g.system_Array_ty elif isRefTy g ty && not (isObjTy g ty) then - Some g.obj_ty + Some g.obj_ty_noNulls elif isStructTupleTy g ty then Some g.system_Value_ty elif isFSharpStructOrEnumTy g ty then @@ -75,13 +79,19 @@ let GetSuperTypeOfType g amap m ty = elif isStructAnonRecdTy g ty then Some g.system_Value_ty elif isAnonRecdTy g ty then - Some g.obj_ty + Some g.obj_ty_noNulls elif isRecdTy g ty || isUnionTy g ty then - Some g.obj_ty + Some g.obj_ty_noNulls else None - resBeforeNull + match resBeforeNull with + | Some superTy -> + let nullness = nullnessOfTy g ty + let superTyWithNull = addNullnessToTy nullness superTy + Some superTyWithNull + | None -> + None /// Make a type for System.Collections.Generic.IList let mkSystemCollectionsGenericIListTy (g: TcGlobals) ty = @@ -107,9 +117,17 @@ let GetImmediateInterfacesOfMetadataType g amap m skipUnref ty (tcref: TyconRef) // succeeded with more reported. There are pathological corner cases where this // doesn't apply: e.g. for mscorlib interfaces like IComparable, but we can always // assume those are present. - for intfTy in tdef.Implements do - if skipUnref = SkipUnrefInterfaces.No || CanRescopeAndImportILType scoref amap m intfTy then - RescopeAndImportILType scoref amap m tinst intfTy + match tdef.ImplementsCustomAttrs with + | Some attrsList when g.langFeatureNullness && g.checkNullness -> + for (attrs,attrsIdx),intfTy in tdef.Implements |> List.zip attrsList do + if skipUnref = SkipUnrefInterfaces.No || CanRescopeAndImportILType scoref amap m intfTy then + let typeAttrs = AttributesFromIL(attrsIdx,attrs) + let nullness = {DirectAttributes = typeAttrs; Fallback = FromClass typeAttrs} + RescopeAndImportILType scoref amap m tinst nullness intfTy + | _ -> + for intfTy in tdef.Implements do + if skipUnref = SkipUnrefInterfaces.No || CanRescopeAndImportILType scoref amap m intfTy then + RescopeAndImportILTypeSkipNullness scoref amap m tinst intfTy | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata -> for intfTy in tcref.ImmediateInterfaceTypesOfFSharpTycon do instType (mkInstForAppTy g ty) intfTy ] @@ -119,7 +137,7 @@ let GetImmediateInterfacesOfMetadataType g amap m skipUnref ty (tcref: TyconRef) // // NOTE: Anonymous record types are not directly considered to implement IComparable, // IComparable or IEquatable. This is because whether they support these interfaces depend on their -// consitutent types, which may not yet be known in type inference. +// constituent types, which may not yet be known in type inference. let rec GetImmediateInterfacesOfType skipUnref g amap m ty = [ match tryAppTy g ty with @@ -178,15 +196,15 @@ and GetImmediateInterfacesOfMeasureAnnotatedType skipUnref g amap m ty reprTy = intfTy // NOTE: we should really only report the IComparable> interface for measure-annotated types - // if the original type supports IComparable somewhere in the hierarchy, likeiwse IEquatable>. + // if the original type supports IComparable somewhere in the hierarchy, likewise IEquatable>. // // However since F# 2.0 we have always reported these interfaces for all measure-annotated types. //if ExistsInInterfaceHierarchy (typeEquiv g (mkAppTy g.system_GenericIComparable_tcref [reprTy])) skipUnref g amap m ty then - mkAppTy g.system_GenericIComparable_tcref [ty] + mkWoNullAppTy g.system_GenericIComparable_tcref [ty] //if ExistsInInterfaceHierarchy (typeEquiv g (mkAppTy g.system_GenericIEquatable_tcref [reprTy])) skipUnref g amap m ty then - mkAppTy g.system_GenericIEquatable_tcref [ty] + mkWoNullAppTy g.system_GenericIEquatable_tcref [ty] ] // Check for any System.Numerics type in the interface hierarchy @@ -249,11 +267,11 @@ let FoldHierarchyOfTypeAux followInterfaces allowMultiIntfInst skipUnref visitor List.foldBack (loop (ndeep+1)) (GetImmediateInterfacesOfType skipUnref g amap m ty) - (loop ndeep g.obj_ty state) + (loop ndeep g.obj_ty_noNulls state) else match tryDestTyparTy g ty with | ValueSome tp -> - let state = loop (ndeep+1) g.obj_ty state + let state = loop (ndeep+1) g.obj_ty_noNulls state List.foldBack (fun x vacc -> match x with @@ -264,6 +282,7 @@ let FoldHierarchyOfTypeAux followInterfaces allowMultiIntfInst skipUnref visitor | TyparConstraint.IsEnum _ | TyparConstraint.IsDelegate _ | TyparConstraint.SupportsNull _ + | TyparConstraint.NotSupportsNull _ | TyparConstraint.IsNonNullableStruct _ | TyparConstraint.IsUnmanaged _ | TyparConstraint.IsReferenceType _ @@ -349,33 +368,38 @@ let ExistsHeadTypeInEntireHierarchy g amap m typeToSearchFrom tcrefToLookFor = ExistsInEntireHierarchyOfType (HasHeadType g tcrefToLookFor) g amap m AllowMultiIntfInstantiations.Yes typeToSearchFrom /// Read an Abstract IL type from metadata and convert to an F# type. -let ImportILTypeFromMetadata amap m scoref tinst minst ilTy = - RescopeAndImportILType scoref amap m (tinst@minst) ilTy +let ImportILTypeFromMetadata amap m scoref tinst minst nullnessSource ilTy = + RescopeAndImportILType scoref amap m (tinst@minst) nullnessSource ilTy + +/// Read an Abstract IL type from metadata and convert to an F# type, ignoring nullness checking. +let ImportILTypeFromMetadataSkipNullness amap m scoref tinst minst ilTy = + RescopeAndImportILTypeSkipNullness scoref amap m (tinst@minst) ilTy /// Read an Abstract IL type from metadata, including any attributes that may affect the type itself, and convert to an F# type. -let ImportILTypeFromMetadataWithAttributes amap m scoref tinst minst ilTy getCattrs = - let ty = RescopeAndImportILType scoref amap m (tinst@minst) ilTy +let ImportILTypeFromMetadataWithAttributes amap m scoref tinst minst nullnessSource ilTy = + let ty = RescopeAndImportILType scoref amap m (tinst@minst) nullnessSource ilTy + // If the type is a byref and one of attributes from a return or parameter has // - a `IsReadOnlyAttribute` - it's an inref // - a `RequiresLocationAttribute` (in which case it's a `ref readonly`) which we treat as inref, // latter is an ad-hoc fix for https://github.com/dotnet/runtime/issues/94317. if isByrefTy amap.g ty - && (TryFindILAttribute amap.g.attrib_IsReadOnlyAttribute (getCattrs ()) - || TryFindILAttribute amap.g.attrib_RequiresLocationAttribute (getCattrs ())) then + && (TryFindILAttribute amap.g.attrib_IsReadOnlyAttribute (nullnessSource.DirectAttributes.Read()) + || TryFindILAttribute amap.g.attrib_RequiresLocationAttribute (nullnessSource.DirectAttributes.Read())) then mkInByrefTy amap.g (destByrefTy amap.g ty) else ty /// Get the parameter type of an IL method. -let ImportParameterTypeFromMetadata amap m ilTy getCattrs scoref tinst mist = - ImportILTypeFromMetadataWithAttributes amap m scoref tinst mist ilTy getCattrs +let ImportParameterTypeFromMetadata amap m nullnessSource ilTy scoref tinst mist = + ImportILTypeFromMetadataWithAttributes amap m scoref tinst mist nullnessSource ilTy /// Get the return type of an IL method, taking into account instantiations for type, return attributes and method generic parameters, and /// translating 'void' to 'None'. -let ImportReturnTypeFromMetadata amap m ilTy getCattrs scoref tinst minst = +let ImportReturnTypeFromMetadata amap m nullnessSource ilTy scoref tinst minst = match ilTy with | ILType.Void -> None - | retTy -> Some(ImportILTypeFromMetadataWithAttributes amap m scoref tinst minst retTy getCattrs) + | retTy -> Some(ImportILTypeFromMetadataWithAttributes amap m scoref tinst minst nullnessSource retTy ) /// Copy constraints. If the constraint comes from a type parameter associated @@ -400,6 +424,8 @@ let CopyTyparConstraints m tprefInst (tporig: Typar) = TyparConstraint.IsEnum (instType tprefInst underlyingTy, m) | TyparConstraint.SupportsComparison _ -> TyparConstraint.SupportsComparison m + | TyparConstraint.NotSupportsNull _ -> + TyparConstraint.NotSupportsNull m | TyparConstraint.SupportsEquality _ -> TyparConstraint.SupportsEquality m | TyparConstraint.IsDelegate(argTys, retTy, _) -> diff --git a/src/Compiler/Checking/TypeHierarchy.fsi b/src/Compiler/Checking/TypeHierarchy.fsi index 225e6187477..8633f9827f9 100644 --- a/src/Compiler/Checking/TypeHierarchy.fsi +++ b/src/Compiler/Checking/TypeHierarchy.fsi @@ -117,6 +117,17 @@ val ExistsHeadTypeInEntireHierarchy: /// Read an Abstract IL type from metadata and convert to an F# type. val ImportILTypeFromMetadata: + amap: ImportMap -> + m: range -> + scoref: ILScopeRef -> + tinst: TType list -> + minst: TType list -> + nullnessSource: Nullness.NullableAttributesSource -> + ilTy: ILType -> + TType + +/// Read an Abstract IL type from metadata and convert to an F# type, ignoring nullness checking. +val ImportILTypeFromMetadataSkipNullness: amap: ImportMap -> m: range -> scoref: ILScopeRef -> tinst: TType list -> minst: TType list -> ilTy: ILType -> TType /// Read an Abstract IL type from metadata, including any attributes that may affect the type itself, and convert to an F# type. @@ -126,16 +137,16 @@ val ImportILTypeFromMetadataWithAttributes: scoref: ILScopeRef -> tinst: TType list -> minst: TType list -> + nullnessSource: Nullness.NullableAttributesSource -> ilTy: ILType -> - getCattrs: (unit -> ILAttributes) -> TType /// Get the parameter type of an IL method. val ImportParameterTypeFromMetadata: amap: ImportMap -> m: range -> + nullnessSource: Nullness.NullableAttributesSource -> ilTy: ILType -> - getCattrs: (unit -> ILAttributes) -> scoref: ILScopeRef -> tinst: TType list -> mist: TType list -> @@ -146,8 +157,8 @@ val ImportParameterTypeFromMetadata: val ImportReturnTypeFromMetadata: amap: ImportMap -> m: range -> + nullnessSource: Nullness.NullableAttributesSource -> ilTy: ILType -> - getCattrs: (unit -> ILAttributes) -> scoref: ILScopeRef -> tinst: TType list -> minst: TType list -> diff --git a/src/Compiler/Checking/TypeRelations.fs b/src/Compiler/Checking/TypeRelations.fs index 49afd4825b6..16ed5e9f9d3 100644 --- a/src/Compiler/Checking/TypeRelations.fs +++ b/src/Compiler/Checking/TypeRelations.fs @@ -31,7 +31,7 @@ let rec TypeDefinitelySubsumesTypeNoCoercion ndeep g amap m ty1 ty2 = let ty1 = stripTyEqns g ty1 let ty2 = stripTyEqns g ty2 // F# reference types are subtypes of type 'obj' - (typeEquiv g ty1 g.obj_ty && isRefTy g ty2) || + (typeEquiv g ty1 g.obj_ty_ambivalent && isRefTy g ty2) || // Follow the supertype chain (isAppTy g ty2 && isRefTy g ty2 && @@ -138,7 +138,7 @@ let ChooseTyparSolutionAndRange (g: TcGlobals) amap (tp:Typar) = let (maxTy, isRefined), m = let initialTy = match tp.Kind with - | TyparKind.Type -> g.obj_ty + | TyparKind.Type -> g.obj_ty_noNulls | TyparKind.Measure -> TType_measure Measure.One // Loop through the constraints computing the lub (((initialTy, false), m), tp.Constraints) ||> List.fold (fun ((maxTy, isRefined), _) tpc -> @@ -157,7 +157,9 @@ let ChooseTyparSolutionAndRange (g: TcGlobals) amap (tp:Typar) = errorR(Error(FSComp.SR.typrelCannotResolveAmbiguityInPrintf(), m)) (maxTy, isRefined), m | TyparConstraint.SupportsNull m -> - (maxTy, isRefined), m + ((addNullnessToTy KnownWithNull maxTy), isRefined), m + | TyparConstraint.NotSupportsNull m -> + (maxTy, isRefined), m // NOTE: this doesn't "force" non-nullness, since it is the default choice in 'obj' or 'int' | TyparConstraint.SupportsComparison m -> join m g.mk_IComparable_ty, m | TyparConstraint.SupportsEquality m -> diff --git a/src/Compiler/Checking/import.fs b/src/Compiler/Checking/import.fs index 70e07fb26ec..68e3512864b 100644 --- a/src/Compiler/Checking/import.fs +++ b/src/Compiler/Checking/import.fs @@ -163,8 +163,130 @@ let CanImportILTypeRef (env: ImportMap) m (tref: ILTypeRef) = /// /// Prefer the F# abbreviation for some built-in types, e.g. 'string' rather than /// 'System.String', since we prefer the F# abbreviation to the .NET equivalents. -let ImportTyconRefApp (env: ImportMap) tcref tyargs = - env.g.improveType tcref tyargs +let ImportTyconRefApp (env: ImportMap) tcref tyargs nullness = + env.g.improveType tcref tyargs nullness + + +module Nullness = + + open FSharp.Compiler.AbstractIL.Diagnostics + + let arrayWithByte0 = [|0uy|] + let arrayWithByte1 = [|1uy|] + let arrayWithByte2 = [|2uy|] + + let knownAmbivalent = NullnessInfo.AmbivalentToNull |> Nullness.Known + let knownWithoutNull = NullnessInfo.WithoutNull |> Nullness.Known + let knownNullable = NullnessInfo.WithNull |> Nullness.Known + + let mapping byteValue = + match byteValue with + | 0uy -> knownAmbivalent + | 1uy -> knownWithoutNull + | 2uy -> knownNullable + | _ -> + dprintfn "%i was passed to Nullness mapping, this is not a valid value" byteValue + knownAmbivalent + + let isByte (g:TcGlobals) (ilgType:ILType) = + g.ilg.typ_Byte.BasicQualifiedName = ilgType.BasicQualifiedName + + let tryParseAttributeDataToNullableByteFlags (g:TcGlobals) attrData = + match attrData with + | None -> ValueNone + | Some ([ILAttribElem.Byte 0uy],_) -> ValueSome arrayWithByte0 + | Some ([ILAttribElem.Byte 1uy],_) -> ValueSome arrayWithByte1 + | Some ([ILAttribElem.Byte 2uy],_) -> ValueSome arrayWithByte2 + | Some ([ILAttribElem.Array(byteType,listOfBytes)],_) when isByte g byteType -> + listOfBytes + |> Array.ofList + |> Array.choose(function | ILAttribElem.Byte b -> Some b | _ -> None) + |> ValueSome + + | _ -> ValueNone + + [] + type AttributesFromIL = AttributesFromIL of metadataIndex:int * attrs:ILAttributesStored + with + member this.Read() = match this with| AttributesFromIL(idx,attrs) -> attrs.GetCustomAttrs(idx) + member this.GetNullable(g:TcGlobals) = + match g.attrib_NullableAttribute_opt with + | None -> ValueNone + | Some n -> + TryDecodeILAttribute n.TypeRef (this.Read()) + |> tryParseAttributeDataToNullableByteFlags g + + member this.GetNullableContext(g:TcGlobals) = + match g.attrib_NullableContextAttribute_opt with + | None -> ValueNone + | Some n -> + TryDecodeILAttribute n.TypeRef (this.Read()) + |> tryParseAttributeDataToNullableByteFlags g + + [] + type NullableContextSource = + | FromClass of AttributesFromIL + | FromMethodAndClass of methodAttrs:AttributesFromIL * classAttrs:AttributesFromIL + + [] + type NullableAttributesSource = + { DirectAttributes: AttributesFromIL + Fallback : NullableContextSource} + with + member this.GetFlags(g:TcGlobals) = + let fallback = this.Fallback + this.DirectAttributes.GetNullable(g) + |> ValueOption.orElseWith(fun () -> + match fallback with + | FromClass attrs -> attrs.GetNullableContext(g) + | FromMethodAndClass(methodCtx,classCtx) -> + methodCtx.GetNullableContext(g) + |> ValueOption.orElseWith (fun () -> classCtx.GetNullableContext(g))) + |> ValueOption.defaultValue arrayWithByte0 + static member Empty = + let emptyFromIL = AttributesFromIL(0,Given(ILAttributes.Empty)) + {DirectAttributes = emptyFromIL; Fallback = FromClass(emptyFromIL)} + + [] + type NullableFlags = {Data : byte[]; Idx : int } +(* Nullness logic for generic arguments: +The data which comes from NullableAttribute back might be a flat array, or a scalar (which represents a virtual array of unknown size) +The array is passed trough all generic typars depth first , e.g. List,Uri>> + -- see here how the array indexes map to types above: [| 0 1 2 3 4 5 |] +For value types, a value is passed even though it is always 0 +*) + with + member this.GetNullness() = + match this.Data.Length with + // No nullable data nor parent context -> we cannot tell + | 0 -> knownAmbivalent + // A scalar value from attributes, cover type and all it's potential typars + | 1 -> this.Data[0] |> mapping + // We have a bigger array, indexes map to typars in a depth-first fashion + | n when n > this.Idx -> this.Data[this.Idx] |> mapping + // This is an erroneous case, we need more nullnessinfo then the metadata contains + | _ -> + // TODO nullness - once being confident that our bugs are solved and what remains are incoming metadata bugs, remove failwith and replace with dprintfn + // Testing with .NET compilers other then Roslyn producing nullness metadata? + failwithf "Length of Nullable metadata and needs of its processing do not match: %A" this + knownAmbivalent + + member this.Advance() = {Data = this.Data; Idx = this.Idx + 1} + + let inline isSystemNullable (tspec:ILTypeSpec) = + match tspec.Name,tspec.Enclosing with + | "Nullable`1",["System"] -> true + | "System.Nullable`1",[] -> true + | _ -> false + + let inline evaluateFirstOrderNullnessAndAdvance (ilt:ILType) (flags:NullableFlags) = + match ilt with + | ILType.Value tspec when tspec.GenericArgs.IsEmpty -> KnownWithoutNull, flags + // System.Nullable is special-cased in C# spec for nullness metadata. + // You CAN assign 'null' to it, and when boxed, it CAN be boxed to 'null'. + | ILType.Value tspec when isSystemNullable tspec -> KnownWithoutNull, flags + | ILType.Value _ -> KnownWithoutNull, flags.Advance() + | _ -> flags.GetNullness(), flags.Advance() /// Import an IL type as an F# type. let rec ImportILType (env: ImportMap) m tinst ty = @@ -174,24 +296,20 @@ let rec ImportILType (env: ImportMap) m tinst ty = | ILType.Array(bounds, ty) -> let n = bounds.Rank - let elemTy = ImportILType env m tinst ty - mkArrayTy env.g n elemTy m + let elemTy = ImportILType env m tinst ty + mkArrayTy env.g n Nullness.knownAmbivalent elemTy m | ILType.Boxed tspec | ILType.Value tspec -> let tcref = ImportILTypeRef env m tspec.TypeRef - let inst = tspec.GenericArgs |> List.map (ImportILType env m tinst) - ImportTyconRefApp env tcref inst + let inst = tspec.GenericArgs |> List.map (ImportILType env m tinst) + ImportTyconRefApp env tcref inst Nullness.knownAmbivalent | ILType.Byref ty -> mkByrefTy env.g (ImportILType env m tinst ty) - | ILType.Ptr ILType.Void when env.g.voidptr_tcr.CanDeref -> mkVoidPtrTy env.g - | ILType.Ptr ty -> mkNativePtrTy env.g (ImportILType env m tinst ty) - | ILType.FunctionPointer _ -> env.g.nativeint_ty (* failwith "cannot import this kind of type (ptr, fptr)" *) - | ILType.Modified(_, _, ty) -> - // All custom modifiers are ignored + // All custom modifiers are ignored ImportILType env m tinst ty | ILType.TypeVar u16 -> @@ -200,28 +318,69 @@ let rec ImportILType (env: ImportMap) m tinst ty = List.item (int u16) tinst with _ -> error(Error(FSComp.SR.impNotEnoughTypeParamsInScopeWhileImporting(), m)) - ty + + let tyWithNullness = addNullnessToTy Nullness.knownAmbivalent ty + tyWithNullness + +/// Import an IL type as an F# type. +let rec ImportILTypeWithNullness (env: ImportMap) m tinst (nf:Nullness.NullableFlags) ty : struct(TType*Nullness.NullableFlags) = + match ty with + | ILType.Void -> + env.g.unit_ty,nf + + | ILType.Array(bounds, innerTy) -> + let n = bounds.Rank + let (arrayNullness,nf) = Nullness.evaluateFirstOrderNullnessAndAdvance ty nf + let struct(elemTy,nf) = ImportILTypeWithNullness env m tinst nf innerTy + mkArrayTy env.g n arrayNullness elemTy m, nf + + | ILType.Boxed tspec | ILType.Value tspec -> + let tcref = ImportILTypeRef env m tspec.TypeRef + let (typeRefNullness,nf) = Nullness.evaluateFirstOrderNullnessAndAdvance ty nf + let struct(inst,nullableFlagsLeft) = (nf,tspec.GenericArgs) ||> List.vMapFold (fun nf current -> ImportILTypeWithNullness env m tinst nf current ) + + ImportTyconRefApp env tcref inst typeRefNullness, nullableFlagsLeft + + | ILType.Byref ty -> + let struct(ttype,nf) = ImportILTypeWithNullness env m tinst nf ty + mkByrefTy env.g ttype, nf + + | ILType.Ptr ILType.Void when env.g.voidptr_tcr.CanDeref -> mkVoidPtrTy env.g, nf + + | ILType.Ptr ty -> + let struct(ttype,nf) = ImportILTypeWithNullness env m tinst nf ty + mkNativePtrTy env.g ttype, nf + + | ILType.FunctionPointer _ -> env.g.nativeint_ty, nf (* failwith "cannot import this kind of type (ptr, fptr)" *) + + | ILType.Modified(_, _, ty) -> + // All custom modifiers are ignored + ImportILTypeWithNullness env m tinst nf ty + + | ILType.TypeVar u16 -> + let ttype = + try + List.item (int u16) tinst + with _ -> + error(Error(FSComp.SR.impNotEnoughTypeParamsInScopeWhileImporting(), m)) + + let (typeVarNullness,nf) = Nullness.evaluateFirstOrderNullnessAndAdvance ty nf + addNullnessToTy typeVarNullness ttype, nf /// Determines if an IL type can be imported as an F# type let rec CanImportILType (env: ImportMap) m ty = match ty with | ILType.Void -> true - | ILType.Array(_bounds, ety) -> CanImportILType env m ety - | ILType.Boxed tspec | ILType.Value tspec -> CanImportILTypeRef env m tspec.TypeRef && tspec.GenericArgs |> List.forall (CanImportILType env m) | ILType.Byref ety -> CanImportILType env m ety - | ILType.Ptr ety -> CanImportILType env m ety - | ILType.FunctionPointer _ -> true - | ILType.Modified(_, _, ety) -> CanImportILType env m ety - | ILType.TypeVar _u16 -> true #if !NO_TYPEPROVIDERS @@ -286,7 +445,9 @@ let rec ImportProvidedType (env: ImportMap) (m: range) (* (tinst: TypeInst) *) ( let g = env.g if st.PUntaint((fun st -> st.IsArray), m) then let elemTy = ImportProvidedType env m (* tinst *) (st.PApply((fun st -> st.GetElementType()), m)) - mkArrayTy g (st.PUntaint((fun st -> st.GetArrayRank()), m)) elemTy m + // TODO Nullness - integration into type providers as a separate feature for later. + let nullness = Nullness.knownAmbivalent + mkArrayTy g (st.PUntaint((fun st -> st.GetArrayRank()), m)) nullness elemTy m elif st.PUntaint((fun st -> st.IsByRef), m) then let elemTy = ImportProvidedType env m (* tinst *) (st.PApply((fun st -> st.GetElementType()), m)) mkByrefTy g elemTy @@ -358,7 +519,10 @@ let rec ImportProvidedType (env: ImportMap) (m: range) (* (tinst: TypeInst) *) ( else genericArg) - ImportTyconRefApp env tcref genericArgs + // TODO Nullness - integration into type providers as a separate feature for later. + let nullness = Nullness.knownAmbivalent + + ImportTyconRefApp env tcref genericArgs nullness /// Import a provided method reference as an Abstract IL method reference let ImportProvidedMethodBaseAsILMethodRef (env: ImportMap) (m: range) (mbase: Tainted) = @@ -409,6 +573,7 @@ let ImportProvidedMethodBaseAsILMethodRef (env: ImportMap) (m: range) (mbase: Ta let formalParamTysAfterInst = [ for p in ctor.PApplyArray((fun x -> x.GetParameters()), "GetParameters", m) do let ilFormalTy = ImportProvidedTypeAsILType env m (p.PApply((fun p -> p.ParameterType), m)) + // TODO Nullness - integration into type providers as a separate feature for later. yield ImportILType env m actualGenericArgs ilFormalTy ] (formalParamTysAfterInst, actualParamTys) ||> List.lengthsEqAndForall2 (typeEquiv env.g)) @@ -455,7 +620,7 @@ let ImportProvidedMethodBaseAsILMethodRef (env: ImportMap) (m: range) (mbase: Ta /// /// Fixup the constraints so that any references to the generic parameters /// in the constraints now refer to the new generic parameters. -let ImportILGenericParameters amap m scoref tinst (gps: ILGenericParameterDefs) = +let ImportILGenericParameters amap m scoref tinst (nullableFallback:Nullness.NullableContextSource) (gps: ILGenericParameterDefs) = match gps with | [] -> [] | _ -> @@ -465,8 +630,22 @@ let ImportILGenericParameters amap m scoref tinst (gps: ILGenericParameterDefs) let tptys = tps |> List.map mkTyparTy let importInst = tinst@tptys (tps, gps) ||> List.iter2 (fun tp gp -> + if gp.Variance = ILGenericVariance.ContraVariant then + tp.MarkAsContravariant() let constraints = - [ if gp.CustomAttrs |> TryFindILAttribute amap.g.attrib_IsUnmanagedAttribute then + [ + if amap.g.langFeatureNullness && amap.g.checkNullness then + let nullness = + { Nullness.DirectAttributes = Nullness.AttributesFromIL(gp.MetadataIndex,gp.CustomAttrsStored) + Nullness.Fallback = nullableFallback } + + match nullness.GetFlags(amap.g) with + | [|1uy|] -> TyparConstraint.NotSupportsNull(m) + // In F#, 'SupportsNull' has the meaning of "must support null as a value". In C#, Nullable(2) is an allowance, not a requirement. + //| [|2uy|] -> TyparConstraint.SupportsNull(m) + | _ -> () + + if gp.CustomAttrs |> TryFindILAttribute amap.g.attrib_IsUnmanagedAttribute then TyparConstraint.IsUnmanaged(m) if gp.HasDefaultConstructorConstraint then TyparConstraint.RequiresDefaultConstructor(m) @@ -517,13 +696,15 @@ let rec ImportILTypeDef amap m scoref (cpath: CompilationPath) enc nm (tdef: ILT ImportILTypeDefs amap m scoref cpath (enc@[tdef]) tdef.NestedTypes ) + let nullableFallback = Nullness.FromClass(Nullness.AttributesFromIL(tdef.MetadataIndex,tdef.CustomAttrsStored)) + // Add the type itself. Construct.NewILTycon (Some cpath) (nm, m) // The read of the type parameters may fail to resolve types. We pick up a new range from the point where that read is forced // Make sure we reraise the original exception one occurs - see findOriginalException. - (LazyWithContext.Create((fun m -> ImportILGenericParameters amap m scoref [] tdef.GenericParams), findOriginalException)) + (LazyWithContext.Create((fun m -> ImportILGenericParameters amap m scoref [] nullableFallback tdef.GenericParams), findOriginalException)) (scoref, enc, tdef) (MaybeLazy.Lazy lazyModuleOrNamespaceTypeForNestedTypes) @@ -705,9 +886,21 @@ let ImportILAssembly(amap: unit -> ImportMap, m, auxModuleLoader, xmlDocInfoLoad //------------------------------------------------------------------------- /// Import an IL type as an F# type. importInst gives the context for interpreting type variables. -let RescopeAndImportILType scoref amap m importInst ilTy = +let RescopeAndImportILTypeSkipNullness scoref amap m importInst ilTy = ilTy |> rescopeILType scoref |> ImportILType amap m importInst +let RescopeAndImportILType scoref (amap:ImportMap) m importInst (nullnessSource:Nullness.NullableAttributesSource) ilTy = + let g = amap.g + if g.langFeatureNullness && g.checkNullness then + let flags = nullnessSource.GetFlags(g) + let flags = {Nullness.NullableFlags.Data = flags; Nullness.NullableFlags.Idx = 0} + let struct(ty,_) = ilTy |> rescopeILType scoref |> ImportILTypeWithNullness amap m importInst flags + ty + else + RescopeAndImportILTypeSkipNullness scoref amap m importInst ilTy + + + let CanRescopeAndImportILType scoref amap m ilTy = ilTy |> rescopeILType scoref |> CanImportILType amap m diff --git a/src/Compiler/Checking/import.fsi b/src/Compiler/Checking/import.fsi index 830fd81b12d..fb1f191effc 100644 --- a/src/Compiler/Checking/import.fsi +++ b/src/Compiler/Checking/import.fsi @@ -51,6 +51,26 @@ type ImportMap = /// The TcGlobals for the import context member g: TcGlobals +module Nullness = + + [] + type AttributesFromIL = + | AttributesFromIL of metadataIndex: int * attrs: ILAttributesStored + + member Read: unit -> ILAttributes + + [] + type NullableContextSource = + | FromClass of AttributesFromIL + | FromMethodAndClass of methodAttrs: AttributesFromIL * classAttrs: AttributesFromIL + + [] + type NullableAttributesSource = + { DirectAttributes: AttributesFromIL + Fallback: NullableContextSource } + + static member Empty: NullableAttributesSource + /// Import a reference to a type definition, given an AbstractIL ILTypeRef, with caching val internal ImportILTypeRef: ImportMap -> range -> ILTypeRef -> TyconRef @@ -79,7 +99,13 @@ val internal ImportProvidedMethodBaseAsILMethodRef: ImportMap -> range -> Tainte /// Import a set of Abstract IL generic parameter specifications as a list of new F# generic parameters. val internal ImportILGenericParameters: - (unit -> ImportMap) -> range -> ILScopeRef -> TType list -> ILGenericParameterDef list -> Typar list + (unit -> ImportMap) -> + range -> + ILScopeRef -> + TType list -> + Nullness.NullableContextSource -> + ILGenericParameterDef list -> + Typar list /// Import an IL assembly as a new TAST CCU val internal ImportILAssembly: @@ -100,7 +126,19 @@ val internal ImportILAssemblyTypeForwarders: /// Import an IL type as an F# type, first rescoping to view the metadata from the current assembly /// being compiled. importInst gives the context for interpreting type variables. -val RescopeAndImportILType: +/// This function fully skips the 'nullness checking' metadata flags. +val RescopeAndImportILTypeSkipNullness: scoref: ILScopeRef -> amap: ImportMap -> m: range -> importInst: TType list -> ilTy: ILType -> TType +/// Import an IL type as an F# type, first rescoping to view the metadata from the current assembly +/// being compiled. importInst gives the context for interpreting type variables. +val RescopeAndImportILType: + scoref: ILScopeRef -> + amap: ImportMap -> + m: range -> + importInst: TType list -> + nullnessSource: Nullness.NullableAttributesSource -> + ilTy: ILType -> + TType + val CanRescopeAndImportILType: scoref: ILScopeRef -> amap: ImportMap -> m: range -> ilTy: ILType -> bool diff --git a/src/Compiler/Checking/infos.fs b/src/Compiler/Checking/infos.fs index c90d49f3dcc..23afa7bece5 100644 --- a/src/Compiler/Checking/infos.fs +++ b/src/Compiler/Checking/infos.fs @@ -9,6 +9,7 @@ open FSharp.Compiler open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.DiagnosticsLogger open FSharp.Compiler.Import +open FSharp.Compiler.Import.Nullness open FSharp.Compiler.Syntax open FSharp.Compiler.SyntaxTreeOps open FSharp.Compiler.TcGlobals @@ -216,7 +217,8 @@ type OptionalArgInfo = else MissingValue else DefaultValue - CallerSide (analyze (ImportILTypeFromMetadata amap m ilScope ilTypeInst [] ilParam.Type)) + // See above - the type is imported only in order to be analyzed for optional default value, nullness is irrelevant here. + CallerSide (analyze (ImportILTypeFromMetadataSkipNullness amap m ilScope ilTypeInst [] ilParam.Type)) | Some v -> CallerSide (Constant v) else @@ -325,7 +327,7 @@ let CrackParamAttribsInfo g (ty: TType, argInfo: ArgReprInfo) = | false, true, true -> match TryFindFSharpAttribute g g.attrib_CallerMemberNameAttribute argInfo.Attribs with | Some(Attrib(_, _, _, _, _, _, callerMemberNameAttributeRange)) -> - warning(Error(FSComp.SR.CallerMemberNameIsOverriden(argInfo.Name.Value.idText), callerMemberNameAttributeRange)) + warning(Error(FSComp.SR.CallerMemberNameIsOverridden(argInfo.Name.Value.idText), callerMemberNameAttributeRange)) CallerFilePath | _ -> failwith "Impossible" | _, _, _ -> @@ -342,12 +344,12 @@ let CrackParamAttribsInfo g (ty: TType, argInfo: ArgReprInfo) = type ILFieldInit with /// Compute the ILFieldInit for the given provided constant value for a provided enum type. - static member FromProvidedObj m (v: obj) = + static member FromProvidedObj m (v: obj MaybeNull) = match v with | Null -> ILFieldInit.Null | NonNull v -> let objTy = v.GetType() - let v = if objTy.IsEnum then objTy.GetField("value__").GetValue v else v + let v = if objTy.IsEnum then !!(!!objTy.GetField("value__")).GetValue v else v match v with | :? single as i -> ILFieldInit.Single i | :? double as i -> ILFieldInit.Double i @@ -362,7 +364,7 @@ type ILFieldInit with | :? uint32 as i -> ILFieldInit.UInt32 i | :? int64 as i -> ILFieldInit.Int64 i | :? uint64 as i -> ILFieldInit.UInt64 i - | _ -> error(Error(FSComp.SR.infosInvalidProvidedLiteralValue(try v.ToString() with _ -> "?"), m)) + | _ -> error(Error(FSComp.SR.infosInvalidProvidedLiteralValue(try !!v.ToString() with _ -> "?"), m)) /// Compute the OptionalArgInfo for a provided parameter. @@ -394,8 +396,8 @@ let OptionalArgInfoOfProvidedParameter (amap: ImportMap) m (provParam : Tainted< /// Compute the ILFieldInit for the given provided constant value for a provided enum type. let GetAndSanityCheckProviderMethod m (mi: Tainted<'T :> ProvidedMemberInfo>) (get : 'T -> ProvidedMethodInfo MaybeNull) err = match mi.PApply((fun mi -> (get mi :> ProvidedMethodBase MaybeNull)),m) with - | Tainted.Null -> error(Error(err(mi.PUntaint((fun mi -> mi.Name),m),mi.PUntaint((fun mi -> (nonNull mi.DeclaringType).Name), m)), m)) // TODO NULLNESS: type isntantiation should not be needed - | meth -> meth + | Tainted.Null -> error(Error(err(mi.PUntaint((fun mi -> mi.Name),m),mi.PUntaint((fun mi -> (nonNull mi.DeclaringType).Name), m)), m)) + | Tainted.NonNull meth -> meth /// Try to get an arbitrary ProvidedMethodInfo associated with a property. let ArbitraryMethodInfoOfPropertyInfo (pi: Tainted) m = @@ -447,6 +449,10 @@ type ILTypeInfo = let (ILTypeInfo(g, ty, tref, tdef)) = x ILTypeInfo(g, instType inst ty, tref, tdef) + member x.NullableAttributes = AttributesFromIL(x.RawMetadata.MetadataIndex,x.RawMetadata.CustomAttrsStored) + + member x.NullableClassSource = FromClass(x.NullableAttributes) + static member FromType g ty = if isAnyTupleTy g ty then // When getting .NET metadata for the properties and methods @@ -463,7 +469,17 @@ type ILTypeInfo = let tref = mkRefForNestedILTypeDef scoref (enc, tdef) ILTypeInfo(g, ty, tref, tdef) else - failwith "ILTypeInfo.FromType - no IL metadata for type" + failwith ("ILTypeInfo.FromType - no IL metadata for type" + System.Environment.StackTrace) + +[] +type ILMethParentTypeInfo = + | IlType of ILTypeInfo + | CSharpStyleExtension of declaring:TyconRef * apparent:TType + + member x.ToType = + match x with + | IlType x -> x.ToType + | CSharpStyleExtension(apparent=x) -> x /// Describes an F# use of an IL method. [] @@ -472,32 +488,38 @@ type ILMethInfo = /// /// If ilDeclaringTyconRefOpt is 'Some' then this is an F# use of an C#-style extension method. /// If ilDeclaringTyconRefOpt is 'None' then ilApparentType is an IL type definition. - | ILMethInfo of g: TcGlobals * ilApparentType: TType * ilDeclaringTyconRefOpt: TyconRef option * ilMethodDef: ILMethodDef * ilGenericMethodTyArgs: Typars + | ILMethInfo of g: TcGlobals * ilType:ILMethParentTypeInfo * ilMethodDef: ILMethodDef * ilGenericMethodTyArgs: Typars - member x.TcGlobals = match x with ILMethInfo(g, _, _, _, _) -> g + member x.TcGlobals = match x with ILMethInfo(g, _, _, _) -> g /// Get the apparent declaring type of the method as an F# type. /// If this is a C#-style extension method then this is the type which the method /// appears to extend. This may be a variable type. - member x.ApparentEnclosingType = match x with ILMethInfo(_, ty, _, _, _) -> ty + member x.ApparentEnclosingType = match x with ILMethInfo(_, ty, _, _) -> ty.ToType /// Like ApparentEnclosingType but use the compiled nominal type if this is a method on a tuple type member x.ApparentEnclosingAppType = convertToTypeWithMetadataIfPossible x.TcGlobals x.ApparentEnclosingType /// Get the declaring type associated with an extension member, if any. - member x.ILExtensionMethodDeclaringTyconRef = match x with ILMethInfo(_, _, tcrefOpt, _, _) -> tcrefOpt + member x.ILExtensionMethodDeclaringTyconRef = + match x with + | ILMethInfo(ilType=CSharpStyleExtension(declaring= x)) -> Some x + | _ -> None /// Get the Abstract IL metadata associated with the method. - member x.RawMetadata = match x with ILMethInfo(_, _, _, md, _) -> md + member x.RawMetadata = match x with ILMethInfo(_, _, md, _) -> md /// Get the formal method type parameters associated with a method. - member x.FormalMethodTypars = match x with ILMethInfo(_, _, _, _, fmtps) -> fmtps + member x.FormalMethodTypars = match x with ILMethInfo(_, _, _, fmtps) -> fmtps /// Get the IL name of the method member x.ILName = x.RawMetadata.Name /// Indicates if the method is an extension method - member x.IsILExtensionMethod = x.ILExtensionMethodDeclaringTyconRef.IsSome + member x.IsILExtensionMethod = + match x with + | ILMethInfo(ilType=CSharpStyleExtension _) -> true + | _ -> false /// Get the declaring type of the method. If this is an C#-style extension method then this is the IL type /// holding the static member that is the extension method. @@ -558,15 +580,28 @@ type ILMethInfo = /// Does it appear to the user as an instance method? member x.IsInstance = not x.IsConstructor && not x.IsStatic - /// Get the argument types of the the IL method. If this is an C#-style extension method + member x.NullableFallback = + let raw = x.RawMetadata + let classAttrs = + match x with + | ILMethInfo(ilType=CSharpStyleExtension(declaring= t)) when t.IsILTycon -> AttributesFromIL(t.ILTyconRawMetadata.MetadataIndex,t.ILTyconRawMetadata.CustomAttrsStored) + // C#-style extension defined in F# -> we do not support manually adding NullableContextAttribute by F# users. + | ILMethInfo(ilType=CSharpStyleExtension _) -> AttributesFromIL(0,Given(ILAttributes.Empty)) + | ILMethInfo(ilType=IlType(t)) -> t.NullableAttributes + + FromMethodAndClass(AttributesFromIL(raw.MetadataIndex,raw.CustomAttrsStored),classAttrs) + + member x.GetNullness(p:ILParameter) = {DirectAttributes = AttributesFromIL(p.MetadataIndex,p.CustomAttrsStored); Fallback = x.NullableFallback} + + /// Get the argument types of the IL method. If this is an C#-style extension method /// then drop the object argument. member x.GetParamTypes(amap, m, minst) = - x.ParamMetadata |> List.map (fun p -> ImportParameterTypeFromMetadata amap m p.Type (fun _ -> p.CustomAttrs) x.MetadataScope x.DeclaringTypeInst minst) + x.ParamMetadata |> List.map (fun p -> ImportParameterTypeFromMetadata amap m (x.GetNullness(p)) p.Type x.MetadataScope x.DeclaringTypeInst minst) /// Get all the argument types of the IL method. Include the object argument even if this is /// an C#-style extension method. member x.GetRawArgTypes(amap, m, minst) = - x.RawMetadata.Parameters |> List.map (fun p -> ImportParameterTypeFromMetadata amap m p.Type (fun _ -> p.CustomAttrs) x.MetadataScope x.DeclaringTypeInst minst) + x.RawMetadata.Parameters |> List.map (fun p -> ImportParameterTypeFromMetadata amap m (x.GetNullness(p)) p.Type x.MetadataScope x.DeclaringTypeInst minst) /// Get info about the arguments of the IL method. If this is an C#-style extension method then /// drop the object argument. @@ -575,7 +610,7 @@ type ILMethInfo = member x.GetParamNamesAndTypes(amap, m, minst) = let scope = x.MetadataScope let tinst = x.DeclaringTypeInst - x.ParamMetadata |> List.map (fun p -> ParamNameAndType(Option.map (mkSynId m) p.Name, ImportParameterTypeFromMetadata amap m p.Type (fun _ -> p.CustomAttrs) scope tinst minst) ) + x.ParamMetadata |> List.map (fun p -> ParamNameAndType(Option.map (mkSynId m) p.Name, ImportParameterTypeFromMetadata amap m (x.GetNullness(p)) p.Type scope tinst minst) ) /// Get a reference to the method (dropping all generic instantiations), as an Abstract IL ILMethodRef. member x.ILMethodRef = @@ -599,12 +634,13 @@ type ILMethInfo = /// Get the (zero or one) 'self'/'this'/'object' arguments associated with an IL method. /// An instance extension method returns one object argument. - member x.GetObjArgTypes(amap, m, minst) = + member x.GetObjArgTypes(amap, m, minst) = // All C#-style extension methods are instance. We have to re-read the 'obj' type w.r.t. the // method instantiation. if x.IsILExtensionMethod then let p = x.RawMetadata.Parameters.Head - [ ImportParameterTypeFromMetadata amap m p.Type (fun _ -> p.CustomAttrs) x.MetadataScope x.DeclaringTypeInst minst ] + let nullableSource = {DirectAttributes = AttributesFromIL(p.MetadataIndex,p.CustomAttrsStored); Fallback = x.NullableFallback} + [ ImportParameterTypeFromMetadata amap m nullableSource p.Type x.MetadataScope x.DeclaringTypeInst minst ] else if x.IsInstance then [ x.ApparentEnclosingType ] else @@ -612,10 +648,12 @@ type ILMethInfo = /// Get the compiled return type of the method, where 'void' is None. member x.GetCompiledReturnType (amap, m, minst) = - ImportReturnTypeFromMetadata amap m x.RawMetadata.Return.Type (fun _ -> x.RawMetadata.Return.CustomAttrs) x.MetadataScope x.DeclaringTypeInst minst + let ilReturn = x.RawMetadata.Return + let nullableSource = {DirectAttributes = AttributesFromIL(ilReturn.MetadataIndex,ilReturn.CustomAttrsStored); Fallback = x.NullableFallback} + ImportReturnTypeFromMetadata amap m nullableSource ilReturn.Type x.MetadataScope x.DeclaringTypeInst minst /// Get the F# view of the return type of the method, where 'void' is 'unit'. - member x.GetFSharpReturnType (amap, m, minst) = + member x.GetFSharpReturnType (amap, m, minst) = x.GetCompiledReturnType(amap, m, minst) |> GetFSharpViewOfReturnType amap.g @@ -630,6 +668,9 @@ type MethInfo = /// Describes a use of a method backed by Abstract IL # metadata | ILMeth of tcGlobals: TcGlobals * ilMethInfo: ILMethInfo * extensionMethodPriority: ExtensionMethodPriority option + /// A pseudo-method used by F# typechecker to treat Object.ToString() of known types as returning regular string, not `string?` as in the BCL + | MethInfoWithModifiedReturnType of original:MethInfo * modifiedReturnType: TType + /// Describes a use of a pseudo-method corresponding to the default constructor for a .NET struct type | DefaultStructCtor of tcGlobals: TcGlobals * structTy: TType @@ -646,6 +687,7 @@ type MethInfo = match x with | ILMeth(_, ilminfo, _) -> ilminfo.ApparentEnclosingType | FSMeth(_, ty, _, _) -> ty + | MethInfoWithModifiedReturnType(mi, _) -> mi.ApparentEnclosingType | DefaultStructCtor(_, ty) -> ty #if !NO_TYPEPROVIDERS | ProvidedMeth(amap, mi, _, m) -> @@ -666,6 +708,7 @@ type MethInfo = match x with | ILMeth(_, ilminfo, _) when x.IsExtensionMember -> ilminfo.DeclaringTyconRef | FSMeth(_, _, vref, _) when x.IsExtensionMember && vref.HasDeclaringEntity -> vref.DeclaringEntity + | MethInfoWithModifiedReturnType(mi, _) -> mi.DeclaringTyconRef | _ -> x.ApparentEnclosingTyconRef /// Get the information about provided static parameters, if any @@ -673,6 +716,7 @@ type MethInfo = match x with | ILMeth _ -> None | FSMeth _ -> None + | MethInfoWithModifiedReturnType _ -> None #if !NO_TYPEPROVIDERS | ProvidedMeth (_, mb, _, m) -> let staticParams = mb.PApplyWithProvider((fun (mb, provider) -> mb.GetStaticParametersForMethod provider), range=m) @@ -691,6 +735,7 @@ type MethInfo = #if !NO_TYPEPROVIDERS | ProvidedMeth(_, _, pri, _) -> pri #endif + | MethInfoWithModifiedReturnType(mi, _) -> mi.ExtensionMemberPriorityOption | DefaultStructCtor _ -> None /// Get the extension method priority of the method. If it is not an extension method @@ -704,6 +749,7 @@ type MethInfo = | ILMeth(_, y, _) -> y.DeclaringTyconRef.DisplayNameWithStaticParametersAndUnderscoreTypars + "::" + y.ILName | FSMeth(_, AbbrevOrAppTy(tcref, _), vref, _) -> tcref.DisplayNameWithStaticParametersAndUnderscoreTypars + "::" + vref.LogicalName | FSMeth(_, _, vref, _) -> "??::" + vref.LogicalName + | MethInfoWithModifiedReturnType(mi, returnTy) -> mi.DebuggerDisplayName + $"({returnTy.DebugText})" #if !NO_TYPEPROVIDERS | ProvidedMeth(_, mi, _, m) -> "ProvidedMeth: " + mi.PUntaint((fun mi -> mi.Name), m) #endif @@ -714,6 +760,7 @@ type MethInfo = match x with | ILMeth(_, y, _) -> y.ILName | FSMeth(_, _, vref, _) -> vref.LogicalName + | MethInfoWithModifiedReturnType(mi, _) -> mi.LogicalName #if !NO_TYPEPROVIDERS | ProvidedMeth(_, mi, _, m) -> mi.PUntaint((fun mi -> mi.Name), m) #endif @@ -753,6 +800,7 @@ type MethInfo = match x with | ILMeth(g, _, _) -> g | FSMeth(g, _, _, _) -> g + | MethInfoWithModifiedReturnType(mi, _) -> mi.TcGlobals | DefaultStructCtor (g, _) -> g #if !NO_TYPEPROVIDERS | ProvidedMeth(amap, _, _, _) -> amap.g @@ -768,6 +816,7 @@ type MethInfo = let ty = x.ApparentEnclosingAppType let _, memberMethodTypars, _, _ = AnalyzeTypeOfMemberVal x.IsCSharpStyleExtensionMember g (ty, vref) memberMethodTypars + | MethInfoWithModifiedReturnType(mi, _) -> mi.FormalMethodTypars | DefaultStructCtor _ -> [] #if !NO_TYPEPROVIDERS | ProvidedMeth _ -> [] // There will already have been an error if there are generic parameters here. @@ -783,6 +832,7 @@ type MethInfo = match x with | ILMeth _ -> XmlDoc.Empty | FSMeth(_, _, vref, _) -> vref.XmlDoc + | MethInfoWithModifiedReturnType(mi, _) -> mi.XmlDoc | DefaultStructCtor _ -> XmlDoc.Empty #if !NO_TYPEPROVIDERS | ProvidedMeth(_, mi, _, m)-> @@ -794,6 +844,7 @@ type MethInfo = member x.ArbitraryValRef = match x with | FSMeth(_g, _, vref, _) -> Some vref + | MethInfoWithModifiedReturnType(mi, _) -> mi.ArbitraryValRef | _ -> None /// Get a list of argument-number counts, one count for each set of curried arguments. @@ -803,6 +854,7 @@ type MethInfo = match x with | ILMeth(_, ilminfo, _) -> [ilminfo.NumParams] | FSMeth(g, _, vref, _) -> GetArgInfosOfMember x.IsCSharpStyleExtensionMember g vref |> List.map List.length + | MethInfoWithModifiedReturnType(mi, _) -> mi.NumArgs | DefaultStructCtor _ -> [0] #if !NO_TYPEPROVIDERS | ProvidedMeth(_, mi, _, m) -> [mi.PUntaint((fun mi -> mi.GetParameters().Length), m)] // Why is this a list? Answer: because the method might be curried @@ -824,6 +876,7 @@ type MethInfo = match x with | ILMeth(_, ilmeth, _) -> ilmeth.IsInstance | FSMeth(_, _, vref, _) -> vref.IsInstanceMember || x.IsCSharpStyleExtensionMember + | MethInfoWithModifiedReturnType(mi, _) -> mi.IsInstance | DefaultStructCtor _ -> false #if !NO_TYPEPROVIDERS | ProvidedMeth(_, mi, _, m) -> mi.PUntaint((fun mi -> not mi.IsConstructor && not mi.IsStatic), m) @@ -837,6 +890,7 @@ type MethInfo = match x with | ILMeth(_, ilmeth, _) -> ilmeth.IsProtectedAccessibility | FSMeth _ -> false + | MethInfoWithModifiedReturnType(mi, _) -> mi.IsProtectedAccessibility | DefaultStructCtor _ -> false #if !NO_TYPEPROVIDERS | ProvidedMeth(_, mi, _, m) -> mi.PUntaint((fun mi -> mi.IsFamily), m) @@ -846,6 +900,7 @@ type MethInfo = match x with | ILMeth(_, ilmeth, _) -> ilmeth.IsVirtual | FSMeth(_, _, vref, _) -> vref.IsVirtualMember + | MethInfoWithModifiedReturnType(mi, _) -> mi.IsVirtual | DefaultStructCtor _ -> false #if !NO_TYPEPROVIDERS | ProvidedMeth(_, mi, _, m) -> mi.PUntaint((fun mi -> mi.IsVirtual), m) @@ -855,6 +910,7 @@ type MethInfo = match x with | ILMeth(_, ilmeth, _) -> ilmeth.IsConstructor | FSMeth(_g, _, vref, _) -> (vref.MemberInfo.Value.MemberFlags.MemberKind = SynMemberKind.Constructor) + | MethInfoWithModifiedReturnType(mi, _) -> mi.IsConstructor | DefaultStructCtor _ -> true #if !NO_TYPEPROVIDERS | ProvidedMeth(_, mi, _, m) -> mi.PUntaint((fun mi -> mi.IsConstructor), m) @@ -867,6 +923,7 @@ type MethInfo = match vref.TryDeref with | ValueSome x -> x.IsClassConstructor | _ -> false + | MethInfoWithModifiedReturnType(mi, _) -> mi.IsClassConstructor | DefaultStructCtor _ -> false #if !NO_TYPEPROVIDERS | ProvidedMeth(_, mi, _, m) -> mi.PUntaint((fun mi -> mi.IsConstructor && mi.IsStatic), m) // Note: these are never public anyway @@ -876,6 +933,7 @@ type MethInfo = match x with | ILMeth(_g, ilmeth, _) -> ilmeth.IsVirtual | FSMeth(_, _, vref, _) -> vref.MemberInfo.Value.MemberFlags.IsDispatchSlot + | MethInfoWithModifiedReturnType(mi, _) -> mi.IsDispatchSlot | DefaultStructCtor _ -> false #if !NO_TYPEPROVIDERS | ProvidedMeth _ -> x.IsVirtual // Note: follow same implementation as ILMeth @@ -887,6 +945,7 @@ type MethInfo = match x with | ILMeth(_, ilmeth, _) -> ilmeth.IsFinal | FSMeth(_g, _, _vref, _) -> false + | MethInfoWithModifiedReturnType(mi, _) -> mi.IsFinal | DefaultStructCtor _ -> true #if !NO_TYPEPROVIDERS | ProvidedMeth(_, mi, _, m) -> mi.PUntaint((fun mi -> mi.IsFinal), m) @@ -902,6 +961,7 @@ type MethInfo = match minfo with | ILMeth(_, ilmeth, _) -> ilmeth.IsAbstract | FSMeth(g, _, vref, _) -> isInterfaceTy g minfo.ApparentEnclosingType || vref.IsDispatchSlotMember + | MethInfoWithModifiedReturnType(mi, _) -> mi.IsAbstract | DefaultStructCtor _ -> false #if !NO_TYPEPROVIDERS | ProvidedMeth(_, mi, _, m) -> mi.PUntaint((fun mi -> mi.IsAbstract), m) @@ -912,6 +972,7 @@ type MethInfo = (match x with | ILMeth(_, x, _) -> x.IsNewSlot || (isInterfaceTy x.TcGlobals x.ApparentEnclosingType && not x.IsFinal) | FSMeth(_, _, vref, _) -> vref.IsDispatchSlotMember + | MethInfoWithModifiedReturnType(mi, _) -> mi.IsNewSlot #if !NO_TYPEPROVIDERS | ProvidedMeth(_, mi, _, m) -> mi.PUntaint((fun mi -> mi.IsHideBySig), m) // REVIEW: Check this is correct #endif @@ -921,6 +982,7 @@ type MethInfo = member x.IsILMethod = match x with | ILMeth _ -> true + | MethInfoWithModifiedReturnType(mi, _) -> mi.IsILMethod | _ -> false /// Check if this method is an explicit implementation of an interface member @@ -928,6 +990,7 @@ type MethInfo = match x with | ILMeth _ -> false | FSMeth(g, _, vref, _) -> vref.IsFSharpExplicitInterfaceImplementation g + | MethInfoWithModifiedReturnType(mi, _) -> mi.IsFSharpExplicitInterfaceImplementation | DefaultStructCtor _ -> false #if !NO_TYPEPROVIDERS | ProvidedMeth _ -> false @@ -938,6 +1001,7 @@ type MethInfo = match x with | ILMeth _ -> false | FSMeth(_, _, vref, _) -> vref.IsDefiniteFSharpOverrideMember + | MethInfoWithModifiedReturnType(mi, _) -> mi.IsDefiniteFSharpOverride | DefaultStructCtor _ -> false #if !NO_TYPEPROVIDERS | ProvidedMeth _ -> false @@ -946,6 +1010,7 @@ type MethInfo = member x.ImplementedSlotSignatures = match x with | FSMeth(_, _, vref, _) -> vref.ImplementedSlotSignatures + | MethInfoWithModifiedReturnType(mi, _) -> mi.ImplementedSlotSignatures | _ -> failwith "not supported" /// Indicates if this is an extension member. @@ -953,6 +1018,7 @@ type MethInfo = match x with | FSMeth (_, _, vref, pri) -> pri.IsSome || vref.IsExtensionMember | ILMeth (_, _, Some _) -> true + | MethInfoWithModifiedReturnType(mi, _) -> mi.IsExtensionMember | _ -> false /// Indicates if this is an extension member (e.g. on a struct) that takes a byref arg @@ -964,12 +1030,16 @@ type MethInfo = /// Indicates if this is an F# extension member. member x.IsFSharpStyleExtensionMember = - match x with FSMeth (_, _, vref, _) -> vref.IsExtensionMember | _ -> false + match x with + | FSMeth (_, _, vref, _) -> vref.IsExtensionMember + | MethInfoWithModifiedReturnType(mi, _) -> mi.IsFSharpStyleExtensionMember + | _ -> false /// Indicates if this is an C#-style extension member. member x.IsCSharpStyleExtensionMember = match x with | FSMeth (_, _, vref, Some _) -> not vref.IsExtensionMember + | MethInfoWithModifiedReturnType(mi, _) -> mi.IsCSharpStyleExtensionMember | ILMeth (_, _, Some _) -> true | _ -> false @@ -991,6 +1061,7 @@ type MethInfo = member x.IsFSharpEventPropertyMethod = match x with | FSMeth(g, _, vref, _) -> vref.IsFSharpEventProperty g + | MethInfoWithModifiedReturnType(mi, _) -> mi.IsFSharpEventPropertyMethod #if !NO_TYPEPROVIDERS | ProvidedMeth _ -> false #endif @@ -1022,12 +1093,14 @@ type MethInfo = | ILMeth (g, ilMethInfo, _) -> ilMethInfo.IsReadOnly g || x.IsOnReadOnlyType | FSMeth _ -> false // F# defined methods not supported yet. Must be a language feature. + | MethInfoWithModifiedReturnType(mi, _) -> mi.IsReadOnly | _ -> false - /// Indicates, wheter this method has `IsExternalInit` modreq. + /// Indicates, whether this method has `IsExternalInit` modreq. member x.HasExternalInit = match x with | ILMeth (_, ilMethInfo, _) -> HasExternalInit ilMethInfo.ILMethodRef + | MethInfoWithModifiedReturnType(mi, _) -> mi.HasExternalInit | _ -> false /// Indicates if this method is an extension member that is read-only. @@ -1040,14 +1113,19 @@ type MethInfo = /// Build IL method infos. static member CreateILMeth (amap: ImportMap, m, ty: TType, md: ILMethodDef) = let tinfo = ILTypeInfo.FromType amap.g ty - let mtps = ImportILGenericParameters (fun () -> amap) m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata md.GenericParams - ILMeth (amap.g, ILMethInfo(amap.g, ty, None, md, mtps), None) + let nullableFallback = FromMethodAndClass(AttributesFromIL(md.MetadataIndex,md.CustomAttrsStored),tinfo.NullableAttributes) + let mtps = ImportILGenericParameters (fun () -> amap) m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata nullableFallback md.GenericParams + ILMeth (amap.g, ILMethInfo(amap.g, IlType tinfo, md, mtps), None) /// Build IL method infos for a C#-style extension method - static member CreateILExtensionMeth (amap, m, apparentTy: TType, declaringTyconRef: TyconRef, extMethPri, md: ILMethodDef) = + static member CreateILExtensionMeth (amap:ImportMap, m, apparentTy: TType, declaringTyconRef: TyconRef, extMethPri, md: ILMethodDef) = let scoref = declaringTyconRef.CompiledRepresentationForNamedType.Scope - let mtps = ImportILGenericParameters (fun () -> amap) m scoref [] md.GenericParams - ILMeth (amap.g, ILMethInfo(amap.g, apparentTy, Some declaringTyconRef, md, mtps), extMethPri) + let typeInfo = CSharpStyleExtension(declaringTyconRef,apparentTy) + let declaringMetadata = declaringTyconRef.ILTyconRawMetadata + let declaringAttributes = AttributesFromIL(declaringMetadata.MetadataIndex,declaringMetadata.CustomAttrsStored) + let nullableFallback = FromMethodAndClass(AttributesFromIL(md.MetadataIndex,md.CustomAttrsStored),declaringAttributes) + let mtps = ImportILGenericParameters (fun () -> amap) m scoref [] nullableFallback md.GenericParams + ILMeth (amap.g, ILMethInfo(amap.g, typeInfo, md, mtps), extMethPri) /// Tests whether two method infos have the same underlying definition. /// Used to merge operator overloads collected from left and right of an operator constraint. @@ -1056,6 +1134,8 @@ type MethInfo = match x1, x2 with | ILMeth(_, x1, _), ILMeth(_, x2, _) -> (x1.RawMetadata === x2.RawMetadata) | FSMeth(g, _, vref1, _), FSMeth(_, _, vref2, _) -> valRefEq g vref1 vref2 + | mi1, MethInfoWithModifiedReturnType(mi2, _) + | MethInfoWithModifiedReturnType(mi1, _), mi2 -> MethInfo.MethInfosUseIdenticalDefinitions mi1 mi2 | DefaultStructCtor _, DefaultStructCtor _ -> tyconRefEq x1.TcGlobals x1.DeclaringTyconRef x2.DeclaringTyconRef #if !NO_TYPEPROVIDERS | ProvidedMeth(_, mi1, _, _), ProvidedMeth(_, mi2, _, _) -> ProvidedMethodBase.TaintedEquals (mi1, mi2) @@ -1067,6 +1147,7 @@ type MethInfo = match x with | ILMeth(_, x1, _) -> hash x1.RawMetadata.Name | FSMeth(_, _, vref, _) -> hash vref.LogicalName + | MethInfoWithModifiedReturnType(mi,_) -> mi.ComputeHashCode() | DefaultStructCtor(_, _ty) -> 34892 // "ty" doesn't support hashing. We could use "hash (tcrefOfAppTy g ty).CompiledName" or // something but we don't have a "g" parameter here yet. But this hash need only be very approximate anyway #if !NO_TYPEPROVIDERS @@ -1078,9 +1159,10 @@ type MethInfo = match x with | ILMeth(_g, ilminfo, pri) -> match ilminfo with - | ILMethInfo(_, ty, None, md, _) -> MethInfo.CreateILMeth(amap, m, instType inst ty, md) - | ILMethInfo(_, ty, Some declaringTyconRef, md, _) -> MethInfo.CreateILExtensionMeth(amap, m, instType inst ty, declaringTyconRef, pri, md) + | ILMethInfo(_, IlType ty, md, _) -> MethInfo.CreateILMeth(amap, m, instType inst ty.ToType, md) + | ILMethInfo(_, CSharpStyleExtension(declaringTyconRef,ty), md, _) -> MethInfo.CreateILExtensionMeth(amap, m, instType inst ty, declaringTyconRef, pri, md) | FSMeth(g, ty, vref, pri) -> FSMeth(g, instType inst ty, vref, pri) + | MethInfoWithModifiedReturnType(mi, retTy) -> MethInfoWithModifiedReturnType(mi.Instantiate(amap, m, inst), retTy) | DefaultStructCtor(g, ty) -> DefaultStructCtor(g, instType inst ty) #if !NO_TYPEPROVIDERS | ProvidedMeth _ -> @@ -1099,6 +1181,7 @@ type MethInfo = let inst = GetInstantiationForMemberVal g x.IsCSharpStyleExtensionMember (ty, vref, minst) let _, _, retTy, _ = AnalyzeTypeOfMemberVal x.IsCSharpStyleExtensionMember g (ty, vref) retTy |> Option.map (instType inst) + | MethInfoWithModifiedReturnType(_,retTy) -> Some retTy | DefaultStructCtor _ -> None #if !NO_TYPEPROVIDERS | ProvidedMeth(amap, mi, _, m) -> @@ -1116,6 +1199,7 @@ type MethInfo = | ILMeth (ilMethInfo = ilminfo) -> // A single group of tupled arguments [ ilminfo.ParamMetadata |> List.map (fun x -> x.Name) ] + | MethInfoWithModifiedReturnType(mi,_) -> mi.GetParamNames() #if !NO_TYPEPROVIDERS | ProvidedMeth (_, mi, _, m) -> // A single group of tupled arguments @@ -1134,6 +1218,7 @@ type MethInfo = let paramTypes = ParamNameAndType.FromMember x.IsCSharpStyleExtensionMember g vref let inst = GetInstantiationForMemberVal g x.IsCSharpStyleExtensionMember (ty, vref, minst) paramTypes |> List.mapSquared (fun (ParamNameAndType(_, ty)) -> instType inst ty) + | MethInfoWithModifiedReturnType(mi,_) -> mi.GetParamTypes(amap,m,minst) | DefaultStructCtor _ -> [] #if !NO_TYPEPROVIDERS | ProvidedMeth(amap, mi, _, m) -> @@ -1158,6 +1243,7 @@ type MethInfo = else [ ty ] else [] + | MethInfoWithModifiedReturnType(mi,_) -> mi.GetObjArgTypes(amap, m, minst) | DefaultStructCtor _ -> [] #if !NO_TYPEPROVIDERS | ProvidedMeth(amap, mi, _, m) -> @@ -1169,6 +1255,7 @@ type MethInfo = member x.GetCustomAttrs() = match x with | ILMeth(_, ilMethInfo, _) -> ilMethInfo.RawMetadata.CustomAttrs + | MethInfoWithModifiedReturnType(mi,_) -> mi.GetCustomAttrs() | _ -> ILAttributes.Empty /// Get the parameter attributes of a method info, which get combined with the parameter names and types @@ -1209,6 +1296,7 @@ type MethInfo = | FSMeth(g, _, vref, _) -> GetArgInfosOfMember x.IsCSharpStyleExtensionMember g vref |> List.mapSquared (CrackParamAttribsInfo g) + | MethInfoWithModifiedReturnType(mi,_) -> mi.GetParamAttribs(amap, m) | DefaultStructCtor _ -> [[]] @@ -1216,10 +1304,10 @@ type MethInfo = | ProvidedMeth(amap, mi, _, _) -> // A single group of tupled arguments [ [for p in mi.PApplyArray((fun mi -> mi.GetParameters()), "GetParameters", m) do - let isParamArrayArg = p.PUntaint((fun px -> (px :> IProvidedCustomAttributeProvider).GetAttributeConstructorArgs(p.TypeProvider.PUntaintNoFailure id, typeof.FullName).IsSome), m) + let isParamArrayArg = p.PUntaint((fun px -> (px :> IProvidedCustomAttributeProvider).GetAttributeConstructorArgs(p.TypeProvider.PUntaintNoFailure id, !! typeof.FullName).IsSome), m) let optArgInfo = OptionalArgInfoOfProvidedParameter amap m p let reflArgInfo = - match p.PUntaint((fun px -> (px :> IProvidedCustomAttributeProvider).GetAttributeConstructorArgs(p.TypeProvider.PUntaintNoFailure id, typeof.FullName)), m) with + match p.PUntaint((fun px -> (px :> IProvidedCustomAttributeProvider).GetAttributeConstructorArgs(p.TypeProvider.PUntaintNoFailure id, !! typeof.FullName)), m) with | Some ([ Some (:? bool as b) ], _) -> ReflectedArgInfo.Quote b | Some _ -> ReflectedArgInfo.Quote false | None -> ReflectedArgInfo.None @@ -1251,6 +1339,7 @@ type MethInfo = |> List.mapSquared (map1Of2 (instType methodToParentRenaming) >> MakeSlotParam ) let formalRetTy = Option.map (instType methodToParentRenaming) retTy MakeSlotSig(x.LogicalName, x.ApparentEnclosingType, formalEnclosingTypars, formalMethTypars, formalParams, formalRetTy) + | MethInfoWithModifiedReturnType(mi,_) -> mi.GetSlotSig(amap, m) | DefaultStructCtor _ -> error(InternalError("no slotsig for DefaultStructCtor", m)) | _ -> let g = x.TcGlobals @@ -1269,12 +1358,17 @@ type MethInfo = let formalRetTy, formalParams = match x with - | ILMeth(_, ilminfo, _) -> + | ILMeth(_, ilminfo, _) -> let ftinfo = ILTypeInfo.FromType g (TType_app(tcref, formalEnclosingTyparTys, g.knownWithoutNull)) - let formalRetTy = ImportReturnTypeFromMetadata amap m ilminfo.RawMetadata.Return.Type (fun _ -> ilminfo.RawMetadata.Return.CustomAttrs) ftinfo.ILScopeRef ftinfo.TypeInstOfRawMetadata formalMethTyparTys + + let ilReturn = ilminfo.RawMetadata.Return + let nullableSource = {DirectAttributes = AttributesFromIL(ilReturn.MetadataIndex,ilReturn.CustomAttrsStored); Fallback = ilminfo.NullableFallback} + + let formalRetTy = ImportReturnTypeFromMetadata amap m nullableSource ilReturn.Type ftinfo.ILScopeRef ftinfo.TypeInstOfRawMetadata formalMethTyparTys let formalParams = [ [ for p in ilminfo.RawMetadata.Parameters do - let paramTy = ImportILTypeFromMetadataWithAttributes amap m ftinfo.ILScopeRef ftinfo.TypeInstOfRawMetadata formalMethTyparTys p.Type (fun _ -> p.CustomAttrs) + let nullableSource = {nullableSource with DirectAttributes = AttributesFromIL(p.MetadataIndex,p.CustomAttrsStored)} + let paramTy = ImportILTypeFromMetadataWithAttributes amap m ftinfo.ILScopeRef ftinfo.TypeInstOfRawMetadata formalMethTyparTys nullableSource p.Type yield TSlotParam(p.Name, paramTy, p.IsIn, p.IsOut, p.IsOptional, []) ] ] formalRetTy, formalParams #if !NO_TYPEPROVIDERS @@ -1286,7 +1380,7 @@ type MethInfo = // For non-generic type providers there is no difference let formalParams = [ [ for p in mi.PApplyArray((fun mi -> mi.GetParameters()), "GetParameters", m) do - let paramName = p.PUntaint((fun p -> match p.Name with null -> None | s -> Some s), m) + let paramName = p.PUntaint((fun p -> match p.Name with "" -> None | s -> Some s), m) let paramTy = ImportProvidedType amap m (p.PApply((fun p -> p.ParameterType), m)) let isIn, isOut, isOptional = p.PUntaint((fun p -> p.IsIn, p.IsOut, p.IsOptional), m) yield TSlotParam(paramName, paramTy, isIn, isOut, isOptional, []) ] ] @@ -1298,37 +1392,41 @@ type MethInfo = /// Get the ParamData objects for the parameters of a MethInfo member x.GetParamDatas(amap, m, minst) = - let paramNamesAndTypes = - match x with - | ILMeth(_g, ilminfo, _) -> - [ ilminfo.GetParamNamesAndTypes(amap, m, minst) ] - | FSMeth(g, _, vref, _) -> - let ty = x.ApparentEnclosingAppType - let items = ParamNameAndType.FromMember x.IsCSharpStyleExtensionMember g vref - let inst = GetInstantiationForMemberVal g x.IsCSharpStyleExtensionMember (ty, vref, minst) - items |> ParamNameAndType.InstantiateCurried inst - | DefaultStructCtor _ -> - [[]] -#if !NO_TYPEPROVIDERS - | ProvidedMeth(amap, mi, _, _) -> - // A single set of tupled parameters - [ [for p in mi.PApplyArray((fun mi -> mi.GetParameters()), "GetParameters", m) do - let paramName = - match p.PUntaint((fun p -> p.Name), m) with - | null -> None - | name -> Some (mkSynId m name) - let paramTy = - match p.PApply((fun p -> p.ParameterType), m) with - | Tainted.Null -> amap.g.unit_ty - | Tainted.NonNull parameterType -> ImportProvidedType amap m parameterType - yield ParamNameAndType(paramName, paramTy) ] ] - -#endif - - let paramAttribs = x.GetParamAttribs(amap, m) - (paramAttribs, paramNamesAndTypes) ||> List.map2 (List.map2 (fun info (ParamNameAndType(nmOpt, pty)) -> - let (ParamAttribs(isParamArrayArg, isInArg, isOutArg, optArgInfo, callerInfo, reflArgInfo)) = info - ParamData(isParamArrayArg, isInArg, isOutArg, optArgInfo, callerInfo, nmOpt, reflArgInfo, pty))) + match x with + | MethInfoWithModifiedReturnType(mi,_) -> mi.GetParamDatas(amap, m, minst) + | _ -> + let paramNamesAndTypes = + match x with + | ILMeth(_g, ilminfo, _) -> + [ ilminfo.GetParamNamesAndTypes(amap, m, minst) ] + | FSMeth(g, _, vref, _) -> + let ty = x.ApparentEnclosingAppType + let items = ParamNameAndType.FromMember x.IsCSharpStyleExtensionMember g vref + let inst = GetInstantiationForMemberVal g x.IsCSharpStyleExtensionMember (ty, vref, minst) + items |> ParamNameAndType.InstantiateCurried inst + | MethInfoWithModifiedReturnType(_mi,_) -> failwith "unreachable" + | DefaultStructCtor _ -> + [[]] +#if !NO_TYPEPROVIDERS + | ProvidedMeth(amap, mi, _, _) -> + // A single set of tupled parameters + [ [for p in mi.PApplyArray((fun mi -> mi.GetParameters()), "GetParameters", m) do + let paramName = + match p.PUntaint((fun p -> p.Name), m) with + | "" -> None + | name -> Some (mkSynId m name) + let paramTy = + match p.PApply((fun p -> p.ParameterType), m) with + | Tainted.Null -> amap.g.unit_ty + | Tainted.NonNull parameterType -> ImportProvidedType amap m parameterType + yield ParamNameAndType(paramName, paramTy) ] ] + +#endif + + let paramAttribs = x.GetParamAttribs(amap, m) + (paramAttribs, paramNamesAndTypes) ||> List.map2 (List.map2 (fun info (ParamNameAndType(nmOpt, pty)) -> + let (ParamAttribs(isParamArrayArg, isInArg, isOutArg, optArgInfo, callerInfo, reflArgInfo)) = info + ParamData(isParamArrayArg, isInArg, isOutArg, optArgInfo, callerInfo, nmOpt, reflArgInfo, pty))) /// Get the ParamData objects for the parameters of a MethInfo member x.HasParamArrayArg(amap, m, minst) = @@ -1472,8 +1570,10 @@ type ILFieldInfo = /// Get the type of the field as an F# type member x.FieldType(amap, m) = - match x with - | ILFieldInfo (tinfo, fdef) -> ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] fdef.FieldType + match x with + | ILFieldInfo (tinfo, fdef) -> + let nullness = {DirectAttributes = AttributesFromIL(fdef.MetadataIndex,fdef.CustomAttrsStored); Fallback = tinfo.NullableClassSource} + ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] nullness fdef.FieldType #if !NO_TYPEPROVIDERS | ProvidedField(amap, fi, m) -> ImportProvidedType amap m (fi.PApply((fun fi -> fi.FieldType), m)) #endif @@ -1533,7 +1633,7 @@ type RecdFieldInfo = member x.FieldType = actualTyOfRecdFieldRef x.RecdFieldRef x.TypeInst /// Get the enclosing (declaring) type of the field in an F#-declared record, class or struct type - member x.DeclaringType = TType_app (x.RecdFieldRef.TyconRef, x.TypeInst, 0uy) + member x.DeclaringType = TType_app (x.RecdFieldRef.TyconRef, x.TypeInst, KnownWithoutNull) // TODO NULLNESS - qualify this override x.ToString() = x.TyconRef.ToString() + "::" + x.LogicalName @@ -1608,13 +1708,13 @@ type ILPropInfo = member x.GetterMethod = assert x.HasGetter let mdef = resolveILMethodRef x.ILTypeInfo.RawMetadata x.RawMetadata.GetMethod.Value - ILMethInfo(x.TcGlobals, x.ILTypeInfo.ToType, None, mdef, []) + ILMethInfo(x.TcGlobals, IlType x.ILTypeInfo, mdef, []) /// Gets the ILMethInfo of the 'set' method for the IL property member x.SetterMethod = assert x.HasSetter let mdef = resolveILMethodRef x.ILTypeInfo.RawMetadata x.RawMetadata.SetMethod.Value - ILMethInfo(x.TcGlobals, x.ILTypeInfo.ToType, None, mdef, []) + ILMethInfo(x.TcGlobals, IlType x.ILTypeInfo, mdef, []) /// Indicates if the IL property has a 'get' method member x.HasGetter = Option.isSome x.RawMetadata.GetMethod @@ -1622,7 +1722,7 @@ type ILPropInfo = /// Indicates if the IL property has a 'set' method member x.HasSetter = Option.isSome x.RawMetadata.SetMethod - /// Indidcates whether IL property has an init-only setter (i.e. has the `System.Runtime.CompilerServices.IsExternalInit` modifer) + /// Indicates whether IL property has an init-only setter (i.e. has the `System.Runtime.CompilerServices.IsExternalInit` modifier) member x.IsSetterInitOnly = x.HasSetter && HasExternalInit x.SetterMethod.ILMethodRef @@ -1647,23 +1747,36 @@ type ILPropInfo = /// Any type parameters of the enclosing type are instantiated in the type returned. member x.GetParamNamesAndTypes(amap, m) = let (ILPropInfo (tinfo, pdef)) = x - pdef.Args |> List.map (fun ty -> ParamNameAndType(None, ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] ty) ) + if x.HasGetter then + x.GetterMethod.GetParamNamesAndTypes(amap,m,tinfo.TypeInstOfRawMetadata) + else if x.HasSetter then + x.SetterMethod.GetParamNamesAndTypes(amap,m,tinfo.TypeInstOfRawMetadata) + else + // Fallback-only for invalid properties + pdef.Args |> List.map (fun ty -> ParamNameAndType(None, ImportILTypeFromMetadataSkipNullness amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] ty) ) /// Get the types of the indexer arguments associated with the IL property. /// /// Any type parameters of the enclosing type are instantiated in the type returned. member x.GetParamTypes(amap, m) = let (ILPropInfo (tinfo, pdef)) = x - pdef.Args |> List.map (fun ty -> ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] ty) + if x.HasGetter then + x.GetterMethod.GetParamTypes(amap,m,tinfo.TypeInstOfRawMetadata) + else if x.HasSetter then + x.SetterMethod.GetParamTypes(amap,m,tinfo.TypeInstOfRawMetadata) + else + // Fallback-only for invalid properties + pdef.Args |> List.map (fun ty -> ImportILTypeFromMetadataSkipNullness amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] ty) /// Get the return type of the IL property. /// /// Any type parameters of the enclosing type are instantiated in the type returned. member x.GetPropertyType (amap, m) = let (ILPropInfo (tinfo, pdef)) = x - ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] pdef.PropertyType + let nullness = {DirectAttributes = AttributesFromIL(pdef.MetadataIndex,pdef.CustomAttrsStored); Fallback = tinfo.NullableClassSource} + ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] nullness pdef.PropertyType - override x.ToString() = x.ILTypeInfo.ToString() + "::" + x.PropertyName + override x.ToString() = !!x.ILTypeInfo.ToString() + "::" + x.PropertyName /// Describes an F# use of a property [] @@ -1769,6 +1882,38 @@ type PropInfo = | ProvidedProp(_, pi, m) -> pi.PUntaint((fun pi -> pi.CanWrite), m) #endif + member x.GetterAccessibility = + match x with + | ILProp ilpinfo when ilpinfo.HasGetter -> Some taccessPublic + | ILProp _ -> None + + | FSProp(_, _, Some getter, _) -> Some getter.Accessibility + | FSProp _ -> None + +#if !NO_TYPEPROVIDERS + | ProvidedProp(_, pi, m) -> pi.PUntaint((fun pi -> if pi.CanWrite then Some taccessPublic else None), m) +#endif + + member x.SetterAccessibility = + match x with + | ILProp ilpinfo when ilpinfo.HasSetter -> Some taccessPublic + | ILProp _ -> None + + | FSProp(_, _, _, Some setter) -> Some setter.Accessibility + | FSProp _ -> None + +#if !NO_TYPEPROVIDERS + | ProvidedProp(_, pi, m) -> pi.PUntaint((fun pi -> if pi.CanWrite then Some taccessPublic else None), m) +#endif + + member x.IsProtectedAccessibility = + match x with + | ILProp ilpinfo when ilpinfo.HasGetter && ilpinfo.HasSetter -> + struct(ilpinfo.GetterMethod.IsProtectedAccessibility, ilpinfo.SetterMethod.IsProtectedAccessibility) + | ILProp ilpinfo when ilpinfo.HasGetter -> struct(ilpinfo.GetterMethod.IsProtectedAccessibility, false) + | ILProp ilpinfo when ilpinfo.HasSetter -> struct(false, ilpinfo.SetterMethod.IsProtectedAccessibility) + | _ -> struct(false, false) + member x.IsSetterInitOnly = match x with | ILProp ilpinfo -> ilpinfo.IsSetterInitOnly @@ -1939,7 +2084,7 @@ type PropInfo = /// Get the result type of the property member x.GetPropertyType (amap, m) = - match x with + match x with | ILProp ilpinfo -> ilpinfo.GetPropertyType (amap, m) | FSProp (g, _, Some vref, _) | FSProp (g, _, _, Some vref) -> @@ -1957,7 +2102,7 @@ type PropInfo = /// /// If the property is in a generic type, then the type parameters are instantiated in the types returned. member x.GetParamNamesAndTypes(amap, m) = - match x with + match x with | ILProp ilpinfo -> ilpinfo.GetParamNamesAndTypes(amap, m) | FSProp (g, ty, Some vref, _) | FSProp (g, ty, _, Some vref) -> @@ -1967,7 +2112,7 @@ type PropInfo = #if !NO_TYPEPROVIDERS | ProvidedProp (_, pi, m) -> [ for p in pi.PApplyArray((fun pi -> pi.GetIndexParameters()), "GetIndexParameters", m) do - let paramName = p.PUntaint((fun p -> match p.Name with null -> None | s -> Some (mkSynId m s)), m) + let paramName = p.PUntaint((fun p -> match p.Name with "" -> None | s -> Some (mkSynId m s)), m) let paramTy = ImportProvidedType amap m (p.PApply((fun p -> p.ParameterType), m)) yield ParamNameAndType(paramName, paramTy) ] #endif @@ -1978,7 +2123,7 @@ type PropInfo = |> List.map (fun (ParamNameAndType(nmOpt, paramTy)) -> ParamData(false, false, false, NotOptional, NoCallerInfo, nmOpt, ReflectedArgInfo.None, paramTy)) /// Get the types of the indexer parameters associated with the property - member x.GetParamTypes(amap, m) = + member x.GetParamTypes(amap, m) = x.GetParamNamesAndTypes(amap, m) |> List.map (fun (ParamNameAndType(_, ty)) -> ty) /// Get a MethInfo for the 'getter' method associated with the property @@ -2073,12 +2218,12 @@ type ILEventInfo = /// Get the ILMethInfo describing the 'add' method associated with the event member x.AddMethod = let mdef = resolveILMethodRef x.ILTypeInfo.RawMetadata x.RawMetadata.AddMethod - ILMethInfo(x.TcGlobals, x.ILTypeInfo.ToType, None, mdef, []) + ILMethInfo(x.TcGlobals, IlType x.ILTypeInfo, mdef, []) /// Get the ILMethInfo describing the 'remove' method associated with the event member x.RemoveMethod = let mdef = resolveILMethodRef x.ILTypeInfo.RawMetadata x.RawMetadata.RemoveMethod - ILMethInfo(x.TcGlobals, x.ILTypeInfo.ToType, None, mdef, []) + ILMethInfo(x.TcGlobals, IlType x.ILTypeInfo, mdef, []) /// Get the declaring type of the event as an ILTypeRef member x.TypeRef = x.ILTypeInfo.ILTypeRef @@ -2089,7 +2234,7 @@ type ILEventInfo = /// Indicates if the property is static member x.IsStatic = x.AddMethod.IsStatic - override x.ToString() = x.ILTypeInfo.ToString() + "::" + x.EventName + override x.ToString() = !!x.ILTypeInfo.ToString() + "::" + x.EventName //------------------------------------------------------------------------- // Helpers for EventInfo @@ -2274,9 +2419,10 @@ type EventInfo = match x with | ILEvent(ILEventInfo(tinfo, edef)) -> // Get the delegate type associated with an IL event, taking into account the instantiation of the - // declaring type. + // declaring type if Option.isNone edef.EventType then error (nonStandardEventError x.EventName m) - ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] edef.EventType.Value + let nullness = {DirectAttributes = AttributesFromIL(edef.MetadataIndex,edef.CustomAttrsStored); Fallback = tinfo.NullableClassSource} + ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] nullness edef.EventType.Value | FSEvent(g, p, _, _) -> FindDelegateTypeOfPropertyEvent g amap x.EventName m (p.GetPropertyType(amap, m)) diff --git a/src/Compiler/Checking/infos.fsi b/src/Compiler/Checking/infos.fsi index a2b178d92ac..9ab99a8346b 100644 --- a/src/Compiler/Checking/infos.fsi +++ b/src/Compiler/Checking/infos.fsi @@ -178,13 +178,19 @@ type ILTypeInfo = member TypeInstOfRawMetadata: TypeInst +[] +type ILMethParentTypeInfo = + | IlType of ILTypeInfo + | CSharpStyleExtension of declaring: TyconRef * apparent: TType + + member ToType: TType + /// Describes an F# use of an IL method. [] type ILMethInfo = | ILMethInfo of g: TcGlobals * - ilApparentType: TType * - ilDeclaringTyconRefOpt: TyconRef option * + ilType: ILMethParentTypeInfo * ilMethodDef: ILMethodDef * ilGenericMethodTyArgs: Typars @@ -278,7 +284,7 @@ type ILMethInfo = /// Any type parameters of the enclosing type are instantiated in the type returned. member GetParamNamesAndTypes: amap: ImportMap * m: range * minst: TType list -> ParamNameAndType list - /// Get the argument types of the the IL method. If this is an C#-style extension method + /// Get the argument types of the IL method. If this is an C#-style extension method /// then drop the object argument. member GetParamTypes: amap: ImportMap * m: range * minst: TType list -> TType list @@ -308,6 +314,9 @@ type MethInfo = /// Describes a use of a method backed by Abstract IL # metadata | ILMeth of tcGlobals: TcGlobals * ilMethInfo: ILMethInfo * extensionMethodPriority: ExtensionMethodPriority option + /// A pseudo-method used by F# typechecker to treat Object.ToString() of known types as returning regular string, not `string?` as in the BCL + | MethInfoWithModifiedReturnType of original: MethInfo * modifiedReturnType: TType + /// Describes a use of a pseudo-method corresponding to the default constructor for a .NET struct type | DefaultStructCtor of tcGlobals: TcGlobals * structTy: TType @@ -438,7 +447,7 @@ type MethInfo = /// Receiver must be a struct type. member IsReadOnly: bool - /// Indicates, wheter this method has `IsExternalInit` modreq. + /// Indicates, whether this method has `IsExternalInit` modreq. member HasExternalInit: bool /// Indicates if the enclosing type for the method is a value type. @@ -721,7 +730,7 @@ type ILPropInfo = /// Get the declaring IL type of the IL property, including any generic instantiation member ILTypeInfo: ILTypeInfo - /// Is the property requied (has the RequiredMemberAttribute). + /// Is the property required (has the RequiredMemberAttribute). member IsRequired: bool /// Indicates if the IL property is logically a 'newslot', i.e. hides any previous slots of the same name. @@ -816,10 +825,16 @@ type PropInfo = /// Indicates if this property has an associated setter method. member HasSetter: bool - /// Indidcates whether IL property has an init-only setter (i.e. has the `System.Runtime.CompilerServices.IsExternalInit` modifer) + member GetterAccessibility: Accessibility option + + member SetterAccessibility: Accessibility option + + member IsProtectedAccessibility: struct (bool * bool) + + /// Indicates whether IL property has an init-only setter (i.e. has the `System.Runtime.CompilerServices.IsExternalInit` modifier) member IsSetterInitOnly: bool - /// Is the property requied (has the RequiredMemberAttribute). + /// Is the property required (has the RequiredMemberAttribute). member IsRequired: bool member ImplementedSlotSignatures: SlotSig list diff --git a/src/Compiler/CodeGen/EraseClosures.fs b/src/Compiler/CodeGen/EraseClosures.fs index 7eddfd9b820..ed32d83b369 100644 --- a/src/Compiler/CodeGen/EraseClosures.fs +++ b/src/Compiler/CodeGen/EraseClosures.fs @@ -573,6 +573,7 @@ let rec convIlxClosureDef cenv encl (td: ILTypeDef) clo = genericParams = td.GenericParams, attributes = td.Attributes, implements = [], + implementsCustomAttrs = None, nestedTypes = emptyILTypeDefs, layout = ILTypeDefLayout.Auto, extends = Some cenv.mkILTyFuncTy, @@ -707,6 +708,7 @@ let rec convIlxClosureDef cenv encl (td: ILTypeDef) clo = genericParams = td.GenericParams, attributes = td.Attributes, implements = [], + implementsCustomAttrs = None, layout = ILTypeDefLayout.Auto, nestedTypes = emptyILTypeDefs, extends = Some nowEnvParentClass, diff --git a/src/Compiler/CodeGen/EraseUnions.fs b/src/Compiler/CodeGen/EraseUnions.fs index d5670ed3fdf..88336c057b2 100644 --- a/src/Compiler/CodeGen/EraseUnions.fs +++ b/src/Compiler/CodeGen/EraseUnions.fs @@ -8,6 +8,8 @@ open FSharp.Compiler.IlxGenSupport open System.Collections.Generic open System.Reflection open Internal.Utilities.Library +open FSharp.Compiler.TypedTree +open FSharp.Compiler.TypedTreeOps open FSharp.Compiler.Features open FSharp.Compiler.TcGlobals open FSharp.Compiler.AbstractIL.IL @@ -666,6 +668,7 @@ let emitDataSwitch ilg (cg: ICodeGen<'Mark>) (avoidHelpers, cuspec, cases) = let mkMethodsAndPropertiesForFields (addMethodGeneratedAttrs, addPropertyGeneratedAttrs) + (g: TcGlobals) access attr imports @@ -705,15 +708,28 @@ let mkMethodsAndPropertiesForFields for field in fields do let fspec = mkILFieldSpecInTy (ilTy, field.LowerName, field.Type) + let ilReturn = mkILReturn field.Type + + let ilReturn = + if TryFindILAttribute g.attrib_NullableAttribute field.ILField.CustomAttrs then + let attrs = + field.ILField.CustomAttrs.AsArray() + |> Array.filter (IsILAttrib g.attrib_NullableAttribute) + + ilReturn.WithCustomAttrs(mkILCustomAttrsFromArray attrs) + else + ilReturn + yield mkILNonGenericInstanceMethod ( "get_" + adjustFieldName hasHelpers field.Name, access, [], - mkILReturn field.Type, + ilReturn, mkMethodBody (true, [], 2, nonBranchingInstrsToCode [ mkLdarg 0us; mkNormalLdfld fspec ], attr, imports) ) |> addMethodGeneratedAttrs + ] basicProps, basicMethods @@ -789,7 +805,19 @@ let convAlternativeDef mkMakerName cuspec altName, cud.HelpersAccessibility, fields - |> Array.map (fun fd -> mkILParamNamed (fd.LowerName, fd.Type)) + |> Array.map (fun fd -> + let plainParam = mkILParamNamed (fd.LowerName, fd.Type) + + if TryFindILAttribute g.attrib_NullableAttribute fd.ILField.CustomAttrs then + let attrs = + fd.ILField.CustomAttrs.AsArray() + |> Array.filter (IsILAttrib g.attrib_NullableAttribute) + + { plainParam with + CustomAttrsStored = storeILCustomAttrs (mkILCustomAttrsFromArray attrs) + } + else + plainParam) |> Array.toList, mkILReturn baseTy, mkMethodBody (true, locals, fields.Length + locals.Length, nonBranchingInstrsToCode ilInstrs, attr, imports) @@ -844,18 +872,39 @@ let convAlternativeDef | SpecialFSharpListHelpers -> let baseTesterMeths, baseTesterProps = - if - g.langVersion.SupportsFeature LanguageFeature.UnionIsPropertiesVisible - && cud.HasHelpers = AllHelpers - then - [], [] - elif cud.UnionCases.Length <= 1 then + if cud.UnionCases.Length <= 1 then [], [] elif repr.RepresentOneAlternativeAsNull info then [], [] else + let additionalAttributes = + if + g.checkNullness + && g.langFeatureNullness + && repr.RepresentAlternativeAsStructValue info + && not alt.IsNullary + then + let notnullfields = + alt.FieldDefs + // Fields that are nullable even from F# perspective has an [Nullable] attribute on them + // Non-nullable fields are implicit in F#, therefore not annotated separately + |> Array.filter (fun f -> TryFindILAttribute g.attrib_NullableAttribute f.ILField.CustomAttrs |> not) + + let fieldNames = + notnullfields + |> Array.map (fun f -> f.LowerName) + |> Array.append (notnullfields |> Array.map (fun f -> f.Name)) + + if fieldNames |> Array.isEmpty then + emptyILCustomAttrs + else + mkILCustomAttrsFromArray [| GetNotNullWhenTrueAttribute g fieldNames |] + + else + emptyILCustomAttrs + [ - mkILNonGenericInstanceMethod ( + (mkILNonGenericInstanceMethod ( "get_" + mkTesterName altName, cud.HelpersAccessibility, [], @@ -868,7 +917,8 @@ let convAlternativeDef attr, imports ) - ) + )) + .With(customAttrs = additionalAttributes) |> addMethodGeneratedAttrs ], [ @@ -891,7 +941,7 @@ let convAlternativeDef propertyType = g.ilg.typ_Bool, init = None, args = [], - customAttrs = emptyILCustomAttrs + customAttrs = additionalAttributes ) |> addPropertyGeneratedAttrs |> addPropertyNeverAttrs @@ -900,13 +950,31 @@ let convAlternativeDef let baseMakerMeths, baseMakerProps = if alt.IsNullary then + let attributes = + if + g.checkNullness + && g.langFeatureNullness + && repr.RepresentAlternativeAsNull(info, alt) + then + let noTypars = td.GenericParams.Length + + GetNullableAttribute + g + [ + yield NullnessInfo.WithNull // The top-level value itself, e.g. option, is nullable + yield! List.replicate noTypars NullnessInfo.AmbivalentToNull + ] // The typars are not (i.e. do not change option into option + |> Array.singleton + |> mkILCustomAttrsFromArray + else + emptyILCustomAttrs let nullaryMeth = mkILNonGenericStaticMethod ( "get_" + altName, cud.HelpersAccessibility, [], - mkILReturn baseTy, + (mkILReturn baseTy).WithCustomAttrs attributes, mkMethodBody ( true, [], @@ -930,7 +998,7 @@ let convAlternativeDef propertyType = baseTy, init = None, args = [], - customAttrs = emptyILCustomAttrs + customAttrs = attributes ) |> addPropertyGeneratedAttrs |> addPropertyNeverAttrs @@ -1103,6 +1171,7 @@ let convAlternativeDef let basicProps, basicMethods = mkMethodsAndPropertiesForFields (addMethodGeneratedAttrs, addPropertyGeneratedAttrs) + g cud.UnionCasesAccessibility attr imports @@ -1136,6 +1205,12 @@ let convAlternativeDef .With(customAttrs = mkILCustomAttrs [ GetDynamicDependencyAttribute g 0x660 baseTy ]) |> addMethodGeneratedAttrs + let attrs = + if g.checkNullness && g.langFeatureNullness then + GetNullableContextAttribute g 1uy :: debugAttrs + else + debugAttrs + let altTypeDef = mkILGenericClass ( altTy.TypeSpec.Name, @@ -1154,7 +1229,7 @@ let convAlternativeDef emptyILTypeDefs, mkILProperties basicProps, emptyILEvents, - mkILCustomAttrs debugAttrs, + mkILCustomAttrs attrs, ILTypeInit.BeforeField ) @@ -1276,8 +1351,59 @@ let mkClassUnionDef |> addMethodGeneratedAttrs ] + let fieldDefs = + // Since structs are flattened out for all cases together, all boxed fields are potentially nullable + if + isStruct + && cud.UnionCases.Length > 1 + && g.checkNullness + && g.langFeatureNullness + then + alt.FieldDefs + |> Array.map (fun field -> + if field.Type.IsNominal && field.Type.Boxity = AsValue then + field + else + let attrs = + let existingAttrs = field.ILField.CustomAttrs.AsArray() + + let nullableIdx = + existingAttrs |> Array.tryFindIndex (IsILAttrib g.attrib_NullableAttribute) + + match nullableIdx with + | None -> + existingAttrs + |> Array.append [| GetNullableAttribute g [ NullnessInfo.WithNull ] |] + | Some idx -> + let replacementAttr = + match existingAttrs[idx] with + (* + The attribute carries either a single byte, or a list of bytes for the fields itself and all its generic type arguments + The way we lay out DUs does not affect nullability of the typars of a field, therefore we just change the very first byte + If the field was already declared as nullable (value = 2uy) or ambivalent(value = 0uy), we can keep it that way + If it was marked as non-nullable within that UnionCase, we have to convert it to WithNull (2uy) due to other cases being possible + *) + | Encoded(method, _data, [ ILAttribElem.Byte 1uy ]) -> + mkILCustomAttribMethRef (method, [ ILAttribElem.Byte 2uy ], []) + | Encoded(method, + _data, + [ ILAttribElem.Array(elemType, (ILAttribElem.Byte 1uy) :: otherElems) ]) -> + mkILCustomAttribMethRef ( + method, + [ ILAttribElem.Array(elemType, (ILAttribElem.Byte 2uy) :: otherElems) ], + [] + ) + | attrAsBefore -> attrAsBefore + + existingAttrs |> Array.replace idx replacementAttr + + field.ILField.With(customAttrs = mkILCustomAttrsFromArray attrs) + |> IlxUnionCaseField) + else + alt.FieldDefs + let fieldsToBeAddedIntoType = - alt.FieldDefs + fieldDefs |> Array.filter (fun f -> fieldsEmitted.Add(struct (f.LowerName, f.Type))) let fields = fieldsToBeAddedIntoType |> Array.map mkUnionCaseFieldId |> Array.toList @@ -1285,6 +1411,7 @@ let mkClassUnionDef let props, meths = mkMethodsAndPropertiesForFields (addMethodGeneratedAttrs, addPropertyGeneratedAttrs) + g cud.UnionCasesAccessibility cud.DebugPoint cud.DebugImports @@ -1445,6 +1572,7 @@ let mkClassUnionDef attributes = enum 0, layout = ILTypeDefLayout.Auto, implements = [], + implementsCustomAttrs = None, extends = Some g.ilg.typ_Object, methods = emptyILMethods, securityDecls = emptyILSecurityDecls, @@ -1494,7 +1622,15 @@ let mkClassUnionDef @ List.map (fun (_, _, _, _, fdef, _) -> fdef) altNullaryFields @ td.Fields.AsList() ), - properties = mkILProperties (tagProps @ basePropsFromAlt @ selfProps @ existingProps) + properties = mkILProperties (tagProps @ basePropsFromAlt @ selfProps @ existingProps), + customAttrs = + if cud.IsNullPermitted && g.checkNullness && g.langFeatureNullness then + td.CustomAttrs.AsArray() + |> Array.append [| GetNullableAttribute g [ NullnessInfo.WithNull ] |] + |> mkILCustomAttrsFromArray + |> storeILCustomAttrs + else + td.CustomAttrsStored ) // The .cctor goes on the Cases type since that's where the constant fields for nullary constructors live |> addConstFieldInit diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index c152a0f239a..6758b6dcd94 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -490,7 +490,7 @@ let mkILTyForCompLoc cloc = mkILNonGenericBoxedTy (TypeRefForCompLoc cloc) /// Compute visibility for type members -/// based on hidden and acessibility from the source code +/// based on hidden and accessibility from the source code /// when hidden and realsig is specified then /// as typed in source code, I.e internal or public /// when hidden and not realsig is specified then @@ -642,7 +642,8 @@ and GenNamedTyAppAux (cenv: cenv) m (tyenv: TypeReprEnv) ptrsOK tcref tinst = #if !NO_TYPEPROVIDERS match tcref.TypeReprInfo with // Generate the base type, because that is always the representation of the erased type, unless the assembly is being injected - | TProvidedTypeRepr info when info.IsErased -> GenTypeAux cenv m tyenv VoidNotOK ptrsOK (info.BaseTypeForErased(m, g.obj_ty)) + | TProvidedTypeRepr info when info.IsErased -> + GenTypeAux cenv m tyenv VoidNotOK ptrsOK (info.BaseTypeForErased(m, g.obj_ty_withNulls)) | _ -> #endif GenTyAppAux cenv m tyenv (GenTyconRef tcref) tinst @@ -701,15 +702,11 @@ and GenUnionCaseRef (cenv: cenv) m tyenv i (fspecs: RecdField[]) = let ilFieldDef = mkILInstanceField (fspec.LogicalName, GenType cenv m tyenv fspec.FormalType, None, ILMemberAccess.Public) // These properties on the "field" of an alternative end up going on a property generated by cu_erase.fs - IlxUnionCaseField( - ilFieldDef.With( - customAttrs = - mkILCustomAttrs - [ - (mkCompilationMappingAttrWithVariantNumAndSeqNum g (int SourceConstructFlags.Field) i j) - ] - ) - )) + let attrs = + (mkCompilationMappingAttrWithVariantNumAndSeqNum g (int SourceConstructFlags.Field) i j) + :: GenAdditionalAttributesForTy g fspec.FormalType + + IlxUnionCaseField(ilFieldDef.With(customAttrs = mkILCustomAttrs attrs))) and GenUnionRef (cenv: cenv) m (tcref: TyconRef) = let g = cenv.g @@ -812,7 +809,7 @@ and GenTypeArgs cenv m tyenv tyargs = GenTypeArgsAux cenv m tyenv tyargs // fields are initialized only in their class constructors (we generate one primary // cctor for each file to ensure initialization coherence across the file, regardless // of how many modules are in the file). This means F# passes an extra check applied by SQL Server when it -// verifies stored procedures: SQL Server checks that all 'initionly' static fields are only initialized from +// verifies stored procedures: SQL Server checks that all 'initonly' static fields are only initialized from // their own class constructor. // // However, mutable static fields must be accessible across compilation units. This means we place them in their "natural" location @@ -931,7 +928,7 @@ type ArityInfo = int list // // or, for witnesses: // -// let inline incr{addWitnessForT} (x: 'T) = x + GenericZero<'T> // has witness argment for '+' +// let inline incr{addWitnessForT} (x: 'T) = x + GenericZero<'T> // has witness argument for '+' // // LAM <'T when 'T :... op_Addition ...>{addWitnessForT}. (incr<'T>{addWitnessForT}, incr<'U>{addWitnessForU}, incr<'V>{addWitnessForV}) : ('T -> 'T) * ('U -> 'U) * ('V -> 'V) // directTypars = 'T @@ -1386,7 +1383,7 @@ let GetMethodSpecForMemberVal cenv (memberInfo: ValMemberInfo) (vref: ValRef) = if isCtor || cctor then ILType.Void else ilRetTy let ilTy = - GenType cenv m tyenvUnderTypars (mkAppTy parentTcref (List.map mkTyparTy ctps)) + GenType cenv m tyenvUnderTypars (mkWoNullAppTy parentTcref (List.map mkTyparTy ctps)) let nm = vref.CompiledName g.CompilerGlobalState @@ -1904,13 +1901,30 @@ type TypeDefBuilder(tdef: ILTypeDef, tdefDiscards) = let gevents = ResizeArray(tdef.Events.AsList()) let gnested = TypeDefsBuilder() - member _.Close() = + member _.Close(g: TcGlobals) = + + let attrs = + if g.checkNullness && g.langFeatureNullness then + let attrsBefore = tdef.CustomAttrs + + [| + yield! attrsBefore.AsArray() + if attrsBefore |> TryFindILAttribute g.attrib_AllowNullLiteralAttribute then + yield GetNullableAttribute g [ NullnessInfo.WithNull ] + if (gmethods.Count + gfields.Count + gproperties.Count) > 0 then + yield GetNullableContextAttribute g 1uy + |] + |> mkILCustomAttrsFromArray + else + tdef.CustomAttrs + tdef.With( methods = mkILMethods (ResizeArray.toList gmethods), fields = mkILFields (ResizeArray.toList gfields), properties = mkILProperties (tdef.Properties.AsList() @ HashRangeSorted gproperties), events = mkILEvents (ResizeArray.toList gevents), - nestedTypes = mkILTypeDefs (tdef.NestedTypes.AsList() @ gnested.Close()) + nestedTypes = mkILTypeDefs (tdef.NestedTypes.AsList() @ gnested.Close(g)), + customAttrs = storeILCustomAttrs attrs ) member _.AddEventDef edef = gevents.Add edef @@ -1971,14 +1985,14 @@ and TypeDefsBuilder() = let mutable countDown = System.Int32.MaxValue let mutable countUp = -1 - member b.Close() = + member b.Close(g: TcGlobals) = //The order we emit type definitions is not deterministic since it is using the reverse of a range from a hash table. We should use an approximation of source order. // Ideally it shouldn't matter which order we use. // However, for some tests FSI generated code appears sensitive to the order, especially for nested types. [ for _, (b, eliminateIfEmpty) in tdefs.Values |> Seq.collect id |> Seq.sortBy fst do - let tdef = b.Close() + let tdef = b.Close(g) // Skip the type if it is empty if not eliminateIfEmpty @@ -2056,6 +2070,7 @@ type AnonTypeGenerationTable() = HasReferenceTypeConstraint = false HasNotNullableValueTypeConstraint = false HasDefaultConstructorConstraint = false + HasAllowsRefStruct = false MetadataIndex = NoMetadataIdx } ] @@ -2068,14 +2083,7 @@ type AnonTypeGenerationTable() = mkILFields [ for _, fldName, fldTy in flds -> - - let access = - if cenv.options.isInteractive && cenv.options.fsiMultiAssemblyEmit then - ILMemberAccess.Public - else - ILMemberAccess.Private - - let fdef = mkILInstanceField (fldName, fldTy, None, access) + let fdef = mkILInstanceField (fldName, fldTy, None, ILMemberAccess.Private) let attrs = [ g.CompilerGeneratedAttribute; g.DebuggerBrowsableNeverAttribute ] fdef.With(customAttrs = mkILCustomAttrs attrs) ] @@ -2182,9 +2190,9 @@ type AnonTypeGenerationTable() = [ (g.mk_IStructuralComparable_ty, true, m) (g.mk_IComparable_ty, true, m) - (mkAppTy g.system_GenericIComparable_tcref [ ty ], true, m) + (mkWoNullAppTy g.system_GenericIComparable_tcref [ ty ], true, m) (g.mk_IStructuralEquatable_ty, true, m) - (mkAppTy g.system_GenericIEquatable_tcref [ ty ], true, m) + (mkWoNullAppTy g.system_GenericIEquatable_tcref [ ty ], true, m) ] let vspec1, vspec2 = AugmentTypeDefinitions.MakeValsForEqualsAugmentation g tcref @@ -2426,7 +2434,7 @@ and AssemblyBuilder(cenv: cenv, anonTypeTable: AnonTypeGenerationTable) as mgbuf |> List.sortBy (fst >> (~-)) // invert the result to get 'order-by-descending' behavior (items in list are 0..* so we don't need to worry about int.MinValue) |> List.map snd - gtdefs.Close(), orderedReflectedDefinitions + gtdefs.Close(g), orderedReflectedDefinitions member _.cenv = cenv @@ -4660,7 +4668,7 @@ and GenIndirectCall cenv cgbuf eenv (funcTy, tyargs, curriedArgs, m) sequel = CountCallFuncInstructions() - // Generate the code code an ILX callfunc operation + // Generate the code for an ILX callfunc operation let instrs = EraseClosures.mkCallFunc cenv.ilxPubCloEnv @@ -5107,7 +5115,7 @@ and GenWhileLoop cenv cgbuf eenv (spWhile, condExpr, bodyExpr, m) sequel = // Generate IL assembly code. // Polymorphic IL/ILX instructions may be instantiated when polymorphic code is inlined. // We must implement this for the few uses of polymorphic instructions -// in the standard libarary. +// in the standard library. //-------------------------------------------------------------------------- and GenAsmCode cenv cgbuf eenv (il, tyargs, args, returnTys, m) sequel = @@ -5158,7 +5166,7 @@ and GenAsmCode cenv cgbuf eenv (il, tyargs, args, returnTys, m) sequel = | I_ldsflda fspec, _ -> I_ldsflda(modFieldSpec fspec) | EI_ilzero(ILType.TypeVar _), [ tyarg ] -> EI_ilzero tyarg | AI_nop, _ -> i - // These are embedded in the IL for a an initonly ldfld, i.e. + // These are embedded in the IL for an initonly ldfld, i.e. // here's the relevant comment from tc.fs // "Add an I_nop if this is an initonly field to make sure we never recognize it as an lvalue. See mkExprAddrOfExpr." @@ -5444,7 +5452,7 @@ and CommitCallSequel cenv eenv m cloc cgbuf mustGenerateUnitAfterCall sequel = and MakeNotSupportedExnExpr cenv eenv (argExpr, m) = let g = cenv.g - let ety = mkAppTy (g.FindSysTyconRef [ "System" ] "NotSupportedException") [] + let ety = mkWoNullAppTy (g.FindSysTyconRef [ "System" ] "NotSupportedException") [] let ilTy = GenType cenv m eenv.tyenv ety let mref = mkILCtorMethSpecForTy(ilTy, [ g.ilg.typ_String ]).MethodRef Expr.Op(TOp.ILCall(false, false, false, true, NormalValUse, false, false, mref, [], [], [ ety ]), [], [ argExpr ], m) @@ -5634,6 +5642,30 @@ and GenGenericParam cenv eenv (tp: Typar) = | TyparConstraint.IsNonNullableStruct _ -> true | _ -> false) + let nullnessOfTypar = + if g.langFeatureNullness && g.checkNullness then + let hasNotSupportsNull = + tp.Constraints + |> List.exists (function + | TyparConstraint.NotSupportsNull _ -> true + | _ -> false) + + let hasSupportsNull () = + tp.Constraints + |> List.exists (function + | TyparConstraint.SupportsNull _ -> true + | _ -> false) + + if hasNotSupportsNull || notNullableValueTypeConstraint then + NullnessInfo.WithoutNull + elif refTypeConstraint || hasSupportsNull () then + NullnessInfo.WithNull + else + NullnessInfo.AmbivalentToNull + |> Some + else + None + let defaultConstructorConstraint = tp.Constraints |> List.exists (function @@ -5675,12 +5707,14 @@ and GenGenericParam cenv eenv (tp: Typar) = nm let attributeList = - let defined = GenAttrs cenv eenv tp.Attribs - - if emitUnmanagedInIlOutput then - (GetIsUnmanagedAttribute g) :: defined - else - defined + [ + yield! GenAttrs cenv eenv tp.Attribs + if emitUnmanagedInIlOutput then + yield (GetIsUnmanagedAttribute g) + match nullnessOfTypar with + | Some nullInfo -> yield GetNullableAttribute g [ nullInfo ] + | _ -> () + ] let tpAttrs = mkILCustomAttrs (attributeList) @@ -5700,6 +5734,7 @@ and GenGenericParam cenv eenv (tp: Typar) = HasReferenceTypeConstraint = refTypeConstraint HasNotNullableValueTypeConstraint = notNullableValueTypeConstraint || emitUnmanagedInIlOutput HasDefaultConstructorConstraint = defaultConstructorConstraint + HasAllowsRefStruct = false } //-------------------------------------------------------------------------- @@ -5715,11 +5750,7 @@ and GenSlotParam m cenv eenv slotParam : ILParameter = GenParamAttribs cenv ty attribs let ilAttribs = GenAttrs cenv eenv attribs - - let ilAttribs = - match GenReadOnlyAttributeIfNecessary cenv.g ty with - | Some attr -> ilAttribs @ [ attr ] - | None -> ilAttribs + let ilAttribs = ilAttribs @ GenAdditionalAttributesForTy cenv.g ty { Name = nm @@ -5775,9 +5806,9 @@ and GenFormalReturnType m cenv eenvFormal returnTy : ILReturn = match returnTy with | None -> ilRet | Some ty -> - match GenReadOnlyAttributeIfNecessary cenv.g ty with - | Some attr -> ilRet.WithCustomAttrs(mkILCustomAttrs (ilRet.CustomAttrs.AsList() @ [ attr ])) - | None -> ilRet + match GenAdditionalAttributesForTy cenv.g ty with + | [] -> ilRet + | attrs -> ilRet.WithCustomAttrs(mkILCustomAttrs (ilRet.CustomAttrs.AsList() @ attrs)) and instSlotParam inst (TSlotParam(nm, ty, inFlag, fl2, fl3, attrs)) = TSlotParam(nm, instType inst ty, inFlag, fl2, fl3, attrs) @@ -6224,6 +6255,7 @@ and GenStructStateMachine cenv cgbuf eenvouter (res: LoweredStateMachine) sequel methodImpls = mkILMethodImpls mimpls, nestedTypes = emptyILTypeDefs, implements = ilInterfaceTys, + implementsCustomAttrs = None, extends = Some super, additionalFlags = ILTypeDefAdditionalFlags.None, securityDecls = emptyILSecurityDecls @@ -6657,6 +6689,7 @@ and GenClosureTypeDefs methodImpls = mkILMethodImpls mimpls, nestedTypes = emptyILTypeDefs, implements = ilIntfTys, + implementsCustomAttrs = None, extends = Some ext, additionalFlags = ILTypeDefAdditionalFlags.None, securityDecls = emptyILSecurityDecls @@ -7322,7 +7355,7 @@ and IsSequelImmediate sequel = /// or 'match'. and GenJoinPoint cenv cgbuf pos eenv ty m sequel = - // What the join point does depends on the contents of the sequel. For example, if the sequal is "return" then + // What the join point does depends on the contents of the sequel. For example, if the sequel is "return" then // each branch can just return and no true join point is needed. match sequel with // All of these can be done at the end of each branch - we don't need a real join point @@ -7502,7 +7535,7 @@ and GenDecisionTreeSuccess let genTargetInfoOpt = if generateTargetNow then - // Fenerate the targets in-order only + // Generate the targets in-order only targetNext.Value <- targetNext.Value + 1 Some(GenDecisionTreeTarget cenv cgbuf stackAtTargets targetInfo sequel) else @@ -8361,7 +8394,7 @@ and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt = let access = ComputeMethodAccessRestrictedBySig eenv vspec // because of reflection back-compatability private constructors are treated the same as internal constructors - // Workaround for .NET and Visual Studio restriction w.r.t debugger type proxys + // Workaround for .NET and Visual Studio restriction w.r.t debugger type proxies // Mark internal and private constructors in internal classes as public. let access = // private and internal constructors from source are treated the same @@ -8473,7 +8506,7 @@ and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt = propertyType = ilTy, init = None, args = [], - customAttrs = mkILCustomAttrs ilAttribs + customAttrs = mkILCustomAttrs (GenAdditionalAttributesForTy g vspec.Type @ ilAttribs) ) cgbuf.mgbuf.AddOrMergePropertyDef(ilGetterMethSpec.MethodRef.DeclaringTypeRef, ilPropDef, m) @@ -8550,6 +8583,8 @@ and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt = else GenAttrs cenv eenv vspec.Attribs // literals have no property, so preserve all the attributes on the field itself + let ilAttribs = GenAdditionalAttributesForTy g vspec.Type @ ilAttribs + let ilFieldDef = ilFieldDef.With(customAttrs = mkILCustomAttrs (ilAttribs @ [ g.DebuggerBrowsableNeverAttribute ])) @@ -8571,6 +8606,7 @@ and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt = vspec.Attribs |> List.filter (fun (Attrib(_, _, _, _, _, targets, _)) -> canTarget (targets, System.AttributeTargets.Property)) |> GenAttrs cenv eenv // property only gets attributes that target properties + |> List.append (GenAdditionalAttributesForTy g vspec.Type) let ilPropDef = ILPropertyDef( @@ -8877,11 +8913,7 @@ and GenParams | None -> None, takenNames let ilAttribs = GenAttrs cenv eenv attribs - - let ilAttribs = - match GenReadOnlyAttributeIfNecessary cenv.g methodArgTy with - | Some attr -> ilAttribs @ [ attr ] - | None -> ilAttribs + let ilAttribs = ilAttribs @ GenAdditionalAttributesForTy cenv.g methodArgTy let param: ILParameter = { @@ -8907,10 +8939,7 @@ and GenReturnInfo cenv eenv returnTy ilRetTy (retInfo: ArgReprInfo) : ILReturn = let ilAttribs = match returnTy with - | Some retTy -> - match GenReadOnlyAttributeIfNecessary cenv.g retTy with - | Some attr -> ilAttribs @ [ attr ] - | None -> ilAttribs + | Some retTy -> ilAttribs @ GenAdditionalAttributesForTy cenv.g retTy | _ -> ilAttribs let ilAttrs = mkILCustomAttrs ilAttribs @@ -9245,9 +9274,7 @@ and GenMethodForBinding || memberInfo.MemberFlags.MemberKind = SynMemberKind.PropertySet || memberInfo.MemberFlags.MemberKind = SynMemberKind.PropertyGetSet -> - match GenReadOnlyAttributeIfNecessary cenv.g returnTy with - | Some ilAttr -> ilAttr - | _ -> () + yield! GenAdditionalAttributesForTy cenv.g returnTy | _ -> () ] @@ -10536,6 +10563,8 @@ and GenWitnessParams cenv eenv m (witnessInfos: TraitWitnessInfos) = let nm = String.uncapitalize witnessInfo.MemberName let nm = if used.Contains nm then nm + string i else nm + let attribs = GenAdditionalAttributesForTy cenv.g ty + let ilParam: ILParameter = { Name = Some nm @@ -10545,7 +10574,7 @@ and GenWitnessParams cenv eenv m (witnessInfos: TraitWitnessInfos) = IsIn = false IsOut = false IsOptional = false - CustomAttrsStored = storeILCustomAttrs (mkILCustomAttrs []) + CustomAttrsStored = storeILCustomAttrs (mkILCustomAttrs attribs) MetadataIndex = NoMetadataIdx } @@ -10577,9 +10606,7 @@ and GenAbstractBinding cenv eenv tref (vref: ValRef) = || memberInfo.MemberFlags.MemberKind = SynMemberKind.PropertySet || memberInfo.MemberFlags.MemberKind = SynMemberKind.PropertyGetSet -> - match GenReadOnlyAttributeIfNecessary cenv.g returnTy with - | Some ilAttr -> ilAttr - | _ -> () + yield! GenAdditionalAttributesForTy cenv.g returnTy | _ -> () ] @@ -10748,6 +10775,19 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option tycon.ImmediateInterfaceTypesOfFSharpTycon |> List.map (GenType cenv m eenvinner.tyenv) + let ilIntCustomAttrs = + if g.langFeatureNullness && g.checkNullness && not (isNil ilIntfTys) then + tycon.ImmediateInterfaceTypesOfFSharpTycon + |> List.map ( + GenAdditionalAttributesForTy g + >> mkILCustomAttrs + >> ILAttributesStored.Given + >> (fun x -> x, 0) + ) + |> Some + else + None + let ilTypeName = tref.Name let hidden = IsHiddenTycon eenv.sigToImplRemapInfo tycon @@ -10777,7 +10817,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option Option.isNone tycon.GeneratedCompareToValues && Option.isNone tycon.GeneratedHashAndEqualsValues && tycon.HasInterface g g.mk_IComparable_ty - && not (tycon.HasOverride g "Equals" [ g.obj_ty ]) + && not (tycon.HasOverride g "Equals" [ g.obj_ty_ambivalent ]) && not tycon.IsFSharpInterfaceTycon then [ GenEqualsOverrideCallingIComparable cenv (tcref, ilThisTy, ilThisTy) ] @@ -10920,6 +10960,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option else ILTypeDefKind.Class | TFSharpClass -> ILTypeDefKind.Class + | TFSharpStruct -> ILTypeDefKind.ValueType | TFSharpInterface -> ILTypeDefKind.Interface | TFSharpEnum -> ILTypeDefKind.Enum @@ -11015,13 +11056,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option // The IL field is hidden if the property/field is hidden OR we're using a property // AND the field is not mutable (because we can take the address of a mutable field). // Otherwise fields are always accessed via their property getters/setters - // - // Additionally, don't hide fields for multiemit in F# Interactive - let isFieldHidden = - isPropHidden - || (not useGenuineField - && not isFSharpMutable - && not (cenv.options.isInteractive && cenv.options.fsiMultiAssemblyEmit)) + let isFieldHidden = isPropHidden || (not useGenuineField && not isFSharpMutable) let extraAttribs = match tyconRepr with @@ -11042,7 +11077,12 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option literalValue = None, offset = ilFieldOffset, marshal = None, - customAttrs = mkILCustomAttrs (GenAttrs cenv eenv fattribs @ extraAttribs) + customAttrs = + mkILCustomAttrs ( + GenAttrs cenv eenv fattribs + @ extraAttribs + @ GenAdditionalAttributesForTy g fspec.FormalType + ) ) .WithAccess(access) .WithStatic(isStatic) @@ -11357,16 +11397,20 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option let ilAttrs = ilCustomAttrs @ [ - mkCompilationMappingAttr - g - (int ( - if isObjectType then - SourceConstructFlags.ObjectType - elif hiddenRepr then - SourceConstructFlags.RecordType ||| SourceConstructFlags.NonPublicRepresentation - else - SourceConstructFlags.RecordType - )) + yield + mkCompilationMappingAttr + g + (int ( + if isObjectType then + SourceConstructFlags.ObjectType + elif hiddenRepr then + SourceConstructFlags.RecordType ||| SourceConstructFlags.NonPublicRepresentation + else + SourceConstructFlags.RecordType + )) + + if not (ilBaseTy.GenericArgs.IsEmpty) then + yield! GenAdditionalAttributesForTy g super ] let isKnownToBeAttribute = @@ -11403,7 +11447,11 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option .WithSerializable(isSerializable) .WithAbstract(isAbstract) .WithImport(isComInteropTy g thisTy) - .With(methodImpls = mkILMethodImpls methodImpls, newAdditionalFlags = additionalFlags) + .With( + methodImpls = mkILMethodImpls methodImpls, + newAdditionalFlags = additionalFlags, + implementsCustomAttrs = ilIntCustomAttrs + ) let tdLayout, tdEncoding = match TryFindFSharpAttribute g g.attrib_StructLayoutAttribute tycon.Attribs with @@ -11566,6 +11614,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option methodImpls = mkILMethodImpls methodImpls, nestedTypes = emptyILTypeDefs, implements = ilIntfTys, + implementsCustomAttrs = None, extends = Some( if tycon.IsStructOrEnumTycon then @@ -11608,19 +11657,24 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option // private static field for lists etc. // // Also discard the F#-compiler supplied implementation of the Empty, IsEmpty, Value and None properties. + let tdefDiscards = Some( (fun (md: ILMethodDef) -> (cuinfo.HasHelpers = SpecialFSharpListHelpers && (md.Name = "get_Empty" || md.Name = "Cons" || md.Name = "get_IsEmpty")) || (cuinfo.HasHelpers = SpecialFSharpOptionHelpers - && (md.Name = "get_Value" || md.Name = "get_None" || md.Name = "Some"))), + && (md.Name = "get_Value" || md.Name = "get_None" || md.Name = "Some")) + || (cuinfo.HasHelpers = AllHelpers + && (md.Name.StartsWith("get_Is") && not (tdef2.Methods.FindByName(md.Name).IsEmpty)))), (fun (pd: ILPropertyDef) -> (cuinfo.HasHelpers = SpecialFSharpListHelpers && (pd.Name = "Empty" || pd.Name = "IsEmpty")) || (cuinfo.HasHelpers = SpecialFSharpOptionHelpers - && (pd.Name = "Value" || pd.Name = "None"))) + && (pd.Name = "Value" || pd.Name = "None")) + || (cuinfo.HasHelpers = AllHelpers + && (pd.Name.StartsWith("Is") && not (tdef2.Properties.LookupByName(pd.Name).IsEmpty)))) ) tdef2, tdefDiscards @@ -12029,14 +12083,14 @@ let LookupGeneratedValue (cenv: cenv) (ctxt: ExecutionContext) eenv (v: Val) = if hasLiteralAttr then let staticTy = ctxt.LookupTypeRef fspec.DeclaringTypeRef // Checked: This FieldInfo (FieldBuilder) supports GetValue(). - staticTy.GetField(fspec.Name).GetValue(null: obj) + (!! staticTy.GetField(fspec.Name)).GetValue(null: obj MaybeNull) else let staticTy = ctxt.LookupTypeRef ilContainerTy.TypeRef // We can't call .Invoke on the ILMethodRef's MethodInfo, // because it is the MethodBuilder and that does not support Invoke. // Rather, we look for the getter MethodInfo from the built type and .Invoke on that. let methInfo = - staticTy.GetMethod(ilGetterMethRef.Name, BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic) + !! staticTy.GetMethod(ilGetterMethRef.Name, BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic) methInfo.Invoke(null, null) @@ -12049,7 +12103,7 @@ let LookupGeneratedValue (cenv: cenv) (ctxt: ExecutionContext) eenv (v: Val) = // because it is the MethodBuilder and that does not support Invoke. // Rather, we look for the getter MethodInfo from the built type and .Invoke on that. let methInfo = - staticTy.GetMethod(ilGetterMethSpec.Name, BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic) + !! staticTy.GetMethod(ilGetterMethSpec.Name, BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic) methInfo.Invoke(null, null) @@ -12066,7 +12120,7 @@ let LookupGeneratedValue (cenv: cenv) (ctxt: ExecutionContext) eenv (v: Val) = #endif None -// Invoke the set_Foo method for a declaration with a value. Used to create variables with values programatically in fsi.exe. +// Invoke the set_Foo method for a declaration with a value. Used to create variables with values programmatically in fsi.exe. let SetGeneratedValue (ctxt: ExecutionContext) eenv isForced (v: Val) (value: obj) = try match StorageForVal v.Range v eenv with @@ -12076,14 +12130,14 @@ let SetGeneratedValue (ctxt: ExecutionContext) eenv isForced (v: Val) (value: ob let staticTy = ctxt.LookupTypeRef fspec.DeclaringTypeRef let fieldInfo = - staticTy.GetField(fspec.Name, BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic) + !! staticTy.GetField(fspec.Name, BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic) fieldInfo.SetValue(null, value) else let staticTy = ctxt.LookupTypeRef ilSetterMethRef.DeclaringTypeRef let methInfo = - staticTy.GetMethod(ilSetterMethRef.Name, BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic) + !! staticTy.GetMethod(ilSetterMethRef.Name, BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic) methInfo.Invoke(null, [| value |]) |> ignore | _ -> () diff --git a/src/Compiler/CodeGen/IlxGenSupport.fs b/src/Compiler/CodeGen/IlxGenSupport.fs index a0fa11a4a31..073b4473ea9 100644 --- a/src/Compiler/CodeGen/IlxGenSupport.fs +++ b/src/Compiler/CodeGen/IlxGenSupport.fs @@ -8,6 +8,7 @@ open Internal.Utilities.Library open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.TcGlobals open FSharp.Compiler.TypedTreeOps +open FSharp.Compiler.TypedTree /// Make a method that simply loads a field let mkLdfldMethodDef (ilMethName, iLAccess, isStatic, ilTy, ilFieldName, ilPropType, customAttrs) = @@ -68,7 +69,22 @@ let mkILNonGenericInstanceProperty (name, ilType, propertyAttribute, customAttri customAttrs = customAttributes ) -let mkLocalPrivateAttributeWithPropertyConstructors (g: TcGlobals, name: string, attrProperties: (string * ILType) list option) = +type AttrDataGenerationStyle = + | PublicFields + | EncapsulatedProperties + +let getFieldMemberAccess = + function + | PublicFields -> ILMemberAccess.Public + | EncapsulatedProperties -> ILMemberAccess.Private + +let mkLocalPrivateAttributeWithPropertyConstructors + ( + g: TcGlobals, + name: string, + attrProperties: (string * ILType) list option, + codegenStyle: AttrDataGenerationStyle + ) = let ilTypeRef = mkILTyRef (ILScopeRef.Local, name) let ilTy = mkILFormalNamedTy ILBoxity.AsObject ilTypeRef [] @@ -76,21 +92,34 @@ let mkLocalPrivateAttributeWithPropertyConstructors (g: TcGlobals, name: string, attrProperties |> Option.defaultValue [] |> List.map (fun (name, ilType) -> - let fieldName = name + "@" - - (g.AddFieldGeneratedAttributes(mkILInstanceField (fieldName, ilType, None, ILMemberAccess.Private))), - (g.AddMethodGeneratedAttributes(mkLdfldMethodDef ($"get_{name}", ILMemberAccess.Public, false, ilTy, fieldName, ilType, []))), - (g.AddPropertyGeneratedAttributes( - mkILNonGenericInstanceProperty ( - name, - ilType, - PropertyAttributes.None, - emptyILCustomAttrs, - Some(mkILMethRef (ilTypeRef, ILCallingConv.Instance, "get_" + name, 0, [], ilType)), - None - ) - )), - (name, fieldName, ilType)) + match codegenStyle with + | PublicFields -> + (g.AddFieldGeneratedAttributes(mkILInstanceField (name, ilType, None, getFieldMemberAccess codegenStyle))), + [], + [], + (name, name, ilType) + | EncapsulatedProperties -> + let fieldName = name + "@" + + (g.AddFieldGeneratedAttributes(mkILInstanceField (fieldName, ilType, None, getFieldMemberAccess codegenStyle))), + [ + g.AddMethodGeneratedAttributes( + mkLdfldMethodDef ($"get_{name}", ILMemberAccess.Public, false, ilTy, fieldName, ilType, []) + ) + ], + [ + g.AddPropertyGeneratedAttributes( + mkILNonGenericInstanceProperty ( + name, + ilType, + PropertyAttributes.None, + emptyILCustomAttrs, + Some(mkILMethRef (ilTypeRef, ILCallingConv.Instance, "get_" + name, 0, [], ilType)), + None + ) + ) + ], + (name, fieldName, ilType)) // Generate constructor with required arguments let ilCtorDef = @@ -106,8 +135,6 @@ let mkLocalPrivateAttributeWithPropertyConstructors (g: TcGlobals, name: string, ) ) - let ilCustomAttrs = mkILCustomAttrsFromArray [| g.CompilerGeneratedAttribute |] - mkILGenericClass ( name, ILTypeDefAccess.Private, @@ -116,13 +143,75 @@ let mkLocalPrivateAttributeWithPropertyConstructors (g: TcGlobals, name: string, ILTypes.Empty, mkILMethods ( ilCtorDef - :: (ilElements |> List.fold (fun acc (_, getter, _, _) -> getter :: acc) []) + :: (ilElements |> List.fold (fun acc (_, getter, _, _) -> getter @ acc) []) ), mkILFields (ilElements |> List.map (fun (field, _, _, _) -> field)), emptyILTypeDefs, - mkILProperties (ilElements |> List.map (fun (_, _, property, _) -> property)), + mkILProperties (ilElements |> List.collect (fun (_, _, props, _) -> props)), emptyILEvents, - ilCustomAttrs, + mkILCustomAttrsFromArray [| g.CompilerGeneratedAttribute |], + ILTypeInit.BeforeField + ) + +let mkLocalPrivateAttributeWithByteAndByteArrayConstructors (g: TcGlobals, name: string, bytePropertyName: string) = + let ilTypeRef = mkILTyRef (ILScopeRef.Local, name) + let ilTy = mkILFormalNamedTy ILBoxity.AsObject ilTypeRef [] + + let fieldName = bytePropertyName + let fieldType = g.ilg.typ_ByteArray + + let fieldDef = + g.AddFieldGeneratedAttributes(mkILInstanceField (fieldName, fieldType, None, ILMemberAccess.Public)) + + // Constructor taking an array + let ilArrayCtorDef = + g.AddMethodGeneratedAttributes( + mkILSimpleStorageCtorWithParamNames ( + Some g.ilg.typ_Attribute.TypeSpec, + ilTy, + [], + [ (fieldName, fieldName, fieldType) ], + ILMemberAccess.Public, + None, + None + ) + ) + + let ilScalarCtorDef = + let scalarValueIlType = g.ilg.typ_Byte + + g.AddMethodGeneratedAttributes( + let code = + [ + mkLdarg0 + mkNormalCall (mkILCtorMethSpecForTy (mkILBoxedType g.ilg.typ_Attribute.TypeSpec, [])) // Base class .ctor + + mkLdarg0 // Prepare 'this' to be on bottom of the stack + mkLdcInt32 1 + I_newarr(ILArrayShape.SingleDimensional, scalarValueIlType) // new byte[1] + AI_dup // Duplicate the array pointer in stack, 1 for stelem and 1 for stfld + mkLdcInt32 0 + mkLdarg 1us + I_stelem DT_I1 // array[0] = argument from .ctor + mkNormalStfld (mkILFieldSpecInTy (ilTy, fieldName, fieldType)) + ] + + let body = mkMethodBody (false, [], 8, nonBranchingInstrsToCode code, None, None) + mkILCtor (ILMemberAccess.Public, [ mkILParamNamed ("scalarByteValue", scalarValueIlType) ], body) + ) + + mkILGenericClass ( + name, + ILTypeDefAccess.Private, + ILGenericParameterDefs.Empty, + g.ilg.typ_Attribute, + ILTypes.Empty, + mkILMethods ([ ilScalarCtorDef; ilArrayCtorDef ]), + mkILFields [ fieldDef ], + emptyILTypeDefs, + emptyILProperties, + emptyILEvents, + mkILCustomAttrsFromArray [| g.CompilerGeneratedAttribute |], ILTypeInit.BeforeField ) @@ -159,23 +248,16 @@ let mkLocalPrivateInt32Enum (g: TcGlobals, tref: ILTypeRef, values: (string * in // Generate Local embeddable versions of framework types when necessary //-------------------------------------------------------------------------- -let private getPotentiallyEmbedableAttribute (g: TcGlobals) (info: BuiltinAttribInfo) = +let private getPotentiallyEmbeddableAttribute (g: TcGlobals) (info: BuiltinAttribInfo) = let tref = info.TypeRef g.TryEmbedILType(tref, (fun () -> mkLocalPrivateAttributeWithDefaultConstructor (g, tref.Name))) mkILCustomAttribute (info.TypeRef, [], [], []) let GetReadOnlyAttribute (g: TcGlobals) = - getPotentiallyEmbedableAttribute g g.attrib_IsReadOnlyAttribute + getPotentiallyEmbeddableAttribute g g.attrib_IsReadOnlyAttribute let GetIsUnmanagedAttribute (g: TcGlobals) = - getPotentiallyEmbedableAttribute g g.attrib_IsUnmanagedAttribute - -let GenReadOnlyAttributeIfNecessary g ty = - if isInByrefTy g ty then - let attr = GetReadOnlyAttribute g - Some attr - else - None + getPotentiallyEmbeddableAttribute g g.attrib_IsUnmanagedAttribute let GetDynamicallyAccessedMemberTypes (g: TcGlobals) = let tref = g.enum_DynamicallyAccessedMemberTypes.TypeRef @@ -220,7 +302,7 @@ let GetDynamicDependencyAttribute (g: TcGlobals) memberTypes (ilType: ILType) = let properties = Some [ "MemberType", GetDynamicallyAccessedMemberTypes g; "Type", g.ilg.typ_Type ] - mkLocalPrivateAttributeWithPropertyConstructors (g, tref.Name, properties)) + mkLocalPrivateAttributeWithPropertyConstructors (g, tref.Name, properties, EncapsulatedProperties)) ) let typIlMemberTypes = @@ -233,6 +315,168 @@ let GetDynamicDependencyAttribute (g: TcGlobals) memberTypes (ilType: ILType) = [] ) +/// Generates NullableContextAttribute[1], which has the meaning of: +/// Nested items not being annotated with Nullable attribute themselves are interpreted as being withoutnull +/// Doing it that way is a heuristical decision supporting limited usage of (| null) annotations and not allowing nulls in >50% of F# code +/// (if majority of fields/parameters/return values would be nullable, this heuristic would lead to bloat of generated metadata) +let GetNullableContextAttribute (g: TcGlobals) flagValue = + let tref = g.attrib_NullableContextAttribute.TypeRef + + g.TryEmbedILType( + tref, + (fun () -> + let fields = Some [ "Flag", g.ilg.typ_Byte ] + mkLocalPrivateAttributeWithPropertyConstructors (g, tref.Name, fields, PublicFields)) + ) + + mkILCustomAttribute (tref, [ g.ilg.typ_Byte ], [ ILAttribElem.Byte flagValue ], []) + +let GetNotNullWhenTrueAttribute (g: TcGlobals) (propNames: string array) = + let tref = g.attrib_MemberNotNullWhenAttribute.TypeRef + + g.TryEmbedILType( + tref, + (fun () -> + let fields = + Some [ "ReturnValue", g.ilg.typ_Bool; "Members", g.ilg.typ_StringArray ] + + mkLocalPrivateAttributeWithPropertyConstructors (g, tref.Name, fields, EncapsulatedProperties)) + ) + + let stringArgs = + propNames |> Array.map (Some >> ILAttribElem.String) |> List.ofArray + + mkILCustomAttribute ( + tref, + [ g.ilg.typ_Bool; g.ilg.typ_StringArray ], + [ ILAttribElem.Bool true; ILAttribElem.Array(g.ilg.typ_String, stringArgs) ], + [] + ) + +let GetNullableAttribute (g: TcGlobals) (nullnessInfos: TypedTree.NullnessInfo list) = + let tref = g.attrib_NullableAttribute.TypeRef + + g.TryEmbedILType(tref, (fun () -> mkLocalPrivateAttributeWithByteAndByteArrayConstructors (g, tref.Name, "NullableFlags"))) + + let byteValue ni = + match ni with + | NullnessInfo.WithNull -> 2uy + | NullnessInfo.AmbivalentToNull -> 0uy + | NullnessInfo.WithoutNull -> 1uy + + let bytes = nullnessInfos |> List.map (fun ni -> byteValue ni |> ILAttribElem.Byte) + + match bytes with + | [ singleByte ] -> mkILCustomAttribute (tref, [ g.ilg.typ_Byte ], [ singleByte ], []) + | listOfBytes -> mkILCustomAttribute (tref, [ g.ilg.typ_ByteArray ], [ ILAttribElem.Array(g.ilg.typ_Byte, listOfBytes) ], []) + +let GenReadOnlyIfNecessary g ty = + if isInByrefTy g ty then + let attr = GetReadOnlyAttribute g + Some attr + else + None + +(* Nullness metadata format in C#: https://github.com/dotnet/roslyn/blob/main/docs/features/nullable-metadata.md +Each type reference in metadata may have an associated NullableAttribute with a byte[] where each byte represents nullability: 0 for oblivious, 1 for not annotated, and 2 for annotated. + +The byte[] is constructed as follows: + +Reference type: the nullability (0, 1, or 2), followed by the representation of the type arguments in order including containing types +Nullable value type: the representation of the type argument only +Non-generic value type: skipped +Generic value type: 0, followed by the representation of the type arguments in order including containing types +Array: the nullability (0, 1, or 2), followed by the representation of the element type +Tuple: the representation of the underlying constructed type +Type parameter reference: the nullability (0, 1, or 2, with 0 for unconstrained type parameter) +*) +let rec GetNullnessFromTType (g: TcGlobals) ty = + match ty |> stripTyEqns g with + | TType_app(tcref, tinst, nullness) -> + let isValueType = tcref.IsStructOrEnumTycon + let isNonGeneric = tinst.IsEmpty + + if isNonGeneric && isValueType then + // Non-generic value type: skipped + [] + else + [ + if tyconRefEq g g.system_Nullable_tcref tcref then + // Nullable value type: the representation of the type argument only + () + else if isValueType then + // Generic value type: 0, followed by the representation of the type arguments in order including containing types + yield NullnessInfo.AmbivalentToNull + else if + IsUnionTypeWithNullAsTrueValue g tcref.Deref + || TypeHasAllowNull tcref g FSharp.Compiler.Text.Range.Zero + then + yield NullnessInfo.WithNull + else + // Reference type: the nullability (0, 1, or 2), followed by the representation of the type arguments in order including containing types + yield nullness.Evaluate() + + for tt in tinst do + yield! GetNullnessFromTType g tt + ] + + | TType_fun(domainTy, retTy, nullness) -> + // FsharpFunc + [ + yield nullness.Evaluate() + yield! GetNullnessFromTType g domainTy + yield! GetNullnessFromTType g retTy + ] + + | TType_tuple(tupInfo, elementTypes) -> + // Tuple: the representation of the underlying constructed type + [ + if evalTupInfoIsStruct tupInfo then + yield NullnessInfo.AmbivalentToNull + else + yield NullnessInfo.WithoutNull + for t in elementTypes do + yield! GetNullnessFromTType g t + ] + + | TType_anon(anonInfo, tys) -> + // It is unlikely for an anon type to be used from C# due to the mangled name, but can still carry the nullability info about it's generic type arguments == the types of the fields + [ + if evalAnonInfoIsStruct anonInfo then + yield NullnessInfo.AmbivalentToNull + else + yield NullnessInfo.WithoutNull + for t in tys do + yield! GetNullnessFromTType g t + ] + | TType_forall _ + | TType_ucase _ + | TType_measure _ -> [] + | TType_var(nullness = nullness) -> [ nullness.Evaluate() ] + +let GenNullnessIfNecessary (g: TcGlobals) ty = + if g.langFeatureNullness && g.checkNullness then + let nullnessList = GetNullnessFromTType g ty + + match nullnessList with + // Optimizations as done in C# :: If the byte[] is empty, the NullableAttribute is omitted. + | [] -> None + // Optimizations as done in C# :: If all values in the byte[] are the same, the NullableAttribute is constructed with that single byte value. + | head :: tail when tail |> List.forall ((=) head) -> + match head with + // For F# code, each type has an automatically generated NullableContextAttribute(1) + // That means an implicit (hidden, not generated) Nullable(1) attribute + | NullnessInfo.WithoutNull -> None + | _ -> GetNullableAttribute g [ head ] |> Some + | nonUniformList -> GetNullableAttribute g nonUniformList |> Some + else + None + +let GenAdditionalAttributesForTy g ty = + let readOnly = GenReadOnlyIfNecessary g ty |> Option.toList + let nullable = GenNullnessIfNecessary g ty |> Option.toList + readOnly @ nullable + /// Generate "modreq([mscorlib]System.Runtime.InteropServices.InAttribute)" on inref types. let GenReadOnlyModReqIfNecessary (g: TcGlobals) ty ilTy = let add = isInByrefTy g ty && g.attrib_InAttribute.TyconRef.CanDeref diff --git a/src/Compiler/CodeGen/IlxGenSupport.fsi b/src/Compiler/CodeGen/IlxGenSupport.fsi index 24968a25ec6..5661eadd502 100644 --- a/src/Compiler/CodeGen/IlxGenSupport.fsi +++ b/src/Compiler/CodeGen/IlxGenSupport.fsi @@ -19,6 +19,9 @@ val mkLdfldMethodDef: val GetDynamicDependencyAttribute: g: TcGlobals -> memberTypes: int32 -> ilType: ILType -> ILAttribute val GenReadOnlyModReqIfNecessary: g: TcGlobals -> ty: TypedTree.TType -> ilTy: ILType -> ILType -val GenReadOnlyAttributeIfNecessary: g: TcGlobals -> ty: TypedTree.TType -> ILAttribute option +val GenAdditionalAttributesForTy: g: TcGlobals -> ty: TypedTree.TType -> ILAttribute list val GetReadOnlyAttribute: g: TcGlobals -> ILAttribute val GetIsUnmanagedAttribute: g: TcGlobals -> ILAttribute +val GetNullableAttribute: g: TcGlobals -> nullnessInfos: TypedTree.NullnessInfo list -> ILAttribute +val GetNullableContextAttribute: g: TcGlobals -> byte -> ILAttribute +val GetNotNullWhenTrueAttribute: g: TcGlobals -> string array -> ILAttribute diff --git a/src/Compiler/DependencyManager/AssemblyResolveHandler.fs b/src/Compiler/DependencyManager/AssemblyResolveHandler.fs index c7f56c903f7..a511f39bdb2 100644 --- a/src/Compiler/DependencyManager/AssemblyResolveHandler.fs +++ b/src/Compiler/DependencyManager/AssemblyResolveHandler.fs @@ -6,6 +6,7 @@ open System open System.IO open System.Reflection open Internal.Utilities.FSharpEnvironment +open Internal.Utilities.Library /// Signature for ResolutionProbe callback /// host implements this, it's job is to return a list of assembly paths to probe. @@ -14,25 +15,24 @@ type AssemblyResolutionProbe = delegate of Unit -> seq /// Type that encapsulates AssemblyResolveHandler for managed packages type AssemblyResolveHandlerCoreclr(assemblyProbingPaths: AssemblyResolutionProbe option) as this = let loadContextType = - Type.GetType("System.Runtime.Loader.AssemblyLoadContext, System.Runtime.Loader", false) + !! Type.GetType("System.Runtime.Loader.AssemblyLoadContext, System.Runtime.Loader", false) let loadFromAssemblyPathMethod = - loadContextType.GetMethod("LoadFromAssemblyPath", [| typeof |]) + !! loadContextType.GetMethod("LoadFromAssemblyPath", [| typeof |]) - let eventInfo = loadContextType.GetEvent("Resolving") + let eventInfo = !! loadContextType.GetEvent("Resolving") let handler, defaultAssemblyLoadContext = let ti = typeof let gmi = - ti.GetMethod("ResolveAssemblyNetStandard", BindingFlags.Instance ||| BindingFlags.NonPublic) + !! ti.GetMethod("ResolveAssemblyNetStandard", BindingFlags.Instance ||| BindingFlags.NonPublic) let mi = gmi.MakeGenericMethod(loadContextType) - let del = Delegate.CreateDelegate(eventInfo.EventHandlerType, this, mi) + let del = Delegate.CreateDelegate(!!eventInfo.EventHandlerType, this, mi) let prop = - loadContextType - .GetProperty("Default", BindingFlags.Static ||| BindingFlags.Public) + (!! loadContextType.GetProperty("Default", BindingFlags.Static ||| BindingFlags.Public)) .GetValue(null, null) del, prop @@ -113,7 +113,7 @@ type AssemblyResolveHandler internal (assemblyProbingPaths: AssemblyResolutionPr else new AssemblyResolveHandlerDeskTop(assemblyProbingPaths) :> IDisposable) - new(assemblyProbingPaths: AssemblyResolutionProbe) = new AssemblyResolveHandler(Option.ofObj assemblyProbingPaths) + new(assemblyProbingPaths: AssemblyResolutionProbe MaybeNull) = new AssemblyResolveHandler(Option.ofObj assemblyProbingPaths) interface IDisposable with member _.Dispose() = diff --git a/src/Compiler/DependencyManager/DependencyProvider.fs b/src/Compiler/DependencyManager/DependencyProvider.fs index 858cf84fc1a..709899e9a05 100644 --- a/src/Compiler/DependencyManager/DependencyProvider.fs +++ b/src/Compiler/DependencyManager/DependencyProvider.fs @@ -15,8 +15,11 @@ open System.Collections.Concurrent module Option = /// Convert string into Option string where null and String.Empty result in None - let ofString s = - if String.IsNullOrEmpty(s) then None else Some(s) + let ofString (s: string MaybeNull) = + match s with + | null -> None + | "" -> None + | s -> Some s [] module ReflectionHelper = @@ -57,31 +60,27 @@ module ReflectionHelper = let instanceFlags = BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.Instance - let property = - theType.GetProperty(propertyName, instanceFlags, null, typeof<'T>, [||], [||]) - - if isNull property then - None - else - let getMethod = property.GetGetMethod() - - if not (isNull getMethod) && not getMethod.IsStatic then - Some property - else - None + match theType.GetProperty(propertyName, instanceFlags, null, typeof<'T>, [||], [||]) with + | null -> None + | property -> + match property.GetGetMethod() with + | null -> None + | getMethod when getMethod.IsStatic -> None + | _ -> Some property with _ -> None let getInstanceMethod<'T> (theType: Type) (parameterTypes: Type[]) methodName = try - let theMethod = theType.GetMethod(methodName, parameterTypes) - if isNull theMethod then None else Some theMethod + match theType.GetMethod(methodName, parameterTypes) with + | null -> None + | theMethod -> Some theMethod with _ -> None let stripTieWrapper (e: Exception) = match e with - | :? TargetInvocationException as e -> e.InnerException + | :? TargetInvocationException as e when isNotNull e.InnerException -> !!e.InnerException | _ -> e /// Indicate the type of error to report @@ -96,7 +95,7 @@ type ResolvingErrorReport = delegate of ErrorReportType * int * string -> unit /// The results of ResolveDependencies type IResolveDependenciesResult = - /// Succeded? + /// Succeeded? abstract Success: bool /// The resolution output log @@ -105,7 +104,7 @@ type IResolveDependenciesResult = /// The resolution error log (* process stderror *) abstract StdError: string[] - /// The resolution paths - the full paths to selcted resolved dll's. + /// The resolution paths - the full paths to selected resolved dll's. /// In scripts this is equivalent to #r @"c:\somepath\to\packages\ResolvedPackage\1.1.1\lib\netstandard2.0\ResolvedAssembly.dll" abstract Resolutions: seq @@ -124,7 +123,9 @@ type IResolveDependenciesResult = /// #I @"c:\somepath\to\packages\1.1.1\ResolvedPackage" abstract Roots: seq +#if NO_CHECKNULLS [] +#endif type IDependencyManagerProvider = abstract Name: string abstract Key: string @@ -323,7 +324,7 @@ type ReflectionDependencyManagerProvider static member MakeResultFromObject(result: obj) = { new IResolveDependenciesResult with - /// Succeded? + /// Succeeded? member _.Success = match getInstanceProperty (result.GetType()) "Success" with | None -> false @@ -370,7 +371,7 @@ type ReflectionDependencyManagerProvider roots: seq ) = { new IResolveDependenciesResult with - /// Succeded? + /// Succeeded? member _.Success = success /// The resolution output log @@ -418,7 +419,7 @@ type ReflectionDependencyManagerProvider rid, timeout ) : IResolveDependenciesResult = - // The ResolveDependencies method, has two signatures, the original signaature in the variable resolveDeps and the updated signature resolveDepsEx + // The ResolveDependencies method, has two signatures, the original signature in the variable resolveDeps and the updated signature resolveDepsEx // the resolve method can return values in two different tuples: // (bool * string list * string list * string list) // (bool * string list * string list) @@ -498,7 +499,7 @@ type DependencyProvider let assemblyLocation = typeof.GetTypeInfo().Assembly.Location - yield Path.GetDirectoryName assemblyLocation + yield !!(Path.GetDirectoryName assemblyLocation) yield AppDomain.CurrentDomain.BaseDirectory ]) diff --git a/src/Compiler/DependencyManager/DependencyProvider.fsi b/src/Compiler/DependencyManager/DependencyProvider.fsi index a4c76e67b92..4c97224fc90 100644 --- a/src/Compiler/DependencyManager/DependencyProvider.fsi +++ b/src/Compiler/DependencyManager/DependencyProvider.fsi @@ -10,7 +10,7 @@ open Internal.Utilities.Library /// The results of ResolveDependencies type IResolveDependenciesResult = - /// Succeded? + /// Succeeded? abstract Success: bool /// The resolution output log @@ -39,7 +39,9 @@ type IResolveDependenciesResult = abstract Roots: seq /// Wraps access to a DependencyManager implementation +#if NO_CHECKNULLS [] +#endif type IDependencyManagerProvider = /// Name of the dependency manager @@ -51,7 +53,7 @@ type IDependencyManagerProvider = /// paket: indicates that this DM is for paket scripts, which manage nuget packages, github source dependencies etc ... abstract Key: string - /// The help messages for this dependency manager inster + /// The help messages for this dependency manager instance abstract HelpMessages: string[] /// Clear the results cache diff --git a/src/Compiler/DependencyManager/NativeDllResolveHandler.fs b/src/Compiler/DependencyManager/NativeDllResolveHandler.fs index 8a3161a89d8..6319f3df48b 100644 --- a/src/Compiler/DependencyManager/NativeDllResolveHandler.fs +++ b/src/Compiler/DependencyManager/NativeDllResolveHandler.fs @@ -24,12 +24,12 @@ type internal ProbingPathsStore() = else p - static member RemoveProbeFromProcessPath probePath = + static member RemoveProbeFromProcessPath(probePath: string) = if not (String.IsNullOrWhiteSpace(probePath)) then let probe = ProbingPathsStore.AppendPathSeparator probePath let path = - ProbingPathsStore.AppendPathSeparator(Environment.GetEnvironmentVariable("PATH")) + ProbingPathsStore.AppendPathSeparator(Environment.GetEnvironmentVariable("PATH") |> defaultIfNull "") if path.Contains(probe) then Environment.SetEnvironmentVariable("PATH", path.Replace(probe, "")) @@ -38,7 +38,7 @@ type internal ProbingPathsStore() = let probe = ProbingPathsStore.AppendPathSeparator probePath let path = - ProbingPathsStore.AppendPathSeparator(Environment.GetEnvironmentVariable("PATH")) + ProbingPathsStore.AppendPathSeparator(Environment.GetEnvironmentVariable("PATH") |> defaultIfNull "") if not (path.Contains(probe)) then Environment.SetEnvironmentVariable("PATH", path + probe) @@ -72,9 +72,9 @@ type internal NativeDllResolveHandlerCoreClr(nativeProbingRoots: NativeResolutio let nativeLibraryTryLoad = let nativeLibraryType: Type = - Type.GetType("System.Runtime.InteropServices.NativeLibrary, System.Runtime.InteropServices", false) + !! Type.GetType("System.Runtime.InteropServices.NativeLibrary, System.Runtime.InteropServices", false) - nativeLibraryType.GetMethod("TryLoad", [| typeof; typeof.MakeByRefType() |]) + !! nativeLibraryType.GetMethod("TryLoad", [| typeof; typeof.MakeByRefType() |]) let loadNativeLibrary path = let arguments = [| path :> obj; IntPtr.Zero :> obj |] @@ -157,13 +157,12 @@ type internal NativeDllResolveHandlerCoreClr(nativeProbingRoots: NativeResolutio // netstandard 2.1 has this property, unfortunately we don't build with that yet //public event Func ResolvingUnmanagedDll let assemblyLoadContextType: Type = - Type.GetType("System.Runtime.Loader.AssemblyLoadContext, System.Runtime.Loader", false) + !! Type.GetType("System.Runtime.Loader.AssemblyLoadContext, System.Runtime.Loader", false) let eventInfo, handler, defaultAssemblyLoadContext = - assemblyLoadContextType.GetEvent("ResolvingUnmanagedDll"), + !! assemblyLoadContextType.GetEvent("ResolvingUnmanagedDll"), Func resolveUnmanagedDll, - assemblyLoadContextType - .GetProperty("Default", BindingFlags.Static ||| BindingFlags.Public) + (!! assemblyLoadContextType.GetProperty("Default", BindingFlags.Static ||| BindingFlags.Public)) .GetValue(null, null) do eventInfo.AddEventHandler(defaultAssemblyLoadContext, handler) @@ -185,7 +184,7 @@ type NativeDllResolveHandler(nativeProbingRoots: NativeResolutionProbe option) = |> Option.filter (fun _ -> isRunningOnCoreClr) |> Option.map (fun _ -> new NativeDllResolveHandlerCoreClr(nativeProbingRoots)) - new(nativeProbingRoots: NativeResolutionProbe) = new NativeDllResolveHandler(Option.ofObj nativeProbingRoots) + new(nativeProbingRoots: NativeResolutionProbe MaybeNull) = new NativeDllResolveHandler(Option.ofObj nativeProbingRoots) member internal _.RefreshPathsInEnvironment(roots: string seq) = handler |> Option.iter (fun handler -> handler.RefreshPathsInEnvironment(roots)) diff --git a/src/Compiler/Driver/CompilerConfig.fs b/src/Compiler/Driver/CompilerConfig.fs index 71b4d667c25..cd883c6f7c7 100644 --- a/src/Compiler/Driver/CompilerConfig.fs +++ b/src/Compiler/Driver/CompilerConfig.fs @@ -180,11 +180,11 @@ type VersionFlag = else use fs = FileSystem.OpenFileForReadShim(s) use is = new StreamReader(fs) - is.ReadLine() + !! is.ReadLine() | VersionNone -> "0.0.0.0" /// Represents a reference to an assembly. May be backed by a real assembly on disk, or a cross-project -/// reference backed by information generated by the the compiler service. +/// reference backed by information generated by the compiler service. type IRawFSharpAssemblyData = /// The raw list AutoOpenAttribute attributes in the assembly abstract GetAutoOpenAttributes: unit -> string list @@ -197,11 +197,14 @@ type IRawFSharpAssemblyData = abstract TryGetILModuleDef: unit -> ILModuleDef option /// The raw F# signature data in the assembly, if any - abstract GetRawFSharpSignatureData: range * ilShortAssemName: string * fileName: string -> (string * (unit -> ReadOnlyByteMemory)) list + abstract GetRawFSharpSignatureData: + range * ilShortAssemName: string * fileName: string -> + (string * ((unit -> ReadOnlyByteMemory) * (unit -> ReadOnlyByteMemory) option)) list /// The raw F# optimization data in the assembly, if any abstract GetRawFSharpOptimizationData: - range * ilShortAssemName: string * fileName: string -> (string * (unit -> ReadOnlyByteMemory)) list + range * ilShortAssemName: string * fileName: string -> + (string * ((unit -> ReadOnlyByteMemory) * (unit -> ReadOnlyByteMemory) option)) list /// The table of type forwarders in the assembly abstract GetRawTypeForwarders: unit -> ILExportedTypesAndForwarders @@ -216,7 +219,7 @@ type IRawFSharpAssemblyData = /// Indicates if the assembly has any F# signature data attribute abstract HasAnyFSharpSignatureDataAttribute: bool - /// Indicates if the assembly has an F# signature data attribute auitable for use with this version of F# tooling + /// Indicates if the assembly has an F# signature data attribute suitable for use with this version of F# tooling abstract HasMatchingFSharpSignatureDataAttribute: bool /// Cache of time stamps as we traverse a project description @@ -443,6 +446,7 @@ type TcConfigBuilder = mutable embedResources: string list mutable diagnosticsOptions: FSharpDiagnosticOptions mutable mlCompatibility: bool + mutable checkNullness: bool mutable checkOverflow: bool mutable showReferenceResolutions: bool mutable outputDir: string option @@ -469,7 +473,8 @@ type TcConfigBuilder = mutable printAllSignatureFiles: bool mutable xmlDocOutputFile: string option mutable stats: bool - mutable generateFilterBlocks: bool (* don't generate filter blocks due to bugs on Mono *) + mutable generateFilterBlocks: + bool (* Previously marked with: `don't generate filter blocks due to bugs on Mono`. However, the related bug has been fixed: https://github.com/dotnet/linker/issues/2181 *) mutable signer: string option mutable container: string option @@ -631,7 +636,11 @@ type TcConfigBuilder = seq { yield! tcConfigB.includes yield! tcConfigB.compilerToolPaths - yield! (tcConfigB.referencedDLLs |> Seq.map (fun ref -> Path.GetDirectoryName(ref.Text))) + + yield! + (tcConfigB.referencedDLLs + |> Seq.map (fun ref -> !! Path.GetDirectoryName(ref.Text))) + tcConfigB.implicitIncludeDir } |> Seq.distinct @@ -650,8 +659,8 @@ type TcConfigBuilder = rangeForErrors ) = - if (String.IsNullOrEmpty defaultFSharpBinariesDir) then - failwith "Expected a valid defaultFSharpBinariesDir" + let defaultFSharpBinariesDir = + nullArgCheck "defaultFSharpBinariesDir" defaultFSharpBinariesDir // These are all default values, many can be overridden using the command line switch { @@ -681,6 +690,7 @@ type TcConfigBuilder = subsystemVersion = 4, 0 // per spec for 357994 useHighEntropyVA = false mlCompatibility = false + checkNullness = false checkOverflow = false showReferenceResolutions = false outputDir = None @@ -708,7 +718,7 @@ type TcConfigBuilder = printAllSignatureFiles = false xmlDocOutputFile = None stats = false - generateFilterBlocks = false (* don't generate filter blocks *) + generateFilterBlocks = false (* This was set as false due to an older bug in Mono https://github.com/dotnet/linker/issues/2181. This has been fixed in the meantime. *) signer = None container = None @@ -723,7 +733,7 @@ type TcConfigBuilder = metadataVersion = None standalone = false extraStaticLinkRoots = [] - compressMetadata = false + compressMetadata = true noSignatureData = false onlyEssentialOptimizationData = false useOptimizationDataFile = false @@ -1102,7 +1112,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = // clone the input builder to ensure nobody messes with it. let data = { data with pause = data.pause } - let computeKnownDllReference libraryName = + let computeKnownDllReference (libraryName: string) = let defaultCoreLibraryReference = AssemblyReference(range0, libraryName + ".dll", None) @@ -1154,7 +1164,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = ComputeMakePathAbsolute data.implicitIncludeDir primaryAssemblyFilename try - let clrRoot = Some(Path.GetDirectoryName(FileSystem.GetFullPathShim fileName)) + let clrRoot = Some(!! Path.GetDirectoryName(FileSystem.GetFullPathShim fileName)) clrRoot, data.legacyReferenceResolver.Impl.HighestInstalledNetFrameworkVersion() with e -> // We no longer expect the above to fail but leaving this just in case @@ -1257,6 +1267,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = member _.embedResources = data.embedResources member _.diagnosticsOptions = data.diagnosticsOptions member _.mlCompatibility = data.mlCompatibility + member _.checkNullness = data.checkNullness member _.checkOverflow = data.checkOverflow member _.showReferenceResolutions = data.showReferenceResolutions member _.outputDir = data.outputDir @@ -1453,7 +1464,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = /// 'framework' reference set that is potentially shared across multiple compilations. member tcConfig.IsSystemAssembly(fileName: string) = try - let dirName = Path.GetDirectoryName fileName + let dirName = !! Path.GetDirectoryName(fileName) let baseName = FileSystemUtils.fileNameWithoutExtension fileName FileSystem.FileExistsShim fileName diff --git a/src/Compiler/Driver/CompilerConfig.fsi b/src/Compiler/Driver/CompilerConfig.fsi index 89e0039610b..98c52f900e0 100644 --- a/src/Compiler/Driver/CompilerConfig.fsi +++ b/src/Compiler/Driver/CompilerConfig.fsi @@ -41,16 +41,18 @@ type IRawFSharpAssemblyData = /// Indicates if the assembly has any F# signature data attribute abstract HasAnyFSharpSignatureDataAttribute: bool - /// Indicates if the assembly has an F# signature data attribute auitable for use with this version of F# tooling + /// Indicates if the assembly has an F# signature data attribute suitable for use with this version of F# tooling abstract HasMatchingFSharpSignatureDataAttribute: bool /// Get the raw F# signature data in the assembly, if any abstract GetRawFSharpSignatureData: - m: range * ilShortAssemName: string * fileName: string -> (string * (unit -> ReadOnlyByteMemory)) list + m: range * ilShortAssemName: string * fileName: string -> + (string * ((unit -> ReadOnlyByteMemory) * (unit -> ReadOnlyByteMemory) option)) list /// Get the raw F# optimization data in the assembly, if any abstract GetRawFSharpOptimizationData: - m: range * ilShortAssemName: string * fileName: string -> (string * (unit -> ReadOnlyByteMemory)) list + m: range * ilShortAssemName: string * fileName: string -> + (string * ((unit -> ReadOnlyByteMemory) * (unit -> ReadOnlyByteMemory) option)) list /// Get the table of type forwarders in the assembly abstract GetRawTypeForwarders: unit -> ILExportedTypesAndForwarders @@ -288,6 +290,8 @@ type TcConfigBuilder = mutable mlCompatibility: bool + mutable checkNullness: bool + mutable checkOverflow: bool mutable showReferenceResolutions: bool @@ -626,6 +630,8 @@ type TcConfig = member mlCompatibility: bool + member checkNullness: bool + member checkOverflow: bool member showReferenceResolutions: bool @@ -874,7 +880,7 @@ type TcConfig = member CoreLibraryDllReference: unit -> AssemblyReference - /// Allow forking and subsuequent modification of the TcConfig via a new TcConfigBuilder + /// Allow forking and subsequent modification of the TcConfig via a new TcConfigBuilder member CloneToBuilder: unit -> TcConfigBuilder /// Indicates if the compilation will result in F# signature data resource in the generated binary diff --git a/src/Compiler/Driver/CompilerDiagnostics.fs b/src/Compiler/Driver/CompilerDiagnostics.fs index 823eb4ccbf1..c73b8e5d197 100644 --- a/src/Compiler/Driver/CompilerDiagnostics.fs +++ b/src/Compiler/Driver/CompilerDiagnostics.fs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -/// Contains logic to prepare, post-process, filter and emit compiler diagnsotics +/// Contains logic to prepare, post-process, filter and emit compiler diagnostics module internal FSharp.Compiler.CompilerDiagnostics open System @@ -24,6 +24,7 @@ open FSharp.Compiler.ConstraintSolver open FSharp.Compiler.DiagnosticMessage open FSharp.Compiler.Diagnostics open FSharp.Compiler.DiagnosticsLogger +open FSharp.Compiler.Features open FSharp.Compiler.Infos open FSharp.Compiler.IO open FSharp.Compiler.Lexhelp @@ -177,6 +178,10 @@ type Exception with | ConstraintSolverTupleDiffLengths(_, _, _, _, m, _) | ConstraintSolverInfiniteTypes(_, _, _, _, m, _) | ConstraintSolverMissingConstraint(_, _, _, m, _) + | ConstraintSolverNullnessWarningEquivWithTypes(_, _, _, _, _, m, _) + | ConstraintSolverNullnessWarningWithTypes(_, _, _, _, _, m, _) + | ConstraintSolverNullnessWarningWithType(_, _, _, m, _) + | ConstraintSolverNullnessWarning(_, m, _) | ConstraintSolverTypesNotInEqualityRelation(_, _, _, m, _, _) | ConstraintSolverError(_, m, _) | ConstraintSolverTypesNotInSubsumptionRelation(_, _, _, m, _) @@ -206,7 +211,7 @@ type Exception with | HashLoadedSourceHasIssues(_, _, _, m) | HashLoadedScriptConsideredSource m -> Some m // Strip TargetInvocationException wrappers - | :? System.Reflection.TargetInvocationException as e -> e.InnerException.DiagnosticRange + | :? System.Reflection.TargetInvocationException as e when isNotNull e.InnerException -> (!!e.InnerException).DiagnosticRange #if !NO_TYPEPROVIDERS | :? TypeProviderError as e -> e.Range |> Some #endif @@ -334,7 +339,7 @@ type Exception with | ArgumentsInSigAndImplMismatch _ -> 3218 // Strip TargetInvocationException wrappers - | :? TargetInvocationException as e -> e.InnerException.DiagnosticNumber + | :? TargetInvocationException as e when isNotNull e.InnerException -> (!!e.InnerException).DiagnosticNumber | WrappedError(e, _) -> e.DiagnosticNumber | DiagnosticWithText(n, _, _) -> n | DiagnosticWithSuggestions(n, _, _, _, _) -> n @@ -345,6 +350,10 @@ type Exception with #endif | ErrorsFromAddingSubsumptionConstraint(_, _, _, _, _, ContextInfo.DowncastUsedInsteadOfUpcast _, _) -> fst (FSComp.SR.considerUpcast ("", "")) + | ConstraintSolverNullnessWarningEquivWithTypes _ -> 3261 + | ConstraintSolverNullnessWarningWithTypes _ -> 3261 + | ConstraintSolverNullnessWarningWithType _ -> 3261 + | ConstraintSolverNullnessWarning _ -> 3261 | _ -> 193 type PhasedDiagnostic with @@ -452,6 +461,10 @@ module OldStyleMessages = let ConstraintSolverTupleDiffLengthsE () = Message("ConstraintSolverTupleDiffLengths", "%d%d") let ConstraintSolverInfiniteTypesE () = Message("ConstraintSolverInfiniteTypes", "%s%s") let ConstraintSolverMissingConstraintE () = Message("ConstraintSolverMissingConstraint", "%s") + let ConstraintSolverNullnessWarningEquivWithTypesE () = Message("ConstraintSolverNullnessWarningEquivWithTypes", "%s%s") + let ConstraintSolverNullnessWarningWithTypesE () = Message("ConstraintSolverNullnessWarningWithTypes", "%s%s") + let ConstraintSolverNullnessWarningWithTypeE () = Message("ConstraintSolverNullnessWarningWithType", "%s") + let ConstraintSolverNullnessWarningE () = Message("ConstraintSolverNullnessWarning", "%s") let ConstraintSolverTypesNotInEqualityRelation1E () = Message("ConstraintSolverTypesNotInEqualityRelation1", "%s%s") let ConstraintSolverTypesNotInEqualityRelation2E () = Message("ConstraintSolverTypesNotInEqualityRelation2", "%s%s") let ConstraintSolverTypesNotInSubsumptionRelationE () = Message("ConstraintSolverTypesNotInSubsumptionRelation", "%s%s%s") @@ -678,6 +691,57 @@ type Exception with if m.StartLine <> m2.StartLine then os.AppendString(SeeAlsoE().Format(stringOfRange m)) + | ConstraintSolverNullnessWarningEquivWithTypes(denv, ty1, ty2, _nullness1, _nullness2, m, m2) -> + + // Turn on nullness annotations for messages about nullness + let denv = + { denv with + showNullnessAnnotations = Some true + } + + let t1, t2, _cxs = NicePrint.minimalStringsOfTwoTypes denv ty1 ty2 + + os.Append(ConstraintSolverNullnessWarningEquivWithTypesE().Format t1 t2) + |> ignore + + if m.StartLine <> m2.StartLine then + os.Append(SeeAlsoE().Format(stringOfRange m)) |> ignore + + | ConstraintSolverNullnessWarningWithTypes(denv, ty1, ty2, _nullness1, _nullness2, m, m2) -> + + // Turn on nullness annotations for messages about nullness + let denv = + { denv with + showNullnessAnnotations = Some true + } + + let t1, t2, _cxs = NicePrint.minimalStringsOfTwoTypes denv ty1 ty2 + + os.Append(ConstraintSolverNullnessWarningWithTypesE().Format t1 t2) |> ignore + + if m.StartLine <> m2.StartLine then + os.Append(SeeAlsoE().Format(stringOfRange m)) |> ignore + + | ConstraintSolverNullnessWarningWithType(denv, ty, _, m, m2) -> + + // Turn on nullness annotations for messages about nullness + let denv = + { denv with + showNullnessAnnotations = Some true + } + + let t = NicePrint.minimalStringOfType denv ty + os.Append(ConstraintSolverNullnessWarningWithTypeE().Format(t)) |> ignore + + if m.StartLine <> m2.StartLine then + os.Append(SeeAlsoE().Format(stringOfRange m)) |> ignore + + | ConstraintSolverNullnessWarning(msg, m, m2) -> + os.Append(ConstraintSolverNullnessWarningE().Format(msg)) |> ignore + + if m.StartLine <> m2.StartLine then + os.AppendString(SeeAlsoE().Format(stringOfRange m2)) + | ConstraintSolverMissingConstraint(denv, tpr, tpc, m, m2) -> os.AppendString( ConstraintSolverMissingConstraintE() @@ -746,7 +810,7 @@ type Exception with | ErrorFromAddingTypeEquation(error = ConstraintSolverError _ as e) -> e.Output(os, suggestNames) - | ErrorFromAddingTypeEquation(_g, denv, ty1, ty2, ConstraintSolverTupleDiffLengths(_, contextInfo, tl1, tl2, _, _), m) -> + | ErrorFromAddingTypeEquation(_g, denv, ty1, ty2, ConstraintSolverTupleDiffLengths(_, contextInfo, tl1, tl2, m1, m2), m) -> let ty1, ty2, tpcs = NicePrint.minimalStringsOfTwoTypes denv ty1 ty2 let messageArgs = tl1.Length, ty1, tl2.Length, ty2 @@ -763,6 +827,11 @@ type Exception with else os.AppendString(FSComp.SR.listElementHasWrongTypeTuple messageArgs) | _ -> os.AppendString(ErrorFromAddingTypeEquationTuplesE().Format tl1.Length ty1 tl2.Length ty2 tpcs) + else + os.AppendString(ConstraintSolverTupleDiffLengthsE().Format tl1.Length tl2.Length) + + if m1.StartLine <> m2.StartLine then + os.AppendString(SeeAlsoE().Format(stringOfRange m1)) | ErrorFromAddingTypeEquation(g, denv, ty1, ty2, e, _) -> if not (typeEquiv g ty1 ty2) then @@ -830,7 +899,8 @@ type Exception with let argsMessage, returnType, genericParametersMessage = let retTy = - knownReturnType |> Option.defaultValue (TType_var(Typar.NewUnlinked(), 0uy)) + knownReturnType + |> Option.defaultValue (TType.TType_var(Typar.NewUnlinked(), KnownAmbivalentToNull)) let argRepr = callerArgs.ArgumentNamesAndTypes @@ -1237,9 +1307,9 @@ type Exception with | Parser.TOKEN_INTERP_STRING_BEGIN_PART -> SR.GetString("Parser.TOKEN.INTERP.STRING.BEGIN.PART") | Parser.TOKEN_INTERP_STRING_PART -> SR.GetString("Parser.TOKEN.INTERP.STRING.PART") | Parser.TOKEN_INTERP_STRING_END -> SR.GetString("Parser.TOKEN.INTERP.STRING.END") + | Parser.TOKEN_BAR_JUST_BEFORE_NULL -> SR.GetString("Parser.TOKEN.BAR_JUST_BEFORE_NULL") | unknown -> - Debug.Assert(false, "unknown token tag") - let result = sprintf "%+A" unknown + let result = sprintf "unknown token tag %+A" unknown Debug.Assert(false, result) result @@ -1876,7 +1946,7 @@ type Exception with ) // Strip TargetInvocationException wrappers - | :? TargetInvocationException as exn -> exn.InnerException.Output(os, suggestNames) + | :? TargetInvocationException as e when isNotNull e.InnerException -> (!!e.InnerException).Output(os, suggestNames) | :? FileNotFoundException as exn -> Printf.bprintf os "%s" exn.Message @@ -1975,6 +2045,8 @@ type FormattedDiagnosticDetailedInfo = Location: FormattedDiagnosticLocation option Canonical: FormattedDiagnosticCanonicalInformation Message: string + Context: string option + DiagnosticStyle: DiagnosticStyle } [] @@ -1982,7 +2054,7 @@ type FormattedDiagnostic = | Short of FSharpDiagnosticSeverity * string | Long of FSharpDiagnosticSeverity * FormattedDiagnosticDetailedInfo -let FormatDiagnosticLocation (tcConfig: TcConfig) m : FormattedDiagnosticLocation = +let FormatDiagnosticLocation (tcConfig: TcConfig) (m: Range) : FormattedDiagnosticLocation = if equals m rangeStartup || equals m rangeCmdArgs then { Range = m @@ -2045,6 +2117,10 @@ let FormatDiagnosticLocation (tcConfig: TcConfig) m : FormattedDiagnosticLocatio sprintf "%s(%d,%d,%d,%d): " file m.StartLine m.StartColumn m.EndLine m.EndColumn, m, file else "", m, file + | DiagnosticStyle.Rich -> + let file = file.Replace('/', Path.DirectorySeparatorChar) + let m = withStart (mkPos m.StartLine (m.StartColumn + 1)) m + (sprintf "\n --> %s (%d,%d)" file m.StartLine m.StartColumn), m, file { Range = m @@ -2085,8 +2161,12 @@ let CollectFormattedDiagnostics (tcConfig: TcConfig, severity: FSharpDiagnosticS let text = match tcConfig.diagnosticStyle with // Show the subcategory for --vserrors so that we can fish it out in Visual Studio and use it to determine error stickiness. + | DiagnosticStyle.Emacs + | DiagnosticStyle.Gcc + | DiagnosticStyle.Default + | DiagnosticStyle.Test -> sprintf "%s FS%04d: " message errorNumber | DiagnosticStyle.VisualStudio -> sprintf "%s %s FS%04d: " subcategory message errorNumber - | _ -> sprintf "%s FS%04d: " message errorNumber + | DiagnosticStyle.Rich -> sprintf "%s FS%04d: " message errorNumber let canonical: FormattedDiagnosticCanonicalInformation = { @@ -2095,13 +2175,51 @@ let CollectFormattedDiagnostics (tcConfig: TcConfig, severity: FSharpDiagnosticS TextRepresentation = text } - let message = diagnostic.FormatCore(tcConfig.flatErrors, suggestNames) + let message = + match tcConfig.diagnosticStyle with + | DiagnosticStyle.Emacs + | DiagnosticStyle.Gcc + | DiagnosticStyle.Default + | DiagnosticStyle.Test + | DiagnosticStyle.Rich + | DiagnosticStyle.VisualStudio -> diagnostic.FormatCore(tcConfig.flatErrors, suggestNames) + + let context = + match tcConfig.diagnosticStyle with + | DiagnosticStyle.Emacs + | DiagnosticStyle.Gcc + | DiagnosticStyle.Default + | DiagnosticStyle.Test + | DiagnosticStyle.VisualStudio -> None + | DiagnosticStyle.Rich -> + match diagnostic.Range with + | Some m -> + let content = + m.FileName + |> FileSystem.GetFullFilePathInDirectoryShim tcConfig.implicitIncludeDir + |> System.IO.File.ReadAllLines + + if m.StartLine = m.EndLine then + $"\n {m.StartLine} | {content[m.StartLine - 1]}\n" + + $"""{String.make (m.StartColumn + 6) ' '}{String.make (m.EndColumn - m.StartColumn) '^'}""" + |> Some + else + content + |> fun lines -> Array.sub lines (m.StartLine - 1) (m.EndLine - m.StartLine - 1) + |> Array.fold + (fun (context, lineNumber) line -> (context + $"\n{lineNumber} | {line}", lineNumber + 1)) + ("", (m.StartLine)) + |> fst + |> Some + | None -> None let entry: FormattedDiagnosticDetailedInfo = { Location = where + Context = context Canonical = canonical Message = message + DiagnosticStyle = tcConfig.diagnosticStyle } errors.Add(FormattedDiagnostic.Long(severity, entry)) @@ -2129,12 +2247,33 @@ type PhasedDiagnostic with match e with | FormattedDiagnostic.Short(_, txt) -> buf.AppendString txt | FormattedDiagnostic.Long(_, details) -> - match details.Location with - | Some l when not l.IsEmpty -> buf.AppendString l.TextRepresentation - | _ -> () - - buf.AppendString details.Canonical.TextRepresentation - buf.AppendString details.Message + match details.DiagnosticStyle with + | DiagnosticStyle.Emacs + | DiagnosticStyle.Gcc + | DiagnosticStyle.Test + | DiagnosticStyle.VisualStudio + | DiagnosticStyle.Default -> + match details.Location with + | Some l when not l.IsEmpty -> + buf.AppendString l.TextRepresentation + + if details.Context.IsSome then + buf.AppendString details.Context.Value + | _ -> () + + buf.AppendString details.Canonical.TextRepresentation + buf.AppendString details.Message + | DiagnosticStyle.Rich -> + buf.AppendString details.Canonical.TextRepresentation + buf.AppendString details.Message + + match details.Location with + | Some l when not l.IsEmpty -> + buf.AppendString l.TextRepresentation + + if details.Context.IsSome then + buf.AppendString details.Context.Value + | _ -> () member diagnostic.OutputContext(buf, prefix, fileLineFunction) = match diagnostic.Range with @@ -2161,19 +2300,18 @@ type PhasedDiagnostic with // Scoped #nowarn pragmas /// Build an DiagnosticsLogger that delegates to another DiagnosticsLogger but filters warnings turned off by the given pragma declarations -// -// NOTE: we allow a flag to turn of strict file checking. This is because file names sometimes don't match due to use of -// #line directives, e.g. for pars.fs/pars.fsy. In this case we just test by line number - in most cases this is sufficient -// because we install a filtering error handler on a file-by-file basis for parsing and type-checking. -// However this is indicative of a more systematic problem where source-line -// sensitive operations (lexfilter and warning filtering) do not always -// interact well with #line directives. type DiagnosticsLoggerFilteringByScopedPragmas - (checkFile, scopedPragmas, diagnosticOptions: FSharpDiagnosticOptions, diagnosticsLogger: DiagnosticsLogger) = + (langVersion: LanguageVersion, scopedPragmas, diagnosticOptions: FSharpDiagnosticOptions, diagnosticsLogger: DiagnosticsLogger) = inherit DiagnosticsLogger("DiagnosticsLoggerFilteringByScopedPragmas") + let needCompatibilityWithEarlierInconsistentInteraction = + not (langVersion.SupportsFeature LanguageFeature.ConsistentNowarnLineDirectiveInteraction) + + let mutable realErrorPresent = false + override _.DiagnosticSink(diagnostic: PhasedDiagnostic, severity) = if severity = FSharpDiagnosticSeverity.Error then + realErrorPresent <- true diagnosticsLogger.DiagnosticSink(diagnostic, severity) else let report = @@ -2182,12 +2320,10 @@ type DiagnosticsLoggerFilteringByScopedPragmas match diagnostic.Range with | Some m -> scopedPragmas - |> List.exists (fun pragma -> - let (ScopedPragma.WarningOff(pragmaRange, warningNumFromPragma)) = pragma - + |> List.exists (fun (ScopedPragma.WarningOff(pragmaRange, warningNumFromPragma)) -> warningNum = warningNumFromPragma - && (not checkFile || m.FileIndex = pragmaRange.FileIndex) - && posGeq m.Start pragmaRange.Start) + && (needCompatibilityWithEarlierInconsistentInteraction + || m.FileIndex = pragmaRange.FileIndex && posGeq m.Start pragmaRange.Start)) |> not | None -> true @@ -2201,5 +2337,7 @@ type DiagnosticsLoggerFilteringByScopedPragmas override _.ErrorCount = diagnosticsLogger.ErrorCount -let GetDiagnosticsLoggerFilteringByScopedPragmas (checkFile, scopedPragmas, diagnosticOptions, diagnosticsLogger) = - DiagnosticsLoggerFilteringByScopedPragmas(checkFile, scopedPragmas, diagnosticOptions, diagnosticsLogger) :> DiagnosticsLogger + override _.CheckForRealErrorsIgnoringWarnings = realErrorPresent + +let GetDiagnosticsLoggerFilteringByScopedPragmas (langVersion, scopedPragmas, diagnosticOptions, diagnosticsLogger) = + DiagnosticsLoggerFilteringByScopedPragmas(langVersion, scopedPragmas, diagnosticOptions, diagnosticsLogger) :> DiagnosticsLogger diff --git a/src/Compiler/Driver/CompilerDiagnostics.fsi b/src/Compiler/Driver/CompilerDiagnostics.fsi index 8e0890d4418..7c5acef17d4 100644 --- a/src/Compiler/Driver/CompilerDiagnostics.fsi +++ b/src/Compiler/Driver/CompilerDiagnostics.fsi @@ -1,12 +1,13 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -/// Contains logic to prepare, post-process, filter and emit compiler diagnsotics +/// Contains logic to prepare, post-process, filter and emit compiler diagnostics module internal FSharp.Compiler.CompilerDiagnostics open System.Text open FSharp.Compiler.CompilerConfig open FSharp.Compiler.Diagnostics open FSharp.Compiler.DiagnosticsLogger +open FSharp.Compiler.Features open FSharp.Compiler.Syntax open FSharp.Compiler.Text @@ -84,7 +85,7 @@ type PhasedDiagnostic with /// Get a diagnostics logger that filters the reporting of warnings based on scoped pragma information val GetDiagnosticsLoggerFilteringByScopedPragmas: - checkFile: bool * + langVersion: LanguageVersion * scopedPragmas: ScopedPragma list * diagnosticOptions: FSharpDiagnosticOptions * diagnosticsLogger: DiagnosticsLogger -> @@ -113,7 +114,9 @@ type FormattedDiagnosticCanonicalInformation = type FormattedDiagnosticDetailedInfo = { Location: FormattedDiagnosticLocation option Canonical: FormattedDiagnosticCanonicalInformation - Message: string } + Message: string + Context: string option + DiagnosticStyle: DiagnosticStyle } /// Used internally and in LegacyHostedCompilerForTesting [] diff --git a/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs index 76573599919..fb6a6526eab 100644 --- a/src/Compiler/Driver/CompilerImports.fs +++ b/src/Compiler/Driver/CompilerImports.fs @@ -58,11 +58,19 @@ let IsSignatureDataResource (r: ILResource) = || r.Name.StartsWithOrdinal FSharpSignatureCompressedDataResourceName || r.Name.StartsWithOrdinal FSharpSignatureDataResourceName2 +let IsSignatureDataResourceB (r: ILResource) = + r.Name.StartsWithOrdinal FSharpSignatureDataResourceNameB + || r.Name.StartsWithOrdinal FSharpSignatureCompressedDataResourceNameB + let IsOptimizationDataResource (r: ILResource) = r.Name.StartsWithOrdinal FSharpOptimizationDataResourceName || r.Name.StartsWithOrdinal FSharpOptimizationCompressedDataResourceName || r.Name.StartsWithOrdinal FSharpOptimizationDataResourceName2 +let IsOptimizationDataResourceB (r: ILResource) = + r.Name.StartsWithOrdinal FSharpOptimizationDataResourceNameB + || r.Name.StartsWithOrdinal FSharpOptimizationCompressedDataResourceNameB + let decompressResource (r: ILResource) = use raw = r.GetBytes().AsStream() use decompressed = new MemoryStream() @@ -71,71 +79,130 @@ let decompressResource (r: ILResource) = deflator.Close() ByteStorage.FromByteArray(decompressed.ToArray()).GetByteMemory() -let GetResourceNameAndSignatureDataFunc (r: ILResource) = - let resourceType, ccuName = - if r.Name.StartsWithOrdinal FSharpSignatureDataResourceName then - FSharpSignatureDataResourceName, String.dropPrefix r.Name FSharpSignatureDataResourceName - elif r.Name.StartsWithOrdinal FSharpSignatureCompressedDataResourceName then - FSharpSignatureCompressedDataResourceName, String.dropPrefix r.Name FSharpSignatureCompressedDataResourceName - elif r.Name.StartsWithOrdinal FSharpSignatureDataResourceName2 then - FSharpSignatureDataResourceName2, String.dropPrefix r.Name FSharpSignatureDataResourceName2 - else - failwith "GetSignatureDataResourceName" - - if resourceType = FSharpSignatureCompressedDataResourceName then - ccuName, (fun () -> decompressResource (r)) +let GetSignatureDataResourceName (r: ILResource) = + if r.Name.StartsWithOrdinal FSharpSignatureDataResourceName then + (fun () -> r.GetBytes()), String.dropPrefix r.Name FSharpSignatureDataResourceName + elif r.Name.StartsWithOrdinal FSharpSignatureCompressedDataResourceName then + (fun () -> decompressResource r), String.dropPrefix r.Name FSharpSignatureCompressedDataResourceName + elif r.Name.StartsWithOrdinal FSharpSignatureDataResourceNameB then + (fun () -> r.GetBytes()), String.dropPrefix r.Name FSharpSignatureDataResourceNameB + elif r.Name.StartsWithOrdinal FSharpSignatureCompressedDataResourceNameB then + (fun () -> decompressResource r), String.dropPrefix r.Name FSharpSignatureCompressedDataResourceNameB + elif r.Name.StartsWithOrdinal FSharpSignatureDataResourceName2 then + (fun () -> r.GetBytes()), String.dropPrefix r.Name FSharpSignatureDataResourceName2 else - ccuName, (fun () -> r.GetBytes()) - -let GetResourceNameAndOptimizationDataFunc (r: ILResource) = - let resourceType, ccuName = - if r.Name.StartsWithOrdinal FSharpOptimizationDataResourceName then - FSharpOptimizationDataResourceName, String.dropPrefix r.Name FSharpOptimizationDataResourceName - elif r.Name.StartsWithOrdinal FSharpOptimizationCompressedDataResourceName then - FSharpOptimizationCompressedDataResourceName, String.dropPrefix r.Name FSharpOptimizationCompressedDataResourceName - elif r.Name.StartsWithOrdinal FSharpOptimizationDataResourceName2 then - FSharpOptimizationDataResourceName2, String.dropPrefix r.Name FSharpOptimizationDataResourceName2 - else - failwith "GetOptimizationDataResourceName" - - if resourceType = FSharpOptimizationCompressedDataResourceName then - ccuName, (fun () -> decompressResource (r)) + failwith "unreachable" + +let GetResourceNameAndSignatureDataFuncs (resources: ILResource list) = + [ for r in resources do + if IsSignatureDataResource r then + let readerA, ccuName = GetSignatureDataResourceName r + + let readerB = + resources |> List.tryPick (fun rB -> + if IsSignatureDataResourceB rB then + let readerB, ccuNameB = GetSignatureDataResourceName rB + if ccuName = ccuNameB then + Some readerB + else None + else None) + + ccuName, (readerA, readerB) ] + +let GetOptimizationDataResourceName (r: ILResource) = + if r.Name.StartsWithOrdinal FSharpOptimizationDataResourceName then + (fun () -> r.GetBytes()), String.dropPrefix r.Name FSharpOptimizationDataResourceName + elif r.Name.StartsWithOrdinal FSharpOptimizationCompressedDataResourceName then + (fun () -> decompressResource r), String.dropPrefix r.Name FSharpOptimizationCompressedDataResourceName + elif r.Name.StartsWithOrdinal FSharpOptimizationDataResourceNameB then + (fun () -> r.GetBytes()), String.dropPrefix r.Name FSharpOptimizationDataResourceNameB + elif r.Name.StartsWithOrdinal FSharpOptimizationCompressedDataResourceNameB then + (fun () -> decompressResource r), String.dropPrefix r.Name FSharpOptimizationCompressedDataResourceNameB + elif r.Name.StartsWithOrdinal FSharpOptimizationDataResourceName2 then + (fun () -> r.GetBytes()), String.dropPrefix r.Name FSharpOptimizationDataResourceName2 else - ccuName, (fun () -> r.GetBytes()) + failwith $"GetOptimizationDataResourceName - {r.Name}" + +let GetResourceNameAndOptimizationDataFuncs (resources: ILResource list) = + [ for r in resources do + if IsOptimizationDataResource r then + let readerA, ccuName = GetOptimizationDataResourceName r + + let readerB = + resources |> List.tryPick (fun rB -> + if IsOptimizationDataResourceB rB then + let readerB, ccuNameB = GetOptimizationDataResourceName rB + if ccuName = ccuNameB then + Some readerB + else None + else None) + ccuName, (readerA, readerB) ] let IsReflectedDefinitionsResource (r: ILResource) = r.Name.StartsWithOrdinal(QuotationPickler.SerializedReflectedDefinitionsResourceNameBase) -let PickleToResource inMem file (g: TcGlobals) compress scope rName p x = +let ByteBufferToBytes compress (bytes: ByteBuffer) = + if compress then + let raw = new MemoryStream(bytes.AsMemory().ToArray()) + let compressed = new MemoryStream() + use deflator = new DeflateStream(compressed, CompressionLevel.Optimal) + raw.CopyTo deflator + deflator.Close() + compressed.ToArray() + else + bytes.AsMemory().ToArray() + +let PickleToResource inMem file (g: TcGlobals) compress scope rName rNameB p x = let file = PathMap.apply g.pathMap file - let bytes = - use bytes = pickleObjWithDanglingCcus inMem file g scope p x + let bytes, bytesB = pickleObjWithDanglingCcus inMem file g scope p x + use bytes = bytes + use bytesB = bytesB + let bytes = ByteBufferToBytes compress bytes + let bytesB = ByteBufferToBytes compress bytesB + let byteStorage = ByteStorage.FromByteArray(bytes) - if compress then - let raw = new MemoryStream(bytes.AsMemory().ToArray()) - let compressed = new MemoryStream() - use deflator = new DeflateStream(compressed, CompressionLevel.Optimal) - raw.CopyTo deflator - deflator.Close() - compressed.ToArray() + let byteStorageB = + if inMem then + ByteStorage.FromMemoryAndCopy(bytesB.AsMemory(), useBackingMemoryMappedFile = true) else - bytes.AsMemory().ToArray() + ByteStorage.FromByteArray(bytesB.AsMemory().ToArray()) - let byteStorage = ByteStorage.FromByteArray(bytes) + let resource = + { + Name = rName + Location = ILResourceLocation.Local(byteStorage) + Access = ILResourceAccess.Public + CustomAttrsStored = storeILCustomAttrs emptyILCustomAttrs + MetadataIndex = NoMetadataIdx + } - { - Name = rName - Location = ILResourceLocation.Local(byteStorage) - Access = ILResourceAccess.Public - CustomAttrsStored = storeILCustomAttrs emptyILCustomAttrs - MetadataIndex = NoMetadataIdx - } + let resourceB = + if bytesB.AsMemory().Length > 0 then + Some + { + Name = rNameB + Location = ILResourceLocation.Local(byteStorageB) + Access = ILResourceAccess.Public + CustomAttrsStored = storeILCustomAttrs emptyILCustomAttrs + MetadataIndex = NoMetadataIdx + } + else + None + + resource, resourceB + +let GetSignatureData (file, ilScopeRef, ilModule, byteReaderA, byteReaderB) : PickledDataWithReferences = + let memA = byteReaderA () + + let memB = + (match byteReaderB with + | None -> ByteMemory.Empty.AsReadOnly() + | Some br -> br ()) -let GetSignatureData (file, ilScopeRef, ilModule, byteReader) : PickledDataWithReferences = - unpickleObjWithDanglingCcus file ilScopeRef ilModule unpickleCcuInfo (byteReader ()) + unpickleObjWithDanglingCcus file ilScopeRef ilModule unpickleCcuInfo memA memB -let WriteSignatureData (tcConfig: TcConfig, tcGlobals, exportRemapping, ccu: CcuThunk, fileName, inMem) : ILResource = +let WriteSignatureData (tcConfig: TcConfig, tcGlobals, exportRemapping, ccu: CcuThunk, fileName, inMem) = let mspec = ApplyExportRemappingToEntity tcGlobals exportRemapping ccu.Contents if tcConfig.dumpSignatureData then @@ -150,13 +217,19 @@ let WriteSignatureData (tcConfig: TcConfig, tcGlobals, exportRemapping, ccu: Ccu // For historical reasons, we use a different resource name for FSharp.Core, so older F# compilers // don't complain when they see the resource. - let rName, compress = + let rName = if tcConfig.compressMetadata then - FSharpSignatureCompressedDataResourceName, true + FSharpSignatureCompressedDataResourceName elif ccu.AssemblyName = getFSharpCoreLibraryName then - FSharpSignatureDataResourceName2, false + FSharpSignatureDataResourceName2 else - FSharpSignatureDataResourceName, false + FSharpSignatureDataResourceName + + let rNameB = + if tcConfig.compressMetadata then + FSharpSignatureCompressedDataResourceNameB + else + FSharpSignatureDataResourceNameB let includeDir = if String.IsNullOrEmpty tcConfig.implicitIncludeDir then @@ -170,9 +243,10 @@ let WriteSignatureData (tcConfig: TcConfig, tcGlobals, exportRemapping, ccu: Ccu inMem fileName tcGlobals - compress + tcConfig.compressMetadata ccu (rName + ccu.AssemblyName) + (rNameB + ccu.AssemblyName) pickleCcuInfo { mspec = mspec @@ -180,28 +254,56 @@ let WriteSignatureData (tcConfig: TcConfig, tcGlobals, exportRemapping, ccu: Ccu usesQuotations = ccu.UsesFSharp20PlusQuotations } -let GetOptimizationData (file, ilScopeRef, ilModule, byteReader) = - unpickleObjWithDanglingCcus file ilScopeRef ilModule Optimizer.u_CcuOptimizationInfo (byteReader ()) +let GetOptimizationData (file, ilScopeRef, ilModule, byteReaderA, byteReaderB) = + let memA = byteReaderA () + + let memB = + (match byteReaderB with + | None -> ByteMemory.Empty.AsReadOnly() + | Some br -> br ()) + + unpickleObjWithDanglingCcus file ilScopeRef ilModule Optimizer.u_CcuOptimizationInfo memA memB let WriteOptimizationData (tcConfig: TcConfig, tcGlobals, fileName, inMem, ccu: CcuThunk, modulInfo) = // For historical reasons, we use a different resource name for FSharp.Core, so older F# compilers // don't complain when they see the resource. - let rName, compress = + let rName = if tcConfig.compressMetadata then - FSharpOptimizationCompressedDataResourceName, true + FSharpOptimizationCompressedDataResourceName elif ccu.AssemblyName = getFSharpCoreLibraryName then - FSharpOptimizationDataResourceName2, false + FSharpOptimizationDataResourceName2 + else + FSharpOptimizationDataResourceName + + let rNameB = + if tcConfig.compressMetadata then + FSharpOptimizationCompressedDataResourceNameB else - FSharpOptimizationDataResourceName, false + FSharpOptimizationDataResourceNameB - PickleToResource inMem fileName tcGlobals compress ccu (rName + ccu.AssemblyName) Optimizer.p_CcuOptimizationInfo modulInfo + PickleToResource + inMem + fileName + tcGlobals + tcConfig.compressMetadata + ccu + (rName + ccu.AssemblyName) + (rNameB + ccu.AssemblyName) + Optimizer.p_CcuOptimizationInfo + modulInfo let EncodeSignatureData (tcConfig: TcConfig, tcGlobals, exportRemapping, generatedCcu, outfile, isIncrementalBuild) = if tcConfig.GenerateSignatureData then - let resource = + let resource1, resource2 = WriteSignatureData(tcConfig, tcGlobals, exportRemapping, generatedCcu, outfile, isIncrementalBuild) - let resources = [ resource ] + let resources = + [ + resource1 + match resource2 with + | None -> () + | Some r -> r + ] let sigAttr = mkSignatureDataVersionAttr tcGlobals (parseILVersion FSharpBinaryMetadataFormatRevision) @@ -220,7 +322,18 @@ let EncodeOptimizationData (tcGlobals, tcConfig: TcConfig, outfile, exportRemapp else data - [ WriteOptimizationData(tcConfig, tcGlobals, outfile, isIncrementalBuild, ccu, optData) ] + let r1, r2 = + WriteOptimizationData(tcConfig, tcGlobals, outfile, isIncrementalBuild, ccu, optData) + + let resources = + [ + r1 + match r2 with + | None -> () + | Some r -> r + ] + + resources else [] @@ -365,15 +478,15 @@ let isHashRReference (r: range) = && not (equals r rangeCmdArgs) && FileSystem.IsPathRootedShim r.FileName -let IsNetModule fileName = +let IsNetModule (fileName:string) = let ext = Path.GetExtension fileName String.Compare(ext, ".netmodule", StringComparison.OrdinalIgnoreCase) = 0 -let IsDLL fileName = +let IsDLL (fileName:string) = let ext = Path.GetExtension fileName String.Compare(ext, ".dll", StringComparison.OrdinalIgnoreCase) = 0 -let IsExe fileName = +let IsExe (fileName:string) = let ext = Path.GetExtension fileName String.Compare(ext, ".exe", StringComparison.OrdinalIgnoreCase) = 0 @@ -428,7 +541,7 @@ type TcConfig with yield! tcConfig.GetSearchPathsForLibraryFiles() if isHashRReference m then - Path.GetDirectoryName(m.FileName) + !! Path.GetDirectoryName(m.FileName) } let resolved = TryResolveFileUsingPaths(searchPaths, m, nm) @@ -872,59 +985,49 @@ type RawFSharpAssemblyDataBackedByFileOnDisk(ilModule: ILModuleDef, ilAssemblyRe member _.GetRawFSharpSignatureData(m, ilShortAssemName, fileName) = let resources = ilModule.Resources.AsList() - let sigDataReaders = - [ - for r in resources do - if IsSignatureDataResource r then - GetResourceNameAndSignatureDataFunc r - ] + let sigDataReaders = GetResourceNameAndSignatureDataFuncs resources let sigDataReaders = if sigDataReaders.IsEmpty && List.contains ilShortAssemName externalSigAndOptData then - let sigFileName = Path.ChangeExtension(fileName, "sigdata") + let sigFileName = !! Path.ChangeExtension(fileName, "sigdata") if not (FileSystem.FileExistsShim sigFileName) then error (Error(FSComp.SR.buildExpectedSigdataFile (FileSystem.GetFullPathShim sigFileName), m)) - [ - (ilShortAssemName, - fun () -> - FileSystem - .OpenFileForReadShim(sigFileName, useMemoryMappedFile = true, shouldShadowCopy = true) - .AsByteMemory() - .AsReadOnly()) - ] + let readerA () = + FileSystem + .OpenFileForReadShim(sigFileName, useMemoryMappedFile = true, shouldShadowCopy = true) + .AsByteMemory() + .AsReadOnly() + + [ (ilShortAssemName, (readerA, None)) ] else sigDataReaders sigDataReaders member _.GetRawFSharpOptimizationData(m, ilShortAssemName, fileName) = - let optDataReaders = - ilModule.Resources.AsList() - |> List.choose (fun r -> - if IsOptimizationDataResource r then - Some(GetResourceNameAndOptimizationDataFunc r) - else - None) + let resources = ilModule.Resources.AsList() + + let optDataReaders = GetResourceNameAndOptimizationDataFuncs resources // Look for optimization data in a file let optDataReaders = if optDataReaders.IsEmpty && List.contains ilShortAssemName externalSigAndOptData then - let optDataFile = Path.ChangeExtension(fileName, "optdata") + let optDataFile = !! Path.ChangeExtension(fileName, "optdata") if not (FileSystem.FileExistsShim optDataFile) then - let fullPath = FileSystem.GetFullPathShim optDataFile - error (Error(FSComp.SR.buildExpectedFileAlongSideFSharpCore (optDataFile, fullPath), m)) - - [ - (ilShortAssemName, - (fun () -> - FileSystem - .OpenFileForReadShim(optDataFile, useMemoryMappedFile = true, shouldShadowCopy = true) - .AsByteMemory() - .AsReadOnly())) - ] + error ( + Error(FSComp.SR.buildExpectedFileAlongSideFSharpCore (optDataFile, FileSystem.GetFullPathShim optDataFile), m) + ) + + let readerA () = + FileSystem + .OpenFileForReadShim(optDataFile, useMemoryMappedFile = true, shouldShadowCopy = true) + .AsByteMemory() + .AsReadOnly() + + [ (ilShortAssemName, (readerA, None)) ] else optDataReaders @@ -963,20 +1066,11 @@ type RawFSharpAssemblyData(ilModule: ILModuleDef, ilAssemblyRefs) = member _.GetRawFSharpSignatureData(_, _, _) = let resources = ilModule.Resources.AsList() - - [ - for r in resources do - if IsSignatureDataResource r then - GetResourceNameAndSignatureDataFunc r - ] + GetResourceNameAndSignatureDataFuncs resources member _.GetRawFSharpOptimizationData(_, _, _) = - ilModule.Resources.AsList() - |> List.choose (fun r -> - if IsOptimizationDataResource r then - Some(GetResourceNameAndOptimizationDataFunc r) - else - None) + let resources = ilModule.Resources.AsList() + GetResourceNameAndOptimizationDataFuncs resources member _.GetRawTypeForwarders() = match ilModule.Manifest with @@ -1370,7 +1464,7 @@ and [] TcImports | Tainted.Null -> false, None | Tainted.NonNull assembly -> let aname = assembly.PUntaint((fun a -> a.GetName()), m) - let ilShortAssemName = aname.Name + let ilShortAssemName = string aname.Name match tcImports.FindCcu(ctok, m, ilShortAssemName, lookupOnly = true) with | ResolvedCcu ccu -> @@ -1383,7 +1477,7 @@ and [] TcImports | UnresolvedCcu _ -> let g = tcImports.GetTcGlobals() let ilScopeRef = ILScopeRef.Assembly(ILAssemblyRef.FromAssemblyName aname) - let fileName = aname.Name + ".dll" + let fileName = string aname.Name + ".dll" let bytes = assembly @@ -1766,7 +1860,7 @@ and [] TcImports |> Option.get // MSDN: this method causes the file to be opened and closed, but the assembly is not added to this domain let name = AssemblyName.GetAssemblyName(resolution.resolvedPath) - name.Version + !! name.Version // Note, this only captures systemRuntimeContainsTypeRef (which captures tcImportsWeak, using name tcImports) let systemRuntimeContainsType = @@ -1867,13 +1961,13 @@ and [] TcImports match providers with | [] -> - let typeName = typeof.FullName + let typeName = !! typeof.FullName warning (Error(FSComp.SR.etHostingAssemblyFoundWithoutHosts (fileNameOfRuntimeAssembly, typeName), m)) | _ -> #if DEBUG if typeProviderEnvironment.ShowResolutionMessages then - dprintfn "Found extension type hosting hosting assembly '%s' with the following extensions:" fileNameOfRuntimeAssembly + dprintfn "Found extension type hosting assembly '%s' with the following extensions:" fileNameOfRuntimeAssembly providers |> List.iter (fun provider -> dprintfn " %s" (DisplayNameOfTypeProvider(provider.TypeProvider, m))) @@ -2020,9 +2114,9 @@ and [] TcImports let ccuRawDataAndInfos = ilModule.GetRawFSharpSignatureData(m, ilShortAssemName, fileName) - |> List.map (fun (ccuName, sigDataReader) -> + |> List.map (fun (ccuName, (sigDataReader, sigDataReaderB)) -> let data = - GetSignatureData(fileName, ilScopeRef, ilModule.TryGetILModuleDef(), sigDataReader) + GetSignatureData(fileName, ilScopeRef, ilModule.TryGetILModuleDef(), sigDataReader, sigDataReaderB) let optDatas = Map.ofList optDataReaders @@ -2073,9 +2167,9 @@ and [] TcImports InterruptibleLazy(fun _ -> match Map.tryFind ccuName optDatas with | None -> None - | Some info -> + | Some (readerA, readerB) -> let data = - GetOptimizationData(fileName, ilScopeRef, ilModule.TryGetILModuleDef(), info) + GetOptimizationData(fileName, ilScopeRef, ilModule.TryGetILModuleDef(), readerA, readerB) let fixupThunk () = data.OptionalFixup(fun nm -> availableToOptionalCcu (tcImports.FindCcu(ctok, m, nm, lookupOnly = false))) @@ -2513,6 +2607,7 @@ and [] TcImports tcConfig.implicitIncludeDir, tcConfig.mlCompatibility, tcConfig.isInteractive, + tcConfig.checkNullness, tcConfig.useReflectionFreeCodeGen, tryFindSysTypeCcu, tcConfig.emitDebugInfoInQuotations, diff --git a/src/Compiler/Driver/CompilerImports.fsi b/src/Compiler/Driver/CompilerImports.fsi index 9697e18968d..2a95347ecbf 100644 --- a/src/Compiler/Driver/CompilerImports.fsi +++ b/src/Compiler/Driver/CompilerImports.fsi @@ -37,13 +37,20 @@ exception MSBuildReferenceResolutionError of message: string * warningCode: stri /// Determine if an IL resource attached to an F# assembly is an F# signature data resource val IsSignatureDataResource: ILResource -> bool +/// Determine if an IL resource attached to an F# assembly is an F# signature data resource (data stream B) +val IsSignatureDataResourceB: ILResource -> bool + /// Determine if an IL resource attached to an F# assembly is an F# optimization data resource val IsOptimizationDataResource: ILResource -> bool +/// Determine if an IL resource attached to an F# assembly is an F# optimization data resource (data stream B) +val IsOptimizationDataResourceB: ILResource -> bool + /// Determine if an IL resource attached to an F# assembly is an F# quotation data resource for reflected definitions val IsReflectedDefinitionsResource: ILResource -> bool -val GetResourceNameAndSignatureDataFunc: ILResource -> string * (unit -> ReadOnlyByteMemory) +val GetResourceNameAndSignatureDataFuncs: + ILResource list -> (string * ((unit -> ReadOnlyByteMemory) * (unit -> ReadOnlyByteMemory) option)) list /// Encode the F# interface data into a set of IL attributes and resources val EncodeSignatureData: diff --git a/src/Compiler/Driver/CompilerOptions.fs b/src/Compiler/Driver/CompilerOptions.fs index e742a20e139..96c40724ef4 100644 --- a/src/Compiler/Driver/CompilerOptions.fs +++ b/src/Compiler/Driver/CompilerOptions.fs @@ -248,7 +248,7 @@ module ResponseFile = let data = seq { while not reader.EndOfStream do - reader.ReadLine() + !! reader.ReadLine() } |> Seq.choose parseLine |> List.ofSeq @@ -278,7 +278,7 @@ let ParseCompilerOptions (collectOtherArgument: string -> unit, blocks: Compiler elif option <> "--" then // is it an abbreviated or MSFT-style option? // if so, strip the first character and move on with your life - // Wierdly a -- option can't have only a 1 character name + // Weirdly a -- option can't have only a 1 character name if option.Length = 2 || isSlashOpt option then option[1..] elif option.Length >= 3 && option[2] = ':' then @@ -680,8 +680,8 @@ let SetEmbedAllSourceSwitch (tcConfigB: TcConfigBuilder) switch = else tcConfigB.embedAllSource <- false -let setOutFileName tcConfigB path = - let outputDir = Path.GetDirectoryName(path) +let setOutFileName tcConfigB (path: string) = + let outputDir = !! Path.GetDirectoryName(path) tcConfigB.outputDir <- Some outputDir tcConfigB.outputFile <- Some path @@ -845,6 +845,14 @@ let errorsAndWarningsFlags (tcConfigB: TcConfigBuilder) = Some(FSComp.SR.optsWarnOn ()) ) + CompilerOption( + "checknulls", + tagNone, + OptionSwitch(fun switch -> tcConfigB.checkNullness <- switch = OptionSwitch.On), + None, + Some(FSComp.SR.optsCheckNulls ()) + ) + CompilerOption( "consolecolors", tagNone, @@ -1220,7 +1228,7 @@ let noFrameworkFlag isFsc tcConfigB = tagNone, OptionUnit(fun () -> // When the compilation is not fsi do nothing. - // It is just not a usefull option when running fsi on the coreclr or the desktop framework really. + // It is just not a useful option when running fsi on the coreclr or the desktop framework really. if isFsc then tcConfigB.implicitlyReferenceDotNetAssemblies <- false tcConfigB.implicitlyResolveAssemblies <- false), @@ -1387,6 +1395,7 @@ let testFlag tcConfigB = let editorSpecificFlags (tcConfigB: TcConfigBuilder) = [ CompilerOption("vserrors", tagNone, OptionUnit(fun () -> tcConfigB.diagnosticStyle <- DiagnosticStyle.VisualStudio), None, None) + CompilerOption("richerrors", tagNone, OptionUnit(fun () -> tcConfigB.diagnosticStyle <- DiagnosticStyle.Rich), None, None) CompilerOption("validate-type-providers", tagNone, OptionUnit id, None, None) // preserved for compatibility's sake, no longer has any effect CompilerOption("LCID", tagInt, OptionInt ignore, None, None) CompilerOption("flaterrors", tagNone, OptionUnit(fun () -> tcConfigB.flatErrors <- true), None, None) @@ -2051,7 +2060,7 @@ let GetBannerText tcConfigB = else "" -/// FSC only help. (FSI has it's own help function). +/// FSC only help. (FSI has its own help function). let GetHelpFsc tcConfigB (blocks: CompilerOptionBlock list) = GetBannerText tcConfigB + GetCompilerOptionBlocks blocks tcConfigB.bufferWidth @@ -2136,7 +2145,7 @@ let abbreviatedFlagsFsc tcConfigB = Some(FSComp.SR.optsShortFormOf ("--target library")) ) - // FSC help abbreviations. FSI has it's own help options... + // FSC help abbreviations. FSI has its own help options... CompilerOption( "?", tagNone, @@ -2389,7 +2398,7 @@ let DoWithColor newColor f = match enableConsoleColoring, foreBackColor () with | false, _ | true, None -> - // could not get console colours, so no attempt to change colours, can not set them back + // could not get console colours, so no attempt to change colours, cannot set them back f () | true, Some(c, _) -> try diff --git a/src/Compiler/Driver/CreateILModule.fs b/src/Compiler/Driver/CreateILModule.fs index 506171ed0ef..5ed836631d7 100644 --- a/src/Compiler/Driver/CreateILModule.fs +++ b/src/Compiler/Driver/CreateILModule.fs @@ -523,7 +523,7 @@ module MainModuleBuilder = $"%d{fileVersionInfo.Major}.%d{fileVersionInfo.Minor}.%d{fileVersionInfo.Build}.%d{fileVersionInfo.Revision}") ("ProductVersion", productVersionString) match tcConfig.outputFile with - | Some f -> ("OriginalFilename", Path.GetFileName f) + | Some f -> ("OriginalFilename", !! Path.GetFileName(f)) | None -> () yield! FindAttribute "Comments" "System.Reflection.AssemblyDescriptionAttribute" yield! FindAttribute "FileDescription" "System.Reflection.AssemblyTitleAttribute" diff --git a/src/Compiler/Driver/FxResolver.fs b/src/Compiler/Driver/FxResolver.fs index 42681600f88..dfeff2cabf3 100644 --- a/src/Compiler/Driver/FxResolver.fs +++ b/src/Compiler/Driver/FxResolver.fs @@ -69,7 +69,7 @@ type internal FxResolver | NonNull message -> lock errorslock (fun () -> errorsList.Add(message)) let psi = ProcessStartInfo() - psi.FileName <- pathToExe + psi.FileName <- !!pathToExe if workingDir.IsSome then psi.WorkingDirectory <- workingDir.Value @@ -91,7 +91,7 @@ type internal FxResolver p.BeginOutputReadLine() p.BeginErrorReadLine() - if not (p.WaitForExit(timeout)) then + if not (p.WaitForExit(timeout: int)) then // Timed out resolving throw a diagnostic. raise (TimeoutException(sprintf "Timeout executing command '%s' '%s'" psi.FileName psi.Arguments)) else @@ -213,7 +213,7 @@ type internal FxResolver if String.IsNullOrWhiteSpace fileName then getFSharpCompilerLocation () else - fileName + !!fileName // Compute the framework implementation directory, either of the selected SDK or the currently running process as a backup // F# interactive/reflective scenarios use the implementation directory of the currently running process @@ -284,7 +284,10 @@ type internal FxResolver try let asm = typeof>.Assembly - if asm.FullName.StartsWith("System.ValueTuple", StringComparison.OrdinalIgnoreCase) then + if + (!!asm.FullName) + .StartsWith("System.ValueTuple", StringComparison.OrdinalIgnoreCase) + then Some asm.Location else let valueTuplePath = @@ -318,7 +321,7 @@ type internal FxResolver version, "" match Version.TryParse(ver) with - | true, v -> v, suffix + | true, v -> !!v, suffix | false, _ -> zeroVersion, suffix let compareVersion (v1: Version * string) (v2: Version * string) = @@ -371,7 +374,7 @@ type internal FxResolver let di = tryGetVersionedSubDirectory "packs/Microsoft.NETCore.App.Ref" version match di with - | Some di -> (Some(di.Name), Some(di.Parent.FullName)), warnings + | Some di -> (Some(di.Name), Some((!!di.Parent).FullName)), warnings | None -> (None, None), warnings with e -> let warn = @@ -416,7 +419,7 @@ type internal FxResolver match runningTfmOpt with | Some tfm -> tfm - | _ -> if isRunningOnCoreClr then "net8.0" else "net472" + | _ -> if isRunningOnCoreClr then "net9.0" else "net472" let trySdkRefsPackDirectory = lazy @@ -495,7 +498,7 @@ type internal FxResolver try if FileSystem.FileExistsShim(reference) then // Reference is a path to a file on disk - Path.GetFileNameWithoutExtension(reference), reference + !! Path.GetFileNameWithoutExtension(reference), reference else // Reference is a SimpleAssembly name reference, frameworkPathFromSimpleName reference @@ -936,7 +939,7 @@ type internal FxResolver if useFsiAuxLib then getFsiLibraryImplementationReference () ] - |> List.filter (Path.GetFileNameWithoutExtension >> systemAssemblies.Contains) + |> List.filter (Path.GetFileNameWithoutExtension >> (!!) >> systemAssemblies.Contains) sdkReferences, false with e -> diff --git a/src/Compiler/Driver/GraphChecking/DependencyResolution.fs b/src/Compiler/Driver/GraphChecking/DependencyResolution.fs index 11ba984ca51..1425ec0f9ed 100644 --- a/src/Compiler/Driver/GraphChecking/DependencyResolution.fs +++ b/src/Compiler/Driver/GraphChecking/DependencyResolution.fs @@ -117,7 +117,7 @@ let rec processStateEntry (trie: TrieNode) (state: FileContentQueryState) (entry FoundDependencies = foundDependencies } - | ModuleName name -> + | FileContentEntry.ModuleName name -> // We need to check if the module name is a hit in the Trie. let state' = let queryResult = queryTrie trie [ name ] diff --git a/src/Compiler/Driver/GraphChecking/DependencyResolution.fsi b/src/Compiler/Driver/GraphChecking/DependencyResolution.fsi index 8804999117e..19dcffc6adf 100644 --- a/src/Compiler/Driver/GraphChecking/DependencyResolution.fsi +++ b/src/Compiler/Driver/GraphChecking/DependencyResolution.fsi @@ -26,7 +26,7 @@ val processOpenPath: trie: TrieNode -> path: LongIdentifier -> state: FileConten /// /// /// The file order is used by the resolution algorithm to remove edges not allowed by the language. -/// Ie. if file B preceeds file A, the resulting graph will not contain edge B -> A. +/// Ie. if file B precedes file A, the resulting graph will not contain edge B -> A. /// Hence this function cannot, as it stands, be used to help create a "reasonable" file ordering for an unordered set of files. /// /// diff --git a/src/Compiler/Driver/GraphChecking/FileContentMapping.fs b/src/Compiler/Driver/GraphChecking/FileContentMapping.fs index e64a64e2ace..c1f6ce8ddb4 100644 --- a/src/Compiler/Driver/GraphChecking/FileContentMapping.fs +++ b/src/Compiler/Driver/GraphChecking/FileContentMapping.fs @@ -9,6 +9,13 @@ type Continuations = ((FileContentEntry list -> FileContentEntry list) -> FileCo let collectFromOption (mapping: 'T -> 'U list) (t: 'T option) : 'U list = List.collect mapping (Option.toList t) let longIdentToPath (skipLast: bool) (longId: LongIdent) : LongIdentifier = + + // We always skip the "special" `global` identifier. + let longId = + match longId with + | h :: t when h.idText = "`global`" -> t + | _ -> longId + match skipLast, longId with | true, _ :: _ -> List.take (longId.Length - 1) longId | _ -> longId @@ -250,6 +257,7 @@ let visitSynType (t: SynType) : FileContentEntry list = let continuations = List.map (snd >> visit) fields Continuation.concatenate continuations continuation | SynType.Array(elementType = elementType) -> visit elementType continuation + | SynType.WithNull(innerType = innerType) -> visit innerType continuation | SynType.Fun(argType, returnType, _, _) -> let continuations = List.map visit [ argType; returnType ] Continuation.concatenate continuations continuation @@ -260,6 +268,7 @@ let visitSynType (t: SynType) : FileContentEntry list = | SynType.HashConstraint(innerType, _) -> visit innerType continuation | SynType.MeasurePower(baseMeasure = baseMeasure) -> visit baseMeasure continuation | SynType.StaticConstant _ -> continuation [] + | SynType.StaticConstantNull _ -> continuation [] | SynType.StaticConstantExpr(expr, _) -> continuation (visitSynExpr expr) | SynType.StaticConstantNamed(ident, value, _) -> let continuations = List.map visit [ ident; value ] @@ -298,6 +307,7 @@ let visitSynTypeConstraint (tc: SynTypeConstraint) : FileContentEntry list = | SynTypeConstraint.WhereTyparIsReferenceType _ | SynTypeConstraint.WhereTyparIsUnmanaged _ | SynTypeConstraint.WhereTyparSupportsNull _ + | SynTypeConstraint.WhereTyparNotSupportsNull _ | SynTypeConstraint.WhereTyparIsComparable _ | SynTypeConstraint.WhereTyparIsEquatable _ -> [] | SynTypeConstraint.WhereTyparDefaultsToType(typeName = typeName) -> visitSynType typeName @@ -595,7 +605,7 @@ let visitPat (p: SynPat) : FileContentEntry list = match p with | NameofPat moduleNameIdent -> continuation [ visitNameofResult moduleNameIdent ] | SynPat.Paren(pat = pat) -> visit pat continuation - | SynPat.Typed(pat = pat; targetType = t) -> visit pat (fun nodes -> nodes @ visitSynType t) + | SynPat.Typed(pat = pat; targetType = t) -> visit pat (fun nodes -> nodes @ visitSynType t |> continuation) | SynPat.Const _ -> continuation [] | SynPat.Wild _ -> continuation [] | SynPat.Named _ -> continuation [] diff --git a/src/Compiler/Driver/GraphChecking/Graph.fs b/src/Compiler/Driver/GraphChecking/Graph.fs index dbe4c6b6cc7..210ca927c7f 100644 --- a/src/Compiler/Driver/GraphChecking/Graph.fs +++ b/src/Compiler/Driver/GraphChecking/Graph.fs @@ -69,7 +69,7 @@ module internal Graph = originalGraph // Collect all edges |> Seq.collect (fun (KeyValue(idx, deps)) -> deps |> Array.map (fun dep -> idx, dep)) - // Group dependants of the same dependencies together + // Group dependents of the same dependencies together |> Seq.groupBy snd // Construct reversed graph |> Seq.map (fun (dep, edges) -> dep, edges |> Seq.map fst |> Seq.toArray) @@ -84,7 +84,7 @@ module internal Graph = |> Seq.iter (fun (KeyValue(file, deps)) -> printfn $"{file} -> {deps |> Array.map nodePrinter |> join}") let print (graph: Graph<'Node>) : unit = - printCustom graph (fun node -> node.ToString()) + printCustom graph (fun node -> node.ToString() |> string) let serialiseToMermaid (graph: Graph) = let sb = StringBuilder() diff --git a/src/Compiler/Driver/GraphChecking/GraphProcessing.fs b/src/Compiler/Driver/GraphChecking/GraphProcessing.fs index 37ecc35041d..218c9d6b2ac 100644 --- a/src/Compiler/Driver/GraphChecking/GraphProcessing.fs +++ b/src/Compiler/Driver/GraphChecking/GraphProcessing.fs @@ -11,7 +11,7 @@ type NodeInfo<'Item> = Item: 'Item Deps: 'Item[] TransitiveDeps: 'Item[] - Dependants: 'Item[] + Dependents: 'Item[] } type IncrementableInt(value: int) = @@ -44,7 +44,7 @@ let processGraph<'Item, 'Result when 'Item: equality and 'Item: comparison> (parentCt: CancellationToken) : ('Item * 'Result)[] = let transitiveDeps = graph |> Graph.transitive - let dependants = graph |> Graph.reverse + let dependents = graph |> Graph.reverse // Cancellation source used to signal either an exception in one of the items or end of processing. use localCts = new CancellationTokenSource() use cts = CancellationTokenSource.CreateLinkedTokenSource(parentCt, localCts.Token) @@ -56,7 +56,7 @@ let processGraph<'Item, 'Result when 'Item: equality and 'Item: comparison> if not exists || not (transitiveDeps.ContainsKey item) - || not (dependants.ContainsKey item) + || not (dependents.ContainsKey item) then printfn $"Unexpected inconsistent state of the graph for item '{item}'" @@ -64,7 +64,7 @@ let processGraph<'Item, 'Result when 'Item: equality and 'Item: comparison> Item = item Deps = graph[item] TransitiveDeps = transitiveDeps[item] - Dependants = dependants[item] + Dependents = dependents[item] } { @@ -133,17 +133,17 @@ let processGraph<'Item, 'Result when 'Item: equality and 'Item: comparison> let singleRes = work getItemPublicNode info node.Result <- Some singleRes - let unblockedDependants = - node.Info.Dependants + let unblockedDependents = + node.Info.Dependents |> lookupMany - // For every dependant, increment its number of processed dependencies, - // and filter dependants which now have all dependencies processed (but didn't before). - |> Array.filter (fun dependant -> - let pdc = dependant.ProcessedDepsCount.Increment() - // Note: We cannot read 'dependant.ProcessedDepsCount' again to avoid returning the same item multiple times. - pdc = dependant.Info.Deps.Length) - - unblockedDependants |> Array.iter queueNode + // For every dependent, increment its number of processed dependencies, + // and filter dependents which now have all dependencies processed (but didn't before). + |> Array.filter (fun dependent -> + let pdc = dependent.ProcessedDepsCount.Increment() + // Note: We cannot read 'dependent.ProcessedDepsCount' again to avoid returning the same item multiple times. + pdc = dependent.Info.Deps.Length) + + unblockedDependents |> Array.iter queueNode incrementProcessedNodesCount () leaves |> Array.iter queueNode @@ -175,7 +175,7 @@ let processGraphAsync<'Item, 'Result when 'Item: equality and 'Item: comparison> : Async<('Item * 'Result)[]> = async { let transitiveDeps = graph |> Graph.transitive - let dependants = graph |> Graph.reverse + let dependents = graph |> Graph.reverse // Cancellation source used to signal either an exception in one of the items or end of processing. let! parentCt = Async.CancellationToken use localCts = new CancellationTokenSource() @@ -193,7 +193,7 @@ let processGraphAsync<'Item, 'Result when 'Item: equality and 'Item: comparison> if not exists || not (transitiveDeps.ContainsKey item) - || not (dependants.ContainsKey item) + || not (dependents.ContainsKey item) then printfn $"Unexpected inconsistent state of the graph for item '{item}'" @@ -201,7 +201,7 @@ let processGraphAsync<'Item, 'Result when 'Item: equality and 'Item: comparison> Item = item Deps = graph[item] TransitiveDeps = transitiveDeps[item] - Dependants = dependants[item] + Dependents = dependents[item] } { @@ -269,17 +269,17 @@ let processGraphAsync<'Item, 'Result when 'Item: equality and 'Item: comparison> let! singleRes = work getItemPublicNode info node.Result <- Some singleRes - let unblockedDependants = - node.Info.Dependants + let unblockedDependents = + node.Info.Dependents |> lookupMany - // For every dependant, increment its number of processed dependencies, - // and filter dependants which now have all dependencies processed (but didn't before). - |> Array.filter (fun dependant -> - let pdc = dependant.ProcessedDepsCount.Increment() - // Note: We cannot read 'dependant.ProcessedDepsCount' again to avoid returning the same item multiple times. - pdc = dependant.Info.Deps.Length) - - unblockedDependants |> Array.iter queueNode + // For every dependent, increment its number of processed dependencies, + // and filter dependents which now have all dependencies processed (but didn't before). + |> Array.filter (fun dependent -> + let pdc = dependent.ProcessedDepsCount.Increment() + // Note: We cannot read 'dependent.ProcessedDepsCount' again to avoid returning the same item multiple times. + pdc = dependent.Info.Deps.Length) + + unblockedDependents |> Array.iter queueNode incrementProcessedNodesCount () } diff --git a/src/Compiler/Driver/GraphChecking/GraphProcessing.fsi b/src/Compiler/Driver/GraphChecking/GraphProcessing.fsi index 585daa52fd7..7a8c9f9885e 100644 --- a/src/Compiler/Driver/GraphChecking/GraphProcessing.fsi +++ b/src/Compiler/Driver/GraphChecking/GraphProcessing.fsi @@ -8,7 +8,7 @@ type NodeInfo<'Item> = { Item: 'Item Deps: 'Item[] TransitiveDeps: 'Item[] - Dependants: 'Item[] } + Dependents: 'Item[] } /// An already processed node in the graph, with its result available type ProcessedNode<'Item, 'Result> = @@ -21,7 +21,7 @@ type GraphProcessingException = /// /// A generic method to generate results for a graph of work items in parallel. -/// Processes leaves first, and after each node has been processed, schedules any now unblocked dependants. +/// Processes leaves first, and after each node has been processed, schedules any now unblocked dependents. /// Returns a list of results, one per item. /// Uses the Thread Pool to schedule work. /// diff --git a/src/Compiler/Driver/GraphChecking/TrieMapping.fs b/src/Compiler/Driver/GraphChecking/TrieMapping.fs index 7eeb40108bd..95b22637e9a 100644 --- a/src/Compiler/Driver/GraphChecking/TrieMapping.fs +++ b/src/Compiler/Driver/GraphChecking/TrieMapping.fs @@ -12,7 +12,7 @@ module private ImmutableHashSet = let singleton (value: 'T) = ImmutableHashSet.Create<'T>(Array.singleton value) - /// Create new new HashSet<'T> with zero elements. + /// Create a new HashSet<'T> with zero elements. let empty () = ImmutableHashSet.Empty let autoOpenShapes = diff --git a/src/Compiler/Driver/GraphChecking/Types.fs b/src/Compiler/Driver/GraphChecking/Types.fs index c667a573f69..7443df58204 100644 --- a/src/Compiler/Driver/GraphChecking/Types.fs +++ b/src/Compiler/Driver/GraphChecking/Types.fs @@ -61,6 +61,7 @@ type internal TrieNode = /// A significant construct found in the syntax tree of a file. /// This construct needs to be processed in order to deduce potential links to other files in the project. +[] type internal FileContentEntry = /// Any toplevel namespace a file might have. /// In case a file has `module X.Y.Z`, then `X.Y` is considered to be the toplevel namespace diff --git a/src/Compiler/Driver/GraphChecking/Types.fsi b/src/Compiler/Driver/GraphChecking/Types.fsi index 096719b6be7..5f075a1bad7 100644 --- a/src/Compiler/Driver/GraphChecking/Types.fsi +++ b/src/Compiler/Driver/GraphChecking/Types.fsi @@ -55,6 +55,7 @@ type internal TrieNode = /// A significant construct found in the syntax tree of a file. /// This construct needs to be processed in order to deduce potential links to other files in the project. +[] type internal FileContentEntry = /// Any toplevel namespace a file might have. /// In case a file has `module X.Y.Z`, then `X.Y` is considered to be the toplevel namespace diff --git a/src/Compiler/Driver/OptimizeInputs.fs b/src/Compiler/Driver/OptimizeInputs.fs index 85cde3b6c0e..36eae5734ce 100644 --- a/src/Compiler/Driver/OptimizeInputs.fs +++ b/src/Compiler/Driver/OptimizeInputs.fs @@ -389,7 +389,6 @@ let ApplyAllOptimizations importMap, prevFile.FirstLoopRes.OptEnv, isIncrementalFragment, - tcConfig.fsiMultiAssemblyEmit, tcConfig.emitTailcalls, prevFile.FirstLoopRes.HidingInfo, file @@ -436,7 +435,6 @@ let ApplyAllOptimizations importMap, prevFile.OptEnvExtraLoop, isIncrementalFragment, - tcConfig.fsiMultiAssemblyEmit, tcConfig.emitTailcalls, prevPhase.FirstLoopRes.HidingInfo, file @@ -507,7 +505,6 @@ let ApplyAllOptimizations importMap, prevFile.OptEnvFinalSimplify, isIncrementalFragment, - tcConfig.fsiMultiAssemblyEmit, tcConfig.emitTailcalls, prevPhase.FirstLoopRes.HidingInfo, file diff --git a/src/Compiler/Driver/ParseAndCheckInputs.fs b/src/Compiler/Driver/ParseAndCheckInputs.fs index 7f7dd55ef7a..d5d18d79651 100644 --- a/src/Compiler/Driver/ParseAndCheckInputs.fs +++ b/src/Compiler/Driver/ParseAndCheckInputs.fs @@ -352,8 +352,8 @@ let PostParseModuleSpecs type ModuleNamesDict = Map> /// Checks if a module name is already given and deduplicates the name if needed. -let DeduplicateModuleName (moduleNamesDict: ModuleNamesDict) fileName (qualNameOfFile: QualifiedNameOfFile) = - let path = Path.GetDirectoryName fileName +let DeduplicateModuleName (moduleNamesDict: ModuleNamesDict) (fileName: string) (qualNameOfFile: QualifiedNameOfFile) = + let path = !! Path.GetDirectoryName(fileName) let path = if FileSystem.IsPathRootedShim path then @@ -434,7 +434,7 @@ let ParseInput "ParseAndCheckFile.parseFile" [| Activity.Tags.fileName, fileName - Activity.Tags.buildPhase, BuildPhase.Parse.ToString() + Activity.Tags.buildPhase, !! BuildPhase.Parse.ToString() Activity.Tags.userOpName, userOpName |> Option.defaultValue "" |] @@ -511,7 +511,7 @@ let ParseInput finally // OK, now commit the errors, since the ScopedPragmas will (hopefully) have been scraped let filteringDiagnosticsLogger = - GetDiagnosticsLoggerFilteringByScopedPragmas(false, scopedPragmas, diagnosticOptions, diagnosticsLogger) + GetDiagnosticsLoggerFilteringByScopedPragmas(lexbuf.LanguageVersion, scopedPragmas, diagnosticOptions, diagnosticsLogger) delayLogger.CommitDelayedDiagnostics filteringDiagnosticsLogger @@ -803,7 +803,7 @@ let ParseOneInputFile (tcConfig: TcConfig, lexResourceManager, fileName, isLastC /// NOTE: Max errors is currently counted separately for each logger. When max errors is reached on one compilation /// the given Exiter will be called. /// -/// NOTE: this needs to be improved to commit diagnotics as soon as possible +/// NOTE: this needs to be improved to commit diagnostics as soon as possible /// /// NOTE: If StopProcessing is raised by any piece of work then the overall function raises StopProcessing. let UseMultipleDiagnosticLoggers (inputs, diagnosticsLogger, eagerFormat) f = @@ -884,7 +884,7 @@ let ProcessMetaCommandsFromInput match args with | [ path ] -> - let p = if String.IsNullOrWhiteSpace(path) then "" else path + let p = if String.IsNullOrWhiteSpace(path) then "" else !!path hashReferenceF state (m, p, directive) @@ -1429,7 +1429,7 @@ let CheckOneInput // Within a file, equip loggers to locally filter w.r.t. scope pragmas in each input let DiagnosticsLoggerForInput (tcConfig: TcConfig, input: ParsedInput, oldLogger) = - GetDiagnosticsLoggerFilteringByScopedPragmas(false, input.ScopedPragmas, tcConfig.diagnosticsOptions, oldLogger) + GetDiagnosticsLoggerFilteringByScopedPragmas(tcConfig.langVersion, input.ScopedPragmas, tcConfig.diagnosticsOptions, oldLogger) /// Typecheck a single file (or interactive entry into F# Interactive) let CheckOneInputEntry (ctok, checkForErrors, tcConfig: TcConfig, tcImports, tcGlobals, prefixPathOpt) tcState input = @@ -1514,7 +1514,7 @@ type NodeToTypeCheck = /// This can be either an implementation or a signature file. | PhysicalFile of fileIndex: FileIndex /// An artificial node that will add the earlier processed signature information to the TcEnvFromImpls. - /// Dependants on this type of node will perceive that a file is known in both TcEnvFromSignatures and TcEnvFromImpls. + /// Dependents on this type of node will perceive that a file is known in both TcEnvFromSignatures and TcEnvFromImpls. /// Even though the actual implementation file was not type-checked. | ArtificialImplFile of signatureFileIndex: FileIndex diff --git a/src/Compiler/Driver/ParseAndCheckInputs.fsi b/src/Compiler/Driver/ParseAndCheckInputs.fsi index 875be616a8e..fb32a4557cd 100644 --- a/src/Compiler/Driver/ParseAndCheckInputs.fsi +++ b/src/Compiler/Driver/ParseAndCheckInputs.fsi @@ -47,7 +47,7 @@ type NodeToTypeCheck = /// This can be either an implementation or a signature file. | PhysicalFile of fileIndex: FileIndex /// An artificial node that will add the earlier processed signature information to the TcEnvFromImpls. - /// Dependants on this type of node will perceive that a file is known in both TcEnvFromSignatures and TcEnvFromImpls. + /// Dependents on this type of node will perceive that a file is known in both TcEnvFromSignatures and TcEnvFromImpls. /// Even though the actual implementation file was not type-checked. | ArtificialImplFile of signatureFileIndex: FileIndex diff --git a/src/Compiler/Driver/ScriptClosure.fs b/src/Compiler/Driver/ScriptClosure.fs index 2374fd6793b..0e22231abb8 100644 --- a/src/Compiler/Driver/ScriptClosure.fs +++ b/src/Compiler/Driver/ScriptClosure.fs @@ -42,7 +42,7 @@ type LoadClosure = /// The resolved references along with the ranges of the #r positions in each file. References: (string * AssemblyResolution list) list - /// The resolved pacakge references along with the ranges of the #r positions in each file. + /// The resolved package references along with the ranges of the #r positions in each file. PackageReferences: (range * string list)[] /// Whether we're decided to use .NET Framework analysis for this script @@ -159,7 +159,7 @@ module ScriptPreprocessClosure = reduceMemoryUsage ) = - let projectDir = Path.GetDirectoryName fileName + let projectDir = !! Path.GetDirectoryName(fileName) let isInteractive = (codeContext = CodeContext.CompilationAndEvaluation) let isInvalidationSupported = (codeContext = CodeContext.Editing) @@ -460,7 +460,7 @@ module ScriptPreprocessClosure = let diagnosticsLogger = CapturingDiagnosticsLogger("FindClosureMetaCommands") use _ = UseDiagnosticsLogger diagnosticsLogger - let pathOfMetaCommandSource = Path.GetDirectoryName fileName + let pathOfMetaCommandSource = !! Path.GetDirectoryName(fileName) let preSources = tcConfig.GetAvailableLoadedSources() let tcConfigResult, noWarns = diff --git a/src/Compiler/Driver/ScriptClosure.fsi b/src/Compiler/Driver/ScriptClosure.fsi index c5deec56b64..6f764b299a9 100644 --- a/src/Compiler/Driver/ScriptClosure.fsi +++ b/src/Compiler/Driver/ScriptClosure.fsi @@ -39,7 +39,7 @@ type LoadClosure = /// The resolved references along with the ranges of the #r positions in each file. References: (string * AssemblyResolution list) list - /// The resolved pacakge references along with the ranges of the #r positions in each file. + /// The resolved package references along with the ranges of the #r positions in each file. PackageReferences: (range * string list)[] /// Whether we're decided to use .NET Framework analysis for this script diff --git a/src/Compiler/Driver/StaticLinking.fs b/src/Compiler/Driver/StaticLinking.fs index 007c77c8e52..53916744622 100644 --- a/src/Compiler/Driver/StaticLinking.fs +++ b/src/Compiler/Driver/StaticLinking.fs @@ -158,7 +158,7 @@ let StaticLinkILModules match depILModule.Manifest with | Some m -> for ca in m.CustomAttrs.AsArray() do - if ca.Method.MethodRef.DeclaringTypeRef.FullName = typeof.FullName then + if ca.Method.MethodRef.DeclaringTypeRef.FullName = !!typeof.FullName then ca | _ -> () ] @@ -184,7 +184,8 @@ let StaticLinkILModules // Save only the interface/optimization attributes of generated data let intfDataResources, others = - allResources |> List.partition (snd >> IsSignatureDataResource) + allResources + |> List.partition (fun (_, r) -> IsSignatureDataResource r || IsSignatureDataResourceB r) let intfDataResources = [ @@ -194,7 +195,8 @@ let StaticLinkILModules ] let optDataResources, others = - others |> List.partition (snd >> IsOptimizationDataResource) + others + |> List.partition (fun (_, r) -> IsOptimizationDataResource r || IsOptimizationDataResourceB r) let optDataResources = [ diff --git a/src/Compiler/Driver/fsc.fs b/src/Compiler/Driver/fsc.fs index 26be4051cbd..9dccdec826d 100644 --- a/src/Compiler/Driver/fsc.fs +++ b/src/Compiler/Driver/fsc.fs @@ -29,13 +29,11 @@ open FSharp.Compiler.AbstractIL open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AbstractIL.ILBinaryReader open FSharp.Compiler.AccessibilityLogic -open FSharp.Compiler.CheckExpressions open FSharp.Compiler.CheckDeclarations open FSharp.Compiler.CompilerConfig open FSharp.Compiler.CompilerDiagnostics open FSharp.Compiler.CompilerImports open FSharp.Compiler.CompilerOptions -open FSharp.Compiler.CompilerGlobalState open FSharp.Compiler.CreateILModule open FSharp.Compiler.DependencyManager open FSharp.Compiler.Diagnostics @@ -47,7 +45,6 @@ open FSharp.Compiler.IO open FSharp.Compiler.ParseAndCheckInputs open FSharp.Compiler.OptimizeInputs open FSharp.Compiler.ScriptClosure -open FSharp.Compiler.Syntax open FSharp.Compiler.StaticLinking open FSharp.Compiler.TcGlobals open FSharp.Compiler.Text @@ -55,7 +52,7 @@ open FSharp.Compiler.Text.Range open FSharp.Compiler.TypedTree open FSharp.Compiler.TypedTreeOps open FSharp.Compiler.XmlDocFileWriter -open FSharp.Compiler.BuildGraph +open FSharp.Compiler.CheckExpressionsOps //---------------------------------------------------------------------------- // Reporting - warnings, errors @@ -374,7 +371,7 @@ module InterfaceFileWriter = let writeToSeparateFiles (declaredImpls: CheckedImplFile list) = for CheckedImplFile(qualifiedNameOfFile = name) as impl in declaredImpls do let fileName = - Path.ChangeExtension(name.Range.FileName, extensionForFile name.Range.FileName) + !! Path.ChangeExtension(name.Range.FileName, extensionForFile name.Range.FileName) printfn "writing impl file to %s" fileName use os = FileSystem.OpenFileForWriteShim(fileName, FileMode.Create).GetWriter() @@ -395,7 +392,7 @@ module InterfaceFileWriter = // 2) If not, but FSharp.Core.dll exists beside the compiler binaries, it will copy it to output directory. // 3) If not, it will produce an error. let CopyFSharpCore (outFile: string, referencedDlls: AssemblyReference list) = - let outDir = Path.GetDirectoryName outFile + let outDir = !! Path.GetDirectoryName(outFile) let fsharpCoreAssemblyName = GetFSharpCoreLibraryName() + ".dll" let fsharpCoreDestinationPath = Path.Combine(outDir, fsharpCoreAssemblyName) @@ -415,7 +412,7 @@ let CopyFSharpCore (outFile: string, referencedDlls: AssemblyReference list) = | Some referencedFsharpCoreDll -> copyFileIfDifferent referencedFsharpCoreDll.Text fsharpCoreDestinationPath | None -> let executionLocation = Assembly.GetExecutingAssembly().Location - let compilerLocation = Path.GetDirectoryName executionLocation + let compilerLocation = !! Path.GetDirectoryName(executionLocation) let compilerFsharpCoreDllPath = Path.Combine(compilerLocation, fsharpCoreAssemblyName) @@ -748,7 +745,7 @@ let main2 yield! pragmas ] - GetDiagnosticsLoggerFilteringByScopedPragmas(true, scopedPragmas, tcConfig.diagnosticsOptions, oldLogger) + GetDiagnosticsLoggerFilteringByScopedPragmas(tcConfig.langVersion, scopedPragmas, tcConfig.diagnosticsOptions, oldLogger) SetThreadDiagnosticsLoggerNoUnwind diagnosticsLogger diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index f74fc3da3e3..2e391fa5515 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -561,6 +561,7 @@ tcCouldNotFindIDisposable,"Couldn't find Dispose on IDisposable, or it was overl 706,tcInvalidUnitsOfMeasurePrefix,"Units-of-measure cannot be used as prefix arguments to a type. Rewrite as postfix arguments in angle brackets." 707,tcUnitsOfMeasureInvalidInTypeConstructor,"Unit-of-measure cannot be used in type constructor application" 708,tcRequireBuilderMethod,"This control construct may only be used if the computation expression builder defines a '%s' method" +708,tcEmptyBodyRequiresBuilderZeroMethod,"An empty body may only be used if the computation expression builder defines a 'Zero' method." 709,tcTypeHasNoNestedTypes,"This type has no nested types" 711,tcUnexpectedSymbolInTypeExpression,"Unexpected %s in type expression" 712,tcTypeParameterInvalidAsTypeConstructor,"Type parameter cannot be used as type constructor" @@ -678,7 +679,7 @@ tcUnnamedArgumentsDoNotFormPrefix,"The unnamed arguments do not form a prefix of 824,tcAttributesAreNotPermittedOnLetBindings,"Attributes are not permitted on 'let' bindings in expressions" 825,tcDefaultValueAttributeRequiresVal,"The 'DefaultValue' attribute may only be used on 'val' declarations" 826,tcConditionalAttributeRequiresMembers,"The 'ConditionalAttribute' attribute may only be used on members" -827,tcInvalidActivePatternName,"This is not a valid name for an active pattern" +827,tcInvalidActivePatternName,"'%s' is not a valid method name. Use a 'let' binding instead." 828,tcEntryPointAttributeRequiresFunctionInModule,"The 'EntryPointAttribute' attribute may only be used on function definitions in modules" 829,tcMutableValuesCannotBeInline,"Mutable values cannot be marked 'inline'" 830,tcMutableValuesMayNotHaveGenericParameters,"Mutable values cannot have generic parameters" @@ -874,7 +875,7 @@ srcFileTooLarge,"Source file is too large to embed in a portable PDB" optsResource,"Embed the specified managed resource" optsLinkresource,"Link the specified resource to this assembly where the resinfo format is [,[,public|private]]" optsDebugPM,"Emit debug information (Short form: -g)" -optsDebug,"Specify debugging type: full, portable, embedded, pdbonly. ('%s' is the default if no debuggging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file)." +optsDebug,"Specify debugging type: full, portable, embedded, pdbonly. ('%s' is the default if no debugging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file)." optsOptimize,"Enable optimizations (Short form: -O)" optsTailcalls,"Enable or disable tailcalls" optsDeterministic,"Produce a deterministic assembly (including module version GUID and timestamp)" @@ -1019,7 +1020,7 @@ lexfltSeparatorTokensOfPatternMatchMisaligned,"The '|' tokens separating rules o # ----------------------------------------------------------------------------- lexCharNotAllowedInOperatorNames,"'%s' is not permitted as a character in operator names and is reserved for future use" lexUnexpectedChar,"Unexpected character '%s'" -1140,lexByteArrayCannotEncode,"This byte array literal contains characters that do not encode as a single byte" +1140,lexByteArrayCannotEncode,"This byte array literal contains %d characters that do not encode as a single byte" 1141,lexIdentEndInMarkReserved,"Identifiers followed by '%s' are reserved for future use" 1142,lexOutsideEightBitSigned,"This number is outside the allowable range for 8-bit signed integers" 1143,lexOutsideEightBitSignedHex,"This number is outside the allowable range for hexadecimal 8-bit signed integers" @@ -1036,7 +1037,8 @@ lexUnexpectedChar,"Unexpected character '%s'" 1154,lexOutsideDecimal,"This number is outside the allowable range for decimal literals" 1155,lexOutsideThirtyTwoBitFloat,"This number is outside the allowable range for 32-bit floats" 1156,lexInvalidNumericLiteral,"This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint)." -1157,lexInvalidByteLiteral,"This is not a valid byte literal" +1157,lexInvalidAsciiByteLiteral,"This is not a valid byte character literal. The value must be less than or equal to '\127'B." +1157,lexInvalidTrigraphAsciiByteLiteral,"This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error." 1158,lexInvalidCharLiteral,"This is not a valid character literal" 1159,lexThisUnicodeOnlyInStringLiterals,"This Unicode encoding is only valid in string literals" 1160,lexTokenReserved,"This token is reserved for future use" @@ -1130,6 +1132,8 @@ lexIfOCaml,"IF-FSHARP/IF-CAML regions are no longer supported" 1249,lexUnmatchedRBracesInTripleQuote,"The interpolated string contains unmatched closing braces." 1250,lexTooManyPercentsInTripleQuote,"The interpolated triple quoted string literal does not start with enough '$' characters to allow this many consecutive '%%' characters." 1251,lexExtendedStringInterpolationNotSupported,"Extended string interpolation is not supported in this version of F#." +1252,lexInvalidCharLiteralInString,"'%s' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '%s'. In a future F# version this warning will be promoted to an error." +1253,lexByteArrayOutisdeAscii,"This byte array literal contains %d non-ASCII characters. All characters should be < 128y." # reshapedmsbuild.fs 1300,toolLocationHelperUnsupportedFrameworkVersion,"The specified .NET Framework version '%s' is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion." # ----------------------------------------------------------------------------- @@ -1166,7 +1170,7 @@ fscTooManyErrors,"Exiting - too many errors" 2018,fscKeyFileWarning,"Option '--keyfile' overrides attribute 'System.Reflection.AssemblyKeyFileAttribute' given in a source file or added module" 2019,fscKeyNameWarning,"Option '--keycontainer' overrides attribute 'System.Reflection.AssemblyNameAttribute' given in a source file or added module" 2020,fscReferenceOnCommandLine,"The assembly '%s' is listed on the command line. Assemblies should be referenced using a command line flag such as '-r'." -2021,fscRemotingError,"The resident compilation service was not used because a problem occured in communicating with the server." +2021,fscRemotingError,"The resident compilation service was not used because a problem occurred in communicating with the server." 2022,pathIsInvalid,"Problem with filename '%s': Illegal characters in path." 2023,fscResxSourceFileDeprecated,"Passing a .resx file (%s) as a source file to the compiler is deprecated. Use resgen.exe to transform the .resx file into a .resources file to pass as a --resource option. If you are using MSBuild, this can be done via an item in the .fsproj project file." 2024,fscStaticLinkingNoProfileMismatches,"Static linking may not be used on an assembly referencing mscorlib (e.g. a .NET Framework assembly) when generating an assembly that references System.Runtime (e.g. a .NET Core or Portable assembly)." @@ -1210,7 +1214,7 @@ fscTooManyErrors,"Exiting - too many errors" 3043,etUnexpectedExceptionFromProvidedMemberMember,"Unexpected exception from member '%s' of provided type '%s' member '%s': %s" 3044,etNestedProvidedTypesDoNotTakeStaticArgumentsOrGenericParameters,"Nested provided types do not take static arguments or generic parameters" 3045,etInvalidStaticArgument,"Invalid static argument to provided type. Expected an argument of kind '%s'." -3046,etErrorApplyingStaticArgumentsToType,"An error occured applying the static arguments to a provided type" +3046,etErrorApplyingStaticArgumentsToType,"An error occurred applying the static arguments to a provided type" 3047,etUnknownStaticArgumentKind,"Unknown static argument kind '%s' when resolving a reference to a provided type or method '%s'" 3048,etProviderHasDesignerAssemblyDependency,"The type provider designer assembly '%s' could not be loaded from folder '%s' because a dependency was missing or could not loaded. All dependencies of the type provider designer assembly must be located in the same folder as that assembly. The exception reported was: %s - %s" 3049,etProviderHasDesignerAssemblyException,"The type provider designer assembly '%s' could not be loaded from folder '%s'. The exception reported was: %s - %s" @@ -1225,7 +1229,7 @@ invalidFullNameForProvidedType,"invalid full name for provided type" 3061,tcTypeCastErased,"This downcast will erase the provided type '%s' to the type '%s'." 3062,tcTypeTestErased,"This type test with a provided type '%s' is not allowed because this provided type will be erased to '%s' at runtime." 3063,tcCannotInheritFromErasedType,"Cannot inherit from erased provided type" -3065,etInvalidTypeProviderAssemblyName,"Assembly '%s' hase TypeProviderAssembly attribute with invalid value '%s'. The value should be a valid assembly name" +3065,etInvalidTypeProviderAssemblyName,"Assembly '%s' has TypeProviderAssembly attribute with invalid value '%s'. The value should be a valid assembly name" 3066,tcInvalidMemberNameCtor,"Invalid member name. Members may not have name '.ctor' or '.cctor'" 3068,tcInferredGenericTypeGivesRiseToInconsistency,"The function or member '%s' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is '%s'." 3069,tcInvalidTypeArgumentCount,"The number of type arguments did not match: '%d' given, '%d' expected. This may be related to a previously reported error." @@ -1356,7 +1360,7 @@ descriptionUnavailable,"(description unavailable...)" 3179,fscSystemRuntimeInteropServicesIsRequired,"System.Runtime.InteropServices assembly is required to use UnknownWrapper\DispatchWrapper classes." 3180,abImplicitHeapAllocation,"The mutable local '%s' is implicitly allocated as a reference cell because it has been captured by a closure. This warning is for informational purposes only to indicate where implicit allocations are performed." estApplyStaticArgumentsForMethodNotImplemented,"A type provider implemented GetStaticParametersForMethod, but ApplyStaticArgumentsForMethod was not implemented or invalid" -3181,etErrorApplyingStaticArgumentsToMethod,"An error occured applying the static arguments to a provided method" +3181,etErrorApplyingStaticArgumentsToMethod,"An error occurred applying the static arguments to a provided method" 3182,pplexUnexpectedChar,"Unexpected character '%s' in preprocessor expression" 3183,ppparsUnexpectedToken,"Unexpected token '%s' in preprocessor expression" 3184,ppparsIncompleteExpression,"Incomplete preprocessor expression" @@ -1382,7 +1386,7 @@ tcTupleStructMismatch,"One tuple type is a struct tuple, the other is a referenc 3202,tcUnsupportedMutRecDecl,"This declaration is not supported in recursive declaration groups" 3203,parsInvalidUseOfRec,"Invalid use of 'rec' keyword" 3204,tcStructUnionMultiCaseDistinctFields,"If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'." -3206,CallerMemberNameIsOverriden,"The CallerMemberNameAttribute applied to parameter '%s' will have no effect. It is overridden by the CallerFilePathAttribute." +3206,CallerMemberNameIsOverridden,"The CallerMemberNameAttribute applied to parameter '%s' will have no effect. It is overridden by the CallerFilePathAttribute." 3207,tcFixedNotAllowed,"Invalid use of 'fixed'. 'fixed' may only be used in a declaration of the form 'use x = fixed expr' where the expression is one of the following: an array, the address of an array element, a string, a byref, an inref, or a type implementing GetPinnableReference()" 3208,tcCouldNotFindOffsetToStringData,"Could not find method System.Runtime.CompilerServices.OffsetToStringData in references when building 'fixed' expression." 3209,chkNoByrefAddressOfLocal,"The address of the variable '%s' or a related expression cannot be used at this point. This is to ensure the address of the local value does not escape its scope." @@ -1461,7 +1465,7 @@ keywordDescriptionStatic,"Used to indicate a method or property that can be call keywordDescriptionStruct,"Used to declare a structure type. Also used in generic parameter constraints." keywordDescriptionThen,"Used in conditional expressions. Also used to perform side effects after object construction." keywordDescriptionTo,"Used in for loops to indicate a range." -keywordDescriptionTry,"Used to introduce a block of code that might generate an exception. Used together with with or finally." +keywordDescriptionTry,"Used to introduce a block of code that might generate an exception. Used together with 'with' or 'finally'." keywordDescriptionType,"Used to declare a class, record, structure, discriminated union, enumeration type, unit of measure, or type abbreviation." keywordDescriptionTypeTest,"Used to check if an object is of the given type in a pattern or binding." keywordDescriptionUpcast,"Used to convert to a type that is higher in the inheritance chain." @@ -1521,6 +1525,22 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl 3250,expressionHasNoName,"Expression does not have a name." 3251,chkNoFirstClassNameOf,"Using the 'nameof' operator as a first-class function value is not permitted." 3252,tcIllegalByrefsInOpenTypeDeclaration,"Byref types are not allowed in an open type declaration." +3260,tcTypeDoesNotHaveAnyNull,"The type '%s' does not support a nullness qualification." +#3261 reserved for ConstraintSolverNullnessWarningEquivWithTypes +#3261 reserved for ConstraintSolverNullnessWarningWithTypes +#3261 reserved for ConstraintSolverNullnessWarningWithType +#3261 reserved for ConstraintSolverNullnessWarning +3262,tcPassingWithoutNullToANullableExpectingFunc,"Value known to be without null passed to a function meant for nullables: %s" +tcPassingWithoutNullToOptionOfObj,"You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value." +tcPassingWithoutNullToValueOptionOfObj,"You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value." +tcPassingWithoutNullToNonNullAP,"You can remove this |Null|NonNull| pattern usage." +tcPassingWithoutNullToNonNullQuickAP,"You can remove this |NonNullQuick| pattern usage." +tcPassingWithoutNullTononNullFunction,"You can remove this `nonNull` assertion." +3263,tcNullableToStringOverride,"With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function." +3268,csNullNotNullConstraintInconsistent,"The constraints 'null' and 'not null' are inconsistent" +3271,tcNullnessCheckingNotEnabled,"The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored." +csTypeHasNullAsTrueValue,"The type '%s' uses 'null' as a representation value but a non-null type is expected" +csTypeHasNullAsExtraValue,"The type '%s' supports 'null' but a non-null type is expected" 3300,chkInvalidFunctionParameterType,"The parameter '%s' has an invalid type '%s'. This is not permitted by the rules of Common IL." 3301,chkInvalidFunctionReturnType,"The function or method has an invalid return type '%s'. This is not permitted by the rules of Common IL." 3302,packageManagementRequiresVFive,"The 'package management' feature requires language version 5.0 or above" @@ -1535,6 +1555,8 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl 3352,typrelInterfaceMemberNoMostSpecificImplementation,"Interface member '%s' does not have a most specific implementation." 3353,fsiInvalidDirective,"Invalid directive '#%s %s'" useSdkRefs,"Use reference assemblies for .NET framework references when available (Enabled by default)." +optsCheckNulls,"Enable nullness declarations and checks" +fSharpBannerVersion,"%s for F# %s" optsGetLangVersions,"Display the allowed values for language version." optsSetLangVersion,"Specify language version such as 'latest' or 'preview'." optsSupportedLangVersions,"Supported language versions:" @@ -1544,7 +1566,7 @@ nativeResourceHeaderMalformed,"Resource header beginning at offset %s is malform formatDashItem," - %s" featureSingleUnderscorePattern,"single underscore pattern" featureWildCardInForLoop,"wild card in for loop" -featureRelaxWhitespace,"whitespace relexation" +featureRelaxWhitespace,"whitespace relaxation" featureNameOf,"nameof" featureImplicitYield,"implicit yield" featureOpenTypeDeclaration,"open type declaration" @@ -1553,6 +1575,7 @@ featurePackageManagement,"package management" featureFromEndSlicing,"from-end slicing" featureFixedIndexSlice3d4d,"fixed-index slice 3d/4d" featureAndBang,"applicative computation expressions" +featureNullnessChecking,"nullness checking" featureResumableStateMachines,"resumable state machines" featureNullableOptionalInterop,"nullable optional interop" featureDefaultInterfaceMemberConsumption,"default interface member consumption" @@ -1596,7 +1619,7 @@ featureBooleanReturningAndReturnTypeDirectedPartialActivePattern,"Boolean-return featureEnforceAttributeTargets,"Enforce AttributeTargets" featureLowerInterpolatedStringToConcat,"Optimizes interpolated strings in certain cases, by lowering to concatenation" featureLowerIntegralRangesToFastLoops,"Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops." -featureLowerSimpleMappingsInComprehensionsToDirectCallsToMap,"Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to calls to List.map and Array.map when xs is a list or an array, respectively." +featureLowerSimpleMappingsInComprehensionsToFastLoops,"Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively." 3354,tcNotAFunctionButIndexerNamedIndexingNotYetEnabled,"This value supports indexing, e.g. '%s.[index]'. The syntax '%s[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation." 3354,tcNotAFunctionButIndexerIndexingNotYetEnabled,"This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation." 3355,tcNotAnIndexerNamedIndexingNotYetEnabled,"The value '%s' is not a function and does not support index notation." @@ -1661,7 +1684,7 @@ forFormatInvalidForInterpolated4,"Interpolated strings used as type IFormattable 3501,tcResumableCodeFunctionMustBeInline,"Invalid resumable code. Any method of function accepting or returning resumable code must be marked 'inline'" 3501,tcResumableCodeArgMustHaveRightName,"Invalid resumable code. Resumable code parameter must have name beginning with '__expand'" 3501,tcResumableCodeArgMustHaveRightKind,"Invalid resumable code. A resumable code parameter must be of delegate or function type" -3501,tcResumableCodeContainsLetRec,"Invalid resumable code. A 'let rec' occured in the resumable code specification" +3501,tcResumableCodeContainsLetRec,"Invalid resumable code. A 'let rec' occurred in the resumable code specification" 3510,tcResumableCodeNotSupported,"Using resumable code or resumable state machines requires /langversion:preview" 3510,tcNoEagerConstraintApplicationAttribute,"Using methods with 'NoEagerConstraintApplicationAttribute' requires /langversion:6.0 or later" 3511,reprStateMachineNotCompilable,"This state machine is not statically compilable. %s. An alternative dynamic implementation will be used, which may be slower. Consider adjusting your code to ensure this state machine is statically compilable, or else suppress this warning." @@ -1669,8 +1692,8 @@ forFormatInvalidForInterpolated4,"Interpolated strings used as type IFormattable 3513,tcResumableCodeInvocation,"Resumable code invocation. Suppress this warning if you are defining new low-level resumable code in terms of existing resumable code." 3514,ilxGenUnknownDebugPoint,"Unknown debug point '%s'. The available debug points are '%s'." reprResumableCodeInvokeNotReduced,"A resumable code invocation at '%s' could not be reduced" -reprResumableCodeContainsLetRec,"A 'let rec' occured in the resumable code specification" -reprResumableCodeContainsConstrainedGenericLet,"A constrained generic construct occured in the resumable code specification" +reprResumableCodeContainsLetRec,"A 'let rec' occurred in the resumable code specification" +reprResumableCodeContainsConstrainedGenericLet,"A constrained generic construct occurred in the resumable code specification" reprResumableCodeContainsDynamicResumeAtInBody,"A target label for __resumeAt was not statically determined. A __resumeAt with a non-static target label may only appear at the start of a resumable code method" reprResumableCodeContainsResumptionInTryFinally,"A try/finally may not contain resumption points" reprResumableCodeContainsResumptionInHandlerOrFilter,"The 'with' block of a try/with may not contain resumption points" @@ -1694,7 +1717,7 @@ reprStateMachineInvalidForm,"The state machine has an unexpected form" 3535,tcUsingInterfacesWithStaticAbstractMethods,"Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'." 3536,tcUsingInterfaceWithStaticAbstractMethodAsType,"'%s' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'." 3537,tcTraitHasMultipleSupportTypes,"The trait '%s' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance." -3545,tcMissingRequiredMembers,"The following required properties have to be initalized:%s" +3545,tcMissingRequiredMembers,"The following required properties have to be initialized:%s" 3546,parsExpectingPattern,"Expecting pattern" 3547,parsExpectedPatternAfterToken,"Expected a pattern after this point" 3548,matchNotAllowedForUnionCaseWithNoData,"Pattern discard is not allowed for union case that takes no data." @@ -1743,7 +1766,7 @@ featureReuseSameFieldsInStructUnions,"Share underlying fields in a [] di 3860,chkStaticMembersOnObjectExpressions,"Object expressions cannot implement interfaces with static abstract members or declare static members." 3861,chkTailCallAttrOnNonRec,"The TailCall attribute should only be applied to recursive functions." 3862,parsStaticMemberImcompleteSyntax,"Incomplete declaration of a static construct. Use 'static let','static do','static member' or 'static val' for declaration." -3863,parsExpectingField,"Expecting record field" +3863,parsExpectingRecordField,"Expecting record field" 3864,tooManyMethodsInDotNetTypeWritingAssembly,"The type '%s' has too many methods. Found: '%d', maximum: '%d'" 3865,parsOnlySimplePatternsAreAllowedInConstructors,"Only simple patterns are allowed in primary constructors" 3866,chkStaticAbstractInterfaceMembers,"A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.%s)." @@ -1755,3 +1778,10 @@ featureReuseSameFieldsInStructUnions,"Share underlying fields in a [] di featureParsedHashDirectiveArgumentNonString,"# directives with non-quoted string arguments" 3869,featureParsedHashDirectiveUnexpectedInteger,"Unexpected integer literal '%d'." 3869,featureParsedHashDirectiveUnexpectedIdentifier,"Unexpected identifier '%s'." +featureEmptyBodiedComputationExpressions,"Support for computation expressions with empty bodies: builder {{ }}" +3870,parsExpectingUnionCaseField,"Expecting union case field" +featureAllowAccessModifiersToAutoPropertiesGettersAndSetters,"Allow access modifiers to auto properties getters and setters" +3871,tcAccessModifiersNotAllowedInSRTPConstraint,"Access modifiers cannot be applied to an SRTP constraint." +featureAllowObjectExpressionWithoutOverrides,"Allow object expressions without overrides" +3872,tcPartialActivePattern,"Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern." +featureConsistentNowarnLineDirectiveInteraction,"The interaction between #nowarn and #line is now consistent." diff --git a/src/Compiler/FSStrings.resx b/src/Compiler/FSStrings.resx index 278d209991b..383b4991105 100644 --- a/src/Compiler/FSStrings.resx +++ b/src/Compiler/FSStrings.resx @@ -129,6 +129,18 @@ A type parameter is missing a constraint '{0}' + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + + + Nullness warning: The type '{0}' does not support 'null'. + + + Nullness warning: {0}. + The unit of measure '{0}' does not match the unit of measure '{1}' @@ -184,7 +196,7 @@ Duplicate definition of {0} '{1}' - The {0} '{1}' can not be defined because the name '{2}' clashes with the {3} '{4}' in this type or module + The {0} '{1}' cannot be defined because the name '{2}' clashes with the {3} '{4}' in this type or module Two members called '{0}' have the same signature @@ -414,6 +426,9 @@ symbol '|}' + + symbol '|' (directly before 'null') + symbol '>}' diff --git a/src/Compiler/FSharp.Compiler.Service.fsproj b/src/Compiler/FSharp.Compiler.Service.fsproj index f0278eaf957..cde4e8aea1e 100644 --- a/src/Compiler/FSharp.Compiler.Service.fsproj +++ b/src/Compiler/FSharp.Compiler.Service.fsproj @@ -1,4 +1,4 @@ - + @@ -13,6 +13,15 @@ FSharp.Compiler.Service true $(DefineConstants);COMPILER + true + + $(FSharpNetCoreProductDefaultTargetFramework);$(TargetFrameworks) $(DefineConstants);FSHARPCORE_USE_PACKAGE $(OtherFlags) --extraoptimizationloops:1 @@ -21,7 +30,9 @@ $(OtherFlags) --warnon:3218 $(OtherFlags) --warnon:3390 - true + + $(OtherFlags) --generate-filter-blocks + true $(IntermediateOutputPath)$(TargetFramework)\ $(IntermediateOutputPath)$(TargetFramework)\ false @@ -32,7 +43,7 @@ false false - false + true @@ -40,7 +51,7 @@ FSharp.Compiler.Service.nuspec true The F# Compiler Services package for F# $(FSLanguageVersion) exposes additional functionality for implementing F# language bindings, additional tools based on the compiler or refactoring tools. The package also includes F# interactive service that can be used for embedding F# scripting into your applications. Contains code from the F# Software Foundation. - /blob/main/release-notes.md#FSharp-Compiler-Service-$(FSharpCompilerServiceReleaseNotesVersion) + /blob/main/docs/release-notes/.FSharp.Compiler.Service/$(FSharpLibrariesChangelogVersion).md F#, fsharp, interactive, compiler, editor preview $(MSBuildThisFileDirectory)logo.png @@ -89,6 +100,7 @@ + FSComp.txt @@ -98,10 +110,11 @@ FSStrings.resx FSStrings.resources - - + + + @@ -114,8 +127,6 @@ - - @@ -312,6 +323,7 @@ + @@ -363,12 +375,15 @@ - - + + + - - + + + + diff --git a/src/Compiler/Facilities/AsyncMemoize.fs b/src/Compiler/Facilities/AsyncMemoize.fs index 49c08e5320a..d22093a2b4f 100644 --- a/src/Compiler/Facilities/AsyncMemoize.fs +++ b/src/Compiler/Facilities/AsyncMemoize.fs @@ -11,14 +11,15 @@ open FSharp.Compiler open FSharp.Compiler.BuildGraph open FSharp.Compiler.Diagnostics open FSharp.Compiler.DiagnosticsLogger +open Internal.Utilities.Library open System.Runtime.CompilerServices [] module internal Utils = /// Return file name with one directory above it - let shortPath path = - let dirPath = Path.GetDirectoryName path + let shortPath (path: string) = + let dirPath = !! Path.GetDirectoryName(path) let dir = dirPath.Split Path.DirectorySeparatorChar @@ -146,7 +147,12 @@ type internal CachingDiagnosticsLogger(originalLogger: DiagnosticsLogger option) member _.CapturedDiagnostics = capturedDiagnostics |> Seq.toList [] -type internal AsyncMemoize<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'TVersion: equality> +type internal AsyncMemoize<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'TVersion: equality +#if !NO_CHECKNULLS + and 'TKey:not null + and 'TVersion:not null +#endif + > (?keepStrongly, ?keepWeakly, ?name: string, ?cancelDuplicateRunningJobs: bool) = let name = defaultArg name "N/A" @@ -287,7 +293,7 @@ type internal AsyncMemoize<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'T key.Version, key.Label, (Running( - TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously), + TaskCompletionSource<'TValue>(TaskCreationOptions.RunContinuationsAsynchronously), cts, computation, DateTime.Now, @@ -474,7 +480,7 @@ type internal AsyncMemoize<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'T { new ICacheKey<_, _> with member _.GetKey() = key member _.GetVersion() = Unchecked.defaultof<_> - member _.GetLabel() = key.ToString() + member _.GetLabel() = match key.ToString() with | null -> "" | s -> s } this.Get(wrappedKey, computation) diff --git a/src/Compiler/Facilities/AsyncMemoize.fsi b/src/Compiler/Facilities/AsyncMemoize.fsi index 88288ea4fc8..049a06914a8 100644 --- a/src/Compiler/Facilities/AsyncMemoize.fsi +++ b/src/Compiler/Facilities/AsyncMemoize.fsi @@ -47,12 +47,17 @@ type internal AsyncLock = member Do: f: (unit -> #Task<'b>) -> Task<'b> /// -/// A cache/memoization for computations that makes sure that the same computation wil only be computed once even if it's needed +/// A cache/memoization for computations that makes sure that the same computation will only be computed once even if it's needed /// at multiple places/times. /// /// Strongly holds at most one result per key. /// -type internal AsyncMemoize<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'TVersion: equality> = +type internal AsyncMemoize<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'TVersion: equality +#if !NO_CHECKNULLS + and 'TKey:not null + and 'TVersion:not null +#endif + > = /// Maximum number of strongly held results to keep in the cache /// Maximum number of weakly held results to keep in the cache diff --git a/src/Compiler/Facilities/CompilerLocation.fs b/src/Compiler/Facilities/CompilerLocation.fs index 11f944c5f30..9cd20c1863e 100644 --- a/src/Compiler/Facilities/CompilerLocation.fs +++ b/src/Compiler/Facilities/CompilerLocation.fs @@ -8,6 +8,7 @@ open System.IO open System.Reflection open System.Runtime.InteropServices open Microsoft.FSharp.Core +open Internal.Utilities.Library #nowarn "44" // ConfigurationSettings is obsolete but the new stuff is horribly complicated. @@ -23,7 +24,10 @@ module internal FSharpEnvironment = let FSharpProductName = UtilsStrings.SR.buildProductName (FSharpBannerVersion) - let versionOf<'t> = typeof<'t>.Assembly.GetName().Version.ToString() + let versionOf<'t> : MaybeNull = + match typeof<'t>.Assembly.GetName().Version with + | null -> null + | v -> v.ToString() let FSharpCoreLibRunningVersion = try @@ -40,8 +44,9 @@ module internal FSharpEnvironment = let FSharpBinaryMetadataFormatRevision = "2.0.0.0" let isRunningOnCoreClr = - typeof.Assembly.FullName - .StartsWith("System.Private.CoreLib", StringComparison.InvariantCultureIgnoreCase) + match typeof.Assembly.FullName with + | null -> false + | name -> name.StartsWith("System.Private.CoreLib", StringComparison.InvariantCultureIgnoreCase) module Option = /// Convert string into Option string where null and String.Empty result in None @@ -69,7 +74,7 @@ module internal FSharpEnvironment = try // We let you set FSHARP_COMPILER_BIN. I've rarely seen this used and its not documented in the install instructions. match Environment.GetEnvironmentVariable("FSHARP_COMPILER_BIN") with - | result when not (String.IsNullOrWhiteSpace result) -> Some result + | result when not (String.IsNullOrWhiteSpace result) -> Some !!result | _ -> let safeExists f = (try @@ -83,7 +88,8 @@ module internal FSharpEnvironment = | _ -> let fallback () = let d = Assembly.GetExecutingAssembly() - Some(Path.GetDirectoryName d.Location) + + Some(!! Path.GetDirectoryName(d.Location)) match tryCurrentDomain () with | None -> fallback () @@ -118,6 +124,7 @@ module internal FSharpEnvironment = |] elif typeof.Assembly.GetName().Name = "System.Private.CoreLib" then [| + "net9.0" "net8.0" "net7.0" "net6.0" @@ -184,7 +191,7 @@ module internal FSharpEnvironment = | Some(p: string) -> match Path.GetDirectoryName(p) with | s when String.IsNullOrEmpty(s) || Path.GetFileName(p) = "packages" || s = p -> () - | parentDir -> yield! searchParentDirChain (Some parentDir) assemblyName + | parentDir -> yield! searchParentDirChain (Option.ofObj parentDir) assemblyName for p in searchToolPaths path compilerToolPaths do let fileName = Path.Combine(p, assemblyName) @@ -195,7 +202,9 @@ module internal FSharpEnvironment = let loadFromParentDirRelativeToRuntimeAssemblyLocation designTimeAssemblyName = let runTimeAssemblyPath = Path.GetDirectoryName runTimeAssemblyFileName - let paths = searchParentDirChain (Some runTimeAssemblyPath) designTimeAssemblyName + + let paths = + searchParentDirChain (Option.ofObj runTimeAssemblyPath) designTimeAssemblyName paths |> Seq.tryHead @@ -203,7 +212,7 @@ module internal FSharpEnvironment = | Some res -> loadFromLocation res | None -> // The search failed, just load from the first location and report an error - let runTimeAssemblyPath = Path.GetDirectoryName runTimeAssemblyFileName + let runTimeAssemblyPath = !! Path.GetDirectoryName(runTimeAssemblyFileName) loadFromLocation (Path.Combine(runTimeAssemblyPath, designTimeAssemblyName)) if designTimeAssemblyName.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) then @@ -214,9 +223,9 @@ module internal FSharpEnvironment = // design-time DLLs specified using "x.DesignTIme, Version= ..." long assembly names and GAC loads. // These kind of design-time assembly specifications are no longer used to our knowledge so that comparison is basically legacy // and will always succeed. - let name = AssemblyName(Path.GetFileNameWithoutExtension designTimeAssemblyName) + let name = AssemblyName(!! Path.GetFileNameWithoutExtension(designTimeAssemblyName)) - if name.Name.Equals(name.FullName, StringComparison.OrdinalIgnoreCase) then + if name.FullName.Equals(name.Name, StringComparison.OrdinalIgnoreCase) then let designTimeFileName = designTimeAssemblyName + ".dll" loadFromParentDirRelativeToRuntimeAssemblyLocation designTimeFileName else @@ -236,7 +245,8 @@ module internal FSharpEnvironment = let getFSharpCompilerLocationWithDefaultFromType (defaultLocation: Type) = let location = try - Some(Path.GetDirectoryName(defaultLocation.Assembly.Location)) + let directory = Path.GetDirectoryName(defaultLocation.Assembly.Location) + Option.ofObj (directory) with _ -> None @@ -265,7 +275,7 @@ module internal FSharpEnvironment = // Must be alongside the location of FSharp.CompilerService.dll let getDefaultFsiLibraryLocation () = - Path.Combine(Path.GetDirectoryName(getFSharpCompilerLocation ()), fsiLibraryName + ".dll") + Path.Combine(!! Path.GetDirectoryName(getFSharpCompilerLocation ()), fsiLibraryName + ".dll") let isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) @@ -285,7 +295,7 @@ module internal FSharpEnvironment = if String.IsNullOrEmpty(pf) then Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) else - pf + !!pf let candidate = Path.Combine(pf, "dotnet", dotnet) @@ -310,20 +320,23 @@ module internal FSharpEnvironment = let probePathForDotnetHost () = let paths = let p = Environment.GetEnvironmentVariable("PATH") - if not (isNull p) then p.Split(Path.PathSeparator) else [||] + + match p with + | null -> [||] + | p -> p.Split(Path.PathSeparator) paths |> Array.tryFind (fun f -> fileExists (Path.Combine(f, dotnet))) match (Environment.GetEnvironmentVariable("DOTNET_HOST_PATH")) with // Value set externally - | value when not (String.IsNullOrEmpty(value)) && fileExists value -> Some value + | NonEmptyString value when fileExists value -> Some value | _ -> // Probe for netsdk install, dotnet. and dotnet.exe is a constant offset from the location of System.Int32 let candidate = let assemblyLocation = Path.GetDirectoryName(typeof.GetTypeInfo().Assembly.Location) - Path.GetFullPath(Path.Combine(assemblyLocation, "..", "..", "..", dotnet)) + Path.GetFullPath(Path.Combine(!!assemblyLocation, "..", "..", "..", dotnet)) if fileExists candidate then Some candidate @@ -341,12 +354,12 @@ module internal FSharpEnvironment = [| match getDotnetHostPath (), getDotnetGlobalHostPath () with | Some hostPath, Some globalHostPath -> - yield Path.GetDirectoryName(hostPath) + yield !! Path.GetDirectoryName(hostPath) if isDotnetMultilevelLookup && hostPath <> globalHostPath then - yield Path.GetDirectoryName(globalHostPath) - | Some hostPath, None -> yield Path.GetDirectoryName(hostPath) - | None, Some globalHostPath -> yield Path.GetDirectoryName(globalHostPath) + yield !! Path.GetDirectoryName(globalHostPath) + | Some hostPath, None -> yield !! Path.GetDirectoryName(hostPath) + | None, Some globalHostPath -> yield !! Path.GetDirectoryName(globalHostPath) | None, None -> () |] diff --git a/src/Compiler/Facilities/DiagnosticOptions.fs b/src/Compiler/Facilities/DiagnosticOptions.fs index 15e8db01593..2a3a6ffe742 100644 --- a/src/Compiler/Facilities/DiagnosticOptions.fs +++ b/src/Compiler/Facilities/DiagnosticOptions.fs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -// This file contains simple types related to diagnsotics that are made public in the +// This file contains simple types related to diagnostics that are made public in the // FSharp.Compiler.Service API but which are also used throughout the // F# compiler. namespace FSharp.Compiler.Diagnostics diff --git a/src/Compiler/Facilities/DiagnosticOptions.fsi b/src/Compiler/Facilities/DiagnosticOptions.fsi index 6cbde1eb0be..8ff6b3d2f88 100644 --- a/src/Compiler/Facilities/DiagnosticOptions.fsi +++ b/src/Compiler/Facilities/DiagnosticOptions.fsi @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -// This file contains simple types related to diagnsotics that are made public in the +// This file contains simple types related to diagnostics that are made public in the // FSharp.Compiler.Service API but which are also used throughout the // F# compiler. diff --git a/src/Compiler/Facilities/DiagnosticsLogger.fs b/src/Compiler/Facilities/DiagnosticsLogger.fs index 382a9574f97..69d1f4fc306 100644 --- a/src/Compiler/Facilities/DiagnosticsLogger.fs +++ b/src/Compiler/Facilities/DiagnosticsLogger.fs @@ -18,13 +18,14 @@ open Internal.Utilities.Library.Extras open System.Threading.Tasks /// Represents the style being used to format errors -[] +[] type DiagnosticStyle = | Default | Emacs | Test | VisualStudio | Gcc + | Rich /// Thrown when we want to add some range information to a .NET exception exception WrappedError of exn * range with @@ -176,7 +177,7 @@ let rec AttachRange m (exn: exn) = else match exn with // Strip TargetInvocationException wrappers - | :? TargetInvocationException -> AttachRange m exn.InnerException + | :? TargetInvocationException as e when isNotNull e.InnerException -> AttachRange m !!exn.InnerException | UnresolvedReferenceNoRange a -> UnresolvedReferenceError(a, m) | UnresolvedPathReferenceNoRange(a, p) -> UnresolvedPathReference(a, p, m) | :? NotSupportedException -> exn @@ -351,6 +352,9 @@ type DiagnosticsLogger(nameForDebugging: string) = member x.CheckForErrors() = (x.ErrorCount > 0) + abstract CheckForRealErrorsIgnoringWarnings: bool + default x.CheckForRealErrorsIgnoringWarnings = x.CheckForErrors() + member _.DebugDisplay() = sprintf "DiagnosticsLogger(%s)" nameForDebugging @@ -423,7 +427,7 @@ module DiagnosticsLoggerExtensions = try if not tryAndDetectDev15 then let preserveStackTrace = - typeof + !!typeof .GetMethod("InternalPreserveStackTrace", BindingFlags.Instance ||| BindingFlags.NonPublic) preserveStackTrace.Invoke(exn, null) |> ignore @@ -899,6 +903,10 @@ type StackGuard(maxDepth: int, name: string) = finally depth <- depth - 1 + [] + member x.GuardCancellable(original: Cancellable<'T>) = + Cancellable(fun ct -> x.Guard(fun () -> Cancellable.run ct original)) + static member val DefaultDepth = #if DEBUG GetEnvInteger "FSHARP_DefaultStackGuardDepth" 50 diff --git a/src/Compiler/Facilities/DiagnosticsLogger.fsi b/src/Compiler/Facilities/DiagnosticsLogger.fsi index 048988e0cf9..e5a4c8e7f8a 100644 --- a/src/Compiler/Facilities/DiagnosticsLogger.fsi +++ b/src/Compiler/Facilities/DiagnosticsLogger.fsi @@ -10,13 +10,14 @@ open System.Runtime.CompilerServices open System.Runtime.InteropServices /// Represents the style being used to format errors -[] +[] type DiagnosticStyle = | Default | Emacs | Test | VisualStudio | Gcc + | Rich /// Thrown when we want to add some range information to a .NET exception exception WrappedError of exn * range @@ -44,7 +45,7 @@ val (|StopProcessing|_|): exn: exn -> unit voption val StopProcessing<'T> : exn -/// Represents a diagnostic exeption whose text comes via SR.* +/// Represents a diagnostic exception whose text comes via SR.* exception DiagnosticWithText of number: int * message: string * range: range /// A diagnostic that is raised when enabled manually, or by default with a language feature @@ -54,7 +55,7 @@ exception DiagnosticEnabledWithLanguageFeature of range: range * enabledByLangFeature: bool -/// Creates a diagnostic exeption whose text comes via SR.* +/// Creates a diagnostic exception whose text comes via SR.* val Error: (int * string) * range -> exn exception InternalError of message: string * range: range @@ -100,7 +101,7 @@ val inline protectAssemblyExplorationNoReraise: dflt1: 'T -> dflt2: 'T -> f: (un val AttachRange: m: range -> exn: exn -> exn -/// Represnts an early exit from parsing, checking etc, for example because 'maxerrors' has been reached. +/// Represents an early exit from parsing, checking etc, for example because 'maxerrors' has been reached. type Exiter = abstract Exit: int -> 'T @@ -208,6 +209,9 @@ type DiagnosticsLogger = /// Checks if ErrorCount > 0 member CheckForErrors: unit -> bool + abstract CheckForRealErrorsIgnoringWarnings: bool + default CheckForRealErrorsIgnoringWarnings: bool + /// Represents a DiagnosticsLogger that discards diagnostics val DiscardErrorsLogger: DiagnosticsLogger @@ -458,6 +462,8 @@ type StackGuard = [] line: int -> 'T + member GuardCancellable: Internal.Utilities.Library.Cancellable<'T> -> Internal.Utilities.Library.Cancellable<'T> + static member GetDepthOption: string -> int /// This represents the global state established as each task function runs as part of the build. diff --git a/src/Compiler/Facilities/LanguageFeatures.fs b/src/Compiler/Facilities/LanguageFeatures.fs index c8378c1042f..5f16aead30a 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fs +++ b/src/Compiler/Facilities/LanguageFeatures.fs @@ -38,6 +38,7 @@ type LanguageFeature = | StringInterpolation | OverloadsForCustomOperations | ExpandedMeasurables + | NullnessChecking | StructActivePattern | PrintfBinaryFormat | IndexerNotationWithoutDot @@ -88,8 +89,12 @@ type LanguageFeature = | EnforceAttributeTargets | LowerInterpolatedStringToConcat | LowerIntegralRangesToFastLoops - | LowerSimpleMappingsInComprehensionsToDirectCallsToMap + | AllowAccessModifiersToAutoPropertiesGettersAndSetters + | LowerSimpleMappingsInComprehensionsToFastLoops | ParsedHashDirectiveArgumentNonQuotes + | EmptyBodiedComputationExpressions + | AllowObjectExpressionWithoutOverrides + | ConsistentNowarnLineDirectiveInteraction /// LanguageVersion management type LanguageVersion(versionText) = @@ -101,10 +106,11 @@ type LanguageVersion(versionText) = static let languageVersion60 = 6.0m static let languageVersion70 = 7.0m static let languageVersion80 = 8.0m + static let languageVersion90 = 9.0m static let previewVersion = 9999m // Language version when preview specified - static let defaultVersion = languageVersion80 // Language version when default specified + static let defaultVersion = languageVersion90 // Language version when default specified static let latestVersion = defaultVersion // Language version when latest specified - static let latestMajorVersion = languageVersion80 // Language version when latestmajor specified + static let latestMajorVersion = languageVersion90 // Language version when latestmajor specified static let validOptions = [| "preview"; "default"; "latest"; "latestmajor" |] @@ -117,6 +123,7 @@ type LanguageVersion(versionText) = languageVersion60 languageVersion70 languageVersion80 + languageVersion90 |] static let features = @@ -193,20 +200,27 @@ type LanguageVersion(versionText) = LanguageFeature.ExtendedFixedBindings, languageVersion80 LanguageFeature.PreferStringGetPinnableReference, languageVersion80 + // F# 9.0 + LanguageFeature.NullnessChecking, languageVersion90 + LanguageFeature.ReuseSameFieldsInStructUnions, languageVersion90 + LanguageFeature.PreferExtensionMethodOverPlainProperty, languageVersion90 + LanguageFeature.WarningIndexedPropertiesGetSetSameType, languageVersion90 + LanguageFeature.WarningWhenTailCallAttrOnNonRec, languageVersion90 + LanguageFeature.UnionIsPropertiesVisible, languageVersion90 + LanguageFeature.BooleanReturningAndReturnTypeDirectedPartialActivePattern, languageVersion90 + LanguageFeature.LowerInterpolatedStringToConcat, languageVersion90 + LanguageFeature.LowerIntegralRangesToFastLoops, languageVersion90 + LanguageFeature.LowerSimpleMappingsInComprehensionsToFastLoops, languageVersion90 + LanguageFeature.ParsedHashDirectiveArgumentNonQuotes, languageVersion90 + LanguageFeature.EmptyBodiedComputationExpressions, languageVersion90 + LanguageFeature.ConsistentNowarnLineDirectiveInteraction, languageVersion90 + // F# preview - LanguageFeature.FromEndSlicing, previewVersion - LanguageFeature.UnmanagedConstraintCsharpInterop, previewVersion - LanguageFeature.ReuseSameFieldsInStructUnions, previewVersion - LanguageFeature.PreferExtensionMethodOverPlainProperty, previewVersion - LanguageFeature.WarningIndexedPropertiesGetSetSameType, previewVersion - LanguageFeature.WarningWhenTailCallAttrOnNonRec, previewVersion - LanguageFeature.UnionIsPropertiesVisible, previewVersion - LanguageFeature.BooleanReturningAndReturnTypeDirectedPartialActivePattern, previewVersion - LanguageFeature.EnforceAttributeTargets, previewVersion - LanguageFeature.LowerInterpolatedStringToConcat, previewVersion - LanguageFeature.LowerIntegralRangesToFastLoops, previewVersion - LanguageFeature.LowerSimpleMappingsInComprehensionsToDirectCallsToMap, previewVersion - LanguageFeature.ParsedHashDirectiveArgumentNonQuotes, previewVersion + LanguageFeature.EnforceAttributeTargets, previewVersion // waiting for fix of https://github.com/dotnet/fsharp/issues/17731 + LanguageFeature.UnmanagedConstraintCsharpInterop, previewVersion // not enabled because: https://github.com/dotnet/fsharp/issues/17509 + LanguageFeature.FromEndSlicing, previewVersion // Unfinished features --- needs work + LanguageFeature.AllowAccessModifiersToAutoPropertiesGettersAndSetters, previewVersion + LanguageFeature.AllowObjectExpressionWithoutOverrides, previewVersion ] static let defaultLanguageVersion = LanguageVersion("default") @@ -228,6 +242,8 @@ type LanguageVersion(versionText) = | "7" -> languageVersion70 | "8.0" | "8" -> languageVersion80 + | "9.0" + | "9" -> languageVersion90 | _ -> 0m let specified = getVersionFromString versionText @@ -289,6 +305,7 @@ type LanguageVersion(versionText) = | LanguageFeature.FromEndSlicing -> FSComp.SR.featureFromEndSlicing () | LanguageFeature.FixedIndexSlice3d4d -> FSComp.SR.featureFixedIndexSlice3d4d () | LanguageFeature.AndBang -> FSComp.SR.featureAndBang () + | LanguageFeature.NullnessChecking -> FSComp.SR.featureNullnessChecking () | LanguageFeature.ResumableStateMachines -> FSComp.SR.featureResumableStateMachines () | LanguageFeature.NullableOptionalInterop -> FSComp.SR.featureNullableOptionalInterop () | LanguageFeature.DefaultInterfaceMemberConsumption -> FSComp.SR.featureDefaultInterfaceMemberConsumption () @@ -353,9 +370,14 @@ type LanguageVersion(versionText) = | LanguageFeature.EnforceAttributeTargets -> FSComp.SR.featureEnforceAttributeTargets () | LanguageFeature.LowerInterpolatedStringToConcat -> FSComp.SR.featureLowerInterpolatedStringToConcat () | LanguageFeature.LowerIntegralRangesToFastLoops -> FSComp.SR.featureLowerIntegralRangesToFastLoops () - | LanguageFeature.LowerSimpleMappingsInComprehensionsToDirectCallsToMap -> - FSComp.SR.featureLowerSimpleMappingsInComprehensionsToDirectCallsToMap () + | LanguageFeature.AllowAccessModifiersToAutoPropertiesGettersAndSetters -> + FSComp.SR.featureAllowAccessModifiersToAutoPropertiesGettersAndSetters () + | LanguageFeature.LowerSimpleMappingsInComprehensionsToFastLoops -> + FSComp.SR.featureLowerSimpleMappingsInComprehensionsToFastLoops () | LanguageFeature.ParsedHashDirectiveArgumentNonQuotes -> FSComp.SR.featureParsedHashDirectiveArgumentNonString () + | LanguageFeature.EmptyBodiedComputationExpressions -> FSComp.SR.featureEmptyBodiedComputationExpressions () + | LanguageFeature.AllowObjectExpressionWithoutOverrides -> FSComp.SR.featureAllowObjectExpressionWithoutOverrides () + | LanguageFeature.ConsistentNowarnLineDirectiveInteraction -> FSComp.SR.featureConsistentNowarnLineDirectiveInteraction () /// Get a version string associated with the given feature. static member GetFeatureVersionString feature = diff --git a/src/Compiler/Facilities/LanguageFeatures.fsi b/src/Compiler/Facilities/LanguageFeatures.fsi index 354d657bc40..4ae722c7f60 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fsi +++ b/src/Compiler/Facilities/LanguageFeatures.fsi @@ -28,6 +28,7 @@ type LanguageFeature = | StringInterpolation | OverloadsForCustomOperations | ExpandedMeasurables + | NullnessChecking | StructActivePattern | PrintfBinaryFormat | IndexerNotationWithoutDot @@ -79,8 +80,12 @@ type LanguageFeature = | EnforceAttributeTargets | LowerInterpolatedStringToConcat | LowerIntegralRangesToFastLoops - | LowerSimpleMappingsInComprehensionsToDirectCallsToMap + | AllowAccessModifiersToAutoPropertiesGettersAndSetters + | LowerSimpleMappingsInComprehensionsToFastLoops | ParsedHashDirectiveArgumentNonQuotes + | EmptyBodiedComputationExpressions + | AllowObjectExpressionWithoutOverrides + | ConsistentNowarnLineDirectiveInteraction /// LanguageVersion management type LanguageVersion = diff --git a/src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs b/src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs index 017cdfaacea..c9f84390367 100644 --- a/src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs +++ b/src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs @@ -12,7 +12,7 @@ open FSharp.Compiler.IO // 1. List of frameworks // 2. DeriveTargetFrameworkDirectoriesFor45Plus // 3. HighestInstalledRefAssembliesOrDotNETFramework -// 4. GetPathToDotNetFrameworkImlpementationAssemblies +// 4. GetPathToDotNetFrameworkImplementationAssemblies [] let private Net45 = "v4.5" @@ -50,11 +50,11 @@ let private SimulatedMSBuildResolver = /// Get the path to the .NET Framework implementation assemblies by using ToolLocationHelper.GetPathToDotNetFramework /// This is only used to specify the "last resort" path for assembly resolution. - let GetPathToDotNetFrameworkImlpementationAssemblies _ = + let GetPathToDotNetFrameworkImplementationAssemblies _ = let isDesktop = typeof.Assembly.GetName().Name = "mscorlib" if isDesktop then - match System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() with + match (System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(): string MaybeNull) with | null -> [] | x -> [ x ] else @@ -82,7 +82,7 @@ let private SimulatedMSBuildResolver = if Environment.OSVersion.Platform = PlatformID.Win32NT then let PF = match Environment.GetEnvironmentVariable("ProgramFiles(x86)") with - | null -> Environment.GetEnvironmentVariable("ProgramFiles") // if PFx86 is null, then we are 32-bit and just get PF + | null -> !! Environment.GetEnvironmentVariable("ProgramFiles") // if PFx86 is null, then we are 32-bit and just get PF | s -> s PF + @"\Reference Assemblies\Microsoft\Framework\.NETFramework" @@ -112,7 +112,7 @@ let private SimulatedMSBuildResolver = yield fsharpCoreDir yield implicitIncludeDir yield! GetPathToDotNetFrameworkReferenceAssemblies targetFrameworkVersion - yield! GetPathToDotNetFrameworkImlpementationAssemblies targetFrameworkVersion + yield! GetPathToDotNetFrameworkImplementationAssemblies targetFrameworkVersion ] for r, baggage in references do @@ -150,14 +150,14 @@ let private SimulatedMSBuildResolver = let fscoreDir0 = let PF = match Environment.GetEnvironmentVariable("ProgramFiles(x86)") with - | null -> Environment.GetEnvironmentVariable("ProgramFiles") + | null -> !! Environment.GetEnvironmentVariable("ProgramFiles") | s -> s PF + @"\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\" - + n.Version.ToString() + + (!!n.Version).ToString() - let trialPath = Path.Combine(fscoreDir0, n.Name + ".dll") + let trialPath = Path.Combine(fscoreDir0, !!n.Name + ".dll") if FileSystem.FileExistsShim trialPath then success trialPath @@ -173,7 +173,7 @@ let private SimulatedMSBuildResolver = r else try - AssemblyName(r).Name + ".dll" + !!AssemblyName(r).Name + ".dll" with _ -> r + ".dll" @@ -198,7 +198,7 @@ let private SimulatedMSBuildResolver = let netFx = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() let gac = - Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(netFx.TrimEnd('\\'))), "assembly") + Path.Combine(!! Path.GetDirectoryName(Path.GetDirectoryName(netFx.TrimEnd('\\'))), "assembly") match n.Version, n.GetPublicKeyToken() with | null, _ @@ -207,7 +207,7 @@ let private SimulatedMSBuildResolver = [ if FileSystem.DirectoryExistsShim gac then for gacDir in FileSystem.EnumerateDirectoriesShim gac do - let assemblyDir = Path.Combine(gacDir, n.Name) + let assemblyDir = Path.Combine(gacDir, !!n.Name) if FileSystem.DirectoryExistsShim assemblyDir then for tdir in FileSystem.EnumerateDirectoriesShim assemblyDir do @@ -228,7 +228,7 @@ let private SimulatedMSBuildResolver = if FileSystem.DirectoryExistsShim gac then for gacDir in Directory.EnumerateDirectories gac do //printfn "searching GAC directory: %s" gacDir - let assemblyDir = Path.Combine(gacDir, n.Name) + let assemblyDir = Path.Combine(gacDir, !!n.Name) if FileSystem.DirectoryExistsShim assemblyDir then //printfn "searching GAC directory: %s" assemblyDir diff --git a/src/Compiler/Facilities/TextLayoutRender.fs b/src/Compiler/Facilities/TextLayoutRender.fs index 12595b69211..735d44b82ad 100644 --- a/src/Compiler/Facilities/TextLayoutRender.fs +++ b/src/Compiler/Facilities/TextLayoutRender.fs @@ -63,6 +63,7 @@ module WordL = let leftAngle = wordL TaggedText.leftAngle let keywordModule = wordL TaggedText.keywordModule let keywordNamespace = wordL TaggedText.keywordNamespace + let keywordReturn = wordL TaggedText.keywordReturn module LeftL = let leftParen = leftL TaggedText.leftParen diff --git a/src/Compiler/Facilities/TextLayoutRender.fsi b/src/Compiler/Facilities/TextLayoutRender.fsi index 0e52b9998f2..96d4b13a184 100644 --- a/src/Compiler/Facilities/TextLayoutRender.fsi +++ b/src/Compiler/Facilities/TextLayoutRender.fsi @@ -102,6 +102,7 @@ module internal WordL = val leftAngle: Layout val keywordModule: Layout val keywordNamespace: Layout + val keywordReturn: Layout module internal LeftL = val leftParen: Layout diff --git a/src/Compiler/Facilities/prim-lexing.fs b/src/Compiler/Facilities/prim-lexing.fs index 6b927ef4a96..d1b965f100f 100644 --- a/src/Compiler/Facilities/prim-lexing.fs +++ b/src/Compiler/Facilities/prim-lexing.fs @@ -49,7 +49,7 @@ type StringText(str: string) = let mutable line = reader.ReadLine() while not (isNull line) do - yield line + yield !!line line <- reader.ReadLine() if str.EndsWith("\n", StringComparison.Ordinal) then @@ -155,7 +155,9 @@ type StringText(str: string) = sb.Append(lastLine.Substring(0, range.EndColumn)).ToString() member _.GetChecksum() = - str |> Md5Hasher.hashString |> ImmutableArray.Create + str + |> Md5Hasher.hashString + |> fun byteArray -> ImmutableArray.Create(byteArray, 0, byteArray.Length) module SourceText = @@ -190,7 +192,9 @@ module SourceTextNew = member _.GetChecksum() = // TODO: something better... - sourceText.ToString() |> Md5Hasher.hashString |> ImmutableArray.Create + !! sourceText.ToString() + |> Md5Hasher.hashString + |> fun byteArray -> ImmutableArray.Create(byteArray, 0, byteArray.Length) } // NOTE: the code in this file is a drop-in replacement runtime for Lexing.fs from the FsLexYacc repository diff --git a/src/Compiler/Interactive/ControlledExecution.fs b/src/Compiler/Interactive/ControlledExecution.fs index 24f2dcb2ae6..2d696344b58 100644 --- a/src/Compiler/Interactive/ControlledExecution.fs +++ b/src/Compiler/Interactive/ControlledExecution.fs @@ -13,6 +13,7 @@ open System.Reflection open System.Threading open Internal.Utilities.FSharpEnvironment +open Internal.Utilities.Library open Unchecked @@ -24,21 +25,20 @@ type internal ControlledExecution(isInteractive: bool) = static let ceType: Type option = Option.ofObj (Type.GetType("System.Runtime.ControlledExecution, System.Private.CoreLib", false)) - static let threadType: Type option = Option.ofObj (typeof) + static let threadType: Type option = typeof |> Option.ofObj static let ceRun: MethodInfo option = match ceType with | None -> None | Some t -> - Option.ofObj ( - t.GetMethod( - "Run", - BindingFlags.Static ||| BindingFlags.Public, - defaultof, - [| typeof; typeof |], - [||] - ) + t.GetMethod( + "Run", + BindingFlags.Static ||| BindingFlags.Public, + defaultof, + [| typeof; typeof |], + [||] ) + |> Option.ofObj static let threadResetAbort: MethodInfo option = match isRunningOnCoreClr, threadType with @@ -67,6 +67,8 @@ type internal ControlledExecution(isInteractive: bool) = static member StripTargetInvocationException(exn: Exception) = match exn with - | :? TargetInvocationException as e when not (isNull e.InnerException) -> - ControlledExecution.StripTargetInvocationException(e.InnerException) + | :? TargetInvocationException as e -> + match e.InnerException with + | null -> exn + | innerEx -> ControlledExecution.StripTargetInvocationException(innerEx) | _ -> exn diff --git a/src/Compiler/Interactive/FSharpInteractiveServer.fs b/src/Compiler/Interactive/FSharpInteractiveServer.fs index 9c66f2df2c5..557a1170e55 100644 --- a/src/Compiler/Interactive/FSharpInteractiveServer.fs +++ b/src/Compiler/Interactive/FSharpInteractiveServer.fs @@ -10,10 +10,10 @@ open System.Threading module CtrlBreakHandlers = - let interuptCommand = "Interactive-CtrlCNotificationCommand-Interupt" + let interruptCommand = "Interactive-CtrlCNotificationCommand-Interrupt" - let lineInteruptCommand = - Encoding.UTF8.GetBytes(interuptCommand + Environment.NewLine) + let lineInterruptCommand = + Encoding.UTF8.GetBytes(interruptCommand + Environment.NewLine) let connectionTimeout = 1000 @@ -35,7 +35,7 @@ module CtrlBreakHandlers = while not (stream.EndOfStream) do let line = stream.ReadLine() - if line = interuptCommand then + if line = interruptCommand then this.Interrupt() finally stream.Close() @@ -56,7 +56,7 @@ module CtrlBreakHandlers = with _ -> () - client.Write(lineInteruptCommand, 0, lineInteruptCommand.Length) + client.Write(lineInterruptCommand, 0, lineInterruptCommand.Length) client.Flush() interface IDisposable with diff --git a/src/Compiler/Interactive/fsi.fs b/src/Compiler/Interactive/fsi.fs index 1e560e70bdd..832327656d9 100644 --- a/src/Compiler/Interactive/fsi.fs +++ b/src/Compiler/Interactive/fsi.fs @@ -71,6 +71,7 @@ open FSharp.Compiler.Tokenization open FSharp.Compiler.TypedTree open FSharp.Compiler.TypedTreeOps open FSharp.Compiler.BuildGraph +open FSharp.Compiler.CheckExpressionsOps //---------------------------------------------------------------------------- // For the FSI as a service methods... @@ -373,7 +374,7 @@ type ILMultiInMemoryAssemblyEmitEnv let typT = convTypeRef tref let tyargs = List.map convTypeAux tspec.GenericArgs - let res = + let res: Type MaybeNull = match isNil tyargs, typT.IsGenericType with | _, true -> typT.MakeGenericType(List.toArray tyargs) | true, false -> typT @@ -388,7 +389,7 @@ type ILMultiInMemoryAssemblyEmitEnv and convTypeAux ty = match ty with - | ILType.Void -> Type.GetType("System.Void") + | ILType.Void -> !! Type.GetType("System.Void") | ILType.Array(shape, eltType) -> let baseT = convTypeAux eltType @@ -396,8 +397,8 @@ type ILMultiInMemoryAssemblyEmitEnv baseT.MakeArrayType() else baseT.MakeArrayType shape.Rank - | ILType.Value tspec -> convTypeSpec tspec - | ILType.Boxed tspec -> convTypeSpec tspec + | ILType.Value tspec -> !!(convTypeSpec tspec) + | ILType.Boxed tspec -> !!(convTypeSpec tspec) | ILType.Ptr eltType -> let baseT = convTypeAux eltType baseT.MakePointerType() @@ -435,7 +436,7 @@ type ILMultiInMemoryAssemblyEmitEnv let ltref = mkRefForNestedILTypeDef ILScopeRef.Local (enc, tdef) let tref = mkRefForNestedILTypeDef ilScopeRef (enc, tdef) let key = tref.BasicQualifiedName - let typ = asm.GetType(key) + let typ = !! asm.GetType(key) //printfn "Adding %s --> %s" key typ.FullName let rtref = rescopeILTypeRef dynamicCcuScopeRef tref typeMap.Add(ltref, (typ, tref)) @@ -510,7 +511,7 @@ type FsiEvaluationSessionHostConfig() = abstract FloatingPointFormat: string /// Called by the evaluation session to ask the host for parameters to format text for output - abstract AddedPrinters: Choice string), Type * (obj -> obj)> list + abstract AddedPrinters: Choice string), Type * (objnull -> objnull)> list /// Called by the evaluation session to ask the host for parameters to format text for output abstract ShowDeclarationValues: bool @@ -587,7 +588,7 @@ type FsiEvaluationSessionHostConfig() = type internal FsiValuePrinter(fsi: FsiEvaluationSessionHostConfig, outWriter: TextWriter) = /// This printer is used by F# Interactive if no other printers apply. - let DefaultPrintingIntercept (ienv: IEnvironment) (obj: obj) = + let DefaultPrintingIntercept (ienv: IEnvironment) (obj: objnull) = match obj with | null -> None | :? System.Collections.IDictionary as ie -> @@ -629,10 +630,10 @@ type internal FsiValuePrinter(fsi: FsiEvaluationSessionHostConfig, outWriter: Te match x with | Choice1Of2(aty: Type, printer) -> yield - (fun _ienv (obj: obj) -> + (fun _ienv (obj: objnull) -> match obj with | null -> None - | _ when aty.IsAssignableFrom(obj.GetType()) -> + | obj when aty.IsAssignableFrom(obj.GetType()) -> let text = printer obj match box text with @@ -642,10 +643,10 @@ type internal FsiValuePrinter(fsi: FsiEvaluationSessionHostConfig, outWriter: Te | Choice2Of2(aty: Type, converter) -> yield - (fun ienv (obj: obj) -> + (fun ienv (obj: objnull) -> match obj with | null -> None - | _ when aty.IsAssignableFrom(obj.GetType()) -> + | obj when aty.IsAssignableFrom(obj.GetType()) -> match converter obj with | null -> None | res -> Some(ienv.GetLayout res) @@ -937,8 +938,8 @@ let internal directoryName (s: string) = "." else match Path.GetDirectoryName s with - | null -> if FileSystem.IsPathRootedShim s then s else "." - | res -> if String.IsNullOrEmpty(res) then "." else res + | Null -> if FileSystem.IsPathRootedShim s then s else "." + | NonNull res -> if String.IsNullOrEmpty(res) then "." else res //---------------------------------------------------------------------------- // cmd line - state for options @@ -975,10 +976,11 @@ type internal FsiCommandLineOptions(fsi: FsiEvaluationSessionHostConfig, argv: s let executableFileNameWithoutExtension = lazy let getFsiCommandLine () = - let fileNameWithoutExtension path = Path.GetFileNameWithoutExtension(path) + let fileNameWithoutExtension (path: string MaybeNull) = Path.GetFileNameWithoutExtension(path) let currentProcess = Process.GetCurrentProcess() - let processFileName = fileNameWithoutExtension currentProcess.MainModule.FileName + let mainModule = currentProcess.MainModule + let processFileName = fileNameWithoutExtension (mainModule ^ _.FileName) let commandLineExecutableFileName = try @@ -993,7 +995,7 @@ type internal FsiCommandLineOptions(fsi: FsiEvaluationSessionHostConfig, argv: s | _ -> StringComparison.OrdinalIgnoreCase if String.Compare(processFileName, commandLineExecutableFileName, stringComparison) = 0 then - processFileName + !!processFileName else sprintf "%s %s" processFileName commandLineExecutableFileName @@ -1529,7 +1531,7 @@ let ConvReflectionTypeToILTypeRef (reflectionTy: Type) = let aref = ILAssemblyRef.FromAssemblyName(reflectionTy.Assembly.GetName()) let scoref = ILScopeRef.Assembly aref - let fullName = reflectionTy.FullName + let fullName = reflectionTy.FullName |> nullArgCheck "reflectionTy.FullName" let index = fullName.IndexOfOrdinal("[") let fullName = @@ -1563,15 +1565,15 @@ let rec ConvReflectionTypeToILType (reflectionTy: Type) = if ctors.Length = 1 - && (not (isNull (ctors[0].GetCustomAttribute()))) + && not (isNull (box (ctors[0].GetCustomAttribute()))) && not ctors[0].IsPublic && IsCompilerGeneratedName reflectionTy.Name then let rec get (typ: Type) = - if FSharp.Reflection.FSharpType.IsFunction typ.BaseType then - get typ.BaseType - else - typ + match typ.BaseType with + | null -> typ + | baseTyp when FSharp.Reflection.FSharpType.IsFunction baseTyp -> get baseTyp + | _ -> typ get reflectionTy else @@ -1581,7 +1583,7 @@ let rec ConvReflectionTypeToILType (reflectionTy: Type) = let elementOrItemTref = if reflectionTy.HasElementType then - reflectionTy.GetElementType() + !! reflectionTy.GetElementType() else reflectionTy |> ConvReflectionTypeToILTypeRef @@ -1674,7 +1676,7 @@ let internal mkBoundValueTypedImpl tcGlobals m moduleName name ty = entity, v, CheckedImplFile.CheckedImplFile(qname, [], mty, contents, false, false, StampMap.Empty, Map.empty) let scriptingSymbolsPath = - let createDirectory path = + let createDirectory (path: string) = lazy try if not (Directory.Exists(path)) then @@ -1861,7 +1863,12 @@ type internal FsiDynamicCompiler let asm = match opts.pdbfile, pdbBytes with - | (Some pdbfile), (Some pdbBytes) -> File.WriteAllBytes(pdbfile, pdbBytes) + | (Some pdbfile), (Some pdbBytes) -> + File.WriteAllBytes(pdbfile, pdbBytes) +#if FOR_TESTING + Directory.CreateDirectory(scriptingSymbolsPath.Value) |> ignore + File.WriteAllBytes(Path.ChangeExtension(pdbfile, ".dll"), assemblyBytes) +#endif | _ -> () match pdbBytes with @@ -1900,7 +1907,7 @@ type internal FsiDynamicCompiler if edef.ArgCount = 0 then yield (fun () -> - let typ = asm.GetType(edef.DeclaringTypeRef.BasicQualifiedName) + let typ = !! asm.GetType(edef.DeclaringTypeRef.BasicQualifiedName) try ignore ( @@ -1918,8 +1925,8 @@ type internal FsiDynamicCompiler ) None - with :? TargetInvocationException as e -> - Some e.InnerException) + with :? TargetInvocationException as e when isNotNull e.InnerException -> + Some !!e.InnerException) ] emEnv.AddModuleDef asm ilScopeRef ilxMainModule @@ -2306,7 +2313,7 @@ type internal FsiDynamicCompiler istate.tcState.TcEnvFromImpls.DisplayEnv, symbol, [], - ItemOccurence.Binding, + ItemOccurrence.Binding, v.DeclarationLocation ) @@ -2321,7 +2328,7 @@ type internal FsiDynamicCompiler istate.tcState.TcEnvFromImpls.DisplayEnv, symbol, [], - ItemOccurence.Binding, + ItemOccurrence.Binding, e.DeclarationLocation ) @@ -2412,7 +2419,7 @@ type internal FsiDynamicCompiler member _.DynamicAssemblies = dynamicAssemblies.ToArray() member _.FindDynamicAssembly(name, useFullName: bool) = - let getName (assemblyName: AssemblyName) = + let getName (assemblyName: AssemblyName) : string MaybeNull = if useFullName then assemblyName.FullName else @@ -2614,7 +2621,7 @@ type internal FsiDynamicCompiler /// Process any delayed assembly additions. member _.ProcessDelayedReferences(ctok, istate) = - // Grab the dealyed assembly reference additions + // Grab the delayed assembly reference additions let refs = delayedReferences |> Seq.toList delayedReferences.Clear() @@ -2783,13 +2790,13 @@ type internal FsiDynamicCompiler istate // error already reported with _ -> - // An exception occured during processing, so remove the lines causing the error from the package manager list. + // An exception occurred during processing, so remove the lines causing the error from the package manager list. tcConfigB.packageManagerLines <- PackageManagerLine.RemoveUnprocessedLines packageManagerKey tcConfigB.packageManagerLines reraise ()) - member fsiDynamicCompiler.PartiallyProcessReferenceOrPackageIncudePathDirective(ctok, istate, directiveKind, path, show, m) = + member fsiDynamicCompiler.PartiallyProcessReferenceOrPackageIncludePathDirective(ctok, istate, directiveKind, path, show, m) = let dm = fsiOptions.DependencyProvider.TryFindDependencyManagerInPath( tcConfigB.compilerToolPaths, @@ -2837,11 +2844,11 @@ type internal FsiDynamicCompiler st), (fun st (m, path, directive) -> let st, _ = - fsiDynamicCompiler.PartiallyProcessReferenceOrPackageIncudePathDirective(ctok, st, directive, path, false, m) + fsiDynamicCompiler.PartiallyProcessReferenceOrPackageIncludePathDirective(ctok, st, directive, path, false, m) st), (fun _ _ -> ())) - (tcConfigB, input, Path.GetDirectoryName sourceFile, istate)) + (tcConfigB, input, !! Path.GetDirectoryName(sourceFile), istate)) member fsiDynamicCompiler.EvalSourceFiles(ctok, istate, m, sourceFiles, lexResourceManager, diagnosticsLogger: DiagnosticsLogger) = let tcConfig = TcConfig.Create(tcConfigB, validate = false) @@ -2936,11 +2943,9 @@ type internal FsiDynamicCompiler | _ -> None | _ -> None - member _.AddBoundValue(ctok, diagnosticsLogger: DiagnosticsLogger, istate, name: string, value: obj) = + member _.AddBoundValue(ctok, diagnosticsLogger: DiagnosticsLogger, istate, name: string, value: objnull) = try - match value with - | null -> nullArg "value" - | _ -> () + let value = value |> nullArgCheck (nameof value) if String.IsNullOrWhiteSpace name then invalidArg "name" "Name cannot be null or white-space." @@ -3258,7 +3263,7 @@ type internal FsiInterruptController // - The requesting assembly (that is, the assembly that is returned by the ResolveEventArgs.RequestingAssembly property) // was loaded without context. // -// On the coreclr we add an UnmanagedDll Resoution handler to ensure that native dll's can be searched for, +// On the coreclr we add an UnmanagedDll Resolution handler to ensure that native dll's can be searched for, // the desktop version of the Clr does not support this mechanism. // // For information about contexts, see the Assembly.LoadFrom(String) method overload. @@ -3281,7 +3286,7 @@ type internal MagicAssemblyResolution() = fsiDynamicCompiler: FsiDynamicCompiler, fsiConsoleOutput: FsiConsoleOutput, fullAssemName: string - ) = + ) : Assembly MaybeNull = try // Grab the name of the assembly @@ -3437,7 +3442,7 @@ type internal MagicAssemblyResolution() = fsiDynamicCompiler: FsiDynamicCompiler, fsiConsoleOutput: FsiConsoleOutput, fullAssemName: string - ) = + ) : Assembly MaybeNull = //Eliminate recursive calls to Resolve which can happen via our callout to msbuild resolution if MagicAssemblyResolution.resolving then @@ -3526,13 +3531,13 @@ type FsiStdinLexerProvider | NonNull t -> fsiStdinSyphon.Add(t + "\n")) match inputOption with - | Some null + | Some Null | None -> if progress then fprintfn fsiConsoleOutput.Out "End of file from TextReader.ReadLine" 0 - | Some(input: string) -> + | Some(NonNull input) -> let input = input + "\n" if input.Length > len then @@ -3769,13 +3774,13 @@ type FsiInteractionProcessor (parsedHashDirectiveStringArguments [ reference ] tcConfigB.langVersion) |> List.head - fsiDynamicCompiler.PartiallyProcessReferenceOrPackageIncudePathDirective(ctok, istate, Directive.Resolution, path, true, m) + fsiDynamicCompiler.PartiallyProcessReferenceOrPackageIncludePathDirective(ctok, istate, Directive.Resolution, path, true, m) | ParsedHashDirective("i", [ path ], m) -> let path = (parsedHashDirectiveStringArguments [ path ] tcConfigB.langVersion) |> List.head - fsiDynamicCompiler.PartiallyProcessReferenceOrPackageIncudePathDirective(ctok, istate, Directive.Include, path, true, m) + fsiDynamicCompiler.PartiallyProcessReferenceOrPackageIncludePathDirective(ctok, istate, Directive.Include, path, true, m) | ParsedHashDirective("I", [ path ], m) -> let path = @@ -3887,7 +3892,7 @@ type FsiInteractionProcessor warning (Error((FSComp.SR.fsiInvalidDirective (c, String.concat " " arg)), m)) istate, Completed None - /// Most functions return a step status - this decides whether to continue and propogates the + /// Most functions return a step status - this decides whether to continue and propagates the /// last value produced let ProcessStepStatus (istate, cont) lastResult f = match cont with @@ -5057,8 +5062,8 @@ module Settings = let runSignal = new AutoResetEvent(false) let exitSignal = new AutoResetEvent(false) let doneSignal = new AutoResetEvent(false) - let mutable queue = ([]: (unit -> obj) list) - let mutable result = (None: obj option) + let mutable queue = ([]: (unit -> objnull) list) + let mutable result = (None: objnull option) let setSignal (signal: AutoResetEvent) = while not (signal.Set()) do diff --git a/src/Compiler/Interactive/fsi.fsi b/src/Compiler/Interactive/fsi.fsi index 6c1bed8c418..c34a583cdb7 100644 --- a/src/Compiler/Interactive/fsi.fsi +++ b/src/Compiler/Interactive/fsi.fsi @@ -8,6 +8,7 @@ open System.Threading open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.Diagnostics open FSharp.Compiler.Symbols +open Internal.Utilities.Library /// Represents an evaluated F# value [] @@ -62,7 +63,7 @@ type public FsiEvaluationSessionHostConfig = abstract FloatingPointFormat: string /// Called by the evaluation session to ask the host for parameters to format text for output - abstract AddedPrinters: Choice string), Type * (obj -> obj)> list + abstract AddedPrinters: Choice string), Type * (objnull -> objnull)> list /// Called by the evaluation session to ask the host for parameters to format text for output abstract ShowDeclarationValues: bool @@ -396,7 +397,7 @@ module Settings = /// Register a print transformer that controls the output of the interactive session. member AddPrintTransformer: ('T -> obj) -> unit - member internal AddedPrinters: Choice string), Type * (obj -> obj)> list + member internal AddedPrinters: Choice string), Type * (objnull -> objnull)> list /// The command line arguments after ignoring the arguments relevant to the interactive /// environment and replacing the first argument with the name of the last script file, @@ -405,7 +406,7 @@ module Settings = /// returned by System.Environment.GetCommandLineArgs. member CommandLineArgs: string[] with get, set - /// Gets or sets a the current event loop being used to process interactions. + /// Gets or sets the current event loop being used to process interactions. member EventLoop: IEventLoop with get, set /// A default implementation of the 'fsi' object, used by GetDefaultConfiguration(). Note this diff --git a/src/Compiler/Interactive/fsihelp.fs b/src/Compiler/Interactive/fsihelp.fs index 5b06e09e245..eb1efd22ed7 100644 --- a/src/Compiler/Interactive/fsihelp.fs +++ b/src/Compiler/Interactive/fsihelp.fs @@ -7,6 +7,10 @@ open System.Text open System.Reflection open FSharp.Compiler.IO +// 3261 Is the nullness warning. I really tried to properly check all accesses, but the chosen xml API has nulls everywhere and is not a good fit for compiler nullness checking. +// Even basic constructs like `n.Attributes.GetNamedItem("name").Value` have `| null| on every single dot access. +#nowarn "3261" + module Parser = open System.Xml diff --git a/src/Compiler/Interactive/xlf/FSIstrings.txt.cs.xlf b/src/Compiler/Interactive/xlf/FSIstrings.txt.cs.xlf index 9146a0d2aa0..d0484d1aada 100644 --- a/src/Compiler/Interactive/xlf/FSIstrings.txt.cs.xlf +++ b/src/Compiler/Interactive/xlf/FSIstrings.txt.cs.xlf @@ -19,7 +19,7 @@ Display documentation for an identifier, e.g. #help \"List.map\";; - Display documentation for an identifier, e.g. #help \"List.map\";; + Zobrazit dokumentaci k identifikátoru, např. #help \"List.map\";; diff --git a/src/Compiler/Interactive/xlf/FSIstrings.txt.de.xlf b/src/Compiler/Interactive/xlf/FSIstrings.txt.de.xlf index ba8a2a310cb..801c1c8aeb6 100644 --- a/src/Compiler/Interactive/xlf/FSIstrings.txt.de.xlf +++ b/src/Compiler/Interactive/xlf/FSIstrings.txt.de.xlf @@ -19,7 +19,7 @@ Display documentation for an identifier, e.g. #help \"List.map\";; - Display documentation for an identifier, e.g. #help \"List.map\";; + Dokumentation für einen Bezeichner anzeigen, z. B. #help \"List.map\";; diff --git a/src/Compiler/Interactive/xlf/FSIstrings.txt.es.xlf b/src/Compiler/Interactive/xlf/FSIstrings.txt.es.xlf index f499bc3eafa..6ecad43d575 100644 --- a/src/Compiler/Interactive/xlf/FSIstrings.txt.es.xlf +++ b/src/Compiler/Interactive/xlf/FSIstrings.txt.es.xlf @@ -19,7 +19,7 @@ Display documentation for an identifier, e.g. #help \"List.map\";; - Display documentation for an identifier, e.g. #help \"List.map\";; + Mostrar documentación para un identificador, por ejemplo, #help \"List.map\";; diff --git a/src/Compiler/Interactive/xlf/FSIstrings.txt.fr.xlf b/src/Compiler/Interactive/xlf/FSIstrings.txt.fr.xlf index 816e9ff898f..ecddd294a3d 100644 --- a/src/Compiler/Interactive/xlf/FSIstrings.txt.fr.xlf +++ b/src/Compiler/Interactive/xlf/FSIstrings.txt.fr.xlf @@ -19,7 +19,7 @@ Display documentation for an identifier, e.g. #help \"List.map\";; - Display documentation for an identifier, e.g. #help \"List.map\";; + Afficher la documentation pour un identifiant, par ex. #help \"List.map\ » ;; diff --git a/src/Compiler/Interactive/xlf/FSIstrings.txt.it.xlf b/src/Compiler/Interactive/xlf/FSIstrings.txt.it.xlf index 93fa31ffda4..f04cf584c81 100644 --- a/src/Compiler/Interactive/xlf/FSIstrings.txt.it.xlf +++ b/src/Compiler/Interactive/xlf/FSIstrings.txt.it.xlf @@ -19,7 +19,7 @@ Display documentation for an identifier, e.g. #help \"List.map\";; - Display documentation for an identifier, e.g. #help \"List.map\";; + Visualizzare la documentazione per un identificatore, ad esempio #help \"List.map\";; diff --git a/src/Compiler/Interactive/xlf/FSIstrings.txt.ja.xlf b/src/Compiler/Interactive/xlf/FSIstrings.txt.ja.xlf index 316b88cfd0d..5b1d3723135 100644 --- a/src/Compiler/Interactive/xlf/FSIstrings.txt.ja.xlf +++ b/src/Compiler/Interactive/xlf/FSIstrings.txt.ja.xlf @@ -19,7 +19,7 @@ Display documentation for an identifier, e.g. #help \"List.map\";; - Display documentation for an identifier, e.g. #help \"List.map\";; + 識別子のドキュメントを表示する (例:#help \"List.map\";; diff --git a/src/Compiler/Interactive/xlf/FSIstrings.txt.ko.xlf b/src/Compiler/Interactive/xlf/FSIstrings.txt.ko.xlf index e577610033a..b94d2b1c62f 100644 --- a/src/Compiler/Interactive/xlf/FSIstrings.txt.ko.xlf +++ b/src/Compiler/Interactive/xlf/FSIstrings.txt.ko.xlf @@ -19,7 +19,7 @@ Display documentation for an identifier, e.g. #help \"List.map\";; - Display documentation for an identifier, e.g. #help \"List.map\";; + 식별자에 대한 설명서 표시(예: #help \"List.map\";;) diff --git a/src/Compiler/Interactive/xlf/FSIstrings.txt.pl.xlf b/src/Compiler/Interactive/xlf/FSIstrings.txt.pl.xlf index b1b3cd575f0..b4d7026498d 100644 --- a/src/Compiler/Interactive/xlf/FSIstrings.txt.pl.xlf +++ b/src/Compiler/Interactive/xlf/FSIstrings.txt.pl.xlf @@ -19,7 +19,7 @@ Display documentation for an identifier, e.g. #help \"List.map\";; - Display documentation for an identifier, e.g. #help \"List.map\";; + Wyświetl dokumentację identyfikatora, np. #help \"List.map\";; diff --git a/src/Compiler/Interactive/xlf/FSIstrings.txt.pt-BR.xlf b/src/Compiler/Interactive/xlf/FSIstrings.txt.pt-BR.xlf index d6607b63a13..f748ba1be27 100644 --- a/src/Compiler/Interactive/xlf/FSIstrings.txt.pt-BR.xlf +++ b/src/Compiler/Interactive/xlf/FSIstrings.txt.pt-BR.xlf @@ -19,7 +19,7 @@ Display documentation for an identifier, e.g. #help \"List.map\";; - Display documentation for an identifier, e.g. #help \"List.map\";; + Exibir documentação para um identificador, por exemplo, #help \"List.map\";; diff --git a/src/Compiler/Interactive/xlf/FSIstrings.txt.ru.xlf b/src/Compiler/Interactive/xlf/FSIstrings.txt.ru.xlf index 62ba1c091a2..9b1c172ae5c 100644 --- a/src/Compiler/Interactive/xlf/FSIstrings.txt.ru.xlf +++ b/src/Compiler/Interactive/xlf/FSIstrings.txt.ru.xlf @@ -19,7 +19,7 @@ Display documentation for an identifier, e.g. #help \"List.map\";; - Display documentation for an identifier, e.g. #help \"List.map\";; + Отобразить документацию для идентификатора, например #help \"List.map\";; diff --git a/src/Compiler/Interactive/xlf/FSIstrings.txt.tr.xlf b/src/Compiler/Interactive/xlf/FSIstrings.txt.tr.xlf index d1d67300f2c..2d2cac17955 100644 --- a/src/Compiler/Interactive/xlf/FSIstrings.txt.tr.xlf +++ b/src/Compiler/Interactive/xlf/FSIstrings.txt.tr.xlf @@ -19,7 +19,7 @@ Display documentation for an identifier, e.g. #help \"List.map\";; - Display documentation for an identifier, e.g. #help \"List.map\";; + Tanımlayıcı ile ilgili belgeleri görüntüle, ör. #help \"List.map\";; diff --git a/src/Compiler/Interactive/xlf/FSIstrings.txt.zh-Hans.xlf b/src/Compiler/Interactive/xlf/FSIstrings.txt.zh-Hans.xlf index 1657fe4f304..b6615ef7514 100644 --- a/src/Compiler/Interactive/xlf/FSIstrings.txt.zh-Hans.xlf +++ b/src/Compiler/Interactive/xlf/FSIstrings.txt.zh-Hans.xlf @@ -19,7 +19,7 @@ Display documentation for an identifier, e.g. #help \"List.map\";; - Display documentation for an identifier, e.g. #help \"List.map\";; + 显示标识符的文档,例如#help \"List.map\";; diff --git a/src/Compiler/Interactive/xlf/FSIstrings.txt.zh-Hant.xlf b/src/Compiler/Interactive/xlf/FSIstrings.txt.zh-Hant.xlf index 0950c95bcee..c49b8a171a9 100644 --- a/src/Compiler/Interactive/xlf/FSIstrings.txt.zh-Hant.xlf +++ b/src/Compiler/Interactive/xlf/FSIstrings.txt.zh-Hant.xlf @@ -19,7 +19,7 @@ Display documentation for an identifier, e.g. #help \"List.map\";; - Display documentation for an identifier, e.g. #help \"List.map\";; + 顯示識別碼的文件,例如#help \"List.map\";; diff --git a/src/Compiler/Legacy/LegacyHostedCompilerForTesting.fs b/src/Compiler/Legacy/LegacyHostedCompilerForTesting.fs index 688b53643c3..a3885384b73 100644 --- a/src/Compiler/Legacy/LegacyHostedCompilerForTesting.fs +++ b/src/Compiler/Legacy/LegacyHostedCompilerForTesting.fs @@ -187,32 +187,34 @@ type internal FscCompiler(legacyReferenceResolver) = let regex = Regex(@"^(/|--)test:ErrorRanges$", RegexOptions.Compiled ||| RegexOptions.IgnoreCase) - fun arg -> regex.IsMatch(arg) + fun (arg: string) -> regex.IsMatch(arg) /// test if --vserrors flag is set let vsErrorsArg = let regex = Regex(@"^(/|--)vserrors$", RegexOptions.Compiled ||| RegexOptions.IgnoreCase) - fun arg -> regex.IsMatch(arg) + fun (arg: string) -> regex.IsMatch(arg) /// test if an arg is a path to fsc.exe let fscExeArg = let regex = Regex(@"fsc(\.exe)?$", RegexOptions.Compiled ||| RegexOptions.IgnoreCase) - fun arg -> regex.IsMatch(arg) + fun (arg: string) -> regex.IsMatch(arg) /// do compilation as if args was argv to fsc.exe member _.Compile(args: string[]) = // args.[0] is later discarded, assuming it is just the path to fsc. // compensate for this in case caller didn't know let args = - match args with - | [||] + match box args with | null -> [| "fsc" |] - | a when not <| fscExeArg a[0] -> Array.append [| "fsc" |] a - | _ -> args + | _ -> + match args with + | [||] -> [| "fsc" |] + | a when not <| fscExeArg a[0] -> Array.append [| "fsc" |] a + | _ -> args let errorRanges = args |> Seq.exists errorRangesArg let vsErrors = args |> Seq.exists vsErrorsArg diff --git a/src/Compiler/Optimize/DetupleArgs.fs b/src/Compiler/Optimize/DetupleArgs.fs index a1655bafb0b..f4521fa0e09 100644 --- a/src/Compiler/Optimize/DetupleArgs.fs +++ b/src/Compiler/Optimize/DetupleArgs.fs @@ -41,7 +41,7 @@ let DetupleRewriteStackGuardDepth = StackGuard.GetDepthOption "DetupleRewrite" // A1: If the function called only wants the fields of the tuple. // A2: If all call sites allocate a tuple argument, // then can factor that tuple creation into the function, -// and hope the optimiser will eliminate it if possible. +// and hope the optimizer will eliminate it if possible. // e.g. if only the fields are required. // // The COLLAPSE transform is based on answer A2... @@ -149,7 +149,7 @@ let DetupleRewriteStackGuardDepth = StackGuard.GetDepthOption "DetupleRewrite" // in these new cases, take care to have let binding sequence (eval order...) -// Merge a tyapp node and and app node. +// Merge a tyapp node and app node. [] let (|TyappAndApp|_|) e = match e with @@ -721,7 +721,7 @@ type penv = ccu: CcuThunk g: TcGlobals } -let hasTransfrom penv f = Zmap.tryFind f penv.transforms +let hasTransform penv f = Zmap.tryFind f penv.transforms //------------------------------------------------------------------------- // pass - app fixup - collapseArgs @@ -828,7 +828,7 @@ let fixupApp (penv: penv) (fx, fty, tys, args, m) = | Expr.Val(vref, _, vm) -> let f = vref.Deref - match hasTransfrom penv f with + match hasTransform penv f with | Some trans -> // fix it let callPattern = trans.transformCallPattern @@ -882,7 +882,7 @@ let passBind penv (TBind(fOrig, repr, letSeqPtOpt) as bind) = let g = penv.g let m = fOrig.Range - match hasTransfrom penv fOrig with + match hasTransform penv fOrig with | None -> // fOrig no transform bind diff --git a/src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs b/src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs index 291e24fe6e9..f03db8f5e6f 100644 --- a/src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs +++ b/src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs @@ -296,7 +296,7 @@ module Pass1_DetermineTLRAndArities = // so better not have env(h) in env(f)!!!]. -/// The subset of ids from a mutal binding that are chosen to be TLR. +/// The subset of ids from a mutual binding that are chosen to be TLR. /// They share a common env. /// [Each fclass has an env, the fclass are the handles to envs.] type BindingGroupSharingSameReqdItems(bindings: Bindings) = @@ -724,7 +724,7 @@ let FlatEnvPacks g fclassM topValS declist (reqdItemsMap: Zmap I_ldelem_any (ILArrayShape.SingleDimensional, ilTy)) srcIlTy - let stelem = mkIlInstr g I_stelem (fun ilTy -> I_stelem_any (ILArrayShape.SingleDimensional, ilTy)) destIlTy - - let mapping = - mkCompGenLetIn m (nameof array) arrayTy array (fun (_, array) -> - mkCompGenLetMutableIn mFor "i" g.int32_ty (mkTypedZero g mIn g.int32_ty) (fun (iVal, i) -> - let body = - // Rebind the loop val to pull directly from the source array. - let body = mkInvisibleLet mBody loopVal (mkAsmExpr ([ldelem], [], [srcArray; i], [loopVal.val_type], mBody)) body - - // destArray[i] <- body srcArray[i] - let setArrSubI = mkAsmExpr ([stelem], [], [array; i; body], [], mIn) - - // i <- i + 1 - let incrI = mkValSet mIn (mkLocalValRef iVal) (mkAsmExpr ([AI_add], [], [i; mkTypedOne g mIn g.int32_ty], [g.int32_ty], mIn)) - - mkSequential mIn setArrSubI incrI - - let guard = mkILAsmClt g mFor i (mkLdlen g mFor array) + let mkMap g m (mBody, _spFor, _spIn, mFor, mIn, spInWhile) srcArray srcIlTy destIlTy overallElemTy (loopVal: Val) body = + mkCompGenLetIn m (nameof srcArray) (tyOfExpr g srcArray) srcArray (fun (_, srcArray) -> + let len = mkLdlen g mIn srcArray + let arrayTy = mkArrayType g overallElemTy + + /// (# "newarr !0" type ('T) count : 'T array #) + let array = + mkAsmExpr + ( + [I_newarr (ILArrayShape.SingleDimensional, destIlTy)], + [], + [len], + [arrayTy], + m + ) - let loop = - mkWhile - g - ( - spInWhile, - NoSpecialWhileLoopMarker, - guard, - body, - mIn - ) + let ldelem = mkIlInstr g I_ldelem (fun ilTy -> I_ldelem_any (ILArrayShape.SingleDimensional, ilTy)) srcIlTy + let stelem = mkIlInstr g I_stelem (fun ilTy -> I_stelem_any (ILArrayShape.SingleDimensional, ilTy)) destIlTy - // while i < array.Length do done - // array - mkSequential m loop array + let mapping = + mkCompGenLetIn m (nameof array) arrayTy array (fun (_, array) -> + mkCompGenLetMutableIn mFor "i" g.int32_ty (mkTypedZero g mIn g.int32_ty) (fun (iVal, i) -> + let body = + // If the loop val is used in the loop body, + // rebind it to pull directly from the source array. + // Otherwise, don't bother reading from the source array at all. + let body = + let freeLocals = (freeInExpr CollectLocals body).FreeLocals + + if freeLocals.Contains loopVal then + mkInvisibleLet mBody loopVal (mkAsmExpr ([ldelem], [], [srcArray; i], [loopVal.val_type], mBody)) body + else + body + + // destArray[i] <- body srcArray[i] + let setArrSubI = mkAsmExpr ([stelem], [], [array; i; body], [], mIn) + + // i <- i + 1 + let incrI = mkValSet mIn (mkLocalValRef iVal) (mkAsmExpr ([AI_add], [], [i; mkTypedOne g mIn g.int32_ty], [g.int32_ty], mIn)) + + mkSequential mIn setArrSubI incrI + + let guard = mkILAsmClt g mFor i (mkLdlen g mFor array) + + let loop = + mkWhile + g + ( + spInWhile, + NoSpecialWhileLoopMarker, + guard, + body, + mIn + ) + + // while i < array.Length do done + // array + mkSequential m loop array + ) ) - ) - // Add a debug point at the `for`, before anything gets evaluated. - Expr.DebugPoint (DebugPointAtLeafExpr.Yes mFor, mapping) + // Add a debug point at the `for`, before anything gets evaluated. + Expr.DebugPoint (DebugPointAtLeafExpr.Yes mFor, mapping) + ) /// Whether to check for overflow when converting a value to a native int. [] @@ -524,22 +534,49 @@ module Array = ) ) -/// f (); …; Seq.singleton x +/// Matches Seq.singleton and returns the body expression. +[] +let (|SeqSingleton|_|) g expr : Expr voption = + match expr with + | ValApp g g.seq_singleton_vref (_, [body], _) -> ValueSome body + | _ -> ValueNone + +/// Matches the compiled representation of the mapping in +/// +/// for … in … do f (); …; yield … +/// for … in … do let … = … in yield … +/// for … in … do f (); …; … +/// for … in … do let … = … in … /// -/// E.g., in [for x in … do f (); …; yield x] +/// i.e., +/// +/// f (); …; Seq.singleton … +/// let … = … in Seq.singleton … [] -let (|SimpleSequential|_|) g expr : Expr voption = +let (|SingleYield|_|) g expr : Expr voption = let rec loop expr cont = match expr with - | Expr.Sequential (expr1, DebugPoints (ValApp g g.seq_singleton_vref (_, [body], _), debug), kind, m) -> - ValueSome (cont (expr1, debug body, kind, m)) + | Expr.Let (binding, DebugPoints (SeqSingleton g body, debug), m, frees) -> + ValueSome (cont (Expr.Let (binding, debug body, m, frees))) + + | Expr.Let (binding, DebugPoints (body, debug), m, frees) -> + loop body (cont << fun body -> Expr.Let (binding, debug body, m, frees)) + + | Expr.Sequential (expr1, DebugPoints (SeqSingleton g body, debug), kind, m) -> + ValueSome (cont (Expr.Sequential (expr1, debug body, kind, m))) | Expr.Sequential (expr1, DebugPoints (body, debug), kind, m) -> - loop body (cont >> fun body -> Expr.Sequential (expr1, debug body, kind, m)) + loop body (cont << fun body -> Expr.Sequential (expr1, debug body, kind, m)) + + | Expr.Match (debugPoint, mInput, decision, [|TTarget (boundVals, DebugPoints (SeqSingleton g body, debug), isStateVarFlags)|], mFull, exprType) -> + ValueSome (cont (Expr.Match (debugPoint, mInput, decision, [|TTarget (boundVals, debug body, isStateVarFlags)|], mFull, exprType))) + + | SeqSingleton g body -> + ValueSome (cont body) | _ -> ValueNone - loop expr Expr.Sequential + loop expr id /// Extracts any let-bindings or sequential /// expressions that directly precede the specified mapping application, e.g., @@ -573,11 +610,9 @@ let gatherPrelude ((|App|_|) : _ -> _ voption) expr = /// The representation used for /// -/// for … in … -> … -/// -/// and -/// -/// for … in … do yield … +/// for … in … -> … +/// for … in … do yield … +/// for … in … do … [] let (|SeqMap|_|) g = gatherPrelude (function @@ -592,30 +627,41 @@ let (|SeqMap|_|) g = /// The representation used for /// -/// for … in … do f (); …; yield … +/// for … in … do f (); …; yield … +/// for … in … do let … = … in yield … +/// for … in … do f (); …; … +/// for … in … do let … = … in … [] let (|SeqCollectSingle|_|) g = gatherPrelude (function - | ValApp g g.seq_collect_vref ([ty1; _; ty2], [Expr.Lambda (valParams = [loopVal]; bodyExpr = SimpleSequential g body; range = mIn) as mapping; input], mFor) -> + | ValApp g g.seq_collect_vref ([ty1; _; ty2], [Expr.Lambda (valParams = [loopVal]; bodyExpr = DebugPoints (SingleYield g body, debug); range = mIn) as mapping; input], mFor) -> let spIn = match mIn.NotedSourceConstruct with NotedSourceConstruct.InOrTo -> DebugPointAtInOrTo.Yes mIn | _ -> DebugPointAtInOrTo.No let spFor = DebugPointAtBinding.Yes mFor let spInWhile = match spIn with DebugPointAtInOrTo.Yes m -> DebugPointAtWhile.Yes m | DebugPointAtInOrTo.No -> DebugPointAtWhile.No let ranges = body.Range, spFor, spIn, mFor, mIn, spInWhile - ValueSome (ty1, ty2, input, mapping, loopVal, body, ranges) + ValueSome (ty1, ty2, input, mapping, loopVal, debug body, ranges) | _ -> ValueNone) /// for … in … -> … /// for … in … do yield … +/// for … in … do … /// for … in … do f (); …; yield … +/// for … in … do let … = … in yield … +/// for … in … do f (); …; … +/// for … in … do let … = … in … [] let (|SimpleMapping|_|) g expr = match expr with // for … in … -> … // for … in … do yield … + // for … in … do … | ValApp g g.seq_delay_vref (_, [Expr.Lambda (bodyExpr = DebugPoints (SeqMap g (cont, (ty1, ty2, input, mapping, loopVal, body, ranges)), debug))], _) // for … in … do f (); …; yield … + // for … in … do let … = … in yield … + // for … in … do f (); …; … + // for … in … do let … = … in … | ValApp g g.seq_delay_vref (_, [Expr.Lambda (bodyExpr = DebugPoints (SeqCollectSingle g (cont, (ty1, ty2, input, mapping, loopVal, body, ranges)), debug))], _) -> ValueSome (debug >> cont, (ty1, ty2, input, mapping, loopVal, body, ranges)) @@ -640,7 +686,7 @@ let LowerComputedListOrArrayExpr tcVal (g: TcGlobals) amap ilTyForTy overallExpr match overallSeqExpr with // [for … in xs -> …] (* When xs is a list. *) | SimpleMapping g (cont, (_, _, List g list, _, loopVal, body, ranges)) when - g.langVersion.SupportsFeature LanguageFeature.LowerSimpleMappingsInComprehensionsToDirectCallsToMap + g.langVersion.SupportsFeature LanguageFeature.LowerSimpleMappingsInComprehensionsToFastLoops -> Some (cont (List.mkMap tcVal g amap m ranges list overallElemTy loopVal body)) @@ -669,7 +715,7 @@ let LowerComputedListOrArrayExpr tcVal (g: TcGlobals) amap ilTyForTy overallExpr match overallSeqExpr with // [|for … in xs -> …|] (* When xs is an array. *) | SimpleMapping g (cont, (ty1, ty2, Array g array, _, loopVal, body, ranges)) when - g.langVersion.SupportsFeature LanguageFeature.LowerSimpleMappingsInComprehensionsToDirectCallsToMap + g.langVersion.SupportsFeature LanguageFeature.LowerSimpleMappingsInComprehensionsToFastLoops -> Some (cont (Array.mkMap g m ranges array (ilTyForTy ty1) (ilTyForTy ty2) overallElemTy loopVal body)) diff --git a/src/Compiler/Optimize/LowerSequences.fs b/src/Compiler/Optimize/LowerSequences.fs index 64686d0fe62..df19323cb66 100644 --- a/src/Compiler/Optimize/LowerSequences.fs +++ b/src/Compiler/Optimize/LowerSequences.fs @@ -555,7 +555,7 @@ let ConvertSequenceExprToObject g amap overallExpr = let pc2lab = Map.ofList ((pcInit, initLabel) :: (pcDone, noDisposeContinuationLabel) :: List.zip pcs labs) let lab2pc = Map.ofList ((initLabel, pcInit) :: (noDisposeContinuationLabel, pcDone) :: List.zip labs pcs) - // Execute phase2, building the core of the the GenerateNext, Dispose and CheckDispose methods + // Execute phase2, building the core of the GenerateNext, Dispose and CheckDispose methods let generateExprCore, disposalExprCore, checkDisposeExprCore = res.phase2 (pcVarRef, currVarRef, nextVarRef, lab2pc) diff --git a/src/Compiler/Optimize/LowerStateMachines.fs b/src/Compiler/Optimize/LowerStateMachines.fs index 97d212f8854..7a6dd553f65 100644 --- a/src/Compiler/Optimize/LowerStateMachines.fs +++ b/src/Compiler/Optimize/LowerStateMachines.fs @@ -448,7 +448,7 @@ type LowerStateMachine(g: TcGlobals) = let res = match expr with | ResumableCodeInvoke g (_, _, _, m, _) -> - Result.Error (FSComp.SR.reprResumableCodeInvokeNotReduced(m.ToString())) + Result.Error (FSComp.SR.reprResumableCodeInvokeNotReduced(!!m.ToString())) // Eliminate 'if __useResumableCode ...' within. | IfUseResumableStateMachinesExpr g (thenExpr, _) -> diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 52b1dccc558..51d889f5691 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -142,7 +142,7 @@ type ValInfos(entries) = (fun (_: ValRef, k: ValLinkageFullKey) -> hash k.PartialKey) (fun (v1, k1) (v2, k2) -> k1.PartialKey = k2.PartialKey && - // dismbiguate overloads, somewhat low-perf but only use for a handful of overloads in FSharp.Core + // disambiguate overloads, somewhat low-perf but only use for a handful of overloads in FSharp.Core match k1.TypeForLinkage, k2.TypeForLinkage with | Some _, Some _ -> let sig1 = XmlDocSigOfVal g true "" v1.Deref @@ -217,8 +217,8 @@ type Summary<'Info> = TotalSize: int /// Meaning: could mutate, could non-terminate, could raise exception - /// One use: an effect expr can not be eliminated as dead code (e.g. sequencing) - /// One use: an effect=false expr can not throw an exception? so try-with is removed. + /// One use: an effect expr cannot be eliminated as dead code (e.g. sequencing) + /// One use: an effect=false expr cannot throw an exception? so try-with is removed. HasEffect: bool /// Indicates that a function may make a useful tailcall, hence when called should itself be tailcalled @@ -2245,7 +2245,7 @@ let TryDetectQueryQuoteAndRun cenv (expr: Expr) = | QuerySelect g (qTy, _, resultElemTy, _, _) | QueryYield g (qTy, resultElemTy, _) | QueryYieldFrom g (qTy, resultElemTy, _) - when typeEquiv g qTy (mkAppTy g.tcref_System_Collections_IEnumerable []) -> + when typeEquiv g qTy (mkWoNullAppTy g.tcref_System_Collections_IEnumerable []) -> match tryRewriteToSeqCombinators g e with | Some newSource -> @@ -2629,13 +2629,13 @@ and OptimizeExprOpReductionsAfter cenv env (op, tyargs, argsR, arginfos, m) = | TOp.UnionCaseFieldGet (cspec, n), [e1info] -> TryOptimizeUnionCaseGet cenv env (e1info, cspec, tyargs, n, m) | _ -> None match knownValue with - | Some valu -> - match TryOptimizeVal cenv env (None, false, false, valu, m) with + | Some value_ -> + match TryOptimizeVal cenv env (None, false, false, value_, m) with | Some res -> OptimizeExpr cenv env res (* discard e1 since guard ensures it has no effects *) - | None -> OptimizeExprOpFallback cenv env (op, tyargs, argsR, m) arginfos valu + | None -> OptimizeExprOpFallback cenv env (op, tyargs, argsR, m) arginfos value_ | None -> OptimizeExprOpFallback cenv env (op, tyargs, argsR, m) arginfos UnknownValue -and OptimizeExprOpFallback cenv env (op, tyargs, argsR, m) arginfos valu = +and OptimizeExprOpFallback cenv env (op, tyargs, argsR, m) arginfos value_ = let g = cenv.g // The generic case - we may collect information, but the construction/projection doesn't disappear @@ -2644,20 +2644,20 @@ and OptimizeExprOpFallback cenv env (op, tyargs, argsR, m) arginfos valu = let argEffects = OrEffects arginfos let argValues = List.map (fun x -> x.Info) arginfos let effect = OpHasEffect g m op - let cost, valu = + let cost, value_ = match op with | TOp.UnionCase c -> 2, MakeValueInfoForUnionCase c (Array.ofList argValues) - | TOp.ExnConstr _ -> 2, valu + | TOp.ExnConstr _ -> 2, value_ | TOp.Tuple tupInfo -> let isStruct = evalTupInfoIsStruct tupInfo - if isStruct then 0, valu + if isStruct then 0, value_ else 1,MakeValueInfoForTuple (Array.ofList argValues) | TOp.AnonRecd anonInfo -> let isStruct = evalAnonInfoIsStruct anonInfo - if isStruct then 0, valu - else 1, valu + if isStruct then 0, value_ + else 1, value_ | TOp.AnonRecdGet _ | TOp.ValFieldGet _ @@ -2666,41 +2666,41 @@ and OptimizeExprOpFallback cenv env (op, tyargs, argsR, m) arginfos valu = | TOp.ExnFieldGet _ | TOp.UnionCaseTagGet _ -> // REVIEW: reduction possible here, and may be very effective - 1, valu + 1, value_ | TOp.UnionCaseProof _ -> // We count the proof as size 0 // We maintain the value of the source of the proof-cast if it is known to be a UnionCaseValue - let valu = + let value_ = match argValues[0] with | StripUnionCaseValue (uc, info) -> UnionCaseValue(uc, info) - | _ -> valu - 0, valu + | _ -> value_ + 0, value_ | TOp.ILAsm (instrs, retTypes) -> min instrs.Length 1, mkAssemblyCodeValueInfo g instrs argValues retTypes - | TOp.Bytes bytes -> bytes.Length/10, valu - | TOp.UInt16s bytes -> bytes.Length/10, valu + | TOp.Bytes bytes -> bytes.Length/10, value_ + | TOp.UInt16s bytes -> bytes.Length/10, value_ | TOp.ValFieldGetAddr _ | TOp.Array | TOp.IntegerForLoop _ | TOp.While _ | TOp.TryWith _ | TOp.TryFinally _ | TOp.ILCall _ | TOp.TraitCall _ | TOp.LValueOp _ | TOp.ValFieldSet _ | TOp.UnionCaseFieldSet _ | TOp.RefAddrGet _ | TOp.Coerce | TOp.Reraise | TOp.UnionCaseFieldGetAddr _ - | TOp.ExnFieldSet _ -> 1, valu + | TOp.ExnFieldSet _ -> 1, value_ | TOp.Recd (ctorInfo, tcref) -> let finfos = tcref.AllInstanceFieldsAsList // REVIEW: this seems a little conservative: Allocating a record with a mutable field // is not an effect - only reading or writing the field is. - let valu = + let value_ = match ctorInfo with | RecdExprIsObjInit -> UnknownValue | RecdExpr -> - if argValues.Length <> finfos.Length then valu + if argValues.Length <> finfos.Length then value_ else MakeValueInfoForRecord tcref (Array.ofList ((argValues, finfos) ||> List.map2 (fun x f -> if f.IsMutable then UnknownValue else x) )) - 2, valu + 2, value_ | TOp.Goto _ | TOp.Label _ | TOp.Return -> assert false; error(InternalError("unexpected goto/label/return in optimization", m)) // Indirect calls to IL code are always taken as tailcalls @@ -2713,7 +2713,7 @@ and OptimizeExprOpFallback cenv env (op, tyargs, argsR, m) arginfos valu = FunctionSize=argsFSize + cost HasEffect=argEffects || effect MightMakeCriticalTailcall= mayBeCriticalTailcall // discard tailcall info for args - these are not in tailcall position - Info=valu } + Info=value_ } // Replace entire expression with known value? match TryOptimizeValInfo cenv env m vinfo with @@ -2724,7 +2724,7 @@ and OptimizeExprOpFallback cenv env (op, tyargs, argsR, m) arginfos valu = FunctionSize=argsFSize + cost HasEffect=argEffects || effect MightMakeCriticalTailcall= mayBeCriticalTailcall // discard tailcall info for args - these are not in tailcall position - Info=valu } + Info=value_ } /// Optimize/analyze a constant node and OptimizeConst cenv env expr (c, m, ty) = @@ -3137,9 +3137,12 @@ and OptimizeVal cenv env expr (v: ValRef, m) = | None -> if v.ShouldInline then - warning(Error(FSComp.SR.optFailedToInlineValue(v.DisplayName), m)) + match valInfoForVal.ValExprInfo with + | UnknownValue -> error(Error(FSComp.SR.optFailedToInlineValue(v.DisplayName), m)) + | _ -> warning(Error(FSComp.SR.optFailedToInlineValue(v.DisplayName), m)) if v.InlineIfLambda then warning(Error(FSComp.SR.optFailedToInlineSuggestedValue(v.DisplayName), m)) + expr, (AddValEqualityInfo g m v { Info=valInfoForVal.ValExprInfo HasEffect=false @@ -3221,7 +3224,7 @@ and TryDevirtualizeApplication cenv env (f, tyargs, args, m) = // the target takes a tupled argument, so we need to reorder the arg expressions in the // arg list, and create a tuple of y & comp // push the comparer to the end and box the argument - let args2 = [x; mkRefTupledNoTypes g m [mkCoerceExpr(y, g.obj_ty, m, ty) ; comp]] + let args2 = [x; mkRefTupledNoTypes g m [mkCoerceExpr(y, g.obj_ty_ambivalent, m, ty) ; comp]] Some (DevirtualizeApplication cenv env vref ty tyargs args2 m) | _ -> None @@ -3246,7 +3249,7 @@ and TryDevirtualizeApplication cenv env (f, tyargs, args, m) = Some (DevirtualizeApplication cenv env withcEqualsExactVal ty tyargs args2 m) | Some (_, _, withcEqualsVal, _ ), [comp; x; y] -> // push the comparer to the end and box the argument - let args2 = [x; mkRefTupledNoTypes g m [mkCoerceExpr(y, g.obj_ty, m, ty) ; comp]] + let args2 = [x; mkRefTupledNoTypes g m [mkCoerceExpr(y, g.obj_ty_ambivalent, m, ty) ; comp]] Some (DevirtualizeApplication cenv env withcEqualsVal ty tyargs args2 m) | _ -> None @@ -3268,7 +3271,7 @@ and TryDevirtualizeApplication cenv env (f, tyargs, args, m) = let args2 = [x; mkRefTupledNoTypes g m [y; (mkCallGetGenericPEREqualityComparer g m)]] Some (DevirtualizeApplication cenv env equalsExact ty tyargs args2 m) | None -> - let args2 = [x; mkRefTupledNoTypes g m [mkCoerceExpr(y, g.obj_ty, m, ty); (mkCallGetGenericPEREqualityComparer g m)]] + let args2 = [x; mkRefTupledNoTypes g m [mkCoerceExpr(y, g.obj_ty_ambivalent, m, ty); (mkCallGetGenericPEREqualityComparer g m)]] Some (DevirtualizeApplication cenv env withcEqualsVal ty tyargs args2 m) | _ -> None @@ -3851,7 +3854,7 @@ and OptimizeLambdas (vspec: Val option) cenv env valReprInfo expr exprTy = () // can't inline any values with semi-recursive object references to self or base - let valu = + let value_ = match baseValOpt with | None -> CurriedLambdaValue (lambdaId, arities, bsize, exprR, exprTy) | Some baseVal -> @@ -3871,7 +3874,7 @@ and OptimizeLambdas (vspec: Val option) cenv env valReprInfo expr exprTy = FunctionSize=1 HasEffect=false MightMakeCriticalTailcall = false - Info= valu } + Info= value_ } | _ -> OptimizeExpr cenv env expr @@ -3883,15 +3886,15 @@ and OptimizeNewDelegateExpr cenv env (lambdaId, vsl, body, remake) = let arities = vsl.Length let bsize = bodyinfo.TotalSize let exprR = remake bodyR - let valu = CurriedLambdaValue (lambdaId, arities, bsize, exprR, tyOfExpr g exprR) + let value_ = CurriedLambdaValue (lambdaId, arities, bsize, exprR, tyOfExpr g exprR) exprR, { TotalSize=bsize + closureTotalSize (* estimate size of new syntactic closure - expensive, in contrast to a method *) FunctionSize=1 HasEffect=false MightMakeCriticalTailcall = false - Info= valu } + Info= value_ } -/// Recursive calls that first try to make an expression "fit" the a shape +/// Recursive calls that first try to make an expression "fit" the shape /// where it is about to be consumed. and OptimizeExprsThenReshapeAndConsiderSplits cenv env exprs = match exprs with @@ -4345,8 +4348,7 @@ and OptimizeModuleDefs cenv (env, bindInfosColl) defs = let defs, minfos = List.unzip defs (defs, UnionOptimizationInfos minfos), (env, bindInfosColl) -and OptimizeImplFileInternal cenv env isIncrementalFragment fsiMultiAssemblyEmit hidden implFile = - let g = cenv.g +and OptimizeImplFileInternal cenv env isIncrementalFragment hidden implFile = let (CheckedImplFile (qname, pragmas, signature, contents, hasExplicitEntryPoint, isScript, anonRecdTypes, namedDebugPointsForInlinedCode)) = implFile let env, contentsR, minfo, hidden = // FSI compiles interactive fragments as if you're typing incrementally into one module. @@ -4358,13 +4360,7 @@ and OptimizeImplFileInternal cenv env isIncrementalFragment fsiMultiAssemblyEmit // This optimizes and builds minfo ignoring the signature let (defR, minfo), (_env, _bindInfosColl) = OptimizeModuleContents cenv (env, []) contents let hidden = ComputeImplementationHidingInfoAtAssemblyBoundary defR hidden - let minfo = - // In F# interactive multi-assembly mode, no internals are accessible across interactive fragments. - // In F# interactive single-assembly mode, internals are accessible across interactive fragments. - if fsiMultiAssemblyEmit then - AbstractLazyModulInfoByHiding true hidden minfo - else - AbstractLazyModulInfoByHiding false hidden minfo + let minfo = AbstractLazyModulInfoByHiding false hidden minfo let env = BindValsInModuleOrNamespace cenv minfo env env, defR, minfo, hidden else @@ -4372,13 +4368,7 @@ and OptimizeImplFileInternal cenv env isIncrementalFragment fsiMultiAssemblyEmit let mexprR, minfo = OptimizeModuleExprWithSig cenv env signature contents let hidden = ComputeSignatureHidingInfoAtAssemblyBoundary signature hidden let minfoExternal = AbstractLazyModulInfoByHiding true hidden minfo - let env = - // In F# interactive multi-assembly mode, internals are not accessible in the 'env' used intra-assembly - // In regular fsc compilation, internals are accessible in the 'env' used intra-assembly - if g.isInteractive && fsiMultiAssemblyEmit then - BindValsInModuleOrNamespace cenv minfoExternal env - else - BindValsInModuleOrNamespace cenv minfo env + let env = BindValsInModuleOrNamespace cenv minfo env env, mexprR, minfoExternal, hidden let implFileR = CheckedImplFile (qname, pragmas, signature, contentsR, hasExplicitEntryPoint, isScript, anonRecdTypes, namedDebugPointsForInlinedCode) @@ -4386,7 +4376,7 @@ and OptimizeImplFileInternal cenv env isIncrementalFragment fsiMultiAssemblyEmit env, implFileR, minfo, hidden /// Entry point -let OptimizeImplFile (settings, ccu, tcGlobals, tcVal, importMap, optEnv, isIncrementalFragment, fsiMultiAssemblyEmit, emitTailcalls, hidden, mimpls) = +let OptimizeImplFile (settings, ccu, tcGlobals, tcVal, importMap, optEnv, isIncrementalFragment, emitTailcalls, hidden, mimpls) = let cenv = { settings=settings scope=ccu @@ -4401,7 +4391,7 @@ let OptimizeImplFile (settings, ccu, tcGlobals, tcVal, importMap, optEnv, isIncr realsig = tcGlobals.realsig } - let env, _, _, _ as results = OptimizeImplFileInternal cenv optEnv isIncrementalFragment fsiMultiAssemblyEmit hidden mimpls + let env, _, _, _ as results = OptimizeImplFileInternal cenv optEnv isIncrementalFragment hidden mimpls let optimizeDuringCodeGen disableMethodSplitting expr = let env = { env with disableMethodSplitting = env.disableMethodSplitting || disableMethodSplitting } diff --git a/src/Compiler/Optimize/Optimizer.fsi b/src/Compiler/Optimize/Optimizer.fsi index aa205b86221..17912af7598 100644 --- a/src/Compiler/Optimize/Optimizer.fsi +++ b/src/Compiler/Optimize/Optimizer.fsi @@ -85,7 +85,6 @@ val internal OptimizeImplFile: Import.ImportMap * IncrementalOptimizationEnv * isIncrementalFragment: bool * - fsiMultiAssemblyEmit: bool * emitTailcalls: bool * SignatureHidingInfo * CheckedImplFile -> diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index 46ea4bce4f5..6af2b440cc0 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -20,7 +20,7 @@ open FSharp.Compiler open FSharp.Compiler.Syntax open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AccessibilityLogic -open FSharp.Compiler.CheckExpressions +open FSharp.Compiler.CheckExpressionsOps open FSharp.Compiler.CheckDeclarations open FSharp.Compiler.CompilerConfig open FSharp.Compiler.CompilerDiagnostics @@ -203,7 +203,10 @@ module internal FSharpCheckerResultsSettings = // Look for DLLs in the location of the service DLL first. let defaultFSharpBinariesDir = FSharpEnvironment - .BinFolderOfDefaultFSharpCompiler(Some(Path.GetDirectoryName(typeof.Assembly.Location))) + .BinFolderOfDefaultFSharpCompiler( + Path.GetDirectoryName(typeof.Assembly.Location) + |> Option.ofObj + ) .Value [] @@ -221,27 +224,27 @@ type FSharpSymbolUse(denv: DisplayEnv, symbol: FSharpSymbol, inst: TyparInstanti member x.IsDefinition = x.IsFromDefinition - member _.IsFromDefinition = itemOcc = ItemOccurence.Binding + member _.IsFromDefinition = itemOcc = ItemOccurrence.Binding - member _.IsFromPattern = itemOcc = ItemOccurence.Pattern + member _.IsFromPattern = itemOcc = ItemOccurrence.Pattern - member _.IsFromType = itemOcc = ItemOccurence.UseInType + member _.IsFromType = itemOcc = ItemOccurrence.UseInType - member _.IsFromAttribute = itemOcc = ItemOccurence.UseInAttribute + member _.IsFromAttribute = itemOcc = ItemOccurrence.UseInAttribute - member _.IsFromDispatchSlotImplementation = itemOcc = ItemOccurence.Implemented + member _.IsFromDispatchSlotImplementation = itemOcc = ItemOccurrence.Implemented - member _.IsFromUse = itemOcc = ItemOccurence.Use + member _.IsFromUse = itemOcc = ItemOccurrence.Use member _.IsFromComputationExpression = match symbol.Item, itemOcc with // 'seq' in 'seq { ... }' gets colored as keywords - | Item.Value vref, ItemOccurence.Use when valRefEq denv.g denv.g.seq_vref vref -> true + | Item.Value vref, ItemOccurrence.Use when valRefEq denv.g denv.g.seq_vref vref -> true // custom builders, custom operations get colored as keywords - | (Item.CustomBuilder _ | Item.CustomOperation _), ItemOccurence.Use -> true + | (Item.CustomBuilder _ | Item.CustomOperation _), ItemOccurrence.Use -> true | _ -> false - member _.IsFromOpenStatement = itemOcc = ItemOccurence.Open + member _.IsFromOpenStatement = itemOcc = ItemOccurrence.Open member _.FileName = range.FileName @@ -492,7 +495,7 @@ type internal TypeCheckInfo // // If we're looking for members using a residue, we'd expect only // a single item (pick the first one) and we need the residue (which may be "") - | CNR(_, ItemOccurence.InvalidUse, _, _, _, _) :: _, _ -> NameResResult.Empty + | CNR(_, ItemOccurrence.InvalidUse, _, _, _, _) :: _, _ -> NameResResult.Empty | CNR(Item.Types(_, ty :: _), _, denv, nenv, ad, m) :: _, Some _ -> let targets = @@ -518,8 +521,8 @@ type internal TypeCheckInfo // let varA = if b then 0 else varA. // then the expression typings get confused (thinking 'varA:int'), so we use name resolution even for usual values. - | CNR(Item.Value(vref), occurence, denv, nenv, ad, m) :: _, Some _ -> - if occurence = ItemOccurence.Binding || occurence = ItemOccurence.Pattern then + | CNR(Item.Value(vref), occurrence, denv, nenv, ad, m) :: _, Some _ -> + if occurrence = ItemOccurrence.Binding || occurrence = ItemOccurrence.Pattern then // Return empty list to stop further lookup - for value declarations NameResResult.Cancel(denv, m) else @@ -572,13 +575,78 @@ type internal TypeCheckInfo match items, membersByResidue with | CNR(Item.Types(_, ty :: _), _, _, _, _, _) :: _, Some _ -> Some ty - | CNR(Item.Value(vref), occurence, _, _, _, _) :: _, Some _ -> - if (occurence = ItemOccurence.Binding || occurence = ItemOccurence.Pattern) then + | CNR(Item.Value(vref), occurrence, _, _, _, _) :: _, Some _ -> + if (occurrence = ItemOccurrence.Binding || occurrence = ItemOccurrence.Pattern) then None else Some(StripSelfRefCell(g, vref.BaseOrThisInfo, vref.TauType)) | _, _ -> None + /// Build a CompletionItem + let CompletionItemWithMoreSetting + (ty: TyconRef voption) + (assemblySymbol: AssemblySymbol voption) + minorPriority + insertText + displayText + (item: ItemWithInst) + = + let kind = + match item.Item with + | Item.DelegateCtor _ + | Item.CtorGroup _ -> CompletionItemKind.Method false + | Item.MethodGroup(_, minfos, _) -> + match minfos with + | [] -> CompletionItemKind.Method false + | minfo :: _ -> CompletionItemKind.Method minfo.IsExtensionMember + | Item.AnonRecdField _ + | Item.RecdField _ + | Item.UnionCaseField _ + | Item.Property _ -> CompletionItemKind.Property + | Item.Event _ -> CompletionItemKind.Event + | Item.ILField _ + | Item.Value _ -> CompletionItemKind.Field + | Item.CustomOperation _ -> CompletionItemKind.CustomOperation + // These items are not given a completion kind. This could be reviewed + | Item.ActivePatternResult _ + | Item.ExnCase _ + | Item.ImplicitOp _ + | Item.ModuleOrNamespaces _ + | Item.Trait _ + | Item.TypeVar _ + | Item.Types _ + | Item.UnionCase _ + | Item.UnqualifiedType _ + | Item.NewDef _ + | Item.SetterArg _ + | Item.CustomBuilder _ + | Item.OtherName _ + | Item.ActivePatternCase _ -> CompletionItemKind.Other + + let isUnresolved = + match assemblySymbol with + | ValueSome x -> Some x.UnresolvedSymbol + | _ -> None + + let ty = + match ty with + | ValueSome x -> Some x + | _ -> None + + { + ItemWithInst = item + MinorPriority = minorPriority + Kind = kind + IsOwnMember = false + Type = ty + Unresolved = isUnresolved + CustomInsertText = insertText + CustomDisplayText = displayText + } + + let CompletionItem (ty: TyconRef voption) (assemblySymbol: AssemblySymbol voption) (item: ItemWithInst) = + CompletionItemWithMoreSetting ty assemblySymbol 0 ValueNone ValueNone item + let CollectParameters (methods: MethInfo list) amap m : Item list = methods |> List.collect (fun meth -> @@ -898,59 +966,6 @@ type internal TypeCheckInfo if p >= 0 then Some p else None - /// Build a CompetionItem - let CompletionItem (ty: TyconRef voption) (assemblySymbol: AssemblySymbol voption) (item: ItemWithInst) = - let kind = - match item.Item with - | Item.DelegateCtor _ - | Item.CtorGroup _ -> CompletionItemKind.Method false - | Item.MethodGroup(_, minfos, _) -> - match minfos with - | [] -> CompletionItemKind.Method false - | minfo :: _ -> CompletionItemKind.Method minfo.IsExtensionMember - | Item.AnonRecdField _ - | Item.RecdField _ - | Item.UnionCaseField _ - | Item.Property _ -> CompletionItemKind.Property - | Item.Event _ -> CompletionItemKind.Event - | Item.ILField _ - | Item.Value _ -> CompletionItemKind.Field - | Item.CustomOperation _ -> CompletionItemKind.CustomOperation - // These items are not given a completion kind. This could be reviewed - | Item.ActivePatternResult _ - | Item.ExnCase _ - | Item.ImplicitOp _ - | Item.ModuleOrNamespaces _ - | Item.Trait _ - | Item.TypeVar _ - | Item.Types _ - | Item.UnionCase _ - | Item.UnqualifiedType _ - | Item.NewDef _ - | Item.SetterArg _ - | Item.CustomBuilder _ - | Item.OtherName _ - | Item.ActivePatternCase _ -> CompletionItemKind.Other - - let isUnresolved = - match assemblySymbol with - | ValueSome x -> Some x.UnresolvedSymbol - | _ -> None - - let ty = - match ty with - | ValueSome x -> Some x - | _ -> None - - { - ItemWithInst = item - MinorPriority = 0 - Kind = kind - IsOwnMember = false - Type = ty - Unresolved = isUnresolved - } - let DefaultCompletionItem item = CompletionItem ValueNone ValueNone item let CompletionItemSuggestedName displayName = @@ -961,6 +976,8 @@ type internal TypeCheckInfo Kind = CompletionItemKind.SuggestedName IsOwnMember = false Unresolved = None + CustomInsertText = ValueNone + CustomDisplayText = ValueNone } let getItem (x: ItemWithInst) = x.Item @@ -973,7 +990,7 @@ type internal TypeCheckInfo if String.IsNullOrWhiteSpace name then None else - let name = String.lowerCaseFirstChar name + let name = String.lowerCaseFirstChar !!name let unused = sResolutions.CapturedNameResolutions @@ -1045,45 +1062,341 @@ type internal TypeCheckInfo |> Option.defaultValue completions /// Gets all methods that a type can override, but has not yet done so. - let GetOverridableMethods pos typeNameRange = - let isMethodOverridable alreadyOverridden (candidate: MethInfo) = + let GetOverridableMethods pos ctx (typeNameRange: range) spacesBeforeOverrideKeyword hasThis isStatic = + let checkImplementedSlotDeclareType ty slots = + slots + |> Option.map (List.exists (fun (TSlotSig(declaringType = ty2)) -> typeEquiv g ty ty2)) + |> Option.defaultValue false + + let isMethodOverridable superTy alreadyOverridden (candidate: MethInfo) = not candidate.IsFinal && not ( alreadyOverridden - |> List.exists (MethInfosEquivByNameAndSig EraseNone true g amap range0 candidate) + |> ResizeArray.exists (fun i -> + MethInfosEquivByNameAndSig EraseNone true g amap range0 candidate i + && (tyconRefEq g candidate.DeclaringTyconRef i.DeclaringTyconRef + || checkImplementedSlotDeclareType superTy (Option.attempt (fun () -> i.ImplementedSlotSignatures)))) ) + let isMethodOptionOverridable superTy alreadyOverridden candidate = + candidate + |> ValueOption.map (fun i -> isMethodOverridable superTy alreadyOverridden i) + |> ValueOption.defaultValue false + + let isPropertyOverridable superTy alreadyOverridden (candidate: PropInfo) = + if candidate.IsVirtualProperty then + let getterOverridden, setterOverridden = + alreadyOverridden + |> List.filter (fun i -> + PropInfosEquivByNameAndSig EraseNone g amap range0 candidate i + && (tyconRefEq g candidate.DeclaringTyconRef i.DeclaringTyconRef + || checkImplementedSlotDeclareType superTy (Option.attempt (fun () -> i.ImplementedSlotSignatures)))) + |> List.fold + (fun (getterOverridden, setterOverridden) i -> getterOverridden || i.HasGetter, setterOverridden || i.HasSetter) + (false, false) + + not getterOverridden, not setterOverridden + else + false, false + + let rec checkOrGenerateArgName (nameSet: HashSet<_>) name = + let name = if String.IsNullOrEmpty name then "arg" else name + + if nameSet.Add(name) then + name + else + checkOrGenerateArgName nameSet $"{name}_{nameSet.Count}" + let (nenv, ad), m = GetBestEnvForPos pos + let denv = nenv.DisplayEnv - sResolutions.CapturedNameResolutions - |> ResizeArray.tryPick (fun r -> - match r.Item with - | Item.Types(_, ty :: _) when equals r.Range typeNameRange && isAppTy g ty -> - let superTy = - (tcrefOfAppTy g ty).TypeContents.tcaug_super |> Option.defaultValue g.obj_ty + let checkMethAbstractAndGetImplementBody (meth: MethInfo) implementBody = + if meth.IsAbstract then + if nenv.DisplayEnv.openTopPathsSorted.Force() |> List.contains [ "System" ] then + "raise (NotImplementedException())" + else + "raise (System.NotImplementedException())" + else + implementBody + + let newlineIndent = + Environment.NewLine + String.make (spacesBeforeOverrideKeyword + 4) ' ' + + let getOverridableMethods superTy (overriddenMethods: MethInfo list) overriddenProperties = + // Do not check a method with same name twice + //type AA() = + // abstract a: unit -> unit + // default _.a() = printfn "A" + //type BB() = + // inherit AA() + // member _.a() = printfn "B" (* This method covered the `AA.a` *) + //type CC() = + // inherit BB() + // override | (* Here should not suggest to override `AA.a` *) + let checkedMethods = ResizeArray(overriddenMethods) + + let isInterface = isInterfaceTy g superTy + + // reuse between props and methods + let argNames = HashSet() + + let overridableProps = + let generatePropertyOverrideBody (prop: PropInfo) getterMeth setterMeth = + argNames.Clear() + + let parameters = + prop.GetParamNamesAndTypes(amap, m) + |> List.map (fun (ParamNameAndType(name, ty)) -> + let name = + name + |> Option.map _.idText + |> Option.defaultValue String.Empty + |> checkOrGenerateArgName argNames + + $"{name}: {stringOfTy denv ty}") + |> String.concat ", " + + let retTy = prop.GetPropertyType(amap, m) + let retTy = stringOfTy denv retTy + + let getter, getterWithBody = + match getterMeth with + | ValueSome meth -> + let implementBody = + checkMethAbstractAndGetImplementBody + meth + ($"base.{prop.DisplayName}" + (if prop.IsIndexer then $"({parameters})" else "")) + + let getter = $"get ({parameters}): {retTy}" + getter, $"{getter} = {implementBody}" + | _ -> String.Empty, String.Empty + + let setter, setterWithBody = + match setterMeth with + | ValueSome meth -> + let argValue = checkOrGenerateArgName argNames "value" + + let implementBody = + checkMethAbstractAndGetImplementBody + meth + ($"base.{prop.DisplayName}" + + (if prop.IsIndexer then $"({parameters})" else String.Empty) + + $" <- {argValue}") + + let parameters = if prop.IsIndexer then $"({parameters}) " else String.Empty + let setter = $"set {parameters}({argValue}: {retTy})" + setter, $"{setter} = {implementBody}" + | _ -> String.Empty, String.Empty + + let keywordAnd = + if getterMeth.IsNone || setterMeth.IsNone then + String.Empty + else + " and " + + let this = if hasThis || prop.IsStatic then String.Empty else "this." + + let getterWithBody = + if String.IsNullOrWhiteSpace getterWithBody then + String.Empty + else + getterWithBody + newlineIndent + + let name = $"{prop.DisplayName} with {getter}{keywordAnd}{setter}" + + let textInCode = + this + + prop.DisplayName + + newlineIndent + + "with " + + getterWithBody + + keywordAnd + + setterWithBody + + name, textInCode + + GetIntrinsicPropInfoWithOverriddenPropOfType + infoReader + None + ad + TypeHierarchy.AllowMultiIntfInstantiations.No + FindMemberFlag.PreferOverrides + range0 + superTy + |> List.choose (fun struct (prop, baseProp) -> + let getterMeth = + if prop.HasGetter then + ValueSome prop.GetterMethod + else + baseProp |> ValueOption.map _.GetterMethod + + let setterMeth = + if prop.HasSetter then + ValueSome prop.SetterMethod + else + baseProp |> ValueOption.map _.SetterMethod + + let isGetterOverridable, isSetterOverridable = + isPropertyOverridable superTy overriddenProperties prop - let overriddenMethods = - GetImmediateIntrinsicMethInfosOfType (None, ad) g amap typeNameRange ty - |> List.filter (fun x -> x.IsDefiniteFSharpOverride) + let isGetterOverridable = + isGetterOverridable + && isMethodOptionOverridable superTy checkedMethods getterMeth - let overridableMethods = - GetIntrinsicMethInfosOfType - infoReader + let isSetterOverridable = + isSetterOverridable + && isMethodOptionOverridable superTy checkedMethods setterMeth + + let canPick = + prop.IsStatic = isStatic && (isGetterOverridable || isSetterOverridable) + + getterMeth |> ValueOption.iter checkedMethods.Add + setterMeth |> ValueOption.iter checkedMethods.Add + + if not canPick then None - ad - TypeHierarchy.AllowMultiIntfInstantiations.No - FindMemberFlag.PreferOverrides - range0 - superTy - |> List.filter (isMethodOverridable overriddenMethods) - |> List.groupBy (fun x -> x.DisplayName) - |> List.map (fun (name, overloads) -> - Item.MethodGroup(name, overloads, None) + else + let getterMeth = if isGetterOverridable then getterMeth else ValueNone + let setterMeth = if isSetterOverridable then setterMeth else ValueNone + let name, textInCode = generatePropertyOverrideBody prop getterMeth setterMeth + + Item.Property( + name, + [ + prop + if baseProp.IsSome then + baseProp.Value + ], + None + ) |> ItemWithNoInst - |> DefaultCompletionItem) + |> CompletionItemWithMoreSetting ValueNone ValueNone -1 (ValueSome textInCode) (ValueSome name) + |> Some) - Some(overridableMethods, nenv.DisplayEnv, m) - | _ -> None) + let overridableMeths = + let generateMethodOverrideBody (meth: MethInfo) = + argNames.Clear() + + let parameters = + meth.GetParamNames() + |> List.zip (meth.GetParamTypes(amap, m, meth.FormalMethodInst)) + |> List.map (fun (types, names) -> + let names = + names + |> List.zip types + |> List.map (fun (ty, name) -> + let name = + name |> Option.defaultValue String.Empty |> checkOrGenerateArgName argNames + + $"{name}: {stringOfTy denv ty}") + |> String.concat ", " + + $"({names})") + |> String.concat " " + + let retTy = meth.GetFSharpReturnType(amap, m, meth.FormalMethodInst) + + let name = $"{meth.DisplayName} {parameters}: {stringOfTy denv retTy}" + + let textInCode = + let nameWithThis = + if hasThis || not meth.IsInstance then + $"{name} = " + else + $"this.{name} = " + + let implementBody = + checkMethAbstractAndGetImplementBody meth $"base.{meth.DisplayName}{parameters}" + + nameWithThis + newlineIndent + implementBody + + name, textInCode + + GetIntrinsicMethInfosOfType + infoReader + None + ad + TypeHierarchy.AllowMultiIntfInstantiations.No + FindMemberFlag.PreferOverrides + range0 + superTy + |> List.choose (fun meth -> + let canPick = + meth.IsInstance <> isStatic + && isMethodOverridable superTy checkedMethods meth + && (not isInterface + || not (tyconRefEq g meth.DeclaringTyconRef g.system_Object_tcref)) + + checkedMethods.Add meth + + if not canPick then + None + else + let name, textInCode = generateMethodOverrideBody meth + + Item.MethodGroup(name, [ meth ], None) + |> ItemWithNoInst + |> CompletionItemWithMoreSetting ValueNone ValueNone -1 (ValueSome textInCode) (ValueSome name) + |> Some) + + overridableProps @ overridableMeths + + let getTyFromTypeNamePos (endPos: pos) = + let nameResItems = + GetPreciseItemsFromNameResolution(endPos.Line, endPos.Column, None, ResolveTypeNamesToTypeRefs, ResolveOverloads.Yes) + + match nameResItems with + | NameResResult.Members(ls, _, _) -> + ls + |> List.tryPick (function + | { Item = Item.Types(_, ty :: _) } -> Some ty + | _ -> None) + | _ -> None + + let ctx = + match ctx with + | MethodOverrideCompletionContext.Class -> + sResolutions.CapturedNameResolutions + |> ResizeArray.tryPick (fun r -> + match r.Item with + | Item.Types(_, ty :: _) when equals r.Range typeNameRange && isAppTy g ty -> + let superTy = + (tcrefOfAppTy g ty).TypeContents.tcaug_super + |> Option.defaultValue g.obj_ty_noNulls + + Some(ty, superTy) + | _ -> None) + + | MethodOverrideCompletionContext.Interface mTy -> + sResolutions.CapturedNameResolutions + |> ResizeArray.tryPick (fun r -> + match r.Item with + | Item.Types(_, ty :: _) when equals r.Range typeNameRange && isAppTy g ty -> + let superTy = getTyFromTypeNamePos mTy.End |> Option.defaultValue g.obj_ty_noNulls + Some(ty, superTy) + | _ -> None) + | MethodOverrideCompletionContext.ObjExpr m -> + let _, quals = GetExprTypingForPosition(m.End) + + quals + |> Array.tryFind (fun (_, _, _, r) -> posEq m.Start r.Start) + |> Option.map (fun (ty, _, _, _) -> ty, getTyFromTypeNamePos typeNameRange.End |> Option.defaultValue g.obj_ty_noNulls) + + match ctx with + | Some(ty, superTy) -> + let overriddenMethods = + GetImmediateIntrinsicMethInfosWithExplicitImplOfType (None, ad) g amap typeNameRange ty + |> List.filter (fun x -> x.IsDefiniteFSharpOverride) + + let overriddenProperties = + GetImmediateIntrinsicPropInfosWithExplicitImplOfType (None, ad) g amap typeNameRange ty + |> List.filter (fun x -> x.IsDefiniteFSharpOverride) + + let overridableMethods = + getOverridableMethods superTy overriddenMethods overriddenProperties + + Some(overridableMethods, denv, m) + | _ -> None /// Gets all field identifiers of a union case that can be referred to in a pattern. let GetUnionCaseFields caseIdRange alreadyReferencedFields = @@ -1579,6 +1892,8 @@ type internal TypeCheckInfo IsOwnMember = false Type = None Unresolved = None + CustomInsertText = ValueNone + CustomDisplayText = ValueNone }) match declaredItems with @@ -1641,7 +1956,8 @@ type internal TypeCheckInfo getDeclaredItemsNotInRangeOpWithAllSymbols () |> Option.bind (FilterRelevantItemsBy getItem2 None IsPatternCandidate) - | Some(CompletionContext.MethodOverride enclosingTypeNameRange) -> GetOverridableMethods pos enclosingTypeNameRange + | Some(CompletionContext.MethodOverride(ctx, enclosingTypeNameRange, spacesBeforeOverrideKeyword, hasThis, isStatic)) -> + GetOverridableMethods pos ctx enclosingTypeNameRange spacesBeforeOverrideKeyword hasThis isStatic // Other completions | cc -> @@ -1860,7 +2176,7 @@ type internal TypeCheckInfo items |> List.map (fun item -> let symbol = FSharpSymbol.Create(cenv, item.Item) - FSharpSymbolUse(denv, symbol, item.ItemWithInst.TyparInstantiation, ItemOccurence.Use, m))) + FSharpSymbolUse(denv, symbol, item.ItemWithInst.TyparInstantiation, ItemOccurrence.Use, m))) //end filtering items) @@ -2706,7 +3022,7 @@ module internal ParseAndCheckFile = let parseFile ( sourceText: ISourceText, - fileName, + fileName: string, options: FSharpParsingOptions, userOpName: string, suggestNamesForErrors: bool, @@ -2761,7 +3077,7 @@ module internal ParseAndCheckFile = ( tcConfig, parsedMainInput, - mainInputFileName, + mainInputFileName: string, loadClosure: LoadClosure option, tcImports: TcImports, backgroundDiagnostics @@ -2853,7 +3169,7 @@ module internal ParseAndCheckFile = ApplyMetaCommandsFromInputToTcConfig( tcConfig, parsedMainInput, - Path.GetDirectoryName mainInputFileName, + !! Path.GetDirectoryName(mainInputFileName), tcImports.DependencyProvider ) |> ignore @@ -2904,7 +3220,7 @@ module internal ParseAndCheckFile = // Apply nowarns to tcConfig (may generate errors, so ensure diagnosticsLogger is installed) let tcConfig = - ApplyNoWarnsToTcConfig(tcConfig, parsedMainInput, Path.GetDirectoryName mainInputFileName) + ApplyNoWarnsToTcConfig(tcConfig, parsedMainInput, !! Path.GetDirectoryName(mainInputFileName)) // update the error handler with the modified tcConfig errHandler.DiagnosticOptions <- tcConfig.diagnosticsOptions @@ -3097,7 +3413,7 @@ type FSharpCheckFileResults | Some(scope, _builderOpt) -> scope.GetSymbolUsesAtLocation(line, lineText, colAtEndOfNames, names) |> List.map (fun (sym, itemWithInst, denv, m) -> - FSharpSymbolUse(denv, sym, itemWithInst.TyparInstantiation, ItemOccurence.Use, m)) + FSharpSymbolUse(denv, sym, itemWithInst.TyparInstantiation, ItemOccurrence.Use, m)) member _.GetMethodsAsSymbols(line, colAtEndOfNames, lineText, names) = match details with @@ -3106,7 +3422,7 @@ type FSharpCheckFileResults scope.GetMethodsAsSymbols(line, lineText, colAtEndOfNames, names) |> Option.map (fun (symbols, denv, m) -> symbols - |> List.map (fun (sym, itemWithInst) -> FSharpSymbolUse(denv, sym, itemWithInst.TyparInstantiation, ItemOccurence.Use, m))) + |> List.map (fun (sym, itemWithInst) -> FSharpSymbolUse(denv, sym, itemWithInst.TyparInstantiation, ItemOccurrence.Use, m))) member _.GetSymbolAtLocation(line, colAtEndOfNames, lineStr, names) = match details with @@ -3152,10 +3468,10 @@ type FSharpCheckFileResults for symbolUse in symbolUseChunk do cancellationToken |> Option.iter (fun ct -> ct.ThrowIfCancellationRequested()) - if symbolUse.ItemOccurence <> ItemOccurence.RelatedText then + if symbolUse.ItemOccurrence <> ItemOccurrence.RelatedText then let symbol = FSharpSymbol.Create(cenv, symbolUse.ItemWithInst.Item) let inst = symbolUse.ItemWithInst.TyparInstantiation - FSharpSymbolUse(symbolUse.DisplayEnv, symbol, inst, symbolUse.ItemOccurence, symbolUse.Range) + FSharpSymbolUse(symbolUse.DisplayEnv, symbol, inst, symbolUse.ItemOccurrence, symbolUse.Range) } member _.GetUsesOfSymbolInFile(symbol: FSharpSymbol, ?cancellationToken: CancellationToken) = @@ -3165,12 +3481,12 @@ type FSharpCheckFileResults [| for symbolUse in scope.ScopeSymbolUses.GetUsesOfSymbol(symbol.Item) - |> Seq.distinctBy (fun symbolUse -> symbolUse.ItemOccurence, symbolUse.Range) do + |> Seq.distinctBy (fun symbolUse -> symbolUse.ItemOccurrence, symbolUse.Range) do cancellationToken |> Option.iter (fun ct -> ct.ThrowIfCancellationRequested()) - if symbolUse.ItemOccurence <> ItemOccurence.RelatedText then + if symbolUse.ItemOccurrence <> ItemOccurrence.RelatedText then let inst = symbolUse.ItemWithInst.TyparInstantiation - FSharpSymbolUse(symbolUse.DisplayEnv, symbol, inst, symbolUse.ItemOccurence, symbolUse.Range) + FSharpSymbolUse(symbolUse.DisplayEnv, symbol, inst, symbolUse.ItemOccurrence, symbolUse.Range) |] member _.GetVisibleNamespacesAndModulesAtPoint(pos: pos) = @@ -3520,12 +3836,12 @@ type FSharpCheckProjectResults ) results - |> Seq.filter (fun symbolUse -> symbolUse.ItemOccurence <> ItemOccurence.RelatedText) - |> Seq.distinctBy (fun symbolUse -> symbolUse.ItemOccurence, symbolUse.Range) + |> Seq.filter (fun symbolUse -> symbolUse.ItemOccurrence <> ItemOccurrence.RelatedText) + |> Seq.distinctBy (fun symbolUse -> symbolUse.ItemOccurrence, symbolUse.Range) |> Seq.map (fun symbolUse -> cancellationToken |> Option.iter (fun ct -> ct.ThrowIfCancellationRequested()) let inst = symbolUse.ItemWithInst.TyparInstantiation - FSharpSymbolUse(symbolUse.DisplayEnv, symbol, inst, symbolUse.ItemOccurence, symbolUse.Range)) + FSharpSymbolUse(symbolUse.DisplayEnv, symbol, inst, symbolUse.ItemOccurrence, symbolUse.Range)) |> Seq.toArray // Not, this does not have to be a SyncOp, it can be called from any thread @@ -3557,10 +3873,10 @@ type FSharpCheckProjectResults for symbolUse in symbolUseChunk do cancellationToken |> Option.iter (fun ct -> ct.ThrowIfCancellationRequested()) - if symbolUse.ItemOccurence <> ItemOccurence.RelatedText then + if symbolUse.ItemOccurrence <> ItemOccurrence.RelatedText then let symbol = FSharpSymbol.Create(cenv, symbolUse.ItemWithInst.Item) let inst = symbolUse.ItemWithInst.TyparInstantiation - FSharpSymbolUse(symbolUse.DisplayEnv, symbol, inst, symbolUse.ItemOccurence, symbolUse.Range) + FSharpSymbolUse(symbolUse.DisplayEnv, symbol, inst, symbolUse.ItemOccurrence, symbolUse.Range) |] member _.ProjectContext = diff --git a/src/Compiler/Service/FSharpCheckerResults.fsi b/src/Compiler/Service/FSharpCheckerResults.fsi index 0ae8b3039d9..6b0a7f49135 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fsi +++ b/src/Compiler/Service/FSharpCheckerResults.fsi @@ -57,7 +57,7 @@ type public FSharpProjectOptions = // Note that this may not reduce to just the project directory, because there may be two projects in the same directory. ProjectFileName: string - /// This is the unique identifier for the project, it is case sensitive. If it's None, will key off of ProjectFileName in our caching. + /// This is the unique identifier for the project, it is case-sensitive. If it's None, will key off of ProjectFileName in our caching. ProjectId: string option /// The files in the project @@ -192,7 +192,7 @@ type public FSharpSymbolUse = // For internal use only internal new: - denv: DisplayEnv * symbol: FSharpSymbol * inst: TyparInstantiation * itemOcc: ItemOccurence * range: range -> + denv: DisplayEnv * symbol: FSharpSymbol * inst: TyparInstantiation * itemOcc: ItemOccurrence * range: range -> FSharpSymbolUse /// Represents the checking context implied by the ProjectOptions diff --git a/src/Compiler/Service/FSharpParseFileResults.fs b/src/Compiler/Service/FSharpParseFileResults.fs index 883c624804c..34958588b79 100644 --- a/src/Compiler/Service/FSharpParseFileResults.fs +++ b/src/Compiler/Service/FSharpParseFileResults.fs @@ -14,7 +14,7 @@ open FSharp.Compiler.Text open FSharp.Compiler.Text.Range module SourceFileImpl = - let IsSignatureFile file = + let IsSignatureFile (file: string) = let ext = Path.GetExtension file 0 = String.Compare(".fsi", ext, StringComparison.OrdinalIgnoreCase) diff --git a/src/Compiler/Service/FSharpParseFileResults.fsi b/src/Compiler/Service/FSharpParseFileResults.fsi index e892c78aa89..20fa8dafec5 100644 --- a/src/Compiler/Service/FSharpParseFileResults.fsi +++ b/src/Compiler/Service/FSharpParseFileResults.fsi @@ -47,7 +47,7 @@ type public FSharpParseFileResults = /// /// Given the position of an expression, attempts to find the range of the - /// '!' in a derefence operation of that expression, like: + /// '!' in a dereference operation of that expression, like: /// '!expr', '!(expr)', etc. /// member TryRangeOfRefCellDereferenceContainingPos: expressionPos: pos -> range option diff --git a/src/Compiler/Service/FSharpProjectSnapshot.fs b/src/Compiler/Service/FSharpProjectSnapshot.fs index a6cea4de69f..cf67ff37d15 100644 --- a/src/Compiler/Service/FSharpProjectSnapshot.fs +++ b/src/Compiler/Service/FSharpProjectSnapshot.fs @@ -7,6 +7,7 @@ open System.Collections.Generic open System.IO open System.Reflection open FSharp.Compiler.IO +open Internal.Utilities.Library open Internal.Utilities.Library.Extras open FSharp.Core.Printf open FSharp.Compiler.Text @@ -22,7 +23,7 @@ open FSharp.Compiler.DiagnosticsLogger type internal ProjectIdentifier = string * string -/// A common interface for an F# source file snapshot that can be used accross all stages (lazy, source loaded, parsed) +/// A common interface for an F# source file snapshot that can be used across all stages (lazy, source loaded, parsed) type internal IFileSnapshot = abstract member FileName: string abstract member Version: byte array @@ -419,7 +420,7 @@ and internal ProjectCore member _.GetVersion() = fullHashString.Value }) - member val ProjectDirectory = Path.GetDirectoryName(ProjectFileName) + member val ProjectDirectory = !! Path.GetDirectoryName(ProjectFileName) member _.OutputFileName = outputFileName.Value member _.Identifier: ProjectIdentifier = key.Value member _.Version = fullHash.Value diff --git a/src/Compiler/Service/IncrementalBuild.fs b/src/Compiler/Service/IncrementalBuild.fs index 76056026c1d..7951f3c9328 100644 --- a/src/Compiler/Service/IncrementalBuild.fs +++ b/src/Compiler/Service/IncrementalBuild.fs @@ -142,7 +142,7 @@ module IncrementalBuildSyntaxTree = Activity.start "IncrementalBuildSyntaxTree.parse" [| Activity.Tags.fileName, fileName - Activity.Tags.buildPhase, BuildPhase.Parse.ToString() + Activity.Tags.buildPhase, !! BuildPhase.Parse.ToString() |] try @@ -259,12 +259,12 @@ type BoundModel private ( IncrementalBuilderEventTesting.MRU.Add(IncrementalBuilderEventTesting.IBETypechecked fileName) let capturingDiagnosticsLogger = CapturingDiagnosticsLogger("TypeCheck") - let diagnosticsLogger = GetDiagnosticsLoggerFilteringByScopedPragmas(false, input.ScopedPragmas, tcConfig.diagnosticsOptions, capturingDiagnosticsLogger) + let diagnosticsLogger = GetDiagnosticsLoggerFilteringByScopedPragmas(tcConfig.langVersion, input.ScopedPragmas, tcConfig.diagnosticsOptions, capturingDiagnosticsLogger) use _ = new CompilationGlobalsScope(diagnosticsLogger, BuildPhase.TypeCheck) beforeFileChecked.Trigger fileName - ApplyMetaCommandsFromInputToTcConfig (tcConfig, input, Path.GetDirectoryName fileName, tcImports.DependencyProvider) |> ignore + ApplyMetaCommandsFromInputToTcConfig (tcConfig, input, !! Path.GetDirectoryName(fileName), tcImports.DependencyProvider) |> ignore let sink = TcResultsSinkImpl(tcGlobals) let hadParseErrors = not (Array.isEmpty parseErrors) let input, moduleNamesDict = DeduplicateParsedInputModuleName prevTcInfo.moduleNamesDict input @@ -303,7 +303,7 @@ type BoundModel private ( return tcInfo, sink, implFile, fileName, newErrors } - let skippedImplemetationTypeCheck = + let skippedImplementationTypeCheck = match syntaxTreeOpt, prevTcInfo.sigNameOpt with | Some syntaxTree, Some (_, qualifiedName) when syntaxTree.HasSignature -> let input, _, fileName, _ = syntaxTree.Skip qualifiedName @@ -385,7 +385,7 @@ type BoundModel private ( match tcStateOpt with | Some tcState -> tcState | _ -> - match skippedImplemetationTypeCheck with + match skippedImplementationTypeCheck with | Some tcInfo -> // For skipped implementation sources do full type check only when requested. GraphNode.FromResult tcInfo, tcInfoExtras @@ -487,14 +487,14 @@ type BoundModel private ( /// Global service state type FrameworkImportsCacheKey = - | FrameworkImportsCacheKey of resolvedpath: string list * assemblyName: string * targetFrameworkDirectories: string list * fsharpBinaries: string * langVersion: decimal + | FrameworkImportsCacheKey of resolvedpath: string list * assemblyName: string * targetFrameworkDirectories: string list * fsharpBinaries: string * langVersion: decimal * checkNulls: bool interface ICacheKey with member this.GetKey() = - this |> function FrameworkImportsCacheKey(assemblyName=a) -> a + this |> function FrameworkImportsCacheKey(assemblyName=a;checkNulls=c) -> if c then a + "CheckNulls" else a member this.GetLabel() = - this |> function FrameworkImportsCacheKey(assemblyName=a) -> a + this |> function FrameworkImportsCacheKey(assemblyName=a;checkNulls=c) -> if c then a + "CheckNulls" else a member this.GetVersion() = this @@ -529,7 +529,8 @@ type FrameworkImportsCache(size) = tcConfig.primaryAssembly.Name, tcConfig.GetTargetFrameworkDirectories(), tcConfig.fsharpBinariesDir, - tcConfig.langVersion.SpecifiedVersion) + tcConfig.langVersion.SpecifiedVersion, + tcConfig.checkNullness) let node = lock gate (fun () -> @@ -553,6 +554,33 @@ type FrameworkImportsCache(size) = let frameworkDLLs, nonFrameworkResolutions, unresolved = TcAssemblyResolutions.SplitNonFoundationalResolutions(tcConfig) let node = this.GetNode(tcConfig, frameworkDLLs, nonFrameworkResolutions) let! tcGlobals, frameworkTcImports = node.GetOrComputeValue() + + // If the tcGlobals was loaded from a different project, langVersion and realsig may be different + // for each cached project. So here we create a new tcGlobals, with the existing framework values + // and updated realsig and langversion + let tcGlobals = + if tcGlobals.langVersion.SpecifiedVersion <> tcConfig.langVersion.SpecifiedVersion + || tcGlobals.realsig <> tcConfig.realsig then + TcGlobals( + tcGlobals.compilingFSharpCore, + tcGlobals.ilg, + tcGlobals.fslibCcu, + tcGlobals.directoryToResolveRelativePaths, + tcGlobals.mlCompatibility, + tcGlobals.isInteractive, + tcGlobals.checkNullness, + tcGlobals.useReflectionFreeCodeGen, + tcGlobals.tryFindSysTypeCcuHelper, + tcGlobals.emitDebugInfoInQuotations, + tcGlobals.noDebugAttributes, + tcGlobals.pathMap, + tcConfig.langVersion, + tcConfig.realsig + ) + + else + tcGlobals + return tcGlobals, frameworkTcImports, nonFrameworkResolutions, unresolved } @@ -609,9 +637,7 @@ type RawFSharpAssemblyDataBackedByLanguageService (tcConfig, tcGlobals, generate let sigData = let _sigDataAttributes, sigDataResources = EncodeSignatureData(tcConfig, tcGlobals, exportRemapping, generatedCcu, outfile, true) - [ for r in sigDataResources do - GetResourceNameAndSignatureDataFunc r - ] + GetResourceNameAndSignatureDataFuncs sigDataResources let autoOpenAttrs = topAttrs.assemblyAttrs |> List.choose (List.singleton >> TryFindFSharpStringAttribute tcGlobals tcGlobals.attrib_AutoOpenAttribute) @@ -801,12 +827,12 @@ module IncrementalBuilderHelpers = let tcAssemblyDataOpt = try - // Assemblies containing type provider components can not successfully be used via cross-assembly references. + // Assemblies containing type provider components cannot successfully be used via cross-assembly references. // We return 'None' for the assembly portion of the cross-assembly reference let hasTypeProviderAssemblyAttrib = topAttrs.assemblyAttrs |> List.exists (fun (Attrib(tcref, _, _, _, _, _, _)) -> let nm = tcref.CompiledRepresentationForNamedType.BasicQualifiedName - nm = typeof.FullName) + nm = !! typeof.FullName) if tcState.CreatesGeneratedProvidedTypes || hasTypeProviderAssemblyAttrib then ProjectAssemblyDataResult.Unavailable true @@ -1446,6 +1472,8 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc tcConfigB.useSimpleResolution <- (getSwitchValue useSimpleResolutionSwitch) |> Option.isSome + tcConfigB.realsig <- List.contains "--realsig" commandLineArgs || List.contains "--realsig+" commandLineArgs + // Apply command-line arguments and collect more source files if they are in the arguments let sourceFilesNew = ApplyCommandLineArgs(tcConfigB, sourceFiles, commandLineArgs) @@ -1456,7 +1484,7 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc { new IXmlDocumentationInfoLoader with /// Try to load xml documentation associated with an assembly by the same file path with the extension ".xml". member _.TryLoad(assemblyFileName) = - let xmlFileName = Path.ChangeExtension(assemblyFileName, ".xml") + let xmlFileName = !! Path.ChangeExtension(assemblyFileName, ".xml") // REVIEW: File IO - Will eventually need to change this to use a file system interface of some sort. XmlDocumentationInfo.TryCreateFromFile(xmlFileName) diff --git a/src/Compiler/Service/IncrementalBuild.fsi b/src/Compiler/Service/IncrementalBuild.fsi index 0fd380631e4..21b2fb23404 100644 --- a/src/Compiler/Service/IncrementalBuild.fsi +++ b/src/Compiler/Service/IncrementalBuild.fsi @@ -30,7 +30,8 @@ type internal FrameworkImportsCacheKey = assemblyName: string * targetFrameworkDirectories: string list * fsharpBinaries: string * - langVersion: decimal + langVersion: decimal * + checkNulls: bool interface ICacheKey diff --git a/src/Compiler/Service/ItemKey.fs b/src/Compiler/Service/ItemKey.fs index 7a904a235ed..3c030f84c90 100644 --- a/src/Compiler/Service/ItemKey.fs +++ b/src/Compiler/Service/ItemKey.fs @@ -7,6 +7,7 @@ open System.IO open System.IO.MemoryMappedFiles open System.Reflection.Metadata open System.Runtime.InteropServices +open Internal.Utilities.Library open FSharp.NativeInterop open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.Infos @@ -436,7 +437,7 @@ and [] ItemKeyStoreBuilder(tcGlobals: TcGlobals) = writeString ItemKeyTags.itemActivePattern match apInfo.ActiveTagsWithRanges with - | (_, m) :: _ -> m.FileName |> Path.GetFileNameWithoutExtension |> writeString + | (_, m) :: _ -> m.FileName |> Path.GetFileNameWithoutExtension |> (!!) |> writeString | _ -> () for tag in apInfo.ActiveTags do diff --git a/src/Compiler/Service/QuickParse.fs b/src/Compiler/Service/QuickParse.fs index 7738d74ad80..ddb7d13f126 100644 --- a/src/Compiler/Service/QuickParse.fs +++ b/src/Compiler/Service/QuickParse.fs @@ -36,7 +36,7 @@ type PartialLongName = /// /// These methods are very old and are mostly to do with extracting "long identifier islands" /// A.B.C -/// from F# source code, an approach taken from pre-F# VS samples for implementing intelliense. +/// from F# source code, an approach taken from pre-F# VS samples for implementing intellisense. /// /// This code should really no longer be needed since the language service has access to /// parsed F# source code ASTs. However, the long identifiers are still passed back to GetDeclarations and friends in the @@ -79,7 +79,7 @@ module QuickParse = | _ -> false let GetCompleteIdentifierIslandImplAux (lineStr: string) (index: int) : (string * int * bool) option = - if index < 0 || isNull lineStr || index >= lineStr.Length then + if index < 0 || index >= lineStr.Length then None else let fixup = diff --git a/src/Compiler/Service/QuickParse.fsi b/src/Compiler/Service/QuickParse.fsi index c2ecb049da7..ad3d434ada7 100644 --- a/src/Compiler/Service/QuickParse.fsi +++ b/src/Compiler/Service/QuickParse.fsi @@ -28,7 +28,7 @@ type public PartialLongName = /// /// These methods are very old and are mostly to do with extracting "long identifier islands" /// A.B.C -/// from F# source code, an approach taken from pre-F# VS samples for implementing intelliense. +/// from F# source code, an approach taken from pre-F# VS samples for implementing intellisense. /// /// This code should really no longer be needed since the language service has access to /// parsed F# source code ASTs. However, the long identifiers are still passed back to GetDeclarations and friends in the diff --git a/src/Compiler/Service/SemanticClassification.fs b/src/Compiler/Service/SemanticClassification.fs index 6ebbb3c8ae0..3de24222311 100644 --- a/src/Compiler/Service/SemanticClassification.fs +++ b/src/Compiler/Service/SemanticClassification.fs @@ -58,7 +58,6 @@ type SemanticClassificationType = | TypeDef = 35 | Plaintext = 36 -[] [] type SemanticClassificationItem = val Range: range @@ -68,7 +67,7 @@ type SemanticClassificationItem = [] module TcResolutionsExtensions = let (|CNR|) (cnr: CapturedNameResolution) = - (cnr.Item, cnr.ItemOccurence, cnr.DisplayEnv, cnr.NameResolutionEnv, cnr.AccessorDomain, cnr.Range) + (cnr.Item, cnr.ItemOccurrence, cnr.DisplayEnv, cnr.NameResolutionEnv, cnr.AccessorDomain, cnr.Range) let isDisposableTy g amap (ty: TType) = not (typeEquiv g ty g.system_IDisposable_ty) @@ -145,14 +144,14 @@ module TcResolutionsExtensions = DiagnosticsScope.Protect range0 (fun () -> - let (|LegitTypeOccurence|_|) occ = + let (|LegitTypeOccurrence|_|) occ = match occ with - | ItemOccurence.UseInType - | ItemOccurence.UseInAttribute - | ItemOccurence.Use - | ItemOccurence.Binding - | ItemOccurence.Pattern - | ItemOccurence.Open -> Some() + | ItemOccurrence.UseInType + | ItemOccurrence.UseInAttribute + | ItemOccurrence.Use + | ItemOccurrence.Binding + | ItemOccurrence.Pattern + | ItemOccurrence.Open -> Some() | _ -> None let (|KeywordIntrinsicValue|_|) (vref: ValRef) = @@ -176,7 +175,7 @@ module TcResolutionsExtensions = | _ -> None | _ -> None - // Custome builders like 'async { }' are both Item.Value and Item.CustomBuilder. + // Custom builders like 'async { }' are both Item.Value and Item.CustomBuilder. // We should prefer the latter, otherwise they would not get classified as CEs. let takeCustomBuilder (cnrs: CapturedNameResolution[]) = assert (cnrs.Length > 0) @@ -210,13 +209,13 @@ module TcResolutionsExtensions = resolutions |> Array.iter (fun cnr -> - match cnr.Item, cnr.ItemOccurence, cnr.Range with - | (Item.CustomBuilder _ | Item.CustomOperation _), ItemOccurence.Use, m -> + match cnr.Item, cnr.ItemOccurrence, cnr.Range with + | (Item.CustomBuilder _ | Item.CustomOperation _), ItemOccurrence.Use, m -> add m SemanticClassificationType.ComputationExpression | Item.Value vref, _, m when isValRefMutable g vref -> add m SemanticClassificationType.MutableVar - | Item.Value KeywordIntrinsicValue, ItemOccurence.Use, m -> add m SemanticClassificationType.IntrinsicFunction + | Item.Value KeywordIntrinsicValue, ItemOccurrence.Use, m -> add m SemanticClassificationType.IntrinsicFunction | Item.Value vref, _, m when isForallFunctionTy g vref.Type -> if isDiscard vref.DisplayName then @@ -300,12 +299,12 @@ module TcResolutionsExtensions = add m SemanticClassificationType.Method // Special case measures for struct types - | Item.Types(_, AppTy g (tyconRef, TType_measure _ :: _) :: _), LegitTypeOccurence, m when + | Item.Types(_, AppTy g (tyconRef, TType_measure _ :: _) :: _), LegitTypeOccurrence, m when isStructTyconRef g tyconRef -> add m SemanticClassificationType.ValueType - | Item.Types(_, ty :: _), LegitTypeOccurence, m -> + | Item.Types(_, ty :: _), LegitTypeOccurrence, m -> let ty = stripTyEqns g ty if isDisposableTy g amap ty then @@ -325,11 +324,11 @@ module TcResolutionsExtensions = else add m SemanticClassificationType.TypeDef - | Item.TypeVar _, LegitTypeOccurence, m -> add m SemanticClassificationType.TypeArgument + | Item.TypeVar _, LegitTypeOccurrence, m -> add m SemanticClassificationType.TypeArgument - | Item.ExnCase _, LegitTypeOccurence, m -> add m SemanticClassificationType.Exception + | Item.ExnCase _, LegitTypeOccurrence, m -> add m SemanticClassificationType.Exception - | Item.ModuleOrNamespaces(modref :: _), LegitTypeOccurence, m -> + | Item.ModuleOrNamespaces(modref :: _), LegitTypeOccurrence, m -> if modref.IsNamespace then add m SemanticClassificationType.Namespace else @@ -353,7 +352,7 @@ module TcResolutionsExtensions = | Item.SetterArg _, _, m -> add m SemanticClassificationType.NamedArgument - | Item.UnqualifiedType(tcref :: _), LegitTypeOccurence, m -> + | Item.UnqualifiedType(tcref :: _), LegitTypeOccurrence, m -> if tcref.IsEnumTycon || tcref.IsILEnumTycon then add m SemanticClassificationType.Enumeration elif tcref.IsFSharpException then diff --git a/src/Compiler/Service/SemanticClassification.fsi b/src/Compiler/Service/SemanticClassification.fsi index ce5d6d88aeb..031192570cc 100644 --- a/src/Compiler/Service/SemanticClassification.fsi +++ b/src/Compiler/Service/SemanticClassification.fsi @@ -49,7 +49,6 @@ type SemanticClassificationType = | TypeDef = 35 | Plaintext = 36 -[] [] type SemanticClassificationItem = val Range: range @@ -60,7 +59,7 @@ type SemanticClassificationItem = [] module internal TcResolutionsExtensions = val (|CNR|): - cnr: CapturedNameResolution -> Item * ItemOccurence * DisplayEnv * NameResolutionEnv * AccessorDomain * range + cnr: CapturedNameResolution -> Item * ItemOccurrence * DisplayEnv * NameResolutionEnv * AccessorDomain * range type TcResolutions with diff --git a/src/Compiler/Service/ServiceAnalysis.fs b/src/Compiler/Service/ServiceAnalysis.fs index 29df63b1194..26b2ea1f7a2 100644 --- a/src/Compiler/Service/ServiceAnalysis.fs +++ b/src/Compiler/Service/ServiceAnalysis.fs @@ -51,6 +51,11 @@ module UnusedOpens = if not entity.IsNamespace && not entity.IsFSharpModule then for fv in entity.MembersFunctionsAndValues do fv + + if entity.IsEnum then + for field in entity.FSharpFields do + if field.IsStatic && field.IsLiteral then + field |] HashSet<_>(symbols, symbolHash) diff --git a/src/Compiler/Service/ServiceDeclarationLists.fs b/src/Compiler/Service/ServiceDeclarationLists.fs index 14b506bff86..e0bce073607 100644 --- a/src/Compiler/Service/ServiceDeclarationLists.fs +++ b/src/Compiler/Service/ServiceDeclarationLists.fs @@ -86,7 +86,9 @@ type CompletionItem = IsOwnMember: bool MinorPriority: int Type: TyconRef option - Unresolved: UnresolvedSymbol option } + Unresolved: UnresolvedSymbol option + CustomInsertText: string voption + CustomDisplayText: string voption } member x.Item = x.ItemWithInst.Item [] @@ -119,7 +121,7 @@ module DeclarationListHelpers = { new IPartialEqualityComparer with member x.InEqualityRelation item = itemComparer.InEqualityRelation item.Item - member x.Equals(item1, item2) = itemComparer.Equals(item1.Item, item2.Item) + member x.Equals(item1, item2) = nullSafeEquality item1 item2 (fun item1 item2 -> itemComparer.Equals(item1.Item, item2.Item)) member x.GetHashCode item = itemComparer.GetHashCode(item.Item) } /// Remove all duplicate items @@ -136,7 +138,7 @@ module DeclarationListHelpers = modrefs |> IPartialEqualityComparer.partialDistinctBy { new IPartialEqualityComparer with member x.InEqualityRelation _ = true - member x.Equals(item1, item2) = (fullDisplayTextOfModRef item1 = fullDisplayTextOfModRef item2) + member x.Equals(item1, item2) = nullSafeEquality item1 item2 (fun item1 item2 -> fullDisplayTextOfModRef item1 = fullDisplayTextOfModRef item2) member x.GetHashCode item = hash item.Stamp } let OutputFullName displayFullName ppF fnF r = @@ -155,7 +157,7 @@ module DeclarationListHelpers = let rec FormatItemDescriptionToToolTipElement displayFullName (infoReader: InfoReader) ad m denv (item: ItemWithInst) symbol (width: int option) = let g = infoReader.g let amap = infoReader.amap - let denv = SimplerDisplayEnv denv + let denv = {SimplerDisplayEnv denv with showCsharpCodeAnalysisAttributes = true } let xml = GetXmlCommentForItem infoReader m item.Item match item.Item with @@ -839,7 +841,7 @@ module internal DescriptionListsImpl = | Item.DelegateCtor delTy -> let (SigOfFunctionForDelegate(_, _, _, delFuncTy)) = GetSigOfFunctionForDelegate infoReader delTy m AccessibleFromSomewhere - // No need to pass more generic type information in here since the instanitations have already been applied + // No need to pass more generic type information in here since the instantiations have already been applied let _prettyTyparInst, prettyParams, prettyRetTyL, _prettyConstraintsL = PrettyParamsOfParamDatas g denv item.TyparInstantiation [ParamData(false, false, false, NotOptional, NoCallerInfo, None, ReflectedArgInfo.None, delFuncTy)] delTy // FUTURE: prettyTyparInst is the pretty version of the known instantiations of type parameters in the output. It could be returned @@ -1125,19 +1127,23 @@ type DeclarationListInfo(declarations: DeclarationListItem[], isForType: bool, i match u.Namespace with | [||] -> u.DisplayName | ns -> (ns |> String.concat ".") + "." + u.DisplayName - | None -> x.Item.DisplayName) + | None when x.CustomDisplayText.IsSome -> x.CustomDisplayText.Value + | None -> x.Item.DisplayName + ) |> List.map ( let textInDeclList item = match item.Unresolved with | Some u -> u.DisplayName + | None when item.CustomDisplayText.IsSome -> item.CustomDisplayText.Value | None -> item.Item.DisplayNameCore let textInCode (item: CompletionItem) = match item.Item with | Item.TypeVar (name, typar) -> (if typar.StaticReq = Syntax.TyparStaticReq.None then "'" else " ^") + name | _ -> - match item.Unresolved with - | Some u -> u.DisplayName - | None -> item.Item.DisplayName + match item.Unresolved, item.CustomInsertText with + | Some u, _ -> u.DisplayName + | None, ValueSome textInCode -> textInCode + | None, _ -> item.Item.DisplayName if not supportsPreferExtsMethodsOverProperty then // we don't pay the cost of filtering specific to RFC-1137 // nor risk a change in behaviour for the intellisense item list @@ -1307,15 +1313,15 @@ type MethodGroup( name: string, unsortedMethods: MethodGroupItem[] ) = unsortedMethods // Methods with zero arguments show up here as taking a single argument of type 'unit'. Patch them now to appear as having zero arguments. |> Array.map (fun meth -> - let parms = meth.Parameters - if parms.Length = 1 && parms[0].CanonicalTypeTextForSorting="Microsoft.FSharp.Core.Unit" then + let params_ = meth.Parameters + if params_.Length = 1 && params_[0].CanonicalTypeTextForSorting="Microsoft.FSharp.Core.Unit" then MethodGroupItem(meth.Description, meth.XmlDoc, meth.ReturnTypeText, [||], true, meth.HasParamArrayArg, meth.StaticParameters) else meth) // Fix the order of methods, to be stable for unit testing. |> Array.sortBy (fun meth -> - let parms = meth.Parameters - parms.Length, (parms |> Array.map (fun p -> p.CanonicalTypeTextForSorting))) + let params_ = meth.Parameters + params_.Length, (params_ |> Array.map (fun p -> p.CanonicalTypeTextForSorting))) member _.MethodName = name diff --git a/src/Compiler/Service/ServiceDeclarationLists.fsi b/src/Compiler/Service/ServiceDeclarationLists.fsi index 4611ff86a16..3aeaa11112d 100644 --- a/src/Compiler/Service/ServiceDeclarationLists.fsi +++ b/src/Compiler/Service/ServiceDeclarationLists.fsi @@ -91,6 +91,9 @@ type internal CompletionItem = Type: TyconRef option Unresolved: UnresolvedSymbol option + + CustomInsertText: string voption + CustomDisplayText: string voption } member Item: Item diff --git a/src/Compiler/Service/ServiceInterfaceStubGenerator.fs b/src/Compiler/Service/ServiceInterfaceStubGenerator.fs index e02df4c7da7..d691e002c0a 100644 --- a/src/Compiler/Service/ServiceInterfaceStubGenerator.fs +++ b/src/Compiler/Service/ServiceInterfaceStubGenerator.fs @@ -41,7 +41,7 @@ module internal CodeGenerationUtils = member _.Unindent i = indentWriter.Indent <- max 0 (indentWriter.Indent - i) - member _.Dump() = indentWriter.InnerWriter.ToString() + member _.Dump() = !! indentWriter.InnerWriter.ToString() interface IDisposable with member _.Dispose() = @@ -154,7 +154,7 @@ module InterfaceStubGenerator = Writer: ColumnIndentedTextWriter /// Map generic types to specific instances for specialized interface implementation - TypeInstantations: Map + TypeInstantiations: Map /// Data for interface instantiation ArgInstantiations: (FSharpGenericParameter * FSharpType) seq @@ -192,7 +192,7 @@ module InterfaceStubGenerator = let genericDefinition = ty.Instantiate(Seq.toList ctx.ArgInstantiations).Format(ctx.DisplayContext) - (genericDefinition, ctx.TypeInstantations) + (genericDefinition, ctx.TypeInstantiations) ||> Map.fold (fun s k v -> s.Replace(k, v)) // Format each argument, including its name and type @@ -680,7 +680,7 @@ module InterfaceStubGenerator = let ctx = { Writer = writer - TypeInstantations = instantiations + TypeInstantiations = instantiations ArgInstantiations = Seq.empty Indentation = indentation ObjectIdent = objectIdent diff --git a/src/Compiler/Service/ServiceLexing.fs b/src/Compiler/Service/ServiceLexing.fs index 9abe2199dc0..37990b026d1 100644 --- a/src/Compiler/Service/ServiceLexing.fs +++ b/src/Compiler/Service/ServiceLexing.fs @@ -392,6 +392,7 @@ module internal TokenClassifications = | HIGH_PRECEDENCE_PAREN_APP | FIXED | HIGH_PRECEDENCE_BRACK_APP + | BAR_JUST_BEFORE_NULL | TYPE_COMING_SOON | TYPE_IS_HERE | MODULE_COMING_SOON @@ -438,7 +439,7 @@ module internal TestExpose = /// many allocated objects. /// /// The encoding is lossy so some incremental lexing scenarios such as deeply nested #if -/// or accurate error messages from lexing for mismtached #if are not supported. +/// or accurate error messages from lexing for mismatched #if are not supported. [] type FSharpTokenizerLexState = { diff --git a/src/Compiler/Service/ServiceNavigation.fs b/src/Compiler/Service/ServiceNavigation.fs index 03afe63b373..48f7d6dc01c 100755 --- a/src/Compiler/Service/ServiceNavigation.fs +++ b/src/Compiler/Service/ServiceNavigation.fs @@ -332,13 +332,21 @@ module NavigationImpl = [ createMember (rcid, NavigationItemKind.Field, FSharpGlyph.Field, range, enclosingEntityKind, false, access) ] - | SynMemberDefn.AutoProperty(ident = id; accessibility = access) -> + | SynMemberDefn.AutoProperty(ident = id; accessibility = access; propKind = propKind) -> + let getterAccessibility, setterAccessibility = access.GetSetAccessNoCheck() + [ - createMember (id, NavigationItemKind.Field, FSharpGlyph.Field, id.idRange, enclosingEntityKind, false, access) + match propKind with + | SynMemberKind.PropertyGetSet -> + yield createMember (id, NavigationItemKind.Field, FSharpGlyph.Field, id.idRange, enclosingEntityKind, false, getterAccessibility) + yield createMember (id, NavigationItemKind.Field, FSharpGlyph.Field, id.idRange, enclosingEntityKind, false, setterAccessibility) + | SynMemberKind.PropertySet -> + yield createMember (id, NavigationItemKind.Field, FSharpGlyph.Field, id.idRange, enclosingEntityKind, false, setterAccessibility) + | _ -> yield createMember (id, NavigationItemKind.Field, FSharpGlyph.Field, id.idRange, enclosingEntityKind, false, getterAccessibility) ] | SynMemberDefn.AbstractSlot(slotSig = SynValSig(ident = SynIdent(id, _); synType = ty; accessibility = access)) -> [ - createMember (id, NavigationItemKind.Method, FSharpGlyph.OverridenMethod, ty.Range, enclosingEntityKind, true, access) + createMember (id, NavigationItemKind.Method, FSharpGlyph.OverridenMethod, ty.Range, enclosingEntityKind, true, access.SingleAccess()) ] | SynMemberDefn.NestedType _ -> failwith "tycon as member????" //processTycon tycon | SynMemberDefn.Interface(members = Some(membs)) -> processMembers membs enclosingEntityKind |> snd @@ -564,10 +572,18 @@ module NavigationImpl = [ for memb in members do match memb with - | SynMemberSig.Member(memberSig = SynValSig.SynValSig(ident = SynIdent(id, _); accessibility = access; range = m)) -> - createMember (id, NavigationItemKind.Method, FSharpGlyph.Method, m, NavigationEntityKind.Class, false, access) + | SynMemberSig.Member(memberSig = SynValSig.SynValSig(ident = SynIdent(id, _); accessibility = access; range = m); flags = { MemberKind = propKind }) -> + let getterAccessibility, setterAccessibility = access.GetSetAccessNoCheck() + + match propKind with + | SynMemberKind.PropertyGetSet -> + yield createMember (id, NavigationItemKind.Method, FSharpGlyph.Method, m, NavigationEntityKind.Class, false, getterAccessibility) + yield createMember (id, NavigationItemKind.Method, FSharpGlyph.Method, m, NavigationEntityKind.Class, false, setterAccessibility) + | SynMemberKind.PropertySet -> + yield createMember (id, NavigationItemKind.Method, FSharpGlyph.Method, m, NavigationEntityKind.Class, false, setterAccessibility) + | _ -> yield createMember (id, NavigationItemKind.Method, FSharpGlyph.Method, m, NavigationEntityKind.Class, false, getterAccessibility) | SynMemberSig.ValField(SynField(idOpt = Some rcid; fieldType = ty; accessibility = access), _) -> - createMember (rcid, NavigationItemKind.Field, FSharpGlyph.Field, ty.Range, NavigationEntityKind.Class, false, access) + yield createMember (rcid, NavigationItemKind.Field, FSharpGlyph.Field, ty.Range, NavigationEntityKind.Class, false, access) | _ -> () ] @@ -577,7 +593,7 @@ module NavigationImpl = for decl in decls do match decl with | SynModuleSigDecl.Val(SynValSig.SynValSig(ident = SynIdent(id, _); accessibility = access; range = m), _) -> - createMember (id, NavigationItemKind.Method, FSharpGlyph.Method, m, NavigationEntityKind.Module, false, access) + createMember (id, NavigationItemKind.Method, FSharpGlyph.Method, m, NavigationEntityKind.Module, false, access.SingleAccess()) | _ -> () ] diff --git a/src/Compiler/Service/ServiceParamInfoLocations.fs b/src/Compiler/Service/ServiceParamInfoLocations.fs index 129a40b93f6..2556111a21a 100755 --- a/src/Compiler/Service/ServiceParamInfoLocations.fs +++ b/src/Compiler/Service/ServiceParamInfoLocations.fs @@ -62,6 +62,7 @@ module internal ParameterLocationsImpl = let isStaticArg (StripParenTypes synType) = match synType with | SynType.StaticConstant _ + | SynType.StaticConstantNull _ | SynType.StaticConstantExpr _ | SynType.StaticConstantNamed _ -> true | SynType.LongIdent _ -> true // NOTE: this is not a static constant, but it is a prefix of incomplete code, e.g. "TP<42, Arg3" is a prefix of "TP<42, Arg3=6>" and Arg3 shows up as a LongId diff --git a/src/Compiler/Service/ServiceParseTreeWalk.fs b/src/Compiler/Service/ServiceParseTreeWalk.fs index c395c9422d2..e0957fe0140 100644 --- a/src/Compiler/Service/ServiceParseTreeWalk.fs +++ b/src/Compiler/Service/ServiceParseTreeWalk.fs @@ -599,9 +599,16 @@ module SyntaxTraversal = | _ -> () for b in binds do yield dive b b.RangeOfBindingWithRhs (traverseSynBinding path) - for SynInterfaceImpl(bindings = binds) in ifaces do + for SynInterfaceImpl(ty, withKeyword, binds, members, range) in ifaces do + let path = + SyntaxNode.SynMemberDefn(SynMemberDefn.Interface(ty, withKeyword, Some members, range)) + :: path + for b in binds do yield dive b b.RangeOfBindingWithRhs (traverseSynBinding path) + + for m in members do + yield dive m m.Range (traverseSynMemberDefn path (fun _ -> None)) ] |> pick expr @@ -831,6 +838,7 @@ module SyntaxTraversal = | SynType.Fun(argType = ty1; returnType = ty2) -> [ ty1; ty2 ] |> List.tryPick (traverseSynType path) | SynType.MeasurePower(ty, _, _) | SynType.HashConstraint(ty, _) + | SynType.WithNull(innerType = ty) | SynType.WithGlobalConstraints(ty, _, _) | SynType.Array(_, ty, _) -> traverseSynType path ty | SynType.StaticConstantNamed(ty1, ty2, _) @@ -840,6 +848,7 @@ module SyntaxTraversal = | SynType.Paren(innerType = t) | SynType.SignatureParameter(usedType = t) -> traverseSynType path t | SynType.Intersection(types = types) -> List.tryPick (traverseSynType path) types + | SynType.StaticConstantNull _ | SynType.Anon _ | SynType.AnonRecd _ | SynType.LongIdent _ @@ -984,6 +993,7 @@ module SyntaxTraversal = x |> normalizeMembersToDealWithPeculiaritiesOfGettersAndSetters path (fun _ -> None) ] + |> pick x | ok -> ok | SynMemberDefn.Inherit(synType, _identOption, range) -> traverseInherit (synType, range) diff --git a/src/Compiler/Service/ServiceParsedInputOps.fs b/src/Compiler/Service/ServiceParsedInputOps.fs index 3f379c0f8b6..0b3f0134545 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fs +++ b/src/Compiler/Service/ServiceParsedInputOps.fs @@ -17,7 +17,7 @@ open FSharp.Compiler.Text.Position open FSharp.Compiler.Text.Range module SourceFileImpl = - let IsSignatureFile file = + let IsSignatureFile (file: string) = let ext = Path.GetExtension file 0 = String.Compare(".fsi", ext, StringComparison.OrdinalIgnoreCase) @@ -70,6 +70,12 @@ type PatternContext = /// Any other position in a pattern that does not need special handling | Other +[] +type MethodOverrideCompletionContext = + | Class + | Interface of mInterfaceName: range + | ObjExpr of mExpr: range + [] type CompletionContext = /// Completion context cannot be determined due to errors @@ -107,7 +113,12 @@ type CompletionContext = | Pattern of context: PatternContext /// Completing a method override (e.g. override this.ToStr|) - | MethodOverride of enclosingTypeNameRange: range + | MethodOverride of + ctx: MethodOverrideCompletionContext * + enclosingTypeNameRange: range * + spacesBeforeOverrideKeyword: int * + hasThis: bool * + isStatic: bool type ShortIdent = string @@ -636,6 +647,7 @@ module ParsedInput = | SynTypeConstraint.WhereTyparIsReferenceType(t, _) -> walkTypar t | SynTypeConstraint.WhereTyparIsUnmanaged(t, _) -> walkTypar t | SynTypeConstraint.WhereTyparSupportsNull(t, _) -> walkTypar t + | SynTypeConstraint.WhereTyparNotSupportsNull(genericName = t) -> walkTypar t | SynTypeConstraint.WhereTyparIsComparable(t, _) -> walkTypar t | SynTypeConstraint.WhereTyparIsEquatable(t, _) -> walkTypar t | SynTypeConstraint.WhereTyparSubtypeOfType(t, ty, _) -> walkTypar t |> Option.orElseWith (fun () -> walkType ty) @@ -699,6 +711,7 @@ module ParsedInput = | SynType.Array(_, t, _) -> walkType t | SynType.Fun(argType = t1; returnType = t2) -> walkType t1 |> Option.orElseWith (fun () -> walkType t2) | SynType.WithGlobalConstraints(t, _, _) -> walkType t + | SynType.WithNull(innerType = t) | SynType.HashConstraint(t, _) -> walkType t | SynType.Or(t1, t2, _, _) -> walkType t1 |> Option.orElseWith (fun () -> walkType t2) | SynType.MeasurePower(t, _, _) -> walkType t @@ -707,6 +720,7 @@ module ParsedInput = | SynType.StaticConstantExpr(e, _) -> walkExpr e | SynType.StaticConstantNamed(ident, value, _) -> List.tryPick walkType [ ident; value ] | SynType.Intersection(types = types) -> List.tryPick walkType types + | SynType.StaticConstantNull _ | SynType.Anon _ | SynType.AnonRecd _ | SynType.LongIdent _ @@ -1076,6 +1090,20 @@ module ParsedInput = | Operator "op_Equality" (SynExpr.Ident id, _) -> Some id | _ -> None + let posAfterRangeAndBetweenSpaces (lineStr: string) (m: range) pos = + let rec loop max i = + if i >= lineStr.Length || i >= max then true + elif Char.IsWhiteSpace lineStr[i] then loop max (i + 1) + else false + + posGt pos m.End && pos.Line = m.End.Line && loop pos.Column m.End.Column + + let rangeContainsPosOrIsSpacesBetweenRangeAndPos (lineStr: string) m pos = + rangeContainsPos m pos + // pos is before m + || posLt pos m.Start + || posAfterRangeAndBetweenSpaces lineStr m pos + let findSetters argList = match argList with | SynExpr.Paren(SynExpr.Tuple(false, parameters, _, _), _, _, _) -> @@ -1434,6 +1462,12 @@ module ParsedInput = |> List.tryPick (fun pat -> TryGetCompletionContextInPattern true pat None pos) |> Option.orElseWith (fun () -> defaultTraverse expr) + // { new | } + | SynExpr.ComputationExpr(expr = SynExpr.ArbitraryAfterError _) when + lineStr.Trim().Split(' ') |> Array.contains "new" + -> + Some(CompletionContext.Inherit(InheritanceContext.Unknown, ([], None))) + | _ -> defaultTraverse expr member _.VisitRecordField(path, copyOpt, field) = @@ -1491,36 +1525,123 @@ module ParsedInput = (SynBinding(headPat = headPat; trivia = trivia; returnInfo = returnInfo) as synBinding) ) = - let isOverride leadingKeyword = + let isOverrideOrMember leadingKeyword = + match leadingKeyword with + | SynLeadingKeyword.Override _ + | SynLeadingKeyword.Member _ -> true + | _ -> false + + let isStaticMember leadingKeyword = + match leadingKeyword with + | SynLeadingKeyword.StaticMember _ -> true + | _ -> false + + let isMember leadingKeyword = match leadingKeyword with - | SynLeadingKeyword.Override _ -> true + | SynLeadingKeyword.Member _ -> true | _ -> false - let overrideContext path = + let overrideContext path (mOverride: range) hasThis isStatic isMember = match path with - | _ :: SyntaxNode.SynTypeDefn(SynTypeDefn(typeInfo = SynComponentInfo(longId = [ enclosingType ]))) :: _ -> - Some(CompletionContext.MethodOverride enclosingType.idRange) + | _ :: SyntaxNode.SynTypeDefn(SynTypeDefn(typeInfo = SynComponentInfo(longId = [ enclosingType ]))) :: _ when + not isMember + -> + Some( + CompletionContext.MethodOverride( + MethodOverrideCompletionContext.Class, + enclosingType.idRange, + mOverride.StartColumn, + hasThis, + isStatic + ) + ) + | SyntaxNode.SynMemberDefn(SynMemberDefn.Interface(interfaceType = ty)) :: SyntaxNode.SynTypeDefn(SynTypeDefn( + typeInfo = SynComponentInfo(longId = [ enclosingType ]))) :: _ + | _ :: SyntaxNode.SynMemberDefn(SynMemberDefn.Interface(interfaceType = ty)) :: SyntaxNode.SynTypeDefn(SynTypeDefn( + typeInfo = SynComponentInfo(longId = [ enclosingType ]))) :: _ -> + let ty = + match ty with + | SynType.App(typeName = ty) -> ty + | _ -> ty + + Some( + CompletionContext.MethodOverride( + MethodOverrideCompletionContext.Interface ty.Range, + enclosingType.idRange, + mOverride.StartColumn, + hasThis, + isStatic + ) + ) + | SyntaxNode.SynMemberDefn(SynMemberDefn.Interface(interfaceType = ty)) :: (SyntaxNode.SynExpr(SynExpr.ObjExpr _) as expr) :: _ + | _ :: SyntaxNode.SynMemberDefn(SynMemberDefn.Interface(interfaceType = ty)) :: (SyntaxNode.SynExpr(SynExpr.ObjExpr _) as expr) :: _ -> + let ty = + match ty with + | SynType.App(typeName = ty) -> ty + | _ -> ty + + Some( + CompletionContext.MethodOverride( + MethodOverrideCompletionContext.ObjExpr expr.Range, + ty.Range, + mOverride.StartColumn, + hasThis, + isStatic + ) + ) + | SyntaxNode.SynExpr(SynExpr.ObjExpr(objType = ty)) as expr :: _ -> + let ty = + match ty with + | SynType.App(typeName = ty) -> ty + | _ -> ty + + Some( + CompletionContext.MethodOverride( + MethodOverrideCompletionContext.ObjExpr expr.Range, + ty.Range, + mOverride.StartColumn, + hasThis, + isStatic + ) + ) | _ -> Some CompletionContext.Invalid match returnInfo with - | Some(SynBindingReturnInfo(range = m)) when rangeContainsPos m pos -> Some CompletionContext.Type + | Some(SynBindingReturnInfo(range = m)) when rangeContainsPosOrIsSpacesBetweenRangeAndPos lineStr m pos -> + Some CompletionContext.Type | _ -> match headPat with + // static member | + | SynPat.FromParseError _ when isStaticMember trivia.LeadingKeyword -> + overrideContext path trivia.LeadingKeyword.Range false true false + + // override | + | SynPat.FromParseError _ when isOverrideOrMember trivia.LeadingKeyword && lineStr.[pos.Column - 1] = ' ' -> + overrideContext path trivia.LeadingKeyword.Range false false (isMember trivia.LeadingKeyword) + // override _.| - | SynPat.FromParseError _ when isOverride trivia.LeadingKeyword -> overrideContext path + | SynPat.FromParseError _ when isOverrideOrMember trivia.LeadingKeyword -> + overrideContext path trivia.LeadingKeyword.Range true false (isMember trivia.LeadingKeyword) // override this.| | SynPat.Named(ident = SynIdent(ident = selfId)) when - isOverride trivia.LeadingKeyword && selfId.idRange.End.IsAdjacentTo pos + isOverrideOrMember trivia.LeadingKeyword && selfId.idRange.End.IsAdjacentTo pos -> - overrideContext path + overrideContext path trivia.LeadingKeyword.Range true false (isMember trivia.LeadingKeyword) // override this.ToStr| | SynPat.LongIdent(longDotId = SynLongIdent(id = [ _; methodId ])) when - isOverride trivia.LeadingKeyword && rangeContainsPos methodId.idRange pos + isOverrideOrMember trivia.LeadingKeyword + && rangeContainsPos methodId.idRange pos + -> + overrideContext path trivia.LeadingKeyword.Range true false (isMember trivia.LeadingKeyword) + + // static member A| + | SynPat.LongIdent(longDotId = SynLongIdent(id = [ methodId ])) when + isStaticMember trivia.LeadingKeyword && rangeContainsPos methodId.idRange pos -> - overrideContext path + overrideContext path trivia.LeadingKeyword.Range false true false | SynPat.LongIdent(longDotId = lidwd; argPats = SynArgPats.Pats pats; range = m) when rangeContainsPos m pos -> if rangeContainsPos lidwd.Range pos then @@ -1633,7 +1754,7 @@ module ParsedInput = None // module Namespace.Top - // module Neste| + // module Nested | SynModuleDecl.NestedModule(moduleInfo = SynComponentInfo(longId = [ ident ])) when rangeContainsPos ident.idRange pos -> Some CompletionContext.Invalid @@ -1708,6 +1829,12 @@ module ParsedInput = Some(CompletionContext.ParameterList(att.TypeName.Range.End, findSetters att.ArgExpr)) else None) + + override _.VisitInterfaceSynMemberDefnType(_, synType: SynType) = + match synType with + | SynType.FromParseError(range = m) when rangeContainsPosOrIsSpacesBetweenRangeAndPos lineStr m pos -> + Some(CompletionContext.Inherit(InheritanceContext.Interface, ([], None))) + | _ -> None } let ctxt = SyntaxTraversal.Traverse(pos, parsedInput, visitor) @@ -1787,6 +1914,7 @@ module ParsedInput = | SynTypeConstraint.WhereTyparIsReferenceType(t, _) | SynTypeConstraint.WhereTyparIsUnmanaged(t, _) | SynTypeConstraint.WhereTyparSupportsNull(t, _) + | SynTypeConstraint.WhereTyparNotSupportsNull(genericName = t) | SynTypeConstraint.WhereTyparIsComparable(t, _) | SynTypeConstraint.WhereTyparIsEquatable(t, _) -> walkTypar t | SynTypeConstraint.WhereTyparDefaultsToType(t, ty, _) @@ -1848,6 +1976,7 @@ module ParsedInput = | SynType.Array(_, t, _) | SynType.HashConstraint(t, _) | SynType.MeasurePower(t, _, _) + | SynType.WithNull(innerType = t) | SynType.Paren(t, _) | SynType.SignatureParameter(usedType = t) -> walkType t | SynType.Fun(argType = t1; returnType = t2) @@ -1868,6 +1997,7 @@ module ParsedInput = walkType ident walkType value | SynType.Intersection(types = types) -> List.iter walkType types + | SynType.StaticConstantNull _ | SynType.Anon _ | SynType.AnonRecd _ | SynType.Var _ diff --git a/src/Compiler/Service/ServiceParsedInputOps.fsi b/src/Compiler/Service/ServiceParsedInputOps.fsi index 336e6213a7a..427ffda43aa 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fsi +++ b/src/Compiler/Service/ServiceParsedInputOps.fsi @@ -42,6 +42,12 @@ type public PatternContext = /// Any other position in a pattern that does not need special handling | Other +[] +type MethodOverrideCompletionContext = + | Class + | Interface of mInterfaceName: range + | ObjExpr of mExpr: range + [] type public CompletionContext = /// Completion context cannot be determined due to errors @@ -79,7 +85,12 @@ type public CompletionContext = | Pattern of context: PatternContext /// Completing a method override (e.g. override this.ToStr|) - | MethodOverride of enclosingTypeNameRange: range + | MethodOverride of + ctx: MethodOverrideCompletionContext * + enclosingTypeNameRange: range * + spacesBeforeOverrideKeyword: int * + hasThis: bool * + isStatic: bool type public ModuleKind = { IsAutoOpen: bool diff --git a/src/Compiler/Service/ServiceStructure.fsi b/src/Compiler/Service/ServiceStructure.fsi index 6c09e63e991..87711629676 100644 --- a/src/Compiler/Service/ServiceStructure.fsi +++ b/src/Compiler/Service/ServiceStructure.fsi @@ -65,7 +65,7 @@ module public Structure = | Comment | XmlDocComment - /// Stores the range for a construct, the sub-range that should be collapsed for outlinging, + /// Stores the range for a construct, the sub-range that should be collapsed for outlining, /// a tag for the construct type, and a tag for the collapse style [] type ScopeRange = diff --git a/src/Compiler/Service/SynExpr.fs b/src/Compiler/Service/SynExpr.fs index a5904621ca6..e9605582514 100644 --- a/src/Compiler/Service/SynExpr.fs +++ b/src/Compiler/Service/SynExpr.fs @@ -519,7 +519,7 @@ module SynExpr = if startLine = endLine then range.StartColumn <= outerOffsidesColumn else - let rec loop offsides lineNo startCol = + let rec loop offsides lineNo (startCol: int) = if lineNo <= endLine then let line = getSourceLineStr lineNo diff --git a/src/Compiler/Service/SynPat.fs b/src/Compiler/Service/SynPat.fs index 8ed9cd69ff1..c94448ce318 100644 --- a/src/Compiler/Service/SynPat.fs +++ b/src/Compiler/Service/SynPat.fs @@ -28,23 +28,6 @@ module SynPat = else ValueNone - /// Matches if any member in the given list is an inherit - /// or implementation of an interface with generic type args. - [] - let (|AnyGenericInheritOrInterfaceImpl|_|) members = - if - members - |> List.exists (function - | SynMemberDefn.ImplicitInherit(inheritType = SynType.App(typeArgs = _ :: _)) - | SynMemberDefn.ImplicitInherit(inheritType = SynType.LongIdentApp(typeArgs = _ :: _)) - | SynMemberDefn.Interface(interfaceType = SynType.App(typeArgs = _ :: _)) - | SynMemberDefn.Interface(interfaceType = SynType.LongIdentApp(typeArgs = _ :: _)) -> true - | _ -> false) - then - ValueSome AnyGenericInheritOrInterfaceImpl - else - ValueNone - /// Matches the rightmost potentially dangling nested pattern. let rec (|Rightmost|) pat = match pat with @@ -182,15 +165,20 @@ module SynPat = // type C<'T> = abstract M : 'T -> unit // let _ = { new C with override _.M (()) = () } // let _ = { new C with override _.M ((x, y)) = () } + // + // Single versus double parens are also compiled differently in cases like these: + // + // type T = + // static member M () = () // .method public static void M() + // static member M (()) = () // .method public static void M(class [FSharp.Core]Microsoft.FSharp.Core.Unit _arg1) + // static member M (_ : int, _ : int) = () // .method public static void M(int32 _arg1, int32 _arg2) + // static member M ((_ : int, _ : int)) = () // .method public static void M(class [System.Runtime]System.Tuple`2 _arg1) | SynPat.Paren((SynPat.Const(SynConst.Unit, _) | SynPat.Tuple(isStruct = false)), _), - SyntaxNode.SynPat(SynPat.LongIdent _) :: SyntaxNode.SynBinding _ :: SyntaxNode.SynExpr(SynExpr.ObjExpr( - objType = SynType.App(typeArgs = _ :: _) | SynType.LongIdentApp(typeArgs = _ :: _))) :: _ + SyntaxNode.SynPat(SynPat.LongIdent _) :: SyntaxNode.SynBinding _ :: _ | SynPat.Tuple(isStruct = false), - SyntaxNode.SynPat(SynPat.Paren _) :: SyntaxNode.SynPat(SynPat.LongIdent _) :: SyntaxNode.SynBinding _ :: SyntaxNode.SynExpr(SynExpr.ObjExpr( - objType = SynType.App(typeArgs = _ :: _) | SynType.LongIdentApp(typeArgs = _ :: _))) :: _ + SyntaxNode.SynPat(SynPat.Paren _) :: SyntaxNode.SynPat(SynPat.LongIdent _) :: SyntaxNode.SynBinding _ :: _ | SynPat.Paren((SynPat.Const(SynConst.Unit, _) | SynPat.Tuple(isStruct = false)), _), - SyntaxNode.SynPat(SynPat.LongIdent _) :: SyntaxNode.SynBinding _ :: SyntaxNode.SynMemberDefn _ :: SyntaxNode.SynTypeDefn(SynTypeDefn( - typeRepr = SynTypeDefnRepr.ObjectModel(members = AnyGenericInheritOrInterfaceImpl))) :: _ -> true + SyntaxNode.SynPat(SynPat.LongIdent _) :: SyntaxNode.SynBinding _ :: SyntaxNode.SynMemberDefn _ :: _ -> true // Not required: // diff --git a/src/Compiler/Service/TransparentCompiler.fs b/src/Compiler/Service/TransparentCompiler.fs index b813ca180af..65d61fa5927 100644 --- a/src/Compiler/Service/TransparentCompiler.fs +++ b/src/Compiler/Service/TransparentCompiler.fs @@ -587,7 +587,8 @@ type internal TransparentCompiler tcConfig.primaryAssembly.Name, tcConfig.GetTargetFrameworkDirectories(), tcConfig.fsharpBinariesDir, - tcConfig.langVersion.SpecifiedVersion + tcConfig.langVersion.SpecifiedVersion, + tcConfig.checkNullness ) caches.FrameworkImports.Get( @@ -869,6 +870,10 @@ type internal TransparentCompiler define :: tcConfigB.conditionalDefines + tcConfigB.realsig <- + List.contains "--realsig" commandLineArgs + || List.contains "--realsig+" commandLineArgs + tcConfigB.projectReferences <- projectReferences tcConfigB.useSimpleResolution <- useSimpleResolution @@ -884,7 +889,7 @@ type internal TransparentCompiler { new IXmlDocumentationInfoLoader with /// Try to load xml documentation associated with an assembly by the same file path with the extension ".xml". member _.TryLoad(assemblyFileName) = - let xmlFileName = Path.ChangeExtension(assemblyFileName, ".xml") + let xmlFileName = !! Path.ChangeExtension(assemblyFileName, ".xml") // REVIEW: File IO - Will eventually need to change this to use a file system interface of some sort. XmlDocumentationInfo.TryCreateFromFile(xmlFileName) @@ -910,7 +915,7 @@ type internal TransparentCompiler Activity.start "ComputeBootstrapInfoStatic" [| - Activity.Tags.project, projectSnapshot.ProjectFileName |> Path.GetFileName + Activity.Tags.project, projectSnapshot.ProjectFileName |> Path.GetFileName |> (!!) "references", projectSnapshot.ReferencedProjects.Length.ToString() |] @@ -1064,7 +1069,11 @@ type internal TransparentCompiler projectSnapshot.NoFileVersionsKey, async { use _ = - Activity.start "ComputeBootstrapInfo" [| Activity.Tags.project, projectSnapshot.ProjectFileName |> Path.GetFileName |] + Activity.start + "ComputeBootstrapInfo" + [| + Activity.Tags.project, projectSnapshot.ProjectFileName |> Path.GetFileName |> (!!) + |] // Trap and report diagnostics from creation. let delayedLogger = CapturingDiagnosticsLogger("IncrementalBuilderCreation") @@ -1232,8 +1241,9 @@ type internal TransparentCompiler //Trace.TraceInformation("\n" + debugGraph) - if Activity.Current <> null then - Activity.Current.AddTag("graph", debugGraph) |> ignore + match Activity.Current with + | Null -> () + | NonNull a -> a.AddTag("graph", debugGraph) |> ignore return nodeGraph, graph } @@ -1337,7 +1347,7 @@ type internal TransparentCompiler Activity.start "ComputeTcIntermediate" [| - Activity.Tags.fileName, fileName |> Path.GetFileName + Activity.Tags.fileName, fileName |> Path.GetFileName |> (!!) "key", key.GetLabel() "version", "-" // key.GetVersion() |] @@ -1365,18 +1375,23 @@ type internal TransparentCompiler // Apply nowarns to tcConfig (may generate errors, so ensure diagnosticsLogger is installed) let tcConfig = - ApplyNoWarnsToTcConfig(tcConfig, parsedMainInput, Path.GetDirectoryName mainInputFileName) + ApplyNoWarnsToTcConfig(tcConfig, parsedMainInput, !! Path.GetDirectoryName(mainInputFileName)) let diagnosticsLogger = errHandler.DiagnosticsLogger let diagnosticsLogger = - GetDiagnosticsLoggerFilteringByScopedPragmas(false, input.ScopedPragmas, tcConfig.diagnosticsOptions, diagnosticsLogger) + GetDiagnosticsLoggerFilteringByScopedPragmas( + tcConfig.langVersion, + input.ScopedPragmas, + tcConfig.diagnosticsOptions, + diagnosticsLogger + ) use _ = new CompilationGlobalsScope(diagnosticsLogger, BuildPhase.TypeCheck) //beforeFileChecked.Trigger fileName - ApplyMetaCommandsFromInputToTcConfig(tcConfig, input, Path.GetDirectoryName fileName, tcImports.DependencyProvider) + ApplyMetaCommandsFromInputToTcConfig(tcConfig, input, Path.GetDirectoryName fileName |> (!!), tcImports.DependencyProvider) |> ignore let sink = TcResultsSinkImpl(tcGlobals, file.SourceText) @@ -1396,7 +1411,7 @@ type internal TransparentCompiler let! finisher = CheckOneInputWithCallback nodeToCheck - ((fun () -> hadParseErrors || diagnosticsLogger.ErrorCount > 0), + ((fun () -> hadParseErrors || diagnosticsLogger.CheckForRealErrorsIgnoringWarnings), tcConfig, tcImports, tcGlobals, @@ -1543,7 +1558,7 @@ type internal TransparentCompiler let file = projectSnapshot.SourceFiles |> List.last use _ = - Activity.start "ComputeTcLastFile" [| Activity.Tags.fileName, file.FileName |> Path.GetFileName |] + Activity.start "ComputeTcLastFile" [| Activity.Tags.fileName, file.FileName |> Path.GetFileName |> (!!) |] let! projectSnapshot = parseSourceFiles projectSnapshot bootstrapInfo.TcConfig @@ -1597,7 +1612,7 @@ type internal TransparentCompiler projectSnapshot.FileKeyWithExtraFileSnapshotVersion fileName, async { use _ = - Activity.start "ComputeParseAndCheckFileInProject" [| Activity.Tags.fileName, fileName |> Path.GetFileName |] + Activity.start "ComputeParseAndCheckFileInProject" [| Activity.Tags.fileName, fileName |> Path.GetFileName |> (!!) |] match! ComputeBootstrapInfo projectSnapshot with | None, creationDiags -> return emptyParseResult fileName creationDiags, FSharpCheckFileAnswer.Aborted @@ -1629,7 +1644,7 @@ type internal TransparentCompiler // Apply nowarns to tcConfig (may generate errors, so ensure diagnosticsLogger is installed) let tcConfig = - ApplyNoWarnsToTcConfig(bootstrapInfo.TcConfig, parseResults.ParseTree, Path.GetDirectoryName fileName) + ApplyNoWarnsToTcConfig(bootstrapInfo.TcConfig, parseResults.ParseTree, Path.GetDirectoryName fileName |> (!!)) let diagnosticsOptions = tcConfig.diagnosticsOptions @@ -1711,7 +1726,9 @@ type internal TransparentCompiler use _ = Activity.start "ComputeParseAndCheckAllFilesInProject" - [| Activity.Tags.project, projectSnapshot.ProjectFileName |> Path.GetFileName |] + [| + Activity.Tags.project, projectSnapshot.ProjectFileName |> Path.GetFileName |> (!!) + |] let! projectSnapshot = parseSourceFiles projectSnapshot bootstrapInfo.TcConfig @@ -1810,14 +1827,14 @@ type internal TransparentCompiler let assemblyDataResult = try - // Assemblies containing type provider components can not successfully be used via cross-assembly references. + // Assemblies containing type provider components cannot successfully be used via cross-assembly references. // We return 'None' for the assembly portion of the cross-assembly reference let hasTypeProviderAssemblyAttrib = topAttrs.assemblyAttrs |> List.exists (fun (Attrib(tcref, _, _, _, _, _, _)) -> let nm = tcref.CompiledRepresentationForNamedType.BasicQualifiedName - nm = typeof.FullName) + nm = !!typeof.FullName) if tcState.CreatesGeneratedProvidedTypes || hasTypeProviderAssemblyAttrib then ProjectAssemblyDataResult.Unavailable true @@ -1856,7 +1873,7 @@ type internal TransparentCompiler None // TODO: This kinda works, but the problem is that in order to switch a project to "in-memory" mode - // - some file needs to be edited (this tirggers a re-check, but LastModifiedTimeOnDisk won't change) + // - some file needs to be edited (this triggers a re-check, but LastModifiedTimeOnDisk won't change) // - saved (this will not trigger anything) // - and then another change has to be made (to any file buffer) - so that recheck is triggered and we get here again // Until that sequence happens the project will be used from disk (if available). @@ -1983,7 +2000,7 @@ type internal TransparentCompiler projectSnapshot.FileKey fileName, async { use _ = - Activity.start "ComputeSemanticClassification" [| Activity.Tags.fileName, fileName |> Path.GetFileName |] + Activity.start "ComputeSemanticClassification" [| Activity.Tags.fileName, fileName |> Path.GetFileName |> (!!) |] let! sinkOpt = tryGetSink fileName projectSnapshot @@ -2013,7 +2030,7 @@ type internal TransparentCompiler projectSnapshot.FileKey fileName, async { use _ = - Activity.start "ComputeItemKeyStore" [| Activity.Tags.fileName, fileName |> Path.GetFileName |] + Activity.start "ComputeItemKeyStore" [| Activity.Tags.fileName, fileName |> Path.GetFileName |> (!!) |] let! sinkOpt = tryGetSink fileName projectSnapshot diff --git a/src/Compiler/Service/service.fs b/src/Compiler/Service/service.fs index 5a1535b6f2d..2c915870f84 100644 --- a/src/Compiler/Service/service.fs +++ b/src/Compiler/Service/service.fs @@ -641,6 +641,8 @@ type FSharpChecker if isEditing then tcConfigB.conditionalDefines <- "EDITING" :: tcConfigB.conditionalDefines + tcConfigB.realsig <- List.contains "--realsig" argv || List.contains "--realsig+" argv + // Apply command-line arguments and collect more source files if they are in the arguments let sourceFilesNew = ApplyCommandLineArgs(tcConfigB, sourceFiles, argv) FSharpParsingOptions.FromTcConfigBuilder(tcConfigB, Array.ofList sourceFilesNew, isInteractive), errorScope.Diagnostics @@ -751,14 +753,14 @@ type CompilerEnvironment() = static member IsScriptFile(fileName: string) = ParseAndCheckInputs.IsScript fileName /// Whether or not this file is compilable - static member IsCompilable file = + static member IsCompilable(file: string) = let ext = Path.GetExtension file compilableExtensions |> List.exists (fun e -> 0 = String.Compare(e, ext, StringComparison.OrdinalIgnoreCase)) /// Whether or not this file should be a single-file project - static member MustBeSingleFileProject file = + static member MustBeSingleFileProject(file: string) = let ext = Path.GetExtension file singleFileProjectExtensions diff --git a/src/Compiler/Service/service.fsi b/src/Compiler/Service/service.fsi index 5e78154d77e..0a6c601344c 100644 --- a/src/Compiler/Service/service.fsi +++ b/src/Compiler/Service/service.fsi @@ -34,7 +34,7 @@ type public FSharpChecker = /// Indicate whether name suggestion should be enabled /// Indicate whether all symbol uses should be kept in background checking /// Indicates whether a table of symbol keys should be kept for background compilation - /// Indicates whether to perform partial type checking. Cannot be set to true if keepAssmeblyContents is true. If set to true, can cause duplicate type-checks when richer information on a file is needed, but can skip background type-checking entirely on implementation files with signature files. + /// Indicates whether to perform partial type checking. Cannot be set to true if keepAssemblyContents is true. If set to true, can cause duplicate type-checks when richer information on a file is needed, but can skip background type-checking entirely on implementation files with signature files. /// Indicates whether to resolve references in parallel. /// When set to true we create a set of all identifiers for each parsed file which can be used to speed up finding references. /// Default: FileSystem. You can use Custom source to provide a function that will return the source for a given file path instead of reading it from the file system. Note that with this option the FSharpChecker will also not monitor the file system for file changes. It will expect to be notified of changes via the NotifyFileChanged method. @@ -114,7 +114,7 @@ type public FSharpChecker = /// The path for the file. The file name is also as a module name for implicit top level modules (e.g. in scripts). /// The source to be parsed. /// Parsing options for the project or script. - /// Store the parse in a size-limited cache assocaited with the FSharpChecker. Default: true + /// Store the parse in a size-limited cache associated with the FSharpChecker. Default: true /// An optional string used for tracing compiler operations associated with this request. [] member ParseFileInProject: diff --git a/src/Compiler/Symbols/Exprs.fs b/src/Compiler/Symbols/Exprs.fs index 4d0b994f35b..15b1bb2a3f6 100644 --- a/src/Compiler/Symbols/Exprs.fs +++ b/src/Compiler/Symbols/Exprs.fs @@ -327,7 +327,7 @@ module FSharpExprConvert = let ConvILTypeRefApp (cenv: SymbolEnv) m tref tyargs = let tcref = Import.ImportILTypeRef cenv.amap m tref - ConvType cenv (mkAppTy tcref tyargs) + ConvType cenv (mkWoNullAppTy tcref tyargs) let ConvUnionCaseRef cenv (ucref: UnionCaseRef) = FSharpUnionCase(cenv, ucref) @@ -378,7 +378,7 @@ module FSharpExprConvert = // Large lists | Expr.Op (TOp.UnionCase ucref, tyargs, [e1;e2], _) -> let mkR = ConvUnionCaseRef cenv ucref - let typR = ConvType cenv (mkAppTy ucref.TyconRef tyargs) + let typR = ConvType cenv (mkWoNullAppTy ucref.TyconRef tyargs) let e1R = ConvExpr cenv env e1 // tail recursive ConvExprLinear cenv env e2 (contF << (fun e2R -> E.NewUnionCase(typR, mkR, [e1R; e2R]) )) @@ -622,7 +622,7 @@ module FSharpExprConvert = match op, tyargs, args with | TOp.UnionCase ucref, _, _ -> let mkR = ConvUnionCaseRef cenv ucref - let typR = ConvType cenv (mkAppTy ucref.TyconRef tyargs) + let typR = ConvType cenv (mkWoNullAppTy ucref.TyconRef tyargs) let argsR = ConvExprs cenv env args E.NewUnionCase(typR, mkR, argsR) @@ -637,13 +637,13 @@ module FSharpExprConvert = E.NewTuple(tyR, argsR) | TOp.Recd (_, tcref), _, _ -> - let typR = ConvType cenv (mkAppTy tcref tyargs) + let typR = ConvType cenv (mkWoNullAppTy tcref tyargs) let argsR = ConvExprs cenv env args E.NewRecord(typR, argsR) | TOp.UnionCaseFieldGet (ucref, n), tyargs, [e1] -> let mkR = ConvUnionCaseRef cenv ucref - let typR = ConvType cenv (mkAppTy ucref.TyconRef tyargs) + let typR = ConvType cenv (mkWoNullAppTy ucref.TyconRef tyargs) let projR = FSharpField(cenv, ucref, n) E.UnionCaseGet(ConvExpr cenv env e1, typR, mkR, projR) @@ -653,7 +653,7 @@ module FSharpExprConvert = | TOp.UnionCaseFieldSet (ucref, n), tyargs, [e1;e2] -> let mkR = ConvUnionCaseRef cenv ucref - let typR = ConvType cenv (mkAppTy ucref.TyconRef tyargs) + let typR = ConvType cenv (mkWoNullAppTy ucref.TyconRef tyargs) let projR = FSharpField(cenv, ucref, n) E.UnionCaseSet(ConvExpr cenv env e1, typR, mkR, projR, ConvExpr cenv env e2) @@ -665,13 +665,13 @@ module FSharpExprConvert = | TOp.ValFieldGet rfref, tyargs, [] -> let projR = ConvRecdFieldRef cenv rfref - let typR = ConvType cenv (mkAppTy rfref.TyconRef tyargs) + let typR = ConvType cenv (mkWoNullAppTy rfref.TyconRef tyargs) E.FSharpFieldGet(None, typR, projR) | TOp.ValFieldGet rfref, tyargs, [obj] -> let objR = ConvLValueExpr cenv env obj let projR = ConvRecdFieldRef cenv rfref - let typR = ConvType cenv (mkAppTy rfref.TyconRef tyargs) + let typR = ConvType cenv (mkWoNullAppTy rfref.TyconRef tyargs) E.FSharpFieldGet(Some objR, typR, projR) | TOp.TupleFieldGet (tupInfo, n), tyargs, [e] -> @@ -775,7 +775,7 @@ module FSharpExprConvert = let argTy2 = tyOfExpr g arg2 let resTy = match getMeasureOfType g argTy1, getMeasureOfType g argTy2 with - | Some (tcref, ms1), Some (_tcref2, ms2) -> mkAppTy tcref [TType_measure (Measure.Prod(ms1, if isMul then ms2 else Measure.Inv ms2))] + | Some (tcref, ms1), Some (_tcref2, ms2) -> mkWoNullAppTy tcref [TType_measure (Measure.Prod(ms1, if isMul then ms2 else Measure.Inv ms2))] | Some _, None -> argTy1 | None, Some _ -> argTy2 | None, None -> argTy1 @@ -805,18 +805,18 @@ module FSharpExprConvert = E.ILAsm(sprintf "%+A" instrs, ConvTypes cenv tyargs, ConvExprs cenv env args) | TOp.ExnConstr tcref, tyargs, args -> - E.NewRecord(ConvType cenv (mkAppTy tcref tyargs), ConvExprs cenv env args) + E.NewRecord(ConvType cenv (mkWoNullAppTy tcref tyargs), ConvExprs cenv env args) | TOp.ValFieldSet rfref, _tinst, [obj;arg] -> let objR = ConvLValueExpr cenv env obj let argR = ConvExpr cenv env arg - let typR = ConvType cenv (mkAppTy rfref.TyconRef tyargs) + let typR = ConvType cenv (mkWoNullAppTy rfref.TyconRef tyargs) let projR = ConvRecdFieldRef cenv rfref E.FSharpFieldSet(Some objR, typR, projR, argR) | TOp.ValFieldSet rfref, _tinst, [arg] -> let argR = ConvExpr cenv env arg - let typR = ConvType cenv (mkAppTy rfref.TyconRef tyargs) + let typR = ConvType cenv (mkWoNullAppTy rfref.TyconRef tyargs) let projR = ConvRecdFieldRef cenv rfref E.FSharpFieldSet(None, typR, projR, argR) @@ -824,16 +824,16 @@ module FSharpExprConvert = let exnc = stripExnEqns tcref let fspec = exnc.TrueInstanceFieldsAsList[i] let fref = mkRecdFieldRef tcref fspec.LogicalName - let typR = ConvType cenv (mkAppTy tcref tyargs) - let objR = ConvExpr cenv env (mkCoerceExpr (obj, mkAppTy tcref [], m, g.exn_ty)) + let typR = ConvType cenv (mkWoNullAppTy tcref tyargs) + let objR = ConvExpr cenv env (mkCoerceExpr (obj, mkWoNullAppTy tcref [], m, g.exn_ty)) E.FSharpFieldGet(Some objR, typR, ConvRecdFieldRef cenv fref) | TOp.ExnFieldSet (tcref, i), [], [obj;e2] -> let exnc = stripExnEqns tcref let fspec = exnc.TrueInstanceFieldsAsList[i] let fref = mkRecdFieldRef tcref fspec.LogicalName - let typR = ConvType cenv (mkAppTy tcref tyargs) - let objR = ConvExpr cenv env (mkCoerceExpr (obj, mkAppTy tcref [], m, g.exn_ty)) + let typR = ConvType cenv (mkWoNullAppTy tcref tyargs) + let objR = ConvExpr cenv env (mkCoerceExpr (obj, mkWoNullAppTy tcref [], m, g.exn_ty)) E.FSharpFieldSet(Some objR, typR, ConvRecdFieldRef cenv fref, ConvExpr cenv env e2) | TOp.Coerce, [tgtTy;srcTy], [x] -> @@ -896,7 +896,7 @@ module FSharpExprConvert = | TOp.UnionCaseProof _, _, [e] -> ConvExprPrim cenv env e // Note: we erase the union case proof conversions when converting to quotations | TOp.UnionCaseTagGet tycr, tyargs, [arg1] -> - let typR = ConvType cenv (mkAppTy tycr tyargs) + let typR = ConvType cenv (mkWoNullAppTy tycr tyargs) E.UnionCaseTag(ConvExpr cenv env arg1, typR) | TOp.TraitCall traitInfo, _, _ -> @@ -1019,7 +1019,7 @@ module FSharpExprConvert = | [v] -> makeFSCall isMember v | [] -> - let typR = ConvType cenv (mkAppTy tcref enclTypeArgs) + let typR = ConvType cenv (mkWoNullAppTy tcref enclTypeArgs) if enclosingEntity.IsModuleOrNamespace then let findModuleMemberByName = enclosingEntity.ModuleOrNamespaceType.AllValsAndMembers @@ -1149,9 +1149,12 @@ module FSharpExprConvert = // TODO: this will not work for curried methods in F# classes. // This is difficult to solve as the information in the ILMethodRef // is not sufficient to resolve to a symbol unambiguously in these cases. - let argTys = [ ilMethRef.ArgTypes |> List.map (ImportILTypeFromMetadata cenv.amap m scoref tinst1 tinst2) ] + + // If this was an ILTycon with potential nullness, try1 is Some(..) and this branch not hit + let argTys = [ ilMethRef.ArgTypes |> List.map (ImportILTypeFromMetadataSkipNullness cenv.amap m scoref tinst1 tinst2) ] let retTy = - match ImportReturnTypeFromMetadata cenv.amap m ilMethRef.ReturnType (fun _ -> emptyILCustomAttrs) scoref tinst1 tinst2 with + let nullableAttributes = Import.Nullness.NullableAttributesSource.Empty + match ImportReturnTypeFromMetadata cenv.amap m nullableAttributes ilMethRef.ReturnType scoref tinst1 tinst2 with | None -> if isCtor then enclosingTy else g.unit_ty | Some ty -> ty @@ -1292,7 +1295,7 @@ module FSharpExprConvert = | DecisionTreeTest.UnionCase (ucref, tyargs) -> let objR = ConvExpr cenv env inpExpr let ucR = ConvUnionCaseRef cenv ucref - let utypR = ConvType cenv (mkAppTy ucref.TyconRef tyargs) + let utypR = ConvType cenv (mkWoNullAppTy ucref.TyconRef tyargs) E.IfThenElse (E.UnionCaseTest (objR, utypR, ucR) |> Mk cenv m g.bool_ty, ConvDecisionTree cenv env dtreeRetTy dtree m, acc) | DecisionTreeTest.Const (Const.Bool true) -> let e1R = ConvExpr cenv env inpExpr diff --git a/src/Compiler/Symbols/SymbolHelpers.fs b/src/Compiler/Symbols/SymbolHelpers.fs index 1584e096edd..1fedee2968a 100644 --- a/src/Compiler/Symbols/SymbolHelpers.fs +++ b/src/Compiler/Symbols/SymbolHelpers.fs @@ -254,7 +254,7 @@ module internal SymbolHelpers = | FSharpXmlDoc.None | FSharpXmlDoc.FromXmlText _ -> xmlDoc | FSharpXmlDoc.FromXmlFile(dllName, xmlSig) -> - TryFindXmlDocByAssemblyNameAndSig infoReader (Path.GetFileNameWithoutExtension dllName) xmlSig + TryFindXmlDocByAssemblyNameAndSig infoReader (!!Path.GetFileNameWithoutExtension(dllName)) xmlSig |> Option.map FSharpXmlDoc.FromXmlText |> Option.defaultValue xmlDoc @@ -406,66 +406,72 @@ module internal SymbolHelpers = //| _ -> false member x.Equals(item1, item2) = - // This may explore assemblies that are not in the reference set. - // In this case just bail out and assume items are not equal - protectAssemblyExploration false (fun () -> - let equalHeadTypes(ty1, ty2) = - match tryTcrefOfAppTy g ty1 with - | ValueSome tcref1 -> - match tryTcrefOfAppTy g ty2 with - | ValueSome tcref2 -> tyconRefEq g tcref1 tcref2 - | _ -> typeEquiv g ty1 ty2 - | _ -> typeEquiv g ty1 ty2 - - ItemsAreEffectivelyEqual g item1 item2 || - - // Much of this logic is already covered by 'ItemsAreEffectivelyEqual' - match item1, item2 with - | Item.DelegateCtor ty1, Item.DelegateCtor ty2 -> equalHeadTypes(ty1, ty2) - | Item.Types(dn1, ty1 :: _), Item.Types(dn2, ty2 :: _) -> - // Bug 4403: We need to compare names as well, because 'int' and 'Int32' are physically the same type, but we want to show both - dn1 = dn2 && equalHeadTypes(ty1, ty2) +#if !NO_CHECKNULLS + match item1,item2 with + | null,null -> true + | null,_ | _,null -> false + | item1,item2 -> +#endif + // This may explore assemblies that are not in the reference set. + // In this case just bail out and assume items are not equal + protectAssemblyExploration false (fun () -> + let equalHeadTypes(ty1, ty2) = + match tryTcrefOfAppTy g ty1 with + | ValueSome tcref1 -> + match tryTcrefOfAppTy g ty2 with + | ValueSome tcref2 -> tyconRefEq g tcref1 tcref2 + | _ -> typeEquiv g ty1 ty2 + | _ -> typeEquiv g ty1 ty2 + + ItemsAreEffectivelyEqual g item1 item2 || + + // Much of this logic is already covered by 'ItemsAreEffectivelyEqual' + match item1, item2 with + | Item.DelegateCtor ty1, Item.DelegateCtor ty2 -> equalHeadTypes(ty1, ty2) + | Item.Types(dn1, ty1 :: _), Item.Types(dn2, ty2 :: _) -> + // Bug 4403: We need to compare names as well, because 'int' and 'Int32' are physically the same type, but we want to show both + dn1 = dn2 && equalHeadTypes(ty1, ty2) - // Prefer a type to a DefaultStructCtor, a DelegateCtor and a FakeInterfaceCtor - | ItemWhereTypIsPreferred ty1, ItemWhereTypIsPreferred ty2 -> equalHeadTypes(ty1, ty2) - - | Item.ExnCase tcref1, Item.ExnCase tcref2 -> tyconRefEq g tcref1 tcref2 - | Item.ILField(fld1), Item.ILField(fld2) -> - ILFieldInfo.ILFieldInfosUseIdenticalDefinitions fld1 fld2 - | Item.CustomOperation (_, _, Some minfo1), Item.CustomOperation (_, _, Some minfo2) -> - MethInfo.MethInfosUseIdenticalDefinitions minfo1 minfo2 - | Item.TypeVar (nm1, tp1), Item.TypeVar (nm2, tp2) -> - (nm1 = nm2) && typarRefEq tp1 tp2 - | Item.ModuleOrNamespaces(modref1 :: _), Item.ModuleOrNamespaces(modref2 :: _) -> fullDisplayTextOfModRef modref1 = fullDisplayTextOfModRef modref2 - | Item.SetterArg(id1, _), Item.SetterArg(id2, _) -> Range.equals id1.idRange id2.idRange && id1.idText = id2.idText - | Item.MethodGroup(_, meths1, _), Item.MethodGroup(_, meths2, _) -> - Seq.zip meths1 meths2 |> Seq.forall (fun (minfo1, minfo2) -> - MethInfo.MethInfosUseIdenticalDefinitions minfo1 minfo2) - | (Item.Value vref1 | Item.CustomBuilder (_, vref1)), (Item.Value vref2 | Item.CustomBuilder (_, vref2)) -> - valRefEq g vref1 vref2 - | Item.ActivePatternCase(APElemRef(_apinfo1, vref1, idx1, _)), Item.ActivePatternCase(APElemRef(_apinfo2, vref2, idx2, _)) -> - idx1 = idx2 && valRefEq g vref1 vref2 - | Item.UnionCase(UnionCaseInfo(_, ur1), _), Item.UnionCase(UnionCaseInfo(_, ur2), _) -> - g.unionCaseRefEq ur1 ur2 - | Item.RecdField(RecdFieldInfo(_, RecdFieldRef(tcref1, n1))), Item.RecdField(RecdFieldInfo(_, RecdFieldRef(tcref2, n2))) -> - (tyconRefEq g tcref1 tcref2) && (n1 = n2) // there is no direct function as in the previous case - | Item.Property(info = pi1s), Item.Property(info = pi2s) -> - (pi1s, pi2s) ||> List.forall2 PropInfo.PropInfosUseIdenticalDefinitions - | Item.Event evt1, Item.Event evt2 -> - EventInfo.EventInfosUseIdenticalDefinitions evt1 evt2 - | Item.AnonRecdField(anon1, _, i1, _), Item.AnonRecdField(anon2, _, i2, _) -> - anonInfoEquiv anon1 anon2 && i1 = i2 - | Item.Trait traitInfo1, Item.Trait traitInfo2 -> - (traitInfo1.MemberLogicalName = traitInfo2.MemberLogicalName) - | Item.CtorGroup(_, meths1), Item.CtorGroup(_, meths2) -> - (meths1, meths2) - ||> List.forall2 MethInfo.MethInfosUseIdenticalDefinitions - | Item.UnqualifiedType tcrefs1, Item.UnqualifiedType tcrefs2 -> - (tcrefs1, tcrefs2) - ||> List.forall2 (fun tcref1 tcref2 -> tyconRefEq g tcref1 tcref2) - | Item.Types(_, [AbbrevOrAppTy(tcref1, _)]), Item.UnqualifiedType([tcref2]) -> tyconRefEq g tcref1 tcref2 - | Item.UnqualifiedType([tcref1]), Item.Types(_, [AbbrevOrAppTy(tcref2, _)]) -> tyconRefEq g tcref1 tcref2 - | _ -> false) + // Prefer a type to a DefaultStructCtor, a DelegateCtor and a FakeInterfaceCtor + | ItemWhereTypIsPreferred ty1, ItemWhereTypIsPreferred ty2 -> equalHeadTypes(ty1, ty2) + + | Item.ExnCase tcref1, Item.ExnCase tcref2 -> tyconRefEq g tcref1 tcref2 + | Item.ILField(fld1), Item.ILField(fld2) -> + ILFieldInfo.ILFieldInfosUseIdenticalDefinitions fld1 fld2 + | Item.CustomOperation (_, _, Some minfo1), Item.CustomOperation (_, _, Some minfo2) -> + MethInfo.MethInfosUseIdenticalDefinitions minfo1 minfo2 + | Item.TypeVar (nm1, tp1), Item.TypeVar (nm2, tp2) -> + (nm1 = nm2) && typarRefEq tp1 tp2 + | Item.ModuleOrNamespaces(modref1 :: _), Item.ModuleOrNamespaces(modref2 :: _) -> fullDisplayTextOfModRef modref1 = fullDisplayTextOfModRef modref2 + | Item.SetterArg(id1, _), Item.SetterArg(id2, _) -> Range.equals id1.idRange id2.idRange && id1.idText = id2.idText + | Item.MethodGroup(_, meths1, _), Item.MethodGroup(_, meths2, _) -> + Seq.zip meths1 meths2 |> Seq.forall (fun (minfo1, minfo2) -> + MethInfo.MethInfosUseIdenticalDefinitions minfo1 minfo2) + | (Item.Value vref1 | Item.CustomBuilder (_, vref1)), (Item.Value vref2 | Item.CustomBuilder (_, vref2)) -> + valRefEq g vref1 vref2 + | Item.ActivePatternCase(APElemRef(_apinfo1, vref1, idx1, _)), Item.ActivePatternCase(APElemRef(_apinfo2, vref2, idx2, _)) -> + idx1 = idx2 && valRefEq g vref1 vref2 + | Item.UnionCase(UnionCaseInfo(_, ur1), _), Item.UnionCase(UnionCaseInfo(_, ur2), _) -> + g.unionCaseRefEq ur1 ur2 + | Item.RecdField(RecdFieldInfo(_, RecdFieldRef(tcref1, n1))), Item.RecdField(RecdFieldInfo(_, RecdFieldRef(tcref2, n2))) -> + (tyconRefEq g tcref1 tcref2) && (n1 = n2) // there is no direct function as in the previous case + | Item.Property(info = pi1s), Item.Property(info = pi2s) -> + (pi1s, pi2s) ||> List.forall2 PropInfo.PropInfosUseIdenticalDefinitions + | Item.Event evt1, Item.Event evt2 -> + EventInfo.EventInfosUseIdenticalDefinitions evt1 evt2 + | Item.AnonRecdField(anon1, _, i1, _), Item.AnonRecdField(anon2, _, i2, _) -> + anonInfoEquiv anon1 anon2 && i1 = i2 + | Item.Trait traitInfo1, Item.Trait traitInfo2 -> + (traitInfo1.MemberLogicalName = traitInfo2.MemberLogicalName) + | Item.CtorGroup(_, meths1), Item.CtorGroup(_, meths2) -> + (meths1, meths2) + ||> List.forall2 MethInfo.MethInfosUseIdenticalDefinitions + | Item.UnqualifiedType tcrefs1, Item.UnqualifiedType tcrefs2 -> + (tcrefs1, tcrefs2) + ||> List.forall2 (fun tcref1 tcref2 -> tyconRefEq g tcref1 tcref2) + | Item.Types(_, [AbbrevOrAppTy(tcref1, _)]), Item.UnqualifiedType([tcref2]) -> tyconRefEq g tcref1 tcref2 + | Item.UnqualifiedType([tcref1]), Item.Types(_, [AbbrevOrAppTy(tcref2, _)]) -> tyconRefEq g tcref1 tcref2 + | _ -> false) member x.GetHashCode item = // This may explore assemblies that are not in the reference set. @@ -542,6 +548,7 @@ module internal SymbolHelpers = let SimplerDisplayEnv denv = { denv with shortConstraints=true showStaticallyResolvedTyparAnnotations=false + showNullnessAnnotations = Some true abbreviateAdditionalConstraints=false suppressNestedTypes=true maxMembers=Some EnvMisc2.maxMembers } @@ -791,7 +798,7 @@ module internal SymbolHelpers = /// Get the "F1 Keyword" associated with an item, for looking up documentation help indexes on the web let rec GetF1Keyword (g: TcGlobals) item = - let getKeywordForMethInfo (minfo : MethInfo) = + let rec getKeywordForMethInfo (minfo : MethInfo) = match minfo with | FSMeth(_, _, vref, _) -> match vref.TryDeclaringEntity with @@ -806,6 +813,7 @@ module internal SymbolHelpers = if nGenericParams > 0 then "``"+(nGenericParams.ToString()) else "" sprintf "%s.%s%s" typeString minfo.RawMetadata.Name paramString |> Some + | MethInfoWithModifiedReturnType(mi,_) -> getKeywordForMethInfo mi | DefaultStructCtor _ -> None #if !NO_TYPEPROVIDERS | ProvidedMeth _ -> None diff --git a/src/Compiler/Symbols/Symbols.fs b/src/Compiler/Symbols/Symbols.fs index 19fbfe9306b..95427b7914f 100644 --- a/src/Compiler/Symbols/Symbols.fs +++ b/src/Compiler/Symbols/Symbols.fs @@ -26,6 +26,7 @@ open FSharp.Compiler.TypedTree open FSharp.Compiler.TypedTreeBasics open FSharp.Compiler.TypedTreeOps open FSharp.Compiler.TypeHierarchy +open FSharp.Compiler.CheckExpressionsOps type FSharpAccessibility(a:Accessibility, ?isProtected) = let isProtected = defaultArg isProtected false @@ -58,7 +59,7 @@ type FSharpAccessibility(a:Accessibility, ?isProtected) = type SymbolEnv(g: TcGlobals, thisCcu: CcuThunk, thisCcuTyp: ModuleOrNamespaceType option, tcImports: TcImports, amap: Import.ImportMap, infoReader: InfoReader) = - let tcVal = CheckExpressions.LightweightTcValForUsingInBuildMethodCall g + let tcVal = LightweightTcValForUsingInBuildMethodCall g new(g: TcGlobals, thisCcu: CcuThunk, thisCcuTyp: ModuleOrNamespaceType option, tcImports: TcImports) = let amap = tcImports.GetImportMap() @@ -1570,6 +1571,11 @@ type FSharpGenericParameterConstraint(cenv, cx: TyparConstraint) = | TyparConstraint.SupportsComparison _ -> true | _ -> false + member _.IsNotSupportsNullConstraint = + match cx with + | TyparConstraint.NotSupportsNull _ -> true + | _ -> false + member _.IsEqualityConstraint = match cx with | TyparConstraint.SupportsEquality _ -> true @@ -1782,7 +1788,11 @@ type FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = match d with | P p -> p.IsUnionCaseTester | M m -> m.IsUnionCaseTester - | E _ | C _ | V _ -> invalidOp "the value or member is not a property" + | V v -> + v.IsPropertyGetterMethod && + v.LogicalName.StartsWith("get_Is") && + v.IsImplied && v.MemberApparentEntity.IsUnionTycon + | E _ | C _ -> false member _.EventAddMethod = checkIsResolved() @@ -2383,18 +2393,54 @@ type FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = | _ -> NicePrint.stringOfMethInfoFSharpStyle cenv.infoReader m displayEnv methInfo let stringValOfPropInfo (p: PropInfo) = - match p with - | DifferentGetterAndSetter(getValRef, setValRef) -> - let g = NicePrint.stringValOrMember displayEnv cenv.infoReader getValRef - let s = NicePrint.stringValOrMember displayEnv cenv.infoReader setValRef - $"{g}\n{s}" - | _ -> - let t = p.GetPropertyType(cenv.amap, m ) |> NicePrint.layoutType displayEnv |> LayoutRender.showL + let supportAccessModifiersBeforeGetSet = + cenv.g.langVersion.SupportsFeature Features.LanguageFeature.AllowAccessModifiersToAutoPropertiesGettersAndSetters + if not supportAccessModifiersBeforeGetSet then + match p with + | DifferentGetterAndSetter(getValRef, setValRef) -> + let g = NicePrint.stringValOrMember displayEnv cenv.infoReader getValRef + let s = NicePrint.stringValOrMember displayEnv cenv.infoReader setValRef + $"{g}\n{s}" + | _ -> + let t = p.GetPropertyType(cenv.amap, m) |> NicePrint.layoutType displayEnv |> LayoutRender.showL + let withGetSet = + if p.HasGetter && p.HasSetter then "with get, set" + elif p.HasGetter then "with get" + elif p.HasSetter then "with set" + else "" + + $"member %s{p.DisplayName}: %s{t} %s{withGetSet}" + else + let layoutAccessibilityCore (denv: DisplayEnv) accessibility = + let isInternalCompPath x = + match x with + | CompPath(ILScopeRef.Local, _, []) -> true + | _ -> false + let (|Public|Internal|Private|) (TAccess p) = + match p with + | [] -> Public + | _ when List.forall isInternalCompPath p -> Internal + | _ -> Private + match denv.contextAccessibility, accessibility with + | Public, Internal -> "internal " + | Public, Private -> "private " + | Internal, Private -> "private " + | _ -> String.Empty + + let getterAccess, setterAccess = + layoutAccessibilityCore displayEnv (Option.defaultValue taccessPublic p.GetterAccessibility), + layoutAccessibilityCore displayEnv (Option.defaultValue taccessPublic p.SetterAccessibility) + let t = p.GetPropertyType(cenv.amap, m) |> NicePrint.layoutType displayEnv |> LayoutRender.showL let withGetSet = - if p.HasGetter && p.HasSetter then "with get, set" - elif p.HasGetter then "with get" - elif p.HasSetter then "with set" - else "" + match p.HasGetter, p.HasSetter with + | true, false -> + $"with %s{getterAccess}get" + | false, true -> + $"with %s{setterAccess}set" + | true, true -> + $"with %s{getterAccess}get, %s{setterAccess}set" + | false, false -> + String.Empty $"member %s{p.DisplayName}: %s{t} %s{withGetSet}" @@ -2516,6 +2562,23 @@ type FSharpType(cenv, ty:TType) = | TType_measure (Measure.Inv _) -> FSharpEntity(cenv, cenv.g.measureinverse_tcr) | _ -> invalidOp "not a named type" + member _.HasNullAnnotation = + protect <| fun () -> + match stripTyparEqns ty with + | TType_var (_, nullness) + | TType_app (_, _, nullness) + | TType_fun(_, _, nullness) -> match nullness.Evaluate() with NullnessInfo.WithNull -> true | _ -> false + | TType_tuple (_, _) -> false + | _ -> false + + member _.IsNullAmbivalent = + protect <| fun () -> + match stripTyparEqns ty with + | TType_app (_, _, nullness) + | TType_fun(_, _, nullness) -> match nullness.Evaluate() with NullnessInfo.AmbivalentToNull -> true | _ -> false + | TType_tuple (_, _) -> false + | _ -> false + member _.GenericArguments = protect <| fun () -> match stripTyparEqns ty with @@ -2738,8 +2801,8 @@ type FSharpAttribute(cenv: SymbolEnv, attrib: AttribInfo) = | AttribInfo.FSAttribInfo(g, attrib) -> NicePrint.stringOfFSAttrib (context.Contents g) attrib | AttribInfo.ILAttribInfo (g, _, _scoref, cattr, _) -> - let parms, _args = decodeILAttribData cattr - NicePrint.stringOfILAttrib (context.Contents g) (cattr.Method.DeclaringType, parms) + let params_, _args = decodeILAttribData cattr + NicePrint.stringOfILAttrib (context.Contents g) (cattr.Method.DeclaringType, params_) member _.Range = attrib.Range @@ -2964,4 +3027,3 @@ type FSharpOpenDeclaration(target: SynOpenDeclTarget, range: range option, modul member _.AppliedScope = appliedScope member _.IsOwnNamespace = isOwnNamespace - diff --git a/src/Compiler/Symbols/Symbols.fsi b/src/Compiler/Symbols/Symbols.fsi index 5530ba53ec5..5c26d2d42ea 100644 --- a/src/Compiler/Symbols/Symbols.fsi +++ b/src/Compiler/Symbols/Symbols.fsi @@ -108,7 +108,7 @@ type FSharpSymbol = /// Gets the display name for the symbol. Double backticks are added if the name is not a valid identifier. /// - /// For FSharpParameter symbols without a name for the paramater, this returns "````" + /// For FSharpParameter symbols without a name for the parameter, this returns "````" member DisplayName: string /// Get the implementation location for the symbol if it was declared in a signature that has an implementation @@ -660,7 +660,7 @@ type FSharpGenericParameterMemberConstraint = /// Get the name of the method required by the constraint member MemberName: string - /// Indicates if the the method required by the constraint must be static + /// Indicates if the method required by the constraint must be static member MemberIsStatic: bool /// Get the argument types of the method required by the constraint @@ -977,7 +977,7 @@ type FSharpMemberOrFunctionOrValue = /// Get the signature text to include this Symbol into an existing signature file. member GetValSignatureText: displayContext: FSharpDisplayContext * m: range -> string option - /// Check if this method has an entrpoint that accepts witness arguments and if so return + /// Check if this method has an entrypoint that accepts witness arguments and if so return /// the name of that entrypoint and information about the additional witness arguments member GetWitnessPassingInfo: unit -> (string * IList) option @@ -1088,6 +1088,12 @@ type FSharpType = /// Get the type definition for a type member TypeDefinition: FSharpEntity + /// Indicates this type is known to have a null annotation + member HasNullAnnotation: bool + + /// Indicates this type is assumed to support the null value + member IsNullAmbivalent: bool + /// Get the generic arguments for a tuple type, a function type or a type constructed using a named entity member GenericArguments: IList @@ -1197,7 +1203,7 @@ type FSharpAttribute = /// Get the range of the name of the attribute member Range: range - /// Indicates if attribute matchies the full name of the given type parameter + /// Indicates if attribute matches the full name of the given type parameter member IsAttribute<'T> : unit -> bool /// Represents open declaration in F# code. diff --git a/src/Compiler/SyntaxTree/LexFilter.fs b/src/Compiler/SyntaxTree/LexFilter.fs index 79afdca04c3..19f7be5d31b 100644 --- a/src/Compiler/SyntaxTree/LexFilter.fs +++ b/src/Compiler/SyntaxTree/LexFilter.fs @@ -555,6 +555,7 @@ let (|TyparsCloseOp|_|) (txt: string) = | Equals "$" -> ValueSome DOLLAR | Equals "%" -> ValueSome (PERCENT_OP "%") | Equals "%%" -> ValueSome (PERCENT_OP "%%") + | Equals "" -> ValueNone | StartsWith "=" | StartsWith "!=" | StartsWith "<" @@ -1144,7 +1145,9 @@ type LexFilterImpl ( // f<{| C : int |}>x // fx // fx + // fx | DEFAULT | COLON | COLON_GREATER | STRUCT | NULL | DELEGATE | AND | WHEN | AMP + | BAR_JUST_BEFORE_NULL | BAR | DOT_DOT | NEW | LBRACE_BAR @@ -2482,6 +2485,9 @@ type LexFilterImpl ( pool.Return tokenTup hwTokenFetch useBlockRule + | BAR, _ when (lexbuf.SupportsFeature(LanguageFeature.NullnessChecking) && match peekNextToken() with NULL -> true | _ -> false) -> + returnToken tokenLexbufState BAR_JUST_BEFORE_NULL + // Ordinary tokens start a vanilla block | _, CtxtSeqBlock _ :: _ -> pushCtxt tokenTup (CtxtVanilla(tokenStartPos, isLongIdentEquals token)) diff --git a/src/Compiler/SyntaxTree/LexHelpers.fs b/src/Compiler/SyntaxTree/LexHelpers.fs index 02d4da364d4..736e4be04f5 100644 --- a/src/Compiler/SyntaxTree/LexHelpers.fs +++ b/src/Compiler/SyntaxTree/LexHelpers.fs @@ -222,16 +222,32 @@ let addUnicodeChar buf c = addIntChar buf (int c) let addByteChar buf (c: char) = addIntChar buf (int32 c % 256) +type LargerThanOneByte = int +type LargerThan127ButInsideByte = int + /// Sanity check that high bytes are zeros. Further check each low byte <= 127 -let stringBufferIsBytes (buf: ByteBuffer) = +let errorsInByteStringBuffer (buf: ByteBuffer) = let bytes = buf.AsMemory() - let mutable ok = true + assert (bytes.Length % 2 = 0) + + // Enhancement?: return faulty values? + // But issue: we don't know range of values -> no direct mapping from value to range & notation + + // values with high byte <> 0 + let mutable largerThanOneByteCount = 0 + // values with high byte = 0, but low byte > 127 + let mutable largerThan127ButSingleByteCount = 0 for i = 0 to bytes.Length / 2 - 1 do if bytes.Span[i * 2 + 1] <> 0uy then - ok <- false + largerThanOneByteCount <- largerThanOneByteCount + 1 + elif bytes.Span[i * 2] > 127uy then + largerThan127ButSingleByteCount <- largerThan127ButSingleByteCount + 1 - ok + if largerThanOneByteCount + largerThan127ButSingleByteCount > 0 then + Some(largerThanOneByteCount, largerThan127ButSingleByteCount) + else + None let newline (lexbuf: LexBuffer<_>) = lexbuf.EndPos <- lexbuf.EndPos.NextLine @@ -477,13 +493,14 @@ module Keywords = fileName |> FileSystem.GetFullPathShim (* asserts that path is already absolute *) |> System.IO.Path.GetDirectoryName + |> (!!) if String.IsNullOrEmpty dirname then dirname else PathMap.applyDir args.pathMap dirname |> fun dir -> KEYWORD_STRING(s, dir) - | "__SOURCE_FILE__" -> KEYWORD_STRING(s, System.IO.Path.GetFileName(FileIndex.fileOfFileIndex lexbuf.StartPos.FileIndex)) + | "__SOURCE_FILE__" -> KEYWORD_STRING(s, !! System.IO.Path.GetFileName(FileIndex.fileOfFileIndex lexbuf.StartPos.FileIndex)) | "__LINE__" -> KEYWORD_STRING(s, string lexbuf.StartPos.Line) | _ -> IdentifierToken args lexbuf s diff --git a/src/Compiler/SyntaxTree/LexHelpers.fsi b/src/Compiler/SyntaxTree/LexHelpers.fsi index 616bfa8a6fd..0ba901a05e0 100644 --- a/src/Compiler/SyntaxTree/LexHelpers.fsi +++ b/src/Compiler/SyntaxTree/LexHelpers.fsi @@ -97,7 +97,9 @@ val stringBufferAsString: ByteBuffer -> string val stringBufferAsBytes: ByteBuffer -> byte[] -val stringBufferIsBytes: ByteBuffer -> bool +type LargerThanOneByte = int +type LargerThan127ButInsideByte = int +val errorsInByteStringBuffer: ByteBuffer -> Option val newline: Lexing.LexBuffer<'a> -> unit diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index d90e395c0c9..22c27eeb9b0 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -43,7 +43,11 @@ let posOfLexPosition (p: Position) = mkPos p.Line p.Column /// Get an F# compiler range from a lexer range let mkSynRange (p1: Position) (p2: Position) = - mkFileIndexRange p1.FileIndex (posOfLexPosition p1) (posOfLexPosition p2) + if p1.FileIndex = p2.FileIndex then + mkFileIndexRange p1.FileIndex (posOfLexPosition p1) (posOfLexPosition p2) + else + // This means we had a #line directive in the middle of this syntax element. + mkFileIndexRange p1.FileIndex (posOfLexPosition p1) (posOfLexPosition (p1.ShiftColumnBy 1)) type LexBuffer<'Char> with @@ -75,7 +79,7 @@ type IParseState with match bls.TryGetValue key with | true, gen -> gen | _ -> - let gen = box (SynArgNameGenerator()) + let gen = !!(box (SynArgNameGenerator())) bls[key] <- gen gen @@ -97,7 +101,7 @@ module LexbufLocalXmlDocStore = match lexbuf.BufferLocalStore.TryGetValue xmlDocKey with | true, collector -> collector | _ -> - let collector = box (XmlDocCollector()) + let collector = !!(box (XmlDocCollector())) lexbuf.BufferLocalStore[xmlDocKey] <- collector collector @@ -145,7 +149,7 @@ module LexbufLocalXmlDocStore = collector.CheckInvalidXmlDocPositions() //------------------------------------------------------------------------ -// Parsing/lexing: status of #if/#endif processing in lexing, used for continutations +// Parsing/lexing: status of #if/#endif processing in lexing, used for continuations // for whitespace tokens in parser specification. //------------------------------------------------------------------------ @@ -188,7 +192,7 @@ module LexbufIfdefStore = match lexbuf.BufferLocalStore.TryGetValue ifDefKey with | true, store -> store | _ -> - let store = box (ResizeArray()) + let store = !!(box (ResizeArray())) lexbuf.BufferLocalStore[ifDefKey] <- store store |> unbox> @@ -237,7 +241,7 @@ module LexbufCommentStore = match lexbuf.BufferLocalStore.TryGetValue commentKey with | true, store -> store | _ -> - let store = box (ResizeArray()) + let store = !!(box (ResizeArray())) lexbuf.BufferLocalStore[commentKey] <- store store |> unbox> @@ -894,7 +898,7 @@ let mkRecdField (lidwd: SynLongIdent) = lidwd, true // Used for 'do expr' in a class. let mkSynDoBinding (vis: SynAccess option, mDo, expr, m) = match vis with - | Some vis -> errorR (Error(FSComp.SR.parsDoCannotHaveVisibilityDeclarations (vis.ToString()), m)) + | Some vis -> errorR (Error(FSComp.SR.parsDoCannotHaveVisibilityDeclarations (vis |> string), m)) | None -> () SynBinding( @@ -1101,7 +1105,8 @@ let mkSynUnionCase attributes (access: SynAccess option) id kind mDecl (xmlDoc, SynUnionCase(attributes, id, kind, xmlDoc, None, mDecl, trivia) let mkAutoPropDefn mVal access ident typ mEquals (expr: SynExpr) accessors xmlDoc attribs flags rangeStart = - let mWith, (getSet, getSetOpt) = accessors + let mWith, (getSet, getSetOpt, getterAccess, setterAccess) = accessors + let access = SynValSigAccess.GetSet(access, getterAccess, setterAccess) let memberRange = match getSetOpt with diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fsi b/src/Compiler/SyntaxTree/ParseHelpers.fsi index a8d61f3cb7e..52f4257d4c2 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fsi +++ b/src/Compiler/SyntaxTree/ParseHelpers.fsi @@ -272,7 +272,7 @@ val mkAutoPropDefn: typ: SynType option -> mEquals: range option -> expr: SynExpr -> - accessors: range option * (SynMemberKind * GetSetKeywords option) -> + accessors: range option * (SynMemberKind * GetSetKeywords option * SynAccess option * SynAccess option) -> xmlDoc: PreXmlDoc -> attribs: SynAttributes -> flags: (SynMemberKind -> SynMemberFlags) * SynLeadingKeyword -> diff --git a/src/Compiler/SyntaxTree/PrettyNaming.fs b/src/Compiler/SyntaxTree/PrettyNaming.fs index d91eddbeb04..8ea10266de8 100755 --- a/src/Compiler/SyntaxTree/PrettyNaming.fs +++ b/src/Compiler/SyntaxTree/PrettyNaming.fs @@ -363,6 +363,8 @@ let IsOperatorDisplayName (name: string) = let IsPossibleOpName (name: string) = name.StartsWithOrdinal(opNamePrefix) +let ordinalStringComparer: IEqualityComparer = StringComparer.Ordinal + /// Compiles a custom operator into a mangled operator name. /// For example, "!%" becomes "op_DereferencePercent". /// This function should only be used for custom operators @@ -387,7 +389,7 @@ let compileCustomOpName = /// Memoize compilation of custom operators. /// They're typically used more than once so this avoids some CPU and GC overhead. - let compiledOperators = ConcurrentDictionary<_, string> StringComparer.Ordinal + let compiledOperators = ConcurrentDictionary ordinalStringComparer // Cache this as a delegate. let compiledOperatorsAddDelegate = @@ -416,7 +418,7 @@ let compileCustomOpName = /// Maps the built-in F# operators to their mangled operator names. let standardOpNames = - let opNames = Dictionary<_, _>(opNameTable.Length, StringComparer.Ordinal) + let opNames = Dictionary<_, _>(opNameTable.Length, ordinalStringComparer) for x, y in opNameTable do opNames.Add(x, y) @@ -440,7 +442,7 @@ let CompileOpName op = let decompileCustomOpName = // Memoize this operation. Custom operators are typically used more than once // so this avoids repeating decompilation. - let decompiledOperators = ConcurrentDictionary<_, _> StringComparer.Ordinal + let decompiledOperators = ConcurrentDictionary<_, _> ordinalStringComparer /// The minimum length of the name for a custom operator character. /// This value is used when initializing StringBuilders to avoid resizing. @@ -507,7 +509,7 @@ let decompileCustomOpName = /// Maps the mangled operator names of built-in F# operators back to the operators. let standardOpsDecompile = - let ops = Dictionary(opNameTable.Length, StringComparer.Ordinal) + let ops = Dictionary(opNameTable.Length, ordinalStringComparer) for x, y in opNameTable do ops.Add(y, x) @@ -624,7 +626,7 @@ let IsValidPrefixOperatorUse s = if String.IsNullOrEmpty s then false else - match s with + match !!s with | "?+" | "?-" | "+" @@ -635,12 +637,13 @@ let IsValidPrefixOperatorUse s = | "%%" | "&" | "&&" -> true - | _ -> s[0] = '!' || isTildeOnlyString s + | s -> s[0] = '!' || isTildeOnlyString s let IsValidPrefixOperatorDefinitionName s = if String.IsNullOrEmpty s then false else + let s = !!s match s[0] with | '~' -> @@ -667,8 +670,8 @@ let IsLogicalPrefixOperator logicalName = if String.IsNullOrEmpty logicalName then false else - let displayName = ConvertValLogicalNameToDisplayNameCore logicalName - displayName <> logicalName && IsValidPrefixOperatorDefinitionName displayName + let displayName = ConvertValLogicalNameToDisplayNameCore !!logicalName + displayName <> !!logicalName && IsValidPrefixOperatorDefinitionName displayName let IsLogicalTernaryOperator logicalName = let displayName = ConvertValLogicalNameToDisplayNameCore logicalName @@ -720,7 +723,7 @@ let ignoredChars = [| '.'; '?' |] // where certain operator tokens are accepted in infix forms, i.e. . // The lexer defines the strings that lead to those tokens. //------ -// This function recognises these "infix operator" names. +// This function recognizes these "infix operator" names. let IsLogicalInfixOpName logicalName = let s = ConvertValLogicalNameToDisplayNameCore logicalName let skipIgnoredChars = s.TrimStart(ignoredChars) @@ -960,6 +963,14 @@ type ActivePatternInfo = member x.ActiveTagsWithRanges = let (APInfo(_, tags, _)) = x in tags + member x.LogicalName = + let (APInfo(isTotal, tags, _)) = x + + tags + |> List.map fst + |> String.concat "|" + |> (fun s -> if isTotal then "(|" + s + "|)" else "(|" + s + "|_|)") + member x.Range = let (APInfo(_, _, m)) = x in m let ActivePatternInfoOfValName nm (m: range) = @@ -1098,12 +1109,21 @@ let FSharpOptimizationDataResourceName = "FSharpOptimizationData." let FSharpSignatureDataResourceName = "FSharpSignatureData." +let FSharpOptimizationDataResourceNameB = "FSharpOptimizationDataB." + +let FSharpSignatureDataResourceNameB = "FSharpSignatureDataB." + // Compressed OptimizationData/SignatureData name for embedded resource let FSharpOptimizationCompressedDataResourceName = "FSharpOptimizationCompressedData." let FSharpSignatureCompressedDataResourceName = "FSharpSignatureCompressedData." +let FSharpOptimizationCompressedDataResourceNameB = + "FSharpOptimizationCompressedDataB." + +let FSharpSignatureCompressedDataResourceNameB = "FSharpSignatureCompressedDataB." + // For historical reasons, we use a different resource name for FSharp.Core, so older F# compilers // don't complain when they see the resource. The prefix of these names must not be 'FSharpOptimizationData' // or 'FSharpSignatureData' diff --git a/src/Compiler/SyntaxTree/PrettyNaming.fsi b/src/Compiler/SyntaxTree/PrettyNaming.fsi index 511f60b9057..9843656e46f 100644 --- a/src/Compiler/SyntaxTree/PrettyNaming.fsi +++ b/src/Compiler/SyntaxTree/PrettyNaming.fsi @@ -114,7 +114,7 @@ val internal ConvertLogicalNameToDisplayName: name: string -> string /// In any cases it is used it probably indicates that text is being /// generated which: /// 1. does not contain double-backticks for non-identifiers -/// 2. does not put parentheses arounf operators or active pattern names +/// 2. does not put parentheses around operators or active pattern names /// /// If the text is immediately in quotes, this is generally ok, e.g. /// @@ -228,6 +228,7 @@ type internal ActivePatternInfo = member ActiveTags: string list member ActiveTagsWithRanges: (string * range) list + member LogicalName: string member IsTotal: bool member Range: range @@ -267,10 +268,18 @@ val internal FSharpOptimizationDataResourceName: string val internal FSharpSignatureDataResourceName: string +val internal FSharpOptimizationDataResourceNameB: string + +val internal FSharpSignatureDataResourceNameB: string + val internal FSharpOptimizationCompressedDataResourceName: string val internal FSharpSignatureCompressedDataResourceName: string +val internal FSharpOptimizationCompressedDataResourceNameB: string + +val internal FSharpSignatureCompressedDataResourceNameB: string + val internal FSharpOptimizationDataResourceName2: string val internal FSharpSignatureDataResourceName2: string diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 81b20ef4818..962188c2f21 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -332,6 +332,8 @@ type SynTypeConstraint = | WhereTyparSupportsNull of typar: SynTypar * range: range + | WhereTyparNotSupportsNull of genericName: SynTypar * range: range * trivia: SynTypeConstraintWhereTyparNotSupportsNullTrivia + | WhereTyparIsComparable of typar: SynTypar * range: range | WhereTyparIsEquatable of typar: SynTypar * range: range @@ -354,6 +356,7 @@ type SynTypeConstraint = | WhereTyparIsReferenceType(range = range) | WhereTyparIsUnmanaged(range = range) | WhereTyparSupportsNull(range = range) + | WhereTyparNotSupportsNull(range = range) | WhereTyparIsComparable(range = range) | WhereTyparIsEquatable(range = range) | WhereTyparDefaultsToType(range = range) @@ -456,10 +459,14 @@ type SynType = | StaticConstant of constant: SynConst * range: range + | StaticConstantNull of range: range + | StaticConstantExpr of expr: SynExpr * range: range | StaticConstantNamed of ident: SynType * value: SynType * range: range + | WithNull of innerType: SynType * ambivalent: bool * range: range * trivia: SynTypeWithNullTrivia + | Paren of innerType: SynType * range: range | SignatureParameter of attributes: SynAttributes * optional: bool * id: Ident option * usedType: SynType * range: range @@ -482,9 +489,11 @@ type SynType = | SynType.Anon(range = m) | SynType.WithGlobalConstraints(range = m) | SynType.StaticConstant(range = m) + | SynType.StaticConstantNull(range = m) | SynType.StaticConstantExpr(range = m) | SynType.StaticConstantNamed(range = m) | SynType.HashConstraint(range = m) + | SynType.WithNull(range = m) | SynType.MeasurePower(range = m) | SynType.Paren(range = m) | SynType.SignatureParameter(range = m) @@ -861,6 +870,14 @@ type SynExprAndBang = range: range * trivia: SynExprAndBangTrivia + member x.Range = + match x with + | SynExprAndBang(range = range) -> range + + member this.Trivia = + match this with + | SynExprAndBang(trivia = trivia) -> trivia + [] type SynExprRecordField = | SynExprRecordField of @@ -1322,6 +1339,24 @@ type SynComponentInfo = match this with | SynComponentInfo(range = m) -> m +[] +type SynValSigAccess = + | Single of accessibility: SynAccess option + | GetSet of accessibility: SynAccess option * getterAccessibility: SynAccess option * setterAccessibility: SynAccess option + + member this.SingleAccess() = + match this with + | Single(access) + | GetSet(accessibility = access) -> access + + member this.GetSetAccessNoCheck() = + match this with + | Single(access) -> access, access + | GetSet(access, getterAccess, setterAccess) -> + let getterAccess = getterAccess |> Option.orElse access + let setterAccess = setterAccess |> Option.orElse access + getterAccess, setterAccess + [] type SynValSig = | SynValSig of @@ -1333,7 +1368,7 @@ type SynValSig = isInline: bool * isMutable: bool * xmlDoc: PreXmlDoc * - accessibility: SynAccess option * + accessibility: SynValSigAccess * synExpr: SynExpr option * range: range * trivia: SynValSigTrivia @@ -1476,7 +1511,7 @@ type SynMemberDefn = memberFlags: SynMemberFlags * memberFlagsForSet: SynMemberFlags * xmlDoc: PreXmlDoc * - accessibility: SynAccess option * + accessibility: SynValSigAccess * synExpr: SynExpr * range: range * trivia: SynMemberDefnAutoPropertyTrivia diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index d766753e2ce..f2c75d8dfac 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -408,6 +408,12 @@ type SynTypeConstraint = /// F# syntax is 'typar: null | WhereTyparSupportsNull of typar: SynTypar * range: range + /// F# syntax is 'typar : null + | WhereTyparNotSupportsNull of + genericName: SynTypar * + range: range * + trivia: SynTypeConstraintWhereTyparNotSupportsNullTrivia + /// F# syntax is 'typar: comparison | WhereTyparIsComparable of typar: SynTypar * range: range @@ -515,12 +521,17 @@ type SynType = /// For the dimensionless units i.e. 1, and static parameters to provided types | StaticConstant of constant: SynConst * range: range + /// F# syntax: null, used in parameters to type providers + | StaticConstantNull of range: range + /// F# syntax: const expr, used in static parameters to type providers | StaticConstantExpr of expr: SynExpr * range: range /// F# syntax: ident=1 etc., used in static parameters to type providers | StaticConstantNamed of ident: SynType * value: SynType * range: range + | WithNull of innerType: SynType * ambivalent: bool * range: range * trivia: SynTypeWithNullTrivia + | Paren of innerType: SynType * range: range /// F# syntax: a: b, used in signatures and type annotations @@ -974,6 +985,12 @@ type SynExprAndBang = range: range * trivia: SynExprAndBangTrivia + /// Gets the syntax range of this construct + member Range: range + + /// Gets the trivia associated with this construct + member Trivia: SynExprAndBangTrivia + [] type SynExprRecordField = | SynExprRecordField of @@ -1481,6 +1498,18 @@ type SynComponentInfo = /// Gets the syntax range of this construct member Range: range +/// Represents one or two access modifier(s) in a property signature +[] +type SynValSigAccess = + | Single of accessibility: SynAccess option + | GetSet of + accessibility: SynAccess option * + getterAccessibility: SynAccess option * + setterAccessibility: SynAccess option + + member SingleAccess: unit -> SynAccess option + member GetSetAccessNoCheck: unit -> SynAccess option * SynAccess option + /// Represents the syntax tree for a 'val' definition in an abstract slot or a signature file [] type SynValSig = @@ -1493,7 +1522,7 @@ type SynValSig = isInline: bool * isMutable: bool * xmlDoc: PreXmlDoc * - accessibility: SynAccess option * + accessibility: SynValSigAccess * synExpr: SynExpr option * range: range * trivia: SynValSigTrivia @@ -1659,7 +1688,7 @@ type SynMemberDefn = memberFlags: SynMemberFlags * memberFlagsForSet: SynMemberFlags * xmlDoc: PreXmlDoc * - accessibility: SynAccess option * + accessibility: SynValSigAccess * synExpr: SynExpr * range: range * trivia: SynMemberDefnAutoPropertyTrivia diff --git a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs index 06a758163ab..dc08afd6368 100644 --- a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs +++ b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs @@ -210,7 +210,7 @@ let rec IsControlFlowExpression e = // // For example // let x = 1 + 1 -// gets extended to inludde the 'let x'. +// gets extended to include the 'let x'. // // A corner case: some things that look like simple value bindings get generalized, e.g. // let empty = [] @@ -1103,6 +1103,46 @@ let (|Get_OrSet_Ident|_|) (ident: Ident) = elif ident.idText.StartsWithOrdinal("set_") then ValueSome() else ValueNone +let getGetterSetterAccess synValSigAccess memberKind (langVersion: Features.LanguageVersion) = + match synValSigAccess with + | SynValSigAccess.Single(access) -> access, access + | SynValSigAccess.GetSet(access, getterAccess, setterAccess) -> + let checkAccess (access: SynAccess option) (accessBeforeGetSet: SynAccess option) = + match accessBeforeGetSet, access with + | None, _ -> access + | Some x, Some _ -> + errorR (Error(FSComp.SR.parsMultipleAccessibilitiesForGetSet (), x.Range)) + None + | Some x, None -> + checkLanguageFeatureAndRecover + langVersion + Features.LanguageFeature.AllowAccessModifiersToAutoPropertiesGettersAndSetters + x.Range + + accessBeforeGetSet + + match memberKind with + | SynMemberKind.PropertyGetSet -> + match access, (getterAccess, setterAccess) with + | _, (None, None) -> access, access + | None, (Some x, _) + | None, (_, Some x) -> + checkLanguageFeatureAndRecover + langVersion + Features.LanguageFeature.AllowAccessModifiersToAutoPropertiesGettersAndSetters + x.Range + + getterAccess, setterAccess + | _, (Some x, _) + | _, (_, Some x) -> + errorR (Error(FSComp.SR.parsMultipleAccessibilitiesForGetSet (), x.Range)) + None, None + + | SynMemberKind.PropertySet -> None, checkAccess access setterAccess + | SynMemberKind.Member + | SynMemberKind.PropertyGet + | _ -> checkAccess access getterAccess, None + let addEmptyMatchClause (mBar1: range) (mBar2: range) (clauses: SynMatchClause list) = let rec addOrPat (pat: SynPat) = match pat with diff --git a/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi b/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi index b86ee98cddb..568e745a167 100644 --- a/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi @@ -363,5 +363,8 @@ val (|TypesForTypar|): t: SynType -> SynType list [] val (|Get_OrSet_Ident|_|): Ident -> unit voption +val getGetterSetterAccess: + SynValSigAccess -> SynMemberKind -> Features.LanguageVersion -> SynAccess option * SynAccess option + /// Adds SynPat.Or pattern for unfinished empty clause above val addEmptyMatchClause: mBar1: range -> mBar2: range -> clauses: SynMatchClause list -> SynMatchClause list diff --git a/src/Compiler/SyntaxTree/SyntaxTrivia.fs b/src/Compiler/SyntaxTree/SyntaxTrivia.fs index 82c581520b4..0932befd7c1 100644 --- a/src/Compiler/SyntaxTree/SyntaxTrivia.fs +++ b/src/Compiler/SyntaxTree/SyntaxTrivia.fs @@ -270,6 +270,7 @@ type SynBindingTrivia = [] type SynExprAndBangTrivia = { + AndBangKeyword: range EqualsRange: range InKeyword: range option } @@ -403,6 +404,9 @@ type SynFieldTrivia = [] type SynTypeOrTrivia = { OrKeyword: range } +[] +type SynTypeWithNullTrivia = { BarRange: range } + [] type SynBindingReturnInfoTrivia = { ColonRange: range option } @@ -428,3 +432,6 @@ type SynMeasureConstantTrivia = LessRange: range GreaterRange: range } + +[] +type SynTypeConstraintWhereTyparNotSupportsNullTrivia = { ColonRange: range; NotRange: range } diff --git a/src/Compiler/SyntaxTree/SyntaxTrivia.fsi b/src/Compiler/SyntaxTree/SyntaxTrivia.fsi index 79c7903e78c..24bfc1b7a52 100644 --- a/src/Compiler/SyntaxTree/SyntaxTrivia.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTrivia.fsi @@ -334,9 +334,10 @@ type SynBindingTrivia = [] type SynExprAndBangTrivia = { + /// The syntax range of the `and!` keyword + AndBangKeyword: range /// The syntax range of the `=` token. EqualsRange: range - /// The syntax range of the `in` keyword. InKeyword: range option } @@ -511,6 +512,14 @@ type SynTypeOrTrivia = OrKeyword: range } +/// Represents additional information for SynType.WithNull +[] +type SynTypeWithNullTrivia = + { + /// The syntax range of the `|` token + BarRange: range + } + /// Represents additional information for SynBindingReturnInfo [] type SynBindingReturnInfoTrivia = @@ -544,3 +553,14 @@ type SynTyparDeclTrivia = type SynMeasureConstantTrivia = { LessRange: range GreaterRange: range } + +/// Represents additional information for SynTypeConstraint.WhereTyparNotSupportsNull +[] +type SynTypeConstraintWhereTyparNotSupportsNullTrivia = + { + /// The syntax range of `:` + ColonRange: range + + /// The syntax range of `not` + NotRange: range + } diff --git a/src/Compiler/SyntaxTree/XmlDoc.fs b/src/Compiler/SyntaxTree/XmlDoc.fs index 16de1a4b32c..a366a69a8a6 100644 --- a/src/Compiler/SyntaxTree/XmlDoc.fs +++ b/src/Compiler/SyntaxTree/XmlDoc.fs @@ -79,7 +79,7 @@ type XmlDoc(unprocessedLines: string[], range: range) = | Some paramNames -> for p in xml.Descendants(XName.op_Implicit "param") do - match p.Attribute(XName.op_Implicit "name") with + match p.Attribute(!!(XName.op_Implicit "name")) with | null -> warning (Error(FSComp.SR.xmlDocMissingParameterName (), doc.Range)) | attr -> let nm = attr.Value @@ -90,9 +90,9 @@ type XmlDoc(unprocessedLines: string[], range: range) = let paramsWithDocs = [ for p in xml.Descendants(XName.op_Implicit "param") do - match p.Attribute(XName.op_Implicit "name") with - | null -> () - | attr -> attr.Value + match p.Attribute(!!(XName.op_Implicit "name")) with + | Null -> () + | NonNull attr -> attr.Value ] if paramsWithDocs.Length > 0 then @@ -107,7 +107,7 @@ type XmlDoc(unprocessedLines: string[], range: range) = warning (Error(FSComp.SR.xmlDocDuplicateParameter (d), doc.Range)) for pref in xml.Descendants(XName.op_Implicit "paramref") do - match pref.Attribute(XName.op_Implicit "name") with + match pref.Attribute(!!(XName.op_Implicit "name")) with | null -> warning (Error(FSComp.SR.xmlDocMissingParameterName (), doc.Range)) | attr -> let nm = attr.Value @@ -307,7 +307,7 @@ type XmlDocumentationInfo private (tryGetXmlDocument: unit -> XmlDocument option let lines = Array.zeroCreate childNodes.Count for i = 0 to childNodes.Count - 1 do - let childNode = childNodes[i] + let childNode = !!childNodes[i] lines[i] <- childNode.OuterXml XmlDoc(lines, range0)) diff --git a/src/Compiler/TypedTree/QuotationPickler.fs b/src/Compiler/TypedTree/QuotationPickler.fs index 4c613f007d2..f2a58203ec6 100644 --- a/src/Compiler/TypedTree/QuotationPickler.fs +++ b/src/Compiler/TypedTree/QuotationPickler.fs @@ -249,7 +249,11 @@ let PickleBufferCapacity = 100000 module SimplePickle = - type Table<'T> = + type Table<'T +#if !NO_CHECKNULLS + when 'T:not null +#endif + > = { tbl: HashMultiMap<'T, int> // This should be "Dictionary" mutable rows: 'T list mutable count: int } diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs index 69a99dfe119..2c065437f2b 100644 --- a/src/Compiler/TypedTree/TcGlobals.fs +++ b/src/Compiler/TypedTree/TcGlobals.fs @@ -15,7 +15,6 @@ open System.Diagnostics open Internal.Utilities.Library open Internal.Utilities.Library.Extras open FSharp.Compiler.AbstractIL.IL -open FSharp.Compiler.AbstractIL.ILX open FSharp.Compiler.CompilerGlobalState open FSharp.Compiler.Features open FSharp.Compiler.IO @@ -24,9 +23,7 @@ open FSharp.Compiler.Text.FileIndex open FSharp.Compiler.Text.Range open FSharp.Compiler.TypedTree open FSharp.Compiler.TypedTreeBasics - open Internal.Utilities -open System.Reflection let internal DummyFileNameForRangesWithoutASpecificLocation = startupFileName let private envRange = rangeN DummyFileNameForRangesWithoutASpecificLocation 0 @@ -65,7 +62,6 @@ module FSharpLib = let LanguagePrimitivesName = Root + ".Core.LanguagePrimitives" let CompilerServicesName = Root + ".Core.CompilerServices" let LinqRuntimeHelpersName = Root + ".Linq.RuntimeHelpers" - let RuntimeHelpersName = Root + ".Core.CompilerServices.RuntimeHelpers" let ExtraTopLevelOperatorsName = Root + ".Core.ExtraTopLevelOperators" let NativeInteropName = Root + ".NativeInterop" @@ -77,7 +73,6 @@ module FSharpLib = let NativeInteropPath = splitNamespace NativeInteropName |> Array.ofList let CompilerServicesPath = splitNamespace CompilerServicesName |> Array.ofList let LinqRuntimeHelpersPath = splitNamespace LinqRuntimeHelpersName |> Array.ofList - let RuntimeHelpersPath = splitNamespace RuntimeHelpersName |> Array.ofList let QuotationsPath = splitNamespace QuotationsName |> Array.ofList let RootPathArray = RootPath |> Array.ofList @@ -187,20 +182,28 @@ type TcGlobals( directoryToResolveRelativePaths, mlCompatibility: bool, isInteractive: bool, + checkNullness: bool, useReflectionFreeCodeGen: bool, // The helper to find system types amongst referenced DLLs - tryFindSysTypeCcuHelper, + tryFindSysTypeCcuHelper: string list -> string -> bool -> FSharp.Compiler.TypedTree.CcuThunk option, emitDebugInfoInQuotations: bool, noDebugAttributes: bool, pathMap: PathMap, langVersion: LanguageVersion, realsig: bool) = - // empty flags - let v_knownWithoutNull = 0uy + let v_langFeatureNullness = langVersion.SupportsFeature LanguageFeature.NullnessChecking + + let v_knownWithNull = + if v_langFeatureNullness then KnownWithNull else KnownAmbivalentToNull + + let v_knownWithoutNull = + if v_langFeatureNullness then KnownWithoutNull else KnownAmbivalentToNull let mkNonGenericTy tcref = TType_app(tcref, [], v_knownWithoutNull) + let mkNonGenericTyWithNullness tcref nullness = TType_app(tcref, [], nullness) + let mkNonLocalTyconRef2 ccu path n = mkNonLocalTyconRef (mkNonLocalEntityRef ccu path) n let mk_MFCore_tcref ccu n = mkNonLocalTyconRef2 ccu CorePathArray n @@ -208,14 +211,11 @@ type TcGlobals( let mk_MFLinq_tcref ccu n = mkNonLocalTyconRef2 ccu LinqPathArray n let mk_MFCollections_tcref ccu n = mkNonLocalTyconRef2 ccu CollectionsPathArray n let mk_MFCompilerServices_tcref ccu n = mkNonLocalTyconRef2 ccu CompilerServicesPath n - let mk_MFRuntimeHelpers_tcref ccu n = mkNonLocalTyconRef2 ccu RuntimeHelpersPath n let mk_MFControl_tcref ccu n = mkNonLocalTyconRef2 ccu ControlPathArray n - let tryFindSysTypeCcu path nm = - tryFindSysTypeCcuHelper path nm false + let tryFindSysTypeCcu path nm = tryFindSysTypeCcuHelper path nm false - let tryFindPublicSysTypeCcu path nm = - tryFindSysTypeCcuHelper path nm true + let tryFindPublicSysTypeCcu path nm = tryFindSysTypeCcuHelper path nm true let vara = Construct.NewRigidTypar "a" envRange let varb = Construct.NewRigidTypar "b" envRange @@ -340,6 +340,9 @@ type TcGlobals( match name with | "System.Runtime.CompilerServices.IsReadOnlyAttribute" | "System.Runtime.CompilerServices.IsUnmanagedAttribute" + | "System.Runtime.CompilerServices.NullableAttribute" + | "System.Runtime.CompilerServices.NullableContextAttribute" + | "System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute" | "System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute" | "System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes" -> true | _ -> false @@ -374,14 +377,12 @@ type TcGlobals( let tryMkSysNonGenericTy path n = tryFindSysTyconRef path n |> Option.map mkNonGenericTy let sys = ["System"] - let sysLinq = ["System";"Linq"] let sysCollections = ["System";"Collections"] let sysGenerics = ["System";"Collections";"Generic"] let sysCompilerServices = ["System";"Runtime";"CompilerServices"] let lazy_tcr = findSysTyconRef sys "Lazy`1" let v_fslib_IEvent2_tcr = mk_MFControl_tcref fslibCcu "IEvent`2" - let v_tcref_IQueryable = findSysTyconRef sysLinq "IQueryable`1" let v_tcref_IObservable = findSysTyconRef sys "IObservable`1" let v_tcref_IObserver = findSysTyconRef sys "IObserver`1" let v_fslib_IDelegateEvent_tcr = mk_MFControl_tcref fslibCcu "IDelegateEvent`1" @@ -429,7 +430,9 @@ type TcGlobals( let v_enum_ty = mkNonGenericTy v_int_tcr let v_bool_ty = mkNonGenericTy v_bool_tcr let v_char_ty = mkNonGenericTy v_char_tcr - let v_obj_ty = mkNonGenericTy v_obj_tcr + let v_obj_ty_without_null = mkNonGenericTyWithNullness v_obj_tcr v_knownWithoutNull + let v_obj_ty_ambivalent = mkNonGenericTyWithNullness v_obj_tcr KnownAmbivalentToNull + let v_obj_ty_with_null = mkNonGenericTyWithNullness v_obj_tcr v_knownWithNull let v_IFormattable_tcref = findSysTyconRef sys "IFormattable" let v_FormattableString_tcref = findSysTyconRef sys "FormattableString" let v_IFormattable_ty = mkNonGenericTy v_IFormattable_tcref @@ -437,6 +440,7 @@ type TcGlobals( let v_FormattableStringFactory_tcref = findSysTyconRef sysCompilerServices "FormattableStringFactory" let v_FormattableStringFactory_ty = mkNonGenericTy v_FormattableStringFactory_tcref let v_string_ty = mkNonGenericTy v_string_tcr + let v_string_ty_ambivalent = mkNonGenericTyWithNullness v_string_tcr KnownAmbivalentToNull let v_decimal_ty = mkSysNonGenericTy sys "Decimal" let v_unit_ty = mkNonGenericTy v_unit_tcr_nice let v_system_Type_ty = mkSysNonGenericTy sys "Type" @@ -449,6 +453,7 @@ type TcGlobals( let mkByrefTy ty = TType_app(v_byref_tcr, [ty], v_knownWithoutNull) let mkNativePtrTy ty = TType_app(v_nativeptr_tcr, [ty], v_knownWithoutNull) let mkFunTy d r = TType_fun (d, r, v_knownWithoutNull) + let mkFunTyWithNullness d r nullness = TType_fun (d, r, nullness) let (-->) d r = mkFunTy d r let mkIteratedFunTy dl r = List.foldBack mkFunTy dl r let mkSmallRefTupledTy l = match l with [] -> v_unit_ty | [h] -> h | tys -> mkRawRefTupleTy tys @@ -646,16 +651,18 @@ type TcGlobals( | [_] -> None | _ -> TType_tuple (tupInfo, l) |> Some - - let decodeTupleTy tupInfo l = - match tryDecodeTupleTy tupInfo l with + let decodeTupleTyAndNullness tupInfo tinst _nullness = + match tryDecodeTupleTy tupInfo tinst with | Some ty -> ty | None -> failwith "couldn't decode tuple ty" - let decodeTupleTyIfPossible tcref tupInfo l = - match tryDecodeTupleTy tupInfo l with + let decodeTupleTyAndNullnessIfPossible tcref tupInfo tinst nullness = + match tryDecodeTupleTy tupInfo tinst with | Some ty -> ty - | None -> TType_app(tcref, l, v_knownWithoutNull) + | None -> TType_app(tcref, tinst, nullness) + + let decodeTupleTy tupInfo tinst = + decodeTupleTyAndNullness tupInfo tinst v_knownWithoutNull let mk_MFCore_attrib nm : BuiltinAttribInfo = AttribInfo(mkILTyRef(ilg.fsharpCoreAssemblyScopeRef, Core + "." + nm), mk_MFCore_tcref fslibCcu nm) @@ -720,11 +727,11 @@ type TcGlobals( let v_generic_hash_withc_inner_info = makeIntrinsicValRef(fslib_MFHashCompare_nleref, "GenericHashWithComparerIntrinsic" , None , None , [vara], mk_hash_withc_sig varaTy) let v_create_instance_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "CreateInstance" , None , None , [vara], ([[v_unit_ty]], varaTy)) - let v_unbox_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "UnboxGeneric" , None , None , [vara], ([[v_obj_ty]], varaTy)) + let v_unbox_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "UnboxGeneric" , None , None , [vara], ([[v_obj_ty_with_null]], varaTy)) - let v_unbox_fast_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "UnboxFast" , None , None , [vara], ([[v_obj_ty]], varaTy)) - let v_istype_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "TypeTestGeneric" , None , None , [vara], ([[v_obj_ty]], v_bool_ty)) - let v_istype_fast_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "TypeTestFast" , None , None , [vara], ([[v_obj_ty]], v_bool_ty)) + let v_unbox_fast_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "UnboxFast" , None , None , [vara], ([[v_obj_ty_with_null]], varaTy)) + let v_istype_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "TypeTestGeneric" , None , None , [vara], ([[v_obj_ty_with_null]], v_bool_ty)) + let v_istype_fast_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "TypeTestFast" , None , None , [vara], ([[v_obj_ty_with_null]], v_bool_ty)) let v_dispose_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "Dispose" , None , None , [vara], ([[varaTy]], v_unit_ty)) @@ -776,7 +783,6 @@ type TcGlobals( let v_sbyte_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "sbyte" , None , Some "ToSByte", [vara], ([[varaTy]], v_sbyte_ty)) let v_int16_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "int16" , None , Some "ToInt16", [vara], ([[varaTy]], v_int16_ty)) let v_uint16_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "uint16" , None , Some "ToUInt16", [vara], ([[varaTy]], v_uint16_ty)) - let v_int_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "int" , None , Some "ToInt", [vara], ([[varaTy]], v_int_ty)) let v_int32_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "int32" , None , Some "ToInt32", [vara], ([[varaTy]], v_int32_ty)) let v_uint32_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "uint32" , None , Some "ToUInt32", [vara], ([[varaTy]], v_uint32_ty)) let v_int64_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "int64" , None , Some "ToInt64", [vara], ([[varaTy]], v_int64_ty)) @@ -790,7 +796,7 @@ type TcGlobals( let v_enum_operator_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "enum" , None , Some "ToEnum", [vara], ([[varaTy]], v_enum_ty)) let v_hash_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "hash" , None , Some "Hash" , [vara], ([[varaTy]], v_int_ty)) - let v_box_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "box" , None , Some "Box" , [vara], ([[varaTy]], v_obj_ty)) + let v_box_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "box" , None , Some "Box" , [vara], ([[varaTy]], v_obj_ty_with_null)) let v_isnull_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "isNull" , None , Some "IsNull" , [vara], ([[varaTy]], v_bool_ty)) let v_raise_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "raise" , None , Some "Raise" , [vara], ([[mkSysNonGenericTy sys "Exception"]], varaTy)) let v_failwith_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "failwith" , None , Some "FailWith" , [vara], ([[v_string_ty]], varaTy)) @@ -824,7 +830,6 @@ type TcGlobals( let v_range_step_generic_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeStepGeneric" , None , None , [vara;varb], ([[varaTy];[varbTy];[varaTy]], mkSeqTy varaTy)) let v_array_length_info = makeIntrinsicValRef(fslib_MFArrayModule_nleref, "length" , None , Some "Length" , [vara], ([[mkArrayType 1 varaTy]], v_int_ty)) - let v_array_map_info = makeIntrinsicValRef(fslib_MFArrayModule_nleref, "map" , None , Some "Map" , [vara; varb], ([[varaTy --> varbTy]; [mkArrayType 1 varaTy]], mkArrayType 1 varbTy)) let v_array_get_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "GetArray" , None , None , [vara], ([[mkArrayType 1 varaTy]; [v_int_ty]], varaTy)) let v_array2D_get_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "GetArray2D" , None , None , [vara], ([[mkArrayType 2 varaTy];[v_int_ty]; [v_int_ty]], varaTy)) let v_array3D_get_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "GetArray3D" , None , None , [vara], ([[mkArrayType 3 varaTy];[v_int_ty]; [v_int_ty]; [v_int_ty]], varaTy)) @@ -834,8 +839,6 @@ type TcGlobals( let v_array3D_set_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "SetArray3D" , None , None , [vara], ([[mkArrayType 3 varaTy];[v_int_ty]; [v_int_ty]; [v_int_ty]; [varaTy]], v_unit_ty)) let v_array4D_set_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "SetArray4D" , None , None , [vara], ([[mkArrayType 4 varaTy];[v_int_ty]; [v_int_ty]; [v_int_ty]; [v_int_ty]; [varaTy]], v_unit_ty)) - let v_list_map_info = makeIntrinsicValRef(fslib_MFListModule_nleref, "map" , None , Some "Map" , [vara; varb], ([[varaTy --> varbTy]; [mkListTy varaTy]], mkListTy varbTy)) - let v_option_toNullable_info = makeIntrinsicValRef(fslib_MFOptionModule_nleref, "toNullable" , None , Some "ToNullable" , [vara], ([[mkOptionTy varaTy]], mkNullableTy varaTy)) let v_option_defaultValue_info = makeIntrinsicValRef(fslib_MFOptionModule_nleref, "defaultValue" , None , Some "DefaultValue" , [vara], ([[varaTy]; [mkOptionTy varaTy]], varaTy)) @@ -849,7 +852,7 @@ type TcGlobals( let v_seq_finally_info = makeIntrinsicValRef(fslib_MFRuntimeHelpers_nleref, "EnumerateThenFinally" , None , None , [varb], ([[mkSeqTy varbTy]; [v_unit_ty --> v_unit_ty]], mkSeqTy varbTy)) let v_seq_trywith_info = makeIntrinsicValRef(fslib_MFRuntimeHelpers_nleref, "EnumerateTryWith" , None , None , [varb], ([[mkSeqTy varbTy]; [mkNonGenericTy v_exn_tcr --> v_int32_ty]; [mkNonGenericTy v_exn_tcr --> mkSeqTy varbTy]], mkSeqTy varbTy)) let v_seq_of_functions_info = makeIntrinsicValRef(fslib_MFRuntimeHelpers_nleref, "EnumerateFromFunctions" , None , None , [vara;varb], ([[v_unit_ty --> varaTy]; [varaTy --> v_bool_ty]; [varaTy --> varbTy]], mkSeqTy varbTy)) - let v_create_event_info = makeIntrinsicValRef(fslib_MFRuntimeHelpers_nleref, "CreateEvent" , None , None , [vara;varb], ([[varaTy --> v_unit_ty]; [varaTy --> v_unit_ty]; [(v_obj_ty --> (varbTy --> v_unit_ty)) --> varaTy]], mkIEvent2Ty varaTy varbTy)) + let v_create_event_info = makeIntrinsicValRef(fslib_MFRuntimeHelpers_nleref, "CreateEvent" , None , None , [vara;varb], ([[varaTy --> v_unit_ty]; [varaTy --> v_unit_ty]; [(v_obj_ty_with_null --> (varbTy --> v_unit_ty)) --> varaTy]], mkIEvent2Ty varaTy varbTy)) let v_cgh__useResumableCode_info = makeIntrinsicValRef(fslib_MFStateMachineHelpers_nleref, "__useResumableCode" , None , None , [vara], ([[]], v_bool_ty)) let v_cgh__debugPoint_info = makeIntrinsicValRef(fslib_MFStateMachineHelpers_nleref, "__debugPoint" , None , None , [vara], ([[v_int_ty]; [varaTy]], varaTy)) let v_cgh__resumeAt_info = makeIntrinsicValRef(fslib_MFStateMachineHelpers_nleref, "__resumeAt" , None , None , [vara], ([[v_int_ty]; [varaTy]], varaTy)) @@ -866,7 +869,6 @@ type TcGlobals( let v_lazy_create_info = makeIntrinsicValRef(fslib_MFLazyExtensions_nleref, "Create" , Some "Lazy`1" , None , [vara], ([[v_unit_ty --> varaTy]], mkLazyTy varaTy)) let v_seq_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "seq" , None , Some "CreateSequence" , [vara], ([[mkSeqTy varaTy]], mkSeqTy varaTy)) - let v_refcell_info = makeIntrinsicValRef(fslib_MFCore_nleref, "ref" , Some "FSharpRef`1" , None , [vara], ([[mkRefCellTy varaTy]; []], varaTy)) let v_splice_expr_info = makeIntrinsicValRef(fslib_MFExtraTopLevelOperators_nleref, "op_Splice" , None , None , [vara], ([[mkQuotedExprTy varaTy]], varaTy)) let v_splice_raw_expr_info = makeIntrinsicValRef(fslib_MFExtraTopLevelOperators_nleref, "op_SpliceUntyped" , None , None , [vara], ([[mkRawQuotedExprTy]], varaTy)) let v_new_decimal_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "MakeDecimal" , None , None , [], ([[v_int_ty]; [v_int_ty]; [v_int_ty]; [v_bool_ty]; [v_byte_ty]], v_decimal_ty)) @@ -887,7 +889,6 @@ type TcGlobals( let v_query_source_info = makeIntrinsicValRef(fslib_MFLinq_nleref, "Source" , Some "QueryBuilder" , None , [vara], ([[mkQueryBuilderTy];[mkSeqTy varaTy ]], mkQuerySourceTy varaTy (mkNonGenericTy v_tcref_System_Collections_IEnumerable)) ) let v_query_source_as_enum_info = makeIntrinsicValRef(fslib_MFLinq_nleref, "get_Source" , Some "QuerySource`2" , None , [vara; vare], ([[mkQuerySourceTy varaTy vareTy];[]], mkSeqTy varaTy) ) let v_new_query_source_info = makeIntrinsicValRef(fslib_MFLinq_nleref, ".ctor" , Some "QuerySource`2" , None , [vara; vare], ([[mkSeqTy varaTy]], mkQuerySourceTy varaTy vareTy) ) - let v_query_where_value_info = makeIntrinsicValRef(fslib_MFLinq_nleref, "Where" , Some "QueryBuilder" , None , [vara; vare], ([[mkQueryBuilderTy];[mkQuerySourceTy varaTy vareTy;varaTy --> v_bool_ty]], mkQuerySourceTy varaTy vareTy) ) let v_query_zero_value_info = makeIntrinsicValRef(fslib_MFLinq_nleref, "Zero" , Some "QueryBuilder" , None , [vara; vare], ([[mkQueryBuilderTy];[]], mkQuerySourceTy varaTy vareTy) ) let v_fail_init_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "FailInit" , None , None , [], ([[v_unit_ty]], v_unit_ty)) let v_fail_static_init_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "FailStaticInit" , None , None , [], ([[v_unit_ty]], v_unit_ty)) @@ -971,25 +972,28 @@ type TcGlobals( "Single" , v_float32_tcr |] |> Array.map (fun (nm, tcr) -> let ty = mkNonGenericTy tcr - nm, findSysTyconRef sys nm, (fun _ -> ty)) + nm, findSysTyconRef sys nm, (fun _ nullness -> + match nullness with + | Nullness.Known NullnessInfo.WithoutNull -> ty + | _ -> mkNonGenericTyWithNullness tcr nullness)) let decompileTyconEntries = [| - "FSharpFunc`2" , v_fastFunc_tcr , (fun tinst -> mkFunTy (List.item 0 tinst) (List.item 1 tinst)) - "Tuple`2" , v_ref_tuple2_tcr , decodeTupleTy tupInfoRef - "Tuple`3" , v_ref_tuple3_tcr , decodeTupleTy tupInfoRef - "Tuple`4" , v_ref_tuple4_tcr , decodeTupleTy tupInfoRef - "Tuple`5" , v_ref_tuple5_tcr , decodeTupleTy tupInfoRef - "Tuple`6" , v_ref_tuple6_tcr , decodeTupleTy tupInfoRef - "Tuple`7" , v_ref_tuple7_tcr , decodeTupleTy tupInfoRef - "Tuple`8" , v_ref_tuple8_tcr , decodeTupleTyIfPossible v_ref_tuple8_tcr tupInfoRef - "ValueTuple`2" , v_struct_tuple2_tcr , decodeTupleTy tupInfoStruct - "ValueTuple`3" , v_struct_tuple3_tcr , decodeTupleTy tupInfoStruct - "ValueTuple`4" , v_struct_tuple4_tcr , decodeTupleTy tupInfoStruct - "ValueTuple`5" , v_struct_tuple5_tcr , decodeTupleTy tupInfoStruct - "ValueTuple`6" , v_struct_tuple6_tcr , decodeTupleTy tupInfoStruct - "ValueTuple`7" , v_struct_tuple7_tcr , decodeTupleTy tupInfoStruct - "ValueTuple`8" , v_struct_tuple8_tcr , decodeTupleTyIfPossible v_struct_tuple8_tcr tupInfoStruct |] + "FSharpFunc`2" , v_fastFunc_tcr , (fun tinst -> mkFunTyWithNullness (List.item 0 tinst) (List.item 1 tinst)) + "Tuple`2" , v_ref_tuple2_tcr , decodeTupleTyAndNullness tupInfoRef + "Tuple`3" , v_ref_tuple3_tcr , decodeTupleTyAndNullness tupInfoRef + "Tuple`4" , v_ref_tuple4_tcr , decodeTupleTyAndNullness tupInfoRef + "Tuple`5" , v_ref_tuple5_tcr , decodeTupleTyAndNullness tupInfoRef + "Tuple`6" , v_ref_tuple6_tcr , decodeTupleTyAndNullness tupInfoRef + "Tuple`7" , v_ref_tuple7_tcr , decodeTupleTyAndNullness tupInfoRef + "Tuple`8" , v_ref_tuple8_tcr , decodeTupleTyAndNullnessIfPossible v_ref_tuple8_tcr tupInfoRef + "ValueTuple`2" , v_struct_tuple2_tcr , decodeTupleTyAndNullness tupInfoStruct + "ValueTuple`3" , v_struct_tuple3_tcr , decodeTupleTyAndNullness tupInfoStruct + "ValueTuple`4" , v_struct_tuple4_tcr , decodeTupleTyAndNullness tupInfoStruct + "ValueTuple`5" , v_struct_tuple5_tcr , decodeTupleTyAndNullness tupInfoStruct + "ValueTuple`6" , v_struct_tuple6_tcr , decodeTupleTyAndNullness tupInfoStruct + "ValueTuple`7" , v_struct_tuple7_tcr , decodeTupleTyAndNullness tupInfoStruct + "ValueTuple`8" , v_struct_tuple8_tcr , decodeTupleTyAndNullnessIfPossible v_struct_tuple8_tcr tupInfoStruct |] let betterEntries = Array.append betterTyconEntries decompileTyconEntries @@ -1020,11 +1024,11 @@ type TcGlobals( let t = Dictionary.newWithSize entries.Length for nm, tcref, builder in entries do t.Add(nm, - (fun tcref2 tinst2 -> + (fun tcref2 tinst2 nullness -> if tyconRefEq tcref tcref2 then - builder tinst2 + builder tinst2 nullness else - TType_app (tcref2, tinst2, v_knownWithoutNull))) + TType_app (tcref2, tinst2, nullness))) betterTypeDict1 <- t t | _ -> betterTypeDict1 @@ -1046,32 +1050,32 @@ type TcGlobals( /// For logical purposes equate some F# types with .NET types, e.g. TType_tuple == System.Tuple/ValueTuple. /// Doing this normalization is a fairly performance critical piece of code as it is frequently invoked /// in the process of converting .NET metadata to F# internal compiler data structures (see import.fs). - let decompileTy (tcref: EntityRef) tinst = + let decompileTy (tcref: EntityRef) tinst nullness = if compilingFSharpCore then // No need to decompile when compiling FSharp.Core.dll - TType_app (tcref, tinst, v_knownWithoutNull) + TType_app (tcref, tinst, nullness) else let dict = getDecompileTypeDict() match dict.TryGetValue tcref.Stamp with - | true, builder -> builder tinst - | _ -> TType_app (tcref, tinst, v_knownWithoutNull) + | true, builder -> builder tinst nullness + | _ -> TType_app (tcref, tinst, nullness) /// For cosmetic purposes "improve" some .NET types, e.g. Int32 --> int32. /// Doing this normalization is a fairly performance critical piece of code as it is frequently invoked /// in the process of converting .NET metadata to F# internal compiler data structures (see import.fs). - let improveTy (tcref: EntityRef) tinst = + let improveTy (tcref: EntityRef) tinst nullness = if compilingFSharpCore then let dict = getBetterTypeDict1() match dict.TryGetValue tcref.LogicalName with - | true, builder -> builder tcref tinst - | _ -> TType_app (tcref, tinst, v_knownWithoutNull) + | true, builder -> builder tcref tinst nullness + | _ -> TType_app (tcref, tinst, nullness) else let dict = getBetterTypeDict2() match dict.TryGetValue tcref.Stamp with - | true, builder -> builder tinst - | _ -> TType_app (tcref, tinst, v_knownWithoutNull) + | true, builder -> builder tinst nullness + | _ -> TType_app (tcref, tinst, nullness) - // Adding an unnecessary "let" instead of inlining into a muiti-line pipelined compute-once "member val" that is too complex for @dsyme + // Adding an unnecessary "let" instead of inlining into a multi-line pipelined compute-once "member val" that is too complex for @dsyme let v_attribs_Unsupported = [ tryFindSysAttrib "System.Runtime.CompilerServices.ModuleInitializerAttribute" tryFindSysAttrib "System.Runtime.CompilerServices.CallerArgumentExpressionAttribute" @@ -1081,13 +1085,17 @@ type TcGlobals( tryFindSysAttrib "System.Runtime.CompilerServices.RequiredMemberAttribute" ] |> List.choose (Option.map (fun x -> x.TyconRef)) + static member IsInEmbeddableKnownSet name = isInEmbeddableKnownSet name + override _.ToString() = "" + member _.directoryToResolveRelativePaths = directoryToResolveRelativePaths + member _.ilg = ilg - static member IsInEmbeddableKnownSet name = isInEmbeddableKnownSet name + member _.noDebugAttributes = noDebugAttributes - member _.embeddedTypeDefs = embeddedILTypeDefs.Values |> Seq.toList + member _.tryFindSysTypeCcuHelper: string list -> string -> bool -> FSharp.Compiler.TypedTree.CcuThunk option = tryFindSysTypeCcuHelper member _.tryRemoveEmbeddedILTypeDefs () = [ for key in embeddedILTypeDefs.Keys.OrderBy id do @@ -1099,7 +1107,12 @@ type TcGlobals( // A table of all intrinsics that the compiler cares about member _.knownIntrinsics = v_knownIntrinsics - // empty flags + member _.checkNullness = checkNullness + + member _.langFeatureNullness = v_langFeatureNullness + + member _.knownWithNull = v_knownWithNull + member _.knownWithoutNull = v_knownWithoutNull // A table of known modules in FSharp.Core. Not all modules are necessarily listed, but the more we list the @@ -1114,8 +1127,6 @@ type TcGlobals( member _.emitDebugInfoInQuotations = emitDebugInfoInQuotations - member _.directoryToResolveRelativePaths = directoryToResolveRelativePaths - member _.pathMap = pathMap member _.langVersion = langVersion @@ -1136,10 +1147,6 @@ type TcGlobals( member _.list_tcr_canon = v_list_tcr_canon - member val set_tcr_canon = mk_MFCollections_tcref fslibCcu "Set`1" - - member val map_tcr_canon = mk_MFCollections_tcref fslibCcu "Map`2" - member _.lazy_tcr_canon = lazy_tcr member val refcell_tcr_nice = v_refcell_tcr_nice @@ -1164,10 +1171,6 @@ type TcGlobals( member _.nativeint_tcr = v_nativeint_tcr - member _.unativeint_tcr = v_unativeint_tcr - - member _.int_tcr = v_int_tcr - member _.int32_tcr = v_int32_tcr member _.int16_tcr = v_int16_tcr @@ -1194,8 +1197,6 @@ type TcGlobals( member _.unit_tcr_canon = v_unit_tcr_canon - member _.unit_tcr_nice = v_unit_tcr_nice - member _.exn_tcr = v_exn_tcr member _.char_tcr = v_char_tcr @@ -1246,7 +1247,6 @@ type TcGlobals( member _.MatchFailureException_tcr = v_mfe_tcr - member _.tcref_IQueryable = v_tcref_IQueryable member _.tcref_IObservable = v_tcref_IObservable @@ -1332,14 +1332,16 @@ type TcGlobals( member _.bool_ty = v_bool_ty member _.int_ty = v_int_ty member _.string_ty = v_string_ty + member _.string_ty_ambivalent = v_string_ty_ambivalent member _.system_IFormattable_tcref = v_IFormattable_tcref member _.system_FormattableString_tcref = v_FormattableString_tcref - member _.system_FormattableStringFactory_tcref = v_FormattableStringFactory_tcref member _.system_IFormattable_ty = v_IFormattable_ty member _.system_FormattableString_ty = v_FormattableString_ty member _.system_FormattableStringFactory_ty = v_FormattableStringFactory_ty member _.unit_ty = v_unit_ty - member _.obj_ty = v_obj_ty + member _.obj_ty_noNulls = v_obj_ty_without_null + member _.obj_ty_ambivalent = v_obj_ty_ambivalent + member _.obj_ty_withNulls = v_obj_ty_with_null member _.char_ty = v_char_ty member _.decimal_ty = v_decimal_ty @@ -1358,10 +1360,7 @@ type TcGlobals( member val system_Delegate_ty = mkSysNonGenericTy sys "Delegate" member val system_MulticastDelegate_ty = mkSysNonGenericTy sys "MulticastDelegate" member val system_Enum_ty = mkSysNonGenericTy sys "Enum" - member val system_Exception_ty = mkSysNonGenericTy sys "Exception" - member val system_String_typ = mkSysNonGenericTy sys "String" member val system_String_tcref = findSysTyconRef sys "String" - member val system_Int32_ty = mkSysNonGenericTy sys "Int32" member _.system_Type_ty = v_system_Type_ty member val system_TypedReference_tcref = tryFindSysTyconRef sys "TypedReference" member val system_ArgIterator_tcref = tryFindSysTyconRef sys "ArgIterator" @@ -1382,7 +1381,6 @@ type TcGlobals( member val system_Single_tcref = findSysTyconRef sys "Single" member val system_Double_tcref = findSysTyconRef sys "Double" member val system_RuntimeTypeHandle_ty = mkSysNonGenericTy sys "RuntimeTypeHandle" - member _.system_RuntimeMethodHandle_ty = v_system_RuntimeMethodHandle_ty member val system_MarshalByRefObject_tcref = tryFindSysTyconRef sys "MarshalByRefObject" member val system_MarshalByRefObject_ty = tryMkSysNonGenericTy sys "MarshalByRefObject" @@ -1390,14 +1388,11 @@ type TcGlobals( member val system_ExceptionDispatchInfo_ty = tryMkSysNonGenericTy ["System"; "Runtime"; "ExceptionServices"] "ExceptionDispatchInfo" - member _.system_Reflection_MethodInfo_ty = v_system_Reflection_MethodInfo_ty member _.mk_IAsyncStateMachine_ty = mkSysNonGenericTy sysCompilerServices "IAsyncStateMachine" - member val system_Array_tcref = v_Array_tcref member val system_Object_tcref = findSysTyconRef sys "Object" member val system_Value_tcref = findSysTyconRef sys "ValueType" member val system_Void_tcref = findSysTyconRef sys "Void" - member val system_IndexOutOfRangeException_tcref = findSysTyconRef sys "IndexOutOfRangeException" member val system_Nullable_tcref = v_nullable_tcr member val system_GenericIComparable_tcref = findSysTyconRef sys "IComparable`1" member val system_GenericIEquatable_tcref = findSysTyconRef sys "IEquatable`1" @@ -1415,7 +1410,6 @@ type TcGlobals( member val tcref_System_Collections_IEqualityComparer = findSysTyconRef sysCollections "IEqualityComparer" member val tcref_System_Collections_Generic_IEqualityComparer = findSysTyconRef sysGenerics "IEqualityComparer`1" member val tcref_System_Collections_Generic_Dictionary = findSysTyconRef sysGenerics "Dictionary`2" - member val tcref_System_Collections_Generic_IDictionary = findSysTyconRef sysGenerics "IDictionary`2" member val tcref_System_IComparable = findSysTyconRef sys "IComparable" member val tcref_System_IStructuralComparable = findSysTyconRef sysCollections "IStructuralComparable" @@ -1424,7 +1418,6 @@ type TcGlobals( member val tcref_LanguagePrimitives = mk_MFCore_tcref fslibCcu "LanguagePrimitives" - member val tcref_System_Collections_Generic_List = findSysTyconRef sysGenerics "List`1" member val tcref_System_Collections_Generic_IList = findSysTyconRef sysGenerics "IList`1" member val tcref_System_Collections_Generic_IReadOnlyList = findSysTyconRef sysGenerics "IReadOnlyList`1" member val tcref_System_Collections_Generic_ICollection = findSysTyconRef sysGenerics "ICollection`1" @@ -1439,7 +1432,6 @@ type TcGlobals( // Review: Does this need to be an option type? member val System_Runtime_CompilerServices_RuntimeFeature_ty = tryFindSysTyconRef sysCompilerServices "RuntimeFeature" |> Option.map mkNonGenericTy - member val iltyp_TypedReference = tryFindSysILTypeRef "System.TypedReference" |> Option.map mkILNonGenericValueTy member val iltyp_StreamingContext = tryFindSysILTypeRef tname_StreamingContext |> Option.map mkILNonGenericValueTy member val iltyp_SerializationInfo = tryFindSysILTypeRef tname_SerializationInfo |> Option.map mkILNonGenericBoxedTy member val iltyp_Missing = findSysILTypeRef tname_Missing |> mkILNonGenericBoxedTy @@ -1464,6 +1456,11 @@ type TcGlobals( member val attrib_IsReadOnlyAttribute = findOrEmbedSysPublicType "System.Runtime.CompilerServices.IsReadOnlyAttribute" member val attrib_IsUnmanagedAttribute = findOrEmbedSysPublicType "System.Runtime.CompilerServices.IsUnmanagedAttribute" member val attrib_DynamicDependencyAttribute = findOrEmbedSysPublicType "System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute" + member val attrib_NullableAttribute_opt = tryFindSysAttrib "System.Runtime.CompilerServices.NullableAttribute" + member val attrib_NullableContextAttribute_opt = tryFindSysAttrib "System.Runtime.CompilerServices.NullableContextAttribute" + member val attrib_NullableAttribute = findOrEmbedSysPublicType "System.Runtime.CompilerServices.NullableAttribute" + member val attrib_NullableContextAttribute = findOrEmbedSysPublicType "System.Runtime.CompilerServices.NullableContextAttribute" + member val attrib_MemberNotNullWhenAttribute = findOrEmbedSysPublicType "System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute" member val enum_DynamicallyAccessedMemberTypes = findOrEmbedSysPublicType "System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes" member val attrib_SystemObsolete = findSysAttrib "System.ObsoleteAttribute" @@ -1479,7 +1476,6 @@ type TcGlobals( member val attrib_OptionalAttribute = tryFindSysAttrib "System.Runtime.InteropServices.OptionalAttribute" member val attrib_DefaultParameterValueAttribute = tryFindSysAttrib "System.Runtime.InteropServices.DefaultParameterValueAttribute" member val attrib_ThreadStaticAttribute = tryFindSysAttrib "System.ThreadStaticAttribute" - member val attrib_SpecialNameAttribute = tryFindSysAttrib "System.Runtime.CompilerServices.SpecialNameAttribute" member val attrib_VolatileFieldAttribute = mk_MFCore_attrib "VolatileFieldAttribute" member val attrib_NoEagerConstraintApplicationAttribute = mk_MFCompilerServices_attrib "NoEagerConstraintApplicationAttribute" member val attrib_ContextStaticAttribute = tryFindSysAttrib "System.ContextStaticAttribute" @@ -1493,7 +1489,6 @@ type TcGlobals( member val attrib_CallerLineNumberAttribute = findSysAttrib "System.Runtime.CompilerServices.CallerLineNumberAttribute" member val attrib_CallerFilePathAttribute = findSysAttrib "System.Runtime.CompilerServices.CallerFilePathAttribute" member val attrib_CallerMemberNameAttribute = findSysAttrib "System.Runtime.CompilerServices.CallerMemberNameAttribute" - member val attrib_ReferenceAssemblyAttribute = findSysAttrib "System.Runtime.CompilerServices.ReferenceAssemblyAttribute" member val attrib_SkipLocalsInitAttribute = findSysAttrib "System.Runtime.CompilerServices.SkipLocalsInitAttribute" member val attribs_Unsupported = v_attribs_Unsupported @@ -1543,6 +1538,7 @@ type TcGlobals( member val attrib_MeasureableAttribute = mk_MFCore_attrib "MeasureAnnotatedAbbreviationAttribute" member val attrib_NoDynamicInvocationAttribute = mk_MFCore_attrib "NoDynamicInvocationAttribute" member val attrib_NoCompilerInliningAttribute = mk_MFCore_attrib "NoCompilerInliningAttribute" + member val attrib_WarnOnWithoutNullArgumentAttribute = mk_MFCore_attrib "WarnOnWithoutNullArgumentAttribute" member val attrib_SecurityAttribute = tryFindSysAttrib "System.Security.Permissions.SecurityAttribute" member val attrib_SecurityCriticalAttribute = findSysAttrib "System.Security.SecurityCriticalAttribute" member val attrib_SecuritySafeCriticalAttribute = findSysAttrib "System.Security.SecuritySafeCriticalAttribute" @@ -1558,7 +1554,6 @@ type TcGlobals( member _.new_decimal_info = v_new_decimal_info member _.seq_info = v_seq_info member val seq_vref = (ValRefForIntrinsic v_seq_info) - member val fsharpref_vref = (ValRefForIntrinsic v_refcell_info) member val and_vref = (ValRefForIntrinsic v_and_info) member val and2_vref = (ValRefForIntrinsic v_and2_info) member val addrof_vref = (ValRefForIntrinsic v_addrof_info) @@ -1616,9 +1611,7 @@ type TcGlobals( member _.unchecked_multiply_info = v_unchecked_multiply_info member _.unchecked_division_info = v_unchecked_division_info member _.unchecked_modulus_info = v_unchecked_modulus_info - member _.unchecked_unary_plus_info = v_unchecked_unary_plus_info member _.unchecked_unary_minus_info = v_unchecked_unary_minus_info - member _.unchecked_unary_not_info = v_unchecked_unary_not_info member _.unchecked_defaultof_info = v_unchecked_defaultof_info member _.checked_addition_info = v_checked_addition_info @@ -1642,7 +1635,6 @@ type TcGlobals( member _.sbyte_operator_info = v_sbyte_operator_info member _.int16_operator_info = v_int16_operator_info member _.uint16_operator_info = v_uint16_operator_info - member _.int_operator_info = v_int_operator_info member _.int32_operator_info = v_int32_operator_info member _.uint32_operator_info = v_uint32_operator_info member _.int64_operator_info = v_int64_operator_info @@ -1684,13 +1676,7 @@ type TcGlobals( member _.box_info = v_box_info member _.isnull_info = v_isnull_info member _.raise_info = v_raise_info - member _.failwith_info = v_failwith_info - member _.invalid_arg_info = v_invalid_arg_info - member _.null_arg_info = v_null_arg_info - member _.invalid_op_info = v_invalid_op_info - member _.failwithf_info = v_failwithf_info member _.reraise_info = v_reraise_info - member _.methodhandleof_info = v_methodhandleof_info member _.typeof_info = v_typeof_info member _.typedefof_info = v_typedefof_info @@ -1718,11 +1704,9 @@ type TcGlobals( member val range_generic_op_vref = ValRefForIntrinsic v_range_generic_op_info member val range_step_generic_op_vref = ValRefForIntrinsic v_range_step_generic_op_info member val array_get_vref = ValRefForIntrinsic v_array_get_info - member val array_map_vref = ValRefForIntrinsic v_array_map_info member val array2D_get_vref = ValRefForIntrinsic v_array2D_get_info member val array3D_get_vref = ValRefForIntrinsic v_array3D_get_info member val array4D_get_vref = ValRefForIntrinsic v_array4D_get_info - member val list_map_vref = ValRefForIntrinsic v_list_map_info member val seq_singleton_vref = ValRefForIntrinsic v_seq_singleton_info member val seq_collect_vref = ValRefForIntrinsic v_seq_collect_info member val nativeptr_tobyref_vref = ValRefForIntrinsic v_nativeptr_tobyref_info @@ -1731,7 +1715,6 @@ type TcGlobals( member val seq_append_vref = ValRefForIntrinsic v_seq_append_info member val seq_generated_vref = ValRefForIntrinsic v_seq_generated_info member val seq_finally_vref = ValRefForIntrinsic v_seq_finally_info - member val seq_of_functions_vref = ValRefForIntrinsic v_seq_of_functions_info member val seq_map_vref = ValRefForIntrinsic v_seq_map_info member val seq_empty_vref = ValRefForIntrinsic v_seq_empty_info member val new_format_vref = ValRefForIntrinsic v_new_format_info @@ -1748,7 +1731,6 @@ type TcGlobals( member val query_yield_vref = ValRefForIntrinsic v_query_yield_value_info member val query_yield_from_vref = ValRefForIntrinsic v_query_yield_from_value_info member val query_select_vref = ValRefForIntrinsic v_query_select_value_info - member val query_where_vref = ValRefForIntrinsic v_query_where_value_info member val query_zero_vref = ValRefForIntrinsic v_query_zero_value_info member val seq_to_list_vref = ValRefForIntrinsic v_seq_to_list_info member val seq_to_array_vref = ValRefForIntrinsic v_seq_to_array_info @@ -1774,7 +1756,6 @@ type TcGlobals( member _.getstring_info = v_getstring_info member _.unbox_fast_info = v_unbox_fast_info member _.istype_info = v_istype_info - member _.istype_fast_info = v_istype_fast_info member _.lazy_force_info = v_lazy_force_info member _.lazy_create_info = v_lazy_create_info member _.create_instance_info = v_create_instance_info @@ -1783,7 +1764,6 @@ type TcGlobals( member _.seq_to_array_info = v_seq_to_array_info member _.array_length_info = v_array_length_info - member _.array_map_info = v_array_map_info member _.array_get_info = v_array_get_info member _.array2D_get_info = v_array2D_get_info member _.array3D_get_info = v_array3D_get_info @@ -1793,8 +1773,6 @@ type TcGlobals( member _.array3D_set_info = v_array3D_set_info member _.array4D_set_info = v_array4D_set_info - member _.list_map_info = v_list_map_info - member val option_toNullable_info = v_option_toNullable_info member val option_defaultValue_info = v_option_defaultValue_info @@ -1855,6 +1833,10 @@ type TcGlobals( /// Indicates if we can use System.Array.Empty when emitting IL for empty array literals member val isArrayEmptyAvailable = v_Array_tcref.ILTyconRawMetadata.Methods.FindByName "Empty" |> List.isEmpty |> not + member g.isSpliceOperator v = + primValRefEq g.compilingFSharpCore g.fslibCcu v g.splice_expr_vref || + primValRefEq g.compilingFSharpCore g.fslibCcu v g.splice_raw_expr_vref + member _.FindSysTyconRef path nm = findSysTyconRef path nm member _.TryFindSysTyconRef path nm = tryFindSysTyconRef path nm @@ -1911,7 +1893,7 @@ type TcGlobals( member _.MakeInternalsVisibleToAttribute(simpleAssemName) = mkILCustomAttribute (tref_InternalsVisibleToAttribute, [ilg.typ_String], [ILAttribElem.String (Some simpleAssemName)], []) - /// Find an FSharp.Core LaguagePrimitives dynamic function that corresponds to a trait witness, e.g. + /// Find an FSharp.Core LanguagePrimitives dynamic function that corresponds to a trait witness, e.g. /// AdditionDynamic for op_Addition. Also work out the type instantiation of the dynamic function. member _.MakeBuiltInWitnessInfo (t: TraitConstraintInfo) = let memberName = diff --git a/src/Compiler/TypedTree/TcGlobals.fsi b/src/Compiler/TypedTree/TcGlobals.fsi new file mode 100644 index 00000000000..950d5217500 --- /dev/null +++ b/src/Compiler/TypedTree/TcGlobals.fsi @@ -0,0 +1,1375 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +module internal FSharp.Compiler.TcGlobals + +val internal DummyFileNameForRangesWithoutASpecificLocation: string + +/// Represents an intrinsic value from FSharp.Core known to the compiler +[] +type internal IntrinsicValRef = + | IntrinsicValRef of + FSharp.Compiler.TypedTree.NonLocalEntityRef * + string * + bool * + FSharp.Compiler.TypedTree.TType * + FSharp.Compiler.TypedTree.ValLinkageFullKey + + /// For debugging + override ToString: unit -> string + + /// For debugging + [ (0))>] + member DebugText: string + + member Name: string + +val internal ValRefForIntrinsic: IntrinsicValRef -> FSharp.Compiler.TypedTree.ValRef + +[] +module internal FSharpLib = + + val Root: string + + val RootPath: string list + + val Core: string + + val CorePath: string list + + val CoreOperatorsCheckedName: string + + val ControlName: string + + val LinqName: string + + val CollectionsName: string + + val LanguagePrimitivesName: string + + val CompilerServicesName: string + + val LinqRuntimeHelpersName: string + + val ExtraTopLevelOperatorsName: string + + val NativeInteropName: string + + val QuotationsName: string + + val ControlPath: string list + + val LinqPath: string list + + val CollectionsPath: string list + + val NativeInteropPath: string array + + val CompilerServicesPath: string array + + val LinqRuntimeHelpersPath: string array + + val QuotationsPath: string array + + val RootPathArray: string array + + val CorePathArray: string array + + val LinqPathArray: string array + + val ControlPathArray: string array + + val CollectionsPathArray: string array + +[] +type internal BuiltinAttribInfo = + | AttribInfo of FSharp.Compiler.AbstractIL.IL.ILTypeRef * FSharp.Compiler.TypedTree.TyconRef + + /// For debugging + override ToString: unit -> string + + /// For debugging + [ (0))>] + member DebugText: string + + member TyconRef: FSharp.Compiler.TypedTree.TyconRef + + member TypeRef: FSharp.Compiler.AbstractIL.IL.ILTypeRef + +[] +val internal tname_InternalsVisibleToAttribute: string = "System.Runtime.CompilerServices.InternalsVisibleToAttribute" + +[] +val internal tname_DebuggerHiddenAttribute: string = "System.Diagnostics.DebuggerHiddenAttribute" + +[] +val internal tname_DebuggerStepThroughAttribute: string = "System.Diagnostics.DebuggerStepThroughAttribute" + +[] +val internal tname_StringBuilder: string = "System.Text.StringBuilder" + +[] +val internal tname_FormattableString: string = "System.FormattableString" + +[] +val internal tname_SecurityPermissionAttribute: string = "System.Security.Permissions.SecurityPermissionAttribute" + +[] +val internal tname_Delegate: string = "System.Delegate" + +[] +val internal tname_Enum: string = "System.Enum" + +[] +val internal tname_FlagsAttribute: string = "System.FlagsAttribute" + +[] +val internal tname_Array: string = "System.Array" + +[] +val internal tname_RuntimeArgumentHandle: string = "System.RuntimeArgumentHandle" + +[] +val internal tname_IsByRefLikeAttribute: string = "System.Runtime.CompilerServices.IsByRefLikeAttribute" + +type internal TcGlobals = + + new: + compilingFSharpCore: bool * + ilg: FSharp.Compiler.AbstractIL.IL.ILGlobals * + fslibCcu: FSharp.Compiler.TypedTree.CcuThunk * + directoryToResolveRelativePaths: string * + mlCompatibility: bool * + isInteractive: bool * + checkNullness: bool * + useReflectionFreeCodeGen: bool * + tryFindSysTypeCcuHelper: (string list -> string -> bool -> FSharp.Compiler.TypedTree.CcuThunk option) * + emitDebugInfoInQuotations: bool * + noDebugAttributes: bool * + pathMap: Internal.Utilities.PathMap * + langVersion: FSharp.Compiler.Features.LanguageVersion * + realsig: bool -> + TcGlobals + + static member IsInEmbeddableKnownSet: name: string -> bool + + member directoryToResolveRelativePaths: string + + member noDebugAttributes: bool + + member tryFindSysTypeCcuHelper: (string list -> string -> bool -> FSharp.Compiler.TypedTree.CcuThunk option) with get + + member AddFieldGeneratedAttributes: + mdef: FSharp.Compiler.AbstractIL.IL.ILFieldDef -> FSharp.Compiler.AbstractIL.IL.ILFieldDef + + member AddFieldNeverAttributes: + mdef: FSharp.Compiler.AbstractIL.IL.ILFieldDef -> FSharp.Compiler.AbstractIL.IL.ILFieldDef + + member AddGeneratedAttributes: + attrs: FSharp.Compiler.AbstractIL.IL.ILAttributes -> FSharp.Compiler.AbstractIL.IL.ILAttributes + + member AddMethodGeneratedAttributes: + mdef: FSharp.Compiler.AbstractIL.IL.ILMethodDef -> FSharp.Compiler.AbstractIL.IL.ILMethodDef + + member AddPropertyGeneratedAttributes: + mdef: FSharp.Compiler.AbstractIL.IL.ILPropertyDef -> FSharp.Compiler.AbstractIL.IL.ILPropertyDef + + member AddPropertyNeverAttributes: + mdef: FSharp.Compiler.AbstractIL.IL.ILPropertyDef -> FSharp.Compiler.AbstractIL.IL.ILPropertyDef + + member AddValGeneratedAttributes: v: FSharp.Compiler.TypedTree.Val -> (FSharp.Compiler.Text.range -> unit) + + member FindSysAttrib: nm: string -> BuiltinAttribInfo + + member FindSysILTypeRef: nm: string -> FSharp.Compiler.AbstractIL.IL.ILTypeRef + + member isSpliceOperator: FSharp.Compiler.TypedTree.ValRef -> bool + + member FindSysTyconRef: path: string list -> nm: string -> FSharp.Compiler.TypedTree.EntityRef + + member HasTailCallAttrib: attribs: FSharp.Compiler.TypedTree.Attribs -> bool + + /// Find an FSharp.Core LanguagePrimitives dynamic function that corresponds to a trait witness, e.g. + /// AdditionDynamic for op_Addition. Also work out the type instantiation of the dynamic function. + member MakeBuiltInWitnessInfo: + t: FSharp.Compiler.TypedTree.TraitConstraintInfo -> IntrinsicValRef * FSharp.Compiler.TypedTree.TType list + + member MakeInternalsVisibleToAttribute: simpleAssemName: string -> FSharp.Compiler.AbstractIL.IL.ILAttribute + + member MkDebuggerTypeProxyAttribute: + ty: FSharp.Compiler.AbstractIL.IL.ILType -> FSharp.Compiler.AbstractIL.IL.ILAttribute + + member TryEmbedILType: + tref: FSharp.Compiler.AbstractIL.IL.ILTypeRef * + mkEmbeddableType: (unit -> FSharp.Compiler.AbstractIL.IL.ILTypeDef) -> + unit + + member TryFindSysAttrib: nm: string -> BuiltinAttribInfo option + + member TryFindSysILTypeRef: nm: string -> FSharp.Compiler.AbstractIL.IL.ILTypeRef option + + member TryFindSysTyconRef: path: string list -> nm: string -> FSharp.Compiler.TypedTree.EntityRef option + + /// Find an FSharp.Core operator that corresponds to a trait witness + member TryMakeOperatorAsBuiltInWitnessInfo: + isStringTy: (TcGlobals -> FSharp.Compiler.TypedTree.TType -> bool) -> + isArrayTy: (TcGlobals -> FSharp.Compiler.TypedTree.TType -> bool) -> + t: FSharp.Compiler.TypedTree.TraitConstraintInfo -> + argExprs: 'a list -> + (IntrinsicValRef * FSharp.Compiler.TypedTree.TType list * 'a list) option + + member decompileType: + tcref: FSharp.Compiler.TypedTree.EntityRef -> + tinst: FSharp.Compiler.TypedTree.TypeInst -> + (FSharp.Compiler.TypedTree.Nullness -> FSharp.Compiler.TypedTree.TType) + + member improveType: + tcref: FSharp.Compiler.TypedTree.EntityRef -> + tinst: FSharp.Compiler.TypedTree.TType list -> + (FSharp.Compiler.TypedTree.Nullness -> FSharp.Compiler.TypedTree.TType) + + /// Memoization table to help minimize the number of ILSourceDocument objects we create + member memoize_file: x: int -> FSharp.Compiler.AbstractIL.IL.ILSourceDocument + + member mkDebuggableAttributeV2: + jitTracking: bool * jitOptimizerDisabled: bool -> FSharp.Compiler.AbstractIL.IL.ILAttribute + + member mkDebuggerDisplayAttribute: s: string -> FSharp.Compiler.AbstractIL.IL.ILAttribute + + member mk_ArrayCollector_ty: seqElemTy: FSharp.Compiler.TypedTree.TType -> FSharp.Compiler.TypedTree.TType + + member mk_GeneratedSequenceBase_ty: seqElemTy: FSharp.Compiler.TypedTree.TType -> FSharp.Compiler.TypedTree.TType + + member mk_IResumableStateMachine_ty: dataTy: FSharp.Compiler.TypedTree.TType -> FSharp.Compiler.TypedTree.TType + + member mk_ListCollector_ty: seqElemTy: FSharp.Compiler.TypedTree.TType -> FSharp.Compiler.TypedTree.TType + + member mk_ResumableStateMachine_ty: dataTy: FSharp.Compiler.TypedTree.TType -> FSharp.Compiler.TypedTree.TType + + member tryRemoveEmbeddedILTypeDefs: unit -> FSharp.Compiler.AbstractIL.IL.ILTypeDef list + + member unionCaseRefEq: + x: FSharp.Compiler.TypedTree.UnionCaseRef -> y: FSharp.Compiler.TypedTree.UnionCaseRef -> bool + + member valRefEq: x: FSharp.Compiler.TypedTree.ValRef -> y: FSharp.Compiler.TypedTree.ValRef -> bool + + member CompilerGeneratedAttribute: FSharp.Compiler.AbstractIL.IL.ILAttribute + + member CompilerGlobalState: FSharp.Compiler.CompilerGlobalState.CompilerGlobalState option + + member DebuggerBrowsableNeverAttribute: FSharp.Compiler.AbstractIL.IL.ILAttribute + + member DebuggerNonUserCodeAttribute: FSharp.Compiler.AbstractIL.IL.ILAttribute + + member IComparer_ty: FSharp.Compiler.TypedTree.TType + + member IEqualityComparer_ty: FSharp.Compiler.TypedTree.TType + + member ListCollector_tcr: FSharp.Compiler.TypedTree.EntityRef + + member MatchFailureException_tcr: FSharp.Compiler.TypedTree.EntityRef + + member ResumableCode_tcr: FSharp.Compiler.TypedTree.EntityRef + + member System_Runtime_CompilerServices_RuntimeFeature_ty: FSharp.Compiler.TypedTree.TType option + + member addrof2_vref: FSharp.Compiler.TypedTree.ValRef + + member addrof_vref: FSharp.Compiler.TypedTree.ValRef + + member and2_vref: FSharp.Compiler.TypedTree.ValRef + + member and_vref: FSharp.Compiler.TypedTree.ValRef + + member array2D_get_info: IntrinsicValRef + + member array2D_get_vref: FSharp.Compiler.TypedTree.ValRef + + member array2D_set_info: IntrinsicValRef + + member array3D_get_info: IntrinsicValRef + + member array3D_get_vref: FSharp.Compiler.TypedTree.ValRef + + member array3D_set_info: IntrinsicValRef + + member array4D_get_info: IntrinsicValRef + + member array4D_get_vref: FSharp.Compiler.TypedTree.ValRef + + member array4D_set_info: IntrinsicValRef + + member array_get_info: IntrinsicValRef + + member array_get_vref: FSharp.Compiler.TypedTree.ValRef + + member array_length_info: IntrinsicValRef + + member array_set_info: IntrinsicValRef + + member array_tcr_nice: FSharp.Compiler.TypedTree.EntityRef + + member attrib_AbstractClassAttribute: BuiltinAttribInfo + + member attrib_AllowNullLiteralAttribute: BuiltinAttribInfo + + member attrib_AttributeUsageAttribute: BuiltinAttribInfo + + member attrib_AutoOpenAttribute: BuiltinAttribInfo + + member attrib_AutoSerializableAttribute: BuiltinAttribInfo + + member attrib_CLIEventAttribute: BuiltinAttribInfo + + member attrib_CLIMutableAttribute: BuiltinAttribInfo + + member attrib_CallerFilePathAttribute: BuiltinAttribInfo + + member attrib_CallerLineNumberAttribute: BuiltinAttribInfo + + member attrib_CallerMemberNameAttribute: BuiltinAttribInfo + + member attrib_ClassAttribute: BuiltinAttribInfo + + member attrib_ComImportAttribute: BuiltinAttribInfo option + + member attrib_ComVisibleAttribute: BuiltinAttribInfo + + member attrib_ComparisonConditionalOnAttribute: BuiltinAttribInfo + + member attrib_CompilationArgumentCountsAttribute: BuiltinAttribInfo + + member attrib_CompilationMappingAttribute: BuiltinAttribInfo + + member attrib_CompilationRepresentationAttribute: BuiltinAttribInfo + + member attrib_CompiledNameAttribute: BuiltinAttribInfo + + member attrib_CompilerFeatureRequiredAttribute: BuiltinAttribInfo + + member attrib_CompilerMessageAttribute: BuiltinAttribInfo + + member attrib_ComponentModelEditorBrowsableAttribute: BuiltinAttribInfo + + member attrib_ConditionalAttribute: BuiltinAttribInfo + + member attrib_ContextStaticAttribute: BuiltinAttribInfo option + + member attrib_CustomComparisonAttribute: BuiltinAttribInfo + + member attrib_CustomEqualityAttribute: BuiltinAttribInfo + + member attrib_CustomOperationAttribute: BuiltinAttribInfo + + member attrib_DebuggerDisplayAttribute: BuiltinAttribInfo + + member attrib_DebuggerTypeProxyAttribute: BuiltinAttribInfo + + member attrib_DefaultAugmentationAttribute: BuiltinAttribInfo + + member attrib_DefaultMemberAttribute: BuiltinAttribInfo + + member attrib_DefaultParameterValueAttribute: BuiltinAttribInfo option + + member attrib_DefaultValueAttribute: BuiltinAttribInfo + + member attrib_DllImportAttribute: BuiltinAttribInfo option + + member attrib_DynamicDependencyAttribute: BuiltinAttribInfo + + member attrib_EntryPointAttribute: BuiltinAttribInfo + + member attrib_EqualityConditionalOnAttribute: BuiltinAttribInfo + + member attrib_ExperimentalAttribute: BuiltinAttribInfo + + member attrib_ExtensionAttribute: BuiltinAttribInfo + + member attrib_FieldOffsetAttribute: BuiltinAttribInfo + + member attrib_FlagsAttribute: BuiltinAttribInfo + + member attrib_GeneralizableValueAttribute: BuiltinAttribInfo + + member attrib_IDispatchConstantAttribute: BuiltinAttribInfo option + + member attrib_IUnknownConstantAttribute: BuiltinAttribInfo option + + member attrib_InAttribute: BuiltinAttribInfo + + member attrib_InlineIfLambdaAttribute: BuiltinAttribInfo + + member attrib_InterfaceAttribute: BuiltinAttribInfo + + member attrib_InternalsVisibleToAttribute: BuiltinAttribInfo + + member attrib_IsReadOnlyAttribute: BuiltinAttribInfo + + member attrib_IsUnmanagedAttribute: BuiltinAttribInfo + + member attrib_LiteralAttribute: BuiltinAttribInfo + + member attrib_MarshalAsAttribute: BuiltinAttribInfo option + + member attrib_MeasureAttribute: BuiltinAttribInfo + + member attrib_MeasureableAttribute: BuiltinAttribInfo + + member attrib_MemberNotNullWhenAttribute: BuiltinAttribInfo + + member attrib_MethodImplAttribute: BuiltinAttribInfo + + member attrib_NoComparisonAttribute: BuiltinAttribInfo + + member attrib_NoCompilerInliningAttribute: BuiltinAttribInfo + + member attrib_NoDynamicInvocationAttribute: BuiltinAttribInfo + + member attrib_NoEagerConstraintApplicationAttribute: BuiltinAttribInfo + + member attrib_NoEqualityAttribute: BuiltinAttribInfo + + member attrib_NonSerializedAttribute: BuiltinAttribInfo option + + member attrib_NullableAttribute: BuiltinAttribInfo + + member attrib_NullableAttribute_opt: BuiltinAttribInfo option + + member attrib_NullableContextAttribute: BuiltinAttribInfo + + member attrib_NullableContextAttribute_opt: BuiltinAttribInfo option + + member attrib_OptionalArgumentAttribute: BuiltinAttribInfo + + member attrib_OptionalAttribute: BuiltinAttribInfo option + + member attrib_OutAttribute: BuiltinAttribInfo + + member attrib_ParamArrayAttribute: BuiltinAttribInfo + + member attrib_PreserveSigAttribute: BuiltinAttribInfo option + + member attrib_ProjectionParameterAttribute: BuiltinAttribInfo + + member attrib_ReferenceEqualityAttribute: BuiltinAttribInfo + + member attrib_ReflectedDefinitionAttribute: BuiltinAttribInfo + + member attrib_RequireQualifiedAccessAttribute: BuiltinAttribInfo + + member attrib_RequiredMemberAttribute: BuiltinAttribInfo + + member attrib_RequiresExplicitTypeArgumentsAttribute: BuiltinAttribInfo + + member attrib_RequiresLocationAttribute: BuiltinAttribInfo + + member attrib_SealedAttribute: BuiltinAttribInfo + + member attrib_SecurityAttribute: BuiltinAttribInfo option + + member attrib_SecurityCriticalAttribute: BuiltinAttribInfo + + member attrib_SecuritySafeCriticalAttribute: BuiltinAttribInfo + + member attrib_SetsRequiredMembersAttribute: BuiltinAttribInfo + + member attrib_SkipLocalsInitAttribute: BuiltinAttribInfo + + member attrib_StructAttribute: BuiltinAttribInfo + + member attrib_StructLayoutAttribute: BuiltinAttribInfo + + member attrib_StructuralComparisonAttribute: BuiltinAttribInfo + + member attrib_StructuralEqualityAttribute: BuiltinAttribInfo + + member attrib_SystemObsolete: BuiltinAttribInfo + + member attrib_ThreadStaticAttribute: BuiltinAttribInfo option + + member attrib_TypeForwardedToAttribute: BuiltinAttribInfo + + member attrib_UnverifiableAttribute: BuiltinAttribInfo + + member attrib_VolatileFieldAttribute: BuiltinAttribInfo + + member attrib_WarnOnWithoutNullArgumentAttribute: BuiltinAttribInfo + + member attribs_Unsupported: FSharp.Compiler.TypedTree.TyconRef list + + member bitwise_and_info: IntrinsicValRef + + member bitwise_and_vref: FSharp.Compiler.TypedTree.ValRef + + member bitwise_or_info: IntrinsicValRef + + member bitwise_or_vref: FSharp.Compiler.TypedTree.ValRef + + member bitwise_shift_left_info: IntrinsicValRef + + member bitwise_shift_left_vref: FSharp.Compiler.TypedTree.ValRef + + member bitwise_shift_right_info: IntrinsicValRef + + member bitwise_shift_right_vref: FSharp.Compiler.TypedTree.ValRef + + member bitwise_unary_not_info: IntrinsicValRef + + member bitwise_unary_not_vref: FSharp.Compiler.TypedTree.ValRef + + member bitwise_xor_info: IntrinsicValRef + + member bitwise_xor_vref: FSharp.Compiler.TypedTree.ValRef + + member bool_tcr: FSharp.Compiler.TypedTree.EntityRef + + member bool_ty: FSharp.Compiler.TypedTree.TType + + member box_info: IntrinsicValRef + + member byref2_tcr: FSharp.Compiler.TypedTree.EntityRef + + member byref_tcr: FSharp.Compiler.TypedTree.EntityRef + + member byrefkind_InOut_tcr: FSharp.Compiler.TypedTree.EntityRef + + member byrefkind_In_tcr: FSharp.Compiler.TypedTree.EntityRef + + member byrefkind_Out_tcr: FSharp.Compiler.TypedTree.EntityRef + + member byte_checked_info: IntrinsicValRef + + member byte_operator_info: IntrinsicValRef + + member byte_tcr: FSharp.Compiler.TypedTree.EntityRef + + member byte_ty: FSharp.Compiler.TypedTree.TType + + member call_with_witnesses_info: IntrinsicValRef + + member cast_quotation_info: IntrinsicValRef + + member cgh__debugPoint_vref: FSharp.Compiler.TypedTree.ValRef + + member cgh__resumableEntry_vref: FSharp.Compiler.TypedTree.ValRef + + member cgh__resumeAt_vref: FSharp.Compiler.TypedTree.ValRef + + member cgh__stateMachine_vref: FSharp.Compiler.TypedTree.ValRef + + member cgh__useResumableCode_vref: FSharp.Compiler.TypedTree.ValRef + + member char_operator_info: IntrinsicValRef + + member char_tcr: FSharp.Compiler.TypedTree.EntityRef + + member char_ty: FSharp.Compiler.TypedTree.TType + + member checkNullness: bool + + member check_this_info: IntrinsicValRef + + member checked_addition_info: IntrinsicValRef + + member checked_multiply_info: IntrinsicValRef + + member checked_subtraction_info: IntrinsicValRef + + member checked_unary_minus_info: IntrinsicValRef + + member choice2_tcr: FSharp.Compiler.TypedTree.EntityRef + + member choice3_tcr: FSharp.Compiler.TypedTree.EntityRef + + member choice4_tcr: FSharp.Compiler.TypedTree.EntityRef + + member choice5_tcr: FSharp.Compiler.TypedTree.EntityRef + + member choice6_tcr: FSharp.Compiler.TypedTree.EntityRef + + member choice7_tcr: FSharp.Compiler.TypedTree.EntityRef + + member compare_operator_vref: FSharp.Compiler.TypedTree.ValRef + + member compilingFSharpCore: bool + + member cons_ucref: FSharp.Compiler.TypedTree.UnionCaseRef + + member create_event_info: IntrinsicValRef + + member create_instance_info: IntrinsicValRef + + member date_tcr: FSharp.Compiler.TypedTree.EntityRef + + member decimal_tcr: FSharp.Compiler.TypedTree.EntityRef + + member decimal_ty: FSharp.Compiler.TypedTree.TType + + member deserialize_quoted_FSharp_20_plus_info: IntrinsicValRef + + member deserialize_quoted_FSharp_40_plus_info: IntrinsicValRef + + member dispose_info: IntrinsicValRef + + member emitDebugInfoInQuotations: bool + + member enumOfValue_vref: FSharp.Compiler.TypedTree.ValRef + + member enum_DynamicallyAccessedMemberTypes: BuiltinAttribInfo + + member enum_operator_info: IntrinsicValRef + + member enum_vref: FSharp.Compiler.TypedTree.ValRef + + member equals_nullable_operator_vref: FSharp.Compiler.TypedTree.ValRef + + member equals_operator_info: IntrinsicValRef + + member equals_operator_vref: FSharp.Compiler.TypedTree.ValRef + + member exn_tcr: FSharp.Compiler.TypedTree.EntityRef + + member exn_ty: FSharp.Compiler.TypedTree.TType + + member exponentiation_vref: FSharp.Compiler.TypedTree.ValRef + + member expr_tcr: FSharp.Compiler.TypedTree.EntityRef + + member fail_init_info: IntrinsicValRef + + member fail_static_init_info: IntrinsicValRef + + member failwith_vref: FSharp.Compiler.TypedTree.ValRef + + member failwithf_vref: FSharp.Compiler.TypedTree.ValRef + + member fastFunc_tcr: FSharp.Compiler.TypedTree.EntityRef + + member float32_operator_info: IntrinsicValRef + + member float32_tcr: FSharp.Compiler.TypedTree.EntityRef + + member float32_ty: FSharp.Compiler.TypedTree.TType + + member float_operator_info: IntrinsicValRef + + member float_tcr: FSharp.Compiler.TypedTree.EntityRef + + member float_ty: FSharp.Compiler.TypedTree.TType + + member format4_tcr: FSharp.Compiler.TypedTree.EntityRef + + member format_tcr: FSharp.Compiler.TypedTree.EntityRef + + member fslibCcu: FSharp.Compiler.TypedTree.CcuThunk + + member fslib_IDelegateEvent_tcr: FSharp.Compiler.TypedTree.EntityRef + + member fslib_IEvent2_tcr: FSharp.Compiler.TypedTree.EntityRef + + /// Indicates if we are generating witness arguments for SRTP constraints. Only done if the FSharp.Core + /// supports witness arguments. + member generateWitnesses: bool + + member generic_compare_withc_tuple2_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_compare_withc_tuple3_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_compare_withc_tuple4_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_compare_withc_tuple5_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_comparison_inner_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_comparison_withc_inner_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_comparison_withc_outer_info: IntrinsicValRef + + member generic_equality_er_inner_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_equality_er_outer_info: IntrinsicValRef + + member generic_equality_per_inner_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_equality_withc_inner_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_equality_withc_outer_info: IntrinsicValRef + + member generic_equality_withc_outer_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_equals_withc_tuple2_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_equals_withc_tuple3_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_equals_withc_tuple4_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_equals_withc_tuple5_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_hash_inner_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_hash_withc_inner_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_hash_withc_outer_info: IntrinsicValRef + + member generic_hash_withc_tuple2_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_hash_withc_tuple3_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_hash_withc_tuple4_vref: FSharp.Compiler.TypedTree.ValRef + + member generic_hash_withc_tuple5_vref: FSharp.Compiler.TypedTree.ValRef + + member get_generic_comparer_info: IntrinsicValRef + + member get_generic_er_equality_comparer_info: IntrinsicValRef + + member get_generic_per_equality_comparer_info: IntrinsicValRef + + member getstring_info: IntrinsicValRef + + member greater_than_operator: IntrinsicValRef + + member greater_than_operator_vref: FSharp.Compiler.TypedTree.ValRef + + member greater_than_or_equals_operator: IntrinsicValRef + + member greater_than_or_equals_operator_vref: FSharp.Compiler.TypedTree.ValRef + + member hash_info: IntrinsicValRef + + member il_arr_tcr_map: FSharp.Compiler.TypedTree.EntityRef array + + member ilg: FSharp.Compiler.AbstractIL.IL.ILGlobals + + member ilsigptr_tcr: FSharp.Compiler.TypedTree.EntityRef + + member iltyp_AsyncCallback: FSharp.Compiler.AbstractIL.IL.ILType + + member iltyp_Exception: FSharp.Compiler.AbstractIL.IL.ILType + + member iltyp_IAsyncResult: FSharp.Compiler.AbstractIL.IL.ILType + + member iltyp_IComparable: FSharp.Compiler.AbstractIL.IL.ILType + + member iltyp_Missing: FSharp.Compiler.AbstractIL.IL.ILType + + member iltyp_ReferenceAssemblyAttributeOpt: FSharp.Compiler.AbstractIL.IL.ILType option + + member iltyp_RuntimeFieldHandle: FSharp.Compiler.AbstractIL.IL.ILType + + member iltyp_RuntimeMethodHandle: FSharp.Compiler.AbstractIL.IL.ILType + + member iltyp_RuntimeTypeHandle: FSharp.Compiler.AbstractIL.IL.ILType + + member iltyp_SerializationInfo: FSharp.Compiler.AbstractIL.IL.ILType option + + member iltyp_StreamingContext: FSharp.Compiler.AbstractIL.IL.ILType option + + member iltyp_UnmanagedType: FSharp.Compiler.AbstractIL.IL.ILType + + member iltyp_ValueType: FSharp.Compiler.AbstractIL.IL.ILType + + member inref_tcr: FSharp.Compiler.TypedTree.EntityRef + + member int16_checked_info: IntrinsicValRef + + member int16_operator_info: IntrinsicValRef + + member int16_tcr: FSharp.Compiler.TypedTree.EntityRef + + member int16_ty: FSharp.Compiler.TypedTree.TType + + member int32_checked_info: IntrinsicValRef + + member int32_operator_info: IntrinsicValRef + + member int32_tcr: FSharp.Compiler.TypedTree.EntityRef + + member int32_ty: FSharp.Compiler.TypedTree.TType + + member int64_checked_info: IntrinsicValRef + + member int64_operator_info: IntrinsicValRef + + member int64_tcr: FSharp.Compiler.TypedTree.EntityRef + + member int64_ty: FSharp.Compiler.TypedTree.TType + + member int_checked_info: IntrinsicValRef + + member int_ty: FSharp.Compiler.TypedTree.TType + + member invalid_arg_vref: FSharp.Compiler.TypedTree.ValRef + + member invalid_op_vref: FSharp.Compiler.TypedTree.ValRef + + /// Indicates if we can use System.Array.Empty when emitting IL for empty array literals + member isArrayEmptyAvailable: bool + + /// Are we assuming all code gen is for F# interactive, with no static linking + member isInteractive: bool + + member isnull_info: IntrinsicValRef + + member istype_fast_vref: FSharp.Compiler.TypedTree.ValRef + + member istype_info: IntrinsicValRef + + member istype_vref: FSharp.Compiler.TypedTree.ValRef + + member knownFSharpCoreModules: System.Collections.Generic.IDictionary + + member knownIntrinsics: + System.Collections.Concurrent.ConcurrentDictionary<(string * string option * string * int), FSharp.Compiler.TypedTree.ValRef> + + member knownWithNull: FSharp.Compiler.TypedTree.Nullness + + member knownWithoutNull: FSharp.Compiler.TypedTree.Nullness + + member langFeatureNullness: bool + + member langVersion: FSharp.Compiler.Features.LanguageVersion + + member lazy_create_info: IntrinsicValRef + + member lazy_force_info: IntrinsicValRef + + member lazy_tcr_canon: FSharp.Compiler.TypedTree.EntityRef + + member lazy_tcr_nice: FSharp.Compiler.TypedTree.EntityRef + + member less_than_operator: IntrinsicValRef + + member less_than_operator_vref: FSharp.Compiler.TypedTree.ValRef + + member less_than_or_equals_operator: IntrinsicValRef + + member less_than_or_equals_operator_vref: FSharp.Compiler.TypedTree.ValRef + + member lift_value_info: IntrinsicValRef + + member lift_value_with_defn_info: IntrinsicValRef + + member lift_value_with_name_info: IntrinsicValRef + + member list_tcr_canon: FSharp.Compiler.TypedTree.EntityRef + + member list_tcr_nice: FSharp.Compiler.TypedTree.EntityRef + + member measureinverse_tcr: FSharp.Compiler.TypedTree.EntityRef + + member measureone_tcr: FSharp.Compiler.TypedTree.EntityRef + + member measureproduct_tcr: FSharp.Compiler.TypedTree.EntityRef + + member methodhandleof_vref: FSharp.Compiler.TypedTree.ValRef + + member mk_Attribute_ty: FSharp.Compiler.TypedTree.TType + + member mk_IAsyncStateMachine_ty: FSharp.Compiler.TypedTree.TType + + member mk_IComparable_ty: FSharp.Compiler.TypedTree.TType + + member mk_IStructuralComparable_ty: FSharp.Compiler.TypedTree.TType + + member mk_IStructuralEquatable_ty: FSharp.Compiler.TypedTree.TType + + member mlCompatibility: bool + + member nameof_vref: FSharp.Compiler.TypedTree.ValRef + + member nativeint_checked_info: IntrinsicValRef + + member nativeint_operator_info: IntrinsicValRef + + member nativeint_tcr: FSharp.Compiler.TypedTree.EntityRef + + member nativeint_ty: FSharp.Compiler.TypedTree.TType + + member nativeptr_tcr: FSharp.Compiler.TypedTree.EntityRef + + member nativeptr_tobyref_vref: FSharp.Compiler.TypedTree.ValRef + + member new_decimal_info: IntrinsicValRef + + member new_format_info: IntrinsicValRef + + member new_format_vref: FSharp.Compiler.TypedTree.ValRef + + member new_query_source_info: IntrinsicValRef + + member nil_ucref: FSharp.Compiler.TypedTree.UnionCaseRef + + member not_equals_operator: IntrinsicValRef + + member not_equals_operator_vref: FSharp.Compiler.TypedTree.ValRef + + member null_arg_vref: FSharp.Compiler.TypedTree.ValRef + + member nullable_equals_nullable_operator_vref: FSharp.Compiler.TypedTree.ValRef + + member nullable_equals_operator_vref: FSharp.Compiler.TypedTree.ValRef + + member obj_ty_ambivalent: FSharp.Compiler.TypedTree.TType + + member obj_ty_noNulls: FSharp.Compiler.TypedTree.TType + + member obj_ty_withNulls: FSharp.Compiler.TypedTree.TType + + member option_defaultValue_info: IntrinsicValRef + + member option_tcr_canon: FSharp.Compiler.TypedTree.EntityRef + + member option_tcr_nice: FSharp.Compiler.TypedTree.EntityRef + + member option_toNullable_info: IntrinsicValRef + + member or2_vref: FSharp.Compiler.TypedTree.ValRef + + member or_vref: FSharp.Compiler.TypedTree.ValRef + + member outref_tcr: FSharp.Compiler.TypedTree.EntityRef + + member pathMap: Internal.Utilities.PathMap + + member pdecimal_tcr: FSharp.Compiler.TypedTree.EntityRef + + member pfloat32_tcr: FSharp.Compiler.TypedTree.EntityRef + + member pfloat_tcr: FSharp.Compiler.TypedTree.EntityRef + + member pint16_tcr: FSharp.Compiler.TypedTree.EntityRef + + member pint64_tcr: FSharp.Compiler.TypedTree.EntityRef + + member pint8_tcr: FSharp.Compiler.TypedTree.EntityRef + + member pint_tcr: FSharp.Compiler.TypedTree.EntityRef + + member piperight2_vref: FSharp.Compiler.TypedTree.ValRef + + member piperight3_vref: FSharp.Compiler.TypedTree.ValRef + + member piperight_vref: FSharp.Compiler.TypedTree.ValRef + + member pnativeint_tcr: FSharp.Compiler.TypedTree.EntityRef + + member puint16_tcr: FSharp.Compiler.TypedTree.EntityRef + + member puint64_tcr: FSharp.Compiler.TypedTree.EntityRef + + member puint8_tcr: FSharp.Compiler.TypedTree.EntityRef + + member puint_tcr: FSharp.Compiler.TypedTree.EntityRef + + member punativeint_tcr: FSharp.Compiler.TypedTree.EntityRef + + member query_builder_tcref: FSharp.Compiler.TypedTree.EntityRef + + member query_for_vref: FSharp.Compiler.TypedTree.ValRef + + member query_run_enumerable_vref: FSharp.Compiler.TypedTree.ValRef + + member query_run_value_vref: FSharp.Compiler.TypedTree.ValRef + + member query_select_vref: FSharp.Compiler.TypedTree.ValRef + + member query_source_as_enum_info: IntrinsicValRef + + member query_source_vref: FSharp.Compiler.TypedTree.ValRef + + member query_value_vref: FSharp.Compiler.TypedTree.ValRef + + member query_yield_from_vref: FSharp.Compiler.TypedTree.ValRef + + member query_yield_vref: FSharp.Compiler.TypedTree.ValRef + + member query_zero_vref: FSharp.Compiler.TypedTree.ValRef + + member quote_to_linq_lambda_info: IntrinsicValRef + + member raise_info: IntrinsicValRef + + member raise_vref: FSharp.Compiler.TypedTree.ValRef + + member range_byte_op_vref: FSharp.Compiler.TypedTree.ValRef + + member range_char_op_vref: FSharp.Compiler.TypedTree.ValRef + + member range_generic_op_vref: FSharp.Compiler.TypedTree.ValRef + + member range_int16_op_vref: FSharp.Compiler.TypedTree.ValRef + + member range_int32_op_vref: FSharp.Compiler.TypedTree.ValRef + + member range_int64_op_vref: FSharp.Compiler.TypedTree.ValRef + + member range_nativeint_op_vref: FSharp.Compiler.TypedTree.ValRef + + member range_op_vref: FSharp.Compiler.TypedTree.ValRef + + member range_sbyte_op_vref: FSharp.Compiler.TypedTree.ValRef + + member range_step_generic_op_vref: FSharp.Compiler.TypedTree.ValRef + + member range_step_op_vref: FSharp.Compiler.TypedTree.ValRef + + member range_uint16_op_vref: FSharp.Compiler.TypedTree.ValRef + + member range_uint32_op_vref: FSharp.Compiler.TypedTree.ValRef + + member range_uint64_op_vref: FSharp.Compiler.TypedTree.ValRef + + member range_unativeint_op_vref: FSharp.Compiler.TypedTree.ValRef + + member raw_expr_tcr: FSharp.Compiler.TypedTree.EntityRef + + member realsig: bool + + member ref_tuple1_tcr: FSharp.Compiler.TypedTree.EntityRef + + member ref_tuple2_tcr: FSharp.Compiler.TypedTree.EntityRef + + member ref_tuple3_tcr: FSharp.Compiler.TypedTree.EntityRef + + member ref_tuple4_tcr: FSharp.Compiler.TypedTree.EntityRef + + member ref_tuple5_tcr: FSharp.Compiler.TypedTree.EntityRef + + member ref_tuple6_tcr: FSharp.Compiler.TypedTree.EntityRef + + member ref_tuple7_tcr: FSharp.Compiler.TypedTree.EntityRef + + member ref_tuple8_tcr: FSharp.Compiler.TypedTree.EntityRef + + member refcell_assign_vref: FSharp.Compiler.TypedTree.ValRef + + member refcell_decr_vref: FSharp.Compiler.TypedTree.ValRef + + member refcell_deref_vref: FSharp.Compiler.TypedTree.ValRef + + member refcell_incr_vref: FSharp.Compiler.TypedTree.ValRef + + member refcell_tcr_canon: FSharp.Compiler.TypedTree.EntityRef + + member refcell_tcr_nice: FSharp.Compiler.TypedTree.EntityRef + + member reference_equality_inner_vref: FSharp.Compiler.TypedTree.ValRef + + member reraise_info: IntrinsicValRef + + member reraise_vref: FSharp.Compiler.TypedTree.ValRef + + member sbyte_checked_info: IntrinsicValRef + + member sbyte_operator_info: IntrinsicValRef + + member sbyte_tcr: FSharp.Compiler.TypedTree.EntityRef + + member sbyte_ty: FSharp.Compiler.TypedTree.TType + + member seq_append_info: IntrinsicValRef + + member seq_append_vref: FSharp.Compiler.TypedTree.ValRef + + member seq_collect_info: IntrinsicValRef + + member seq_collect_vref: FSharp.Compiler.TypedTree.ValRef + + member seq_delay_info: IntrinsicValRef + + member seq_delay_vref: FSharp.Compiler.TypedTree.ValRef + + member seq_empty_info: IntrinsicValRef + + member seq_empty_vref: FSharp.Compiler.TypedTree.ValRef + + member seq_finally_info: IntrinsicValRef + + member seq_finally_vref: FSharp.Compiler.TypedTree.ValRef + + member seq_generated_info: IntrinsicValRef + + member seq_generated_vref: FSharp.Compiler.TypedTree.ValRef + + member seq_info: IntrinsicValRef + + member seq_map_info: IntrinsicValRef + + member seq_map_vref: FSharp.Compiler.TypedTree.ValRef + + member seq_of_functions_info: IntrinsicValRef + + member seq_singleton_info: IntrinsicValRef + + member seq_singleton_vref: FSharp.Compiler.TypedTree.ValRef + + member seq_tcr: FSharp.Compiler.TypedTree.EntityRef + + member seq_to_array_info: IntrinsicValRef + + member seq_to_array_vref: FSharp.Compiler.TypedTree.ValRef + + member seq_to_list_info: IntrinsicValRef + + member seq_to_list_vref: FSharp.Compiler.TypedTree.ValRef + + member seq_trywith_info: IntrinsicValRef + + member seq_using_info: IntrinsicValRef + + member seq_using_vref: FSharp.Compiler.TypedTree.ValRef + + member seq_vref: FSharp.Compiler.TypedTree.ValRef + + member sizeof_vref: FSharp.Compiler.TypedTree.ValRef + + member splice_expr_vref: FSharp.Compiler.TypedTree.ValRef + + member splice_raw_expr_vref: FSharp.Compiler.TypedTree.ValRef + + member sprintf_info: IntrinsicValRef + + member sprintf_vref: FSharp.Compiler.TypedTree.ValRef + + member string_ty: FSharp.Compiler.TypedTree.TType + + member string_ty_ambivalent: FSharp.Compiler.TypedTree.TType + + member struct_tuple1_tcr: FSharp.Compiler.TypedTree.EntityRef + + member struct_tuple2_tcr: FSharp.Compiler.TypedTree.EntityRef + + member struct_tuple3_tcr: FSharp.Compiler.TypedTree.EntityRef + + member struct_tuple4_tcr: FSharp.Compiler.TypedTree.EntityRef + + member struct_tuple5_tcr: FSharp.Compiler.TypedTree.EntityRef + + member struct_tuple6_tcr: FSharp.Compiler.TypedTree.EntityRef + + member struct_tuple7_tcr: FSharp.Compiler.TypedTree.EntityRef + + member struct_tuple8_tcr: FSharp.Compiler.TypedTree.EntityRef + + member suppressed_types: FSharp.Compiler.TypedTree.EntityRef list + + member system_ArgIterator_tcref: FSharp.Compiler.TypedTree.EntityRef option + + member system_Array_ty: FSharp.Compiler.TypedTree.TType + + member system_Bool_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_Byte_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_Char_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_Decimal_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_Delegate_ty: FSharp.Compiler.TypedTree.TType + + member system_Double_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_Enum_ty: FSharp.Compiler.TypedTree.TType + + member system_ExceptionDispatchInfo_ty: FSharp.Compiler.TypedTree.TType option + + member system_FormattableStringFactory_ty: FSharp.Compiler.TypedTree.TType + + member system_FormattableString_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_FormattableString_ty: FSharp.Compiler.TypedTree.TType + + member system_GenericIComparable_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_GenericIEquatable_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_IDisposable_ty: FSharp.Compiler.TypedTree.TType + + member system_IFormattable_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_IFormattable_ty: FSharp.Compiler.TypedTree.TType + + member system_Int16_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_Int32_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_Int64_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_IntPtr_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_LinqExpression_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_MarshalByRefObject_tcref: FSharp.Compiler.TypedTree.EntityRef option + + member system_MarshalByRefObject_ty: FSharp.Compiler.TypedTree.TType option + + member system_MulticastDelegate_ty: FSharp.Compiler.TypedTree.TType + + member system_Nullable_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_Object_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_Object_ty: FSharp.Compiler.TypedTree.TType + + member system_RuntimeArgumentHandle_tcref: FSharp.Compiler.TypedTree.EntityRef option + + member system_RuntimeHelpers_ty: FSharp.Compiler.TypedTree.TType + + member system_RuntimeTypeHandle_ty: FSharp.Compiler.TypedTree.TType + + member system_SByte_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_Single_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_String_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_Type_ty: FSharp.Compiler.TypedTree.TType + + member system_TypedReference_tcref: FSharp.Compiler.TypedTree.EntityRef option + + member system_UInt16_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_UInt32_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_UInt64_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_UIntPtr_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_Value_tcref: FSharp.Compiler.TypedTree.EntityRef + + member system_Value_ty: FSharp.Compiler.TypedTree.TType + + member system_Void_tcref: FSharp.Compiler.TypedTree.EntityRef + + member tcref_IObservable: FSharp.Compiler.TypedTree.EntityRef + + member tcref_IObserver: FSharp.Compiler.TypedTree.EntityRef + + member tcref_LanguagePrimitives: FSharp.Compiler.TypedTree.EntityRef + + member tcref_System_Attribute: FSharp.Compiler.TypedTree.EntityRef + + member tcref_System_Collections_Generic_Dictionary: FSharp.Compiler.TypedTree.EntityRef + + member tcref_System_Collections_Generic_ICollection: FSharp.Compiler.TypedTree.EntityRef + + member tcref_System_Collections_Generic_IEnumerable: FSharp.Compiler.TypedTree.EntityRef + + member tcref_System_Collections_Generic_IEnumerator: FSharp.Compiler.TypedTree.EntityRef + + member tcref_System_Collections_Generic_IEqualityComparer: FSharp.Compiler.TypedTree.EntityRef + + member tcref_System_Collections_Generic_IList: FSharp.Compiler.TypedTree.EntityRef + + member tcref_System_Collections_Generic_IReadOnlyCollection: FSharp.Compiler.TypedTree.EntityRef + + member tcref_System_Collections_Generic_IReadOnlyList: FSharp.Compiler.TypedTree.EntityRef + + member tcref_System_Collections_IComparer: FSharp.Compiler.TypedTree.EntityRef + + member tcref_System_Collections_IEnumerable: FSharp.Compiler.TypedTree.EntityRef + + member tcref_System_Collections_IEqualityComparer: FSharp.Compiler.TypedTree.EntityRef + + member tcref_System_IComparable: FSharp.Compiler.TypedTree.EntityRef + + member tcref_System_IDisposable: FSharp.Compiler.TypedTree.EntityRef + + member tcref_System_IStructuralComparable: FSharp.Compiler.TypedTree.EntityRef + + member tcref_System_IStructuralEquatable: FSharp.Compiler.TypedTree.EntityRef + + member typedefof_info: IntrinsicValRef + + member typedefof_vref: FSharp.Compiler.TypedTree.ValRef + + member typeof_info: IntrinsicValRef + + member typeof_vref: FSharp.Compiler.TypedTree.ValRef + + member uint16_checked_info: IntrinsicValRef + + member uint16_operator_info: IntrinsicValRef + + member uint16_tcr: FSharp.Compiler.TypedTree.EntityRef + + member uint16_ty: FSharp.Compiler.TypedTree.TType + + member uint32_checked_info: IntrinsicValRef + + member uint32_operator_info: IntrinsicValRef + + member uint32_tcr: FSharp.Compiler.TypedTree.EntityRef + + member uint32_ty: FSharp.Compiler.TypedTree.TType + + member uint64_checked_info: IntrinsicValRef + + member uint64_operator_info: IntrinsicValRef + + member uint64_tcr: FSharp.Compiler.TypedTree.EntityRef + + member uint64_ty: FSharp.Compiler.TypedTree.TType + + member unativeint_checked_info: IntrinsicValRef + + member unativeint_operator_info: IntrinsicValRef + + member unativeint_ty: FSharp.Compiler.TypedTree.TType + + member unbox_fast_info: IntrinsicValRef + + member unbox_fast_vref: FSharp.Compiler.TypedTree.ValRef + + member unbox_info: IntrinsicValRef + + member unbox_vref: FSharp.Compiler.TypedTree.ValRef + + member unchecked_addition_info: IntrinsicValRef + + member unchecked_addition_vref: FSharp.Compiler.TypedTree.ValRef + + member unchecked_defaultof_info: IntrinsicValRef + + member unchecked_defaultof_vref: FSharp.Compiler.TypedTree.ValRef + + member unchecked_division_info: IntrinsicValRef + + member unchecked_division_vref: FSharp.Compiler.TypedTree.ValRef + + member unchecked_modulus_info: IntrinsicValRef + + member unchecked_modulus_vref: FSharp.Compiler.TypedTree.ValRef + + member unchecked_multiply_info: IntrinsicValRef + + member unchecked_multiply_vref: FSharp.Compiler.TypedTree.ValRef + + member unchecked_subtraction_info: IntrinsicValRef + + member unchecked_subtraction_vref: FSharp.Compiler.TypedTree.ValRef + + member unchecked_unary_minus_info: IntrinsicValRef + + member unchecked_unary_minus_vref: FSharp.Compiler.TypedTree.ValRef + + member unchecked_unary_not_vref: FSharp.Compiler.TypedTree.ValRef + + member unchecked_unary_plus_vref: FSharp.Compiler.TypedTree.ValRef + + member unit_tcr_canon: FSharp.Compiler.TypedTree.EntityRef + + member unit_ty: FSharp.Compiler.TypedTree.TType + + member useReflectionFreeCodeGen: bool + + member valueoption_tcr_canon: FSharp.Compiler.TypedTree.EntityRef + + member valueoption_tcr_nice: FSharp.Compiler.TypedTree.EntityRef + + member voidptr_tcr: FSharp.Compiler.TypedTree.EntityRef + +#if DEBUG +// This global is only used during debug output +val mutable internal global_g: TcGlobals option +#endif diff --git a/src/Compiler/TypedTree/TypeProviders.fs b/src/Compiler/TypedTree/TypeProviders.fs index aba063eb625..78baba4ee9d 100644 --- a/src/Compiler/TypedTree/TypeProviders.fs +++ b/src/Compiler/TypedTree/TypeProviders.fs @@ -37,7 +37,7 @@ type ResolutionEnvironment = GetReferencedAssemblies: unit -> string[] TemporaryFolder: string } -/// Load a the design-time part of a type-provider into the host process, and look for types +/// Load the design-time part of a type-provider into the host process, and look for types /// marked with the TypeProviderAttribute attribute. let GetTypeProviderImplementationTypes ( runTimeAssemblyFileName, @@ -49,7 +49,7 @@ let GetTypeProviderImplementationTypes ( // Report an error, blaming the particular type provider component let raiseError designTimeAssemblyPathOpt (e: exn) = let attrName = typeof.Name - let exnTypeName = e.GetType().FullName + let exnTypeName = !! e.GetType().FullName let exnMsg = e.Message match designTimeAssemblyPathOpt with | None -> @@ -69,16 +69,13 @@ let GetTypeProviderImplementationTypes ( [ for t in exportedTypes do let ca = t.GetCustomAttributes(typeof, true) - match ca with - | Null -> () - | NonNull ca -> - if ca.Length > 0 then - yield t + if ca.Length > 0 then + yield t ] filtered with e -> - let folder = Path.GetDirectoryName loadedDesignTimeAssembly.Location - let exnTypeName = e.GetType().FullName + let folder = !! Path.GetDirectoryName(loadedDesignTimeAssembly.Location) + let exnTypeName = !! e.GetType().FullName let exnMsg = e.Message match e with | :? FileLoadException -> @@ -92,8 +89,8 @@ let GetTypeProviderImplementationTypes ( let StripException (e: exn) = match e with - | :? TargetInvocationException as e -> e.InnerException - | :? TypeInitializationException as e -> e.InnerException + | :? TargetInvocationException as e when isNotNull e.InnerException -> !! e.InnerException + | :? TypeInitializationException as e when isNotNull e.InnerException -> !! e.InnerException | _ -> e /// Create an instance of a type provider from the implementation type for the type provider in the @@ -116,7 +113,7 @@ let CreateTypeProvider ( f () with err -> let e = StripException (StripException err) - raise (TypeProviderError(FSComp.SR.etTypeProviderConstructorException(e.Message), typeProviderImplementationType.FullName, m)) + raise (TypeProviderError(FSComp.SR.etTypeProviderConstructorException(e.Message), !! typeProviderImplementationType.FullName, m)) let getReferencedAssemblies () = resolutionEnvironment.GetReferencedAssemblies() |> Array.distinct @@ -151,7 +148,7 @@ let CreateTypeProvider ( else // No appropriate constructor found - raise (TypeProviderError(FSComp.SR.etProviderDoesNotHaveValidConstructor(), typeProviderImplementationType.FullName, m)) + raise (TypeProviderError(FSComp.SR.etProviderDoesNotHaveValidConstructor(), !! typeProviderImplementationType.FullName, m)) let GetTypeProvidersOfAssembly ( runtimeAssemblyFilename: string, @@ -171,7 +168,7 @@ let GetTypeProvidersOfAssembly ( let designTimeAssemblyName = try if designTimeName.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) then - Some (AssemblyName (Path.GetFileNameWithoutExtension designTimeName)) + Some (AssemblyName (!!Path.GetFileNameWithoutExtension(designTimeName))) else Some (AssemblyName designTimeName) with :? ArgumentException -> @@ -193,7 +190,7 @@ let GetTypeProvidersOfAssembly ( CreateTypeProvider (t, runtimeAssemblyFilename, resolutionEnvironment, isInvalidationSupported, isInteractive, systemRuntimeContainsType, systemRuntimeAssemblyVersion, m) match box resolver with - | Null -> () + | null -> () | _ -> yield (resolver, ilScopeRefOfRuntimeAssembly) | None, _ -> @@ -227,8 +224,13 @@ let TryTypeMemberArray (st: Tainted<_>, fullName, memberName, m, f) = [||] /// Try to access a member on a provided type, catching and reporting errors and checking the result is non-null, +#if NO_CHECKNULLS let TryTypeMemberNonNull<'T, 'U when 'U : null and 'U : not struct>(st: Tainted<'T>, fullName, memberName, m, recover: 'U, (f: 'T -> 'U)) : Tainted<'U> = match TryTypeMember(st, fullName, memberName, m, recover, f) with +#else +let TryTypeMemberNonNull<'T, 'U when 'U : not null and 'U : not struct>(st: Tainted<'T>, fullName, memberName, m, recover: 'U, (f: 'T -> 'U | null)) : Tainted<'U> = + match TryTypeMember<'T, 'U | null>(st, fullName, memberName, m, withNull recover, f) with +#endif | Tainted.Null -> errorR(Error(FSComp.SR.etUnexpectedNullFromProvidedTypeMember(fullName, memberName), m)) st.PApplyNoFailure(fun _ -> recover) @@ -287,7 +289,7 @@ type ProvidedTypeComparer() = interface IEqualityComparer with member _.GetHashCode(ty: ProvidedType) = hash (key ty) - member _.Equals(ty1: ProvidedType, ty2: ProvidedType) = (key ty1 = key ty2) + member _.Equals(ty1: ProvidedType, ty2: ProvidedType) = nullSafeEquality ty1 ty2 (fun ty1 ty2 -> key ty1 = key ty2) /// The context used to interpret information in the closure of System.Type, System.MethodInfo and other /// info objects coming from the type provider. @@ -340,14 +342,17 @@ type ProvidedTypeContext = dict )) -[] +[] +#if NO_CHECKNULLS +[] +#endif type ProvidedType (x: Type, ctxt: ProvidedTypeContext) = inherit ProvidedMemberInfo(x, ctxt) let isMeasure = lazy x.CustomAttributes - |> Seq.exists (fun a -> a.Constructor.DeclaringType.FullName = typeof.FullName) + |> Seq.exists (fun a -> (!! a.Constructor.DeclaringType).FullName = typeof.FullName) let provide () = ProvidedCustomAttributeProvider (fun _ -> x.CustomAttributes) :> IProvidedCustomAttributeProvider @@ -408,14 +413,14 @@ type ProvidedType (x: Type, ctxt: ProvidedTypeContext) = /// Type.BaseType can be null when Type is interface or object member _.BaseType = x.BaseType |> ProvidedType.Create ctxt - member _.GetStaticParameters(provider: ITypeProvider) = provider.GetStaticParameters x |> ProvidedParameterInfo.CreateArray ctxt + member _.GetStaticParameters(provider: ITypeProvider) : ProvidedParameterInfo[] MaybeNull = provider.GetStaticParameters x |> ProvidedParameterInfo.CreateArray ctxt /// Type.GetElementType can be null if i.e. Type is not array\pointer\byref type member _.GetElementType() = x.GetElementType() |> ProvidedType.Create ctxt member _.GetGenericArguments() = x.GetGenericArguments() |> ProvidedType.CreateArray ctxt - member _.ApplyStaticArguments(provider: ITypeProvider, fullTypePathAfterArguments, staticArgs: obj[]) = + member _.ApplyStaticArguments(provider: ITypeProvider, fullTypePathAfterArguments, staticArgs: objnull[]) = provider.ApplyStaticArguments(x, fullTypePathAfterArguments, staticArgs) |> ProvidedType.Create ctxt member _.IsVoid = (Type.op_Equality(x, typeof) || (x.Namespace = "System" && x.Name = "Void")) @@ -467,17 +472,28 @@ type ProvidedType (x: Type, ctxt: ProvidedTypeContext) = let argTypes = args |> Array.map (fun arg -> arg.RawSystemType) ProvidedType.CreateNoContext(x.MakeGenericType(argTypes)) - member _.AsProvidedVar name = ProvidedVar.Create ctxt (Var(name, x)) + member _.AsProvidedVar name = ProvidedVar.CreateNonNull ctxt (Quotations.Var(name, x)) + + static member Create ctxt x : ProvidedType MaybeNull = + match x with + | Null -> null + | NonNull t -> ProvidedType (t, ctxt) - static member Create ctxt x = match x with null -> null | t -> ProvidedType (t, ctxt) + static member CreateNonNull ctxt x = ProvidedType (x, ctxt) - static member CreateWithNullCheck ctxt name x = match x with null -> nullArg name | t -> ProvidedType (t, ctxt) + static member CreateWithNullCheck ctxt name (x:Type MaybeNull) = + match x with + | null -> nullArg name + | t -> ProvidedType (t, ctxt) - static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedType.Create ctxt) + static member CreateArray ctxt (xs: Type[] MaybeNull) : ProvidedType[] MaybeNull = + match xs with + | Null -> null + | NonNull xs -> xs |> Array.map (ProvidedType.CreateNonNull ctxt) - static member CreateNoContext (x: Type) = ProvidedType.Create ProvidedTypeContext.Empty x + static member CreateNoContext (x:Type) = ProvidedType.Create ProvidedTypeContext.Empty x - static member Void = ProvidedType.CreateNoContext typeof + static member Void = ProvidedType.CreateNoContext typeof member _.Handle = x @@ -496,12 +512,17 @@ type ProvidedType (x: Type, ctxt: ProvidedTypeContext) = static member TaintedEquals (pt1: Tainted, pt2: Tainted) = Tainted.EqTainted (pt1.PApplyNoFailure(fun st -> st.Handle)) (pt2.PApplyNoFailure(fun st -> st.Handle)) -[] +#if NO_CHECKNULLS +[] +#endif type IProvidedCustomAttributeProvider = - abstract GetDefinitionLocationAttribute: provider: ITypeProvider -> (string * int * int) option - abstract GetXmlDocAttributes: provider: ITypeProvider -> string[] - abstract GetHasTypeProviderEditorHideMethodsAttribute: provider: ITypeProvider -> bool - abstract GetAttributeConstructorArgs: provider: ITypeProvider * attribName: string -> (obj option list * (string * obj option) list) option + abstract GetDefinitionLocationAttribute : provider: ITypeProvider -> (string MaybeNull * int * int) option + + abstract GetXmlDocAttributes : provider: ITypeProvider -> string[] + + abstract GetHasTypeProviderEditorHideMethodsAttribute : provider:ITypeProvider -> bool + + abstract GetAttributeConstructorArgs: provider:ITypeProvider * attribName:string -> (obj option list * (string * obj option) list) option type ProvidedCustomAttributeProvider (attributes :ITypeProvider -> seq) = @@ -511,7 +532,8 @@ type ProvidedCustomAttributeProvider (attributes :ITypeProvider -> seq] let (|Arg|_|) (x: CustomAttributeTypedArgument) = match x.Value with null -> ValueNone | v -> ValueSome v - let findAttribByName tyFullName (a: CustomAttributeData) = (a.Constructor.DeclaringType.FullName = tyFullName) + let findAttribByName tyFullName (a: CustomAttributeData) = ((!!a.Constructor.DeclaringType).FullName = tyFullName) + let findAttrib (ty: Type) a = findAttribByName ty.FullName a interface IProvidedCustomAttributeProvider with member _.GetAttributeConstructorArgs (provider, attribName) = @@ -521,11 +543,11 @@ type ProvidedCustomAttributeProvider (attributes :ITypeProvider -> seq Seq.toList - |> List.map (function Arg null -> None | Arg obj -> Some obj | _ -> None) + |> List.map (function Arg obj -> Some obj | _ -> None) let namedArgs = a.NamedArguments |> Seq.toList - |> List.map (fun arg -> arg.MemberName, match arg.TypedValue with Arg null -> None | Arg obj -> Some obj | _ -> None) + |> List.map (fun arg -> arg.MemberName, match arg.TypedValue with Arg obj -> Some obj | _ -> None) ctorArgs, namedArgs) member _.GetHasTypeProviderEditorHideMethodsAttribute provider = @@ -536,7 +558,7 @@ type ProvidedCustomAttributeProvider (attributes :ITypeProvider -> seq Seq.tryFind (findAttrib typeof) |> Option.map (fun a -> - let filePath = defaultArg (a.NamedArguments |> Seq.tryPick (function Member "FilePath" (Arg (:? string as v)) -> Some v | _ -> None)) null + let filePath : string MaybeNull = defaultArg (a.NamedArguments |> Seq.tryPick (function Member "FilePath" (Arg (:? string as v)) -> Some v | _ -> None)) null let line = defaultArg (a.NamedArguments |> Seq.tryPick (function Member "Line" (Arg (:? int as v)) -> Some v | _ -> None)) 0 let column = defaultArg (a.NamedArguments |> Seq.tryPick (function Member "Column" (Arg (:? int as v)) -> Some v | _ -> None)) 0 (filePath, line, column)) @@ -552,7 +574,10 @@ type ProvidedCustomAttributeProvider (attributes :ITypeProvider -> seq Seq.toArray -[] +[] +#if NO_CHECKNULLS +[] +#endif type ProvidedMemberInfo (x: MemberInfo, ctxt) = let provide () = ProvidedCustomAttributeProvider (fun _ -> x.CustomAttributes) :> IProvidedCustomAttributeProvider @@ -574,11 +599,14 @@ type ProvidedMemberInfo (x: MemberInfo, ctxt) = member _.GetAttributeConstructorArgs (provider, attribName) = provide().GetAttributeConstructorArgs (provider, attribName) -[] +[] +#if NO_CHECKNULLS +[] +#endif type ProvidedParameterInfo (x: ParameterInfo, ctxt) = let provide () = ProvidedCustomAttributeProvider (fun _ -> x.CustomAttributes) :> IProvidedCustomAttributeProvider - member _.Name = x.Name + member _.Name = let nm = x.Name in match box nm with null -> "" | _ -> !!nm member _.IsOut = x.IsOut @@ -591,12 +619,25 @@ type ProvidedParameterInfo (x: ParameterInfo, ctxt) = member _.HasDefaultValue = x.Attributes.HasFlag(ParameterAttributes.HasDefault) /// ParameterInfo.ParameterType cannot be null - member _.ParameterType = ProvidedType.CreateWithNullCheck ctxt "ParameterType" x.ParameterType - - static member Create ctxt x = match x with null -> null | t -> ProvidedParameterInfo (t, ctxt) - - static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedParameterInfo.Create ctxt) // TODO null wrong? - + member _.ParameterType = ProvidedType.CreateWithNullCheck ctxt "ParameterType" x.ParameterType + + static member Create ctxt (x: ParameterInfo MaybeNull) : ProvidedParameterInfo MaybeNull = + match x with + | Null -> null + | NonNull x -> ProvidedParameterInfo (x, ctxt) + + static member CreateNonNull ctxt x = ProvidedParameterInfo (x, ctxt) + + static member CreateArray ctxt (xs: ParameterInfo[] MaybeNull) : ProvidedParameterInfo[] MaybeNull = + match xs with + | Null -> null + | NonNull xs -> xs |> Array.map (ProvidedParameterInfo.CreateNonNull ctxt) + + static member CreateArrayNonNull ctxt xs : ProvidedParameterInfo[] = + match box xs with + | Null -> [| |] + | _ -> xs |> Array.map (ProvidedParameterInfo.CreateNonNull ctxt) + interface IProvidedCustomAttributeProvider with member _.GetHasTypeProviderEditorHideMethodsAttribute provider = provide().GetHasTypeProviderEditorHideMethodsAttribute provider @@ -616,16 +657,19 @@ type ProvidedParameterInfo (x: ParameterInfo, ctxt) = override _.GetHashCode() = assert false; x.GetHashCode() -[] +[] +#if NO_CHECKNULLS +[] +#endif type ProvidedAssembly (x: Assembly) = member _.GetName() = x.GetName() - member _.FullName = x.FullName + member _.FullName = !!x.FullName member _.GetManifestModuleContents(provider: ITypeProvider) = provider.GetGeneratedAssemblyContents x - static member Create (x: Assembly) = match x with null -> null | t -> ProvidedAssembly t + static member Create (x: Assembly MaybeNull) : ProvidedAssembly MaybeNull = match x with null -> null | t -> ProvidedAssembly (t) member _.Handle = x @@ -633,7 +677,10 @@ type ProvidedAssembly (x: Assembly) = override _.GetHashCode() = assert false; x.GetHashCode() -[] +[] +#if NO_CHECKNULLS +[] +#endif type ProvidedMethodBase (x: MethodBase, ctxt) = inherit ProvidedMemberInfo(x, ctxt) @@ -668,12 +715,14 @@ type ProvidedMethodBase (x: MethodBase, ctxt) = member _.Handle = x static member TaintedGetHashCode (x: Tainted) = - Tainted.GetHashCodeTainted (x.PApplyNoFailure(fun st -> (st.Name, st.DeclaringType.Assembly.FullName, st.DeclaringType.FullName))) + Tainted.GetHashCodeTainted + (x.PApplyNoFailure(fun st -> (st.Name, (nonNull (nonNull st.DeclaringType).Assembly).FullName, + (nonNull st.DeclaringType).FullName))) static member TaintedEquals (pt1: Tainted, pt2: Tainted) = Tainted.EqTainted (pt1.PApplyNoFailure(fun st -> st.Handle)) (pt2.PApplyNoFailure(fun st -> st.Handle)) - member _.GetStaticParametersForMethod(provider: ITypeProvider) = + member _.GetStaticParametersForMethod(provider: ITypeProvider) : ProvidedParameterInfo[] = let bindingFlags = BindingFlags.Instance ||| BindingFlags.NonPublic ||| BindingFlags.Public let staticParams = @@ -688,13 +737,13 @@ type ProvidedMethodBase (x: MethodBase, ctxt) = [| typeof |], null) if isNull meth then [| |] else let paramsAsObj = - try meth.Invoke(provider, bindingFlags ||| BindingFlags.InvokeMethod, null, [| box x |], null) + try (!!meth).Invoke(provider, bindingFlags ||| BindingFlags.InvokeMethod, null, [| box x |], null) with err -> raise (StripException (StripException err)) paramsAsObj :?> ParameterInfo[] - staticParams |> ProvidedParameterInfo.CreateArray ctxt + staticParams |> ProvidedParameterInfo.CreateArrayNonNull ctxt - member _.ApplyStaticArgumentsForMethod(provider: ITypeProvider, fullNameAfterArguments: string, staticArgs: obj[]) = + member _.ApplyStaticArgumentsForMethod(provider: ITypeProvider, fullNameAfterArguments: string, staticArgs: objnull[]) = let bindingFlags = BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.InvokeMethod let mb = @@ -710,7 +759,8 @@ type ProvidedMethodBase (x: MethodBase, ctxt) = match meth with | null -> failwith (FSComp.SR.estApplyStaticArgumentsForMethodNotImplemented()) - | _ -> + | meth -> + let mbAsObj = try meth.Invoke(provider, bindingFlags ||| BindingFlags.InvokeMethod, null, [| box x; box fullNameAfterArguments; box staticArgs |], null) with err -> raise (StripException (StripException err)) @@ -719,18 +769,29 @@ type ProvidedMethodBase (x: MethodBase, ctxt) = | :? MethodBase as mb -> mb | _ -> failwith (FSComp.SR.estApplyStaticArgumentsForMethodNotImplemented()) match mb with - | :? MethodInfo as mi -> (mi |> ProvidedMethodInfo.Create ctxt: ProvidedMethodInfo) :> ProvidedMethodBase - | :? ConstructorInfo as ci -> (ci |> ProvidedConstructorInfo.Create ctxt: ProvidedConstructorInfo) :> ProvidedMethodBase + | :? MethodInfo as mi -> (mi |> ProvidedMethodInfo.CreateNonNull ctxt : ProvidedMethodInfo) :> ProvidedMethodBase + | :? ConstructorInfo as ci -> (ci |> ProvidedConstructorInfo.CreateNonNull ctxt : ProvidedConstructorInfo) :> ProvidedMethodBase | _ -> failwith (FSComp.SR.estApplyStaticArgumentsForMethodNotImplemented()) -[] +[] +#if NO_CHECKNULLS +[] +#endif type ProvidedFieldInfo (x: FieldInfo, ctxt) = inherit ProvidedMemberInfo(x, ctxt) - static member Create ctxt x = match x with null -> null | t -> ProvidedFieldInfo (t, ctxt) + static member CreateNonNull ctxt x = ProvidedFieldInfo (x, ctxt) + + static member Create ctxt x : ProvidedFieldInfo MaybeNull = + match x with + | Null -> null + | NonNull x -> ProvidedFieldInfo (x, ctxt) - static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedFieldInfo.Create ctxt) + static member CreateArray ctxt (xs: FieldInfo[] MaybeNull) : ProvidedFieldInfo[] MaybeNull = + match xs with + | Null -> null + | NonNull xs -> xs |> Array.map (ProvidedFieldInfo.CreateNonNull ctxt) member _.IsInitOnly = x.IsInitOnly @@ -765,15 +826,28 @@ type ProvidedFieldInfo (x: FieldInfo, ctxt) = static member TaintedEquals (pt1: Tainted, pt2: Tainted) = Tainted.EqTainted (pt1.PApplyNoFailure(fun st -> st.Handle)) (pt2.PApplyNoFailure(fun st -> st.Handle)) -[] +[] +#if NO_CHECKNULLS +[] +#endif type ProvidedMethodInfo (x: MethodInfo, ctxt) = inherit ProvidedMethodBase(x, ctxt) member _.ReturnType = x.ReturnType |> ProvidedType.CreateWithNullCheck ctxt "ReturnType" - static member Create ctxt x = match x with null -> null | t -> ProvidedMethodInfo (t, ctxt) + static member CreateNonNull ctxt (x: MethodInfo) : ProvidedMethodInfo = + ProvidedMethodInfo (x, ctxt) + + static member Create ctxt (x: MethodInfo MaybeNull) : ProvidedMethodInfo MaybeNull = + match x with + | Null -> null + | NonNull x -> ProvidedMethodInfo (x, ctxt) - static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedMethodInfo.Create ctxt) + + static member CreateArray ctxt (xs: MethodInfo[] MaybeNull) : ProvidedMethodInfo[] MaybeNull = + match xs with + | Null -> null + | NonNull xs -> xs |> Array.map (ProvidedMethodInfo.CreateNonNull ctxt) member _.Handle = x @@ -783,7 +857,10 @@ type ProvidedMethodInfo (x: MethodInfo, ctxt) = override _.GetHashCode() = assert false; x.GetHashCode() -[] +[] +#if NO_CHECKNULLS +[] +#endif type ProvidedPropertyInfo (x: PropertyInfo, ctxt) = inherit ProvidedMemberInfo(x, ctxt) @@ -800,9 +877,17 @@ type ProvidedPropertyInfo (x: PropertyInfo, ctxt) = /// PropertyInfo.PropertyType cannot be null member _.PropertyType = x.PropertyType |> ProvidedType.CreateWithNullCheck ctxt "PropertyType" - static member Create ctxt x = match x with null -> null | t -> ProvidedPropertyInfo (t, ctxt) + static member CreateNonNull ctxt x = ProvidedPropertyInfo (x, ctxt) - static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedPropertyInfo.Create ctxt) + static member Create ctxt x : ProvidedPropertyInfo MaybeNull = + match x with + | Null -> null + | NonNull x -> ProvidedPropertyInfo (x, ctxt) + + static member CreateArray ctxt (xs: PropertyInfo[] MaybeNull) : ProvidedPropertyInfo[] MaybeNull = + match xs with + | Null -> null + | NonNull xs -> xs |> Array.map (ProvidedPropertyInfo.CreateNonNull ctxt) member _.Handle = x @@ -811,12 +896,17 @@ type ProvidedPropertyInfo (x: PropertyInfo, ctxt) = override _.GetHashCode() = assert false; x.GetHashCode() static member TaintedGetHashCode (x: Tainted) = - Tainted.GetHashCodeTainted (x.PApplyNoFailure(fun st -> (st.Name, st.DeclaringType.Assembly.FullName, st.DeclaringType.FullName))) + Tainted.GetHashCodeTainted + (x.PApplyNoFailure(fun st -> (st.Name, (nonNull (nonNull st.DeclaringType).Assembly).FullName, + (nonNull st.DeclaringType).FullName))) static member TaintedEquals (pt1: Tainted, pt2: Tainted) = Tainted.EqTainted (pt1.PApplyNoFailure(fun st -> st.Handle)) (pt2.PApplyNoFailure(fun st -> st.Handle)) -[] +[] +#if NO_CHECKNULLS +[] +#endif type ProvidedEventInfo (x: EventInfo, ctxt) = inherit ProvidedMemberInfo(x, ctxt) @@ -826,11 +916,19 @@ type ProvidedEventInfo (x: EventInfo, ctxt) = /// EventInfo.EventHandlerType cannot be null member _.EventHandlerType = x.EventHandlerType |> ProvidedType.CreateWithNullCheck ctxt "EventHandlerType" - - static member Create ctxt x = match x with null -> null | t -> ProvidedEventInfo (t, ctxt) - - static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedEventInfo.Create ctxt) - + + static member CreateNonNull ctxt x = ProvidedEventInfo (x, ctxt) + + static member Create ctxt x : ProvidedEventInfo MaybeNull = + match x with + | Null -> null + | NonNull x -> ProvidedEventInfo (x, ctxt) + + static member CreateArray ctxt (xs: EventInfo[] MaybeNull) : ProvidedEventInfo[] MaybeNull = + match xs with + | Null -> null + | NonNull xs -> xs |> Array.map (ProvidedEventInfo.CreateNonNull ctxt) + member _.Handle = x override _.Equals y = assert false; match y with :? ProvidedEventInfo as y -> x.Equals y.Handle | _ -> false @@ -838,18 +936,31 @@ type ProvidedEventInfo (x: EventInfo, ctxt) = override _.GetHashCode() = assert false; x.GetHashCode() static member TaintedGetHashCode (x: Tainted) = - Tainted.GetHashCodeTainted (x.PApplyNoFailure(fun st -> (st.Name, st.DeclaringType.Assembly.FullName, st.DeclaringType.FullName))) + Tainted.GetHashCodeTainted + (x.PApplyNoFailure(fun st -> (st.Name, (nonNull (nonNull st.DeclaringType).Assembly).FullName, + (nonNull st.DeclaringType).FullName))) static member TaintedEquals (pt1: Tainted, pt2: Tainted) = Tainted.EqTainted (pt1.PApplyNoFailure(fun st -> st.Handle)) (pt2.PApplyNoFailure(fun st -> st.Handle)) -[] +[] +#if NO_CHECKNULLS +[] +#endif type ProvidedConstructorInfo (x: ConstructorInfo, ctxt) = inherit ProvidedMethodBase(x, ctxt) - static member Create ctxt x = match x with null -> null | t -> ProvidedConstructorInfo (t, ctxt) + static member CreateNonNull ctxt x = ProvidedConstructorInfo (x, ctxt) - static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedConstructorInfo.Create ctxt) + static member Create ctxt (x: ConstructorInfo MaybeNull) : ProvidedConstructorInfo MaybeNull = + match x with + | Null -> null + | NonNull x -> ProvidedConstructorInfo (x, ctxt) + + static member CreateArray ctxt (xs: ConstructorInfo[] MaybeNull) : ProvidedConstructorInfo[] MaybeNull = + match xs with + | Null -> null + | NonNull xs -> xs |> Array.map (ProvidedConstructorInfo.CreateNonNull ctxt) member _.Handle = x @@ -879,7 +990,11 @@ type ProvidedExprType = | ProvidedIfThenElseExpr of ProvidedExpr * ProvidedExpr * ProvidedExpr | ProvidedVarExpr of ProvidedVar +#if NO_CHECKNULLS [] +#else +[] +#endif type ProvidedExpr (x: Expr, ctxt) = member _.Type = x.Type |> ProvidedType.Create ctxt @@ -893,82 +1008,102 @@ type ProvidedExpr (x: Expr, ctxt) = member _.GetExprType() = match x with | Patterns.NewObject(ctor, args) -> - Some (ProvidedNewObjectExpr (ProvidedConstructorInfo.Create ctxt ctor, [| for a in args -> ProvidedExpr.Create ctxt a |])) + Some (ProvidedNewObjectExpr (ProvidedConstructorInfo.CreateNonNull ctxt ctor, [| for a in args -> ProvidedExpr.CreateNonNull ctxt a |])) | Patterns.WhileLoop(guardExpr, bodyExpr) -> - Some (ProvidedWhileLoopExpr (ProvidedExpr.Create ctxt guardExpr, ProvidedExpr.Create ctxt bodyExpr)) + Some (ProvidedWhileLoopExpr (ProvidedExpr.CreateNonNull ctxt guardExpr, ProvidedExpr.CreateNonNull ctxt bodyExpr)) | Patterns.NewDelegate(ty, vs, expr) -> - Some (ProvidedNewDelegateExpr(ProvidedType.Create ctxt ty, ProvidedVar.CreateArray ctxt (List.toArray vs), ProvidedExpr.Create ctxt expr)) + Some (ProvidedNewDelegateExpr(ProvidedType.CreateNonNull ctxt ty, ProvidedVar.CreateArray ctxt (List.toArray vs), ProvidedExpr.CreateNonNull ctxt expr)) | Patterns.Call(objOpt, meth, args) -> - Some (ProvidedCallExpr((match objOpt with None -> None | Some obj -> Some (ProvidedExpr.Create ctxt obj)), - ProvidedMethodInfo.Create ctxt meth, [| for a in args -> ProvidedExpr.Create ctxt a |])) + Some (ProvidedCallExpr((match objOpt with None -> None | Some obj -> Some (ProvidedExpr.CreateNonNull ctxt obj)), + ProvidedMethodInfo.CreateNonNull ctxt meth, [| for a in args -> ProvidedExpr.CreateNonNull ctxt a |])) | Patterns.DefaultValue ty -> - Some (ProvidedDefaultExpr (ProvidedType.Create ctxt ty)) + Some (ProvidedDefaultExpr (ProvidedType.CreateNonNull ctxt ty)) | Patterns.Value(obj, ty) -> - Some (ProvidedConstantExpr (obj, ProvidedType.Create ctxt ty)) + Some (ProvidedConstantExpr (obj, ProvidedType.CreateNonNull ctxt ty)) | Patterns.Coerce(arg, ty) -> - Some (ProvidedTypeAsExpr (ProvidedExpr.Create ctxt arg, ProvidedType.Create ctxt ty)) + Some (ProvidedTypeAsExpr (ProvidedExpr.CreateNonNull ctxt arg, ProvidedType.CreateNonNull ctxt ty)) | Patterns.NewTuple args -> Some (ProvidedNewTupleExpr(ProvidedExpr.CreateArray ctxt (Array.ofList args))) | Patterns.TupleGet(arg, n) -> - Some (ProvidedTupleGetExpr (ProvidedExpr.Create ctxt arg, n)) + Some (ProvidedTupleGetExpr (ProvidedExpr.CreateNonNull ctxt arg, n)) | Patterns.NewArray(ty, args) -> - Some (ProvidedNewArrayExpr(ProvidedType.Create ctxt ty, ProvidedExpr.CreateArray ctxt (Array.ofList args))) + Some (ProvidedNewArrayExpr(ProvidedType.CreateNonNull ctxt ty, ProvidedExpr.CreateArray ctxt (Array.ofList args))) | Patterns.Sequential(e1, e2) -> - Some (ProvidedSequentialExpr(ProvidedExpr.Create ctxt e1, ProvidedExpr.Create ctxt e2)) + Some (ProvidedSequentialExpr(ProvidedExpr.CreateNonNull ctxt e1, ProvidedExpr.CreateNonNull ctxt e2)) | Patterns.Lambda(v, body) -> - Some (ProvidedLambdaExpr (ProvidedVar.Create ctxt v, ProvidedExpr.Create ctxt body)) + Some (ProvidedLambdaExpr (ProvidedVar.CreateNonNull ctxt v, ProvidedExpr.CreateNonNull ctxt body)) | Patterns.TryFinally(b1, b2) -> - Some (ProvidedTryFinallyExpr (ProvidedExpr.Create ctxt b1, ProvidedExpr.Create ctxt b2)) + Some (ProvidedTryFinallyExpr (ProvidedExpr.CreateNonNull ctxt b1, ProvidedExpr.CreateNonNull ctxt b2)) | Patterns.TryWith(b, v1, e1, v2, e2) -> - Some (ProvidedTryWithExpr (ProvidedExpr.Create ctxt b, ProvidedVar.Create ctxt v1, ProvidedExpr.Create ctxt e1, ProvidedVar.Create ctxt v2, ProvidedExpr.Create ctxt e2)) + Some (ProvidedTryWithExpr (ProvidedExpr.CreateNonNull ctxt b, ProvidedVar.CreateNonNull ctxt v1, ProvidedExpr.CreateNonNull ctxt e1, ProvidedVar.CreateNonNull ctxt v2, ProvidedExpr.CreateNonNull ctxt e2)) | Patterns.TypeTest(e, ty) -> - Some (ProvidedTypeTestExpr(ProvidedExpr.Create ctxt e, ProvidedType.Create ctxt ty)) + Some (ProvidedTypeTestExpr(ProvidedExpr.CreateNonNull ctxt e, ProvidedType.CreateNonNull ctxt ty)) | Patterns.Let(v, e, b) -> - Some (ProvidedLetExpr (ProvidedVar.Create ctxt v, ProvidedExpr.Create ctxt e, ProvidedExpr.Create ctxt b)) + Some (ProvidedLetExpr (ProvidedVar.CreateNonNull ctxt v, ProvidedExpr.CreateNonNull ctxt e, ProvidedExpr.CreateNonNull ctxt b)) | Patterns.ForIntegerRangeLoop (v, e1, e2, e3) -> - Some (ProvidedForIntegerRangeLoopExpr (ProvidedVar.Create ctxt v, ProvidedExpr.Create ctxt e1, ProvidedExpr.Create ctxt e2, ProvidedExpr.Create ctxt e3)) + Some (ProvidedForIntegerRangeLoopExpr (ProvidedVar.CreateNonNull ctxt v, ProvidedExpr.CreateNonNull ctxt e1, ProvidedExpr.CreateNonNull ctxt e2, ProvidedExpr.CreateNonNull ctxt e3)) | Patterns.VarSet(v, e) -> - Some (ProvidedVarSetExpr (ProvidedVar.Create ctxt v, ProvidedExpr.Create ctxt e)) + Some (ProvidedVarSetExpr (ProvidedVar.CreateNonNull ctxt v, ProvidedExpr.CreateNonNull ctxt e)) | Patterns.IfThenElse(g, t, e) -> - Some (ProvidedIfThenElseExpr (ProvidedExpr.Create ctxt g, ProvidedExpr.Create ctxt t, ProvidedExpr.Create ctxt e)) + Some (ProvidedIfThenElseExpr (ProvidedExpr.CreateNonNull ctxt g, ProvidedExpr.CreateNonNull ctxt t, ProvidedExpr.CreateNonNull ctxt e)) | Patterns.Var v -> - Some (ProvidedVarExpr (ProvidedVar.Create ctxt v)) + Some (ProvidedVarExpr (ProvidedVar.CreateNonNull ctxt v)) | _ -> None + static member Create ctxt t : ProvidedExpr MaybeNull = + match box t with + | Null -> null + | _ -> ProvidedExpr (t, ctxt) - static member Create ctxt t = match box t with null -> null | _ -> ProvidedExpr (t, ctxt) + static member CreateNonNull ctxt t : ProvidedExpr = + ProvidedExpr (t, ctxt) - static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedExpr.Create ctxt) + static member CreateArray ctxt xs : ProvidedExpr[] = + match box xs with + | Null -> [| |] + | _ -> xs |> Array.map (ProvidedExpr.CreateNonNull ctxt) override _.Equals y = match y with :? ProvidedExpr as y -> x.Equals y.Handle | _ -> false override _.GetHashCode() = x.GetHashCode() +#if NO_CHECKNULLS [] +#else +[] +#endif type ProvidedVar (x: Var, ctxt) = member _.Type = x.Type |> ProvidedType.Create ctxt member _.Name = x.Name member _.IsMutable = x.IsMutable member _.Handle = x member _.Context = ctxt - static member Create ctxt t = match box t with null -> null | _ -> ProvidedVar (t, ctxt) - static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedVar.Create ctxt) + + static member CreateNonNull ctxt t = + ProvidedVar (t, ctxt) + + static member CreateArray ctxt xs : ProvidedVar[] = + match box xs with + | Null -> [| |] + | _ -> xs |> Array.map (ProvidedVar.CreateNonNull ctxt) + override _.Equals y = match y with :? ProvidedVar as y -> x.Equals y.Handle | _ -> false + override _.GetHashCode() = x.GetHashCode() /// Get the provided invoker expression for a particular use of a method. let GetInvokerExpression (provider: ITypeProvider, methodBase: ProvidedMethodBase, paramExprs: ProvidedVar[]) = - provider.GetInvokerExpression(methodBase.Handle, [| for p in paramExprs -> Expr.Var p.Handle |]) |> ProvidedExpr.Create methodBase.Context + provider.GetInvokerExpression(methodBase.Handle, [| for p in paramExprs -> Quotations.Expr.Var p.Handle |]) |> ProvidedExpr.Create methodBase.Context /// Compute the Name or FullName property of a provided type, reporting appropriate errors let CheckAndComputeProvidedNameProperty(m, st: Tainted, proj, propertyString) = - let name = + let name : string MaybeNull = try st.PUntaint(proj, m) with :? TypeProviderError as tpe -> let newError = tpe.MapText((fun msg -> FSComp.SR.etProvidedTypeWithNameException(propertyString, msg)), st.TypeProviderDesignation, m) raise newError if String.IsNullOrEmpty name then raise (TypeProviderError(FSComp.SR.etProvidedTypeWithNullOrEmptyName propertyString, st.TypeProviderDesignation, m)) - name + !!name /// Verify that this type provider has supported attributes let ValidateAttributesOfProvidedType (m, st: Tainted) = @@ -977,8 +1112,7 @@ let ValidateAttributesOfProvidedType (m, st: Tainted) = errorR(Error(FSComp.SR.etMustNotBeGeneric fullName, m)) if TryTypeMember(st, fullName, "IsArray", m, false, fun st->st.IsArray) |> unmarshal then errorR(Error(FSComp.SR.etMustNotBeAnArray fullName, m)) - TryTypeMemberNonNull(st, fullName, "GetInterfaces", m, [||], fun st -> st.GetInterfaces()) |> ignore - + TryTypeMemberNonNull(st, fullName, "GetInterfaces", m, [||], fun st -> st.GetInterfaces()) |> ignore /// Verify that a provided type has the expected name let ValidateExpectedName m expectedPath expectedName (st: Tainted) = @@ -986,19 +1120,23 @@ let ValidateExpectedName m expectedPath expectedName (st: Tainted) if name <> expectedName then raise (TypeProviderError(FSComp.SR.etProvidedTypeHasUnexpectedName(expectedName, name), st.TypeProviderDesignation, m)) +#if NO_CHECKNULLS let namespaceName = TryTypeMember(st, name, "Namespace", m, "", fun st -> st.Namespace) |> unmarshal +#else + let namespaceName = TryTypeMember<_, string | null>(st, name, "Namespace", m, "", fun st -> st.Namespace) |> unmarshal // TODO NULLNESS: why is this explicit instantiation needed? +#endif let rec declaringTypes (st: Tainted) accu = match TryTypeMember(st, name, "DeclaringType", m, null, fun st -> st.DeclaringType) with | Tainted.Null -> accu - | dt -> declaringTypes dt (CheckAndComputeProvidedNameProperty(m, dt, (fun dt -> dt.Name), "Name") :: accu) + | Tainted.NonNull dt -> declaringTypes dt (CheckAndComputeProvidedNameProperty(m, dt, (fun dt -> dt.Name), "Name") :: accu) let path = - [| match namespaceName with - | null -> () - | _ -> yield! namespaceName.Split([|'.'|]) - yield! declaringTypes st [] |] - + [| match namespaceName with + | Null -> () + | NonNull namespaceName -> yield! namespaceName.Split([|'.'|]) + yield! declaringTypes st [] |] + if path <> expectedPath then let expectedPath = String.Join(".", expectedPath) let path = String.Join(".", path) @@ -1009,7 +1147,11 @@ let ValidateProvidedTypeAfterStaticInstantiation(m, st: Tainted, e // Do all the calling into st up front with recovery let fullName, namespaceName, usedMembers = let name = CheckAndComputeProvidedNameProperty(m, st, (fun st -> st.Name), "Name") +#if NO_CHECKNULLS let namespaceName = TryTypeMember(st, name, "Namespace", m, FSComp.SR.invalidNamespaceForProvidedType(), fun st -> st.Namespace) |> unmarshal +#else + let namespaceName = TryTypeMember<_, string | null>(st, name, "Namespace", m, FSComp.SR.invalidNamespaceForProvidedType(), fun st -> st.Namespace) |> unmarshal +#endif let fullName = TryTypeMemberNonNull(st, name, "FullName", m, FSComp.SR.invalidFullNameForProvidedType(), fun st -> st.FullName) |> unmarshal ValidateExpectedName m expectedPath expectedName st // Must be able to call (GetMethods|GetEvents|GetProperties|GetNestedTypes|GetConstructors)(bindingFlags). @@ -1034,23 +1176,22 @@ let ValidateProvidedTypeAfterStaticInstantiation(m, st: Tainted, e for mi in usedMembers do match mi with | Tainted.Null -> errorR(Error(FSComp.SR.etNullMember fullName, m)) - | _ -> + | Tainted.NonNull _ -> let memberName = TryMemberMember(mi, fullName, "Name", "Name", m, "invalid provided type member name", fun mi -> mi.Name) |> unmarshal if String.IsNullOrEmpty memberName then errorR(Error(FSComp.SR.etNullOrEmptyMemberName fullName, m)) else let miDeclaringType = TryMemberMember(mi, fullName, memberName, "DeclaringType", m, ProvidedType.CreateNoContext(typeof), fun mi -> mi.DeclaringType) - match miDeclaringType with // Generated nested types may have null DeclaringType | Tainted.Null when mi.OfType().IsSome -> () | Tainted.Null -> errorR(Error(FSComp.SR.etNullMemberDeclaringType(fullName, memberName), m)) - | _ -> + | Tainted.NonNull miDeclaringType -> let miDeclaringTypeFullName = TryMemberMember (miDeclaringType, fullName, memberName, "FullName", m, "invalid declaring type full name", - fun miDeclaringType -> miDeclaringType.FullName) + fun miDeclaringType -> !!miDeclaringType.FullName) |> unmarshal if not (ProvidedType.TaintedEquals (st, miDeclaringType)) then @@ -1063,11 +1204,9 @@ let ValidateProvidedTypeAfterStaticInstantiation(m, st: Tainted, e if not isPublic || isGenericMethod then errorR(Error(FSComp.SR.etMethodHasRequirements(fullName, memberName), m)) | None -> - match mi.OfType() with | Some subType -> ValidateAttributesOfProvidedType(m, subType) | None -> - match mi.OfType() with | Some pi -> // Property must have a getter or setter @@ -1092,8 +1231,8 @@ let ValidateProvidedTypeAfterStaticInstantiation(m, st: Tainted, e | true, false -> errorR(Error(FSComp.SR.etPropertyHasSetterButNoCanWrite(memberName, fullName), m)) if not canRead && not canWrite then errorR(Error(FSComp.SR.etPropertyNeedsCanWriteOrCanRead(memberName, fullName), m)) - | None -> + | None -> match mi.OfType() with | Some ei -> // Event must have adder and remover @@ -1105,11 +1244,9 @@ let ValidateProvidedTypeAfterStaticInstantiation(m, st: Tainted, e | _, Tainted.Null -> errorR(Error(FSComp.SR.etEventNoRemove(memberName, fullName), m)) | _, _ -> () | None -> - match mi.OfType() with | Some _ -> () // TODO: Constructors must be public etc. | None -> - match mi.OfType() with | Some _ -> () // TODO: Fields must be public, literals must have a value etc. | None -> @@ -1119,7 +1256,11 @@ let ValidateProvidedTypeDefinition(m, st: Tainted, expectedPath: s // Validate the Name, Namespace and FullName properties let name = CheckAndComputeProvidedNameProperty(m, st, (fun st -> st.Name), "Name") +#if NO_CHECKNULLS let _namespaceName = TryTypeMember(st, name, "Namespace", m, FSComp.SR.invalidNamespaceForProvidedType(), fun st -> st.Namespace) |> unmarshal +#else + let _namespaceName = TryTypeMember<_, string | null>(st, name, "Namespace", m, FSComp.SR.invalidNamespaceForProvidedType(), fun st -> st.Namespace) |> unmarshal +#endif let _fullname = TryTypeMemberNonNull(st, name, "FullName", m, FSComp.SR.invalidFullNameForProvidedType(), fun st -> st.FullName) |> unmarshal ValidateExpectedName m expectedPath expectedName st @@ -1130,15 +1271,15 @@ let ValidateProvidedTypeDefinition(m, st: Tainted, expectedPath: s | -1 -> () | n -> errorR(Error(FSComp.SR.etIllegalCharactersInTypeName(string expectedName[n], expectedName), m)) - let staticParameters = st.PApplyWithProvider((fun (st, provider) -> st.GetStaticParameters provider), range=m) - if staticParameters.PUntaint((fun a -> a.Length), m) = 0 then + let staticParameters : Tainted = st.PApplyWithProvider((fun (st, provider) -> st.GetStaticParameters provider), range=m) + if staticParameters.PUntaint((fun a -> (nonNull a).Length), m) = 0 then ValidateProvidedTypeAfterStaticInstantiation(m, st, expectedPath, expectedName) /// Resolve a (non-nested) provided type given a full namespace name and a type name. /// May throw an exception which will be turned into an error message by one of the 'Try' function below. /// If resolution is successful the type is then validated. -let ResolveProvidedType (resolver: Tainted, m, moduleOrNamespace: string[], typeName) = +let ResolveProvidedType (resolver: Tainted, m, moduleOrNamespace: string[], typeName) : Tainted = let displayName = String.Join(".", moduleOrNamespace) // Try to find the type in the given provided namespace @@ -1168,7 +1309,7 @@ let ResolveProvidedType (resolver: Tainted, m, moduleOrNamespace: match tryNamespaces providedNamespaces with | None -> resolver.PApply((fun _ -> null), m) | Some res -> res - + /// Try to resolve a type against the given host with the given resolution environment. let TryResolveProvidedType(resolver: Tainted, m, moduleOrNamespace, typeName) = try @@ -1185,14 +1326,14 @@ let ILPathToProvidedType (st: Tainted, m) = match st.PApply((fun st -> st.DeclaringType), m) with | Tainted.Null -> match st.PUntaint((fun st -> st.Namespace), m) with - | Null -> typeName + | Null -> typeName | NonNull ns -> ns + "." + typeName | _ -> typeName let rec encContrib (st: Tainted) = match st.PApply((fun st ->st.DeclaringType), m) with | Tainted.Null -> [] - | enc -> encContrib enc @ [ nameContrib enc ] + | Tainted.NonNull enc -> encContrib enc @ [ nameContrib enc ] encContrib st, nameContrib st @@ -1204,7 +1345,7 @@ let ComputeMangledNameForApplyStaticParameters(nm, staticArgs, staticParams: Tai PrettyNaming.ComputeMangledNameWithoutDefaultArgValues(nm, staticArgs, defaultArgValues) /// Apply the given provided method to the given static arguments (the arguments are assumed to have been sorted into application order) -let TryApplyProvidedMethod(methBeforeArgs: Tainted, staticArgs: obj[], m: range) = +let TryApplyProvidedMethod(methBeforeArgs: Tainted, staticArgs: objnull[], m: range) = if staticArgs.Length = 0 then Some methBeforeArgs else @@ -1213,7 +1354,6 @@ let TryApplyProvidedMethod(methBeforeArgs: Tainted, staticAr let staticParams = methBeforeArgs.PApplyWithProvider((fun (mb, resolver) -> mb.GetStaticParametersForMethod resolver), range=m) let mangledName = ComputeMangledNameForApplyStaticParameters(nm, staticArgs, staticParams, m) mangledName - match methBeforeArgs.PApplyWithProvider((fun (mb, provider) -> mb.ApplyStaticArgumentsForMethod(provider, mangledName, staticArgs)), range=m) with | Tainted.Null -> None | Tainted.NonNull methWithArguments -> @@ -1224,11 +1364,11 @@ let TryApplyProvidedMethod(methBeforeArgs: Tainted, staticAr /// Apply the given provided type to the given static arguments (the arguments are assumed to have been sorted into application order -let TryApplyProvidedType(typeBeforeArguments: Tainted, optGeneratedTypePath: string list option, staticArgs: obj[], m: range) = +let TryApplyProvidedType(typeBeforeArguments: Tainted, optGeneratedTypePath: string list option, staticArgs: objnull[], m: range) = if staticArgs.Length = 0 then Some (typeBeforeArguments, (fun () -> ())) else - + let fullTypePathAfterArguments = // If there is a generated type name, then use that match optGeneratedTypePath with @@ -1237,10 +1377,10 @@ let TryApplyProvidedType(typeBeforeArguments: Tainted, optGenerate // Otherwise, use the full path of the erased type, including mangled arguments let nm = typeBeforeArguments.PUntaint((fun x -> x.Name), m) let enc, _ = ILPathToProvidedType (typeBeforeArguments, m) - let staticParams = typeBeforeArguments.PApplyWithProvider((fun (mb, resolver) -> mb.GetStaticParameters resolver), range=m) + let staticParams : Tainted = typeBeforeArguments.PApplyWithProvider((fun (st, resolver) -> st.GetStaticParameters resolver |> nonNull), range=m) let mangledName = ComputeMangledNameForApplyStaticParameters(nm, staticArgs, staticParams, m) enc @ [ mangledName ] - + match typeBeforeArguments.PApplyWithProvider((fun (typeBeforeArguments, provider) -> typeBeforeArguments.ApplyStaticArguments(provider, Array.ofList fullTypePathAfterArguments, staticArgs)), range=m) with | Tainted.Null -> None | Tainted.NonNull typeWithArguments -> @@ -1254,7 +1394,7 @@ let TryApplyProvidedType(typeBeforeArguments: Tainted, optGenerate /// Given a mangled name reference to a non-nested provided type, resolve it. /// If necessary, demangle its static arguments before applying them. let TryLinkProvidedType(resolver: Tainted, moduleOrNamespace: string[], typeLogicalName: string, range: range) = - + // Demangle the static parameters let typeName, argNamesAndValues = try @@ -1267,7 +1407,7 @@ let TryLinkProvidedType(resolver: Tainted, moduleOrNamespace: str match typeBeforeArguments with | Tainted.Null -> None - | _ -> + | Tainted.NonNull typeBeforeArguments -> // Take the static arguments (as strings, taken from the text in the reference we're relinking), // and convert them to objects of the appropriate type, based on the expected kind. let staticParameters = @@ -1275,7 +1415,7 @@ let TryLinkProvidedType(resolver: Tainted, moduleOrNamespace: str typeBeforeArguments.GetStaticParameters resolver),range=range0) let staticParameters = staticParameters.PApplyArray(id, "", range) - + let staticArgs = staticParameters |> Array.map (fun sp -> let typeBeforeArgumentsName = typeBeforeArguments.PUntaint ((fun st -> st.Name), range) @@ -1287,7 +1427,7 @@ let TryLinkProvidedType(resolver: Tainted, moduleOrNamespace: str sp.PUntaint((fun sp -> let pt = sp.ParameterType let uet = if pt.IsEnum then pt.GetEnumUnderlyingType() else pt - uet.FullName), range) + !!uet.FullName), range) match spReprTypeName with | "System.SByte" -> box (sbyte arg) @@ -1309,11 +1449,11 @@ let TryLinkProvidedType(resolver: Tainted, moduleOrNamespace: str | _ -> if sp.PUntaint ((fun sp -> sp.IsOptional), range) then match sp.PUntaint((fun sp -> sp.RawDefaultValue), range) with - | Null -> error (Error(FSComp.SR.etStaticParameterRequiresAValue (spName, typeBeforeArgumentsName, typeBeforeArgumentsName, spName), range0)) - | NonNull v -> v + | null -> error (Error(FSComp.SR.etStaticParameterRequiresAValue (spName, typeBeforeArgumentsName, typeBeforeArgumentsName, spName), range0)) + | v -> v else error(Error(FSComp.SR.etProvidedTypeReferenceMissingArgument spName, range0))) - + match TryApplyProvidedType(typeBeforeArguments, None, staticArgs, range0) with | Some (typeWithArguments, checkTypeName) -> @@ -1322,15 +1462,15 @@ let TryLinkProvidedType(resolver: Tainted, moduleOrNamespace: str | None -> None /// Get the parts of a .NET namespace. Special rules: null means global, empty is not allowed. -let GetPartsOfNamespaceRecover(namespaceName: string) = +let GetPartsOfNamespaceRecover(namespaceName: string MaybeNull) = match namespaceName with | Null -> [] | NonNull namespaceName -> if namespaceName.Length = 0 then [""] - else splitNamespace (nonNull namespaceName) + else splitNamespace namespaceName /// Get the parts of a .NET namespace. Special rules: null means global, empty is not allowed. -let GetProvidedNamespaceAsPath (m, resolver: Tainted, namespaceName: string) = +let GetProvidedNamespaceAsPath (m, resolver: Tainted, namespaceName:string MaybeNull) = match namespaceName with | Null -> [] | NonNull namespaceName -> @@ -1343,7 +1483,7 @@ let GetFSharpPathToProvidedType (st: Tainted, range) = // Can't use st.Fullname because it may be like IEnumerable // We want [System;Collections;Generic] let namespaceParts = GetPartsOfNamespaceRecover(st.PUntaint((fun st -> st.Namespace), range)) - let rec walkUpNestedClasses(st: Tainted, soFar) = + let rec walkUpNestedClasses(st: Tainted, soFar) = match st with | Tainted.Null -> soFar | Tainted.NonNull st -> walkUpNestedClasses(st.PApply((fun st ->st.DeclaringType), range), soFar) @ [st.PUntaint((fun st -> st.Name), range)] @@ -1360,8 +1500,8 @@ let GetOriginalILAssemblyRefOfProvidedAssembly (assembly: Tainted, range) = - - let aref = GetOriginalILAssemblyRefOfProvidedAssembly (st.PApply((fun st -> st.Assembly), range), range) + + let aref = GetOriginalILAssemblyRefOfProvidedAssembly (st.PApply((fun st -> nonNull st.Assembly), range), range) // NULLNESS TODO: why is explicit instantiation needed here let scoperef = ILScopeRef.Assembly aref let enc, nm = ILPathToProvidedType (st, range) let tref = ILTypeRef.Create(scoperef, enc, nm) @@ -1380,7 +1520,6 @@ type ProviderGeneratedType = ProviderGeneratedType of ilOrigTyRef: ILTypeRef * i /// names in the statically linked, embedded assembly, plus what types are nested in side what types. type ProvidedAssemblyStaticLinkingMap = { ILTypeMap: Dictionary } - static member CreateNew() = { ILTypeMap = Dictionary() } diff --git a/src/Compiler/TypedTree/TypeProviders.fsi b/src/Compiler/TypedTree/TypeProviders.fsi index 770536dfd81..c99f2ab3775 100755 --- a/src/Compiler/TypedTree/TypeProviders.fsi +++ b/src/Compiler/TypedTree/TypeProviders.fsi @@ -9,6 +9,7 @@ module internal rec FSharp.Compiler.TypeProviders open System open System.Collections.Concurrent open System.Collections.Generic +open Internal.Utilities.Library open FSharp.Core.CompilerServices open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.Text @@ -90,7 +91,10 @@ type ProvidedTypeContext = /// Map the TyconRef objects, if any member RemapTyconRefs: (obj -> obj) -> ProvidedTypeContext -[] +[] +#if NO_CHECKNULLS +[] +#endif type ProvidedType = inherit ProvidedMemberInfo @@ -110,7 +114,7 @@ type ProvidedType = member Assembly: ProvidedAssembly - member BaseType: ProvidedType + member BaseType: ProvidedType MaybeNull member GetNestedType: string -> ProvidedType @@ -204,21 +208,24 @@ type ProvidedType = static member TaintedEquals: Tainted * Tainted -> bool +#if NO_CHECKNULLS [] +#endif type IProvidedCustomAttributeProvider = - abstract GetHasTypeProviderEditorHideMethodsAttribute: provider: ITypeProvider -> bool - abstract GetDefinitionLocationAttribute: provider: ITypeProvider -> (string * int * int) option + abstract GetDefinitionLocationAttribute: provider: ITypeProvider -> (string MaybeNull * int * int) option abstract GetXmlDocAttributes: provider: ITypeProvider -> string[] abstract GetAttributeConstructorArgs: provider: ITypeProvider * attribName: string -> (obj option list * (string * obj option) list) option - -[] -type ProvidedAssembly = - + +[] +#if NO_CHECKNULLS +[] +#endif +type ProvidedAssembly = member GetName: unit -> System.Reflection.AssemblyName member FullName: string @@ -227,18 +234,23 @@ type ProvidedAssembly = member Handle: System.Reflection.Assembly -[] -type ProvidedMemberInfo = +[] +#if NO_CHECKNULLS +[] +#endif +type ProvidedMemberInfo = member Name: string - member DeclaringType: ProvidedType - - interface IProvidedCustomAttributeProvider + member DeclaringType: ProvidedType MaybeNull -[] -type ProvidedMethodBase = + interface IProvidedCustomAttributeProvider +[] +#if NO_CHECKNULLS +[] +#endif +type ProvidedMethodBase = inherit ProvidedMemberInfo member IsGenericMethod: bool @@ -273,8 +285,11 @@ type ProvidedMethodBase = static member TaintedEquals: Tainted * Tainted -> bool -[] -type ProvidedMethodInfo = +[] +#if NO_CHECKNULLS +[] +#endif +type ProvidedMethodInfo = inherit ProvidedMethodBase @@ -282,8 +297,11 @@ type ProvidedMethodInfo = member MetadataToken: int -[] -type ProvidedParameterInfo = +[] +#if NO_CHECKNULLS +[] +#endif +type ProvidedParameterInfo = member Name: string @@ -295,14 +313,17 @@ type ProvidedParameterInfo = member IsOptional: bool - member RawDefaultValue: obj + member RawDefaultValue: objnull member HasDefaultValue: bool interface IProvidedCustomAttributeProvider -[] -type ProvidedFieldInfo = +[] +#if NO_CHECKNULLS +[] +#endif +type ProvidedFieldInfo = inherit ProvidedMemberInfo @@ -330,8 +351,11 @@ type ProvidedFieldInfo = static member TaintedEquals: Tainted * Tainted -> bool -[] -type ProvidedPropertyInfo = +[] +#if NO_CHECKNULLS +[] +#endif +type ProvidedPropertyInfo = inherit ProvidedMemberInfo @@ -351,8 +375,11 @@ type ProvidedPropertyInfo = static member TaintedEquals: Tainted * Tainted -> bool -[] -type ProvidedEventInfo = +[] +#if NO_CHECKNULLS +[] +#endif +type ProvidedEventInfo = inherit ProvidedMemberInfo @@ -366,8 +393,11 @@ type ProvidedEventInfo = static member TaintedEquals: Tainted * Tainted -> bool -[] -type ProvidedConstructorInfo = +[] +#if NO_CHECKNULLS +[] +#endif +type ProvidedConstructorInfo = inherit ProvidedMethodBase type ProvidedExprType = @@ -411,8 +441,11 @@ type ProvidedExprType = | ProvidedIfThenElseExpr of ProvidedExpr * ProvidedExpr * ProvidedExpr | ProvidedVarExpr of ProvidedVar - -[] + +[] +#if NO_CHECKNULLS +[] +#endif type ProvidedExpr = member Type: ProvidedType @@ -422,7 +455,10 @@ type ProvidedExpr = member GetExprType: unit -> ProvidedExprType option -[] +[] +#if NO_CHECKNULLS +[] +#endif type ProvidedVar = member Type: ProvidedType @@ -446,12 +482,12 @@ val ValidateProvidedTypeAfterStaticInstantiation: /// to check the type name is as expected (this function is called by the caller of TryApplyProvidedType /// after other checks are made). val TryApplyProvidedType: - typeBeforeArguments: Tainted * optGeneratedTypePath: string list option * staticArgs: obj[] * range -> + typeBeforeArguments: Tainted * optGeneratedTypePath: string list option * staticArgs: objnull[] * range -> (Tainted * (unit -> unit)) option /// Try to apply a provided method to the given static arguments. val TryApplyProvidedMethod: - methBeforeArgs: Tainted * staticArgs: obj[] * range -> Tainted option + methBeforeArgs: Tainted * staticArgs: objnull[] * range -> Tainted option /// Try to resolve a type in the given extension type resolver val TryResolveProvidedType: Tainted * range * string[] * typeName: string -> Tainted option diff --git a/src/Compiler/TypedTree/TypedTree.fs b/src/Compiler/TypedTree/TypedTree.fs index ec455fcbee8..daf31357df3 100644 --- a/src/Compiler/TypedTree/TypedTree.fs +++ b/src/Compiler/TypedTree/TypedTree.fs @@ -90,7 +90,7 @@ type ValBaseOrThisInfo = /// Indicates a normal value | NormalVal - /// Indicates the 'this' value specified in a memberm e.g. 'x' in 'member x.M() = 1' + /// Indicates the 'this' value specified in a member e.g. 'x' in 'member x.M() = 1' | MemberThisVal /// Flags on values @@ -300,7 +300,7 @@ type TyparRigidity = [] type TyparFlags(flags: int32) = - new (kind: TyparKind, rigidity: TyparRigidity, isFromError: bool, isCompGen: bool, staticReq: TyparStaticReq, dynamicReq: TyparDynamicReq, equalityDependsOn: bool, comparisonDependsOn: bool) = + new (kind: TyparKind, rigidity: TyparRigidity, isFromError: bool, isCompGen: bool, staticReq: TyparStaticReq, dynamicReq: TyparDynamicReq, equalityDependsOn: bool, comparisonDependsOn: bool, supportsNullFlex: bool) = TyparFlags((if isFromError then 0b00000000000000010 else 0) ||| (if isCompGen then 0b00000000000000100 else 0) ||| (match staticReq with @@ -321,7 +321,11 @@ type TyparFlags(flags: int32) = | TyparDynamicReq.No -> 0b00000000000000000 | TyparDynamicReq.Yes -> 0b00000010000000000) ||| (if equalityDependsOn then - 0b00000100000000000 else 0)) + 0b00000100000000000 else 0) ||| + // 0b00001000100000000 is being checked by x.Kind, but never set in this version of the code + // 0b00010000000000000 is taken by compat flex + (if supportsNullFlex then + 0b00100000000000000 else 0)) /// Indicates if the type inference variable was generated after an error when type checking expressions or patterns member x.IsFromError = (flags &&& 0b00000000000000010) <> 0x0 @@ -380,8 +384,20 @@ type TyparFlags(flags: int32) = else TyparFlags(flags &&& ~~~0b00010000000000000) + /// Indicates that whether this type parameter is flexible for 'supports null' constraint, e.g. in the case of assignment to a mutable value + member x.IsSupportsNullFlex = + (flags &&& 0b00100000000000000) <> 0x0 + + member x.WithSupportsNullFlex b = + if b then + TyparFlags(flags ||| 0b00100000000000000) + else + TyparFlags(flags &&& ~~~0b00100000000000000) + + + member x.WithStaticReq staticReq = - TyparFlags(x.Kind, x.Rigidity, x.IsFromError, x.IsCompilerGenerated, staticReq, x.DynamicReq, x.EqualityConditionalOn, x.ComparisonConditionalOn) + TyparFlags(x.Kind, x.Rigidity, x.IsFromError, x.IsCompilerGenerated, staticReq, x.DynamicReq, x.EqualityConditionalOn, x.ComparisonConditionalOn, x.IsSupportsNullFlex) /// Get the flags as included in the F# binary metadata. We pickle this as int64 to allow for future expansion member x.PickledBits = flags @@ -2238,6 +2254,9 @@ type TyparOptionalData = /// The declared attributes of the type parameter. Empty for type inference variables. mutable typar_attribs: Attribs + + /// Set to true if the typar is contravariant, i.e. declared as in C# + mutable typar_is_contravariant: bool } [] @@ -2321,6 +2340,8 @@ type Typar = /// Set whether this type parameter is a compat-flex type parameter (i.e. where "expr :> tp" only emits an optional warning) member x.SetIsCompatFlex b = x.typar_flags <- x.typar_flags.WithCompatFlex b + member x.SetSupportsNullFlex b = x.typar_flags <- x.typar_flags.WithSupportsNullFlex b + /// Indicates whether a type variable can be instantiated by types or units-of-measure. member x.Kind = x.typar_flags.Kind @@ -2337,12 +2358,12 @@ type Typar = member x.SetAttribs attribs = match attribs, x.typar_opt_data with | [], None -> () - | [], Some { typar_il_name = None; typar_xmldoc = doc; typar_constraints = [] } when doc.IsEmpty -> + | [], Some { typar_il_name = None; typar_xmldoc = doc; typar_constraints = []; typar_is_contravariant = false } when doc.IsEmpty -> x.typar_opt_data <- None | _, Some optData -> optData.typar_attribs <- attribs - | _ -> x.typar_opt_data <- Some { typar_il_name = None; typar_xmldoc = XmlDoc.Empty; typar_constraints = []; typar_attribs = attribs } + | _ -> x.typar_opt_data <- Some { typar_il_name = None; typar_xmldoc = XmlDoc.Empty; typar_constraints = []; typar_attribs = attribs; typar_is_contravariant = false } - /// Get the XML documetnation for the type parameter + /// Get the XML documentation for the type parameter member x.XmlDoc = match x.typar_opt_data with | Some optData -> optData.typar_xmldoc @@ -2358,7 +2379,7 @@ type Typar = member x.SetILName il_name = match x.typar_opt_data with | Some optData -> optData.typar_il_name <- il_name - | _ -> x.typar_opt_data <- Some { typar_il_name = il_name; typar_xmldoc = XmlDoc.Empty; typar_constraints = []; typar_attribs = [] } + | _ -> x.typar_opt_data <- Some { typar_il_name = il_name; typar_xmldoc = XmlDoc.Empty; typar_constraints = []; typar_attribs = []; typar_is_contravariant = false } /// Indicates the display name of a type variable member x.DisplayName = if x.Name = "?" then "?"+string x.Stamp else x.Name @@ -2367,10 +2388,17 @@ type Typar = member x.SetConstraints cs = match cs, x.typar_opt_data with | [], None -> () - | [], Some { typar_il_name = None; typar_xmldoc = doc; typar_attribs = [] } when doc.IsEmpty -> + | [], Some { typar_il_name = None; typar_xmldoc = doc; typar_attribs = [];typar_is_contravariant = false } when doc.IsEmpty -> x.typar_opt_data <- None | _, Some optData -> optData.typar_constraints <- cs - | _ -> x.typar_opt_data <- Some { typar_il_name = None; typar_xmldoc = XmlDoc.Empty; typar_constraints = cs; typar_attribs = [] } + | _ -> x.typar_opt_data <- Some { typar_il_name = None; typar_xmldoc = XmlDoc.Empty; typar_constraints = cs; typar_attribs = []; typar_is_contravariant = false } + + /// Marks the typar as being contravariant + member x.MarkAsContravariant() = + match x.typar_opt_data with + | Some optData -> optData.typar_is_contravariant <- true + | _ -> + x.typar_opt_data <- Some { typar_il_name = None; typar_xmldoc = XmlDoc.Empty; typar_constraints = []; typar_attribs = []; typar_is_contravariant = true } /// Creates a type variable that contains empty data, and is not yet linked. Only used during unpickling of F# metadata. static member NewUnlinked() : Typar = @@ -2392,19 +2420,23 @@ type Typar = x.typar_solution <- tg.typar_solution match tg.typar_opt_data with | Some tg -> - let optData = { typar_il_name = tg.typar_il_name; typar_xmldoc = tg.typar_xmldoc; typar_constraints = tg.typar_constraints; typar_attribs = tg.typar_attribs } + let optData = { typar_il_name = tg.typar_il_name; typar_xmldoc = tg.typar_xmldoc; typar_constraints = tg.typar_constraints; typar_attribs = tg.typar_attribs; typar_is_contravariant = tg.typar_is_contravariant } x.typar_opt_data <- Some optData | None -> () /// Links a previously unlinked type variable to the given data. Only used during unpickling of F# metadata. - member x.AsType = - let ty = x.typar_astype - match box ty with - | null -> - let ty2 = TType_var (x, 0uy) - x.typar_astype <- ty2 - ty2 - | _ -> ty + member x.AsType nullness = + match nullness with + | Nullness.Known NullnessInfo.AmbivalentToNull -> + let ty = x.typar_astype + match box ty with + | null -> + let ty2 = TType_var (x, Nullness.Known NullnessInfo.AmbivalentToNull) + x.typar_astype <- ty2 + ty2 + | _ -> ty + | _ -> + TType_var (x, nullness) /// Indicates if a type variable has been linked. Only used during unpickling of F# metadata. member x.IsLinked = x.typar_stamp <> -1L @@ -2421,12 +2453,12 @@ type Typar = /// Sets the rigidity of a type variable member x.SetRigidity b = let flags = x.typar_flags - x.typar_flags <- TyparFlags(flags.Kind, b, flags.IsFromError, flags.IsCompilerGenerated, flags.StaticReq, flags.DynamicReq, flags.EqualityConditionalOn, flags.ComparisonConditionalOn) + x.typar_flags <- TyparFlags(flags.Kind, b, flags.IsFromError, flags.IsCompilerGenerated, flags.StaticReq, flags.DynamicReq, flags.EqualityConditionalOn, flags.ComparisonConditionalOn, flags.IsSupportsNullFlex) /// Sets whether a type variable is compiler generated member x.SetCompilerGenerated b = let flags = x.typar_flags - x.typar_flags <- TyparFlags(flags.Kind, flags.Rigidity, flags.IsFromError, b, flags.StaticReq, flags.DynamicReq, flags.EqualityConditionalOn, flags.ComparisonConditionalOn) + x.typar_flags <- TyparFlags(flags.Kind, flags.Rigidity, flags.IsFromError, b, flags.StaticReq, flags.DynamicReq, flags.EqualityConditionalOn, flags.ComparisonConditionalOn, flags.IsSupportsNullFlex) /// Sets whether a type variable has a static requirement member x.SetStaticReq b = @@ -2435,17 +2467,17 @@ type Typar = /// Sets whether a type variable is required at runtime member x.SetDynamicReq b = let flags = x.typar_flags - x.typar_flags <- TyparFlags(flags.Kind, flags.Rigidity, flags.IsFromError, flags.IsCompilerGenerated, flags.StaticReq, b, flags.EqualityConditionalOn, flags.ComparisonConditionalOn) + x.typar_flags <- TyparFlags(flags.Kind, flags.Rigidity, flags.IsFromError, flags.IsCompilerGenerated, flags.StaticReq, b, flags.EqualityConditionalOn, flags.ComparisonConditionalOn, flags.IsSupportsNullFlex) /// Sets whether the equality constraint of a type definition depends on this type variable member x.SetEqualityDependsOn b = let flags = x.typar_flags - x.typar_flags <- TyparFlags(flags.Kind, flags.Rigidity, flags.IsFromError, flags.IsCompilerGenerated, flags.StaticReq, flags.DynamicReq, b, flags.ComparisonConditionalOn) + x.typar_flags <- TyparFlags(flags.Kind, flags.Rigidity, flags.IsFromError, flags.IsCompilerGenerated, flags.StaticReq, flags.DynamicReq, b, flags.ComparisonConditionalOn, flags.IsSupportsNullFlex) /// Sets whether the comparison constraint of a type definition depends on this type variable member x.SetComparisonDependsOn b = let flags = x.typar_flags - x.typar_flags <- TyparFlags(flags.Kind, flags.Rigidity, flags.IsFromError, flags.IsCompilerGenerated, flags.StaticReq, flags.DynamicReq, flags.EqualityConditionalOn, b) + x.typar_flags <- TyparFlags(flags.Kind, flags.Rigidity, flags.IsFromError, flags.IsCompilerGenerated, flags.StaticReq, flags.DynamicReq, flags.EqualityConditionalOn, b, flags.IsSupportsNullFlex) [] member x.DebugText = x.ToString() @@ -2465,6 +2497,9 @@ type TyparConstraint = /// A constraint that a type has a 'null' value | SupportsNull of range: range + /// A constraint that a type doesn't support nullness + | NotSupportsNull of range + /// A constraint that a type has a member with the given signature | MayResolveMember of constraintInfo: TraitConstraintInfo * range: range @@ -3062,7 +3097,7 @@ type Val = // - in opt.fs: when compiling fslib, we bind an entry for the value in a global table (see bind_escaping_local_vspec) // - in ilxgen.fs: when compiling fslib, we bind an entry for the value in a global table (see bind_escaping_local_vspec) // - in opt.fs: (fullDebugTextOfValRef) for error reporting of non-inlinable values - // - in service.fs (boutput_item_description): to display the full text of a value's binding location + // - in service.fs (output_item_description): to display the full text of a value's binding location // - in check.fs: as a boolean to detect public values for saving quotations // - in ilxgen.fs: as a boolean to detect public values for saving quotations // - in MakeExportRemapping, to build non-local references for values @@ -3357,7 +3392,7 @@ type NonLocalValOrMemberRef = member x.DebugText = x.ToString() /// For debugging - override x.ToString() = x.EnclosingEntity.nlr.ToString() + "::" + x.ItemKey.PartialKey.LogicalName + override x.ToString() = !! x.EnclosingEntity.nlr.ToString() + "::" + x.ItemKey.PartialKey.LogicalName /// Represents the path information for a reference to a value or member in another assembly, disassociated /// from any particular reference. @@ -4284,6 +4319,66 @@ type RecdFieldRef = override x.ToString() = x.FieldName +[] +type Nullness = + | Known of NullnessInfo + | Variable of NullnessVar + + member n.Evaluate() = + match n with + | Known info -> info + | Variable v -> v.Evaluate() + + member n.TryEvaluate() = + match n with + | Known info -> ValueSome info + | Variable v -> v.TryEvaluate() + + override n.ToString() = match n.Evaluate() with NullnessInfo.WithNull -> "?" | NullnessInfo.WithoutNull -> "" | NullnessInfo.AmbivalentToNull -> "%" + + member n.ToFsharpCodeString() = match n.Evaluate() with NullnessInfo.WithNull -> " | null " | NullnessInfo.WithoutNull -> "" | NullnessInfo.AmbivalentToNull -> "" + +// Note, nullness variables are only created if the nullness checking feature is on +[] +type NullnessVar() = + let mutable solution: Nullness option = None + + member nv.Evaluate() = + match solution with + | None -> NullnessInfo.WithoutNull + | Some soln -> soln.Evaluate() + + member nv.TryEvaluate() = + match solution with + | None -> ValueNone + | Some soln -> soln.TryEvaluate() + + member nv.IsSolved = solution.IsSome + + member nv.Set(nullness) = + assert (not nv.IsSolved) + solution <- Some nullness + + member nv.Unset() = + assert nv.IsSolved + solution <- None + + member nv.Solution = + assert nv.IsSolved + solution.Value + +[] +type NullnessInfo = + + /// we know that there is an extra null value in the type + | WithNull + + /// we know that there is no extra null value in the type + | WithoutNull + + /// we know we don't care + | AmbivalentToNull + /// Represents a type in the typed abstract syntax [] type TType = @@ -4291,10 +4386,10 @@ type TType = /// Indicates the type is a universal type, only used for types of values and members | TType_forall of typars: Typars * bodyTy: TType - /// Indicates the type is built from a named type and a number of type arguments. + /// TType_app(tyconRef, typeInstantiation, nullness). /// - /// 'flags' is a placeholder for future features, in particular nullness analysis - | TType_app of tyconRef: TyconRef * typeInstantiation: TypeInst * flags: byte + /// Indicates the type is built from a named type and a number of type arguments + | TType_app of tyconRef: TyconRef * typeInstantiation: TypeInst * nullness: Nullness /// Indicates the type is an anonymous record type whose compiled representation is located in the given assembly | TType_anon of anonInfo: AnonRecdTypeInfo * tys: TType list @@ -4302,10 +4397,10 @@ type TType = /// Indicates the type is a tuple type. elementTypes must be of length 2 or greater. | TType_tuple of tupInfo: TupInfo * elementTypes: TTypes - /// Indicates the type is a function type. + /// TType_fun(domainType, rangeType, nullness). /// - /// 'flags' is a placeholder for future features, in particular nullness analysis. - | TType_fun of domainType: TType * rangeType: TType * flags: byte + /// Indicates the type is a function type + | TType_fun of domainType: TType * rangeType: TType * nullness: Nullness /// Indicates the type is a non-F#-visible type representing a "proof" that a union value belongs to a particular union case /// These types are not user-visible and will never appear as an inferred type. They are the types given to @@ -4313,9 +4408,7 @@ type TType = | TType_ucase of unionCaseRef: UnionCaseRef * typeInstantiation: TypeInst /// Indicates the type is a variable type, whether declared, generalized or an inference type parameter - /// - /// 'flags' is a placeholder for future features, in particular nullness analysis - | TType_var of typar: Typar * flags: byte + | TType_var of typar: Typar * nullness: Nullness /// Indicates the type is a unit-of-measure expression being used as an argument to a type or member | TType_measure of measure: Measure @@ -4341,18 +4434,18 @@ type TType = override x.ToString() = match x with | TType_forall (_tps, ty) -> "forall ... " + ty.ToString() - | TType_app (tcref, tinst, _) -> tcref.DisplayName + (match tinst with [] -> "" | tys -> "<" + String.concat "," (List.map string tys) + ">") + | TType_app (tcref, tinst, nullness) -> tcref.DisplayName + (match tinst with [] -> "" | tys -> "<" + String.concat "," (List.map string tys) + ">") + nullness.ToString() | TType_tuple (tupInfo, tinst) -> (match tupInfo with | TupInfo.Const false -> "" | TupInfo.Const true -> "struct ") - + String.concat "," (List.map string tinst) + + String.concat "," (List.map string tinst) + ")" | TType_anon (anonInfo, tinst) -> (match anonInfo.TupInfo with | TupInfo.Const false -> "" | TupInfo.Const true -> "struct ") + "{|" + String.concat "," (Seq.map2 (fun nm ty -> nm + " " + string ty + ";") anonInfo.SortedNames tinst) + "|}" - | TType_fun (domainTy, retTy, _) -> "(" + string domainTy + " -> " + string retTy + ")" + | TType_fun (domainTy, retTy, nullness) -> "(" + string domainTy + " -> " + string retTy + ")" + nullness.ToString() | TType_ucase (uc, tinst) -> "ucase " + uc.CaseName + (match tinst with [] -> "" | tys -> "<" + String.concat "," (List.map string tys) + ">") | TType_var (tp, _) -> match tp.Solution with @@ -4433,7 +4526,7 @@ type AnonRecdTypeInfo = x.SortedNames <- sortedNames x.IlTypeName <- d.IlTypeName - member x.IsLinked = (match x.SortedIds with null -> true | _ -> false) + member x.IsLinked = (match box x.SortedIds with null -> true | _ -> false) member x.DisplayNameCoreByIdx idx = x.SortedNames[idx] @@ -4696,7 +4789,7 @@ type DecisionTreeTest = /// -- boundVals - The values bound at the target, matching the valuesin the TDSuccess /// -- targetExpr - The expression to evaluate if we branch to the target /// -- debugPoint - The debug point for the target -/// -- isStateVarFlags - Indicates which, if any, of the values are repesents as state machine variables +/// -- isStateVarFlags - Indicates which, if any, of the values are represents as state machine variables [] type DecisionTreeTarget = | TTarget of @@ -5019,11 +5112,11 @@ type Expr = override expr.ToString() = expr.ToDebugString(3) - member expr.ToDebugString(depth: int) = + member expr.ToDebugString(depth: int) : string = if depth = 0 then ".." else let depth = depth - 1 match expr with - | Const (c, _, _) -> c.ToString() + | Const (c, _, _) -> string c | Val (v, _, _) -> v.LogicalName | Sequential (e1, e2, _, _) -> "Sequential(" + e1.ToDebugString(depth) + ", " + e2.ToDebugString(depth) + ")" | Lambda (_, _, _, vs, body, _, _) -> sprintf "Lambda(%+A, " vs + body.ToDebugString(depth) + ")" @@ -5602,13 +5695,13 @@ module CcuTypeForwarderTable = if remainingPath.Count = 0 then finalKey else - remainingPath.Array.[remainingPath.Offset] + (!!remainingPath.Array).[remainingPath.Offset] match nodes.TryGetValue searchTerm with | true, innerTree -> if remainingPath.Count = 0 then innerTree.Value else - findInTree (ArraySegment(remainingPath.Array, remainingPath.Offset + 1, remainingPath.Count - 1)) finalKey innerTree + findInTree (ArraySegment((!!remainingPath.Array), remainingPath.Offset + 1, remainingPath.Count - 1)) finalKey innerTree | false, _ -> None /// Represents a table of .NET CLI type forwarders for an assembly @@ -5652,12 +5745,12 @@ type CcuThunk = /// Dereference the assembly reference member ccu.Deref = - if isNull (ccu.target :> obj) then + if isNull (box ccu.target) then raise(UnresolvedReferenceNoRange ccu.name) ccu.target /// Indicates if this assembly reference is unresolved - member ccu.IsUnresolvedReference = isNull (ccu.target :> obj) + member ccu.IsUnresolvedReference = isNull (box ccu.target) /// Ensure the ccu is derefable in advance. Supply a path to attach to any resulting error message. member ccu.EnsureDerefable(requiringPath: string[]) = @@ -5755,7 +5848,7 @@ type CcuThunk = [] member x.DebugText = x.ToString() - /// Used at the end of comppiling an assembly to get a frozen, final stable CCU + /// Used at the end of compiling an assembly to get a frozen, final stable CCU /// for the compilation which we no longer mutate. member x.CloneWithFinalizedContents(ccuContents) = { x with target = { x.target with Contents = ccuContents } } @@ -5918,7 +6011,7 @@ type Construct() = let lazyBaseTy = LazyWithContext.Create ((fun (m, objTy) -> - let baseSystemTy = st.PApplyOption((fun st -> match st.BaseType with null -> None | ty -> Some ty), m) + let baseSystemTy = st.PApplyOption((fun st -> match st.BaseType with null -> None | ty -> Some (ty)), m) match baseSystemTy with | None -> objTy | Some t -> importProvidedType t), @@ -5932,7 +6025,9 @@ type Construct() = IsDelegate = (fun () -> st.PUntaint((fun st -> let baseType = st.BaseType match baseType with - | null -> false + | Null -> false + | NonNull x -> + match x with | x when x.IsGenericType -> false | x when x.DeclaringType <> null -> false | x -> x.FullName = "System.Delegate" || x.FullName = "System.MulticastDelegate"), m)) @@ -6051,13 +6146,13 @@ type Construct() = Typar.New { typar_id = id typar_stamp = newStamp() - typar_flags= TyparFlags(kind, rigid, isFromError, isCompGen, staticReq, dynamicReq, eqDep, compDep) + typar_flags= TyparFlags(kind, rigid, isFromError, isCompGen, staticReq, dynamicReq, eqDep, compDep, false) typar_solution = None typar_astype = Unchecked.defaultof<_> typar_opt_data = match attribs with | [] -> None - | _ -> Some { typar_il_name = None; typar_xmldoc = XmlDoc.Empty; typar_constraints = []; typar_attribs = attribs } } + | _ -> Some { typar_il_name = None; typar_xmldoc = XmlDoc.Empty; typar_constraints = []; typar_attribs = attribs; typar_is_contravariant = false } } /// Create a new type parameter node for a declared type parameter static member NewRigidTypar nm m = @@ -6234,10 +6329,10 @@ type Construct() = static member ComputeDefinitionLocationOfProvidedItem<'T when 'T :> IProvidedCustomAttributeProvider> (p: Tainted<'T>) : range option = let attrs = p.PUntaintNoFailure(fun x -> x.GetDefinitionLocationAttribute(p.TypeProvider.PUntaintNoFailure id)) match attrs with - | None | Some (null, _, _) -> None - | Some (filePath, line, column) -> + | None | Some (Null, _, _) -> None + | Some (NonNull filePath, line, column) -> // Coordinates from type provider are 1-based for lines and columns // Coordinates internally in the F# compiler are 1-based for lines and 0-based for columns let pos = Position.mkPos line (max 0 (column - 1)) - mkRange filePath pos pos |> Some + mkRange !!filePath pos pos |> Some #endif diff --git a/src/Compiler/TypedTree/TypedTree.fsi b/src/Compiler/TypedTree/TypedTree.fsi index ca766220265..3ba4f5c12ba 100644 --- a/src/Compiler/TypedTree/TypedTree.fsi +++ b/src/Compiler/TypedTree/TypedTree.fsi @@ -205,7 +205,8 @@ type TyparFlags = staticReq: Syntax.TyparStaticReq * dynamicReq: TyparDynamicReq * equalityDependsOn: bool * - comparisonDependsOn: bool -> + comparisonDependsOn: bool * + supportsNullFlex: bool -> TyparFlags new: flags: int32 -> TyparFlags @@ -232,6 +233,9 @@ type TyparFlags = /// Indicates if the type inference variable was generated after an error when type checking expressions or patterns member IsFromError: bool + /// Indicates whether this type parameter is flexible for 'supports null' constraint, e.g. in the case of assignment to a mutable value + member IsSupportsNullFlex: bool + /// Indicates whether a type variable can be instantiated by types or units-of-measure. member Kind: TyparKind @@ -1481,6 +1485,9 @@ type TyparOptionalData = /// The declared attributes of the type parameter. Empty for type inference variables. mutable typar_attribs: Attribs + + /// Set to true if the typar is contravariant, i.e. declared as in C# + mutable typar_is_contravariant: bool } override ToString: unit -> string @@ -1537,6 +1544,9 @@ type Typar = /// Adjusts the constraints associated with a type variable member SetConstraints: cs: TyparConstraint list -> unit + /// Marks the typar as being contravariant + member MarkAsContravariant: unit -> unit + /// Sets whether a type variable is required at runtime member SetDynamicReq: b: TyparDynamicReq -> unit @@ -1552,6 +1562,9 @@ type Typar = /// Set whether this type parameter is a compat-flex type parameter (i.e. where "expr :> tp" only emits an optional warning) member SetIsCompatFlex: b: bool -> unit + /// Set whether this type parameter is flexible for 'supports null' constraint, e.g. in the case of assignment to a mutable value + member SetSupportsNullFlex: b: bool -> unit + /// Sets the rigidity of a type variable member SetRigidity: b: TyparRigidity -> unit @@ -1561,7 +1574,7 @@ type Typar = override ToString: unit -> string /// Links a previously unlinked type variable to the given data. Only used during unpickling of F# metadata. - member AsType: TType + member AsType: nullness: Nullness -> TType /// The declared attributes of the type parameter. Empty for type inference variables type parameters from .NET. member Attribs: Attribs @@ -1630,7 +1643,7 @@ type Typar = /// Indicates if the type variable has a static "head type" requirement, i.e. ^a variables used in FSharp.Core type member constraints. member StaticReq: Syntax.TyparStaticReq - /// Get the XML documetnation for the type parameter + /// Get the XML documentation for the type parameter member XmlDoc: XmlDoc /// Represents a constraint on a type parameter or type @@ -1646,6 +1659,9 @@ type TyparConstraint = /// A constraint that a type has a 'null' value | SupportsNull of range: range + /// A constraint that a type doesn't support nullness + | NotSupportsNull of range + /// A constraint that a type has a member with the given signature | MayResolveMember of constraintInfo: TraitConstraintInfo * range: range @@ -3052,6 +3068,39 @@ type RecdFieldRef = /// Get a reference to the type containing this record field member TyconRef: TyconRef +[] +type NullnessInfo = + + /// we know that there is an extra null value in the type + | WithNull + + /// we know that there is no extra null value in the type + | WithoutNull + + /// we know we don't care + | AmbivalentToNull + +[] +type Nullness = + | Known of NullnessInfo + | Variable of NullnessVar + + member Evaluate: unit -> NullnessInfo + + member TryEvaluate: unit -> NullnessInfo voption + + member ToFsharpCodeString: unit -> string + +[] +type NullnessVar = + new: unit -> NullnessVar + member Evaluate: unit -> NullnessInfo + member TryEvaluate: unit -> NullnessInfo voption + member IsSolved: bool + member Set: Nullness -> unit + member Unset: unit -> unit + member Solution: Nullness + /// Represents a type in the typed abstract syntax [] type TType = @@ -3062,7 +3111,7 @@ type TType = /// Indicates the type is built from a named type and a number of type arguments. /// /// 'flags' is a placeholder for future features, in particular nullness analysis - | TType_app of tyconRef: TyconRef * typeInstantiation: TypeInst * flags: byte + | TType_app of tyconRef: TyconRef * typeInstantiation: TypeInst * nullness: Nullness /// Indicates the type is an anonymous record type whose compiled representation is located in the given assembly | TType_anon of anonInfo: AnonRecdTypeInfo * tys: TType list @@ -3073,7 +3122,7 @@ type TType = /// Indicates the type is a function type. /// /// 'flags' is a placeholder for future features, in particular nullness analysis. - | TType_fun of domainType: TType * rangeType: TType * flags: byte + | TType_fun of domainType: TType * rangeType: TType * nullness: Nullness /// Indicates the type is a non-F#-visible type representing a "proof" that a union value belongs to a particular union case /// These types are not user-visible type will never appear as an inferred type. They are the types given to @@ -3083,14 +3132,14 @@ type TType = /// Indicates the type is a variable type, whether declared, generalized or an inference type parameter /// /// 'flags' is a placeholder for future features, in particular nullness analysis - | TType_var of typar: Typar * flags: byte + | TType_var of typar: Typar * nullness: Nullness /// Indicates the type is a unit-of-measure expression being used as an argument to a type or member | TType_measure of measure: Measure /// For now, used only as a discriminant in error message. /// See https://github.com/dotnet/fsharp/issues/2561 - member GetAssemblyName: unit -> string + member GetAssemblyName: unit -> string MaybeNull override ToString: unit -> string @@ -3353,7 +3402,7 @@ type DecisionTreeTest = /// -- boundVals - The values bound at the target, matching the valuesin the TDSuccess /// -- targetExpr - The expression to evaluate if we branch to the target /// -- debugPoint - The debug point for the target -/// -- isStateVarFlags - Indicates which, if any, of the values are repesents as state machine variables +/// -- isStateVarFlags - Indicates which, if any, of the values are represents as state machine variables [] type DecisionTreeTarget = | TTarget of boundVals: Val list * targetExpr: Expr * isStateVarFlags: bool list option @@ -4137,7 +4186,7 @@ type CcuThunk = /// Create a CCU with the given name but where the contents have not yet been specified static member CreateDelayed: nm: CcuReference -> CcuThunk - /// Used at the end of comppiling an assembly to get a frozen, final stable CCU + /// Used at the end of compiling an assembly to get a frozen, final stable CCU /// for the compilation which we no longer mutate. member CloneWithFinalizedContents: ccuContents: ModuleOrNamespace -> CcuThunk diff --git a/src/Compiler/TypedTree/TypedTreeBasics.fs b/src/Compiler/TypedTree/TypedTreeBasics.fs index ca2674f873f..c8268ffcf8a 100644 --- a/src/Compiler/TypedTree/TypedTreeBasics.fs +++ b/src/Compiler/TypedTree/TypedTreeBasics.fs @@ -182,15 +182,23 @@ let ccuOfTyconRef eref = // Type parameters and inference unknowns //------------------------------------------------------------------------- -let mkTyparTy (tp: Typar) = +let NewNullnessVar() = Nullness.Variable (NullnessVar()) // we don't known (and if we never find out then it's non-null) + +let KnownAmbivalentToNull = Nullness.Known NullnessInfo.AmbivalentToNull + +let KnownWithNull = Nullness.Known NullnessInfo.WithNull + +let KnownWithoutNull = Nullness.Known NullnessInfo.WithoutNull + +let mkTyparTy (tp:Typar) = match tp.Kind with - | TyparKind.Type -> tp.AsType + | TyparKind.Type -> tp.AsType KnownWithoutNull | TyparKind.Measure -> TType_measure (Measure.Var tp) // For fresh type variables clear the StaticReq when copying because the requirement will be re-established through the // process of type inference. let copyTypar clearStaticReq (tp: Typar) = - let optData = tp.typar_opt_data |> Option.map (fun tg -> { typar_il_name = tg.typar_il_name; typar_xmldoc = tg.typar_xmldoc; typar_constraints = tg.typar_constraints; typar_attribs = tg.typar_attribs }) + let optData = tp.typar_opt_data |> Option.map (fun tg -> { typar_il_name = tg.typar_il_name; typar_xmldoc = tg.typar_xmldoc; typar_constraints = tg.typar_constraints; typar_attribs = tg.typar_attribs; typar_is_contravariant = tg.typar_is_contravariant }) let flags = if clearStaticReq then tp.typar_flags.WithStaticReq(TyparStaticReq.None) else tp.typar_flags Typar.New { typar_id = tp.typar_id typar_flags = flags @@ -227,9 +235,71 @@ let rec stripUnitEqnsAux canShortcut unt = | Measure.Var r when r.IsSolved -> stripUnitEqnsAux canShortcut (tryShortcutSolvedUnitPar canShortcut r) | _ -> unt -let rec stripTyparEqnsAux canShortcut ty = +let combineNullness (nullnessOrig: Nullness) (nullnessNew: Nullness) = + match nullnessOrig, nullnessNew with + | Nullness.Variable _, Nullness.Known NullnessInfo.WithoutNull -> + nullnessOrig + | _ -> + match nullnessOrig.Evaluate() with + | NullnessInfo.WithoutNull -> nullnessNew + | NullnessInfo.AmbivalentToNull -> + match nullnessNew.Evaluate() with + | NullnessInfo.WithoutNull -> nullnessOrig + | NullnessInfo.AmbivalentToNull -> nullnessOrig + | NullnessInfo.WithNull -> nullnessNew + | NullnessInfo.WithNull -> + match nullnessNew.Evaluate() with + | NullnessInfo.WithoutNull -> nullnessOrig + | NullnessInfo.AmbivalentToNull -> nullnessNew + | NullnessInfo.WithNull -> nullnessOrig + +let nullnessEquiv (nullnessOrig: Nullness) (nullnessNew: Nullness) = LanguagePrimitives.PhysicalEquality nullnessOrig nullnessNew + +let tryAddNullnessToTy nullnessNew (ty:TType) = + match ty with + | TType_var (tp, nullnessOrig) -> + let nullnessAfter = combineNullness nullnessOrig nullnessNew + if nullnessEquiv nullnessAfter nullnessOrig then + Some ty + else + Some (TType_var (tp, nullnessAfter)) + | TType_app (tcr, tinst, nullnessOrig) -> + let nullnessAfter = combineNullness nullnessOrig nullnessNew + if nullnessEquiv nullnessAfter nullnessOrig then + Some ty + else + Some (TType_app (tcr, tinst, nullnessAfter)) + | TType_ucase _ -> None + | TType_tuple _ -> None + | TType_anon _ -> None + | TType_fun (d, r, nullnessOrig) -> + let nullnessAfter = combineNullness nullnessOrig nullnessNew + if nullnessEquiv nullnessAfter nullnessOrig then + Some ty + else + Some (TType_fun (d, r, nullnessAfter)) + | TType_forall _ -> None + | TType_measure _ -> None + +let addNullnessToTy (nullness: Nullness) (ty:TType) = + match nullness with + | Nullness.Known NullnessInfo.WithoutNull -> ty + | Nullness.Variable nv when nv.IsSolved && nv.Evaluate() = NullnessInfo.WithoutNull -> ty + | _ -> + match ty with + | TType_var (tp, nullnessOrig) -> TType_var (tp, combineNullness nullnessOrig nullness) + | TType_app (tcr, tinst, nullnessOrig) -> + let tycon = tcr.Deref + if tycon.IsStructRecordOrUnionTycon || tycon.IsStructOrEnumTycon then + ty + else + TType_app (tcr, tinst, combineNullness nullnessOrig nullness) + | TType_fun (d, r, nullnessOrig) -> TType_fun (d, r, combineNullness nullnessOrig nullness) + | _ -> ty + +let rec stripTyparEqnsAux nullness0 canShortcut ty = match ty with - | TType_var (r, _) -> + | TType_var (r, nullness) -> match r.Solution with | Some soln -> if canShortcut then @@ -238,23 +308,33 @@ let rec stripTyparEqnsAux canShortcut ty = // This is only because IterType likes to walk _all_ the constraints _everywhere_ in a type, including // those attached to _solved_ type variables. In an ideal world this would never be needed - see the notes // on IterType. - | TType_var (r2, _) when r2.Constraints.IsEmpty -> - match r2.Solution with - | None -> () - | Some _ as soln2 -> - r.typar_solution <- soln2 + | TType_var (r2, nullness2) when r2.Constraints.IsEmpty -> + match nullness2.Evaluate() with + | NullnessInfo.WithoutNull -> + match r2.Solution with + | None -> () + | Some _ as soln2 -> + r.typar_solution <- soln2 + | _ -> () | _ -> () - stripTyparEqnsAux canShortcut soln + stripTyparEqnsAux (combineNullness nullness0 nullness) canShortcut soln | None -> - ty + addNullnessToTy nullness0 ty | TType_measure unt -> TType_measure (stripUnitEqnsAux canShortcut unt) - | _ -> ty + | _ -> addNullnessToTy nullness0 ty -let stripTyparEqns ty = stripTyparEqnsAux false ty +let stripTyparEqns ty = stripTyparEqnsAux KnownWithoutNull false ty let stripUnitEqns unt = stripUnitEqnsAux false unt +let replaceNullnessOfTy nullness (ty:TType) = + match stripTyparEqns ty with + | TType_var (tp, _) -> TType_var (tp, nullness) + | TType_app (tcr, tinst, _) -> TType_app (tcr, tinst, nullness) + | TType_fun (d, r, _) -> TType_fun (d, r, nullness) + | sty -> sty + /// Detect a use of a nominal type, including type abbreviations. [] let (|AbbrevOrAppTy|_|) (ty: TType) = diff --git a/src/Compiler/TypedTree/TypedTreeBasics.fsi b/src/Compiler/TypedTree/TypedTreeBasics.fsi index 001e4129d06..c064be67c9e 100644 --- a/src/Compiler/TypedTree/TypedTreeBasics.fsi +++ b/src/Compiler/TypedTree/TypedTreeBasics.fsi @@ -118,6 +118,20 @@ val ccuOfValRef: vref: ValRef -> CcuThunk option val ccuOfTyconRef: eref: EntityRef -> CcuThunk option +val NewNullnessVar: unit -> Nullness + +val KnownAmbivalentToNull: Nullness + +val KnownWithNull: Nullness + +val KnownWithoutNull: Nullness + +val combineNullness: Nullness -> Nullness -> Nullness + +val tryAddNullnessToTy: Nullness -> TType -> TType option + +val addNullnessToTy: Nullness -> TType -> TType + val mkTyparTy: tp: Typar -> TType val copyTypars: clearStaticReq: bool -> tps: Typar list -> Typar list @@ -126,7 +140,9 @@ val tryShortcutSolvedUnitPar: canShortcut: bool -> r: Typar -> Measure val stripUnitEqnsAux: canShortcut: bool -> unt: Measure -> Measure -val stripTyparEqnsAux: canShortcut: bool -> ty: TType -> TType +val stripTyparEqnsAux: nullness0: Nullness -> canShortcut: bool -> ty: TType -> TType + +val replaceNullnessOfTy: nullness: Nullness -> ty: TType -> TType val stripTyparEqns: ty: TType -> TType diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index 120baae8461..333b29cd78f 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -38,6 +38,19 @@ let AccFreeVarsStackGuardDepth = GetEnvInteger "FSHARP_AccFreeVars" 100 let RemapExprStackGuardDepth = GetEnvInteger "FSHARP_RemapExpr" 50 let FoldExprStackGuardDepth = GetEnvInteger "FSHARP_FoldExpr" 50 +let inline compareBy (x: 'T MaybeNull) (y: 'T MaybeNull) ([]func: 'T -> 'K) = +#if NO_CHECKNULLS + compare (func x) (func y) +#else + match x,y with + | null,null -> 0 + | null,_ -> -1 + | _,null -> 1 + | x,y -> compare (func !!x) (func !!y) +#endif + + + //--------------------------------------------------------------------------- // Basic data structures //--------------------------------------------------------------------------- @@ -166,8 +179,9 @@ let generalizeTypars tps = List.map generalizeTypar tps let rec remapTypeAux (tyenv: Remap) (ty: TType) = let ty = stripTyparEqns ty match ty with - | TType_var (tp, _) as ty -> - instTyparRef tyenv.tpinst ty tp + | TType_var (tp, nullness) as ty -> + let res = instTyparRef tyenv.tpinst ty tp + addNullnessToTy nullness res | TType_app (tcref, tinst, flags) as ty -> match tyenv.tyconRefRemap.TryFind tcref with @@ -257,6 +271,7 @@ and remapTyparConstraintsAux tyenv cs = | TyparConstraint.SupportsComparison _ | TyparConstraint.SupportsEquality _ | TyparConstraint.SupportsNull _ + | TyparConstraint.NotSupportsNull _ | TyparConstraint.IsUnmanaged _ | TyparConstraint.IsNonNullableStruct _ | TyparConstraint.IsReferenceType _ @@ -622,12 +637,12 @@ let mkByrefTyWithInference (g: TcGlobals) ty1 ty2 = else TType_app (g.byref_tcr, [ty1], g.knownWithoutNull) -let mkArrayTy (g: TcGlobals) rank ty m = +let mkArrayTy (g: TcGlobals) rank nullness ty m = if rank < 1 || rank > 32 then errorR(Error(FSComp.SR.tastopsMaxArrayThirtyTwo rank, m)) - TType_app (g.il_arr_tcr_map[3], [ty], g.knownWithoutNull) + TType_app (g.il_arr_tcr_map[3], [ty], nullness) else - TType_app (g.il_arr_tcr_map[rank - 1], [ty], g.knownWithoutNull) + TType_app (g.il_arr_tcr_map[rank - 1], [ty], nullness) //-------------------------------------------------------------------------- // Tuple compilation (types) @@ -718,7 +733,7 @@ let reduceTyconMeasureableOrProvided (g: TcGlobals) (tycon: Tycon) tyargs = | TMeasureableRepr ty -> if isNil tyargs then ty else instType (mkTyconInst tycon tyargs) ty #if !NO_TYPEPROVIDERS - | TProvidedTypeRepr info when info.IsErased -> info.BaseTypeForErased (range0, g.obj_ty) + | TProvidedTypeRepr info when info.IsErased -> info.BaseTypeForErased (range0, g.obj_ty_withNulls) #endif | _ -> invalidArg "tc" "this type definition is not a refinement" @@ -726,13 +741,15 @@ let reduceTyconRefMeasureableOrProvided (g: TcGlobals) (tcref: TyconRef) tyargs reduceTyconMeasureableOrProvided g tcref.Deref tyargs let rec stripTyEqnsA g canShortcut ty = - let ty = stripTyparEqnsAux canShortcut ty + let ty = stripTyparEqnsAux KnownWithoutNull canShortcut ty match ty with - | TType_app (tcref, tinst, _) -> + | TType_app (tcref, tinst, nullness) -> let tycon = tcref.Deref match tycon.TypeAbbrev with | Some abbrevTy -> - stripTyEqnsA g canShortcut (applyTyconAbbrev abbrevTy tycon tinst) + let reducedTy = applyTyconAbbrev abbrevTy tycon tinst + let reducedTy2 = addNullnessToTy nullness reducedTy + stripTyEqnsA g canShortcut reducedTy2 | None -> // This is the point where we get to add additional conditional normalizing equations // into the type system. Such power! @@ -744,7 +761,9 @@ let rec stripTyEqnsA g canShortcut ty = // Add the equation double<1> = double for units of measure. elif tycon.IsMeasureableReprTycon && List.forall (isDimensionless g) tinst then - stripTyEqnsA g canShortcut (reduceTyconMeasureableOrProvided g tycon tinst) + let reducedTy = reduceTyconMeasureableOrProvided g tycon tinst + let reducedTy2 = addNullnessToTy nullness reducedTy + stripTyEqnsA g canShortcut reducedTy2 else ty | ty -> ty @@ -759,23 +778,25 @@ let evalAnonInfoIsStruct (anonInfo: AnonRecdTypeInfo) = evalTupInfoIsStruct anonInfo.TupInfo /// This erases outermost occurrences of inference equations, type abbreviations, non-generated provided types -/// and measureable types (float<_>). +/// and measurable types (float<_>). /// It also optionally erases all "compilation representations", i.e. function and /// tuple types, and also "nativeptr<'T> --> System.IntPtr" let rec stripTyEqnsAndErase eraseFuncAndTuple (g: TcGlobals) ty = let ty = stripTyEqns g ty match ty with - | TType_app (tcref, args, _) -> + | TType_app (tcref, args, nullness) -> let tycon = tcref.Deref - if tycon.IsErased then - stripTyEqnsAndErase eraseFuncAndTuple g (reduceTyconMeasureableOrProvided g tycon args) + if tycon.IsErased then + let reducedTy = reduceTyconMeasureableOrProvided g tycon args + let reducedTy2 = addNullnessToTy nullness reducedTy + stripTyEqnsAndErase eraseFuncAndTuple g reducedTy2 elif tyconRefEq g tcref g.nativeptr_tcr && eraseFuncAndTuple then stripTyEqnsAndErase eraseFuncAndTuple g g.nativeint_ty else ty - | TType_fun(domainTy, rangeTy, flags) when eraseFuncAndTuple -> - TType_app(g.fastFunc_tcr, [ domainTy; rangeTy ], flags) + | TType_fun(domainTy, rangeTy, nullness) when eraseFuncAndTuple -> + TType_app(g.fastFunc_tcr, [ domainTy; rangeTy ], nullness) | TType_tuple(tupInfo, l) when eraseFuncAndTuple -> mkCompiledTupleTy g (evalTupInfoIsStruct tupInfo) l @@ -855,7 +876,7 @@ let isMeasureTy g ty = ty |> stripTyEqns g |> (function TType_measure _ -> true let isProvenUnionCaseTy ty = match ty with TType_ucase _ -> true | _ -> false -let mkAppTy tcref tyargs = TType_app(tcref, tyargs, 0uy) +let mkWoNullAppTy tcref tyargs = TType_app(tcref, tyargs, KnownWithoutNull) let mkProvenUnionCaseTy ucref tyargs = TType_ucase(ucref, tyargs) @@ -891,14 +912,14 @@ let (|RefTupleTy|_|) g ty = ty |> stripTyEqns g |> (function TType_tuple(tupInfo let (|FunTy|_|) g ty = ty |> stripTyEqns g |> (function TType_fun(domainTy, rangeTy, _) -> ValueSome (domainTy, rangeTy) | _ -> ValueNone) let tryNiceEntityRefOfTy ty = - let ty = stripTyparEqnsAux false ty + let ty = stripTyparEqnsAux KnownWithoutNull false ty match ty with | TType_app (tcref, _, _) -> ValueSome tcref | TType_measure (Measure.Const tcref) -> ValueSome tcref | _ -> ValueNone let tryNiceEntityRefOfTyOption ty = - let ty = stripTyparEqnsAux false ty + let ty = stripTyparEqnsAux KnownWithoutNull false ty match ty with | TType_app (tcref, _, _) -> Some tcref | TType_measure (Measure.Const tcref) -> Some tcref @@ -918,7 +939,7 @@ let convertToTypeWithMetadataIfPossible g ty = mkOuterCompiledTupleTy g (evalTupInfoIsStruct tupInfo) tupElemTys elif isFunTy g ty then let a,b = destFunTy g ty - mkAppTy g.fastFunc_tcr [a; b] + mkWoNullAppTy g.fastFunc_tcr [a; b] else ty //--------------------------------------------------------------------------- @@ -927,9 +948,9 @@ let convertToTypeWithMetadataIfPossible g ty = let stripMeasuresFromTy g ty = match ty with - | TType_app(tcref, tinst, flags) -> + | TType_app(tcref, tinst, nullness) -> let tinstR = tinst |> List.filter (isMeasureTy g >> not) - TType_app(tcref, tinstR, flags) + TType_app(tcref, tinstR, nullness) | _ -> ty //--------------------------------------------------------------------------- @@ -1014,6 +1035,7 @@ and typarConstraintsAEquivAux erasureFlag g aenv tpc1 tpc2 = | TyparConstraint.SupportsComparison _, TyparConstraint.SupportsComparison _ | TyparConstraint.SupportsEquality _, TyparConstraint.SupportsEquality _ | TyparConstraint.SupportsNull _, TyparConstraint.SupportsNull _ + | TyparConstraint.NotSupportsNull _, TyparConstraint.NotSupportsNull _ | TyparConstraint.IsNonNullableStruct _, TyparConstraint.IsNonNullableStruct _ | TyparConstraint.IsReferenceType _, TyparConstraint.IsReferenceType _ | TyparConstraint.IsUnmanaged _, TyparConstraint.IsUnmanaged _ @@ -1040,7 +1062,7 @@ and typeAEquivAux erasureFlag g aenv ty1 ty2 = | TType_forall(tps1, rty1), TType_forall(tps2, retTy2) -> typarsAEquivAux erasureFlag g aenv tps1 tps2 && typeAEquivAux erasureFlag g (aenv.BindEquivTypars tps1 tps2) rty1 retTy2 - | TType_var (tp1, _), TType_var (tp2, _) when typarEq tp1 tp2 -> + | TType_var (tp1, _), TType_var (tp2, _) when typarEq tp1 tp2 -> // NOTE: nullness annotations are ignored for type equivalence true | TType_var (tp1, _), _ -> @@ -1048,7 +1070,8 @@ and typeAEquivAux erasureFlag g aenv ty1 ty2 = | Some tpTy1 -> typeEquivAux erasureFlag g tpTy1 ty2 | None -> false - | TType_app (tcref1, tinst1, _), TType_app (tcref2, tinst2, _) -> + // NOTE: nullness annotations are ignored for type equivalence + | TType_app (tcref1, tinst1, _), TType_app (tcref2, tinst2, _) -> tcrefAEquiv g aenv tcref1 tcref2 && typesAEquivAux erasureFlag g aenv tinst1 tinst2 @@ -1060,13 +1083,14 @@ and typeAEquivAux erasureFlag g aenv ty1 ty2 = | TType_tuple (tupInfo1, l1), TType_tuple (tupInfo2, l2) -> structnessAEquiv tupInfo1 tupInfo2 && typesAEquivAux erasureFlag g aenv l1 l2 + // NOTE: nullness annotations are ignored for type equivalence + | TType_fun (domainTy1, rangeTy1, _), TType_fun (domainTy2, rangeTy2, _) -> + typeAEquivAux erasureFlag g aenv domainTy1 domainTy2 && typeAEquivAux erasureFlag g aenv rangeTy1 rangeTy2 + | TType_anon (anonInfo1, l1), TType_anon (anonInfo2, l2) -> anonInfoEquiv anonInfo1 anonInfo2 && typesAEquivAux erasureFlag g aenv l1 l2 - | TType_fun (domainTy1, rangeTy1, _), TType_fun (domainTy2, rangeTy2, _) -> - typeAEquivAux erasureFlag g aenv domainTy1 domainTy2 && typeAEquivAux erasureFlag g aenv rangeTy1 rangeTy2 - | TType_measure m1, TType_measure m2 -> match erasureFlag with | EraseNone -> measureAEquiv g aenv m1 m2 @@ -1074,6 +1098,18 @@ and typeAEquivAux erasureFlag g aenv ty1 ty2 = | _ -> false +and nullnessSensitivetypeAEquivAux erasureFlag g aenv ty1 ty2 = + let ty1 = stripTyEqnsWrtErasure erasureFlag g ty1 + let ty2 = stripTyEqnsWrtErasure erasureFlag g ty2 + match ty1, ty2 with + | TType_var (_,n1), TType_var (_,n2) + | TType_app (_,_,n1), TType_app (_,_,n2) + | TType_fun (_,_,n1), TType_fun (_,_,n2) -> + n1 === n2 + | _ -> true + + && typeAEquivAux erasureFlag g aenv ty1 ty2 + and anonInfoEquiv (anonInfo1: AnonRecdTypeInfo) (anonInfo2: AnonRecdTypeInfo) = ccuEq anonInfo1.Assembly anonInfo2.Assembly && structnessAEquiv anonInfo1.TupInfo anonInfo2.TupInfo && @@ -1133,18 +1169,30 @@ let isErasedType g ty = | _ -> false // Return all components of this type expression that cannot be tested at runtime -let rec getErasedTypes g ty = +let rec getErasedTypes g ty checkForNullness = let ty = stripTyEqns g ty if isErasedType g ty then [ty] else match ty with | TType_forall(_, bodyTy) -> - getErasedTypes g bodyTy - | TType_var (tp, _) -> - if tp.IsErased then [ty] else [] - | TType_app (_, b, _) | TType_ucase(_, b) | TType_anon (_, b) | TType_tuple (_, b) -> - List.foldBack (fun ty tys -> getErasedTypes g ty @ tys) b [] - | TType_fun (domainTy, rangeTy, _) -> - getErasedTypes g domainTy @ getErasedTypes g rangeTy + getErasedTypes g bodyTy checkForNullness + + | TType_var (tp, nullness) -> + match checkForNullness, nullness.Evaluate() with + | true, NullnessInfo.WithNull -> [ty] // with-null annotations can't be tested at runtime, Nullable<> is not part of Nullness feature as of now. + | _ -> if tp.IsErased then [ty] else [] + + | TType_app (_, b, nullness) -> + match checkForNullness, nullness.Evaluate() with + | true, NullnessInfo.WithNull -> [ty] + | _ -> List.foldBack (fun ty tys -> getErasedTypes g ty false @ tys) b [] + + | TType_ucase(_, b) | TType_anon (_, b) | TType_tuple (_, b) -> + List.foldBack (fun ty tys -> getErasedTypes g ty false @ tys) b [] + + | TType_fun (domainTy, rangeTy, nullness) -> + match checkForNullness, nullness.Evaluate() with + | true, NullnessInfo.WithNull -> [ty] + | _ -> getErasedTypes g domainTy false @ getErasedTypes g rangeTy false | TType_measure _ -> [ty] @@ -1152,9 +1200,9 @@ let rec getErasedTypes g ty = // Standard orderings, e.g. for order set/map keys //--------------------------------------------------------------------------- -let valOrder = { new IComparer with member _.Compare(v1, v2) = compare v1.Stamp v2.Stamp } +let valOrder = { new IComparer with member _.Compare(v1, v2) = compareBy v1 v2 _.Stamp } -let tyconOrder = { new IComparer with member _.Compare(tycon1, tycon2) = compare tycon1.Stamp tycon2.Stamp } +let tyconOrder = { new IComparer with member _.Compare(tycon1, tycon2) = compareBy tycon1 tycon2 _.Stamp } let recdFieldRefOrder = { new IComparer with @@ -1236,11 +1284,14 @@ let rec stripDebugPoints expr = | Expr.DebugPoint (_, innerExpr) -> stripDebugPoints innerExpr | expr -> expr -// Strip debug points and remember how to recrete them +// Strip debug points and remember how to recreate them let (|DebugPoints|) expr = - match stripExpr expr with - | Expr.DebugPoint (dp, innerExpr) -> innerExpr, (fun e -> Expr.DebugPoint(dp, e)) - | expr -> expr, id + let rec loop expr debug = + match stripExpr expr with + | Expr.DebugPoint (dp, innerExpr) -> loop innerExpr (debug << fun e -> Expr.DebugPoint (dp, e)) + | expr -> expr, debug + + loop expr id let mkCase (a, b) = TCase(a, b) @@ -1823,6 +1874,7 @@ let isInByrefTy g ty = | _ -> false) let isOutByrefTag g ty = ty |> stripTyEqns g |> (function TType_app(tcref, [], _) -> tyconRefEq g g.byrefkind_Out_tcr tcref | _ -> false) + let isOutByrefTy g ty = ty |> stripTyEqns g |> (function | TType_app(tcref, [_; tagTy], _) when g.byref2_tcr.CanDeref -> tyconRefEq g g.byref2_tcr tcref && isOutByrefTag g tagTy @@ -2129,7 +2181,7 @@ let unionFreeTycons s1 s2 = let typarOrder = { new IComparer with - member x.Compare (v1: Typar, v2: Typar) = compare v1.Stamp v2.Stamp } + member x.Compare (v1: Typar, v2: Typar) = compareBy v1 v2 _.Stamp } let emptyFreeTypars = Zset.empty typarOrder let unionFreeTypars s1 s2 = @@ -2289,6 +2341,7 @@ and accFreeInTyparConstraint opts tpc acc = | TyparConstraint.SupportsComparison _ | TyparConstraint.SupportsEquality _ | TyparConstraint.SupportsNull _ + | TyparConstraint.NotSupportsNull _ | TyparConstraint.IsNonNullableStruct _ | TyparConstraint.IsReferenceType _ | TyparConstraint.IsUnmanaged _ @@ -2424,6 +2477,7 @@ and accFreeInTyparConstraintLeftToRight g cxFlag thruFlag acc tpc = | TyparConstraint.SupportsComparison _ | TyparConstraint.SupportsEquality _ | TyparConstraint.SupportsNull _ + | TyparConstraint.NotSupportsNull _ | TyparConstraint.IsNonNullableStruct _ | TyparConstraint.IsUnmanaged _ | TyparConstraint.IsReferenceType _ @@ -2472,7 +2526,7 @@ and accFreeInTypeLeftToRight g cxFlag thruFlag acc ty = let racc = accFreeInTypeLeftToRight g cxFlag thruFlag emptyFreeTyparsLeftToRight r unionFreeTyparsLeftToRight (boundTyparsLeftToRight g cxFlag thruFlag tps racc) acc - | TType_measure unt -> + | TType_measure unt -> let mvars = ListMeasureVarOccsWithNonZeroExponents unt List.foldBack (fun (tp, _) acc -> accFreeTyparRefLeftToRight g cxFlag thruFlag acc tp) mvars acc @@ -2810,7 +2864,10 @@ let generalizedTyconRef (g: TcGlobals) tcref = let tinst = generalTyconRefInst tcref TType_app(tcref, tinst, g.knownWithoutNull) -let isTTyparCoercesToType = function TyparConstraint.CoercesTo _ -> true | _ -> false +let isTTyparCoercesToType tpc = + match tpc with + | TyparConstraint.CoercesTo _ -> true + | _ -> false //-------------------------------------------------------------------------- // Print Signatures/Types - prelude @@ -2948,7 +3005,7 @@ module PrettyTypes = // Hence we double check here that the thing is really a type variable let safeDestAnyParTy orig g ty = match tryAnyParTy g ty with ValueNone -> orig | ValueSome x -> x - let foldUnurriedArgInfos f z (x: UncurriedArgInfos) = List.fold (fold1Of2 f) z x + let foldUncurriedArgInfos f z (x: UncurriedArgInfos) = List.fold (fold1Of2 f) z x let foldTypar f z (x: Typar) = foldOn mkTyparTy f z x let mapTypar g f (x: Typar) : Typar = (mkTyparTy >> f >> safeDestAnyParTy x g) x @@ -2966,7 +3023,7 @@ module PrettyTypes = let PrettifyInstAndUncurriedSig g (x: TyparInstantiation * UncurriedArgInfos * TType) = PrettifyThings g - (fun f -> foldTriple (foldTyparInst f, foldUnurriedArgInfos f, f)) + (fun f -> foldTriple (foldTyparInst f, foldUncurriedArgInfos f, f)) (fun f -> mapTriple (mapTyparInst g f, List.map (map1Of2 f), f)) x @@ -3101,8 +3158,10 @@ type DisplayEnv = shortConstraints: bool useColonForReturnType: bool showAttributes: bool + showCsharpCodeAnalysisAttributes: bool showOverrides: bool showStaticallyResolvedTyparAnnotations: bool + showNullnessAnnotations: bool option abbreviateAdditionalConstraints: bool showTyparDefaultConstraints: bool showDocumentation: bool @@ -3135,8 +3194,10 @@ type DisplayEnv = suppressMutableKeyword = false showMemberContainers = false showAttributes = false + showCsharpCodeAnalysisAttributes = false showOverrides = true showStaticallyResolvedTyparAnnotations = true + showNullnessAnnotations = None showDocumentation = false abbreviateAdditionalConstraints = false showTyparDefaultConstraints = false @@ -3182,7 +3243,7 @@ type DisplayEnv = ControlPath (splitNamespace ExtraTopLevelOperatorsName) ] -let (+.+) s1 s2 = if String.IsNullOrEmpty(s1) then s2 else s1+"."+s2 +let (+.+) s1 s2 = if String.IsNullOrEmpty(s1) then s2 else !!s1+"."+s2 let layoutOfPath p = sepListL SepL.dot (List.map (tagNamespace >> wordL) p) @@ -3387,7 +3448,7 @@ let trimPathByDisplayEnv denv path = let superOfTycon (g: TcGlobals) (tycon: Tycon) = match tycon.TypeContents.tcaug_super with - | None -> g.obj_ty + | None -> g.obj_ty_noNulls | Some ty -> ty /// walk a TyconRef's inheritance tree, yielding any parent types as an array @@ -3466,6 +3527,19 @@ let TryFindFSharpStringAttribute g nm attrs = match TryFindFSharpAttribute g nm attrs with | Some(Attrib(_, _, [ AttribStringArg b ], _, _, _, _)) -> Some b | _ -> None + +let TryFindLocalizedFSharpStringAttribute g nm attrs = + match TryFindFSharpAttribute g nm attrs with + | Some(Attrib(_, _, [ AttribStringArg b ], namedArgs, _, _, _)) -> + match namedArgs with + | ExtractAttribNamedArg "Localize" (AttribBoolArg true) -> + #if PROTO || BUILDING_WITH_LKG + Some b + #else + FSComp.SR.GetTextOpt(b) + #endif + | _ -> Some b + | _ -> None let TryFindILAttribute (AttribInfo (atref, _)) attrs = HasILAttribute atref attrs @@ -3475,6 +3549,9 @@ let TryFindILAttributeOpt attr attrs = | Some (AttribInfo (atref, _)) -> HasILAttribute atref attrs | _ -> false +let IsILAttrib (AttribInfo (builtInAttrRef, _)) attr = isILAttrib builtInAttrRef attr + + /// Analyze three cases for attributes declared on type definitions: IL-declared attributes, F#-declared attributes and /// provided attributes. // @@ -4005,32 +4082,44 @@ module DebugPrint = else tupleL tinstL ^^ tcL + and auxAddNullness coreL (nullness: Nullness) = + match nullness.Evaluate() with + | NullnessInfo.WithNull -> coreL ^^ wordL (tagText "?") + | NullnessInfo.WithoutNull -> coreL + | NullnessInfo.AmbivalentToNull -> coreL //^^ wordL (tagText "%") + and auxTypeWrapL env isAtomic ty = let wrap x = bracketIfL isAtomic x in // wrap iff require atomic expr match stripTyparEqns ty with | TType_forall (typars, bodyTy) -> (leftL (tagText "!") ^^ layoutTyparDecls typars --- auxTypeL env bodyTy) |> wrap - | TType_ucase (UnionCaseRef(tcref, _), tinst) - - | TType_app (tcref, tinst, _) -> + | TType_ucase (UnionCaseRef(tcref, _), tinst) -> let prefix = tcref.IsPrefixDisplay let tcL = layoutTyconRef tcref auxTyparsL env tcL prefix tinst + | TType_app (tcref, tinst, nullness) -> + let prefix = tcref.IsPrefixDisplay + let tcL = layoutTyconRef tcref + let coreL = auxTyparsL env tcL prefix tinst + auxAddNullness coreL nullness + | TType_tuple (_tupInfo, tys) -> sepListL (wordL (tagText "*")) (List.map (auxTypeAtomL env) tys) |> wrap - | TType_fun (domainTy, rangeTy, _) -> - ((auxTypeAtomL env domainTy ^^ wordL (tagText "->")) --- auxTypeL env rangeTy) |> wrap + | TType_fun (domainTy, rangeTy, nullness) -> + let coreL = ((auxTypeAtomL env domainTy ^^ wordL (tagText "->")) --- auxTypeL env rangeTy) |> wrap + auxAddNullness coreL nullness - | TType_var (typar, _) -> - auxTyparWrapL env isAtomic typar + | TType_var (typar, nullness) -> + let coreL = auxTyparWrapL env isAtomic typar + auxAddNullness coreL nullness | TType_anon (anonInfo, tys) -> - braceBarL (sepListL (wordL (tagText ";")) (List.map2 (fun nm ty -> wordL (tagField nm) --- auxTypeAtomL env ty) (Array.toList anonInfo.SortedNames) tys)) + braceBarL (sepListL (wordL (tagText ";")) (List.map2 (fun nm ty -> wordL (tagField nm) --- auxTypeAtomL env ty) (Array.toList anonInfo.SortedNames) tys)) - | TType_measure unt -> + | TType_measure unt -> #if DEBUG leftL (tagText "{") ^^ (match global_g with @@ -4130,6 +4219,8 @@ module DebugPrint = wordL (tagText "struct") |> constraintPrefix | TyparConstraint.IsReferenceType _ -> wordL (tagText "not struct") |> constraintPrefix + | TyparConstraint.NotSupportsNull _ -> + wordL (tagText "not null") |> constraintPrefix | TyparConstraint.IsUnmanaged _ -> wordL (tagText "unmanaged") |> constraintPrefix | TyparConstraint.SimpleChoice(tys, _) -> @@ -6153,12 +6244,12 @@ and remapTyconRepr ctxt tmenv repr = | TProvidedTypeRepr info -> TProvidedTypeRepr { info with - LazyBaseType = info.LazyBaseType.Force (range0, ctxt.g.obj_ty) |> remapType tmenv |> LazyWithContext.NotLazy + LazyBaseType = info.LazyBaseType.Force (range0, ctxt.g.obj_ty_withNulls) |> remapType tmenv |> LazyWithContext.NotLazy // The load context for the provided type contains TyconRef objects. We must remap these. // This is actually done on-demand (see the implementation of ProvidedTypeContext) ProvidedType = info.ProvidedType.PApplyNoFailure (fun st -> - let ctxt = st.Context.RemapTyconRefs(unbox >> remapTyconRef tmenv.tyconRefRemap >> box) + let ctxt = st.Context.RemapTyconRefs(unbox >> remapTyconRef tmenv.tyconRefRemap >> box >> (!!)) ProvidedType.ApplyContext (st, ctxt)) } #endif | TNoRepr -> repr @@ -6440,7 +6531,7 @@ let rec remarkExpr (m: range) x = // This code allows a feature where if a 'while'/'for' etc in a computation expression is // implemented using code inlining and is ultimately implemented by a corresponding construct somewhere - // in the remark'd code then aat least one debug point is recovered, based on the noted debug point for the original construct. + // in the remark'd code then at least one debug point is recovered, based on the noted debug point for the original construct. // // However it is imperfect, since only one debug point is recovered let op = @@ -6630,7 +6721,7 @@ let rec tyOfExpr g expr = | TOp.ILCall (_, _, _, _, _, _, _, _, _, _, retTypes) | TOp.ILAsm (_, retTypes) -> (match retTypes with [h] -> h | _ -> g.unit_ty) | TOp.UnionCase uc -> actualResultTyOfUnionCase tinst uc | TOp.UnionCaseProof uc -> mkProvenUnionCaseTy uc tinst - | TOp.Recd (_, tcref) -> mkAppTy tcref tinst + | TOp.Recd (_, tcref) -> mkWoNullAppTy tcref tinst | TOp.ExnConstr _ -> g.exn_ty | TOp.Bytes _ -> mkByteArrayTy g | TOp.UInt16s _ -> mkArrayType g g.uint16_ty @@ -7620,7 +7711,7 @@ let permuteExprList (sigma: int[]) (exprs: Expr list) (ty: TType list) (names: s /// We still need to sort by index. let mkRecordExpr g (lnk, tcref, tinst, unsortedRecdFields: RecdFieldRef list, unsortedFieldExprs, m) = // Remove any abbreviations - let tcref, tinst = destAppTy g (mkAppTy tcref tinst) + let tcref, tinst = destAppTy g (mkWoNullAppTy tcref tinst) let sortedRecdFields = unsortedRecdFields |> List.indexed |> Array.ofList |> Array.sortBy (fun (_, r) -> r.Index) let sigma = Array.create sortedRecdFields.Length -1 @@ -7847,8 +7938,6 @@ let mkCallArrayLength (g: TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g let mkCallArrayGet (g: TcGlobals) m ty e1 idx1 = mkApps g (typedExprForIntrinsic g m g.array_get_info, [[ty]], [ e1 ; idx1 ], m) -let mkCallArrayMap (g: TcGlobals) m ty1 ty2 e1 e2 = mkApps g (typedExprForIntrinsic g m g.array_map_info, [[ty1; ty2]], [ e1 ; e2 ], m) - let mkCallArray2DGet (g: TcGlobals) m ty e1 idx1 idx2 = mkApps g (typedExprForIntrinsic g m g.array2D_get_info, [[ty]], [ e1 ; idx1; idx2 ], m) let mkCallArray3DGet (g: TcGlobals) m ty e1 idx1 idx2 idx3 = mkApps g (typedExprForIntrinsic g m g.array3D_get_info, [[ty]], [ e1 ; idx1; idx2; idx3 ], m) @@ -7863,8 +7952,6 @@ let mkCallArray3DSet (g: TcGlobals) m ty e1 idx1 idx2 idx3 v = mkApps g (typedEx let mkCallArray4DSet (g: TcGlobals) m ty e1 idx1 idx2 idx3 idx4 v = mkApps g (typedExprForIntrinsic g m g.array4D_set_info, [[ty]], [ e1 ; idx1; idx2; idx3; idx4; v ], m) -let mkCallListMap (g: TcGlobals) m ty1 ty2 e1 e2 = mkApps g (typedExprForIntrinsic g m g.list_map_info, [[ty1; ty2]], [ e1 ; e2 ], m) - let mkCallHash (g: TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.hash_info, [[ty]], [ e1 ], m) let mkCallBox (g: TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.box_info, [[ty]], [ e1 ], m) @@ -7909,9 +7996,9 @@ let TryEliminateDesugaredConstants g m c = | _ -> None -let mkSeqTy (g: TcGlobals) ty = mkAppTy g.seq_tcr [ty] +let mkSeqTy (g: TcGlobals) ty = mkWoNullAppTy g.seq_tcr [ty] -let mkIEnumeratorTy (g: TcGlobals) ty = mkAppTy g.tcref_System_Collections_Generic_IEnumerator [ty] +let mkIEnumeratorTy (g: TcGlobals) ty = mkWoNullAppTy g.tcref_System_Collections_Generic_IEnumerator [ty] let mkCallSeqCollect g m alphaTy betaTy arg1 arg2 = let enumty2 = try rangeOfFunTy g (tyOfExpr g arg1) with _ -> (* defensive programming *) (mkSeqTy g betaTy) @@ -8136,12 +8223,12 @@ let mkCompilationMappingAttrForQuotationResource (g: TcGlobals) (nm, tys: ILType #if !NO_TYPEPROVIDERS let isTypeProviderAssemblyAttr (cattr: ILAttribute) = - cattr.Method.DeclaringType.BasicQualifiedName = typeof.FullName + cattr.Method.DeclaringType.BasicQualifiedName = !! typeof.FullName let TryDecodeTypeProviderAssemblyAttr (cattr: ILAttribute) : string MaybeNull option = if isTypeProviderAssemblyAttr cattr then - let parms, _args = decodeILAttribData cattr - match parms with // The first parameter to the attribute is the name of the assembly with the compiler extensions. + let params_, _args = decodeILAttribData cattr + match params_ with // The first parameter to the attribute is the name of the assembly with the compiler extensions. | ILAttribElem.String (Some assemblyName) :: _ -> Some assemblyName | ILAttribElem.String None :: _ -> Some null | [] -> Some null @@ -8839,7 +8926,7 @@ let typarEnc _g (gtpsType, gtpsMethod) typar = warning(InternalError("Typar not found during XmlDoc generation", typar.Range)) "``0" -let rec typeEnc g (gtpsType, gtpsMethod) ty = +let rec typeEnc g (gtpsType, gtpsMethod) ty = let stripped = stripTyEqnsAndMeasureEqns g ty match stripped with | TType_forall _ -> @@ -8853,8 +8940,8 @@ let rec typeEnc g (gtpsType, gtpsMethod) ty = let ety = destNativePtrTy g ty typeEnc g (gtpsType, gtpsMethod) ety + "*" - | _ when isArrayTy g ty -> - let tcref, tinst = destAppTy g ty + | TType_app (_, _, _nullness) when isArrayTy g ty -> + let tcref, tinst = destAppTy g ty let rank = rankOfArrayTyconRef g tcref let arraySuffix = "[" + String.concat ", " (List.replicate (rank-1) "0:") + "]" typeEnc g (gtpsType, gtpsMethod) (List.head tinst) + arraySuffix @@ -8864,7 +8951,7 @@ let rec typeEnc g (gtpsType, gtpsMethod) ty = let tyName = let ty = stripTyEqnsAndMeasureEqns g ty match ty with - | TType_app (tcref, _tinst, _) -> + | TType_app (tcref, _tinst, _nullness) -> // Generic type names are (name + "`" + digits) where name does not contain "`". // In XML doc, when used in type instances, these do not use the ticks. let path = Array.toList (fullMangledPathToTyconRef tcref) @ [tcref.CompiledName] @@ -8883,10 +8970,10 @@ let rec typeEnc g (gtpsType, gtpsMethod) ty = else sprintf "System.Tuple%s"(tyargsEnc g (gtpsType, gtpsMethod) tys) - | TType_fun (domainTy, rangeTy, _) -> + | TType_fun (domainTy, rangeTy, _nullness) -> "Microsoft.FSharp.Core.FSharpFunc" + tyargsEnc g (gtpsType, gtpsMethod) [domainTy; rangeTy] - | TType_var (typar, _) -> + | TType_var (typar, _nullness) -> typarEnc g (gtpsType, gtpsMethod) typar | TType_measure _ -> "?" @@ -8899,7 +8986,7 @@ and tyargsEnc g (gtpsType, gtpsMethod) args = let XmlDocArgsEnc g (gtpsType, gtpsMethod) argTys = if isNil argTys then "" - else "(" + String.concat "," (List.map (typeEnc g (gtpsType, gtpsMethod)) argTys) + ")" + else "(" + String.concat "," (List.map (typeEnc g (gtpsType, gtpsMethod)) argTys) + ")" let buildAccessPath (cp: CompilationPath option) = match cp with @@ -8908,7 +8995,7 @@ let buildAccessPath (cp: CompilationPath option) = System.String.Join(".", ap) | None -> "Extension Type" -let prependPath path name = if String.IsNullOrEmpty(path) then name else path + "." + name +let prependPath path name = if String.IsNullOrEmpty(path) then name else !!path + "." + name let XmlDocSigOfVal g full path (v: Val) = let parentTypars, methTypars, cxs, argInfos, retTy, prefix, path, name = @@ -9023,64 +9110,134 @@ let isNonNullableStructTyparTy g ty = | ValueNone -> false -// Note, isRefTy does not include type parameters with the ': not struct' constraint +// Note, isRefTy does not include type parameters with the ': not struct' or ': null' constraints // This predicate is used to detect those type parameters. let isReferenceTyparTy g ty = match tryDestTyparTy g ty with | ValueSome tp -> - tp.Constraints |> List.exists (function TyparConstraint.IsReferenceType _ -> true | _ -> false) + tp.Constraints |> List.exists (function + | TyparConstraint.IsReferenceType _ -> true + | TyparConstraint.SupportsNull _ -> true + | _ -> false) | ValueNone -> false +let isSupportsNullTyparTy g ty = + if isReferenceTyparTy g ty then + (destTyparTy g ty).Constraints |> List.exists (function TyparConstraint.SupportsNull _ -> true | _ -> false) + else + false + let TypeNullNever g ty = let underlyingTy = stripTyEqnsAndMeasureEqns g ty isStructTy g underlyingTy || isByrefTy g underlyingTy || isNonNullableStructTyparTy g ty -/// Indicates if the type admits the use of 'null' as a value +/// The pre-nullness logic about whether a type admits the use of 'null' as a value. let TypeNullIsExtraValue g m ty = if isILReferenceTy g ty || isDelegateTy g ty then - // Putting AllowNullLiteralAttribute(false) on an IL or provided type means 'null' can't be used with that type - not (match tryTcrefOfAppTy g ty with ValueSome tcref -> TryFindTyconRefBoolAttribute g m g.attrib_AllowNullLiteralAttribute tcref = Some false | _ -> false) + match tryTcrefOfAppTy g ty with + | ValueSome tcref -> + // Putting AllowNullLiteralAttribute(false) on an IL or provided + // type means 'null' can't be used with that type, otherwise it can + TryFindTyconRefBoolAttribute g m g.attrib_AllowNullLiteralAttribute tcref <> Some false + | _ -> + // In pre-nullness, other IL reference types (e.g. arrays) always support null + true elif TypeNullNever g ty then false else - // Putting AllowNullLiteralAttribute(true) on an F# type means 'null' can be used with that type + // In F# 4.x, putting AllowNullLiteralAttribute(true) on an F# type means 'null' can be used with that type match tryTcrefOfAppTy g ty with | ValueSome tcref -> TryFindTyconRefBoolAttribute g m g.attrib_AllowNullLiteralAttribute tcref = Some true | ValueNone -> // Consider type parameters - if isReferenceTyparTy g ty then - (destTyparTy g ty).Constraints |> List.exists (function TyparConstraint.SupportsNull _ -> true | _ -> false) - else - false - + isSupportsNullTyparTy g ty + +// Any mention of a type with AllowNullLiteral(true) is considered to be with-null +let intrinsicNullnessOfTyconRef g (tcref: TyconRef) = + match TryFindTyconRefBoolAttribute g tcref.Range g.attrib_AllowNullLiteralAttribute tcref with + | Some true -> g.knownWithNull + | _ -> g.knownWithoutNull + +let nullnessOfTy g ty = + ty + |> stripTyEqns g + |> function + | TType_app(tcref, _, nullness) -> + let nullness2 = intrinsicNullnessOfTyconRef g tcref + if nullness2 === g.knownWithoutNull then + nullness + else + combineNullness nullness nullness2 + | TType_fun (_, _, nullness) | TType_var (_, nullness) -> + nullness + | _ -> g.knownWithoutNull + +let changeWithNullReqTyToVariable g reqTy = + let sty = stripTyEqns g reqTy + match isTyparTy g sty with + | false -> + match nullnessOfTy g sty with + | Nullness.Known NullnessInfo.AmbivalentToNull + | Nullness.Known NullnessInfo.WithNull when g.checkNullness -> + reqTy |> replaceNullnessOfTy (NewNullnessVar()) + | _ -> reqTy + | true -> reqTy + +/// When calling a null-allowing API, we prefer to infer a without null argument for idiomatic F# code. +/// That is, unless caller explicitly marks a value (e.g. coming from a function parameter) as WithNull, it should not be inferred as such. +let reqTyForArgumentNullnessInference g actualTy reqTy = + // Only change reqd nullness if actualTy is an inference variable + match tryDestTyparTy g actualTy with + | ValueSome t when t.IsCompilerGenerated && not(t.Constraints |> List.exists(function | TyparConstraint.SupportsNull _ -> true | _ -> false))-> + changeWithNullReqTyToVariable g reqTy + | _ -> reqTy + +let TypeHasAllowNull (tcref:TyconRef) g m = + not tcref.IsStructOrEnumTycon && + not (isByrefLikeTyconRef g m tcref) && + (TryFindTyconRefBoolAttribute g m g.attrib_AllowNullLiteralAttribute tcref = Some true) + +/// The new logic about whether a type admits the use of 'null' as a value. +let TypeNullIsExtraValueNew g m ty = + let sty = stripTyparEqns ty + + // Check if the type has AllowNullLiteral + (match tryTcrefOfAppTy g sty with + | ValueSome tcref -> TypeHasAllowNull tcref g m + | _ -> false) + || + // Check if the type has a nullness annotation + (match (nullnessOfTy g sty).Evaluate() with + | NullnessInfo.AmbivalentToNull -> false + | NullnessInfo.WithoutNull -> false + | NullnessInfo.WithNull -> true) + || + // Check if the type has a ': null' constraint + isSupportsNullTyparTy g ty + +/// The pre-nullness logic about whether a type uses 'null' as a true representation value let TypeNullIsTrueValue g ty = (match tryTcrefOfAppTy g ty with | ValueSome tcref -> IsUnionTypeWithNullAsTrueValue g tcref.Deref | _ -> false) || isUnitTy g ty +/// Indicates if unbox(null) is actively rejected at runtime. See nullability RFC. This applies to types that don't have null +/// as a valid runtime representation under old compatibility rules. let TypeNullNotLiked g m ty = not (TypeNullIsExtraValue g m ty) && not (TypeNullIsTrueValue g ty) && not (TypeNullNever g ty) -// The non-inferring counter-part to SolveTypeUseSupportsNull -let TypeSatisfiesNullConstraint g m ty = - TypeNullIsExtraValue g m ty - -// The non-inferring counter-part to SolveTypeRequiresDefaultValue (and SolveTypeRequiresDefaultConstructor for struct types) -let rec TypeHasDefaultValue g m ty = +let rec TypeHasDefaultValueAux isNew g m ty = let ty = stripTyEqnsAndMeasureEqns g ty - // Check reference types - precisely the ones satisfying the ': null' constraint have default values - TypeSatisfiesNullConstraint g m ty - || - // Check nominal struct types - (isStructTy g ty && - // F# struct types have a DefaultValue if all their field types have a default value excluding those with DefaultValue(false) + (if isNew then TypeNullIsExtraValueNew g m ty else TypeNullIsExtraValue g m ty) + || (isStructTy g ty && + // Is it an F# struct type? (if isFSharpStructTy g ty then let tcref, tinst = destAppTy g ty let flds = @@ -9089,17 +9246,17 @@ let rec TypeHasDefaultValue g m ty = // We can ignore fields with the DefaultValue(false) attribute |> List.filter (fun fld -> TryFindFSharpBoolAttribute g g.attrib_DefaultValueAttribute fld.FieldAttribs <> Some false) - flds |> List.forall (actualTyOfRecdField (mkTyconRefInst tcref tinst) >> TypeHasDefaultValue g m) + flds |> List.forall (actualTyOfRecdField (mkTyconRefInst tcref tinst) >> TypeHasDefaultValueAux isNew g m) // Struct tuple types have a DefaultValue if all their element types have a default value elif isStructTupleTy g ty then - destStructTupleTy g ty |> List.forall (TypeHasDefaultValue g m) + destStructTupleTy g ty |> List.forall (TypeHasDefaultValueAux isNew g m) // Struct anonymous record types have a DefaultValue if all their element types have a default value elif isStructAnonRecdTy g ty then match tryDestAnonRecdTy g ty with | ValueNone -> true - | ValueSome (_, ptys) -> ptys |> List.forall (TypeHasDefaultValue g m) + | ValueSome (_, ptys) -> ptys |> List.forall (TypeHasDefaultValueAux isNew g m) else // All nominal struct types defined in other .NET languages have a DefaultValue regardless of their instantiation true)) @@ -9108,6 +9265,10 @@ let rec TypeHasDefaultValue g m ty = (isNonNullableStructTyparTy g ty && (destTyparTy g ty).Constraints |> List.exists (function TyparConstraint.RequiresDefaultConstructor _ -> true | _ -> false)) +let TypeHasDefaultValue (g: TcGlobals) m ty = TypeHasDefaultValueAux false g m ty + +let TypeHasDefaultValueNew g m ty = TypeHasDefaultValueAux true g m ty + /// Determines types that are potentially known to satisfy the 'comparable' constraint and returns /// a set of residual types that must also satisfy the constraint [] @@ -9343,7 +9504,7 @@ let mkChoiceTy (g: TcGlobals) m tinst = match List.length tinst with | 0 -> g.unit_ty | 1 -> List.head tinst - | length -> mkAppTy (mkChoiceTyconRef g m length) tinst + | length -> mkWoNullAppTy (mkChoiceTyconRef g m length) tinst let mkChoiceCaseRef g m n i = mkUnionCaseRef (mkChoiceTyconRef g m n) ("Choice"+string (i+1)+"Of"+string n) @@ -11145,7 +11306,7 @@ let CombineCcuContentFragments l = CombineModuleOrNamespaceTypeList [] l -/// An immutable mappping from witnesses to some data. +/// An immutable mapping from witnesses to some data. /// /// Note: this uses an immutable HashMap/Dictionary with an IEqualityComparer that captures TcGlobals, see EmptyTraitWitnessInfoHashMap type TraitWitnessInfoHashMap<'T> = ImmutableDictionary @@ -11154,7 +11315,7 @@ type TraitWitnessInfoHashMap<'T> = ImmutableDictionary let EmptyTraitWitnessInfoHashMap g : TraitWitnessInfoHashMap<'T> = ImmutableDictionary.Create( { new IEqualityComparer<_> with - member _.Equals(a, b) = traitKeysAEquiv g TypeEquivEnv.Empty a b + member _.Equals(a, b) = nullSafeEquality a b (fun a b -> traitKeysAEquiv g TypeEquivEnv.Empty a b) member _.GetHashCode(a) = hash a.MemberName }) diff --git a/src/Compiler/TypedTree/TypedTreeOps.fsi b/src/Compiler/TypedTree/TypedTreeOps.fsi index cec67a4961d..8c17d530762 100755 --- a/src/Compiler/TypedTree/TypedTreeOps.fsi +++ b/src/Compiler/TypedTree/TypedTreeOps.fsi @@ -375,7 +375,7 @@ val mkCompiledTupleTy: TcGlobals -> bool -> TTypes -> TType /// Convert from F# tuple creation expression to .NET tuple creation expressions val mkCompiledTuple: TcGlobals -> bool -> TTypes * Exprs * range -> TyconRef * TTypes * Exprs * range -/// Make a TAST expression representing getting an item fromm a tuple +/// Make a TAST expression representing getting an item from a tuple val mkGetTupleItemN: TcGlobals -> range -> int -> ILType -> bool -> Expr -> TType -> Expr /// Evaluate the TupInfo to work out if it is a struct or a ref. Currently this is very simple @@ -647,6 +647,12 @@ val destStructAnonRecdTy: TcGlobals -> TType -> TTypes val tryDestForallTy: TcGlobals -> TType -> Typars * TType +val nullnessOfTy: TcGlobals -> TType -> Nullness + +val changeWithNullReqTyToVariable: TcGlobals -> reqTy: TType -> TType + +val reqTyForArgumentNullnessInference: TcGlobals -> actualTy: TType -> reqTy: TType -> TType + val isFunTy: TcGlobals -> TType -> bool val isForallTy: TcGlobals -> TType -> bool @@ -685,7 +691,7 @@ val tryAnyParTyOption: TcGlobals -> TType -> Typar option val isMeasureTy: TcGlobals -> TType -> bool -val mkAppTy: TyconRef -> TypeInst -> TType +val mkWoNullAppTy: TyconRef -> TypeInst -> TType val mkProvenUnionCaseTy: UnionCaseRef -> TypeInst -> TType @@ -899,6 +905,8 @@ val typarsAEquiv: TcGlobals -> TypeEquivEnv -> Typars -> Typars -> bool val typeAEquivAux: Erasure -> TcGlobals -> TypeEquivEnv -> TType -> TType -> bool +val nullnessSensitivetypeAEquivAux: Erasure -> TcGlobals -> TypeEquivEnv -> TType -> TType -> bool + val typeAEquiv: TcGlobals -> TypeEquivEnv -> TType -> TType -> bool val returnTypesAEquivAux: Erasure -> TcGlobals -> TypeEquivEnv -> TType option -> TType option -> bool @@ -919,7 +927,7 @@ val anonInfoEquiv: AnonRecdTypeInfo -> AnonRecdTypeInfo -> bool val isErasedType: TcGlobals -> TType -> bool // Return all components (units-of-measure, and types) of this type that would be erased -val getErasedTypes: TcGlobals -> TType -> TType list +val getErasedTypes: TcGlobals -> TType -> checkForNullness: bool -> TType list //------------------------------------------------------------------------- // Unit operations @@ -1071,8 +1079,10 @@ type DisplayEnv = shortConstraints: bool useColonForReturnType: bool showAttributes: bool + showCsharpCodeAnalysisAttributes: bool showOverrides: bool showStaticallyResolvedTyparAnnotations: bool + showNullnessAnnotations: bool option abbreviateAdditionalConstraints: bool showTyparDefaultConstraints: bool /// If set, signatures will be rendered with XML documentation comments for members if they exist @@ -1645,7 +1655,7 @@ val destArrayTy: TcGlobals -> TType -> TType val destListTy: TcGlobals -> TType -> TType /// Build an array type of the given rank -val mkArrayTy: TcGlobals -> int -> TType -> range -> TType +val mkArrayTy: TcGlobals -> int -> Nullness -> TType -> range -> TType /// Check if a type definition is one of the artificial type definitions used for array types of different ranks val isArrayTyconRef: TcGlobals -> TyconRef -> bool @@ -1683,7 +1693,7 @@ val isFSharpDelegateTy: TcGlobals -> TType -> bool /// Determine if a type is an interface type val isInterfaceTy: TcGlobals -> TType -> bool -/// Determine if a type is a FSharpRef type +/// Determine if a type is a reference type val isRefTy: TcGlobals -> TType -> bool /// Determine if a type is a function (including generic). Not the same as isFunTy. @@ -1795,18 +1805,20 @@ val ModuleNameIsMangled: TcGlobals -> Attribs -> bool val CompileAsEvent: TcGlobals -> Attribs -> bool +val TypeNullIsTrueValue: TcGlobals -> TType -> bool + val TypeNullIsExtraValue: TcGlobals -> range -> TType -> bool -val TypeNullIsTrueValue: TcGlobals -> TType -> bool +val TypeHasAllowNull: TyconRef -> TcGlobals -> range -> bool -val TypeNullNotLiked: TcGlobals -> range -> TType -> bool +val TypeNullIsExtraValueNew: TcGlobals -> range -> TType -> bool val TypeNullNever: TcGlobals -> TType -> bool -val TypeSatisfiesNullConstraint: TcGlobals -> range -> TType -> bool - val TypeHasDefaultValue: TcGlobals -> range -> TType -> bool +val TypeHasDefaultValueNew: TcGlobals -> range -> TType -> bool + val isAbstractTycon: Tycon -> bool val isUnionCaseRefDefinitelyMutable: UnionCaseRef -> bool @@ -2050,8 +2062,6 @@ val mkCallArrayLength: TcGlobals -> range -> TType -> Expr -> Expr val mkCallArrayGet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -val mkCallArrayMap: g: TcGlobals -> m: range -> ty1: TType -> ty2: TType -> e1: Expr -> e2: Expr -> Expr - val mkCallArray2DGet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr val mkCallArray3DGet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr @@ -2066,8 +2076,6 @@ val mkCallArray3DSet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Exp val mkCallArray4DSet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr -val mkCallListMap: g: TcGlobals -> m: range -> ty1: TType -> ty2: TType -> e1: Expr -> e2: Expr -> Expr - val mkCallHash: TcGlobals -> range -> TType -> Expr -> Expr val mkCallBox: TcGlobals -> range -> TType -> Expr -> Expr @@ -2275,6 +2283,8 @@ val mkLdelem: TcGlobals -> range -> TType -> Expr -> Expr -> Expr val TryDecodeILAttribute: ILTypeRef -> ILAttributes -> (ILAttribElem list * ILAttributeNamedArg list) option +val IsILAttrib: BuiltinAttribInfo -> ILAttribute -> bool + val TryFindILAttribute: BuiltinAttribInfo -> ILAttributes -> bool val TryFindILAttributeOpt: BuiltinAttribInfo option -> ILAttributes -> bool @@ -2297,6 +2307,8 @@ val TryFindFSharpBoolAttributeAssumeFalse: TcGlobals -> BuiltinAttribInfo -> Att val TryFindFSharpStringAttribute: TcGlobals -> BuiltinAttribInfo -> Attribs -> string option +val TryFindLocalizedFSharpStringAttribute: TcGlobals -> BuiltinAttribInfo -> Attribs -> string option + val TryFindFSharpInt32Attribute: TcGlobals -> BuiltinAttribInfo -> Attribs -> int32 option /// Try to find a specific attribute on a type definition, where the attribute accepts a string argument. @@ -2683,7 +2695,7 @@ val GetTraitConstraintInfosOfTypars: TcGlobals -> Typars -> TraitConstraintInfo val GetTraitWitnessInfosOfTypars: TcGlobals -> numParentTypars: int -> typars: Typars -> TraitWitnessInfos -/// An immutable mappping from witnesses to some data. +/// An immutable mapping from witnesses to some data. /// /// Note: this uses an immutable HashMap/Dictionary with an IEqualityComparer that captures TcGlobals, see EmptyTraitWitnessInfoHashMap type TraitWitnessInfoHashMap<'T> = ImmutableDictionary diff --git a/src/Compiler/TypedTree/TypedTreePickle.fs b/src/Compiler/TypedTree/TypedTreePickle.fs index 038909659ce..9ade306d77c 100644 --- a/src/Compiler/TypedTree/TypedTreePickle.fs +++ b/src/Compiler/TypedTree/TypedTreePickle.fs @@ -67,7 +67,11 @@ type PickledDataWithReferences<'rawData> = //--------------------------------------------------------------------------- [] +#if NO_CHECKNULLS type Table<'T> = +#else +type Table<'T when 'T: not null> = +#endif { name: string tbl: Dictionary<'T, int> mutable rows: ResizeArray<'T> @@ -121,6 +125,7 @@ type NodeOutTable<'Data, 'Node> = [] type WriterState = { os: ByteBuffer + osB: ByteBuffer oscope: CcuThunk occus: Table oentities: NodeOutTable @@ -154,6 +159,8 @@ type NodeInTable<'Data, 'Node> = [] type ReaderState = { is: ByteStream + // secondary stream of information for F# 5.0 + isB: ByteStream iilscope: ILScopeRef iccus: InputTable ientities: NodeInTable @@ -178,18 +185,28 @@ type 'T pickler = 'T -> WriterState -> unit let p_byte b st = st.os.EmitIntAsByte b +let p_byteB b st = st.osB.EmitIntAsByte b + let p_bool b st = p_byte (if b then 1 else 0) st -let prim_p_int32 i st = +/// Write an uncompressed integer to the main stream. +let prim_p_int32 i st = p_byte (b0 i) st p_byte (b1 i) st p_byte (b2 i) st p_byte (b3 i) st -/// Compress integers according to the same scheme used by CLR metadata -/// This halves the size of pickled data -let p_int32 n st = - if n >= 0 && n <= 0x7F then +/// Write an uncompressed integer to the B stream. +let prim_p_int32B i st = + p_byteB (b0 i) st + p_byteB (b1 i) st + p_byteB (b2 i) st + p_byteB (b3 i) st + +/// Compress integers according to the same scheme used by CLR metadata +/// This halves the size of pickled data +let p_int32 n st = + if n >= 0 && n <= 0x7F then p_byte (b0 n) st else if n >= 0x80 && n <= 0x3FFF then p_byte (0x80 ||| (n >>> 8)) st @@ -198,6 +215,17 @@ let p_int32 n st = p_byte 0xFF st prim_p_int32 n st +/// Write a compressed integer to the B stream. +let p_int32B n st = + if n >= 0 && n <= 0x7F then + p_byteB (b0 n) st + else if n >= 0x80 && n <= 0x3FFF then + p_byteB ( (0x80 ||| (n >>> 8))) st + p_byteB ( (n &&& 0xFF)) st + else + p_byteB 0xFF st + prim_p_int32B n st + let space = () let p_space n () st = for i = 0 to n - 1 do @@ -227,6 +255,7 @@ let p_prim_string (s: string) st = st.os.EmitBytes bytes let p_int c st = p_int32 c st +let p_intB c st = p_int32B c st let p_int8 (i: sbyte) st = p_int32 (int32 i) st let p_uint8 (i: byte) st = p_byte (int i) st let p_int16 (i: int16) st = p_int32 (int32 i) st @@ -267,12 +296,16 @@ let inline p_tup11 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 (a, b, c, d, e, f, x7, x8 let u_byte st = int (st.is.ReadByte()) +/// Unpickle an uncompressed integer from the B stream +/// The extra B stream of bytes is implicitly 0 if not present +let u_byteB st = + if st.isB.IsEOF then 0 else int (st.isB.ReadByte()) + type unpickler<'T> = ReaderState -> 'T let u_bool st = let b = u_byte st in (b = 1) - - +/// Unpickle an uncompressed integer from the main stream let prim_u_int32 st = let b0 = (u_byte st) let b1 = (u_byte st) @@ -280,6 +313,14 @@ let prim_u_int32 st = let b3 = (u_byte st) b0 ||| (b1 <<< 8) ||| (b2 <<< 16) ||| (b3 <<< 24) +/// Unpickle an uncompressed integer from the B stream +let prim_u_int32B st = + let b0 = u_byteB st + let b1 = u_byteB st + let b2 = u_byteB st + let b3 = u_byteB st + b0 ||| (b1 <<< 8) ||| (b2 <<< 16) ||| (b3 <<< 24) + let u_int32 st = let b0 = u_byte st if b0 <= 0x7F then b0 @@ -291,6 +332,19 @@ let u_int32 st = assert(b0 = 0xFF) prim_u_int32 st +/// Unpickle a compressed integer from the B stream. +/// The integer is 0 if the B stream is not present. +let u_int32B st = + let b0 = u_byteB st + if b0 <= 0x7F then b0 + else if b0 <= 0xbf then + let b0 = b0 &&& 0x7F + let b1 = u_byteB st + (b0 <<< 8) ||| b1 + else + assert(b0 = 0xFF) + prim_u_int32B st + let u_byte_memory st = let n = (u_int32 st) st.is.ReadBytes n @@ -303,6 +357,7 @@ let u_prim_string st = st.is.ReadUtf8String len let u_int st = u_int32 st +let u_intB st = u_int32B st let u_int8 st = sbyte (u_int32 st) let u_uint8 st = byte (u_byte st) let u_int16 st = int16 (u_int32 st) @@ -444,7 +499,12 @@ let p_list_core f (xs: 'T list) st = let p_list f x st = p_int (List.length x) st p_list_core f x st -let p_list_ext extraf f x st = + +let p_listB f x st = + p_intB (List.length x) st + p_list_core f x st + +let p_list_ext extraf f x st = let n = List.length x let n = if Option.isSome extraf then n ||| 0x80000000 else n p_int n st @@ -530,6 +590,12 @@ let u_list_core f n st = let u_list f st = let n = u_int st u_list_core f n st + +/// Unpickle a list from the B stream. The resulting list is empty if the B stream is not present. +let u_listB f st = + let n = u_intB st + u_list_core f n st + let u_list_ext extra f st = let n = u_int st let extraItem = @@ -647,7 +713,12 @@ let p_nleref x st = p_int (encode_nleref st.occus st.ostrings st.onlerefs st.osc // Simple types are types like "int", represented as TType(Ref_nonlocal(..., "int"), []). // A huge number of these occur in pickled F# data, so make them unique. -let decode_simpletyp st _ccuTab _stringTab nlerefTab a = TType_app(ERefNonLocal (lookup_nleref st nlerefTab a), [], 0uy) +// +// NULLNESS - the simpletyp table now holds KnownAmbivalentToNull by default. +// For old assemblies it is, if we give those assemblies the ambivalent interpretation. +// For new assemblies compiled with null-checking on it isn't, if the default is to give +// those the KnownWithoutNull interpretation by default. +let decode_simpletyp st _ccuTab _stringTab nlerefTab a = TType_app(ERefNonLocal (lookup_nleref st nlerefTab a), [], KnownAmbivalentToNull) let u_encoded_simpletyp st = u_int st let u_simpletyp st = lookup_uniq st st.isimpletys (u_int st) let encode_simpletyp ccuTab stringTab nlerefTab simpleTyTab thisCcu a = encode_uniq simpleTyTab (encode_nleref ccuTab stringTab nlerefTab thisCcu a) @@ -661,6 +732,7 @@ let PickleBufferCapacity = 50000 let pickleObjWithDanglingCcus inMem file g scope p x = let st1 = { os = ByteBuffer.Create(PickleBufferCapacity, useArrayPool = true) + osB = ByteBuffer.Create(PickleBufferCapacity, useArrayPool = true) oscope=scope occus= Table<_>.Create "occus" oentities=NodeOutTable<_, _>.Create((fun (tc: Tycon) -> tc.Stamp), (fun tc -> tc.LogicalName), (fun tc -> tc.Range), id , "otycons") @@ -674,22 +746,24 @@ let pickleObjWithDanglingCcus inMem file g scope p x = oglobals=g ofile=file oInMem=inMem - isStructThisArgPos = false} - let ccuNameTab, (ntycons, ntypars, nvals, nanoninfos), stringTab, pubpathTab, nlerefTab, simpleTyTab, phase1bytes = + isStructThisArgPos = false } + + let ccuNameTab,(ntycons, ntypars, nvals, nanoninfos),stringTab,pubpathTab,nlerefTab,simpleTyTab,phase1bytes,phase1bytesB = p x st1 let sizes = st1.oentities.Size, st1.otypars.Size, st1.ovals.Size, st1.oanoninfos.Size - st1.occus, sizes, st1.ostrings, st1.opubpaths, st1.onlerefs, st1.osimpletys, st1.os.AsMemory() + st1.occus, sizes, st1.ostrings, st1.opubpaths, st1.onlerefs, st1.osimpletys, st1.os.AsMemory(), st1.osB let st2 = { os = ByteBuffer.Create(PickleBufferCapacity, useArrayPool = true) + osB = ByteBuffer.Create(PickleBufferCapacity, useArrayPool = true) oscope=scope occus= Table<_>.Create "occus (fake)" - oentities=NodeOutTable<_, _>.Create((fun (tc: Tycon) -> tc.Stamp), (fun tc -> tc.LogicalName), (fun tc -> tc.Range), id , "otycons") - otypars=NodeOutTable<_, _>.Create((fun (tp: Typar) -> tp.Stamp), (fun tp -> tp.DisplayName), (fun tp -> tp.Range), id , "otypars") + oentities=NodeOutTable<_, _>.Create((fun (tc: Tycon) -> tc.Stamp), (fun tc -> tc.LogicalName), (fun tc -> tc.Range), id, "otycons") + otypars=NodeOutTable<_, _>.Create((fun (tp: Typar) -> tp.Stamp), (fun tp -> tp.DisplayName), (fun tp -> tp.Range), id, "otypars") ovals=NodeOutTable<_, _>.Create((fun (v: Val) -> v.Stamp), (fun v -> v.LogicalName), (fun v -> v.Range), (fun osgn -> osgn), "ovals") oanoninfos=NodeOutTable<_, _>.Create((fun (v: AnonRecdTypeInfo) -> v.Stamp), (fun v -> string v.IlTypeName), (fun _ -> range0), id, "oanoninfos") ostrings=Table<_>.Create "ostrings (fake)" @@ -717,12 +791,18 @@ let pickleObjWithDanglingCcus inMem file g scope p x = p_memory (stringTab.AsArray, pubpathTab.AsArray, nlerefTab.AsArray, simpleTyTab.AsArray, phase1bytes) st2 + + // The B stream should be empty in the second phase + let phase2bytesB = st2.osB.AsMemory() + if phase2bytesB.Length <> 0 then failwith "expected phase2bytesB.Length = 0" + (st2.osB :> System.IDisposable).Dispose() st2.os (st1.os :> System.IDisposable).Dispose() - phase2bytes -let check (ilscope: ILScopeRef) (inMap: NodeInTable<_, _>) = + phase2bytes, phase1bytesB + +let check (ilscope: ILScopeRef) (inMap: NodeInTable<_,_>) = for i = 0 to inMap.Count - 1 do let n = inMap.Get i if not (inMap.IsLinked n) then @@ -732,9 +812,10 @@ let check (ilscope: ILScopeRef) (inMap: NodeInTable<_, _>) = // an identical copy of the source for the DLL containing the data being unpickled. A message will // then be printed indicating the name of the item. -let unpickleObjWithDanglingCcus file viewedScope (ilModule: ILModuleDef option) u (phase2bytes: ReadOnlyByteMemory) = +let unpickleObjWithDanglingCcus file viewedScope (ilModule: ILModuleDef option) u (phase2bytes: ReadOnlyByteMemory) (phase1bytesB: ReadOnlyByteMemory) = let st2 = { is = ByteStream.FromBytes (phase2bytes, 0, phase2bytes.Length) + isB = ByteStream.FromBytes (ByteMemory.FromArray([| |]).AsReadOnly(), 0, 0) iilscope = viewedScope iccus = new_itbl "iccus (fake)" [| |] ientities = NodeInTable<_, _>.Create (Tycon.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "itycons", 0) @@ -768,6 +849,7 @@ let unpickleObjWithDanglingCcus file viewedScope (ilModule: ILModuleDef option) let data = let st1 = { is = ByteStream.FromBytes (phase1bytes, 0, phase1bytes.Length) + isB = ByteStream.FromBytes (phase1bytesB, 0, phase1bytesB.Length) iccus = ccuTab iilscope = viewedScope ientities = NodeInTable<_, _>.Create(Tycon.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "itycons", ntycons) @@ -782,6 +864,7 @@ let unpickleObjWithDanglingCcus file viewedScope (ilModule: ILModuleDef option) iILModule = ilModule } let res = u st1 check viewedScope st1.ientities + check viewedScope st1.ientities check viewedScope st1.ivals check viewedScope st1.itypars res @@ -1529,7 +1612,20 @@ let p_tyar_constraint x st = | TyparConstraint.SupportsComparison _ -> p_byte 10 st | TyparConstraint.SupportsEquality _ -> p_byte 11 st | TyparConstraint.IsUnmanaged _ -> p_byte 12 st -let p_tyar_constraints = (p_list p_tyar_constraint) + | TyparConstraint.NotSupportsNull _ -> + failwith "NotSupportsNull constraints should only be emitted to streamB" + +// Some extra F# 5.0 constraints are stored in stream B, these will be ignored by earlier F# compilers +let p_tyar_constraintB x st = + match x with + | TyparConstraint.NotSupportsNull _ -> p_byteB 1 st + | _ -> failwith "only NotSupportsNull constraints should be emitted to streamB" + +let p_tyar_constraints cxs st = + let cxs1, cxs2 = cxs |> List.partition (function TyparConstraint.NotSupportsNull _ -> false | _ -> true) + p_list p_tyar_constraint cxs1 st + // Some extra F# 5.0 constraints are stored in stream B, these will be ignored by earlier F# compilers + p_listB p_tyar_constraintB cxs2 st let u_tyar_constraint st = let tag = u_byte st @@ -1549,9 +1645,21 @@ let u_tyar_constraint st = | 12 -> (fun _ -> TyparConstraint.IsUnmanaged range0) | _ -> ufailwith st "u_tyar_constraint" - -let u_tyar_constraints = (u_list_revi u_tyar_constraint) - +// Some extra F# 5.0 constraints are stored in stream B, these will be ignored by earlier F# compilers +let u_tyar_constraintB st = + let tag = u_byteB st + match tag with + | 1 -> TyparConstraint.NotSupportsNull range0 + | _ -> ufailwith st "u_tyar_constraintB - unexpected constraint in streamB" + +let u_tyar_constraints st = + let cxs1 = u_list_revi u_tyar_constraint st + // Some extra F# 5.0 constraints are stored in stream B, these will be ignored by earlier F# compilers + // + // If the B stream is not present (e.g. reading F# 4.5 components) then this list will be empty + // via the implementation of u_listB. + let cxs2 = u_listB u_tyar_constraintB st + cxs1 @ cxs2 let p_tyar_spec_data (x: Typar) st = p_tup5 @@ -1579,7 +1687,7 @@ let u_tyar_spec_data st = typar_opt_data= match g, e, c with | doc, [], [] when doc.IsEmpty -> None - | _ -> Some { typar_il_name = None; typar_xmldoc = g; typar_constraints = e; typar_attribs = c } } + | _ -> Some { typar_il_name = None; typar_xmldoc = g; typar_constraints = e; typar_attribs = c;typar_is_contravariant = false } } let u_tyar_spec st = u_osgn_decl st.itypars u_tyar_spec_data st @@ -1604,19 +1712,41 @@ let _ = fill_p_ty2 (fun isStructThisArgPos ty st -> else p_byte 0 st; p_tys l st - | TType_app(ERefNonLocal nleref, [], _) -> + | TType_app(ERefNonLocal nleref, [], nullness) -> + if st.oglobals.langFeatureNullness then + match nullness.Evaluate() with + | NullnessInfo.WithNull -> p_byteB 9 st + | NullnessInfo.WithoutNull -> p_byteB 10 st + | NullnessInfo.AmbivalentToNull -> p_byteB 11 st p_byte 1 st; p_simpletyp nleref st - | TType_app (tc, tinst, _) -> - p_byte 2 st; p_tup2 (p_tcref "typ") p_tys (tc, tinst) st - - | TType_fun (d, r, _) -> + | TType_app (tc, tinst, nullness) -> + if st.oglobals.langFeatureNullness then + match nullness.Evaluate() with + | NullnessInfo.WithNull -> p_byteB 12 st + | NullnessInfo.WithoutNull -> p_byteB 13 st + | NullnessInfo.AmbivalentToNull -> p_byteB 14 st + p_byte 2 st; p_tcref "typ" tc st; p_tys tinst st + + | TType_fun (d,r,nullness) -> + if st.oglobals.langFeatureNullness then + match nullness.Evaluate() with + | NullnessInfo.WithNull -> p_byteB 15 st + | NullnessInfo.WithoutNull -> p_byteB 16 st + | NullnessInfo.AmbivalentToNull -> p_byteB 17 st p_byte 3 st // Note, the "this" argument may be found in the domain position of a function type, so propagate the isStructThisArgPos value p_ty2 isStructThisArgPos d st p_ty r st - | TType_var (r, _) -> p_byte 4 st; p_tpref r st + | TType_var (r, nullness) -> + if st.oglobals.langFeatureNullness then + match nullness.Evaluate() with + | NullnessInfo.WithNull -> p_byteB 18 st + | NullnessInfo.WithoutNull -> p_byteB 19 st + | NullnessInfo.AmbivalentToNull -> p_byteB 20 st + p_byte 4 st + p_tpref r st | TType_forall (tps, r) -> p_byte 5 st @@ -1642,27 +1772,59 @@ let _ = fill_p_ty2 (fun isStructThisArgPos ty st -> let _ = fill_u_ty (fun st -> let tag = u_byte st + match tag with | 0 -> let l = u_tys st TType_tuple (tupInfoRef, l) - - | 1 -> - u_simpletyp st - - | 2 -> - let tc = u_tcref st + | 1 -> + let tagB = u_byteB st + let sty = u_simpletyp st + match tagB with + | 0 -> + sty + | 9 -> + match sty with + | TType_app(tcref, _, _) -> TType_app(tcref, [], KnownWithNull) + | _ -> ufailwith st "u_ty 9a" + | 10 -> + match sty with + | TType_app(tcref, _, _) -> TType_app(tcref, [], KnownWithoutNull) + | _ -> ufailwith st "u_ty 9b" + | 11 -> + match sty with + | TType_app(tcref, _, _) -> TType_app(tcref, [], KnownAmbivalentToNull) + | _ -> ufailwith st "u_ty 9c" + | b -> ufailwith st (sprintf "u_ty - 1/B, byte = %A" b) + | 2 -> + let tagB = u_byteB st + let tcref = u_tcref st let tinst = u_tys st - TType_app (tc, tinst, 0uy) - - | 3 -> + match tagB with + | 0 -> TType_app (tcref, tinst, KnownAmbivalentToNull) + | 12 -> TType_app (tcref, tinst, KnownWithNull) + | 13 -> TType_app (tcref, tinst, KnownWithoutNull) + | 14 -> TType_app (tcref, tinst, KnownAmbivalentToNull) + | _ -> ufailwith st "u_ty - 2/B" + | 3 -> + let tagB = u_byteB st let d = u_ty st let r = u_ty st - TType_fun (d, r, 0uy) - + match tagB with + | 0 -> TType_fun (d, r, KnownAmbivalentToNull) + | 15 -> TType_fun (d, r, KnownWithNull) + | 16 -> TType_fun (d, r, KnownWithoutNull) + | 17 -> TType_fun (d, r, KnownAmbivalentToNull) + | _ -> ufailwith st "u_ty - 3/B" | 4 -> + let tagB = u_byteB st let r = u_tpref st - r.AsType + match tagB with + | 0 -> r.AsType KnownAmbivalentToNull + | 18 -> r.AsType KnownWithNull + | 19 -> r.AsType KnownWithoutNull + | 20 -> r.AsType KnownAmbivalentToNull + | _ -> ufailwith st "u_ty - 4/B" | 5 -> let tps = u_tyar_specs st diff --git a/src/Compiler/TypedTree/TypedTreePickle.fsi b/src/Compiler/TypedTree/TypedTreePickle.fsi index 5e0fa9915c3..3e3910bd4e1 100644 --- a/src/Compiler/TypedTree/TypedTreePickle.fsi +++ b/src/Compiler/TypedTree/TypedTreePickle.fsi @@ -85,7 +85,7 @@ val internal pickleCcuInfo: pickler /// Serialize an arbitrary object using the given pickler val pickleObjWithDanglingCcus: - inMem: bool -> file: string -> TcGlobals -> scope: CcuThunk -> pickler<'T> -> 'T -> ByteBuffer + inMem: bool -> file: string -> TcGlobals -> scope: CcuThunk -> pickler<'T> -> 'T -> ByteBuffer * ByteBuffer /// The type of state unpicklers read from type ReaderState @@ -151,5 +151,6 @@ val internal unpickleObjWithDanglingCcus: viewedScope: ILScopeRef -> ilModule: ILModuleDef option -> 'T unpickler -> + ReadOnlyByteMemory -> ReadOnlyByteMemory -> PickledDataWithReferences<'T> diff --git a/src/Compiler/TypedTree/tainted.fs b/src/Compiler/TypedTree/tainted.fs index f586f99a3cd..d23b5183a53 100644 --- a/src/Compiler/TypedTree/tainted.fs +++ b/src/Compiler/TypedTree/tainted.fs @@ -89,7 +89,7 @@ type internal Tainted<'T> (context: TaintedContext, value: 'T) = | _ -> () member _.TypeProviderDesignation = - context.TypeProvider.GetType().FullName + !! context.TypeProvider.GetType().FullName member _.TypeProviderAssemblyRef = context.TypeProviderAssemblyRef @@ -101,11 +101,12 @@ type internal Tainted<'T> (context: TaintedContext, value: 'T) = | :? TypeProviderError -> reraise() | :? AggregateException as ae -> let errNum,_ = FSComp.SR.etProviderError("", "") - let messages = [for e in ae.InnerExceptions -> e.Message] + let messages = [for e in ae.InnerExceptions -> if isNull e.InnerException then e.Message else (e.Message + ": " + e.GetBaseException().Message)] raise <| TypeProviderError(errNum, this.TypeProviderDesignation, range, messages) | e -> let errNum,_ = FSComp.SR.etProviderError("", "") - raise <| TypeProviderError((errNum, e.Message), this.TypeProviderDesignation, range) + let error = if isNull e.InnerException then e.Message else (e.Message + ": " + e.GetBaseException().Message) + raise <| TypeProviderError((errNum, error), this.TypeProviderDesignation, range) member _.TypeProvider = Tainted<_>(context, context.TypeProvider) @@ -131,8 +132,8 @@ type internal Tainted<'T> (context: TaintedContext, value: 'T) = let u = this.Protect (fun x -> f (x, context.TypeProvider)) range Tainted(context, u) - member this.PApplyArray(f, methodName, range: range) = - let a : 'U[] = this.Protect f range + member this.PApplyArray(f, methodName, range:range) = + let a : 'U[] MaybeNull = this.Protect f range match a with | Null -> raise <| TypeProviderError(FSComp.SR.etProviderReturnedNull(methodName), this.TypeProviderDesignation, range) | NonNull a -> a |> Array.map (fun u -> Tainted(context,u)) @@ -163,8 +164,14 @@ type internal Tainted<'T> (context: TaintedContext, value: 'T) = Tainted(context, this.Protect(fun value -> box value :?> 'U) range) module internal Tainted = - let (|Null|NonNull|) (p:Tainted<'T>) : Choice> when 'T : null and 'T : not struct = + +#if NO_CHECKNULLS + let (|Null|NonNull|) (p:Tainted<'T>) : Choice> when 'T : null and 'T : not struct = if p.PUntaintNoFailure isNull then Null else NonNull (p.PApplyNoFailure id) +#else + let (|Null|NonNull|) (p:Tainted<'T | null>) : Choice> when 'T : not null and 'T : not struct = + if p.PUntaintNoFailure isNull then Null else NonNull (p.PApplyNoFailure nonNull) +#endif let Eq (p:Tainted<'T>) (v:'T) = p.PUntaintNoFailure (fun pv -> pv = v) diff --git a/src/Compiler/TypedTree/tainted.fsi b/src/Compiler/TypedTree/tainted.fsi index ee1a6d94069..61392794b5f 100644 --- a/src/Compiler/TypedTree/tainted.fsi +++ b/src/Compiler/TypedTree/tainted.fsi @@ -101,7 +101,11 @@ type internal Tainted<'T> = module internal Tainted = /// Test whether the tainted value is null - val (|Null|NonNull|): Tainted<'T MaybeNull> -> Choice> when 'T: null and 'T: not struct +#if NO_CHECKNULLS + val (|Null|NonNull|) : Tainted<'T MaybeNull> -> Choice> when 'T : null and 'T : not struct +#else + val (|Null|NonNull|) : Tainted<'T MaybeNull> -> Choice> when 'T : not null and 'T : not struct +#endif /// Test whether the tainted value equals given value. /// Failure in call to equality operation will be blamed on type provider of first operand diff --git a/src/Compiler/Utilities/Activity.fs b/src/Compiler/Utilities/Activity.fs index ebc08633021..b6fafe1c1b9 100644 --- a/src/Compiler/Utilities/Activity.fs +++ b/src/Compiler/Utilities/Activity.fs @@ -6,6 +6,8 @@ open System open System.Diagnostics open System.IO open System.Text +open Internal.Utilities.Library + module ActivityNames = [] @@ -67,20 +69,21 @@ module internal Activity = module Events = let cacheHit = "cacheHit" - type System.Diagnostics.Activity with + type Diagnostics.Activity with member this.RootId = let rec rootID (act: Activity) = - if isNull act.ParentId then act.Id else rootID act.Parent + match act.Parent with + | null -> act.Id + | parent -> rootID parent rootID this member this.Depth = let rec depth (act: Activity) acc = - if isNull act.ParentId then - acc - else - depth act.Parent (acc + 1) + match act.Parent with + | null -> acc + | parent -> depth parent (acc + 1) depth this 0 @@ -100,8 +103,10 @@ module internal Activity = let startNoTags (name: string) : IDisposable = activitySource.StartActivity name let addEvent name = - if (not (isNull Activity.Current)) && Activity.Current.Source = activitySource then - Activity.Current.AddEvent(ActivityEvent name) |> ignore + match Activity.Current with + | null -> () + | activity when activity.Source = activitySource -> activity.AddEvent(ActivityEvent name) |> ignore + | _ -> () module Profiling = @@ -134,16 +139,17 @@ module internal Activity = ActivityStarted = (fun a -> a.AddTag(gcStatsInnerTag, collectGCStats ()) |> ignore), ActivityStopped = (fun a -> - let statsBefore = a.GetTagItem(gcStatsInnerTag) :?> GCStats let statsAfter = collectGCStats () let p = Process.GetCurrentProcess() a.AddTag(Tags.workingSetMB, p.WorkingSet64 / 1_000_000L) |> ignore a.AddTag(Tags.handles, p.HandleCount) |> ignore a.AddTag(Tags.threads, p.Threads.Count) |> ignore - for i = 0 to statsAfter.Length - 1 do - a.AddTag($"gc{i}", statsAfter[i] - statsBefore[i]) |> ignore) - + match a.GetTagItem(gcStatsInnerTag) with + | :? GCStats as statsBefore -> + for i = 0 to statsAfter.Length - 1 do + a.AddTag($"gc{i}", statsAfter[i] - statsBefore[i]) |> ignore + | _ -> ()) ) ActivitySource.AddActivityListener(l) @@ -194,11 +200,11 @@ module internal Activity = module CsvExport = - let private escapeStringForCsv (o: obj) = - if isNull o then - "" - else - let mutable txtVal = o.ToString() + let private escapeStringForCsv (o: obj MaybeNull) = + match o with + | null -> "" + | o -> + let mutable txtVal = match o.ToString() with | null -> "" | s -> s let hasComma = txtVal.IndexOf(',') > -1 let hasQuote = txtVal.IndexOf('"') > -1 @@ -213,7 +219,7 @@ module internal Activity = let private createCsvRow (a: Activity) = let sb = new StringBuilder(128) - let appendWithLeadingComma (s: string) = + let appendWithLeadingComma (s: string MaybeNull) = sb.Append(',') |> ignore sb.Append(s) |> ignore @@ -231,7 +237,7 @@ module internal Activity = sb.ToString() - let addCsvFileListener pathToFile = + let addCsvFileListener (pathToFile:string) = if pathToFile |> File.Exists |> not then File.WriteAllLines( pathToFile, @@ -253,7 +259,7 @@ module internal Activity = let l = new ActivityListener( - ShouldListenTo = (fun a -> ActivityNames.AllRelevantNames |> Array.contains a.Name), + ShouldListenTo = (fun a ->ActivityNames.AllRelevantNames |> Array.contains a.Name), Sample = (fun _ -> ActivitySamplingResult.AllData), ActivityStopped = (fun a -> msgQueue.Post(createCsvRow a)) ) diff --git a/src/Compiler/Utilities/EditDistance.fs b/src/Compiler/Utilities/EditDistance.fs index 10595b0b999..c1f4cadf3bf 100644 --- a/src/Compiler/Utilities/EditDistance.fs +++ b/src/Compiler/Utilities/EditDistance.fs @@ -100,7 +100,7 @@ let JaroWinklerDistance s1 s2 = let p = 0.1 jaroScore + (l * p * (1.0 - jaroScore)) -/// Computes the restricted Damerau-Levenstein edit distance, +/// Computes the restricted Damerau-Levenshtein edit distance, /// also known as the "optimal string alignment" distance. /// - read more at https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance /// - Implementation taken from http://www.navision-blog.de/2008/11/01/damerau-levenshtein-distance-in-fsharp-part-ii/ diff --git a/src/Compiler/Utilities/FileSystem.fs b/src/Compiler/Utilities/FileSystem.fs index c2f4636ce8a..cb8c1cdbea8 100644 --- a/src/Compiler/Utilities/FileSystem.fs +++ b/src/Compiler/Utilities/FileSystem.fs @@ -427,7 +427,7 @@ module internal FileSystemUtils = if not (hasExtensionWithValidate false path) then raise (ArgumentException("chopExtension")) // message has to be precisely this, for OCaml compatibility, and no argument name can be set - Path.Combine(Path.GetDirectoryName path, Path.GetFileNameWithoutExtension(path)) + Path.Combine(!! Path.GetDirectoryName(path), !! Path.GetFileNameWithoutExtension(path)) let fileNameOfPath path = checkPathForIllegalChars path @@ -528,7 +528,7 @@ type DefaultFileSystem() as this = let fileStream = new FileStream(filePath, fileMode, fileAccess, fileShare) let length = fileStream.Length - // We want to use mmaped files only when: + // We want to use mmapped files only when: // - Opening large binary files (no need to use for source or resource files really) if not useMemoryMappedFile then @@ -694,15 +694,19 @@ type DefaultFileSystem() as this = default _.IsStableFileHeuristic(fileName: string) = let directory = Path.GetDirectoryName fileName - directory.Contains("Reference Assemblies/") - || directory.Contains("Reference Assemblies\\") - || directory.Contains("packages/") - || directory.Contains("packages\\") - || directory.Contains("lib/mono/") + match directory with + | Null -> false + | NonNull directory -> + directory.Contains("Reference Assemblies/") + || directory.Contains("Reference Assemblies\\") + || directory.Contains("packages/") + || directory.Contains("packages\\") + || directory.Contains("lib/mono/") abstract ChangeExtensionShim: path: string * extension: string -> string - default _.ChangeExtensionShim(path: string, extension: string) : string = Path.ChangeExtension(path, extension) + default _.ChangeExtensionShim(path: string, extension: string) : string = + !! Path.ChangeExtension(path, extension) interface IFileSystem with member _.AssemblyLoader = this.AssemblyLoader @@ -820,7 +824,7 @@ module public StreamExtensions = use sr = new StreamReader(s, encoding, true) while not <| sr.EndOfStream do - yield sr.ReadLine() + yield !! sr.ReadLine() } member s.ReadAllLines(?encoding: Encoding) : string array = diff --git a/src/Compiler/Utilities/HashMultiMap.fs b/src/Compiler/Utilities/HashMultiMap.fs index b88af5d77eb..c0fc897121d 100644 --- a/src/Compiler/Utilities/HashMultiMap.fs +++ b/src/Compiler/Utilities/HashMultiMap.fs @@ -3,44 +3,60 @@ namespace Internal.Utilities.Collections open System.Collections.Generic +open System.Collections.Concurrent // Each entry in the HashMultiMap dictionary has at least one entry. Under normal usage each entry has _only_ // one entry. So use two hash tables: one for the main entries and one for the overflow. [] -type internal HashMultiMap<'Key, 'Value>(size: int, comparer: IEqualityComparer<'Key>) = - - let firstEntries = Dictionary<_, _>(size, comparer) - - let rest = Dictionary<_, _>(3, comparer) - - new(comparer: IEqualityComparer<'Key>) = HashMultiMap<'Key, 'Value>(11, comparer) - - new(entries: seq<'Key * 'Value>, comparer: IEqualityComparer<'Key>) as x = - new HashMultiMap<'Key, 'Value>(11, comparer) - then entries |> Seq.iter (fun (k, v) -> x.Add(k, v)) - - member x.GetRest(k) = +type internal HashMultiMap<'Key, 'Value +#if !NO_CHECKNULLS + when 'Key:not null +#endif + >(size: int, comparer: IEqualityComparer<'Key>, ?useConcurrentDictionary: bool) = + + let comparer = comparer + + let firstEntries: IDictionary<_, _> = + if defaultArg useConcurrentDictionary false then + ConcurrentDictionary<_, _>(comparer) + else + Dictionary<_, _>(size, comparer) + + let rest: IDictionary<_, _> = + if defaultArg useConcurrentDictionary false then + ConcurrentDictionary<_, _>(comparer) + else + Dictionary<_, _>(3, comparer) + + new(comparer: IEqualityComparer<'Key>, ?useConcurrentDictionary: bool) = + HashMultiMap<'Key, 'Value>(11, comparer, defaultArg useConcurrentDictionary false) + + new(entries: seq<'Key * 'Value>, comparer: IEqualityComparer<'Key>, ?useConcurrentDictionary: bool) as this = + HashMultiMap<'Key, 'Value>(11, comparer, defaultArg useConcurrentDictionary false) + then entries |> Seq.iter (fun (k, v) -> this.Add(k, v)) + + member _.GetRest(k) = match rest.TryGetValue k with | true, res -> res | _ -> [] - member x.Add(y, z) = + member this.Add(y, z) = match firstEntries.TryGetValue y with - | true, res -> rest[y] <- res :: x.GetRest(y) + | true, res -> rest[y] <- res :: this.GetRest(y) | _ -> () firstEntries[y] <- z - member x.Clear() = + member _.Clear() = firstEntries.Clear() rest.Clear() - member x.FirstEntries = firstEntries + member _.FirstEntries = firstEntries - member x.Rest = rest + member _.Rest = rest - member x.Copy() = - let res = HashMultiMap<'Key, 'Value>(firstEntries.Count, firstEntries.Comparer) + member _.Copy() = + let res = HashMultiMap<'Key, 'Value>(firstEntries.Count, comparer) for kvp in firstEntries do res.FirstEntries.Add(kvp.Key, kvp.Value) @@ -86,11 +102,11 @@ type internal HashMultiMap<'Key, 'Value>(size: int, comparer: IEqualityComparer< for z in rest do f kvp.Key z - member x.Contains(y) = firstEntries.ContainsKey(y) + member _.Contains(y) = firstEntries.ContainsKey(y) - member x.ContainsKey(y) = firstEntries.ContainsKey(y) + member _.ContainsKey(y) = firstEntries.ContainsKey(y) - member x.Remove(y) = + member _.Remove(y) = match firstEntries.TryGetValue y with // NOTE: If not ok then nothing to remove - nop | true, _res -> @@ -108,14 +124,14 @@ type internal HashMultiMap<'Key, 'Value>(size: int, comparer: IEqualityComparer< | _ -> firstEntries.Remove(y) |> ignore | _ -> () - member x.Replace(y, z) = firstEntries[y] <- z + member _.Replace(y, z) = firstEntries[y] <- z - member x.TryFind(y) = + member _.TryFind(y) = match firstEntries.TryGetValue y with | true, res -> Some res | _ -> None - member x.Count = firstEntries.Count + member _.Count = firstEntries.Count interface IEnumerable> with @@ -184,6 +200,6 @@ type internal HashMultiMap<'Key, 'Value>(size: int, comparer: IEqualityComparer< member s.CopyTo(arr, arrIndex) = s |> Seq.iteri (fun j x -> arr[arrIndex + j] <- x) - member s.IsReadOnly = false + member _.IsReadOnly = false member s.Count = s.Count diff --git a/src/Compiler/Utilities/HashMultiMap.fsi b/src/Compiler/Utilities/HashMultiMap.fsi index a4dd51a5bba..6a4ba2ce119 100644 --- a/src/Compiler/Utilities/HashMultiMap.fsi +++ b/src/Compiler/Utilities/HashMultiMap.fsi @@ -7,16 +7,20 @@ open System.Collections.Generic /// Hash tables, by default based on F# structural "hash" and (=) functions. /// The table may map a single key to multiple bindings. [] -type internal HashMultiMap<'Key, 'Value> = +type internal HashMultiMap<'Key, 'Value +#if !NO_CHECKNULLS + when 'Key:not null +#endif + > = /// Create a new empty mutable HashMultiMap with the given key hash/equality functions. - new: comparer: IEqualityComparer<'Key> -> HashMultiMap<'Key, 'Value> + new: comparer: IEqualityComparer<'Key> * ?useConcurrentDictionary: bool -> HashMultiMap<'Key, 'Value> /// Create a new empty mutable HashMultiMap with an internal bucket array of the given approximate size /// and with the given key hash/equality functions. - new: size: int * comparer: IEqualityComparer<'Key> -> HashMultiMap<'Key, 'Value> + new: size: int * comparer: IEqualityComparer<'Key> * ?useConcurrentDictionary: bool -> HashMultiMap<'Key, 'Value> /// Build a map that contains the bindings of the given IEnumerable. - new: entries: seq<'Key * 'Value> * comparer: IEqualityComparer<'Key> -> HashMultiMap<'Key, 'Value> + new: entries: seq<'Key * 'Value> * comparer: IEqualityComparer<'Key> * ?useConcurrentDictionary: bool -> HashMultiMap<'Key, 'Value> /// Make a shallow copy of the collection. member Copy: unit -> HashMultiMap<'Key, 'Value> diff --git a/src/Compiler/Utilities/InternalCollections.fs b/src/Compiler/Utilities/InternalCollections.fs index ed086e544cc..07bbcf3d3d0 100755 --- a/src/Compiler/Utilities/InternalCollections.fs +++ b/src/Compiler/Utilities/InternalCollections.fs @@ -24,7 +24,7 @@ type internal AgedLookup<'Token, 'Key, 'Value when 'Value: not struct>(keepStron let mutable keepMax = max keepStrongly keepMax let requiredToKeep = defaultArg requiredToKeep (fun _ -> false) - /// Look up a the given key, return None if not found. + /// Look up the given key, return None if not found. let TryPeekKeyValueImpl (data, key) = let rec Lookup key = function diff --git a/src/Compiler/Utilities/LruCache.fs b/src/Compiler/Utilities/LruCache.fs index 62abc1d829c..92f73885eb7 100644 --- a/src/Compiler/Utilities/LruCache.fs +++ b/src/Compiler/Utilities/LruCache.fs @@ -6,6 +6,7 @@ open System open System.Collections.Generic open System.Diagnostics +open Internal.Utilities.Library open Internal.Utilities.Library.Extras [] @@ -22,7 +23,12 @@ type internal ValueLink<'T when 'T: not struct> = | Weak of WeakReference<'T> [] -type internal LruCache<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'TVersion: equality and 'TValue: not struct> +type internal LruCache<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'TVersion: equality and 'TValue: not struct +#if !NO_CHECKNULLS + and 'TKey:not null + and 'TVersion:not null +#endif + > (keepStrongly, ?keepWeakly, ?requiredToKeep, ?event) = let keepWeakly = defaultArg keepWeakly 100 @@ -35,8 +41,10 @@ type internal LruCache<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'TVers let strongList = LinkedList<'TKey * 'TVersion * string * ValueLink<'TValue>>() let weakList = LinkedList<'TKey * 'TVersion * string * ValueLink<'TValue>>() - let rec removeCollected (node: LinkedListNode<_>) = - if node <> null then + let rec removeCollected (possiblyNullNode: LinkedListNode<_> MaybeNull) = + match possiblyNullNode with + | null -> () + | node -> let key, version, label, value = node.Value match value with @@ -64,9 +72,10 @@ type internal LruCache<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'TVers let mutable node = weakList.Last while weakList.Count > keepWeakly && node <> null do - let previous = node.Previous - let key, version, label, _ = node.Value - weakList.Remove node + let notNullNode = !! node + let previous = notNullNode.Previous + let key, version, label, _ = notNullNode.Value + weakList.Remove notNullNode dictionary[key].Remove version |> ignore if dictionary[key].Count = 0 then @@ -81,14 +90,15 @@ type internal LruCache<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'TVers let mutable anythingWeakened = false while strongList.Count > keepStrongly && node <> null do - let previous = node.Previous + let notNullNode = !! node + let previous = notNullNode.Previous - match node.Value with + match notNullNode.Value with | _, _, _, Strong v when requiredToKeep v -> () | key, version, label, Strong v -> - strongList.Remove node - node.Value <- key, version, label, Weak(WeakReference<_> v) - weakList.AddFirst node + strongList.Remove notNullNode + notNullNode.Value <- key, version, label, Weak(WeakReference<_> v) + weakList.AddFirst notNullNode event CacheEvent.Weakened (label, key, version) anythingWeakened <- true | _key, _version, _label, _ -> failwith "Invalid state, weak reference in strong list" diff --git a/src/Compiler/Utilities/LruCache.fsi b/src/Compiler/Utilities/LruCache.fsi index d4d4d5ea83f..5979304f163 100644 --- a/src/Compiler/Utilities/LruCache.fsi +++ b/src/Compiler/Utilities/LruCache.fsi @@ -12,7 +12,12 @@ type internal CacheEvent = /// /// It's also versioned, meaning each key can have multiple versions and only the latest one is kept strongly. /// Older versions are kept weakly and can be collected by GC. -type internal LruCache<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'TVersion: equality and 'TValue: not struct> = +type internal LruCache<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'TVersion: equality and 'TValue: not struct +#if !NO_CHECKNULLS + and 'TKey:not null + and 'TVersion:not null +#endif + > = /// Maximum number of strongly held results to keep in the cache /// Maximum number of weakly held results to keep in the cache diff --git a/src/Compiler/Utilities/NullnessShims.fs b/src/Compiler/Utilities/NullnessShims.fs new file mode 100644 index 00000000000..785a6c6a3b8 --- /dev/null +++ b/src/Compiler/Utilities/NullnessShims.fs @@ -0,0 +1,72 @@ +namespace Internal.Utilities.Library + +open System + +[] +module internal NullnessShims = + + let inline isNotNull (x: 'T) = not (isNull x) + +#if NO_CHECKNULLS || BUILDING_WITH_LKG + type 'T MaybeNull when 'T: not struct = 'T + type objnull = obj + + let inline (^) (a: 'a) ([] b: 'a -> 'b) : 'b = + match a with + | null -> Unchecked.defaultof<'b> + | _ -> b a + + let inline (|NonNullQuick|) (x: 'T MaybeNull) = + match x with + | null -> raise (NullReferenceException()) + | v -> v + + let inline nonNull<'T when 'T:not struct and 'T:null> (x: 'T MaybeNull ) = + match x with + | null -> raise (NullReferenceException()) + | v -> v + + let inline (|Null|NonNull|) (x: 'T MaybeNull) : Choice = + match x with + | null -> Null + | v -> NonNull v + + let inline nullArgCheck paramName (x: 'T MaybeNull) = + if isNull (box x) then raise (ArgumentNullException(paramName)) + else x + + let inline (!!) x = x + + let inline defaultIfNull defaultValue arg = match arg with | null -> defaultValue | _ -> arg + + let inline nullSafeEquality (x: MaybeNull<'T>) (y: MaybeNull<'T>) ([]nonNullEqualityFunc:'T->'T->bool) = + match box x, box y with + | null, null -> true + | null,_ | _, null -> false + | _,_ -> nonNullEqualityFunc x y +#else + type 'T MaybeNull when 'T: not null and 'T: not struct = 'T | null + + let inline (^) (a: 'a | null) ([] b: 'a -> 'b) : ('b | null) = + match a with + | Null -> null + | NonNull v -> b v + + let inline (!!) (x:'T | null) = Unchecked.nonNull x + + let inline nullSafeEquality (x: MaybeNull<'T>) (y: MaybeNull<'T>) ([]nonNullEqualityFunc:'T->'T->bool) = + match x, y with + | null, null -> true + | null,_ | _, null -> false + | x, y -> nonNullEqualityFunc !!x !!y + +#endif + + + + [] + let inline (|NonEmptyString|_|) (x: string MaybeNull) = + match x with + | null -> ValueNone + | "" -> ValueNone + | v -> ValueSome v \ No newline at end of file diff --git a/src/Compiler/Utilities/TaggedCollections.fs b/src/Compiler/Utilities/TaggedCollections.fs index 814a7afbc0a..4676c2673a0 100644 --- a/src/Compiler/Utilities/TaggedCollections.fs +++ b/src/Compiler/Utilities/TaggedCollections.fs @@ -9,6 +9,7 @@ namespace Internal.Utilities.Collections.Tagged open Microsoft.FSharp.Core open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators open System.Collections.Generic +open Internal.Utilities.Library [] [] @@ -141,7 +142,7 @@ module SetTree = | _ -> add comparer k (add comparer t2.Key t1) | _ -> add comparer k (add comparer t1.Key t2) - let rec split (comparer: IComparer<'T>) pivot (t: SetTree<'T>) = + let rec split (comparer: IComparer<'T>) (pivot: 'T) (t: SetTree<'T>) = // Given a pivot and a set t // Return { x in t s.t. x < pivot }, pivot in t?, { x in t s.t. x > pivot } if isEmpty t then @@ -178,7 +179,7 @@ module SetTree = let k3, l' = spliceOutSuccessor tn.Left in k3, mk l' tn.Key tn.Right | _ -> t.Key, empty - let rec remove (comparer: IComparer<'T>) k (t: SetTree<'T>) = + let rec remove (comparer: IComparer<'T>) (k: 'T) (t: SetTree<'T>) = if isEmpty t then t else @@ -200,7 +201,7 @@ module SetTree = rebalance tn.Left tn.Key (remove comparer k tn.Right) | _ -> if c = 0 then empty else t - let rec contains (comparer: IComparer<'T>) k (t: SetTree<'T>) = + let rec contains (comparer: IComparer<'T>) (k: 'T) (t: SetTree<'T>) = if isEmpty t then false else @@ -809,7 +810,7 @@ module MapTree = let indexNotFound () = raise (KeyNotFoundException("An index satisfying the predicate was not found in the collection")) - let rec tryGetValue (comparer: IComparer<'Key>) k (v: byref<'Value>) (m: MapTree<'Key, 'Value>) = + let rec tryGetValue (comparer: IComparer<'Key>) (k: 'Key) (v: byref<'Value>) (m: MapTree<'Key, 'Value>) = if isEmpty m then false else @@ -823,7 +824,7 @@ module MapTree = | :? MapTreeNode<'Key, 'Value> as mn -> tryGetValue comparer k &v (if c < 0 then mn.Left else mn.Right) | _ -> false - let find (comparer: IComparer<'Key>) k (m: MapTree<'Key, 'Value>) = + let find (comparer: IComparer<'Key>) (k: 'Key) (m: MapTree<'Key, 'Value>) = let mutable v = Unchecked.defaultof<'Value> if tryGetValue comparer k &v m then v else indexNotFound () diff --git a/src/Compiler/Utilities/illib.fs b/src/Compiler/Utilities/illib.fs index ec797443dd0..6c5a52a2fd8 100644 --- a/src/Compiler/Utilities/illib.fs +++ b/src/Compiler/Utilities/illib.fs @@ -16,29 +16,31 @@ type InterruptibleLazy<'T> private (value, valueFactory: unit -> 'T) = let syncObj = obj () [] - let mutable valueFactory = valueFactory + // TODO nullness - this is boxed to obj because of an attribute targets bug fixed in main, but not yet shipped (needs shipped 8.0.400) + let mutable valueFactory : objnull = valueFactory + let mutable value = value new(valueFactory: unit -> 'T) = InterruptibleLazy(Unchecked.defaultof<_>, valueFactory) member this.IsValueCreated = - match box valueFactory with + match valueFactory with | null -> true | _ -> false member this.Value = - match box valueFactory with + match valueFactory with | null -> value | _ -> Monitor.Enter(syncObj) try - match box valueFactory with + match valueFactory with | null -> () | _ -> - value <- valueFactory () + value <- (valueFactory |> unbox 'T>) () valueFactory <- Unchecked.defaultof<_> finally Monitor.Exit(syncObj) @@ -85,30 +87,6 @@ module internal PervasiveAutoOpens = | [ _ ] -> true | _ -> false - type 'T MaybeNull when 'T: null and 'T: not struct = 'T - - let inline isNotNull (x: 'T) = not (isNull x) - - let inline (|NonNullQuick|) (x: 'T MaybeNull) = - match x with - | null -> raise (NullReferenceException()) - | v -> v - - let inline nonNull (x: 'T MaybeNull) = - match x with - | null -> raise (NullReferenceException()) - | v -> v - - let inline (|Null|NonNull|) (x: 'T MaybeNull) : Choice = - match x with - | null -> Null - | v -> NonNull v - - let inline nullArgCheck paramName (x: 'T MaybeNull) = - match x with - | null -> raise (ArgumentNullException(paramName)) - | v -> v - let inline (===) x y = LanguagePrimitives.PhysicalEquality x y /// Per the docs the threshold for the Large Object Heap is 85000 bytes: https://learn.microsoft.com/dotnet/standard/garbage-collection/large-object-heap#how-an-object-ends-up-on-the-large-object-heap-and-how-gc-handles-them @@ -126,7 +104,7 @@ module internal PervasiveAutoOpens = member inline x.EndsWithOrdinalIgnoreCase value = x.EndsWith(value, StringComparison.OrdinalIgnoreCase) - member inline x.IndexOfOrdinal value = + member inline x.IndexOfOrdinal (value:string) = x.IndexOf(value, StringComparison.Ordinal) member inline x.IndexOfOrdinal(value, startIndex) = @@ -142,17 +120,15 @@ module internal PervasiveAutoOpens = | Some x -> x let reportTime = - let mutable tPrev: IDisposable = null + let mutable tPrev: IDisposable MaybeNull = null fun descr -> if isNotNull tPrev then tPrev.Dispose() + tPrev <- null - tPrev <- - if descr <> "Finish" then - FSharp.Compiler.Diagnostics.Activity.Profiling.startAndMeasureEnvironmentStats descr - else - null + if descr <> "Finish" then + tPrev <- FSharp.Compiler.Diagnostics.Activity.Profiling.startAndMeasureEnvironmentStats descr let foldOn p f z x = f z (p x) @@ -178,8 +154,8 @@ module internal PervasiveAutoOpens = type DelayInitArrayMap<'T, 'TDictKey, 'TDictValue>(f: unit -> 'T[]) = let syncObj = obj () - let mutable arrayStore = null - let mutable dictStore = null + let mutable arrayStore : _ array MaybeNull = null + let mutable dictStore : _ MaybeNull = null let mutable func = f @@ -193,11 +169,11 @@ type DelayInitArrayMap<'T, 'TDictKey, 'TDictValue>(f: unit -> 'T[]) = match arrayStore with | NonNull value -> value | _ -> - - arrayStore <- func () + let freshArray = func () + arrayStore <- freshArray func <- Unchecked.defaultof<_> - arrayStore + freshArray finally Monitor.Exit(syncObj) @@ -212,9 +188,9 @@ type DelayInitArrayMap<'T, 'TDictKey, 'TDictValue>(f: unit -> 'T[]) = match dictStore with | NonNull value -> value | _ -> - - dictStore <- this.CreateDictionary(array) - dictStore + let dict = this.CreateDictionary(array) + dictStore <- dict + dict finally Monitor.Exit(syncObj) @@ -227,7 +203,7 @@ type DelayInitArrayMap<'T, 'TDictKey, 'TDictValue>(f: unit -> 'T[]) = module Order = let orderBy (p: 'T -> 'U) = { new IComparer<'T> with - member _.Compare(x, xx) = compare (p x) (p xx) + member _.Compare(x, xx) = compare (p !!x) (p !!xx) } let orderOn p (pxOrder: IComparer<'U>) = @@ -266,6 +242,7 @@ module Array = let order (eltOrder: IComparer<'T>) = { new IComparer<'T array> with member _.Compare(xs, ys) = + let xs,ys = nullArgCheck "xs" xs, nullArgCheck "ys" ys let c = compare xs.Length ys.Length if c <> 0 then @@ -361,10 +338,7 @@ module Array = /// ~0.8x slower for ints let inline areEqual (xs: 'T[]) (ys: 'T[]) = match xs, ys with - | null, null -> true | [||], [||] -> true - | null, _ - | _, null -> false | _ when xs.Length <> ys.Length -> false | _ -> let mutable break' = false @@ -438,6 +412,9 @@ module Option = with _ -> None +module internal ValueTuple = + let inline map1Of2 ([]f) struct(a1, a2) = struct(f a1, a2) + module List = let sortWithOrder (c: IComparer<'T>) elements = @@ -562,6 +539,7 @@ module List = let order (eltOrder: IComparer<'T>) = { new IComparer<'T list> with member _.Compare(xs, ys) = + let xs,ys = nullArgCheck "xs" xs, nullArgCheck "ys" ys let rec loop xs ys = match xs, ys with | [], [] -> 0 @@ -664,6 +642,22 @@ module List = | Some x -> x :: l | _ -> l + + [] + let rec private vMapFoldWithAcc<'T, 'State, 'Result> (mapping: 'State -> 'T -> struct('Result * 'State)) state list acc : struct('Result list * 'State) = + match list with + | [] -> acc, state + | [h] -> + mapping state h + |> ValueTuple.map1Of2 (fun x -> x::acc) + | h :: t -> + let struct(mappedHead, stateHead) = mapping state h + vMapFoldWithAcc mapping stateHead t (mappedHead :: acc) + + let vMapFold<'T, 'State, 'Result> (mapping: 'State -> 'T -> struct('Result * 'State)) state list : struct('Result list * 'State) = + vMapFoldWithAcc mapping state list [] + |> ValueTuple.map1Of2 List.rev + module ResizeArray = /// Split a ResizeArray into an array of smaller chunks. @@ -749,7 +743,7 @@ module String = let uppercase (s: string) = s.ToUpperInvariant() // Scripts that distinguish between upper and lower case (bicameral) DU Discriminators and Active Pattern identifiers are required to start with an upper case character. - // For valid identifiers where the case of the identifier can not be determined because there is no upper and lower case we will allow DU Discriminators and upper case characters + // For valid identifiers where the case of the identifier cannot be determined because there is no upper and lower case we will allow DU Discriminators and upper case characters // to be used. This means that developers using unicameral scripts such as hindi, are not required to prefix these identifiers with an Upper case latin character. // let isLeadingIdentifierCharacterUpperCase (s: string) = @@ -811,13 +805,16 @@ module String = let (|StartsWith|_|) pattern value = if String.IsNullOrWhiteSpace value then None - elif value.StartsWithOrdinal pattern then Some() + elif (!!value).StartsWithOrdinal pattern then Some() else None - let (|Contains|_|) pattern value = - if String.IsNullOrWhiteSpace value then None - elif value.Contains pattern then Some() - else None + let (|Contains|_|) (pattern:string) value = + match value with + | value when String.IsNullOrWhiteSpace value -> None + | null -> None + | value -> + if value.Contains pattern then Some() + else None let getLines (str: string) = use reader = new StringReader(str) @@ -956,7 +953,11 @@ module ResultOrException = | Exception _err -> f () /// Generates unique stamps -type UniqueStampGenerator<'T when 'T: equality>() = +type UniqueStampGenerator<'T when 'T: equality +#if !NO_CHECKNULLS + and 'T:not null +#endif + >() = let encodeTable = ConcurrentDictionary<'T, Lazy>(HashIdentity.Structural) let mutable nItems = -1 @@ -968,7 +969,11 @@ type UniqueStampGenerator<'T when 'T: equality>() = member _.Table = encodeTable.Keys /// memoize tables (all entries cached, never collected) -type MemoizationTable<'T, 'U>(compute: 'T -> 'U, keyComparer: IEqualityComparer<'T>, ?canMemoize) = +type MemoizationTable<'T, 'U +#if !NO_CHECKNULLS + when 'T:not null +#endif + >(compute: 'T -> 'U, keyComparer: IEqualityComparer<'T>, ?canMemoize) = let table = new ConcurrentDictionary<'T, Lazy<'U>>(keyComparer) let computeFunc = Func<_, _>(fun key -> lazy (compute key)) @@ -984,7 +989,11 @@ type MemoizationTable<'T, 'U>(compute: 'T -> 'U, keyComparer: IEqualityComparer< compute x /// A thread-safe lookup table which is assigning an auto-increment stamp with each insert -type internal StampedDictionary<'T, 'U>(keyComparer: IEqualityComparer<'T>) = +type internal StampedDictionary<'T, 'U +#if !NO_CHECKNULLS + when 'T:not null +#endif + >(keyComparer: IEqualityComparer<'T>) = let table = new ConcurrentDictionary<'T, Lazy>(keyComparer) let mutable count = -1 @@ -1026,7 +1035,7 @@ type LazyWithContext<'T, 'Ctxt> = /// This field holds either the function to run or a LazyWithContextFailure object recording the exception raised /// from running the function. It is null if the thunk has been evaluated successfully. - mutable funcOrException: obj + mutable funcOrException: objnull /// A helper to ensure we rethrow the "original" exception findOriginalException: exn -> exn @@ -1113,7 +1122,7 @@ module IPartialEqualityComparer = let On f (c: IPartialEqualityComparer<_>) = { new IPartialEqualityComparer<_> with member _.InEqualityRelation x = c.InEqualityRelation(f x) - member _.Equals(x, y) = c.Equals(f x, f y) + member _.Equals(x, y) = c.Equals(f !!x, f !!y) member _.GetHashCode x = c.GetHashCode(f x) } diff --git a/src/Compiler/Utilities/illib.fsi b/src/Compiler/Utilities/illib.fsi index a9ee48c4be9..be4edea38f9 100644 --- a/src/Compiler/Utilities/illib.fsi +++ b/src/Compiler/Utilities/illib.fsi @@ -41,25 +41,6 @@ module internal PervasiveAutoOpens = /// Returns true if the list contains exactly 1 element. Otherwise false. val inline isSingleton: l: 'a list -> bool - /// Returns true if the argument is non-null. - val inline isNotNull: x: 'T -> bool when 'T: null - - /// Indicates that a type may be null. 'MaybeNull' is used internally in the F# compiler as - /// replacement for 'string?' to align with FS-1060. - type 'T MaybeNull when 'T: null and 'T: not struct = 'T - - /// Asserts the argument is non-null and raises an exception if it is - val inline (|NonNullQuick|): 'T MaybeNull -> 'T - - /// Match on the nullness of an argument. - val inline (|Null|NonNull|): 'T MaybeNull -> Choice - - /// Asserts the argument is non-null and raises an exception if it is - val inline nonNull: x: 'T MaybeNull -> 'T - - /// Checks the argument is non-null - val inline nullArgCheck: paramName: string -> x: 'T MaybeNull -> 'T - val inline (===): x: 'a -> y: 'a -> bool when 'a: not struct /// Per the docs the threshold for the Large Object Heap is 85000 bytes: https://learn.microsoft.com/dotnet/standard/garbage-collection/large-object-heap#how-an-object-ends-up-on-the-large-object-heap-and-how-gc-handles-them @@ -105,7 +86,12 @@ type DelayInitArrayMap<'T, 'TDictKey, 'TDictValue> = module internal Order = - val orderBy: p: ('T -> 'U) -> IComparer<'T> when 'U: comparison + val orderBy: p: ('T -> 'U) -> IComparer<'T> + when 'U: comparison +#if !NO_CHECKNULLS + and 'T:not null + and 'T:not struct +#endif val orderOn: p: ('T -> 'U) -> pxOrder: IComparer<'U> -> IComparer<'T> @@ -240,6 +226,8 @@ module internal List = val prependIfSome: x: 'a option -> l: 'a list -> 'a list + val vMapFold<'T,'State,'Result> : mapping:('State -> 'T -> struct('Result * 'State)) -> state:'State -> list:'T list -> struct('Result list * 'State) + module internal ResizeArray = /// Split a ResizeArray into an array of smaller chunks. @@ -395,7 +383,11 @@ module internal ResultOrException = val otherwise: f: (unit -> ResultOrException<'a>) -> x: ResultOrException<'a> -> ResultOrException<'a> /// Generates unique stamps -type internal UniqueStampGenerator<'T when 'T: equality> = +type internal UniqueStampGenerator<'T when 'T: equality +#if !NO_CHECKNULLS + and 'T:not null +#endif + > = new: unit -> UniqueStampGenerator<'T> @@ -404,7 +396,11 @@ type internal UniqueStampGenerator<'T when 'T: equality> = member Table: ICollection<'T> /// Memoize tables (all entries cached, never collected unless whole table is collected) -type internal MemoizationTable<'T, 'U> = +type internal MemoizationTable<'T, 'U +#if !NO_CHECKNULLS + when 'T:not null +#endif + > = new: compute: ('T -> 'U) * keyComparer: IEqualityComparer<'T> * ?canMemoize: ('T -> bool) -> MemoizationTable<'T, 'U> @@ -412,7 +408,11 @@ type internal MemoizationTable<'T, 'U> = member Apply: x: 'T -> 'U /// A thread-safe lookup table which is assigning an auto-increment stamp with each insert -type internal StampedDictionary<'T, 'U> = +type internal StampedDictionary<'T, 'U +#if !NO_CHECKNULLS + when 'T:not null +#endif + > = new: keyComparer: IEqualityComparer<'T> -> StampedDictionary<'T, 'U> @@ -445,7 +445,11 @@ type internal LazyWithContext<'T, 'ctxt> = /// Intern tables to save space. module internal Tables = - val memoize: f: ('a -> 'b) -> ('a -> 'b) when 'a: equality + val memoize: f: ('a -> 'b) -> ('a -> 'b) + when 'a: equality +#if !NO_CHECKNULLS && NET8_0_OR_GREATER + and 'a:not null +#endif /// Interface that defines methods for comparing objects using partial equality relation type internal IPartialEqualityComparer<'T> = @@ -455,6 +459,10 @@ type internal IPartialEqualityComparer<'T> = /// Interface that defines methods for comparing objects using partial equality relation module internal IPartialEqualityComparer = val On: f: ('a -> 'b) -> c: IPartialEqualityComparer<'b> -> IPartialEqualityComparer<'a> +#if !NO_CHECKNULLS + when 'a:not null + and 'a:not struct +#endif /// Like Seq.distinctBy but only filters out duplicates for some of the elements val partialDistinctBy: per: IPartialEqualityComparer<'T> -> seq: 'T list -> 'T list diff --git a/src/Compiler/Utilities/lib.fs b/src/Compiler/Utilities/lib.fs index 87e50acd74a..921b0a6dba3 100755 --- a/src/Compiler/Utilities/lib.fs +++ b/src/Compiler/Utilities/lib.fs @@ -330,15 +330,15 @@ type Graph<'Data, 'Id when 'Id : comparison and 'Id : equality> // with care. //---------------------------------------------------------------------------- -type NonNullSlot<'T> = 'T -let nullableSlotEmpty() = Unchecked.defaultof<'T> -let nullableSlotFull x = x +type NonNullSlot<'T when 'T : not struct> = 'T +let nullableSlotEmpty() : NonNullSlot<'T> = Unchecked.defaultof<_> +let nullableSlotFull (x: 'T) : NonNullSlot<'T> = x //--------------------------------------------------------------------------- // Caches, mainly for free variables //--------------------------------------------------------------------------- -type cache<'T> = { mutable cacheVal: 'T NonNullSlot } +type cache<'T when 'T : not struct> = { mutable cacheVal: NonNullSlot<'T> } let newCache() = { cacheVal = nullableSlotEmpty() } let inline cached cache ([] resF) = diff --git a/src/Compiler/Utilities/lib.fsi b/src/Compiler/Utilities/lib.fsi index c7bccd4211d..cbdb893c5b8 100644 --- a/src/Compiler/Utilities/lib.fsi +++ b/src/Compiler/Utilities/lib.fsi @@ -228,24 +228,24 @@ type Graph<'Data, 'Id when 'Id: comparison> = /// This is an unsafe trick, as it relies on the fact that the type of values /// being placed into the slot never utilizes "null" as a representation. To be used with /// with care. -type NonNullSlot<'T> = 'T +type NonNullSlot<'T when 'T: not struct> = 'T -val nullableSlotEmpty: unit -> 'T +val nullableSlotEmpty: unit -> NonNullSlot<'T> -val nullableSlotFull: x: 'a -> 'a +val nullableSlotFull: x: 'a -> NonNullSlot<'a> /// Caches, mainly for free variables -type cache<'T> = { mutable cacheVal: NonNullSlot<'T> } +type cache<'T when 'T: not struct> = { mutable cacheVal: NonNullSlot<'T> } -val newCache: unit -> cache<'a> +val newCache: unit -> cache<'a> when 'a: not struct -val inline cached: cache: cache<'a> -> resF: (unit -> 'a) -> 'a +val inline cached: cache: cache<'a> -> resF: (unit -> 'a) -> 'a when 'a: not struct val inline cacheOptByref: cache: byref<'T option> -> f: (unit -> 'T) -> 'T val inline cacheOptRef: cache: 'a option ref -> f: (unit -> 'a) -> 'a -val inline tryGetCacheValue: cache: cache<'a> -> NonNullSlot<'a> voption +val inline tryGetCacheValue: cache: cache<'a> -> NonNullSlot<'a> voption when 'a: not struct [] type MaybeLazy<'T> = diff --git a/src/Compiler/Utilities/range.fs b/src/Compiler/Utilities/range.fs index 678ab07f452..6d0002a97ba 100755 --- a/src/Compiler/Utilities/range.fs +++ b/src/Compiler/Utilities/range.fs @@ -359,7 +359,7 @@ type Range(code1: int64, code2: int64) = if FileSystem.IsInvalidPathShim m.FileName then "path invalid: " + m.FileName elif not (FileSystem.FileExistsShim m.FileName) then - "non existing file: " + m.FileName + "nonexistent file: " + m.FileName else FileSystem.OpenFileForReadShim(m.FileName).ReadLines() |> Seq.skip (m.StartLine - 1) diff --git a/src/Compiler/Utilities/range.fsi b/src/Compiler/Utilities/range.fsi index 7b422fcd307..40a52efa879 100755 --- a/src/Compiler/Utilities/range.fsi +++ b/src/Compiler/Utilities/range.fsi @@ -39,7 +39,7 @@ type internal NotedSourceConstruct = /// This does include "expr; cexpr" sequentials where the "expr" is interpreted as an implicit yield + Combine call | Combine - /// Notes that a range is related to an implied "Delay"m "Quote" or "Run" at the entry to a computation expression. THis doesn't + /// Notes that a range is related to an implied "Delay"m "Quote" or "Run" at the entry to a computation expression. This doesn't /// apply to the "Delay" calls added for try/with, try/finally, while or for constructs. | DelayOrQuoteOrRun @@ -56,7 +56,7 @@ type Position = /// The encoding of the position as a 64-bit integer member internal Encoding: int64 - /// Check if the position is adjacent to another postition + /// Check if the position is adjacent to another position member internal IsAdjacentTo: otherPos: Position -> bool /// Decode a position fro a 64-bit integer diff --git a/src/Compiler/Utilities/sformat.fs b/src/Compiler/Utilities/sformat.fs index 2a11d4fee98..9279bf093d0 100644 --- a/src/Compiler/Utilities/sformat.fs +++ b/src/Compiler/Utilities/sformat.fs @@ -7,9 +7,6 @@ // The one implementation file is used because we keep the implementations of // structured formatting the same for fsi.exe and '%A' printing. However F# Interactive has // a richer feature set. - -#nowarn "52" // The value has been copied to ensure the original is not mutated by this operation - #if COMPILER namespace FSharp.Compiler.Text #else @@ -17,8 +14,14 @@ namespace FSharp.Compiler.Text namespace Microsoft.FSharp.Text.StructuredPrintfImpl #endif +#nowarn "52" // The value has been copied to ensure the original is not mutated by this operation +// 3261 and 3262 Nullness warnings - this waits for LKG update, since this file is included in fsharp.core and fsharp.compiler.service and goes via proto build. +// Supporting all possible combinations of available library+compiler versions would complicate code in this source files too much at the moment. +#nowarn "3261" +#nowarn "3262" + // Breakable block layout implementation. -// This is a fresh implementation of pre-existing ideas. +// This is a fresh implementation of preexisting ideas. open System open System.IO @@ -29,6 +32,9 @@ open Microsoft.FSharp.Core open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators open Microsoft.FSharp.Reflection open Microsoft.FSharp.Collections +#if COMPILER +open Internal.Utilities.Library +#endif [] type TextTag = @@ -116,6 +122,13 @@ type IEnvironment = abstract MaxColumns: int abstract MaxRows: int +#if NO_CHECKNULLS +[] +module NullShim = + // Shim to match nullness checking library support in preview + let inline (|Null|NonNull|) (x: 'T) : Choice = match x with null -> Null | v -> NonNull v +#endif + [] module TaggedText = let mkTag tag text = TaggedText(tag, text) @@ -255,6 +268,7 @@ module TaggedText = let keywordInline = tagKeyword "inline" let keywordModule = tagKeyword "module" let keywordNamespace = tagKeyword "namespace" + let keywordReturn = tagKeyword "return" let punctuationUnit = tagPunctuation "()" #endif @@ -409,7 +423,7 @@ type FormatOptions = FloatingPointFormat: string AttributeProcessor: string -> (string * string) list -> bool -> unit #if COMPILER // This is the PrintIntercepts extensibility point currently revealed by fsi.exe's AddPrinter - PrintIntercepts: (IEnvironment -> obj -> Layout option) list + PrintIntercepts: (IEnvironment -> objnull -> Layout option) list StringLimit: int #endif FormatProvider: IFormatProvider @@ -496,7 +510,7 @@ module ReflectUtils = // of an F# value. let GetValueInfoOfObject (bindingFlags: BindingFlags) (obj: obj) = match obj with - | null -> NullValue + | Null -> NullValue | _ -> let reprty = obj.GetType() @@ -561,9 +575,8 @@ module ReflectUtils = let GetValueInfo bindingFlags (x: 'a, ty: Type) (* x could be null *) = let obj = (box x) - match obj with - | null -> + | Null -> let isNullaryUnion = match ty.GetCustomAttributes(typeof, false) with | [| :? CompilationRepresentationAttribute as attr |] -> @@ -581,7 +594,8 @@ module ReflectUtils = UnitValue else NullValue - | _ -> GetValueInfoOfObject bindingFlags obj + | NonNull obj -> + GetValueInfoOfObject bindingFlags obj module Display = open ReflectUtils @@ -841,8 +855,8 @@ module Display = let getListValueInfo bindingFlags (x: obj, ty: Type) = match x with - | null -> None - | _ -> + | Null -> None + | NonNull x -> match Value.GetValueInfo bindingFlags (x, ty) with | UnionCaseValue("Cons", recd) -> Some(unpackCons recd) | UnionCaseValue("Empty", [||]) -> None @@ -936,7 +950,7 @@ module Display = // // Note: The layout code forces breaks based on leaf size and possible break points. // It does not force leaf size based on width. - // So long leaf-string width can not depend on their printing context... + // So long leaf-string width cannot depend on their printing context... // // The suffix like "+[dd chars]" is 11 chars. // 12345678901 @@ -1000,14 +1014,13 @@ module Display = and objL showMode depthLim prec (x: obj, ty: Type) = let info = Value.GetValueInfo bindingFlags (x, ty) - try if depthLim <= 0 || exceededPrintSize () then wordL (tagPunctuation "...") else match x with - | null -> reprL showMode (depthLim - 1) prec info x - | _ -> + | Null -> reprL showMode (depthLim - 1) prec info x + | NonNull x -> if (path.ContainsKey(x)) then wordL (tagPunctuation "...") else @@ -1021,10 +1034,9 @@ module Display = Some(wordL (tagText (x.ToString()))) else // Try the StructuredFormatDisplayAttribute extensibility attribute - match ty.GetCustomAttributes(typeof, true) with - | null - | [||] -> None - | res -> structuredFormatObjectL showMode ty depthLim (res[0] :?> StructuredFormatDisplayAttribute) x + match ty.GetCustomAttributes (typeof, true) with + | Null | [| |] -> None + | NonNull res -> structuredFormatObjectL showMode ty depthLim (res[0] :?> StructuredFormatDisplayAttribute) x #if COMPILER // This is the PrintIntercepts extensibility point currently revealed by fsi.exe's AddPrinter @@ -1057,8 +1069,7 @@ module Display = // Format an object that has a layout specified by StructuredFormatAttribute and structuredFormatObjectL showMode ty depthLim (attr: StructuredFormatDisplayAttribute) (obj: obj) = let txt = attr.Value - - if isNull txt || txt.Length <= 1 then + if isNull (box txt) || txt.Length <= 1 then None else @@ -1142,9 +1153,9 @@ module Display = let openingBracketIndex = postTextMatch.Groups["prop"].Index - 1 buildObjMessageL remainingPropertyText[openingBracketIndex..] newLayouts - | remaingPropertyText -> + | remainingPropertyText -> // make sure we don't have any stray brackets - let strayClosingMatch = illFormedBracketPatternLookup.IsMatch remaingPropertyText + let strayClosingMatch = illFormedBracketPatternLookup.IsMatch remainingPropertyText if strayClosingMatch then None @@ -1156,7 +1167,7 @@ module Display = List.rev ( (sepL (tagText preText) ^^ alternativeObjL - ^^ sepL (tagText (replaceEscapedBrackets (remaingPropertyText)))) + ^^ sepL (tagText (replaceEscapedBrackets (remainingPropertyText)))) :: layouts ) ) @@ -1523,7 +1534,7 @@ module Display = let leafFormatter (opts: FormatOptions) (obj: obj) = match obj with - | null -> tagKeyword "null" + | Null -> tagKeyword "null" | :? double as d -> let s = d.ToString(opts.FloatingPointFormat, opts.FormatProvider) @@ -1587,7 +1598,7 @@ module Display = match text with | null -> "" - | _ -> text + | text -> text with e -> // If a .ToString() call throws an exception, catch it and use the message as the result. // This may be informative, e.g. division by zero etc... diff --git a/src/Compiler/Utilities/sformat.fsi b/src/Compiler/Utilities/sformat.fsi index 1c740a38dce..af5b1e2f7d6 100644 --- a/src/Compiler/Utilities/sformat.fsi +++ b/src/Compiler/Utilities/sformat.fsi @@ -22,8 +22,8 @@ open System open System.IO open Microsoft.FSharp.Core open Microsoft.FSharp.Collections - #if COMPILER +open Internal.Utilities.Library /// Data representing joints in structured layouts of terms. The representation /// of this data type is only for the consumption of formatting engines. @@ -213,6 +213,7 @@ module internal TaggedText = val internal keywordInline: TaggedText val internal keywordModule: TaggedText val internal keywordNamespace: TaggedText + val internal keywordReturn: TaggedText val internal punctuationUnit: TaggedText type internal IEnvironment = @@ -365,7 +366,7 @@ type internal FormatOptions = { FloatingPointFormat: string AttributeProcessor: string -> (string * string) list -> bool -> unit #if COMPILER // FSharp.Core.dll: PrintIntercepts aren't used there - PrintIntercepts: (IEnvironment -> obj -> Layout option) list + PrintIntercepts: (IEnvironment -> objnull -> Layout option) list StringLimit: int #endif FormatProvider: IFormatProvider @@ -394,7 +395,7 @@ module internal Display = val output_layout_tagged: options: FormatOptions -> writer: TaggedTextWriter -> layout: Layout -> unit #else - // Most functions aren't needed in FSharp.Core.dll, but we add one inernal entry for printf + // Most functions aren't needed in FSharp.Core.dll, but we add one internal entry for printf val anyToStringForPrintf: options: FormatOptions -> bindingFlags: System.Reflection.BindingFlags -> value: 'T * Type -> string #endif diff --git a/src/Compiler/Utilities/sr.fs b/src/Compiler/Utilities/sr.fs index 840a9f4197c..9473cc8d78e 100644 --- a/src/Compiler/Utilities/sr.fs +++ b/src/Compiler/Utilities/sr.fs @@ -6,6 +6,7 @@ open System open Microsoft.FSharp.Core open Microsoft.FSharp.Collections open Microsoft.FSharp.Reflection +open Internal.Utilities.Library module internal SR = let private resources = @@ -20,7 +21,7 @@ module internal SR = if isNull s then System.Diagnostics.Debug.Assert(false, sprintf "**RESOURCE ERROR**: Resource token %s does not exist!" name) #endif - s + !!s module internal DiagnosticMessage = @@ -53,7 +54,7 @@ module internal DiagnosticMessage = // PERF: this technique is a bit slow (e.g. in simple cases, like 'sprintf "%x"') mkFunctionValue tys (fun inp -> impl rty inp) - let capture1 (fmt: string) i args ty (go: obj list -> System.Type -> int -> obj) : obj = + let capture1 (fmt: string) i args ty (go: objnull list -> System.Type -> int -> obj) : obj = match fmt[i] with | '%' -> go args ty (i + 1) | 'd' @@ -75,7 +76,7 @@ module internal DiagnosticMessage = if i >= len || (fmt[i] = '%' && i + 1 >= len) then let b = System.Text.StringBuilder() b.AppendFormat(messageString, (Array.ofList (List.rev args))) |> ignore - box (b.ToString()) + !!(box (b.ToString())) // REVIEW: For these purposes, this should be a nop, but I'm leaving it // in case we ever decide to support labels for the error format string // E.g., "%s%d" @@ -99,7 +100,7 @@ module internal DiagnosticMessage = // validate that the message string exists let fmtString = fmt.Value - if isNull messageString then + if isNull (box messageString) then System.Diagnostics.Debug.Assert(false, sprintf "**DECLARED MESSAGE ERROR** String resource %s does not exist" messageID) messageString <- "" @@ -149,7 +150,7 @@ module internal DiagnosticMessage = nFmt - let nHoles, holes = countFormatHoles messageString + let nHoles, holes = countFormatHoles !!messageString let nPlaceholders = countFormatPlaceholders fmtString // first, verify that the number of holes in the message string does not exceed the @@ -172,5 +173,5 @@ module internal DiagnosticMessage = ) #endif - messageString <- postProcessString messageString - new ResourceString<'T>(messageString, fmt) + messageString <- postProcessString !!messageString + new ResourceString<'T>(!!messageString, fmt) diff --git a/src/Compiler/lex.fsl b/src/Compiler/lex.fsl index cd73aa454c2..fd95cd3ebce 100644 --- a/src/Compiler/lex.fsl +++ b/src/Compiler/lex.fsl @@ -137,10 +137,14 @@ let startString args (lexbuf: UnicodeLexing.Lexbuf) = if kind.IsInterpolated then fail args lexbuf (FSComp.SR.lexByteStringMayNotBeInterpolated()) () BYTEARRAY (Lexhelp.stringBufferAsBytes buf, synByteStringKind, cont) - elif Lexhelp.stringBufferIsBytes buf then - BYTEARRAY (Lexhelp.stringBufferAsBytes buf, synByteStringKind, cont) else - fail args lexbuf (FSComp.SR.lexByteArrayCannotEncode()) () + match Lexhelp.errorsInByteStringBuffer buf with + | Some (largerThanOneByte, largerThan127) -> + if largerThanOneByte > 0 then + fail args lexbuf (FSComp.SR.lexByteArrayCannotEncode(largerThanOneByte)) () + if largerThan127 > 0 then + warning (Error(FSComp.SR.lexByteArrayOutisdeAscii(largerThan127), lexbuf.LexemeRange)) + | None -> () BYTEARRAY (Lexhelp.stringBufferAsBytes buf, synByteStringKind, cont) elif kind.IsInterpolated then let s = Lexhelp.stringBufferAsString buf @@ -518,7 +522,7 @@ rule token (args: LexArgs) (skip: bool) = parse { let s = lexeme lexbuf let x = int32 (if s.[1] = '\\' then escape s.[2] else s.[1]) if x < 0 || x > 127 then - fail args lexbuf (FSComp.SR.lexInvalidByteLiteral()) (UINT8(byte 0)) + fail args lexbuf (FSComp.SR.lexInvalidAsciiByteLiteral()) (UINT8(byte 0)) else UINT8 (byte(x)) } @@ -535,26 +539,50 @@ rule token (args: LexArgs) (skip: bool) = parse { let s = lexeme lexbuf let x = int32 (trigraph s.[2] s.[3] s.[4]) if x < 0 || x > 255 then - fail args lexbuf (FSComp.SR.lexInvalidByteLiteral()) (UINT8(byte 0)) + fail args lexbuf (FSComp.SR.lexInvalidAsciiByteLiteral()) (UINT8(byte 0)) + elif x > 127 then + // TODO: Promote to Error: + // * Adjust range check in `if` above to `x > 127` + // * Remove this `elif` expression + // * Remove `lexInvalidTrigraphAsciiByteLiteral` from `FSComp.txt` + warning (Error(FSComp.SR.lexInvalidTrigraphAsciiByteLiteral(), lexbuf.LexemeRange)) + UINT8 (byte(x)) else UINT8 (byte(x)) } + | '\'' unicodeGraphShort '\'' { CHAR (char (int32 (unicodeGraphShort (lexemeTrimBoth lexbuf 3 1)))) } + | '\'' unicodeGraphShort '\'' 'B' { let x = int32 (unicodeGraphShort (lexemeTrimBoth lexbuf 3 2)) if x < 0 || x > 127 then - fail args lexbuf (FSComp.SR.lexInvalidByteLiteral()) (UINT8(byte 0)) + fail args lexbuf (FSComp.SR.lexInvalidAsciiByteLiteral()) (UINT8(byte 0)) else UINT8 (byte(x)) } | '\'' hexGraphShort '\'' { CHAR (char (int32 (hexGraphShort (lexemeTrimBoth lexbuf 3 1)))) } - | '\'' unicodeGraphShort '\'' { CHAR (char (int32 (unicodeGraphShort (lexemeTrimBoth lexbuf 3 1)))) } + | '\'' hexGraphShort '\'' 'B' + { let x = int32 (hexGraphShort (lexemeTrimBoth lexbuf 3 2)) + if x < 0 || x > 127 then + fail args lexbuf (FSComp.SR.lexInvalidAsciiByteLiteral()) (UINT8(byte 0)) + else + UINT8 (byte(x)) } | '\'' unicodeGraphLong '\'' { match unicodeGraphLong (lexemeTrimBoth lexbuf 3 1) with | SingleChar(c) -> CHAR (char c) | _ -> fail args lexbuf (FSComp.SR.lexThisUnicodeOnlyInStringLiterals()) (CHAR (char 0)) } + | '\'' unicodeGraphLong '\'' 'B' + { match unicodeGraphLong (lexemeTrimBoth lexbuf 3 2) with + | SingleChar(c) -> + let x = int32 c + if x < 0 || x > 127 then + fail args lexbuf (FSComp.SR.lexInvalidAsciiByteLiteral()) (UINT8(byte 0)) + else + UINT8 (byte(x)) + | _ -> fail args lexbuf (FSComp.SR.lexInvalidAsciiByteLiteral()) (UINT8(byte 0)) } + | "(*IF-FSHARP" { if lexbuf.SupportsFeature LanguageFeature.MLCompatRevisions then mlCompatWarning (FSComp.SR.lexIndentOffForML()) lexbuf.LexemeRange @@ -1201,11 +1229,26 @@ and singleQuoteString (sargs: LexerStringArgs) (skip: bool) = parse | trigraph { let (buf, _fin, m, kind, args) = sargs let s = lexeme lexbuf - addByteChar buf (trigraph s.[1] s.[2] s.[3]) - if not skip then - STRING_TEXT (LexCont.String(args.ifdefStack, args.stringNest, LexerStringStyle.SingleQuote, kind, args.interpolationDelimiterLength, m)) + let result() = + if not skip then + STRING_TEXT (LexCont.String(args.ifdefStack, args.stringNest, LexerStringStyle.SingleQuote, kind, args.interpolationDelimiterLength, m)) + else + singleQuoteString sargs skip lexbuf + let c = trigraph s.[1] s.[2] s.[3] + let x = int c + if x < 0 || x > 255 then + // TODO: Promote to Error: + // * remove `addByteChar ...` + // * remove `warning ...` + // * Adjust `lexInvalidCharLiteralInString` in `FSComp.txt`: remove `Note` (incl. 2nd placeholder) + // * uncomment `fail ...` + addByteChar buf c + warning (Error(FSComp.SR.lexInvalidCharLiteralInString (s[0..3], sprintf "\\%03i" (x % 256)), lexbuf.LexemeRange)) + //fail args lexbuf (FSComp.SR.lexInvalidCharLiteralInString (s[0..3])) () + result() else - singleQuoteString sargs skip lexbuf } + addByteChar buf c + result() } | hexGraphShort { let (buf, _fin, m, kind, args) = sargs @@ -1233,7 +1276,8 @@ and singleQuoteString (sargs: LexerStringArgs) (skip: bool) = parse singleQuoteString sargs skip lexbuf match unicodeGraphLong hexChars with | Invalid -> - fail args lexbuf (FSComp.SR.lexInvalidUnicodeLiteral hexChars) (result()) + fail args lexbuf (FSComp.SR.lexInvalidUnicodeLiteral hexChars) () + result() | SingleChar(c) -> addUnicodeChar buf (int c) result() diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 8cc9523b1fd..54d47b7c4fb 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -2,7 +2,9 @@ %{ +#nowarn "64" // turn off warnings that type variables used in production annotations are instantiated to concrete type #nowarn "1182" // generated code has lots of unused "parseState" +#nowarn "3261" // the generated code would need to properly annotate nulls, e.g. changing System.Object to `obj|null` open System @@ -21,6 +23,7 @@ open FSharp.Compiler.Syntax open FSharp.Compiler.SyntaxTrivia open FSharp.Compiler.Syntax.PrettyNaming open FSharp.Compiler.SyntaxTreeOps +open FSharp.Compiler.Text open FSharp.Compiler.Text.Position open FSharp.Compiler.Text.Range open FSharp.Compiler.Xml @@ -89,6 +92,7 @@ let parse_error_rich = Some(fun (ctxt: ParseErrorContext<_>) -> %token GREATER_RBRACK STRUCT SIG %token STATIC MEMBER CLASS ABSTRACT OVERRIDE DEFAULT CONSTRUCTOR INHERIT %token EXTERN VOID PUBLIC PRIVATE INTERNAL GLOBAL +%token BAR_JUST_BEFORE_NULL /* for parser 'escape hatch' out of expression context without consuming the 'recover' token */ %token TYPE_COMING_SOON TYPE_IS_HERE MODULE_COMING_SOON MODULE_IS_HERE @@ -105,7 +109,7 @@ let parse_error_rich = Some(fun (ctxt: ParseErrorContext<_>) -> %token ODO /* LexFilter #light converts 'DO' tokens to 'ODO' */ %token ODO_BANG /* LexFilter #light converts 'DO_BANG' tokens to 'ODO_BANG' */ %token OTHEN /* LexFilter #light converts 'THEN' tokens to 'OTHEN' */ -%token OELSE /* LexFilter #light converts 'ELSE' tokens to 'OELSE' except if immeditely followed by 'if', when they become 'ELIF' */ +%token OELSE /* LexFilter #light converts 'ELSE' tokens to 'OELSE' except if immediately followed by 'if', when they become 'ELIF' */ %token OWITH /* LexFilter #light converts SOME (but not all) 'WITH' tokens to 'OWITH' */ %token OFUNCTION /* LexFilter #light converts 'FUNCTION' tokens to 'OFUNCTION' */ %token OFUN /* LexFilter #light converts 'FUN' tokens to 'OFUN' */ @@ -141,7 +145,7 @@ let parse_error_rich = Some(fun (ctxt: ParseErrorContext<_>) -> %token OBLOCKEND // CtxtSeqBlock(_, _, AddBlockEnd) %token OBLOCKEND_COMING_SOON OBLOCKEND_IS_HERE // CtxtSeqBlock(_, _, AddBlockEnd) -%token OINTERFACE_MEMBER /* inserted for non-paranthetical use of 'INTERFACE', i.e. not INTERFACE/END */ +%token OINTERFACE_MEMBER /* inserted for non-parenthetical use of 'INTERFACE', i.e. not INTERFACE/END */ %token FIXED %token ODUMMY @@ -167,7 +171,9 @@ let parse_error_rich = Some(fun (ctxt: ParseErrorContext<_>) -> %type argExpr %type declExprBlock %type headBindingPattern +%type appTypeNullableInParens %type atomTypeNonAtomicDeprecated +%type atomTypeOrAnonRecdType %type atomicExprAfterType %type typedSequentialExprBlock %type atomicExpr @@ -228,7 +234,7 @@ let parse_error_rich = Some(fun (ctxt: ParseErrorContext<_>) -> * * Dummy terminals (like prec_type_prefix) can assign precedence to a rule. * Doc says rule and (shift) token precedence resolves shift/reduce conflict. - * It seems like dummy terminals can not assign precedence to the shift, + * It seems like dummy terminals cannot assign precedence to the shift, * but including the tokens in the precedences below will order them. * e.g. prec_type_prefix lower precedence than RARROW, LBRACK, IDENT, STAR (all extend types). */ @@ -255,6 +261,7 @@ let parse_error_rich = Some(fun (ctxt: ParseErrorContext<_>) -> /* Lower than "if a then b" */ %left prec_then_before %nonassoc prec_then_if +%nonassoc BAR_JUST_BEFORE_NULL %left BAR %right SEMICOLON prec_semiexpr_sep OBLOCKSEP @@ -405,7 +412,7 @@ interactiveTerminator: /* It is important to make this as large as possible given the chunk of input */ /* text. More or less identical to 'moduleDefns' but where SEMICOLON_SEMICOLON is */ /* not part of the grammar of topSeps and HASH interactions are not part of */ -/* the swalloed blob, since things like #use must be processed separately. */ +/* the swallowed blob, since things like #use must be processed separately. */ /* REVIEW: limiting the input chunks until the next # directive can lead to */ /* discrepencies between whole-file type checking in FSI and FSC. */ @@ -738,6 +745,7 @@ valSpfn: | opt_attributes opt_access VAL opt_attributes opt_inline opt_mutable opt_access nameop opt_explicitValTyparDecls COLON topTypeWithTypeConstraints optLiteralValueSpfn { if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2)) let attr1, attr2, isInline, isMutable, vis2, id, doc, explicitValTyparDecls, (ty, arity), (mEquals, konst: SynExpr option) = ($1), ($4), (Option.isSome $5), (Option.isSome $6), ($7), ($8), grabXmlDoc(parseState, $1, 1), ($9), ($11), ($12) + let vis2 = SynValSigAccess.Single(vis2) if not (isNil attr2) then errorR(Deprecated(FSComp.SR.parsAttributesMustComeBeforeVal(), rhs parseState 4)) let m = rhs2 parseState 1 11 @@ -883,7 +891,9 @@ tyconSpfnRhs: { let m = lhs parseState let ty, arity = $3 let flags = AbstractMemberFlags true SynMemberKind.Member - let valSig = SynValSig([], (SynIdent(mkSynId m "Invoke", None)), inferredTyparDecls, ty, arity, false, false, PreXmlDoc.Empty, None, None, m, SynValSigTrivia.Zero) + let vis2 = SynValSigAccess.Single(None) + + let valSig = SynValSig([], (SynIdent(mkSynId m "Invoke", None)), inferredTyparDecls, ty, arity, false, false, PreXmlDoc.Empty, vis2, None, m, SynValSigTrivia.Zero) let invoke = SynMemberSig.Member(valSig, flags, m, SynMemberSigMemberTrivia.Zero) (fun leadingKeyword nameRange nameInfo mEquals augmentation -> if not (isNil augmentation) then raiseParseErrorAt m (FSComp.SR.parsAugmentationsIllegalOnDelegateType()) @@ -958,7 +968,12 @@ classMemberSpfn: | opt_attributes opt_access memberSpecFlags opt_inline opt_access nameop opt_explicitValTyparDecls COLON topTypeWithTypeConstraints classMemberSpfnGetSet optLiteralValueSpfn { if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2)) let isInline, doc, vis2, id, explicitValTyparDecls, (ty, arity), (mEquals, optLiteralValue) = (Option.isSome $4), grabXmlDoc(parseState, $1, 1), $5, $6, $7, $9, $11 - let mWith, (getSet, getSetRangeOpt) = $10 + let mWith, (getSet, getSetRangeOpt, getterAccess, setterAccess) = $10 + let vis2 = + match getterAccess, setterAccess with + | None, None -> SynValSigAccess.Single(vis2) + | _ -> SynValSigAccess.GetSet(vis2, getterAccess, setterAccess) + let getSetAdjuster arity = match arity, getSet with SynValInfo([], _), SynMemberKind.Member -> SynMemberKind.PropertyGet | _ -> getSet let mWhole = let m = rhs parseState 3 @@ -979,11 +994,11 @@ classMemberSpfn: let trivia: SynMemberSigMemberTrivia = { GetSetKeywords = getSetRangeOpt } SynMemberSig.Member(valSpfn, flags, mWhole, trivia) } - | opt_attributes opt_access interfaceMember appType + | opt_attributes opt_access interfaceMember appTypeWithoutNull { if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2)) SynMemberSig.Interface($4, unionRanges (rhs parseState 3) ($4).Range) } - | opt_attributes opt_access INHERIT appType + | opt_attributes opt_access INHERIT appTypeWithoutNull { if Option.isSome $2 then errorR (Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier (), rhs parseState 2)) SynMemberSig.Inherit($4, unionRanges (rhs parseState 1) $4.Range) } @@ -1019,18 +1034,19 @@ classMemberSpfn: | opt_attributes opt_access NEW COLON topTypeWithTypeConstraints { let vis, doc, (ty, valSynInfo) = $2, grabXmlDoc(parseState, $1, 1), $5 + let vis2 = SynValSigAccess.Single(vis) let mNew = rhs parseState 3 let m = unionRanges (rhs parseState 1) ty.Range |> unionRangeWithXmlDoc doc let isInline = false let trivia: SynValSigTrivia = { LeadingKeyword = SynLeadingKeyword.New mNew; InlineKeyword = None; WithKeyword = None; EqualsRange = None } - let valSpfn = SynValSig ($1, (SynIdent(mkSynId (rhs parseState 3) "new", None)), noInferredTypars, ty, valSynInfo, isInline, false, doc, vis, None, m, trivia) + let valSpfn = SynValSig ($1, (SynIdent(mkSynId (rhs parseState 3) "new", None)), noInferredTypars, ty, valSynInfo, isInline, false, doc, vis2, None, m, trivia) SynMemberSig.Member(valSpfn, CtorMemberFlags, m, SynMemberSigMemberTrivia.Zero) } /* The optional "with get, set" on a member in a signature */ classMemberSpfnGetSet: | /* EMPTY */ - { None, (SynMemberKind.Member, None) } + { None, (SynMemberKind.Member, None, None, None) } | WITH classMemberSpfnGetSetElements { let mWith = rhs parseState 1 @@ -1048,39 +1064,39 @@ classMemberSpfnGetSet: /* The "get, set" on a property member in a signature */ classMemberSpfnGetSetElements: - | nameop - { (let (SynIdent(id:Ident, _)) = $1 + | opt_access nameop + { (let (SynIdent(id:Ident, _)) = $2 if id.idText = "get" then - SynMemberKind.PropertyGet, Some(GetSetKeywords.Get id.idRange) + SynMemberKind.PropertyGet, Some(GetSetKeywords.Get id.idRange), $1, None else if id.idText = "set" then - SynMemberKind.PropertySet, Some(GetSetKeywords.Set id.idRange) + SynMemberKind.PropertySet, Some(GetSetKeywords.Set id.idRange), None, $1 else raiseParseErrorAt (rhs parseState 1) (FSComp.SR.parsGetOrSetRequired())) } - | nameop COMMA nameop - { let (SynIdent(id, _)) = $1 - let (SynIdent(id2, _)) = $3 + | opt_access nameop COMMA opt_access nameop + { let (SynIdent(id, _)) = $2 + let (SynIdent(id2, _)) = $5 if not ((id.idText = "get" && id2.idText = "set") || (id.idText = "set" && id2.idText = "get")) then raiseParseErrorAt (rhs2 parseState 1 3) (FSComp.SR.parsGetOrSetRequired()) if id.idText = "get" then - SynMemberKind.PropertyGetSet, Some(GetSetKeywords.GetSet(id.idRange, id2.idRange)) + SynMemberKind.PropertyGetSet, Some(GetSetKeywords.GetSet(id.idRange, id2.idRange)), $1, $4 else - SynMemberKind.PropertyGetSet, Some(GetSetKeywords.GetSet(id2.idRange, id.idRange)) } + SynMemberKind.PropertyGetSet, Some(GetSetKeywords.GetSet(id2.idRange, id.idRange)), $4, $1 } - | nameop COMMA recover - { (let (SynIdent(id:Ident, _)) = $1 + | opt_access nameop COMMA recover + { (let (SynIdent(id:Ident, _)) = $2 if id.idText = "get" then - SynMemberKind.PropertyGet, Some(GetSetKeywords.Get id.idRange) + SynMemberKind.PropertyGet, Some(GetSetKeywords.Get id.idRange), $1, None else if id.idText = "set" then - SynMemberKind.PropertySet, Some(GetSetKeywords.Set id.idRange) + SynMemberKind.PropertySet, Some(GetSetKeywords.Set id.idRange), None, $1 else - raiseParseErrorAt (rhs parseState 1) (FSComp.SR.parsGetOrSetRequired())) } + raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsGetOrSetRequired())) } | OBLOCKBEGIN oblockend ODECLEND { reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsIdentifierExpected()) - SynMemberKind.Member, None } + SynMemberKind.Member, None, None, None } memberSpecFlags: | memberFlags { $1 } @@ -1379,7 +1395,7 @@ openDecl: { let mOpen = rhs parseState 1 SynOpenDeclTarget.ModuleOrNamespace(SynLongIdent([], [], []), mOpen.EndRange), mOpen } - | OPEN typeKeyword appType + | OPEN typeKeyword appTypeWithoutNull { let mOpen = rhs parseState 1 let mPath = $3.Range SynOpenDeclTarget.Type($3, mPath), unionRanges mOpen mPath } @@ -1419,9 +1435,9 @@ namedModuleDefnBlock: // The second is a module abbreviation, the first a module containing a single expression. // The resolution is in favour of the module abbreviation, i.e. anything of the form // module M2 = ID.ID.ID.ID - // will be taken as a module abbreviation, regardles of the identifiers themselves. + // will be taken as a module abbreviation, regardless of the identifiers themselves. // - // This is similar to the ambiguitty between + // This is similar to the ambiguity between // type X = int // and // type X = OneValue @@ -1626,12 +1642,9 @@ tyconDefn: let (tcDefRepr, mWith, members) = $8 nameRange let (SynComponentInfo(_, _, _, lid, _, _, _, _)) = $1 let mEquals = rhs parseState 7 - // Gets the XML doc comments prior to the implicit constructor let xmlDoc = grabXmlDoc (parseState, $2, 2) - let m = match lid with [] -> rhs parseState 1 | _ -> rangeOfLid lid - let memberCtorPattern = pat |> Option.map (fun pat -> SynMemberDefn.ImplicitCtor(vis, $2, pat, Option.bind snd az, xmlDoc, m, { AsKeyword = Option.map fst az }) @@ -1659,14 +1672,11 @@ tyconDefn: | Some(_, Some id) -> reportParseErrorAt (rhs parseState 6) (FSComp.SR.tcLetAndDoRequiresImplicitConstructionSequence ()) | _ -> () - tcDefRepr - let declRange = unionRanges (rhs parseState 1) tcDefRepr.Range let mWhole = (declRange, members) ||> unionRangeWithListBy (fun (mem: SynMemberDefn) -> mem.Range) |> unionRangeWithXmlDoc xmlDoc - fun leadingKeyword -> let trivia: SynTypeDefnTrivia = { LeadingKeyword = leadingKeyword; EqualsRange = Some mEquals; WithKeyword = mWith } SynTypeDefn($1, tcDefRepr, members, memberCtorPattern, mWhole, trivia) } @@ -1683,7 +1693,6 @@ tyconDefn: | Some pat, _, _ -> let memberCtorPattern = SynMemberDefn.ImplicitCtor(vis, $2, pat, Option.bind snd az, xmlDoc, m, { AsKeyword = Option.map fst az }) [memberCtorPattern], unionRanges mName memberCtorPattern.Range - | _, _, Some(mAs, asId) -> let mAs = asId |> Option.map (fun id -> @@ -1691,12 +1700,9 @@ tyconDefn: id.idRange ) |> Option.defaultValue mAs - [], unionRanges mName mAs - | _, Some vis, _ -> [], unionRanges mName vis.Range - | _ -> [], mName @@ -1704,7 +1710,6 @@ tyconDefn: let trivia = { SynTypeDefnTrivia.Zero with LeadingKeyword = leadingKeyword } SynTypeDefn($1, SynTypeDefnRepr.Simple(SynTypeDefnSimpleRepr.None(mName), mName), members, None, mWhole, trivia) } - /* The right-hand-side of a type definition */ tyconDefnRhsBlock: /* This rule allows members to be given for record and union types in the #light syntax */ @@ -1768,7 +1773,8 @@ tyconDefnRhs: { let m = lhs parseState let ty, arity = $3 (fun nameRange augmentation -> - let valSig = SynValSig([], (SynIdent(mkSynId m "Invoke", None)), inferredTyparDecls, ty, arity, false, false, PreXmlDoc.Empty, None, None, m, SynValSigTrivia.Zero) + let vis2 = SynValSigAccess.Single(None) + let valSig = SynValSig([], (SynIdent(mkSynId m "Invoke", None)), inferredTyparDecls, ty, arity, false, false, PreXmlDoc.Empty, vis2, None, m, SynValSigTrivia.Zero) let flags = AbstractMemberFlags true SynMemberKind.Member let invoke = SynMemberDefn.AbstractSlot(valSig, flags, m, SynMemberDefnAbstractSlotTrivia.Zero) if not (isNil augmentation) then raiseParseErrorAt m (FSComp.SR.parsAugmentationsIllegalOnDelegateType()) @@ -2025,7 +2031,7 @@ classDefnMember: [SynMemberDefn.Member(binding, mWhole)] } - | opt_attributes opt_access interfaceMember appType opt_interfaceImplDefn + | opt_attributes opt_access interfaceMember appTypeWithoutNull opt_interfaceImplDefn { if not (isNil $1) then errorR(Error(FSComp.SR.parsAttributesAreNotPermittedOnInterfaceImplementations(), rhs parseState 1)) if Option.isSome $2 then errorR(Error(FSComp.SR.parsInterfacesHaveSameVisibilityAsEnclosingType(), rhs parseState 3)) let mWithKwd, members, mWhole = @@ -2044,7 +2050,7 @@ classDefnMember: | opt_attributes opt_access abstractMemberFlags opt_inline nameop opt_explicitValTyparDecls COLON topTypeWithTypeConstraints classMemberSpfnGetSet opt_ODECLEND { let ty, arity = $8 let isInline, doc, id, explicitValTyparDecls = (Option.isSome $4), grabXmlDoc(parseState, $1, 1), $5, $6 - let mWith, (getSet, getSetRangeOpt) = $9 + let mWith, (getSet, getSetRangeOpt, getterAccess, setterAccess) = $9 let getSetAdjuster arity = match arity, getSet with SynValInfo([], _), SynMemberKind.Member -> SynMemberKind.PropertyGet | _ -> getSet let mWhole = let m = rhs parseState 1 @@ -2052,10 +2058,12 @@ classDefnMember: | None -> unionRanges m ty.Range | Some gs -> unionRanges m gs.Range |> unionRangeWithXmlDoc doc - if Option.isSome $2 then errorR(Error(FSComp.SR.parsAccessibilityModsIllegalForAbstract(), mWhole)) + if Option.isSome $2 || Option.isSome getterAccess || Option.isSome setterAccess + then errorR(Error(FSComp.SR.parsAccessibilityModsIllegalForAbstract(), mWhole)) let mkFlags, leadingKeyword = $3 let trivia = { LeadingKeyword = leadingKeyword; InlineKeyword = $4; WithKeyword = mWith; EqualsRange = None } - let valSpfn = SynValSig($1, id, explicitValTyparDecls, ty, arity, isInline, false, doc, None, None, mWhole, trivia) + let vis2 = SynValSigAccess.Single(None) + let valSpfn = SynValSig($1, id, explicitValTyparDecls, ty, arity, isInline, false, doc, vis2, None, mWhole, trivia) let trivia: SynMemberDefnAbstractSlotTrivia = { GetSetKeywords = getSetRangeOpt } [ SynMemberDefn.AbstractSlot(valSpfn, mkFlags (getSetAdjuster arity), mWhole, trivia) ] } @@ -2191,7 +2199,7 @@ autoPropsDefnDecl: errorR (Error(FSComp.SR.parsMutableOnAutoPropertyShouldBeGetSet (), rhs parseState 2)) fun attribs flags rangeStart -> let xmlDoc = grabXmlDocAtRangeStart (parseState, attribs, rangeStart) - [ mkAutoPropDefn mVal $3 $4 $5 None expr (None, (SynMemberKind.Member, None)) xmlDoc attribs flags rangeStart ] } + [ mkAutoPropDefn mVal $3 $4 $5 None expr (None, (SynMemberKind.Member, None, None, None)) xmlDoc attribs flags rangeStart ] } | VAL opt_mutable opt_access ident opt_typ OBLOCKSEP { let mVal = rhs parseState 1 @@ -2204,7 +2212,7 @@ autoPropsDefnDecl: errorR (Error(FSComp.SR.parsMutableOnAutoPropertyShouldBeGetSet (), rhs parseState 2)) fun attribs flags rangeStart -> let xmlDoc = grabXmlDocAtRangeStart (parseState, attribs, rangeStart) - [ mkAutoPropDefn mVal $3 $4 $5 None expr (None, (SynMemberKind.Member, None)) xmlDoc attribs flags rangeStart ] } + [ mkAutoPropDefn mVal $3 $4 $5 None expr (None, (SynMemberKind.Member, None, None, None)) xmlDoc attribs flags rangeStart ] } | VAL opt_mutable opt_access recover { let mVal = rhs parseState 1 @@ -2214,7 +2222,7 @@ autoPropsDefnDecl: errorR (Error(FSComp.SR.parsMutableOnAutoPropertyShouldBeGetSet (), rhs parseState 2)) fun attribs flags rangeStart -> let xmlDoc = grabXmlDocAtRangeStart(parseState, attribs, rangeStart) - [ mkAutoPropDefn mVal $3 id None None expr (None, (SynMemberKind.Member, None)) xmlDoc attribs flags rangeStart ] } + [ mkAutoPropDefn mVal $3 id None None expr (None, (SynMemberKind.Member, None, None, None)) xmlDoc attribs flags rangeStart ] } /* An optional type on an auto-property definition */ opt_typ: @@ -2384,8 +2392,23 @@ objectImplementationMember: { let rangeStart = rhs parseState 1 $3 $1 $2 rangeStart } - | opt_attributes staticMemberOrMemberOrOverride error - { [] } + | opt_attributes staticMemberOrMemberOrOverride recover + { let rangeStart = rhs parseState 1 + let memFlagsBuilder, leadingKeyword = $2 + let flags = Some(memFlagsBuilder SynMemberKind.Member) + let xmlDoc = grabXmlDocAtRangeStart (parseState, $1, rangeStart) + let trivia = { LeadingKeyword = leadingKeyword; InlineKeyword = None; EqualsRange = None } + let mMember = rhs parseState 2 + let mEnd = mMember.EndRange + let bindingPat = patFromParseError (SynPat.Wild(mEnd)) + let expr = arbExpr ("objectImplementationMember1", mEnd) + let mWhole = rhs2 parseState 1 2 + let binding = + mkSynBinding + (xmlDoc, bindingPat) + (None, false, false, mWhole, DebugPointAtBinding.NoneAtInvisible, None, expr, mEnd, [], $1, flags, trivia) + + [SynMemberDefn.Member(binding, mWhole)] } | opt_attributes error memberCore opt_ODECLEND { [] } @@ -2411,12 +2434,12 @@ tyconDefnOrSpfnSimpleRepr: | opt_attributes opt_access path LQUOTE STRING recover { errorR(Error(FSComp.SR.parsUnexpectedQuotationOperatorInTypeAliasDidYouMeanVerbatimString(), rhs parseState 4)) SynTypeDefnSimpleRepr.TypeAbbrev(ParserDetail.ErrorRecovery, SynType.LongIdent($3), unionRanges (rhs parseState 1) $3.Range) } - - /* A type abbreviation */ + + /* A type abbreviation */ | opt_attributes opt_access typ { if not (isNil $1) then errorR(Error(FSComp.SR.parsAttributesIllegalHere(), rhs parseState 1)) if Option.isSome $2 then errorR(Error(FSComp.SR.parsTypeAbbreviationsCannotHaveVisibilityDeclarations(), rhs parseState 2)) - SynTypeDefnSimpleRepr.TypeAbbrev(ParserDetail.Ok, $3, unionRanges (rhs parseState 1) $3.Range) } + SynTypeDefnSimpleRepr.TypeAbbrev(ParserDetail.Ok, $3, unionRanges (rhs parseState 1) $3.Range) } /* A union type definition */ | opt_attributes opt_access unionTypeRepr @@ -2465,7 +2488,7 @@ braceFieldDeclList: { [] } | LBRACE rbrace - { errorR (Error(FSComp.SR.parsExpectingField(), rhs parseState 2)) + { errorR (Error(FSComp.SR.parsExpectingRecordField (), rhs parseState 2)) [] } anonRecdType: @@ -2628,6 +2651,11 @@ typeConstraint: | typar COLON NULL { SynTypeConstraint.WhereTyparSupportsNull($1, lhs parseState) } + | typar COLON IDENT NULL + { if $3 <> "not" then reportParseErrorAt (rhs parseState 3) (FSComp.SR.parsUnexpectedIdentifier($3 + " (2)")) + let trivia : SynTypeConstraintWhereTyparNotSupportsNullTrivia = { ColonRange = rhs parseState 2; NotRange = rhs parseState 3 } + SynTypeConstraint.WhereTyparNotSupportsNull($1, lhs parseState, trivia) } + | typar COLON LPAREN classMemberSpfn rparen { let tp = $1 SynTypeConstraint.WhereTyparSupportsMember(SynType.Var(tp, tp.Range), $4, lhs parseState) } @@ -2646,25 +2674,25 @@ typeConstraint: | "enum" -> let _ltm, _gtm, args, _commas, mWhole = $4 SynTypeConstraint.WhereTyparIsEnum($1, args, unionRanges $1.Range mWhole) - | nm -> raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsUnexpectedIdentifier(nm)) } + | nm -> raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsUnexpectedIdentifier(nm + " (3)")) } | typar COLON IDENT { match $3 with | "comparison" -> SynTypeConstraint.WhereTyparIsComparable($1, lhs parseState) | "equality" -> SynTypeConstraint.WhereTyparIsEquatable($1, lhs parseState) | "unmanaged" -> SynTypeConstraint.WhereTyparIsUnmanaged($1, lhs parseState) - | nm -> raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsUnexpectedIdentifier(nm)) } + | nm -> raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsUnexpectedIdentifier(nm + " (4)")) } - | appType + | appTypeWithoutNull { SynTypeConstraint.WhereSelfConstrained($1, lhs parseState) } typeAlts: - | typeAlts OR appType + | typeAlts OR appTypeWithoutNull { let mOr = rhs parseState 2 let m = unionRanges $1.Range $3.Range SynType.Or($1, $3, m, { OrKeyword = mOr }) } - | appType + | appTypeWithoutNull { $1 } /* The core of a union type definition */ @@ -2701,17 +2729,26 @@ attrUnionCaseDecl: { fun (xmlDoc, mBar) -> mkSynUnionCase $1 $2 (SynIdent(mkSynId mBar.EndRange "", None)) (SynUnionCaseKind.Fields []) mBar (xmlDoc, mBar) |> Choice2Of2 } | opt_attributes opt_access unionCaseName OF unionCaseRepr - { mkSynUnionCase $1 $2 $3 (SynUnionCaseKind.Fields $5) (rhs2 parseState 1 5) >> Choice2Of2 } + { let mId = rhs parseState 3 + let fields, mFields = $5 + let mWhole = unionRanges mId mFields + mkSynUnionCase $1 $2 $3 (SynUnionCaseKind.Fields fields) mWhole >> Choice2Of2 } | opt_attributes opt_access unionCaseName unionCaseRepr { errorR (Error(FSComp.SR.parsMissingKeyword("of"), rhs2 parseState 3 4)) - mkSynUnionCase $1 $2 $3 (SynUnionCaseKind.Fields $4) (rhs2 parseState 1 4) >> Choice2Of2 } + let mAttributes = rhs parseState 1 + let fields, mFields = $4 + let mWhole = unionRanges mAttributes mFields + mkSynUnionCase $1 $2 $3 (SynUnionCaseKind.Fields fields) mWhole >> Choice2Of2 } | opt_attributes opt_access OF unionCaseRepr - { let mOf = rhs parseState 3 + { let mAttributes = rhs parseState 1 + let mOf = rhs parseState 3 let mId = mOf.StartRange + let fields, mFields = $4 + let mWhole = unionRanges mAttributes mFields errorR (Error(FSComp.SR.parsMissingUnionCaseName(), mOf)) - mkSynUnionCase $1 $2 (SynIdent(mkSynId mId "", None)) (SynUnionCaseKind.Fields $4) (rhs2 parseState 1 4) >> Choice2Of2 } + mkSynUnionCase $1 $2 (SynIdent(mkSynId mId "", None)) (SynUnionCaseKind.Fields fields) mWhole >> Choice2Of2 } | opt_attributes opt_access OF recover { let mOf = rhs parseState 3 @@ -2723,13 +2760,18 @@ attrUnionCaseDecl: { mkSynUnionCase $1 $2 $3 (SynUnionCaseKind.Fields []) (rhs2 parseState 1 4) >> Choice2Of2 } | opt_attributes opt_access unionCaseName COLON topType - { if parseState.LexBuffer.ReportLibraryOnlyFeatures then libraryOnlyWarning(lhs parseState) - mkSynUnionCase $1 $2 $3 (SynUnionCaseKind.FullType $5) (rhs2 parseState 1 5) >> Choice2Of2 } + { let mAttributes = rhs parseState 1 + let fullType, _ = $5 + let mWhole = unionRanges mAttributes fullType.Range + if parseState.LexBuffer.ReportLibraryOnlyFeatures then libraryOnlyWarning(lhs parseState) + mkSynUnionCase $1 $2 $3 (SynUnionCaseKind.FullType $5) mWhole >> Choice2Of2 } | opt_attributes opt_access unionCaseName EQUALS atomicExpr { if Option.isSome $2 then errorR(Error(FSComp.SR.parsEnumFieldsCannotHaveVisibilityDeclarations(), rhs parseState 2)) let mEquals = rhs parseState 4 - let mDecl = rhs2 parseState 1 5 + let mAttributes = rhs parseState 1 + let expr, _ = $5 + let mDecl = unionRanges mAttributes expr.Range (fun (xmlDoc, mBar) -> let trivia: SynEnumCaseTrivia = { BarRange = Some mBar; EqualsRange = mEquals } let mDecl = unionRangeWithXmlDoc xmlDoc mDecl @@ -2787,10 +2829,21 @@ firstUnionCaseDeclOfMany: firstUnionCaseDecl: | ident OF unionCaseRepr - { let trivia: SynUnionCaseTrivia = { BarRange = None } + { let fields, mFields = $3 + let trivia: SynUnionCaseTrivia = { BarRange = None } let xmlDoc = grabXmlDoc (parseState, [], 1) - let mDecl = rhs2 parseState 1 3 |> unionRangeWithXmlDoc xmlDoc - Choice2Of2(SynUnionCase([], SynIdent($1, None), SynUnionCaseKind.Fields $3, xmlDoc, None, mDecl, trivia)) } + let mId = rhs parseState 1 + let mDecl = unionRanges mId mFields |> unionRangeWithXmlDoc xmlDoc + Choice2Of2(SynUnionCase([], SynIdent($1, None), SynUnionCaseKind.Fields fields, xmlDoc, None, mDecl, trivia)) } + + | unionCaseName COLON topType + { if parseState.LexBuffer.ReportLibraryOnlyFeatures then libraryOnlyWarning(lhs parseState) + let trivia: SynUnionCaseTrivia = { BarRange = None } + let xmlDoc = grabXmlDoc (parseState, [], 1) + let mId = rhs parseState 1 + let fullType, _ = $3 + let mDecl = unionRanges mId fullType.Range |> unionRangeWithXmlDoc xmlDoc + Choice2Of2(SynUnionCase([], $1, SynUnionCaseKind.FullType $3, xmlDoc, None, mDecl, trivia)) } | ident OF recover { let trivia: SynUnionCaseTrivia = { BarRange = None } @@ -2801,18 +2854,21 @@ firstUnionCaseDecl: | OF unionCaseRepr { let mOf = rhs parseState 1 let mId = mOf.StartRange + let fields, mFields = $2 errorR (Error(FSComp.SR.parsMissingUnionCaseName(), mOf)) let id = SynIdent(mkSynId mId "", None) let trivia: SynUnionCaseTrivia = { BarRange = None } let xmlDoc = grabXmlDoc (parseState, [], 1) - let mDecl = rhs2 parseState 1 2 |> unionRangeWithXmlDoc xmlDoc - Choice2Of2(SynUnionCase([], id, SynUnionCaseKind.Fields $2, xmlDoc, None, mDecl, trivia)) } + let mDecl = unionRanges mOf mFields |> unionRangeWithXmlDoc xmlDoc + Choice2Of2(SynUnionCase([], id, SynUnionCaseKind.Fields fields, xmlDoc, None, mDecl, trivia)) } | ident EQUALS atomicExpr opt_OBLOCKSEP - { let mEquals = rhs parseState 2 + { let mId = rhs parseState 1 + let mEquals = rhs parseState 2 let trivia: SynEnumCaseTrivia = { BarRange = None; EqualsRange = mEquals } let xmlDoc = grabXmlDoc (parseState, [], 1) - let mDecl = rhs2 parseState 1 3 |> unionRangeWithXmlDoc xmlDoc + let expr, _ = $3 + let mDecl = unionRanges mId expr.Range |> unionRangeWithXmlDoc xmlDoc Choice1Of2(SynEnumCase([], SynIdent($1, None), fst $3, xmlDoc, mDecl, trivia)) } | ident EQUALS recover opt_OBLOCKSEP @@ -2826,36 +2882,60 @@ firstUnionCaseDecl: unionCaseReprElements: | unionCaseReprElement STAR unionCaseReprElements - { $1 :: $3 } + { let mField = rhs parseState 1 + let fields, mFields = $3 + $1 :: fields, unionRanges mField mFields } + + | unionCaseReprElement STAR recover + { let mStar = rhs parseState 2 + let ty = SynType.FromParseError mStar.EndRange + let field = mkSynAnonField (ty, PreXmlDoc.Empty) + [$1; field], rhs2 parseState 1 2 } + + | STAR unionCaseReprElements + { let mStar = rhs parseState 1 + errorR (Error(FSComp.SR.parsExpectingUnionCaseField (), rhs parseState 1)) + let fields, mFields = $2 + let ty = SynType.FromParseError mStar.StartRange + let field = mkSynAnonField (ty, PreXmlDoc.Empty) + field :: fields, unionRanges mStar mFields } | unionCaseReprElement %prec prec_toptuptyptail_prefix - { [$1] } + { [$1], $1.Range } unionCaseReprElement: - | ident COLON appType - { let xmlDoc = grabXmlDoc(parseState, [], 1) - let mWhole = rhs2 parseState 1 3 |> unionRangeWithXmlDoc xmlDoc + | ident COLON appTypeNullableInParens + { let xmlDoc = grabXmlDoc (parseState, [], 1) + let mId = rhs parseState 1 + let mWhole = unionRanges mId $3.Range |> unionRangeWithXmlDoc xmlDoc mkSynNamedField ($1, $3, xmlDoc, mWhole) } - | appType - { let xmlDoc = grabXmlDoc(parseState, [], 1) + | ident COLON recover + { let xmlDoc = grabXmlDoc (parseState, [], 1) + let mColon = rhs parseState 2 + let ty = SynType.FromParseError mColon.EndRange + let mWhole = rhs2 parseState 1 2 |> unionRangeWithXmlDoc xmlDoc + mkSynNamedField ($1, ty, xmlDoc, mWhole) } + + | appTypeNullableInParens + { let xmlDoc = grabXmlDoc (parseState, [], 1) mkSynAnonField ($1, xmlDoc) } | ident COLON invalidUseOfAppTypeFunction - { let xmlDoc = grabXmlDoc(parseState, [], 1) + { let xmlDoc = grabXmlDoc (parseState, [], 1) let mWhole = rhs2 parseState 1 3 |> unionRangeWithXmlDoc xmlDoc - reportParseErrorAt ($3 : SynType).Range (FSComp.SR.tcUnexpectedFunTypeInUnionCaseField()) + reportParseErrorAt ($3: SynType).Range (FSComp.SR.tcUnexpectedFunTypeInUnionCaseField ()) mkSynNamedField ($1, $3, xmlDoc, mWhole) } | invalidUseOfAppTypeFunction - { let xmlDoc = grabXmlDoc(parseState, [], 1) - reportParseErrorAt ($1 : SynType).Range (FSComp.SR.tcUnexpectedFunTypeInUnionCaseField()) + { let xmlDoc = grabXmlDoc (parseState, [], 1) + reportParseErrorAt ($1: SynType).Range (FSComp.SR.tcUnexpectedFunTypeInUnionCaseField ()) mkSynAnonField ($1, xmlDoc) } unionCaseRepr: | braceFieldDeclList { errorR(Deprecated(FSComp.SR.parsConsiderUsingSeparateRecordType(), lhs parseState)) - $1 } + $1, rhs parseState 1 } | unionCaseReprElements { $1 } @@ -2931,7 +3011,8 @@ exconIntro: { SynUnionCase([], SynIdent($1, None), SynUnionCaseKind.Fields [], PreXmlDoc.Empty, None, lhs parseState, { BarRange = None }) } | ident OF unionCaseRepr - { SynUnionCase([], SynIdent($1, None), SynUnionCaseKind.Fields $3, PreXmlDoc.Empty, None, lhs parseState, { BarRange = None }) } + { let fields, _ = $3 + SynUnionCase([], SynIdent($1, None), SynUnionCaseKind.Fields fields, PreXmlDoc.Empty, None, lhs parseState, { BarRange = None }) } | ident OF recover { SynUnionCase([], SynIdent($1, None), SynUnionCaseKind.Fields [], PreXmlDoc.Empty, None, lhs parseState, { BarRange = None }) } @@ -3160,6 +3241,9 @@ cType: { let m = lhs parseState SynType.App(SynType.LongIdent(SynLongIdent([ident("nativeptr", m)], [], [ Some(IdentTrivia.OriginalNotation "*") ])), None, [$1], [], None, true, m) } + | cType BAR_JUST_BEFORE_NULL NULL + { SynType.WithNull($1, false, lhs parseState, { BarRange = rhs parseState 2 }) } + | cType AMP { let m = lhs parseState SynType.App(SynType.LongIdent(SynLongIdent([ident("byref", m)], [], [ Some(IdentTrivia.OriginalNotation "&") ])), None, [$1], [], None, true, m) } @@ -3439,9 +3523,15 @@ simplePatterns: | LPAREN rparen { SynPat.Const(SynConst.Unit, rhs2 parseState 1 2) } +barCanBeRightBeforeNull: + | BAR + { } + | BAR_JUST_BEFORE_NULL + { } + headBindingPattern: - | headBindingPattern AS constrPattern + | headBindingPattern AS constrPattern %prec AS { SynPat.As($1, $3, rhs2 parseState 1 3) } | headBindingPattern AS recover @@ -3455,7 +3545,7 @@ headBindingPattern: let pat2 = SynPat.Wild(mAs.EndRange) SynPat.As($1, pat2, rhs2 parseState 1 2) } - | headBindingPattern BAR headBindingPattern + | headBindingPattern barCanBeRightBeforeNull headBindingPattern %prec BAR { let mBar = rhs parseState 2 SynPat.Or($1, $3, rhs2 parseState 1 3, { BarRange = mBar }) } @@ -3463,7 +3553,7 @@ headBindingPattern: { let mColonColon = rhs parseState 2 SynPat.ListCons($1, $3, rhs2 parseState 1 3, { ColonColonRange = mColonColon }) } - | headBindingPattern COLON_COLON recover + | headBindingPattern COLON_COLON ends_coming_soon_or_recover { let mColonColon = rhs parseState 2 let pat2 = SynPat.Wild(mColonColon.EndRange) SynPat.ListCons($1, pat2, rhs2 parseState 1 2, { ColonColonRange = mColonColon }) } @@ -3592,7 +3682,21 @@ constrPattern: SynPat.LongIdent(lid, None, None, args, vis, m) } | COLON_QMARK atomTypeOrAnonRecdType %prec pat_isinst - { SynPat.IsInst($2, lhs parseState) } + { let m = unionRanges (rhs parseState 1) $2.Range + SynPat.IsInst($2, m) } + + | COLON_QMARK recover %prec pat_isinst + { let mColon = rhs parseState 1 + if not $2 then + reportParseErrorAt mColon (FSComp.SR.parsExpectingPattern ()) + let ty = SynType.FromParseError(mColon.EndRange) + SynPat.IsInst(ty, mColon) } + + | COLON_QMARK %prec pat_isinst + { let mColon = rhs parseState 1 + let ty = SynType.FromParseError(mColon.EndRange) + reportParseErrorAt mColon (FSComp.SR.parsExpectingType ()) + SynPat.IsInst(ty, mColon) } | atomicPattern { $1 } @@ -3712,7 +3816,7 @@ parenPatternBody: /* This duplicates out 'patterns' in order to give type annotations */ /* the desired precedence w.r.t. patterns, tuple patterns in particular. */ -/* Duplication requried to minimize the disturbance to the grammar, */ +/* Duplication required to minimize the disturbance to the grammar, */ /* in particular the expected property that "pat" parses the same as */ /* "(pat)"! Here are some examples: */ /* a, b parses as (a, b) */ @@ -3736,7 +3840,7 @@ parenPatternBody: /* duplicating the entire expression grammar, or making a fairly severe breaking change */ /* to the language. */ parenPattern: - | parenPattern AS constrPattern + | parenPattern AS constrPattern %prec AS { SynPat.As($1, $3, rhs2 parseState 1 3) } | parenPattern AS recover @@ -3750,7 +3854,7 @@ parenPattern: reportParseErrorAt mAs (FSComp.SR.parsExpectingPattern ()) SynPat.As($1, pat2, rhs2 parseState 1 2) } - | parenPattern BAR parenPattern + | parenPattern barCanBeRightBeforeNull parenPattern %prec BAR { let mBar = rhs parseState 2 SynPat.Or($1, $3, rhs2 parseState 1 3, { BarRange = mBar }) } @@ -3769,6 +3873,8 @@ parenPattern: | parenPattern COLON recover { let mColon = rhs parseState 2 + if not $3 then + reportParseErrorAt mColon (FSComp.SR.parsExpectingPattern ()) let ty = SynType.FromParseError(mColon.EndRange) SynPat.Typed($1, ty, unionRanges $1.Range mColon) } @@ -3782,6 +3888,8 @@ parenPattern: | parenPattern COLON_COLON recover { let mColonColon = rhs parseState 2 + if not $3 then + reportParseErrorAt mColonColon (FSComp.SR.parsExpectingPattern ()) let pat2 = SynPat.Wild(mColonColon.EndRange) SynPat.ListCons($1, pat2, rhs2 parseState 1 2, { ColonColonRange = mColonColon }) } @@ -3972,7 +4080,8 @@ moreBinders: let mEquals = rhs parseState 3 let m = unionRanges (rhs parseState 1) $4.Range let mIn = rhs parseState 5 - SynExprAndBang(spBind, $1, true, $2, $4, m, { EqualsRange = mEquals; InKeyword = Some mIn }) :: $6 } + let trivia = { AndBangKeyword = rhs parseState 1; EqualsRange = mEquals; InKeyword = Some mIn } + SynExprAndBang(spBind, $1, true, $2, $4, m, trivia) :: $6 } | OAND_BANG headBindingPattern EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP moreBinders %prec expr_let { let report, mIn, _ = $5 @@ -3980,7 +4089,8 @@ moreBinders: let spBind = DebugPointAtBinding.Yes(rhs2 parseState 1 5) (* TODO Pretty sure this is wrong *) let mEquals = rhs parseState 3 let m = unionRanges (rhs parseState 1) $4.Range - SynExprAndBang(spBind, $1, true, $2, $4, m, { EqualsRange = mEquals; InKeyword = mIn }) :: $7 } + let trivia = { AndBangKeyword = rhs parseState 1; EqualsRange = mEquals; InKeyword = mIn } + SynExprAndBang(spBind, $1, true, $2, $4, m, trivia) :: $7 } | %prec prec_no_more_attr_bindings { [] } @@ -4660,11 +4770,11 @@ withPatternClauses: | patternClauses { $1 None } - | BAR patternClauses + | barCanBeRightBeforeNull patternClauses { let mBar = rhs parseState 1 |> Some $2 mBar } - | BAR BAR patternClauses + | BAR barCanBeRightBeforeNull patternClauses { let mBar1 = rhs parseState 1 let mBar2 = rhs parseState 2 reportParseErrorAt mBar2 (FSComp.SR.parsExpectingPattern ()) @@ -4672,7 +4782,7 @@ withPatternClauses: let clauses = addEmptyMatchClause mBar1 mBar2 clauses clauses, mLast } - | BAR error + | barCanBeRightBeforeNull error { // silent recovery let mLast = rhs parseState 1 [], mLast } @@ -4696,7 +4806,7 @@ patternClauses: fun mBar -> [SynMatchClause(pat, guard, resultExpr, m, DebugPointAtTarget.Yes, { ArrowRange = Some mArrow; BarRange = mBar })], mLast } - | patternAndGuard patternResult BAR patternClauses + | patternAndGuard patternResult barCanBeRightBeforeNull patternClauses { let pat, guard = $1 let mArrow, resultExpr = $2 let mNextBar = rhs parseState 3 |> Some @@ -4705,7 +4815,7 @@ patternClauses: fun mBar -> (SynMatchClause(pat, guard, resultExpr, m, DebugPointAtTarget.Yes, { ArrowRange = Some mArrow; BarRange = mBar }) :: clauses), mLast } - | patternAndGuard patternResult BAR BAR patternClauses + | patternAndGuard patternResult BAR barCanBeRightBeforeNull patternClauses { let pat, guard = $1 let mArrow, resultExpr = $2 let mBar1 = rhs parseState 3 @@ -4719,7 +4829,7 @@ patternClauses: let trivia = { ArrowRange = Some mArrow; BarRange = mBar } SynMatchClause(pat, guard, resultExpr, m, DebugPointAtTarget.Yes, trivia) :: clauses, mLast } - | patternAndGuard error BAR patternClauses + | patternAndGuard error barCanBeRightBeforeNull patternClauses { let pat, guard = $1 let mNextBar = rhs parseState 3 |> Some let clauses, mLast = $4 mNextBar @@ -4728,7 +4838,7 @@ patternClauses: fun _mBar -> (SynMatchClause(pat, guard, arbExpr ("patternClauses1", m.EndRange), m, DebugPointAtTarget.Yes, SynMatchClauseTrivia.Zero) :: clauses), mLast } - | patternAndGuard patternResult BAR recover + | patternAndGuard patternResult barCanBeRightBeforeNull recover { let pat, guard = $1 let mArrow, resultExpr = $2 let mLast = rhs parseState 3 @@ -5279,9 +5389,10 @@ typars: SynType.Paren($2, m) } typarAlts: - | typarAlts OR appType + | typarAlts OR appTypeCanBeNullable { let mOr = rhs parseState 2 - let m = unionRanges $1.Range $3.Range + let appType : SynType = $3 + let m = unionRanges $1.Range appType.Range SynType.Or($1, $3, m, { OrKeyword = mOr }) } | typar @@ -5628,7 +5739,7 @@ opt_objExprInterfaces: { (* silent recovery *) $2 } objExprInterface: - | interfaceMember appType opt_objExprBindings opt_declEnd opt_OBLOCKSEP + | interfaceMember appTypeWithoutNull opt_objExprBindings opt_declEnd opt_OBLOCKSEP { let mWithKwd, bindings, members = $3 let m = match List.tryLast members with @@ -5850,14 +5961,14 @@ topTupleTypeElements: [ SynTupleTypeSegment.Type t, Some argInfo ] } topAppType: - | attributes appType COLON appType + | attributes appTypeCanBeNullable COLON appTypeCanBeNullable { match $2 with | SynType.LongIdent(SynLongIdent([id], _, _)) -> let m = unionRanges (rhs parseState 1) $4.Range SynType.SignatureParameter($1, false, Some id, $4, m), SynArgInfo($1, false, Some id) | _ -> raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsSyntaxErrorInLabeledType()) } - | attributes appType COLON recover + | attributes appTypeCanBeNullable COLON recover { match $2 with | SynType.LongIdent(SynLongIdent([id], _, _)) -> let mColon = rhs parseState 2 @@ -5866,7 +5977,7 @@ topAppType: SynType.SignatureParameter($1, false, Some id, ty, m), SynArgInfo($1, false, Some id) | _ -> raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsSyntaxErrorInLabeledType()) } - | attributes QMARK ident COLON appType + | attributes QMARK ident COLON appTypeCanBeNullable { let m = unionRanges (rhs parseState 1) $5.Range SynType.SignatureParameter($1, true, Some $3, $5, m), SynArgInfo($1, true, Some $3) } @@ -5876,18 +5987,18 @@ topAppType: let ty = SynType.FromParseError(mColon.EndRange) SynType.SignatureParameter($1, true, Some $3, ty, m), SynArgInfo($1, true, Some $3) } - | attributes appType + | attributes appTypeCanBeNullable { let m = unionRanges (rhs parseState 1) $2.Range SynType.SignatureParameter($1, false, None, $2, m), SynArgInfo($1, false, None) } - | appType COLON appType + | appTypeCanBeNullable COLON appTypeCanBeNullable { match $1 with | SynType.LongIdent(SynLongIdent([id], _, _)) -> let m = unionRanges (rhs parseState 1) $3.Range SynType.SignatureParameter([], false, Some id, $3, m), SynArgInfo([], false, Some id) | _ -> raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsSyntaxErrorInLabeledType()) } - | appType COLON recover + | appTypeCanBeNullable COLON recover { match $1 with | SynType.LongIdent(SynLongIdent([id], _, _)) -> let mColon = rhs parseState 2 @@ -5896,7 +6007,7 @@ topAppType: SynType.SignatureParameter([], false, Some id, ty, m), SynArgInfo([], false, Some id) | _ -> raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsSyntaxErrorInLabeledType()) } - | QMARK ident COLON appType + | QMARK ident COLON appTypeCanBeNullable { let m = unionRanges (rhs parseState 1) $4.Range SynType.SignatureParameter([], true, Some $2, $4, m), SynArgInfo([], true, Some $2) } @@ -5906,22 +6017,24 @@ topAppType: let ty = SynType.FromParseError(mColon.EndRange) SynType.SignatureParameter([], true, Some $2, ty, m), SynArgInfo([], true, Some $2) } - | appType + | appTypeCanBeNullable { $1, SynArgInfo([], false, None) } /* Grammar rule meant for recovery scenarios */ /* For example in unionCaseReprElement where function type is not allowed */ invalidUseOfAppTypeFunction: - | appType RARROW invalidUseOfAppTypeFunction + | appTypeWithoutNull RARROW invalidUseOfAppTypeFunction { let mArrow = rhs parseState 2 let m = unionRanges (rhs2 parseState 1 2) $3.Range SynType.Fun($1, $3, m, { ArrowRange = mArrow }) } - | appType RARROW recover + + | appTypeWithoutNull RARROW recover { let mArrow = rhs parseState 2 let ty = SynType.FromParseError(mArrow.EndRange) let m = rhs2 parseState 1 2 SynType.Fun($1, ty, m, { ArrowRange = mArrow }) } - | appType RARROW RARROW invalidUseOfAppTypeFunction + + | appTypeWithoutNull RARROW RARROW invalidUseOfAppTypeFunction { let mArrow1 = rhs parseState 2 let mArrow2 = rhs parseState 3 reportParseErrorAt mArrow2 (FSComp.SR.parsExpectingType ()) @@ -5929,7 +6042,8 @@ invalidUseOfAppTypeFunction: let m1 = unionRanges $1.Range $4.Range let m2 = unionRanges mArrow2 $4.Range SynType.Fun($1, SynType.Fun(ty, $4, m2, { ArrowRange = mArrow2 }), m1, { ArrowRange = mArrow1 }) } - | appType RARROW appType + + | appTypeWithoutNull RARROW appTypeWithoutNull { let mArrow = rhs parseState 2 let m = rhs2 parseState 1 3 SynType.Fun($1, $3, m, { ArrowRange = mArrow }) } @@ -5965,12 +6079,12 @@ typEOF: tupleType: - | appType STAR tupleOrQuotTypeElements + | appTypeCanBeNullable STAR tupleOrQuotTypeElements { let mStar = rhs parseState 2 let path = SynTupleTypeSegment.Type $1 :: SynTupleTypeSegment.Star mStar :: $3 mkSynTypeTuple path } - | appType STAR recover + | appTypeCanBeNullable STAR recover { let mStar = rhs parseState 2 let ty = SynType.FromParseError(mStar.EndRange) let path = [SynTupleTypeSegment.Type $1; SynTupleTypeSegment.Star mStar; SynTupleTypeSegment.Type ty] @@ -5996,28 +6110,28 @@ tupleType: let path = [SynTupleTypeSegment.Slash mSlash; SynTupleTypeSegment.Type ty] mkSynTypeTuple path } - | appType INFIX_STAR_DIV_MOD_OP tupleOrQuotTypeElements + | appTypeCanBeNullable INFIX_STAR_DIV_MOD_OP tupleOrQuotTypeElements { if $2 <> "/" then reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnexpectedInfixOperator()) let mSlash = rhs parseState 2 let path = SynTupleTypeSegment.Type $1 :: SynTupleTypeSegment.Slash mSlash :: $3 mkSynTypeTuple path } - | appType INFIX_STAR_DIV_MOD_OP recover + | appTypeCanBeNullable INFIX_STAR_DIV_MOD_OP recover { if $2 <> "/" then reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnexpectedInfixOperator ()) let mSlash = rhs parseState 2 let ty = SynType.FromParseError(mSlash.EndRange) let path = [SynTupleTypeSegment.Type $1; SynTupleTypeSegment.Slash mSlash; SynTupleTypeSegment.Type ty] mkSynTypeTuple path } - | appType %prec prec_tuptyp_prefix + | appTypeCanBeNullable %prec prec_tuptyp_prefix { $1 } tupleOrQuotTypeElements: - | appType STAR tupleOrQuotTypeElements + | appTypeCanBeNullable STAR tupleOrQuotTypeElements { let mStar = rhs parseState 2 SynTupleTypeSegment.Type $1 :: SynTupleTypeSegment.Star mStar :: $3 } - | appType STAR recover + | appTypeCanBeNullable STAR recover { let mStar = rhs parseState 2 let ty = SynType.FromParseError(mStar.EndRange) [SynTupleTypeSegment.Type $1; SynTupleTypeSegment.Star mStar; SynTupleTypeSegment.Type ty] } @@ -6028,12 +6142,12 @@ tupleOrQuotTypeElements: reportParseErrorAt mStar (FSComp.SR.parsExpectingType ()) SynTupleTypeSegment.Type ty :: SynTupleTypeSegment.Star mStar :: $2 } - | appType INFIX_STAR_DIV_MOD_OP tupleOrQuotTypeElements + | appTypeCanBeNullable INFIX_STAR_DIV_MOD_OP tupleOrQuotTypeElements { if $2 <> "/" then reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnexpectedInfixOperator ()) let mSlash = rhs parseState 2 SynTupleTypeSegment.Type $1 :: SynTupleTypeSegment.Slash mSlash :: $3 } - | appType INFIX_STAR_DIV_MOD_OP recover + | appTypeCanBeNullable INFIX_STAR_DIV_MOD_OP recover { if $2 <> "/" then reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnexpectedInfixOperator ()) let mSlash = rhs parseState 2 let ty = SynType.FromParseError(mSlash.EndRange) @@ -6046,7 +6160,7 @@ tupleOrQuotTypeElements: reportParseErrorAt mSlash (FSComp.SR.parsExpectingType ()) SynTupleTypeSegment.Type ty :: SynTupleTypeSegment.Slash mSlash :: $2 } - | appType %prec prec_tuptyptail_prefix + | appTypeCanBeNullable %prec prec_tuptyptail_prefix { [ SynTupleTypeSegment.Type $1 ] } intersectionType: @@ -6078,14 +6192,28 @@ appTypeConPower: | appTypeCon { $1 } -appType: - | appType arrayTypeSuffix +appTypeCanBeNullable: + | appTypeWithoutNull BAR_JUST_BEFORE_NULL NULL + { SynType.WithNull($1, false, lhs parseState, { BarRange = rhs parseState 2 }) } + + | appTypeWithoutNull + { $1 } + +appTypeNullableInParens: + | appTypeWithoutNull + { $1 } + + | LPAREN appTypeCanBeNullable rparen + { SynType.Paren($2, lhs parseState) } + +appTypeWithoutNull: + | appTypeWithoutNull arrayTypeSuffix { SynType.Array($2, $1, lhs parseState) } - | appType HIGH_PRECEDENCE_BRACK_APP arrayTypeSuffix /* only HPA for "name[]" allowed here */ + | appTypeWithoutNull HIGH_PRECEDENCE_BRACK_APP arrayTypeSuffix /* only HPA for "name[]" allowed here */ { SynType.Array($3, $1, lhs parseState) } - | appType appTypeConPower + | appTypeWithoutNull appTypeConPower /* note: use "rhs parseState 1" to deal with parens in "(int) list" */ { SynType.App($2, None, [$1], [], None, true, unionRanges (rhs parseState 1) $2.Range) } @@ -6286,24 +6414,24 @@ atomType: { reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnmatchedParen ()) SynType.Paren($2, lhs parseState) } - | STRUCT LPAREN appType STAR tupleOrQuotTypeElements rparen + | STRUCT LPAREN appTypeCanBeNullable STAR tupleOrQuotTypeElements rparen { let mStar = rhs parseState 4 let path = SynTupleTypeSegment.Type $3 :: SynTupleTypeSegment.Star mStar :: $5 let m = rhs2 parseState 1 6 SynType.Tuple(true, path, m) } - | STRUCT LPAREN appType STAR tupleOrQuotTypeElements recover + | STRUCT LPAREN appTypeCanBeNullable STAR tupleOrQuotTypeElements recover { reportParseErrorAt (rhs parseState 2) (FSComp.SR.parsUnmatchedParen()) let mStar = rhs parseState 4 let path = SynTupleTypeSegment.Type $3 :: SynTupleTypeSegment.Star mStar :: $5 let m = rhs2 parseState 1 5 SynType.Tuple(true, path, m) } - | STRUCT LPAREN appType STAR recover + | STRUCT LPAREN appTypeCanBeNullable STAR recover { reportParseErrorAt (rhs parseState 2) (FSComp.SR.parsUnmatchedParen()) SynType.Anon(lhs parseState) } - | STRUCT LPAREN appType recover + | STRUCT LPAREN appTypeCanBeNullable recover { reportParseErrorAt (rhs parseState 2) (FSComp.SR.parsUnmatchedParen()) SynType.Anon(lhs parseState) } @@ -6316,7 +6444,7 @@ atomType: | NULL { let m = rhs parseState 1 - SynType.StaticConstant(SynConst.String(null, SynStringKind.Regular, m), m) } + SynType.StaticConstantNull(m) } | CONST atomicExpr { let e, _ = $2 @@ -6716,7 +6844,7 @@ opt_topSeparators: | topSeparator opt_topSeparators { } | /* EMPTY */ { } -/* Seprators in either #light or non-#light */ +/* Separators in either #light or non-#light */ seps: | OBLOCKSEP { None } | SEMICOLON { Some (rhs parseState 1) } @@ -6751,12 +6879,6 @@ deprecated_opt_equals: | EQUALS { deprecatedWithError (FSComp.SR.parsNoEqualShouldFollowNamespace()) (lhs parseState); () } | /* EMPTY */ { } -opt_equals: - | EQUALS - { let mEquals = rhs parseState 1 - Some mEquals } - | /* EMPTY */ { None } - opt_OBLOCKSEP: | OBLOCKSEP { } | /* EMPTY */ { } @@ -6769,10 +6891,6 @@ opt_rec: | REC { true } | /* EMPTY */ { false } -opt_bar: - | BAR { } - | /* EMPTY */ { } - opt_inline: | INLINE { Some(rhs parseState 1) } | /* EMPTY */ { None } diff --git a/src/Compiler/pppars.fsy b/src/Compiler/pppars.fsy index fb2ae8a1c32..41cb41ff38a 100644 --- a/src/Compiler/pppars.fsy +++ b/src/Compiler/pppars.fsy @@ -3,6 +3,9 @@ %{ open FSharp.Compiler.DiagnosticsLogger +#nowarn "64" // turn off warnings that type variables used in production annotations are instantiated to concrete type +#nowarn "3261" // the generated code would need to properly annotate nulls, e.g. changing System.Object to `obj|null` + let dummy = IfdefId("DUMMY") let doNothing _ dflt= diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index e8b29f9dd54..39b41f3b382 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -124,12 +124,12 @@ A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). - A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). + Statický abstraktní člen nevirtuálního rozhraní by měl být volán pouze prostřednictvím parametru typu (například T.{0}). Classes cannot contain static abstract members. - Classes cannot contain static abstract members. + Třídy nemůžou obsahovat statické abstraktní členy. @@ -192,6 +192,11 @@ Známý typ parametru: {0} + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + Argument at index {0} doesn't match Argument na indexu {0} neodpovídá @@ -202,6 +207,16 @@ Argument {0} neodpovídá + + The type '{0}' supports 'null' but a non-null type is expected + The type '{0}' supports 'null' but a non-null type is expected + + + + The type '{0}' uses 'null' as a representation value but a non-null type is expected + The type '{0}' uses 'null' as a representation value but a non-null type is expected + + The constraints 'unmanaged' and 'not struct' are inconsistent Omezení „unmanaged“ a „not struct“ jsou nekonzistentní @@ -227,6 +242,11 @@ Atribut sestavení {0} odkazuje na navržené sestavení {1}, které se nedá načíst nebo neexistuje. Ohlášená výjimka: {2} – {3} + + {0} for F# {1} + {0} for F# {1} + + underscore dot shorthand for accessor only function zkrácený tvar podtržítka pouze pro funkci přístupový objekt @@ -237,6 +257,16 @@ další převody orientované na typ + + Allow access modifiers to auto properties getters and setters + Allow access modifiers to auto properties getters and setters + + + + Allow object expressions without overrides + Allow object expressions without overrides + + applicative computation expressions aplikativní výpočetní výrazy @@ -277,6 +307,11 @@ Vyvolá upozornění, pokud je atribut TailCall použit u nerekurzivních funkcí. + + The interaction between #nowarn and #line is now consistent. + The interaction between #nowarn and #line is now consistent. + + Constraint intersection on flexible types Průnik omezení u flexibilních typů @@ -302,6 +337,11 @@ literál float32 bez tečky + + Support for computation expressions with empty bodies: builder {{ }} + Support for computation expressions with empty bodies: builder {{ }} + + Enforce AttributeTargets Vynutit AttributeTargets @@ -397,9 +437,9 @@ Optimalizuje určitá použití operátorů integrálního rozsahu (..) a kroku rozsahu (.. ..) pro rychlé smyčky while. - - Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to calls to List.map and Array.map when xs is a list or an array, respectively. - Sníží [for x in xs -> f x] a [|for x in xs -> f x|] na volání List.map a Array.map, když xs je seznam, respektive pole. + + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. @@ -442,6 +482,11 @@ nepovinný zprostředkovatel komunikace s možnou hodnotou null + + nullness checking + nullness checking + + open type declaration Otevřít deklaraci typu @@ -459,17 +504,17 @@ # directives with non-quoted string arguments - # directives with non-quoted string arguments + Direktivy # s řetězcovými argumenty bez uvozovek Unexpected identifier '{0}'. - Unexpected identifier '{0}'. + Neočekávaný identifikátor {0}. Unexpected integer literal '{0}'. - Unexpected integer literal '{0}'. + Neočekávaný celočíselný literál {0}. @@ -498,7 +543,7 @@ - whitespace relexation + whitespace relaxation uvolnění prázdných znaků @@ -702,6 +747,11 @@ Používá se ve výpočtových výrazech pro zavedení konstrukce smyčky, kde podmínka je výsledkem jiného výpočtového výrazu. + + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + + a byte string may not be interpolated Bajtový řetězec se nedá interpolovat. @@ -717,11 +767,26 @@ Oblasti IF-FSHARP/IF-CAML už nejsou podporovány. + + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + + + + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + + This is not a valid identifier Toto není platný identifikátor + + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + + A '}}' character must be escaped (by doubling) in an interpolated string. Znak }} musí být v interpolovaném řetězci uvozený (zdvojeným znakem). @@ -827,6 +892,11 @@ Vytiskněte odvozená rozhraní všech kompilovaných souborů do přidružených souborů podpisu. + + Enable nullness declarations and checks + Enable nullness declarations and checks + + Clear the package manager results cache Vymazat mezipaměť výsledků správce balíčků @@ -972,21 +1042,26 @@ Byl očekáván výraz. - - Expecting record field - Očekává se pole záznamu. - - Expecting pattern Očekává se vzorek. + + Expecting record field + Expecting record field + + Expecting type Očekává se typ + + Expecting union case field + Expecting union case field + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Neúplný znakový literál (příklad: Q) nebo volání kvalifikovaného typu (příklad: T.Name) @@ -1053,7 +1128,7 @@ - A constrained generic construct occured in the resumable code specification + A constrained generic construct occurred in the resumable code specification Ve specifikaci obnovitelného kódu došlo k omezené obecné konstrukci. @@ -1068,7 +1143,7 @@ - A 'let rec' occured in the resumable code specification + A 'let rec' occurred in the resumable code specification Ve specifikaci obnovitelného kódu došlo k „let rec“. @@ -1137,24 +1212,29 @@ (Navržený název) + + Access modifiers cannot be applied to an SRTP constraint. + Access modifiers cannot be applied to an SRTP constraint. + + This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. - This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. + Tento aktivní vzor očekává tento počet argumentů výrazu: {0}, například {1}{2}. This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. - This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. + Tento aktivní vzor očekává tento počet argumentů výrazu: {0} a argument vzoru, například {1}{2} pat. This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. - This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. + Tento aktivní vzor neočekává žádné argumenty, tj. měl by se používat takto: {0} a ne takto: {1} x. This active pattern expects exactly one pattern argument, e.g., '{0} pat'. - This active pattern expects exactly one pattern argument, e.g., '{0} pat'. + Tento aktivní vzor očekává přesně jeden argument vzoru, např. {0} pat. @@ -1247,6 +1327,11 @@ Zkrácená syntaxe lambda je podporována pouze pro atomické výrazy, jako je metoda, vlastnost, pole nebo indexer v implicitní argumentu _. Příklad: let f = _. Length'. + + An empty body may only be used if the computation expression builder defines a 'Zero' method. + An empty body may only be used if the computation expression builder defines a 'Zero' method. + + The syntax 'expr1[expr2]' is used for indexing. Consider adding a type annotation to enable indexing, or if calling a function add a space, e.g. 'expr1 [expr2]'. Syntaxe expr1[expr2] se používá pro indexování. Pokud chcete povolit indexování, zvažte možnost přidat anotaci typu, nebo pokud voláte funkci, přidejte mezeru, třeba expr1 [expr2]. @@ -1279,7 +1364,7 @@ This expression uses the implicit conversion '{0}' to convert type '{1}' to type '{2}'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn \"3391\". - Tento výraz používá implicitní převod {0} pro převod typu {1} na typ {2}. Přečtěte si téma https://aka.ms/fsharp-implicit-convs. Toto upozornění může být vypnuté pomocí '#nowarn \"3391\". + Tento výraz používá implicitní převod {0} pro převod typu {1} na typ {2}. Přečtěte si téma https://aka.ms/fsharp-implicit-convs. Toto upozornění může být vypnuté pomocí '#nowarn \"3391\". @@ -1363,7 +1448,7 @@ - The following required properties have to be initalized:{0} + The following required properties have to be initialized:{0} Je třeba inicializovat následující požadované vlastnosti:{0} @@ -1412,6 +1497,16 @@ Hodnota {0} není funkce a nepodporuje zápis indexu. + + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + + + + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + + The syntax 'expr1[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use 'expr1.[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction expr1 [expr2]'. Syntaxe expr1[expr2] je při použití jako argument nejednoznačná. Více informací: https://aka.ms/fsharp-index-notation. Pokud plánujete indexování nebo vytváření řezů, musíte použít expr1.[expr2] na pozici argumentu. Pokud voláte funkci s vícenásobnými curryfikovanými argumenty, přidejte mezi ně mezeru, třeba someFunction expr1 [expr2]. @@ -1437,6 +1532,41 @@ Syntaxe (expr1)[expr2] je teď pro indexování vyhrazená a je při použití jako argument nejednoznačná. Více informací: https://aka.ms/fsharp-index-notation. Pokud voláte funkci s vícenásobnými curryfikovanými argumenty, přidejte mezi ně mezeru, třeba someFunction (expr1) [expr2]. + + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + + + + Value known to be without null passed to a function meant for nullables: {0} + Value known to be without null passed to a function meant for nullables: {0} + + + + You can remove this |Null|NonNull| pattern usage. + You can remove this |Null|NonNull| pattern usage. + + + + You can remove this |NonNullQuick| pattern usage. + You can remove this |NonNullQuick| pattern usage. + + + + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + + + + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + + + + You can remove this `nonNull` assertion. + You can remove this `nonNull` assertion. + + The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a '{0}' method or appropriate 'MergeSources' and 'Bind' methods Konstrukt „let! ... and! ...“ se dá použít jen v případě, že tvůrce výpočetních výrazů definuje buď metodu „{0}“, nebo vhodné metody „MergeSource“ a „Bind“. @@ -1453,7 +1583,7 @@ - Invalid resumable code. A 'let rec' occured in the resumable code specification + Invalid resumable code. A 'let rec' occurred in the resumable code specification Neplatný obnovitelný kód. Ve specifikaci obnovitelného kódu došlo k „let rec“. @@ -1522,6 +1652,11 @@ Vlastnost nesmí určovat volitelné argumenty, in, out, ParamArray, CallerInfo nebo Quote. + + The type '{0}' does not support a nullness qualification. + The type '{0}' does not support a nullness qualification. + + Invalid interpolated string. {0} Neplatný interpolovaný řetězec. {0} @@ -1534,12 +1669,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' se obvykle používá jako omezení typu v obecném kódu, například \"T when ISomeInterface<'T>\" nebo \"let f (x: #ISomeInterface<_>)\". Pokyny najdete v https://aka.ms/fsharp-iwsams. Toto upozornění můžete zakázat pomocí #nowarn \"3536\" nebo '--nowarn:3536'. + '{0}' se obvykle používá jako omezení typu v obecném kódu, například \"T when ISomeInterface<'T>\" nebo \"let f (x: #ISomeInterface<_>)\". Pokyny najdete v https://aka.ms/fsharp-iwsams. Toto upozornění můžete zakázat pomocí #nowarn \"3536\" nebo '--nowarn:3536'. Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - Deklarování \"interfaces with static abstract methods\" (rozhraní se statickými abstraktními metodami) je pokročilá funkce. Pokyny najdete v https://aka.ms/fsharp-iwsams. Toto upozornění můžete zakázat pomocí #nowarn \"3535\" nebo '--nowarn:3535'. + Deklarování \"interfaces with static abstract methods\" (rozhraní se statickými abstraktními metodami) je pokročilá funkce. Pokyny najdete v https://aka.ms/fsharp-iwsams. Toto upozornění můžete zakázat pomocí #nowarn \"3535\" nebo '--nowarn:3535'. @@ -1564,7 +1699,7 @@ A type has been implicitly inferred as 'obj', which may be unintended. Consider adding explicit type annotations. You can disable this warning by using '#nowarn \"3559\"' or '--nowarn:3559'. - Typ se implicitně odvodil jako obj, což může být nezamýšlené. Zvažte přidání explicitních poznámek k typu. Toto upozornění můžete zakázat pomocí #nowarn 3559 nebo --nowarn:3559. + Typ se implicitně odvodil jako obj, což může být nezamýšlené. Zvažte přidání explicitních poznámek k typu. Toto upozornění můžete zakázat pomocí #nowarn 3559 nebo --nowarn:3559. @@ -1899,7 +2034,7 @@ Invalid directive. Expected '#time', '#time \"on\"' or '#time \"off\"'. - Neplatná direktiva. Očekávaná direktiva je #time, #time \"on\" nebo #time \"off\". + Neplatná direktiva. Očekávaná direktiva je #time, #time \"on\" nebo #time \"off\". @@ -4823,8 +4958,8 @@ - This is not a valid name for an active pattern - Toto není platný název aktivního vzoru. + '{0}' is not a valid method name. Use a 'let' binding instead. + '{0}' is not a valid method name. Use a 'let' binding instead. @@ -5768,7 +5903,7 @@ - Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debuggging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). + Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debugging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). Zadejte typ ladění: full, portable, embedded, pdbonly. ({0} je výchozí hodnota v případě, že není zadaný žádný typ ladění, a umožňuje připojení ladicího programu ke spuštěnému programu, portable je formát pro různé platformy, embedded je formát pro různé platformy vložený do výstupního souboru). @@ -6388,8 +6523,8 @@ - This byte array literal contains characters that do not encode as a single byte - Tento literál bajtového pole obsahuje znaky, které se nekódují jako jednobajtové. + This byte array literal contains {0} characters that do not encode as a single byte + This byte array literal contains {0} characters that do not encode as a single byte @@ -6472,11 +6607,6 @@ Toto není platný číselný literál. Platné číselné literály zahrnují hodnoty 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - - This is not a valid byte literal - Toto není platný bajtový literál. - - This is not a valid character literal Toto není platný znakový literál. @@ -7028,7 +7158,7 @@ - The resident compilation service was not used because a problem occured in communicating with the server. + The resident compilation service was not used because a problem occurred in communicating with the server. Rezidentní kompilační služba se nepoužila, protože došlo k potížím při komunikaci se serverem. @@ -7228,7 +7358,7 @@ - An error occured applying the static arguments to a provided type + An error occurred applying the static arguments to a provided type Při použití statických argumentů u poskytnutého typu došlo k chybě. @@ -7293,7 +7423,7 @@ - Assembly '{0}' hase TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name + Assembly '{0}' has TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name Základní atribut TypeProviderAssembly sestavení {0} má neplatnou hodnotu {1}. Hodnotou by měl být platný název sestavení. @@ -7878,7 +8008,7 @@ - An error occured applying the static arguments to a provided method + An error occurred applying the static arguments to a provided method Při použití statických argumentů u poskytnuté metody došlo k chybě. @@ -8007,7 +8137,7 @@ Pokud je typ sjednocení s více písmeny struktura, musí mít všechny případy sjednocení jedinečné názvy. Příklad: 'type A = B of b: int | C z c: int - + The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute. Atribut CallerMemberNameAttribute použitý pro parametr {0} nebude mít žádný účinek. Přepisuje ho atribut CallerFilePathAttribute. @@ -8323,8 +8453,8 @@ - Used to introduce a block of code that might generate an exception. Used together with with or finally. - Slouží k uvození bloku kódu, který může vygenerovat výjimku. Používá se společně s with nebo finally. + Used to introduce a block of code that might generate an exception. Used together with 'with' or 'finally'. + Slouží k uvození bloku kódu, který může vygenerovat výjimku. Používá se společně s with nebo finally. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 26932a4dc81..402571c8a5a 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -124,12 +124,12 @@ A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). - A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). + Ein statischer abstrakter, nicht virtueller Schnittstellenmember sollte nur über den Typparameter aufgerufen werden (z. B. „T.{0}"). Classes cannot contain static abstract members. - Classes cannot contain static abstract members. + Klassen dürfen keine statischen abstrakten Member enthalten. @@ -192,6 +192,11 @@ Bekannter Typparameter: {0} + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + Argument at index {0} doesn't match Das Argument bei Index {0} stimmt nicht überein. @@ -202,6 +207,16 @@ Das Argument "{0}" stimmt nicht überein. + + The type '{0}' supports 'null' but a non-null type is expected + The type '{0}' supports 'null' but a non-null type is expected + + + + The type '{0}' uses 'null' as a representation value but a non-null type is expected + The type '{0}' uses 'null' as a representation value but a non-null type is expected + + The constraints 'unmanaged' and 'not struct' are inconsistent Die Einschränkungen "unmanaged" und "not struct" sind nicht konsistent. @@ -227,6 +242,11 @@ Das Assemblyattribut "{0}" verweist auf eine Designerassembly "{1}", die entweder nicht geladen werden kann oder nicht vorhanden ist. Gemeldete Ausnahme: {2} – {3} + + {0} for F# {1} + {0} for F# {1} + + underscore dot shorthand for accessor only function Unterstrich-Punkt-Kurzschreibweise für Accessorfunktion @@ -237,6 +257,16 @@ zusätzliche typgesteuerte Konvertierungen + + Allow access modifiers to auto properties getters and setters + Allow access modifiers to auto properties getters and setters + + + + Allow object expressions without overrides + Allow object expressions without overrides + + applicative computation expressions applikative Berechnungsausdrücke @@ -277,6 +307,11 @@ Löst Warnungen aus, wenn das Attribut "TailCall" für nicht rekursive Funktionen verwendet wird. + + The interaction between #nowarn and #line is now consistent. + The interaction between #nowarn and #line is now consistent. + + Constraint intersection on flexible types Einschränkungsüberschneidung für flexible Typen @@ -302,6 +337,11 @@ punktloses float32-Literal + + Support for computation expressions with empty bodies: builder {{ }} + Support for computation expressions with empty bodies: builder {{ }} + + Enforce AttributeTargets AttributeTargets erzwingen @@ -397,9 +437,9 @@ Optimiert bestimmte Verwendungen der Operatoren des integralen Bereichs (..) und des Bereichsschritts (.. ..) für schnelle WHILE-Schleifen. - - Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to calls to List.map and Array.map when xs is a list or an array, respectively. - Verringert [für x in xs -> f x] und [|für x in xs -> f x|] für Aufrufe von „List.map“ und „Array.map“, wenn xs eine Liste bzw. ein Array ist. + + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. @@ -442,6 +482,11 @@ Interop, NULL-Werte zulassend, optional + + nullness checking + nullness checking + + open type declaration Deklaration für offene Typen @@ -459,17 +504,17 @@ # directives with non-quoted string arguments - # directives with non-quoted string arguments + # Direktiven mit Zeichenfolgenargumenten ohne Anführungszeichen Unexpected identifier '{0}'. - Unexpected identifier '{0}'. + Unerwarteter Bezeichner: "{0}". Unexpected integer literal '{0}'. - Unexpected integer literal '{0}'. + Unerwartetes Ganzzahl-Literal "{0}". @@ -498,7 +543,7 @@ - whitespace relexation + whitespace relaxation Lockerung für Leerraum @@ -702,6 +747,11 @@ Wird in Berechnungsausdrücken zum Bereitstellen eines Schleifenkonstrukts verwendet, bei dem die Bedingung das Ergebnis eines anderen Berechnungsausdrucks ist. + + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + + a byte string may not be interpolated Eine Bytezeichenfolge darf nicht interpoliert werden. @@ -717,11 +767,26 @@ IF-FSHARP-/IF-CAML-Regionen werden nicht mehr unterstützt + + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + + + + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + + This is not a valid identifier Dies ist kein gültiger Bezeichner. + + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + + A '}}' character must be escaped (by doubling) in an interpolated string. Ein }}-Zeichen muss in einer interpolierten Zeichenfolge (durch Verdoppeln) mit Escapezeichen versehen werden. @@ -827,6 +892,11 @@ Drucken der abgeleiteten Schnittstellen aller Dateien an zugehörige Signaturdateien + + Enable nullness declarations and checks + Enable nullness declarations and checks + + Clear the package manager results cache Löschen Sie den Ergebniscache des Paketmanagers @@ -972,21 +1042,26 @@ Ausdruck wird erwartet - - Expecting record field - Datensatzfeld wird erwartet - - Expecting pattern Muster wird erwartet + + Expecting record field + Expecting record field + + Expecting type Typ wird erwartet + + Expecting union case field + Expecting union case field + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Unvollständiges Zeichenliteral (Beispiel: „Q“) oder qualifizierter Typaufruf (Beispiel: „T.Name“) @@ -1053,7 +1128,7 @@ - A constrained generic construct occured in the resumable code specification + A constrained generic construct occurred in the resumable code specification In der fortsetzbaren Codespezifikation ist ein eingeschränktes generisches Konstrukt aufgetreten. @@ -1068,7 +1143,7 @@ - A 'let rec' occured in the resumable code specification + A 'let rec' occurred in the resumable code specification "Let rec" ist in der fortsetzbaren Codespezifikation aufgetreten. @@ -1137,24 +1212,29 @@ (Empfohlener Name) + + Access modifiers cannot be applied to an SRTP constraint. + Access modifiers cannot be applied to an SRTP constraint. + + This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. - This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. + Dieses aktive Muster erwartet {0} Ausdrucksargumente, z. B. „{1}{2}“. This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. - This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. + Dieses aktive Muster erwartet {0} Ausdrucksargumente und ein Musterargument, z. B. „{1}{2} pat“. This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. - This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. + Dieses aktive Muster erwartet keine Argumente, d. h., es sollte wie folgt verwendet werden: „{0}“ anstelle von „{1} x“. This active pattern expects exactly one pattern argument, e.g., '{0} pat'. - This active pattern expects exactly one pattern argument, e.g., '{0} pat'. + Dieses aktive Muster erwartet genau ein Musterargument, z. B. „{0} pat“. @@ -1247,6 +1327,11 @@ Die Lambdasyntax der Kurzform wird nur für atomische Ausdrücke wie Methode, Eigenschaft, Feld oder Indexer für das implizite Argument "_" unterstützt. Beispiel: "let f = _. Länge". + + An empty body may only be used if the computation expression builder defines a 'Zero' method. + An empty body may only be used if the computation expression builder defines a 'Zero' method. + + The syntax 'expr1[expr2]' is used for indexing. Consider adding a type annotation to enable indexing, or if calling a function add a space, e.g. 'expr1 [expr2]'. Die Syntax "expr1[expr2]" wird für die Indizierung verwendet. Fügen Sie ggf. eine Typanmerkung hinzu, um die Indizierung zu aktivieren, oder fügen Sie beim Aufrufen einer Funktion ein Leerzeichen hinzu, z. B. "expr1 [expr2]". @@ -1279,7 +1364,7 @@ This expression uses the implicit conversion '{0}' to convert type '{1}' to type '{2}'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn \"3391\". - Dieser Ausdruck verwendet die implizite Konvertierung "{0}", um den Typ "{1}" in den Typ "{2}" zu konvertieren. Siehe https://aka.ms/fsharp-implicit-convs. Diese Warnung kann durch "#nowarn \" 3391 \ " deaktiviert werden. + Dieser Ausdruck verwendet die implizite Konvertierung "{0}", um den Typ "{1}" in den Typ "{2}" zu konvertieren. Siehe https://aka.ms/fsharp-implicit-convs. Diese Warnung kann durch "#nowarn \" 3391 \ " deaktiviert werden. @@ -1363,7 +1448,7 @@ - The following required properties have to be initalized:{0} + The following required properties have to be initialized:{0} Die folgenden erforderlichen Eigenschaften müssen initialisiert werden:{0} @@ -1412,6 +1497,16 @@ Der Wert "{0}" ist keine Funktion und unterstützt keine Indexnotation. + + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + + + + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + + The syntax 'expr1[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use 'expr1.[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction expr1 [expr2]'. Die Syntax "expr1[expr2]" ist mehrdeutig, wenn sie als Argument verwendet wird. Siehe https://aka.ms/fsharp-index-notation. Wenn Sie indizieren oder aufteilen möchten, müssen Sie "expr1.[expr2]' in Argumentposition verwenden. Wenn Sie eine Funktion mit mehreren geschweiften Argumenten aufrufen, fügen Sie ein Leerzeichen dazwischen hinzu, z. B. "someFunction expr1 [expr2]". @@ -1437,6 +1532,41 @@ Die Syntax "(expr1)[expr2]" ist jetzt für die Indizierung reserviert und mehrdeutig, wenn sie als Argument verwendet wird. Siehe https://aka.ms/fsharp-index-notation. Wenn Sie eine Funktion mit mehreren geschweiften Argumenten aufrufen, fügen Sie ein Leerzeichen dazwischen hinzu, z. B. "someFunction (expr1) [expr2]". + + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + + + + Value known to be without null passed to a function meant for nullables: {0} + Value known to be without null passed to a function meant for nullables: {0} + + + + You can remove this |Null|NonNull| pattern usage. + You can remove this |Null|NonNull| pattern usage. + + + + You can remove this |NonNullQuick| pattern usage. + You can remove this |NonNullQuick| pattern usage. + + + + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + + + + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + + + + You can remove this `nonNull` assertion. + You can remove this `nonNull` assertion. + + The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a '{0}' method or appropriate 'MergeSources' and 'Bind' methods Das Konstrukt "let! ... and! ..." kann nur verwendet werden, wenn der Berechnungsausdrucks-Generator entweder eine {0}-Methode oder geeignete MergeSources- und Bind-Methoden definiert. @@ -1453,7 +1583,7 @@ - Invalid resumable code. A 'let rec' occured in the resumable code specification + Invalid resumable code. A 'let rec' occurred in the resumable code specification Ungültiger fortsetzbarer Code. "Let rec" ist in der fortsetzbaren Codespezifikation aufgetreten @@ -1522,6 +1652,11 @@ Ein Merkmal darf keine Argumente für „optional“, „in“, „out“, „ParamArray“", „CallerInfo“ oder „Quote“ angeben. + + The type '{0}' does not support a nullness qualification. + The type '{0}' does not support a nullness qualification. + + Invalid interpolated string. {0} Ungültige interpolierte Zeichenfolge. {0} @@ -1534,12 +1669,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - „{0}“ wird normalerweise als Typeinschränkung im generischen Code verwendet, z. B. \"'T when ISomeInterface<'T>\" oder \"let f (x: #ISomeInterface<_>)\". Anleitungen finden Sie unter https://aka.ms/fsharp-iwsams. Sie können diese Warnung deaktivieren, indem Sie „#nowarn \"3536\"“ or „--nowarn:3536“ verwenden. + „{0}“ wird normalerweise als Typeinschränkung im generischen Code verwendet, z. B. \"'T when ISomeInterface<'T>\" oder \"let f (x: #ISomeInterface<_>)\". Anleitungen finden Sie unter https://aka.ms/fsharp-iwsams. Sie können diese Warnung deaktivieren, indem Sie „#nowarn \"3536\"“ or „--nowarn:3536“ verwenden. Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - Das Deklarieren von \"Schnittstellen mit statischen abstrakten Methoden\" ist ein erweitertes Feature. Anleitungen finden Sie unter https://aka.ms/fsharp-iwsams. Sie können diese Warnung deaktivieren, indem Sie „#nowarn \"3535\"“ or „--nowarn:3535“ verwenden. + Das Deklarieren von \"Schnittstellen mit statischen abstrakten Methoden\" ist ein erweitertes Feature. Anleitungen finden Sie unter https://aka.ms/fsharp-iwsams. Sie können diese Warnung deaktivieren, indem Sie „#nowarn \"3535\"“ or „--nowarn:3535“ verwenden. @@ -1564,7 +1699,7 @@ A type has been implicitly inferred as 'obj', which may be unintended. Consider adding explicit type annotations. You can disable this warning by using '#nowarn \"3559\"' or '--nowarn:3559'. - Ein Typ wurde implizit als "obj" abgeleitet, was möglicherweise unbeabsichtigt ist. Erwägen Sie, explizite Typanmerkungen hinzuzufügen. Sie können diese Warnung deaktivieren, indem Sie "#nowarn \"3559\" oder "--nowarn:3559" verwenden. + Ein Typ wurde implizit als "obj" abgeleitet, was möglicherweise unbeabsichtigt ist. Erwägen Sie, explizite Typanmerkungen hinzuzufügen. Sie können diese Warnung deaktivieren, indem Sie "#nowarn \"3559\" oder "--nowarn:3559" verwenden. @@ -1899,7 +2034,7 @@ Invalid directive. Expected '#time', '#time \"on\"' or '#time \"off\"'. - Ungültige Direktive. Erwartet wurde "#time", '#time \"on\"' oder '#time \"off\"'. + Ungültige Direktive. Erwartet wurde "#time", '#time \"on\"' oder '#time \"off\"'. @@ -4823,8 +4958,8 @@ - This is not a valid name for an active pattern - Dies ist kein gültiger Name für ein aktives Muster. + '{0}' is not a valid method name. Use a 'let' binding instead. + '{0}' is not a valid method name. Use a 'let' binding instead. @@ -5768,7 +5903,7 @@ - Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debuggging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). + Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debugging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). Geben Sie den Debugtyp an: full, portable, embedded, pdbonly. ("{0}" ist der Standardwert, wenn kein Debugtyp angegeben wird, und ermöglicht das Anfügen eines Debuggers an ein aktuell ausgeführtes Programm. "portable" ist ein plattformübergreifendes Format, "embedded" ein plattformübergreifendes, in die Ausgabedatei eingebettetes Format). @@ -6388,8 +6523,8 @@ - This byte array literal contains characters that do not encode as a single byte - Dieses Bytearrayliteral enthält Zeichen, die sich nicht als einzelnes Byte codieren lassen. + This byte array literal contains {0} characters that do not encode as a single byte + This byte array literal contains {0} characters that do not encode as a single byte @@ -6472,11 +6607,6 @@ Dies ist kein gültiges numerisches Literal. Unter anderem sind die folgenden numerischen Literale gültig: 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - - This is not a valid byte literal - Dies ist kein gültiges Byteliteral. - - This is not a valid character literal Dies ist kein gültiges Zeichenliteral. @@ -7028,7 +7158,7 @@ - The resident compilation service was not used because a problem occured in communicating with the server. + The resident compilation service was not used because a problem occurred in communicating with the server. Der residente Kompilierungsdienst wurde nicht verwendet, da bei der Kommunikation mit dem Server ein Problem aufgetreten ist. @@ -7228,7 +7358,7 @@ - An error occured applying the static arguments to a provided type + An error occurred applying the static arguments to a provided type Fehler beim Anwenden des statischen Arguments auf einen angegebenen Typ. @@ -7293,7 +7423,7 @@ - Assembly '{0}' hase TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name + Assembly '{0}' has TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name Assembly '{0}' verfügt über ein TypeProviderAssembly-Attribut mit dem ungültigen Wert '{1}'. Beim Wert sollte es sich um einen gültigen Assemblynamen handeln. @@ -7878,7 +8008,7 @@ - An error occured applying the static arguments to a provided method + An error occurred applying the static arguments to a provided method Fehler beim Anwenden der statischen Argumente auf eine angegebene Methode. @@ -8007,7 +8137,7 @@ Wenn ein Mehrfach-Union-Typ eine Struktur ist, müssen alle Union-Fälle eindeutige Namen aufweisen. Beispiel: „type A = B von b: int | C von c: int“. - + The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute. Das auf Parameter "{0}" angewendete CallerMemberNameAttribute hat keine Auswirkung. Es wird vom CallerFilePathAttribute überschrieben. @@ -8323,8 +8453,8 @@ - Used to introduce a block of code that might generate an exception. Used together with with or finally. - Wird verwendet, um einen Codeblock einzuführen, der unter Umständen eine Ausnahme generiert. Wird zusammen mit "with" oder "finally" verwendet. + Used to introduce a block of code that might generate an exception. Used together with 'with' or 'finally'. + Wird verwendet, um einen Codeblock einzuführen, der unter Umständen eine Ausnahme generiert. Wird zusammen mit "with" oder "finally" verwendet. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 5ae9f079d23..d3267a7425c 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -124,12 +124,12 @@ A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). - A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). + Solo se debe llamar a un miembro de interfaz no virtual abstracto estático mediante un parámetro de tipo (por ejemplo: "T.{0}). Classes cannot contain static abstract members. - Classes cannot contain static abstract members. + Las clases no pueden contener miembros abstractos estáticos. @@ -192,6 +192,11 @@ Parámetro de tipo conocido: {0} + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + Argument at index {0} doesn't match El argumento del índice {0} no coincide. @@ -202,6 +207,16 @@ El argumento "{0}" no coincide. + + The type '{0}' supports 'null' but a non-null type is expected + The type '{0}' supports 'null' but a non-null type is expected + + + + The type '{0}' uses 'null' as a representation value but a non-null type is expected + The type '{0}' uses 'null' as a representation value but a non-null type is expected + + The constraints 'unmanaged' and 'not struct' are inconsistent Las restricciones “no administrado” y "no estructurado" son incoherentes @@ -227,6 +242,11 @@ El atributo de ensamblado "{0}" hace referencia a un ensamblado de diseñador "{1}" que no se puede cargar o no existe. Se notificó la excepción: {2} - {3}. + + {0} for F# {1} + {0} for F# {1} + + underscore dot shorthand for accessor only function forma abreviada de punto y guion bajo para la función de solo descriptor de acceso @@ -237,6 +257,16 @@ conversiones adicionales dirigidas a tipos + + Allow access modifiers to auto properties getters and setters + Allow access modifiers to auto properties getters and setters + + + + Allow object expressions without overrides + Allow object expressions without overrides + + applicative computation expressions expresiones de cálculo aplicativas @@ -277,6 +307,11 @@ Genera advertencias si el atributo 'TailCall' se usa en funciones no recursivas. + + The interaction between #nowarn and #line is now consistent. + The interaction between #nowarn and #line is now consistent. + + Constraint intersection on flexible types Intersección de restricciones en tipos flexibles @@ -302,6 +337,11 @@ literal float32 sin punto + + Support for computation expressions with empty bodies: builder {{ }} + Support for computation expressions with empty bodies: builder {{ }} + + Enforce AttributeTargets Aplicar AttributeTargets @@ -397,9 +437,9 @@ Optimiza ciertos usos de los operadores de intervalo entero (..) y paso de intervalo (.. ..) para acelerar los bucles while. - - Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to calls to List.map and Array.map when xs is a list or an array, respectively. - Reduce [for x in xs -> f x] y [|for x in xs -> f x|] a las llamadas a List.map y Array.map cuando xs es una lista o una matriz, respectivamente. + + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. @@ -442,6 +482,11 @@ interoperabilidad opcional que admite valores NULL + + nullness checking + nullness checking + + open type declaration declaración de tipo abierto @@ -459,17 +504,17 @@ # directives with non-quoted string arguments - # directives with non-quoted string arguments + # directivas con argumentos de cadena sin comillas Unexpected identifier '{0}'. - Unexpected identifier '{0}'. + Identificador inesperado "{0}". Unexpected integer literal '{0}'. - Unexpected integer literal '{0}'. + Literal entero inesperado "{0}". @@ -498,7 +543,7 @@ - whitespace relexation + whitespace relaxation relajación de espacio en blanco @@ -702,6 +747,11 @@ Se usa en expresiones de cálculo para introducir una construcción de bucle donde la condición es el resultado de otra expresión de cálculo. + + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + + a byte string may not be interpolated no se puede interpolar una cadena de bytes @@ -717,11 +767,26 @@ Ya no se admiten las regiones IF-FSHARP/IF-CAML + + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + + + + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + + This is not a valid identifier Este nombre no es un identificador válido. + + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + + A '}}' character must be escaped (by doubling) in an interpolated string. El carácter "}}" se debe escapar (duplicándose) en las cadenas interpoladas. @@ -827,6 +892,11 @@ Imprimir las interfaces deducidas de todos los archivos de compilación en los archivos de signatura asociados + + Enable nullness declarations and checks + Enable nullness declarations and checks + + Clear the package manager results cache Borrar la caché de resultados del administrador de paquetes @@ -972,21 +1042,26 @@ Se espera una expresión - - Expecting record field - Se espera un campo de registro - - Expecting pattern Se espera un patrón + + Expecting record field + Expecting record field + + Expecting type Tipo esperado + + Expecting union case field + Expecting union case field + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Literal de carácter incompleto (ejemplo: 'Q') o invocación de tipo completo (ejemplo: 'T.Name) @@ -1053,7 +1128,7 @@ - A constrained generic construct occured in the resumable code specification + A constrained generic construct occurred in the resumable code specification En la especificación del código resumible aparecía una construcción genérica restringida @@ -1068,7 +1143,7 @@ - A 'let rec' occured in the resumable code specification + A 'let rec' occurred in the resumable code specification Se ha producido "let rec" en la especificación de código reanudable @@ -1137,24 +1212,29 @@ (Nombre sugerido) + + Access modifiers cannot be applied to an SRTP constraint. + Access modifiers cannot be applied to an SRTP constraint. + + This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. - This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. + Este patrón activo espera {0} argumentos de expresión; por ejemplo, "{1}{2}". This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. - This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. + Este patrón activo espera {0} argumentos de expresión y un argumento de patrón, por ejemplo, "{1}{2} pat". This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. - This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. + Este patrón activo no espera argumentos, es decir, debe usarse como "{0}" en lugar de "{1} x". This active pattern expects exactly one pattern argument, e.g., '{0} pat'. - This active pattern expects exactly one pattern argument, e.g., '{0} pat'. + Este patrón activo espera exactamente un argumento de patrón, por ejemplo, "{0} pat". @@ -1247,6 +1327,11 @@ La sintaxis lambda abreviada solo se admite para expresiones atómicas, como el método, la propiedad, el campo o el indexador en el argumento '_' implícito. Por ejemplo: 'let f = _.Length'. + + An empty body may only be used if the computation expression builder defines a 'Zero' method. + An empty body may only be used if the computation expression builder defines a 'Zero' method. + + The syntax 'expr1[expr2]' is used for indexing. Consider adding a type annotation to enable indexing, or if calling a function add a space, e.g. 'expr1 [expr2]'. La sintaxis "expr1[expr2]" se usa para la indexación. Considere la posibilidad de agregar una anotación de tipo para habilitar la indexación, si se llama a una función, agregue un espacio, por ejemplo, "expr1 [expr2]". @@ -1279,7 +1364,7 @@ This expression uses the implicit conversion '{0}' to convert type '{1}' to type '{2}'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn \"3391\". - Esta expresión usa la conversión implícita '{0}' para convertir el tipo '{1}' al tipo '{2}'. Consulte https://aka.ms/fsharp-implicit-convs. Esta advertencia se puede deshabilitar mediante '#nowarn \"3391\". + Esta expresión usa la conversión implícita '{0}' para convertir el tipo '{1}' al tipo '{2}'. Consulte https://aka.ms/fsharp-implicit-convs. Esta advertencia se puede deshabilitar mediante '#nowarn \"3391\". @@ -1363,7 +1448,7 @@ - The following required properties have to be initalized:{0} + The following required properties have to be initialized:{0} Se deben inicializar las siguientes propiedades necesarias:{0} @@ -1412,6 +1497,16 @@ El valor "{0}" no es una función y no admite la notación de índices. + + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + + + + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + + The syntax 'expr1[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use 'expr1.[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction expr1 [expr2]'. La sintaxis "expr1[expr2]" es ambigua cuando se usa como argumento. Vea https://aka.ms/fsharp-index-notation. Si piensa indexar o segmentar, debe usar "expr1.[expr2]" en la posición del argumento. Si se llama a una función con varios argumentos currificados, se agregará un espacio entre ellos, por ejemplo, "unaFunción expr1 [expr2]". @@ -1437,6 +1532,41 @@ La sintaxis "(expr1)[expr2]" está reservada ahora para la indexación y es ambigua cuando se usa como argumento. Vea https://aka.ms/fsharp-index-notation. Si se llama a una función con varios argumentos currificados, agregue un espacio entre ellos, por ejemplo, "unaFunción (expr1) [expr2]". + + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + + + + Value known to be without null passed to a function meant for nullables: {0} + Value known to be without null passed to a function meant for nullables: {0} + + + + You can remove this |Null|NonNull| pattern usage. + You can remove this |Null|NonNull| pattern usage. + + + + You can remove this |NonNullQuick| pattern usage. + You can remove this |NonNullQuick| pattern usage. + + + + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + + + + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + + + + You can remove this `nonNull` assertion. + You can remove this `nonNull` assertion. + + The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a '{0}' method or appropriate 'MergeSources' and 'Bind' methods La construcción "let! ... and! ..." solo se puede usar si el generador de expresiones de cálculo define un método "{0}" o bien los métodos "MergeSources" y "Bind" adecuados. @@ -1453,7 +1583,7 @@ - Invalid resumable code. A 'let rec' occured in the resumable code specification + Invalid resumable code. A 'let rec' occurred in the resumable code specification Código reanudable no válido. Se ha producido "let rec" en la especificación de código reanudable @@ -1522,6 +1652,11 @@ Un rasgo no puede especificar argumentos opcionales, in, out, ParamArray, CallerInfo o Quote + + The type '{0}' does not support a nullness qualification. + The type '{0}' does not support a nullness qualification. + + Invalid interpolated string. {0} Cadena interpolada no válida. {0} @@ -1534,12 +1669,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' se usa normalmente como restricción de tipo en código genérico; por ejemplo, \"'T when ISomeInterface<'T>\" o \"let f (x: #ISomeInterface<_>)\". Consulte https://aka.ms/fsharp-iwsams para obtener instrucciones. Puede deshabilitar esta advertencia con "#nowarn \"3536\"" o "--nowarn:3536". + '{0}' se usa normalmente como restricción de tipo en código genérico; por ejemplo, \"'T when ISomeInterface<'T>\" o \"let f (x: #ISomeInterface<_>)\". Consulte https://aka.ms/fsharp-iwsams para obtener instrucciones. Puede deshabilitar esta advertencia con "#nowarn \"3536\"" o "--nowarn:3536". Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - Declarar \"interfaces con métodos abstractos estáticos\" es una característica avanzada. Consulte https://aka.ms/fsharp-iwsams para obtener instrucciones. Puede deshabilitar esta advertencia con "#nowarn \"3535\"" o "--nowarn:3535". + Declarar \"interfaces con métodos abstractos estáticos\" es una característica avanzada. Consulte https://aka.ms/fsharp-iwsams para obtener instrucciones. Puede deshabilitar esta advertencia con "#nowarn \"3535\"" o "--nowarn:3535". @@ -1564,7 +1699,7 @@ A type has been implicitly inferred as 'obj', which may be unintended. Consider adding explicit type annotations. You can disable this warning by using '#nowarn \"3559\"' or '--nowarn:3559'. - Se ha inferido implícitamente un tipo como "obj", lo que puede ser involuntario. Considere agregar anotaciones de tipo explícitas. Puede desactivar esta advertencia utilizando "#nowarn \"3559\"" o "--nowarn:3559". + Se ha inferido implícitamente un tipo como "obj", lo que puede ser involuntario. Considere agregar anotaciones de tipo explícitas. Puede desactivar esta advertencia utilizando "#nowarn \"3559\"" o "--nowarn:3559". @@ -1899,7 +2034,7 @@ Invalid directive. Expected '#time', '#time \"on\"' or '#time \"off\"'. - Directiva no válida. Se esperaba '#time', '#time \"on\"' o '#time \"off\"'. + Directiva no válida. Se esperaba '#time', '#time \"on\"' o '#time \"off\"'. @@ -4823,8 +4958,8 @@ - This is not a valid name for an active pattern - Este no es un nombre válido para un patrón activo. + '{0}' is not a valid method name. Use a 'let' binding instead. + '{0}' is not a valid method name. Use a 'let' binding instead. @@ -5768,7 +5903,7 @@ - Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debuggging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). + Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debugging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). Especifique el tipo de depuración: full, portable, embedded, pdbonly. ('{0}' es el valor predeterminado si no se especifica ningún tipo de depuración y permite conectar un depurador a un programa en ejecución, 'portable' es un formato multiplataforma, 'embedded' es un formato multiplataforma insertado en el archivo de salida). @@ -6388,8 +6523,8 @@ - This byte array literal contains characters that do not encode as a single byte - Este literal de matriz de bytes contiene caracteres que no se codifican como un solo byte. + This byte array literal contains {0} characters that do not encode as a single byte + This byte array literal contains {0} characters that do not encode as a single byte @@ -6472,11 +6607,6 @@ Este literal numérico no es válido. Entre los literales numéricos válidos se incluyen 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - - This is not a valid byte literal - Este no es un literal de byte válido. - - This is not a valid character literal Este no es un literal de carácter válido. @@ -7028,7 +7158,7 @@ - The resident compilation service was not used because a problem occured in communicating with the server. + The resident compilation service was not used because a problem occurred in communicating with the server. El servicio de compilación residente no se usó porque se produjo un problema en la comunicación con el servidor. @@ -7228,7 +7358,7 @@ - An error occured applying the static arguments to a provided type + An error occurred applying the static arguments to a provided type Error al aplicar los argumentos estáticos a un tipo proporcionado. @@ -7293,7 +7423,7 @@ - Assembly '{0}' hase TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name + Assembly '{0}' has TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name El ensamblado '{0}' tiene el atributo TypeProviderAssembly con el valor '{1}' no válido. El valor debe ser un nombre de ensamblado válido. @@ -7878,7 +8008,7 @@ - An error occured applying the static arguments to a provided method + An error occurred applying the static arguments to a provided method Se produjo un error al aplicar los argumentos estáticos a un método proporcionado @@ -8007,7 +8137,7 @@ Si un tipo de unión multicase es un struct, todos los casos de unión deben tener nombres únicos. Por ejemplo: 'type A = B of b: int | C of c: int'. - + The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute. El CallerMemberNameAttribute aplicado al parámetro '{0}' no tendrá ningún efecto. Este se reemplaza por CallerFilePathAttribute. @@ -8323,8 +8453,8 @@ - Used to introduce a block of code that might generate an exception. Used together with with or finally. - Se usa para incluir un bloque de código que puede generar una excepción. Se usa junto con with o finally. + Used to introduce a block of code that might generate an exception. Used together with 'with' or 'finally'. + Se usa para incluir un bloque de código que puede generar una excepción. Se usa junto con with o finally. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index a8ae73b3c65..f74bc4e3196 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -124,12 +124,12 @@ A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). - A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). + Un membre d’interface non virtuel abstrait statique doit être appelé uniquement via le paramètre de type (par exemple : 'T.{0}). Classes cannot contain static abstract members. - Classes cannot contain static abstract members. + Les classes ne peuvent pas contenir de membres abstraits statiques. @@ -192,6 +192,11 @@ Paramètre de type connu : {0} + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + Argument at index {0} doesn't match L'argument à l'index {0} ne correspond pas @@ -202,6 +207,16 @@ L'argument '{0}' ne correspond pas + + The type '{0}' supports 'null' but a non-null type is expected + The type '{0}' supports 'null' but a non-null type is expected + + + + The type '{0}' uses 'null' as a representation value but a non-null type is expected + The type '{0}' uses 'null' as a representation value but a non-null type is expected + + The constraints 'unmanaged' and 'not struct' are inconsistent Les contraintes « non gérées » et « non structurées » sont incohérentes @@ -227,6 +242,11 @@ L'attribut d'assembly '{0}' fait référence à un assembly de concepteur '{1}' qui ne peut pas être chargé ou qui n'existe pas. Exception signalée : {2} - {3} + + {0} for F# {1} + {0} for F# {1} + + underscore dot shorthand for accessor only function raccourci de point de soulignement pour la fonction d'accesseur uniquement @@ -237,6 +257,16 @@ conversions supplémentaires dirigées vers le type + + Allow access modifiers to auto properties getters and setters + Allow access modifiers to auto properties getters and setters + + + + Allow object expressions without overrides + Allow object expressions without overrides + + applicative computation expressions expressions de calcul applicatives @@ -277,6 +307,11 @@ Émet des avertissements si l’attribut « TailCall » est utilisé sur des fonctions non récursives. + + The interaction between #nowarn and #line is now consistent. + The interaction between #nowarn and #line is now consistent. + + Constraint intersection on flexible types Intersection de contraintes sur les types flexibles @@ -302,6 +337,11 @@ littéral float32 sans point + + Support for computation expressions with empty bodies: builder {{ }} + Support for computation expressions with empty bodies: builder {{ }} + + Enforce AttributeTargets Appliquer AttributeTargets @@ -397,9 +437,9 @@ Optimise certaines utilisations des opérateurs de plage intégrale (..) et d’étape de plage (.. ..) en boucles while rapides. - - Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to calls to List.map and Array.map when xs is a list or an array, respectively. - Diminue [for x in xs -> f x] et [|for x in xs -> f x|] aux appels à List.map et Array.map, respectivement lorsque xs est une liste ou un tableau. + + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. @@ -442,6 +482,11 @@ interopérabilité facultative pouvant accepter une valeur null + + nullness checking + nullness checking + + open type declaration déclaration de type ouverte @@ -459,17 +504,17 @@ # directives with non-quoted string arguments - # directives with non-quoted string arguments + # directives avec des arguments de chaîne non entre guillemets Unexpected identifier '{0}'. - Unexpected identifier '{0}'. + Identificateur inattendu '{0}'. Unexpected integer literal '{0}'. - Unexpected integer literal '{0}'. + Littéral entier inattendu '{0}'. @@ -498,7 +543,7 @@ - whitespace relexation + whitespace relaxation assouplissement de la mise en retrait avec des espaces blancs @@ -702,6 +747,11 @@ Utilisé dans les expressions de calcul pour introduire une construction en boucle où la condition est le résultat d'une autre expression de calcul. + + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + + a byte string may not be interpolated une chaîne d'octets ne peut pas être interpolée @@ -717,11 +767,26 @@ Les régions IF-FSHARP/IF-CAML ne sont plus prises en charge. + + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + + + + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + + This is not a valid identifier Ceci n'est pas un identifiant valide + + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + + A '}}' character must be escaped (by doubling) in an interpolated string. Un caractère '}}' doit faire l'objet d'une séquence d'échappement (par doublement) dans une chaîne interpolée. @@ -827,6 +892,11 @@ Imprimer les interfaces inférées de tous les fichiers de compilation sur les fichiers de signature associés + + Enable nullness declarations and checks + Enable nullness declarations and checks + + Clear the package manager results cache Effacer le cache des résultats du Gestionnaire de package @@ -972,21 +1042,26 @@ Expression attendue - - Expecting record field - Champ d’enregistrement attendu - - Expecting pattern Modèle attendu + + Expecting record field + Expecting record field + + Expecting type Type attendu + + Expecting union case field + Expecting union case field + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Littéral de caractère incomplet (exemple : 'Q') ou appel de type qualifié (exemple : 'T.Name) @@ -1053,7 +1128,7 @@ - A constrained generic construct occured in the resumable code specification + A constrained generic construct occurred in the resumable code specification Une construction générique contrainte s'est produite dans la spécification de code de reprise @@ -1068,7 +1143,7 @@ - A 'let rec' occured in the resumable code specification + A 'let rec' occurred in the resumable code specification Un «let rec» s’est produit dans la spécification de code pouvant être repris @@ -1137,24 +1212,29 @@ (Nom suggéré) + + Access modifiers cannot be applied to an SRTP constraint. + Access modifiers cannot be applied to an SRTP constraint. + + This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. - This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. + Ce modèle actif attend {0} argument(s) d’expression, par exemple, '{1}{2}'. This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. - This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. + Ce modèle actif attend des arguments d'expression {0} et un argument de modèle, par exemple '{1}{2} pat'. This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. - This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. + Ce modèle actif n’attend aucun argument, c’est-à-dire qu’il doit être utilisé comme «{0}» au lieu de «{1} x ». This active pattern expects exactly one pattern argument, e.g., '{0} pat'. - This active pattern expects exactly one pattern argument, e.g., '{0} pat'. + Ce modèle actif attend exactement un argument de modèle, par exemple, «{0} pat ». @@ -1247,6 +1327,11 @@ La syntaxe lambda raccourcie est prise en charge uniquement pour les expressions atomiques, telles que la méthode, la propriété, le champ ou l’indexeur sur l’argument ’_’ implicite. Par exemple : « let f = _. Longueur ». + + An empty body may only be used if the computation expression builder defines a 'Zero' method. + An empty body may only be used if the computation expression builder defines a 'Zero' method. + + The syntax 'expr1[expr2]' is used for indexing. Consider adding a type annotation to enable indexing, or if calling a function add a space, e.g. 'expr1 [expr2]'. La syntaxe « expr1[expr2] » est utilisée pour l’indexation. Envisagez d’ajouter une annotation de type pour activer l’indexation, ou si vous appelez une fonction, ajoutez un espace, par exemple « expr1 [expr2] ». @@ -1279,7 +1364,7 @@ This expression uses the implicit conversion '{0}' to convert type '{1}' to type '{2}'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn \"3391\". - Cette expression utilise la conversion implicite '{0}' pour convertir le type '{1}' en type '{2}'. Voir https://aka.ms/fsharp-implicit-convs. Cet avertissement peut être désactivé en utilisant '#nowarn \"3391\". + Cette expression utilise la conversion implicite '{0}' pour convertir le type '{1}' en type '{2}'. Voir https://aka.ms/fsharp-implicit-convs. Cet avertissement peut être désactivé en utilisant '#nowarn \"3391\". @@ -1363,7 +1448,7 @@ - The following required properties have to be initalized:{0} + The following required properties have to be initialized:{0} Les propriétés requises suivantes doivent être initialisées :{0} @@ -1412,6 +1497,16 @@ La valeur « {0} » n’est pas une fonction et ne prend pas en charge la notation d’index. + + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + + + + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + + The syntax 'expr1[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use 'expr1.[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction expr1 [expr2]'. La syntaxe « expr1[expr2] » est ambiguë lorsqu’elle est utilisée comme argument. Voir https://aka.ms/fsharp-index-notation. Si vous avez l’intention d’indexer ou de découper, vous devez utiliser « expr1.[expr2] » en position d’argument. Si vous appelez une fonction avec plusieurs arguments codés, ajoutez un espace entre eux, par exemple « someFunction expr1 [expr2] ». @@ -1437,6 +1532,41 @@ La syntaxe « (expr1)[expr2] » est désormais réservée à l’indexation et est ambiguë lorsqu’elle est utilisée comme argument. Voir https://aka.ms/fsharp-index-notation. Si vous appelez une fonction avec plusieurs arguments codés, ajoutez un espace entre eux, par exemple « someFunction (expr1) [expr2] ». + + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + + + + Value known to be without null passed to a function meant for nullables: {0} + Value known to be without null passed to a function meant for nullables: {0} + + + + You can remove this |Null|NonNull| pattern usage. + You can remove this |Null|NonNull| pattern usage. + + + + You can remove this |NonNullQuick| pattern usage. + You can remove this |NonNullQuick| pattern usage. + + + + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + + + + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + + + + You can remove this `nonNull` assertion. + You can remove this `nonNull` assertion. + + The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a '{0}' method or appropriate 'MergeSources' and 'Bind' methods Le « laissez ! » ... et! ...' ne peut être utilisée que si le générateur d'expression de calcul définit soit une méthode '{0}', soit des méthodes 'MergeSources' et 'Bind' appropriées. @@ -1453,7 +1583,7 @@ - Invalid resumable code. A 'let rec' occured in the resumable code specification + Invalid resumable code. A 'let rec' occurred in the resumable code specification Code pouvant être reprise non valide. Un «let rec» s’est produit dans la spécification de code pouvant être repris @@ -1522,6 +1652,11 @@ Une caractéristique ne peut pas spécifier d’arguments facultatifs, in, out, ParamArray, CallerInfo ou Quote + + The type '{0}' does not support a nullness qualification. + The type '{0}' does not support a nullness qualification. + + Invalid interpolated string. {0} Chaîne interpolée non valide. {0} @@ -1534,12 +1669,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' est généralement utilisée comme contrainte de type dans le code générique, par exemple \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". Consultez https://aka.ms/fsharp-iwsams pour obtenir de l’aide. Vous pouvez désactiver cet avertissement à l’aide de '#nowarn \"3536\"' or '--nowarn:3536'. + '{0}' est généralement utilisée comme contrainte de type dans le code générique, par exemple \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". Consultez https://aka.ms/fsharp-iwsams pour obtenir de l’aide. Vous pouvez désactiver cet avertissement à l’aide de '#nowarn \"3536\"' or '--nowarn:3536'. Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - La déclaration de \"interfaces with static abstract methods\" est une fonctionnalité avancée. Consultez https://aka.ms/fsharp-iwsams pour obtenir de l’aide. Vous pouvez désactiver cet avertissement à l’aide de '#nowarn \"3535\"' or '--nowarn:3535'. + La déclaration de \"interfaces with static abstract methods\" est une fonctionnalité avancée. Consultez https://aka.ms/fsharp-iwsams pour obtenir de l’aide. Vous pouvez désactiver cet avertissement à l’aide de '#nowarn \"3535\"' or '--nowarn:3535'. @@ -1564,7 +1699,7 @@ A type has been implicitly inferred as 'obj', which may be unintended. Consider adding explicit type annotations. You can disable this warning by using '#nowarn \"3559\"' or '--nowarn:3559'. - Un type a été implicitement déduit comme 'obj', ce qui peut être involontaire. Envisagez d'ajouter des annotations de type explicites. Vous pouvez désactiver cet avertissement en utilisant '#nowarn \"3559\"' ou '--nowarn:3559'. + Un type a été implicitement déduit comme 'obj', ce qui peut être involontaire. Envisagez d'ajouter des annotations de type explicites. Vous pouvez désactiver cet avertissement en utilisant '#nowarn \"3559\"' ou '--nowarn:3559'. @@ -1899,7 +2034,7 @@ Invalid directive. Expected '#time', '#time \"on\"' or '#time \"off\"'. - Directive non valide. '#time', '#time \"on\"' ou '#time \"off\"' attendu. + Directive non valide. '#time', '#time \"on\"' ou '#time \"off\"' attendu. @@ -4823,8 +4958,8 @@ - This is not a valid name for an active pattern - Nom non valide pour un modèle actif + '{0}' is not a valid method name. Use a 'let' binding instead. + '{0}' is not a valid method name. Use a 'let' binding instead. @@ -5768,7 +5903,7 @@ - Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debuggging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). + Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debugging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). Spécifiez le type de débogage : full, portable, embedded, pdbonly. ('{0}' est la valeur par défaut si aucun type de débogage n'est spécifié. Cette valeur permet d'attacher un débogueur à un programme en cours d'exécution, 'portable' est un format multiplateforme, 'embedded' est un format multiplateforme incorporé dans le fichier de sortie). @@ -6388,8 +6523,8 @@ - This byte array literal contains characters that do not encode as a single byte - Ce littéral de tableau d'octets contient des caractères qui ne sont pas encodés sous forme d'octet unique + This byte array literal contains {0} characters that do not encode as a single byte + This byte array literal contains {0} characters that do not encode as a single byte @@ -6472,11 +6607,6 @@ Il ne s’agit pas d’un littéral numérique valide. Les littéraux numériques valides incluent 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1,0 (float/double), 1,0f (float32/single), 1,0 m (décimal), 1I (bigint). - - This is not a valid byte literal - Littéral d'octet non valide - - This is not a valid character literal Littéral de caractère non valide @@ -7028,7 +7158,7 @@ - The resident compilation service was not used because a problem occured in communicating with the server. + The resident compilation service was not used because a problem occurred in communicating with the server. Le service de compilation résident n'a pas été utilisé en raison d'un problème lors de la communication avec le serveur. @@ -7228,7 +7358,7 @@ - An error occured applying the static arguments to a provided type + An error occurred applying the static arguments to a provided type Une erreur s'est produite lors de l'application des arguments statiques à un type fourni @@ -7293,7 +7423,7 @@ - Assembly '{0}' hase TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name + Assembly '{0}' has TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name L'assembly '{0}' a un attribut TypeProviderAssembly comportant la valeur non valide '{1}'. La valeur doit être un nom d'assembly valide @@ -7878,7 +8008,7 @@ - An error occured applying the static arguments to a provided method + An error occurred applying the static arguments to a provided method Une erreur s'est produite durant l'application des arguments statiques à une méthode fournie @@ -8007,7 +8137,7 @@ Si un type d’union multi-cas est un struct, alors tous les cas d’union doivent avoir des noms uniques. Par exemple : 'type A = B de b : int | C de c : int'. - + The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute. CallerMemberNameAttribute, qui est appliqué au paramètre '{0}', n'aura aucun effet. Il est remplacé par CallerFilePathAttribute. @@ -8323,8 +8453,8 @@ - Used to introduce a block of code that might generate an exception. Used together with with or finally. - Permet d'introduire un bloc de code pouvant générer une exception. Utilisé avec with ou finally. + Used to introduce a block of code that might generate an exception. Used together with 'with' or 'finally'. + Permet d'introduire un bloc de code pouvant générer une exception. Utilisé avec with ou finally. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 8bfde9a01b8..3495d0c1659 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -124,12 +124,12 @@ A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). - A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). + Un membro di interfaccia non virtuale astratto statico deve essere chiamato solo tramite un parametro di tipo, ad esempio 'T.{0}. Classes cannot contain static abstract members. - Classes cannot contain static abstract members. + Le classi non possono contenere membri astratti statici. @@ -192,6 +192,11 @@ Parametro di tipo noto: {0} + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + Argument at index {0} doesn't match L'argomento alla posizione di indice {0} non corrisponde @@ -202,6 +207,16 @@ L'argomento '{0}' non corrisponde + + The type '{0}' supports 'null' but a non-null type is expected + The type '{0}' supports 'null' but a non-null type is expected + + + + The type '{0}' uses 'null' as a representation value but a non-null type is expected + The type '{0}' uses 'null' as a representation value but a non-null type is expected + + The constraints 'unmanaged' and 'not struct' are inconsistent I vincoli 'unmanaged' e 'not struct' sono incoerenti @@ -227,6 +242,11 @@ L'attributo di assembly '{0}' fa riferimento a un assembly '{1}' della finestra di progettazione che non è stato caricato o non esiste. L'eccezione restituita è {2} - {3} + + {0} for F# {1} + {0} for F# {1} + + underscore dot shorthand for accessor only function sintassi abbreviata del punto di sottolineatura solo per la funzione di accesso @@ -237,6 +257,16 @@ conversioni aggiuntive dirette ai tipi + + Allow access modifiers to auto properties getters and setters + Allow access modifiers to auto properties getters and setters + + + + Allow object expressions without overrides + Allow object expressions without overrides + + applicative computation expressions espressioni di calcolo applicativo @@ -277,6 +307,11 @@ Genera avvisi se l'attributo 'TailCall' viene utilizzato in funzioni non ricorsive. + + The interaction between #nowarn and #line is now consistent. + The interaction between #nowarn and #line is now consistent. + + Constraint intersection on flexible types Intersezione di vincoli su tipi flessibili @@ -302,6 +337,11 @@ valore letterale float32 senza punti + + Support for computation expressions with empty bodies: builder {{ }} + Support for computation expressions with empty bodies: builder {{ }} + + Enforce AttributeTargets Imponi destinazioni attributo @@ -397,9 +437,9 @@ Ottimizza determinati utilizzi degli operatori di intervallo integrale (..) e di intervallo di fase (.. ..) in cicli while veloci. - - Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to calls to List.map and Array.map when xs is a list or an array, respectively. - Riduce [per x in xs -> f x] e [|per x in xs -> f x|] alle chiamate rispettivamente a List.map e Array.map quando xs è un elenco o una matrice. + + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. @@ -442,6 +482,11 @@ Interop facoltativo nullable + + nullness checking + nullness checking + + open type declaration dichiarazione di tipo aperto @@ -459,17 +504,17 @@ # directives with non-quoted string arguments - # directives with non-quoted string arguments + # direttive con argomenti stringa non delimitati Unexpected identifier '{0}'. - Unexpected identifier '{0}'. + Identificatore non previsto: '{0}'. Unexpected integer literal '{0}'. - Unexpected integer literal '{0}'. + Valore letterale integer '{0}' imprevisto. @@ -498,7 +543,7 @@ - whitespace relexation + whitespace relaxation uso meno restrittivo degli spazi vuoti @@ -702,6 +747,11 @@ Usato nelle espressioni di calcolo per introdurre un costrutto con riprodurre a ciclo continuo in cui la condizione è il risultato di un'altra espressione di calcolo. + + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + + a byte string may not be interpolated non è possibile interpolare una stringa di byte @@ -717,11 +767,26 @@ Le aree IF-FSHARP/IF-CAML non sono più supportate + + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + + + + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + + This is not a valid identifier Non si tratta di un identificatore valido. + + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + + A '}}' character must be escaped (by doubling) in an interpolated string. In una stringa interpolata è necessario specificare il carattere di escape di un carattere '}}' raddoppiandolo. @@ -827,6 +892,11 @@ Stampare le interfacce derivate di tutti i file di compilazione nei file di firma associati + + Enable nullness declarations and checks + Enable nullness declarations and checks + + Clear the package manager results cache Cancellare la cache dei risultati di Gestione pacchetti @@ -972,21 +1042,26 @@ Prevista espressione. - - Expecting record field - Previsto campo record - - Expecting pattern Criterio previsto + + Expecting record field + Expecting record field + + Expecting type Previsto tipo + + Expecting union case field + Expecting union case field + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Valore letterale carattere incompleto (ad esempio: 'Q') o chiamata di tipo qualificato (ad esempio: 'T.Name) @@ -1053,7 +1128,7 @@ - A constrained generic construct occured in the resumable code specification + A constrained generic construct occurred in the resumable code specification Costrutto generico vincolato nella specifica del codice ripristinabile @@ -1068,7 +1143,7 @@ - A 'let rec' occured in the resumable code specification + A 'let rec' occurred in the resumable code specification È stata rilevata una funzione 'let rec' nella specifica del codice ripristinabile @@ -1137,24 +1212,29 @@ (Nome consigliato) + + Access modifiers cannot be applied to an SRTP constraint. + Access modifiers cannot be applied to an SRTP constraint. + + This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. - This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. + Questo criterio attivo prevede {0} argomenti di espressione, ad esempio '{1}{2}'. This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. - This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. + Questo criterio attivo prevede {0} argomento/i dell'espressione e un argomento del criterio, ad esempio '{1}{2} pat'. This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. - This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. + Questo criterio attivo non prevede argomenti, ad esempio deve essere usato come '{0}' anziché '{1} x'. This active pattern expects exactly one pattern argument, e.g., '{0} pat'. - This active pattern expects exactly one pattern argument, e.g., '{0} pat'. + Questo criterio attivo prevede esattamente un argomento del criterio, ad esempio '{0} pat'. @@ -1247,6 +1327,11 @@ La sintassi lambda a sintassi abbreviata è supportata solo per le espressioni atomiche, ad esempio metodo, proprietà, campo o indicizzatore nell'argomento '_' implicito. Ad esempio: 'let f = _. Lunghezza'. + + An empty body may only be used if the computation expression builder defines a 'Zero' method. + An empty body may only be used if the computation expression builder defines a 'Zero' method. + + The syntax 'expr1[expr2]' is used for indexing. Consider adding a type annotation to enable indexing, or if calling a function add a space, e.g. 'expr1 [expr2]'. La sintassi 'expr1[expr2]' viene usata per l'indicizzazione. Provare ad aggiungere un'annotazione di tipo per abilitare l'indicizzazione oppure se la chiamata a una funzione aggiunge uno spazio, ad esempio 'expr1 [expr2]'. @@ -1279,7 +1364,7 @@ This expression uses the implicit conversion '{0}' to convert type '{1}' to type '{2}'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn \"3391\". - Questa espressione usa la conversione implicita '{0}' per convertire il tipo '{1}' nel tipo '{2}'. Vedere https://aka.ms/fsharp-implicit-convs. Per disabilitare questo avviso, usare '#nowarn \"3391\"'. + Questa espressione usa la conversione implicita '{0}' per convertire il tipo '{1}' nel tipo '{2}'. Vedere https://aka.ms/fsharp-implicit-convs. Per disabilitare questo avviso, usare '#nowarn \"3391\"'. @@ -1363,7 +1448,7 @@ - The following required properties have to be initalized:{0} + The following required properties have to be initialized:{0} È necessario inizializzare le proprietà obbligatorie seguenti:{0} @@ -1412,6 +1497,16 @@ Questo valore '{0}' non è una funzione e non supporta la notazione degli indici. + + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + + + + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + + The syntax 'expr1[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use 'expr1.[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction expr1 [expr2]'. La sintassi 'expr1[expr2]' è ambigua se usata come argomento. Vedere https://aka.ms/fsharp-index-notation. Se si intende eseguire l'indicizzazione o il sezionamento, è necessario usare 'expr1.[expr2]' nella posizione dell'argomento. Se si chiama una funzione con più argomenti sottoposti a corsi, aggiungere uno spazio tra di essi, ad esempio 'someFunction expr1 [expr2]'. @@ -1437,6 +1532,41 @@ La sintassi '(expr1)[expr2]' è ora riservata per l'indicizzazione ed è ambigua quando usata come argomento. Vedere https://aka.ms/fsharp-index-notation. Se si chiama una funzione con più argomenti sottoposti a corsi, aggiungere uno spazio tra di essi, ad esempio 'someFunction (expr1) [expr2]'. + + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + + + + Value known to be without null passed to a function meant for nullables: {0} + Value known to be without null passed to a function meant for nullables: {0} + + + + You can remove this |Null|NonNull| pattern usage. + You can remove this |Null|NonNull| pattern usage. + + + + You can remove this |NonNullQuick| pattern usage. + You can remove this |NonNullQuick| pattern usage. + + + + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + + + + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + + + + You can remove this `nonNull` assertion. + You can remove this `nonNull` assertion. + + The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a '{0}' method or appropriate 'MergeSources' and 'Bind' methods È possibile usare il costrutto "let! ... and! ..." solo se il generatore di espressioni di calcolo definisce un metodo "{0}" o metodi "MergeSource" e "Bind" appropriati @@ -1453,7 +1583,7 @@ - Invalid resumable code. A 'let rec' occured in the resumable code specification + Invalid resumable code. A 'let rec' occurred in the resumable code specification Codice ripristinabile non valido. È stato rilevata una funzione 'let rec' nella specifica del codice ripristinabile @@ -1522,6 +1652,11 @@ Un tratto non può specificare argomenti optional, in, out, ParamArray, CallerInfo o Quote + + The type '{0}' does not support a nullness qualification. + The type '{0}' does not support a nullness qualification. + + Invalid interpolated string. {0} La stringa interpolata non è valida. {0} @@ -1534,12 +1669,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' viene in genere usato come vincolo di tipo nel codice generico, ad esempio \"'T when ISomeInterface<'T>\" o \"let f (x: #ISomeInterface<_>)\". Per indicazioni, vedere https://aka.ms/fsharp-iwsams. È possibile disabilitare questo avviso usando '#nowarn \"3536\"' o '--nowarn:3536'. + '{0}' viene in genere usato come vincolo di tipo nel codice generico, ad esempio \"'T when ISomeInterface<'T>\" o \"let f (x: #ISomeInterface<_>)\". Per indicazioni, vedere https://aka.ms/fsharp-iwsams. È possibile disabilitare questo avviso usando '#nowarn \"3536\"' o '--nowarn:3536'. Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - La dichiarazione di \"interfaces with static abstract methods\" è una funzionalità avanzata. Per indicazioni, vedere https://aka.ms/fsharp-iwsams. È possibile disabilitare questo avviso usando '#nowarn \"3535\"' o '--nowarn:3535'. + La dichiarazione di \"interfaces with static abstract methods\" è una funzionalità avanzata. Per indicazioni, vedere https://aka.ms/fsharp-iwsams. È possibile disabilitare questo avviso usando '#nowarn \"3535\"' o '--nowarn:3535'. @@ -1564,7 +1699,7 @@ A type has been implicitly inferred as 'obj', which may be unintended. Consider adding explicit type annotations. You can disable this warning by using '#nowarn \"3559\"' or '--nowarn:3559'. - Un tipo è stato dedotto in modo implicito come 'obj' e ciò potrebbe non essere intenzionale. Provare ad aggiungere annotazioni di tipo esplicite. È possibile disabilitare questo avviso usando '#nowarn \"3559\"' o '--nowarn:3559'. + Un tipo è stato dedotto in modo implicito come 'obj' e ciò potrebbe non essere intenzionale. Provare ad aggiungere annotazioni di tipo esplicite. È possibile disabilitare questo avviso usando '#nowarn \"3559\"' o '--nowarn:3559'. @@ -1899,7 +2034,7 @@ Invalid directive. Expected '#time', '#time \"on\"' or '#time \"off\"'. - Direttiva non valida. Previsto '#time', '#time \"on\"' o '#time \"off\"'. + Direttiva non valida. Previsto '#time', '#time \"on\"' o '#time \"off\"'. @@ -4823,8 +4958,8 @@ - This is not a valid name for an active pattern - Questo non è un nome valido per un criterio attivo + '{0}' is not a valid method name. Use a 'let' binding instead. + '{0}' is not a valid method name. Use a 'let' binding instead. @@ -5768,7 +5903,7 @@ - Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debuggging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). + Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debugging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). Consente di specificare il tipo di debug: full, portable, embedded, pdbonly. '{0}' è l'impostazione predefinita se non viene specificato il tipo di debug e consente di associare un debugger a un programma in esecuzione. 'portable' è un formato multipiattaforma. 'embedded' è un formato multipiattaforma incorporato nel file di output. @@ -6388,8 +6523,8 @@ - This byte array literal contains characters that do not encode as a single byte - Questo valore letterale della matrice di byte contiene caratteri non codificabili come singoli byte + This byte array literal contains {0} characters that do not encode as a single byte + This byte array literal contains {0} characters that do not encode as a single byte @@ -6472,11 +6607,6 @@ Non è un valore letterale numerico valido. I valori letterali numerici validi includono 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint 32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1,0 (float/double), 1,0f (float32/single), 1,0m (decimale), 1I (bigint). - - This is not a valid byte literal - Valore letterale byte non valido - - This is not a valid character literal Valore letterale carattere non valido @@ -7028,7 +7158,7 @@ - The resident compilation service was not used because a problem occured in communicating with the server. + The resident compilation service was not used because a problem occurred in communicating with the server. Il servizio di compilazione residente non è stato usato perché si è verificato un problema nella comunicazione con il server. @@ -7228,7 +7358,7 @@ - An error occured applying the static arguments to a provided type + An error occurred applying the static arguments to a provided type Errore durante l'applicazione degli argomenti statici a un tipo fornito @@ -7293,7 +7423,7 @@ - Assembly '{0}' hase TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name + Assembly '{0}' has TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name Valore '{1}' non valido dell'attributo TypeProviderAssembly nell'assembly '{0}'. Il valore deve essere un nome di assembly valido. @@ -7878,7 +8008,7 @@ - An error occured applying the static arguments to a provided method + An error occurred applying the static arguments to a provided method Si è verificato un errore durante l'applicazione degli argomenti statici a un metodo fornito @@ -8007,7 +8137,7 @@ Se un tipo di unione multicase è uno struct, tutti i case di unione devono avere nomi univoci. Ad esempio: 'tipo A = B di b: int | C di c: int'. - + The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute. CallerMemberNameAttribute applicato al parametro '{0}' non avrà alcun effetto. CallerFilePathAttribute ne eseguirà l'override. @@ -8323,8 +8453,8 @@ - Used to introduce a block of code that might generate an exception. Used together with with or finally. - Usata per introdurre un blocco di codice che potrebbe generare un'eccezione. Usata insieme a with o finally. + Used to introduce a block of code that might generate an exception. Used together with 'with' or 'finally'. + Usata per introdurre un blocco di codice che potrebbe generare un'eccezione. Usata insieme a with o finally. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 3c1f9932d0c..a87915633be 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -124,12 +124,12 @@ A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). - A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). + 静的抽象非仮想インターフェイス メンバーは、型パラメーターを介してのみ呼び出す必要があります (例: 'T.{0})。 Classes cannot contain static abstract members. - Classes cannot contain static abstract members. + クラスに静的抽象メンバーを含めることはできません。 @@ -192,6 +192,11 @@ 既知の型パラメーター: {0} + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + Argument at index {0} doesn't match インデックス {0} の引数が一致しません @@ -202,6 +207,16 @@ 引数 '{0}' が一致しません + + The type '{0}' supports 'null' but a non-null type is expected + The type '{0}' supports 'null' but a non-null type is expected + + + + The type '{0}' uses 'null' as a representation value but a non-null type is expected + The type '{0}' uses 'null' as a representation value but a non-null type is expected + + The constraints 'unmanaged' and 'not struct' are inconsistent 制約 'unmanaged' と 'not struct' が矛盾しています @@ -227,6 +242,11 @@ アセンブリ属性 '{0}' は、デザイナー アセンブリ '{1}' を参照していますが、これは読み込むことができないか、存在していません。報告された例外: {2} - {3} + + {0} for F# {1} + {0} for F# {1} + + underscore dot shorthand for accessor only function アクセサー専用関数のアンダースコア ドット短縮形 @@ -237,6 +257,16 @@ その他の型指定された変換 + + Allow access modifiers to auto properties getters and setters + Allow access modifiers to auto properties getters and setters + + + + Allow object expressions without overrides + Allow object expressions without overrides + + applicative computation expressions 適用できる計算式 @@ -277,6 +307,11 @@ 'TailCall' 属性が再帰関数以外で使用されている場合、警告が発せられます。 + + The interaction between #nowarn and #line is now consistent. + The interaction between #nowarn and #line is now consistent. + + Constraint intersection on flexible types フレキシブル型の制約積集合 @@ -302,6 +337,11 @@ ドットなしの float32 リテラル + + Support for computation expressions with empty bodies: builder {{ }} + Support for computation expressions with empty bodies: builder {{ }} + + Enforce AttributeTargets AttributeTargets を適用する @@ -397,9 +437,9 @@ 整数範囲 (..) および範囲ステップ (.. ..) 演算子の特定の使用法を最適化し、高速な while ループにします。 - - Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to calls to List.map and Array.map when xs is a list or an array, respectively. - xs が list または array の場合、[for x in xs -> f x] および [|for x in xs -> f x|] を下げて List.map および Array.map を呼び出します。 + + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. @@ -442,6 +482,11 @@ Null 許容のオプションの相互運用 + + nullness checking + nullness checking + + open type declaration オープン型宣言 @@ -459,17 +504,17 @@ # directives with non-quoted string arguments - # directives with non-quoted string arguments + 引用符で囲まれていない文字列引数を含む # ディレクティブ Unexpected identifier '{0}'. - Unexpected identifier '{0}'. + '{0}' は予期しない識別子です。 Unexpected integer literal '{0}'. - Unexpected integer literal '{0}'. + '{0}' は予期しない整数リテラルです。 @@ -498,7 +543,7 @@ - whitespace relexation + whitespace relaxation 空白の緩和 @@ -702,6 +747,11 @@ 条件が別の計算式の結果であるループ構造を導入するために、計算式で使用されます。 + + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + + a byte string may not be interpolated バイト文字列は補間されていない可能性があります @@ -717,11 +767,26 @@ IF-FSHARP/IF-CAML リージョンは現在サポートされていません + + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + + + + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + + This is not a valid identifier これは有効な識別子ではありません + + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + + A '}}' character must be escaped (by doubling) in an interpolated string. 文字 '}}' は、補間された文字列内で (二重にすることで) エスケープする必要があります。 @@ -827,6 +892,11 @@ すべてのコンパイル ファイルの推定されたインターフェイスを関連する署名ファイルに印刷します + + Enable nullness declarations and checks + Enable nullness declarations and checks + + Clear the package manager results cache パッケージ マネージャーの結果キャッシュをクリアする @@ -972,21 +1042,26 @@ 式を指定してください - - Expecting record field - レコード フィールドが必要です - - Expecting pattern 必要なパターン + + Expecting record field + Expecting record field + + Expecting type 型が必要です + + Expecting union case field + Expecting union case field + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) 不完全な文字リテラル (例: 'Q') または修飾型の呼び出し (例: 'T.Name) @@ -1053,7 +1128,7 @@ - A constrained generic construct occured in the resumable code specification + A constrained generic construct occurred in the resumable code specification 再開可能なコード指定で制約付きジェネリック コンストラクトが発生しました @@ -1068,7 +1143,7 @@ - A 'let rec' occured in the resumable code specification + A 'let rec' occurred in the resumable code specification 再開可能なコード仕様で 'let rec' が発生しました @@ -1137,24 +1212,29 @@ (推奨される名前) + + Access modifiers cannot be applied to an SRTP constraint. + Access modifiers cannot be applied to an SRTP constraint. + + This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. - This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. + このアクティブ パターンには、{0} 式の引数が必要です (例: '{1}{2}')。 This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. - This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. + このアクティブ パターンには、{0} 式の引数とパターン引数 とパターン引数 (例: '{1}{2} pat') が必要です。 This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. - This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. + このアクティブ パターンには引数は必要ありません。つまり、'{1} x' ではなく、'{0}' のように使用する必要があります。 This active pattern expects exactly one pattern argument, e.g., '{0} pat'. - This active pattern expects exactly one pattern argument, e.g., '{0} pat'. + このアクティブ パターンには、'{0} pat' などのパターン引数が 1 つだけ必要です。 @@ -1247,6 +1327,11 @@ 短縮ラムダ構文は、暗黙的な '_' 引数のメソッド、プロパティ、フィールド、インデクサーなどのアトミック式でのみサポートされています。例: 'let f = _.Length'。 + + An empty body may only be used if the computation expression builder defines a 'Zero' method. + An empty body may only be used if the computation expression builder defines a 'Zero' method. + + The syntax 'expr1[expr2]' is used for indexing. Consider adding a type annotation to enable indexing, or if calling a function add a space, e.g. 'expr1 [expr2]'. 構文 'expr1[expr2]' はインデックス作成に使用されます。インデックスを有効にするために型の注釈を追加するか、関数を呼び出す場合には、'expr1 [expr2]' のようにスペースを入れます。 @@ -1279,7 +1364,7 @@ This expression uses the implicit conversion '{0}' to convert type '{1}' to type '{2}'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn \"3391\". - この式では、暗黙的な変換 '{0}' を使用して、型 '{1}' を型 '{2}' に変換しています。https://aka.ms/fsharp-implicit-convs をご確認ください。'#nowarn\"3391\" を使用して、この警告を無効にできる可能性があります。 + この式では、暗黙的な変換 '{0}' を使用して、型 '{1}' を型 '{2}' に変換しています。https://aka.ms/fsharp-implicit-convs をご確認ください。'#nowarn\"3391\" を使用して、この警告を無効にできる可能性があります。 @@ -1363,7 +1448,7 @@ - The following required properties have to be initalized:{0} + The following required properties have to be initialized:{0} 次の必須プロパティを初期化する必要があります:{0} @@ -1412,6 +1497,16 @@ 値 '{0}' は関数ではなく、インデックス表記をサポートしていません。 + + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + + + + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + + The syntax 'expr1[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use 'expr1.[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction expr1 [expr2]'. 構文 'expr1[expr2]' は引数として使用されている場合、あいまいです。https://aka.ms/fsharp-index-notation を参照してください。インデックス作成またはスライスを行う場合は、'expr1.[expr2]' を引数の位置に使用する必要があります。複数のカリー化された引数を持つ関数を呼び出す場合は、'expr1 [expr2]' のように間にスペースを追加します。 @@ -1437,6 +1532,41 @@ 構文 '(expr1)[expr2]' はインデックス作成に予約されているので、引数として使うとあいまいです。https://aka.ms/fsharp-index-notation を参照してください。複数のカリー化された引数を持つ関数を呼び出す場合には、'someFunction (expr1) [expr2]' のように間にスペースを追加します。 + + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + + + + Value known to be without null passed to a function meant for nullables: {0} + Value known to be without null passed to a function meant for nullables: {0} + + + + You can remove this |Null|NonNull| pattern usage. + You can remove this |Null|NonNull| pattern usage. + + + + You can remove this |NonNullQuick| pattern usage. + You can remove this |NonNullQuick| pattern usage. + + + + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + + + + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + + + + You can remove this `nonNull` assertion. + You can remove this `nonNull` assertion. + + The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a '{0}' method or appropriate 'MergeSources' and 'Bind' methods 'let! ... and! ...' コンストラクトは、コンピュテーション式ビルダーが '{0}' メソッドまたは適切な 'MergeSource' および 'Bind' メソッドのいずれかを定義している場合にのみ使用できます @@ -1453,7 +1583,7 @@ - Invalid resumable code. A 'let rec' occured in the resumable code specification + Invalid resumable code. A 'let rec' occurred in the resumable code specification 再開可能なコードが無効です。再開可能なコード仕様で 'let rec' が発生しました @@ -1522,6 +1652,11 @@ 特性では、オプションの、in 引数、out 引数、ParamArray 引数、CallerInfo 引数、または Quote 引数を指定することはできません + + The type '{0}' does not support a nullness qualification. + The type '{0}' does not support a nullness qualification. + + Invalid interpolated string. {0} 補間された文字列が無効です。{0} @@ -1534,12 +1669,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' は通常、ジェネリック コードの型制約として使用されます (例: \"'T when ISomeInterface<'T>\" または \"let f (x: #ISomeInterface<_>)\")。ガイダンスについては https://aka.ms/fsharp-iwsams を参照してください。この警告は、'#nowarn \"3536\"' または '--nowarn:3536' を使用して無効にできます。 + '{0}' は通常、ジェネリック コードの型制約として使用されます (例: \"'T when ISomeInterface<'T>\" または \"let f (x: #ISomeInterface<_>)\")。ガイダンスについては https://aka.ms/fsharp-iwsams を参照してください。この警告は、'#nowarn \"3536\"' または '--nowarn:3536' を使用して無効にできます。 Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - \"interfaces with static abstract method\" の宣言は高度な機能です。ガイダンスについては https://aka.ms/fsharp-iwsams を参照してください。この警告は、'#nowarn \"3535\"' または '--nowarn:3535' を使用して無効にできます。 + \"interfaces with static abstract method\" の宣言は高度な機能です。ガイダンスについては https://aka.ms/fsharp-iwsams を参照してください。この警告は、'#nowarn \"3535\"' または '--nowarn:3535' を使用して無効にできます。 @@ -1564,7 +1699,7 @@ A type has been implicitly inferred as 'obj', which may be unintended. Consider adding explicit type annotations. You can disable this warning by using '#nowarn \"3559\"' or '--nowarn:3559'. - 型が暗黙的に 'obj' として推論されました。これは意図していない可能性があります。明示的な型の注釈を追加することを検討してください。この警告は、'#nowarn \"3559\"' または '--nowarn:3559' を使用して無効にできます。 + 型が暗黙的に 'obj' として推論されました。これは意図していない可能性があります。明示的な型の注釈を追加することを検討してください。この警告は、'#nowarn \"3559\"' または '--nowarn:3559' を使用して無効にできます。 @@ -1899,7 +2034,7 @@ Invalid directive. Expected '#time', '#time \"on\"' or '#time \"off\"'. - ディレクティブが無効です。'#time'、'#time \"on\"'、または '#time \"off\"' という形式で指定する必要があります。 + ディレクティブが無効です。'#time'、'#time \"on\"'、または '#time \"off\"' という形式で指定する必要があります。 @@ -4823,8 +4958,8 @@ - This is not a valid name for an active pattern - アクティブ パターンの有効な名前ではありません + '{0}' is not a valid method name. Use a 'let' binding instead. + '{0}' is not a valid method name. Use a 'let' binding instead. @@ -5768,7 +5903,7 @@ - Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debuggging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). + Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debugging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). デバッグの種類 full、portable、pdbonly を指定します (デバッグの種類が指定されない場合には '{0}' が既定で、実行中のプログラムにデバッガーを付加することができます。'portable' はクロスプラットフォーム形式、'embedded' は出力ファイルに埋め込まれたクロスプラットフォーム形式です)。 @@ -6388,8 +6523,8 @@ - This byte array literal contains characters that do not encode as a single byte - このバイト配列リテラルには、シングル バイトとしてエンコードされない文字が含まれます + This byte array literal contains {0} characters that do not encode as a single byte + This byte array literal contains {0} characters that do not encode as a single byte @@ -6472,11 +6607,6 @@ これは有効な数値リテラルではありません。有効な数値リテラルには、1、0x1、0o1、 0b1、1l (int/int32)、1u (uint/uint32)、1L (int64)、1UL (uint64)、1s (int16)、1us (uint16)、1y (int8/sbyte)、1uy (uint8/byte)、1.0 (float/double)、1.0f (float32/single)、1.0m (10 進)、1I (bigint)。 - - This is not a valid byte literal - これは有効なバイト リテラルではありません - - This is not a valid character literal これは有効な文字リテラルではありません @@ -7028,7 +7158,7 @@ - The resident compilation service was not used because a problem occured in communicating with the server. + The resident compilation service was not used because a problem occurred in communicating with the server. サーバーとの通信で問題が発生したため、常駐コンパイル サービスが使用されませんでした。 @@ -7228,7 +7358,7 @@ - An error occured applying the static arguments to a provided type + An error occurred applying the static arguments to a provided type 指定された型に静的引数を適用する際にエラーが発生しました @@ -7293,7 +7423,7 @@ - Assembly '{0}' hase TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name + Assembly '{0}' has TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name アセンブリ '{0}' の TypeProviderAssembly 属性に、無効な値 '{1}' が含まれています。この値は有効なアセンブリ名であることが必要です @@ -7878,7 +8008,7 @@ - An error occured applying the static arguments to a provided method + An error occurred applying the static arguments to a provided method 静的な引数を指定されたメソッドに適用する際エラーが発生しました @@ -8007,7 +8137,7 @@ マルチケース共用体の型が構造体の場合は、すべての共用体ケースに一意の名前を付ける必要があります。例: 'type A = B of b: int | c の C: int'。 - + The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute. パラメーター '{0}' に適用された CallerMemberNameAttribute は、CallerFilePathAttribute.によってオーバーライドされるため無効となります。 @@ -8323,8 +8453,8 @@ - Used to introduce a block of code that might generate an exception. Used together with with or finally. - 例外を生成する可能性があるコード ブロックを開始するために使用します。with または finally と一緒に使用します。 + Used to introduce a block of code that might generate an exception. Used together with 'with' or 'finally'. + 例外を生成する可能性があるコード ブロックを開始するために使用します。with または finally と一緒に使用します。 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index a960ad4399f..70a64e75a53 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -124,12 +124,12 @@ A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). - A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). + 정적 추상 비 가상 인터페이스 구성원은 형식 매개 변수(예: 'T.{0})를 통해서만 호출해야 합니다. Classes cannot contain static abstract members. - Classes cannot contain static abstract members. + 클래스에는 정적 추상 구성원을 포함할 수 없습니다. @@ -192,6 +192,11 @@ 알려진 형식 매개 변수: {0} + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + Argument at index {0} doesn't match 인덱스 {0}의 인수가 일치하지 않습니다. @@ -202,6 +207,16 @@ '{0}' 인수가 일치하지 않습니다. + + The type '{0}' supports 'null' but a non-null type is expected + The type '{0}' supports 'null' but a non-null type is expected + + + + The type '{0}' uses 'null' as a representation value but a non-null type is expected + The type '{0}' uses 'null' as a representation value but a non-null type is expected + + The constraints 'unmanaged' and 'not struct' are inconsistent 제약 조건 'unmanaged' 및 'not struct'가 일치하지 않습니다. @@ -227,6 +242,11 @@ '{0}' 어셈블리 특성이 로드할 수 없거나 존재하지 않는 디자이너 어셈블리'{1}'을(를) 참조합니다. 보고된 예외: {2} - {3} + + {0} for F# {1} + {0} for F# {1} + + underscore dot shorthand for accessor only function 접근자 전용 함수에 대한 밑줄 점 약어 @@ -237,6 +257,16 @@ 추가 형식-디렉션 변환 + + Allow access modifiers to auto properties getters and setters + Allow access modifiers to auto properties getters and setters + + + + Allow object expressions without overrides + Allow object expressions without overrides + + applicative computation expressions 적용 가능한 계산 식 @@ -277,6 +307,11 @@ 'TailCall' 특성이 비 재귀 함수에 사용되는 경우 경고를 발생합니다. + + The interaction between #nowarn and #line is now consistent. + The interaction between #nowarn and #line is now consistent. + + Constraint intersection on flexible types 유연한 형식의 제약 조건 교집합 @@ -302,6 +337,11 @@ 점이 없는 float32 리터럴 + + Support for computation expressions with empty bodies: builder {{ }} + Support for computation expressions with empty bodies: builder {{ }} + + Enforce AttributeTargets AttributeTargets 적용 @@ -397,9 +437,9 @@ 정수 계열 범위(..) 및 범위 단계(.. ..) 연산자의 특정 사용을 빠른 while 루프에 최적화합니다. - - Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to calls to List.map and Array.map when xs is a list or an array, respectively. - xs가 각각 목록 또는 배열인 경우 [for x in xs -> f x] 및 [|for x in xs -> f x|]를 List.map 및 Array.map에 대한 호출로 낮춥니다. + + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. @@ -442,6 +482,11 @@ nullable 선택적 interop + + nullness checking + nullness checking + + open type declaration 개방형 형식 선언 @@ -459,17 +504,17 @@ # directives with non-quoted string arguments - # directives with non-quoted string arguments + 따옴표가 없는 문자열 인수가 있는 #개의 지시문 Unexpected identifier '{0}'. - Unexpected identifier '{0}'. + 예기치 않은 식별자 '{0}' Unexpected integer literal '{0}'. - Unexpected integer literal '{0}'. + 예기치 않은 정수 리터럴 '{0}'. @@ -498,7 +543,7 @@ - whitespace relexation + whitespace relaxation 공백 완화 @@ -702,6 +747,11 @@ 계산 식에서 조건이 다른 계산 식의 결과인 루프 구문을 도입하는 데 사용됩니다. + + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + + a byte string may not be interpolated 바이트 문자열을 보간하지 못할 수 있습니다. @@ -717,11 +767,26 @@ IF-FSHARP/IF-CAML 영역은 더 이상 지원되지 않습니다. + + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + + + + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + + This is not a valid identifier 유효한 식별자가 아닙니다. + + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + + A '}}' character must be escaped (by doubling) in an interpolated string. '}}' 문자는 보간된 문자열에서 이중으로 사용하여 이스케이프해야 합니다. @@ -827,6 +892,11 @@ 모든 컴파일 파일의 유추된 인터페이스를 관련 서명 파일로 인쇄합니다. + + Enable nullness declarations and checks + Enable nullness declarations and checks + + Clear the package manager results cache 패키지 관리자 결과 캐시 지우기 @@ -972,21 +1042,26 @@ 식이 필요함 - - Expecting record field - 레코드 필드 필요 - - Expecting pattern 예상되는 패턴 + + Expecting record field + Expecting record field + + Expecting type 예상 형식 + + Expecting union case field + Expecting union case field + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) 불완전한 문자 리터럴(예: 'Q') 또는 정규화된 형식 호출(예: 'T.Name) @@ -1053,7 +1128,7 @@ - A constrained generic construct occured in the resumable code specification + A constrained generic construct occurred in the resumable code specification 다시 시작 가능한 코드 사양에서 제약이 있는 제네릭 구문이 발생했습니다. @@ -1068,7 +1143,7 @@ - A 'let rec' occured in the resumable code specification + A 'let rec' occurred in the resumable code specification 다시 시작 가능한 코드 사양에서 'let rec'가 발생했습니다. @@ -1137,24 +1212,29 @@ (제안된 이름) + + Access modifiers cannot be applied to an SRTP constraint. + Access modifiers cannot be applied to an SRTP constraint. + + This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. - This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. + 이 활성 패턴에는 {0} 식 인수(예: '{1}{2}')가 필요합니다. This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. - This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. + 이 활성 패턴에는 {0} 식 인수와 패턴 인수가 필요합니다(예: '{1}{2} pat'). This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. - This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. + 이 활성 패턴에는 인수가 필요하지 않습니다. 즉, '{0} x' 대신 '{1}'을(를) 사용해야 합니다. This active pattern expects exactly one pattern argument, e.g., '{0} pat'. - This active pattern expects exactly one pattern argument, e.g., '{0} pat'. + 이 활성 패턴에는 정확히 하나의 패턴 인수(예: '{0} pat')가 필요합니다. @@ -1247,6 +1327,11 @@ 줄임 람다 구문은 암시적 '_' 인수의 메서드, 속성, 필드 또는 인덱서와 같은 원자성 식에 대해서만 지원됩니다. 예: 'let f = _.Length'. + + An empty body may only be used if the computation expression builder defines a 'Zero' method. + An empty body may only be used if the computation expression builder defines a 'Zero' method. + + The syntax 'expr1[expr2]' is used for indexing. Consider adding a type annotation to enable indexing, or if calling a function add a space, e.g. 'expr1 [expr2]'. 인덱싱에는 'expr1[expr2]' 구문이 사용됩니다. 인덱싱을 사용하도록 설정하기 위해 형식 주석을 추가하는 것을 고려하거나 함수를 호출하는 경우 공백을 추가하세요(예: 'expr1 [expr2]'). @@ -1279,7 +1364,7 @@ This expression uses the implicit conversion '{0}' to convert type '{1}' to type '{2}'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn \"3391\". - 이 식은 암시적 변환 '{0}'을 사용하여 '{1}' 형식을 '{2}' 형식으로 변환 합니다. https://aka.ms/fsharp-implicit-convs 참조. ’#Nowarn \ "3391\"을 (를) 사용하여 이 경고를 사용 하지 않도록 설정할 수 있습니다. + 이 식은 암시적 변환 '{0}'을 사용하여 '{1}' 형식을 '{2}' 형식으로 변환 합니다. https://aka.ms/fsharp-implicit-convs 참조. ’#Nowarn \ "3391\"을 (를) 사용하여 이 경고를 사용 하지 않도록 설정할 수 있습니다. @@ -1363,7 +1448,7 @@ - The following required properties have to be initalized:{0} + The following required properties have to be initialized:{0} 다음 필수 속성을 초기화해야 합니다. {0} @@ -1412,6 +1497,16 @@ '{0}' 값은 함수가 아니며 인덱스 표기법을 지원하지 않습니다. + + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + + + + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + + The syntax 'expr1[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use 'expr1.[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction expr1 [expr2]'. 'expr1[expr2]' 구문은 인수로 사용될 때 모호합니다. https://aka.ms/fsharp-index-notation을 참조하세요. 인덱싱이나 슬라이싱을 하려면 인수 위치에 'expr1.[expr2]'를 사용해야 합니다. 여러 개의 커리된 인수로 함수를 호출하는 경우 그 사이에 공백을 추가하세요(예: 'someFunction expr1 [expr2]'). @@ -1437,6 +1532,41 @@ 구문 '(expr1)[expr2]'는 이제 인덱싱을 위해 예약되었으며 인수로 사용될 때 모호합니다. https://aka.ms/fsharp-index-notation을 참조하세요. 여러 개의 커리된 인수로 함수를 호출하는 경우 그 사이에 공백을 추가하세요(예: 'someFunction (expr1) [expr2]'). + + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + + + + Value known to be without null passed to a function meant for nullables: {0} + Value known to be without null passed to a function meant for nullables: {0} + + + + You can remove this |Null|NonNull| pattern usage. + You can remove this |Null|NonNull| pattern usage. + + + + You can remove this |NonNullQuick| pattern usage. + You can remove this |NonNullQuick| pattern usage. + + + + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + + + + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + + + + You can remove this `nonNull` assertion. + You can remove this `nonNull` assertion. + + The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a '{0}' method or appropriate 'MergeSources' and 'Bind' methods 'let! ... and! ...' 구문은 계산 식 작성기에서 '{0}' 메서드 또는 적절한 'MergeSources' 및 'Bind' 메서드를 정의한 경우에만 사용할 수 있습니다. @@ -1453,7 +1583,7 @@ - Invalid resumable code. A 'let rec' occured in the resumable code specification + Invalid resumable code. A 'let rec' occurred in the resumable code specification 다시 시작 가능한 코드가 잘못되었습니다. 다시 시작 가능한 코드 사양에서 'let rec'가 발생했습니다. @@ -1522,6 +1652,11 @@ 특성은 optional, in, out, ParamArray, CallerInfo, Quote 인수를 지정할 수 없습니다. + + The type '{0}' does not support a nullness qualification. + The type '{0}' does not support a nullness qualification. + + Invalid interpolated string. {0} 잘못된 보간 문자열. {0} @@ -1534,12 +1669,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}'은(는) 일반적으로 제네릭 코드에서 형식 제약 조건으로 사용됩니다(예: \"'T when ISomeInterface<'T>\" 또는 \"let f (x: #ISomeInterface<_>)\"). 지침은 https://aka.ms/fsharp-iwsams를 참조하세요. '#nowarn \"3536\"' 또는 '--nowarn:3536'을 사용하여 이 경고를 비활성화할 수 있습니다. + '{0}'은(는) 일반적으로 제네릭 코드에서 형식 제약 조건으로 사용됩니다(예: \"'T when ISomeInterface<'T>\" 또는 \"let f (x: #ISomeInterface<_>)\"). 지침은 https://aka.ms/fsharp-iwsams를 참조하세요. '#nowarn \"3536\"' 또는 '--nowarn:3536'을 사용하여 이 경고를 비활성화할 수 있습니다. Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - \"interfaces with static abstract methods\"를 선언하는 것은 고급 기능입니다. 지침은 https://aka.ms/fsharp-iwsams를 참조하세요. '#nowarn \"3535\"' 또는 '--nowarn:3535'를 사용하여 이 경고를 비활성화할 수 있습니다. + \"interfaces with static abstract methods\"를 선언하는 것은 고급 기능입니다. 지침은 https://aka.ms/fsharp-iwsams를 참조하세요. '#nowarn \"3535\"' 또는 '--nowarn:3535'를 사용하여 이 경고를 비활성화할 수 있습니다. @@ -1564,7 +1699,7 @@ A type has been implicitly inferred as 'obj', which may be unintended. Consider adding explicit type annotations. You can disable this warning by using '#nowarn \"3559\"' or '--nowarn:3559'. - 형식이 암시적으로 'obj'로 유추되었습니다. 이는 의도하지 않은 것일 수 있습니다. 명시적 형식 주석을 추가하는 것이 좋습니다. 이 경고는 '#nowarn \"3559\"' 또는 '--nowarn:3559'를 사용하여 비활성화할 수 있습니다. + 형식이 암시적으로 'obj'로 유추되었습니다. 이는 의도하지 않은 것일 수 있습니다. 명시적 형식 주석을 추가하는 것이 좋습니다. 이 경고는 '#nowarn \"3559\"' 또는 '--nowarn:3559'를 사용하여 비활성화할 수 있습니다. @@ -1899,7 +2034,7 @@ Invalid directive. Expected '#time', '#time \"on\"' or '#time \"off\"'. - 지시문이 잘못되었습니다. '#time', '#time \"on\"' 또는 '#time \"off\"'가 필요합니다. + 지시문이 잘못되었습니다. '#time', '#time \"on\"' 또는 '#time \"off\"'가 필요합니다. @@ -4823,8 +4958,8 @@ - This is not a valid name for an active pattern - 활성 패턴에 대한 올바른 이름이 아닙니다. + '{0}' is not a valid method name. Use a 'let' binding instead. + '{0}' is not a valid method name. Use a 'let' binding instead. @@ -5768,7 +5903,7 @@ - Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debuggging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). + Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debugging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). 디버깅 형식(full, portable, embedded, pdbonly)을 지정합니다. '{0}'은(는) 디버깅 형식을 지정하지 않은 경우 기본값이며 디버거를 실행 중인 프로그램에 연결할 수 있습니다. 'portable'은 플랫폼 간 형식이고, 'embedded'는 출력 파일에 포함된 플랫폼 간 형식입니다. @@ -6388,8 +6523,8 @@ - This byte array literal contains characters that do not encode as a single byte - 이 바이트 배열 리터럴에는 단일 바이트로 인코딩되지 않는 문자가 포함되어 있습니다. + This byte array literal contains {0} characters that do not encode as a single byte + This byte array literal contains {0} characters that do not encode as a single byte @@ -6472,11 +6607,6 @@ 유효한 숫자 리터럴이 아닙니다. 유효한 숫자 리터럴은 1, 0x1, 0o1, 0b1, 1l(int/int32), 1u(uint/uint32), 1L(int64), 1UL(uint64), 1s(int16), 1us(uint16), 1y(int8/)입니다. sbyte), 1uy(uint8/byte), 1.0(float/double), 1.0f(float32/single), 1.0m(decimal), 1I(bigint). - - This is not a valid byte literal - 올바른 바이트 리터럴이 아닙니다. - - This is not a valid character literal 올바른 문자 리터럴이 아닙니다. @@ -7028,7 +7158,7 @@ - The resident compilation service was not used because a problem occured in communicating with the server. + The resident compilation service was not used because a problem occurred in communicating with the server. 서버와 통신하는 동안 문제가 발생하여 상주 컴파일 서비스를 사용하지 않았습니다. @@ -7228,7 +7358,7 @@ - An error occured applying the static arguments to a provided type + An error occurred applying the static arguments to a provided type 제공된 형식에 정적 인수를 적용하는 동안 오류가 발생했습니다. @@ -7293,7 +7423,7 @@ - Assembly '{0}' hase TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name + Assembly '{0}' has TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name {0}' 어셈블리에 포함된 TypeProviderAssembly 특성의 값('{1}')이 잘못되었습니다. 값은 올바른 어셈블리 이름이어야 합니다. @@ -7878,7 +8008,7 @@ - An error occured applying the static arguments to a provided method + An error occurred applying the static arguments to a provided method 제공된 메서드에 정적 인수를 적용하는 동안 오류가 발생했습니다. @@ -8007,7 +8137,7 @@ 다중 사례 공용 구조체 형식이 구조체인 경우 모든 공용 구조체 사례의 이름이 고유해야 합니다. 예: 'type A = B of b: int | C 중 C: 정수'. - + The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute. {0}' 매개 변수에 적용되는 CallerMemberNameAttribute는 효과가 없습니다. CallerFilePathAttribute에서 재정의합니다. @@ -8323,8 +8453,8 @@ - Used to introduce a block of code that might generate an exception. Used together with with or finally. - 예외를 생성할 수 있는 코드 블록을 지정하는 데 사용됩니다. with 또는 finally와 함께 사용됩니다. + Used to introduce a block of code that might generate an exception. Used together with 'with' or 'finally'. + 예외를 생성할 수 있는 코드 블록을 지정하는 데 사용됩니다. with 또는 finally와 함께 사용됩니다. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index bd2facc3cba..31b8d2a6215 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -124,12 +124,12 @@ A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). - A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). + Statyczna abstrakcyjna składowa interfejsu niewirtualnego powinna być wywoływana tylko za pomocą parametru typu (na przykład: „T”).{0} Classes cannot contain static abstract members. - Classes cannot contain static abstract members. + Klasy nie mogą zawierać statycznych abstrakcyjnych składowych. @@ -192,6 +192,11 @@ Parametr znanego typu: {0} + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + Argument at index {0} doesn't match Argument pod indeksem {0} nie jest zgodny @@ -202,6 +207,16 @@ Argument „{0}” nie jest zgodny + + The type '{0}' supports 'null' but a non-null type is expected + The type '{0}' supports 'null' but a non-null type is expected + + + + The type '{0}' uses 'null' as a representation value but a non-null type is expected + The type '{0}' uses 'null' as a representation value but a non-null type is expected + + The constraints 'unmanaged' and 'not struct' are inconsistent Ograniczenia „unmanaged” i „not struct” są niespójne @@ -227,6 +242,11 @@ Atrybut zestawu „{0}” odwołuje się do zestawu projektanta „{1}”, którego nie można załadować lub który nie istnieje. Zgłoszony wyjątek: {2} — {3} + + {0} for F# {1} + {0} for F# {1} + + underscore dot shorthand for accessor only function skrót podkreślenia kropki dla funkcji tylko metody dostępu @@ -237,6 +257,16 @@ dodatkowe konwersje ukierunkowane na typ + + Allow access modifiers to auto properties getters and setters + Allow access modifiers to auto properties getters and setters + + + + Allow object expressions without overrides + Allow object expressions without overrides + + applicative computation expressions praktyczne wyrażenia obliczeniowe @@ -277,6 +307,11 @@ Zgłasza ostrzeżenia, jeśli atrybut „TailCall” jest używany w funkcjach niekursywnych. + + The interaction between #nowarn and #line is now consistent. + The interaction between #nowarn and #line is now consistent. + + Constraint intersection on flexible types Przecięcie ograniczenia dla typów elastycznych @@ -302,6 +337,11 @@ bezkropkowy literał float32 + + Support for computation expressions with empty bodies: builder {{ }} + Support for computation expressions with empty bodies: builder {{ }} + + Enforce AttributeTargets Wymuszaj elementy AttributeTargets @@ -397,9 +437,9 @@ Optymalizuje niektóre zastosowania operatorów zakresu całkowitego (..) i krok-zakresu (.. .), aby przyspieszyć pętle while. - - Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to calls to List.map and Array.map when xs is a list or an array, respectively. - Obniża wartości [dla x w xs -> f x] i [|dla x w xs -> f x|] do wywołań w List.map i Array.map, gdy xs jest odpowiednio listą lub tablicą. + + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. @@ -442,6 +482,11 @@ opcjonalna międzyoperacyjność dopuszczająca wartość null + + nullness checking + nullness checking + + open type declaration deklaracja typu otwartego @@ -459,17 +504,17 @@ # directives with non-quoted string arguments - # directives with non-quoted string arguments + Dyrektywy (#) z argumentami ciągu niezawartymi w cudzysłów Unexpected identifier '{0}'. - Unexpected identifier '{0}'. + Nieoczekiwany identyfikator „{0}”. Unexpected integer literal '{0}'. - Unexpected integer literal '{0}'. + Nieoczekiwany literał liczby całkowitej „{0}”. @@ -498,7 +543,7 @@ - whitespace relexation + whitespace relaxation rozluźnianie reguł dotyczących odstępów @@ -702,6 +747,11 @@ Używane w wyrażeniach obliczeń w celu wprowadzenia konstrukcji pętli, w której warunek jest wynikiem innego wyrażenia obliczeń. + + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + + a byte string may not be interpolated ciąg bajtowy nie może być interpolowany @@ -717,11 +767,26 @@ Regiony IF-FSHARP/IF-CAML nie są już obsługiwane + + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + + + + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + + This is not a valid identifier To nie jest prawidłowy identyfikator + + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + + A '}}' character must be escaped (by doubling) in an interpolated string. W przypadku znaku „}}” należy zastosować ucieczkę (przez wpisanie dwóch takich znaków) w ciągu interpolowanym. @@ -827,6 +892,11 @@ Drukowanie wywnioskowanych interfejsów wszystkich plików kompilacji do skojarzonych plików sygnatur + + Enable nullness declarations and checks + Enable nullness declarations and checks + + Clear the package manager results cache Wyczyść pamięć podręczną wyników menedżera pakietów @@ -972,21 +1042,26 @@ Oczekiwanie na wyrażenie - - Expecting record field - Oczekiwanie pola rekordu - - Expecting pattern Oczekiwano wzorca + + Expecting record field + Expecting record field + + Expecting type Oczekiwano typu + + Expecting union case field + Expecting union case field + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Niekompletny literał znaku (przykład: „Q”) lub wywołanie typu kwalifikowanego (przykład: „T.Name”) @@ -1053,7 +1128,7 @@ - A constrained generic construct occured in the resumable code specification + A constrained generic construct occurred in the resumable code specification W specyfikacji kodu z możliwością wznowienia wystąpiła ograniczona konstrukcja ogólna @@ -1068,7 +1143,7 @@ - A 'let rec' occured in the resumable code specification + A 'let rec' occurred in the resumable code specification W specyfikacji kodu z możliwością wznowienia, wystąpił błąd "let rec" @@ -1137,24 +1212,29 @@ (Sugerowana nazwa) + + Access modifiers cannot be applied to an SRTP constraint. + Access modifiers cannot be applied to an SRTP constraint. + + This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. - This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. + Ten aktywny wzorzec oczekuje argumentów wyrażenia ({0}), np. „{1}{2}”. This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. - This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. + Ten aktywny wzorzec oczekuje argumentów wyrażenia ({0}) i argumentu wzorca, np. „{1}{2} pat”. This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. - This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. + Ten aktywny wzorzec nie oczekuje żadnych argumentów, tj. powinien być używany jak „{0}” zamiast „{1} x”. This active pattern expects exactly one pattern argument, e.g., '{0} pat'. - This active pattern expects exactly one pattern argument, e.g., '{0} pat'. + Ten aktywny wzorzec oczekuje dokładnie jednego argumentu wzorca, np. „{0} pat”. @@ -1247,6 +1327,11 @@ Składnia lambda skrótu jest obsługiwana tylko w przypadku wyrażeń niepodzielnych, takich jak metoda, właściwość, pole lub indeksator w dorozumianym argumencie „_”. Na przykład: „let f = _. Length”. + + An empty body may only be used if the computation expression builder defines a 'Zero' method. + An empty body may only be used if the computation expression builder defines a 'Zero' method. + + The syntax 'expr1[expr2]' is used for indexing. Consider adding a type annotation to enable indexing, or if calling a function add a space, e.g. 'expr1 [expr2]'. Do indeksowania używana jest składnia „expr1[expr2]”. Rozważ dodanie adnotacji typu, aby umożliwić indeksowanie, lub jeśli wywołujesz funkcję dodaj spację, np. „expr1 [expr2]”. @@ -1279,7 +1364,7 @@ This expression uses the implicit conversion '{0}' to convert type '{1}' to type '{2}'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn \"3391\". - W tym wyrażeniu jest używana bezwzględna konwersja "{0}" w celu przekonwertowania typu "{1}" na typ "{2}". Zobacz https://aka.ms/fsharp-implicit-convs. To ostrzeżenie można wyłączyć przy użyciu polecenia "#nowarn \" 3391 \ ". + W tym wyrażeniu jest używana bezwzględna konwersja "{0}" w celu przekonwertowania typu "{1}" na typ "{2}". Zobacz https://aka.ms/fsharp-implicit-convs. To ostrzeżenie można wyłączyć przy użyciu polecenia "#nowarn \" 3391 \ ". @@ -1363,7 +1448,7 @@ - The following required properties have to be initalized:{0} + The following required properties have to be initialized:{0} Następujące wymagane właściwości muszą zostać zainicjowane:{0} @@ -1412,6 +1497,16 @@ Wartość elementu „{0}” nie jest funkcją i nie obsługuje notacji indeksowej. + + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + + + + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + + The syntax 'expr1[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use 'expr1.[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction expr1 [expr2]'. Składnia wyrażenia „expr1[expr2]” jest niejednoznaczna, gdy jest używana jako argument. Zobacz https://aka.ms/fsharp-index-notation. Jeśli zamierzasz indeksować lub fragmentować, to w pozycji argumentu musi być użyte wyrażenie „expr1.[expr2]”. Jeśli wywołujesz funkcję z wieloma argumentami typu curried, dodaj spację między nimi, np. „someFunction expr1 [expr2]”. @@ -1437,6 +1532,41 @@ Składnia wyrażenia „(expr1)[expr2]” jest teraz zarezerwowana do indeksowania i jest niejednoznaczna, gdy jest używana jako argument. Zobacz: https://aka.ms/fsharp-index-notation. Jeśli wywołujesz funkcję z wieloma argumentami typu curried, dodaj spację między nimi, np. „someFunction (expr1) [expr2]”. + + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + + + + Value known to be without null passed to a function meant for nullables: {0} + Value known to be without null passed to a function meant for nullables: {0} + + + + You can remove this |Null|NonNull| pattern usage. + You can remove this |Null|NonNull| pattern usage. + + + + You can remove this |NonNullQuick| pattern usage. + You can remove this |NonNullQuick| pattern usage. + + + + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + + + + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + + + + You can remove this `nonNull` assertion. + You can remove this `nonNull` assertion. + + The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a '{0}' method or appropriate 'MergeSources' and 'Bind' methods Konstrukcji „let! ... and! ...” można użyć tylko wtedy, gdy konstruktor wyrażeń obliczeniowych definiuje metodę „{0}” lub odpowiednie metody „MergeSource” i „Bind” @@ -1453,7 +1583,7 @@ - Invalid resumable code. A 'let rec' occured in the resumable code specification + Invalid resumable code. A 'let rec' occurred in the resumable code specification Nieprawidłowy kod z możliwością wznowienia. W specyfikacji kodu z możliwością wznowienia wystąpił element "let rec" @@ -1522,6 +1652,11 @@ Cecha nie może określać opcjonalnych argumentów in, out, ParamArray, CallerInfo lub Quote + + The type '{0}' does not support a nullness qualification. + The type '{0}' does not support a nullness qualification. + + Invalid interpolated string. {0} Nieprawidłowy ciąg interpolowany. {0} @@ -1534,12 +1669,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - Element „{0}” jest zwykle używany jako ograniczenie typu w kodzie ogólnym, np. \"" T, gdy ISomeInterface<' T>\" lub \"let f (x: #ISomeInterface<_>)\". Aby uzyskać wskazówki, zobacz https://aka.ms/fsharp-iwsams. To ostrzeżenie można wyłączyć, używając polecenia „nowarn \"3536\"" lub "--nowarn:3536”. + Element „{0}” jest zwykle używany jako ograniczenie typu w kodzie ogólnym, np. \"" T, gdy ISomeInterface<' T>\" lub \"let f (x: #ISomeInterface<_>)\". Aby uzyskać wskazówki, zobacz https://aka.ms/fsharp-iwsams. To ostrzeżenie można wyłączyć, używając polecenia „nowarn \"3536\"" lub "--nowarn:3536”. Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - Deklarowanie \"interfejsów ze statycznymi metodami abstrakcyjnymi\" jest funkcją zaawansowaną. Aby uzyskać wskazówki, zobacz https://aka.ms/fsharp-iwsams. To ostrzeżenie można wyłączyć przy użyciu polecenia „#nowarn \"3535\"" lub "--nowarn:3535”. + Deklarowanie \"interfejsów ze statycznymi metodami abstrakcyjnymi\" jest funkcją zaawansowaną. Aby uzyskać wskazówki, zobacz https://aka.ms/fsharp-iwsams. To ostrzeżenie można wyłączyć przy użyciu polecenia „#nowarn \"3535\"" lub "--nowarn:3535”. @@ -1564,7 +1699,7 @@ A type has been implicitly inferred as 'obj', which may be unintended. Consider adding explicit type annotations. You can disable this warning by using '#nowarn \"3559\"' or '--nowarn:3559'. - Typ został niejawnie wywnioskowany jako „obj”, co może być niezamierzone. Rozważ dodanie jawnych adnotacji typu. Możesz wyłączyć to ostrzeżenie, używając polecenia „#nowarn \"3559\"” lub „--nowarn:3559”. + Typ został niejawnie wywnioskowany jako „obj”, co może być niezamierzone. Rozważ dodanie jawnych adnotacji typu. Możesz wyłączyć to ostrzeżenie, używając polecenia „#nowarn \"3559\"” lub „--nowarn:3559”. @@ -1899,7 +2034,7 @@ Invalid directive. Expected '#time', '#time \"on\"' or '#time \"off\"'. - Nieprawidłowa dyrektywa. Oczekiwano „#time”, „#time \"on\"” lub „#time \"off\"”. + Nieprawidłowa dyrektywa. Oczekiwano „#time”, „#time \"on\"” lub „#time \"off\"”. @@ -4823,8 +4958,8 @@ - This is not a valid name for an active pattern - To nie jest prawidłowa nazwa aktywnego wzorca + '{0}' is not a valid method name. Use a 'let' binding instead. + '{0}' is not a valid method name. Use a 'let' binding instead. @@ -5768,7 +5903,7 @@ - Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debuggging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). + Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debugging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). Określ typ debugowania: full, portable, pdbonly. Wartość „{0}” jest wartością domyślną, jeśli nie określono typu debugowania, i umożliwia dołączenie debugera do działającego programu. Wartość „portable” określa format międzyplatformowy. Wartość „embedded” określa format międzyplatformowy osadzony w pliku wyjściowym. @@ -6388,8 +6523,8 @@ - This byte array literal contains characters that do not encode as a single byte - Ten literał tablicy bajtowej zawiera znaki, które nie są kodowane jako pojedynczy bajt + This byte array literal contains {0} characters that do not encode as a single byte + This byte array literal contains {0} characters that do not encode as a single byte @@ -6472,11 +6607,6 @@ To nie jest prawidłowy literał liczbowy. Prawidłowe literały liczbowe to 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/bajt), 1,0 (float/double), 1,0f (float32/single), 1,0 m (dziesiętny), 1I (bigint). - - This is not a valid byte literal - Nie jest to prawidłowy literał bajtowy - - This is not a valid character literal Nie jest to prawidłowy literał znakowy @@ -7028,7 +7158,7 @@ - The resident compilation service was not used because a problem occured in communicating with the server. + The resident compilation service was not used because a problem occurred in communicating with the server. Rezydentna usługa kompilacji nie została użyta, ponieważ wystąpił problem z komunikowaniem się z serwerem. @@ -7228,7 +7358,7 @@ - An error occured applying the static arguments to a provided type + An error occurred applying the static arguments to a provided type Wystąpił błąd podczas stosowania argumentów statycznych do udostępnionego typu @@ -7293,7 +7423,7 @@ - Assembly '{0}' hase TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name + Assembly '{0}' has TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name Zestaw „{0}” ma atrybut TypeProviderAssembly z nieprawidłową wartością „{1}”. Wartość powinna być prawidłową nazwą zestawu @@ -7878,7 +8008,7 @@ - An error occured applying the static arguments to a provided method + An error occurred applying the static arguments to a provided method Wystąpił błąd podczas stosowania argumentów statycznych dla podanej metody @@ -8007,7 +8137,7 @@ Jeśli typ unii wielokaskładnikowej jest strukturą, wszystkie przypadki unii muszą mieć unikatowe nazwy. Na przykład: „typ A = B z b: int | C z c: int”. - + The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute. Zastosowanie elementu CallerMemberNameAttribute do parametru „{0}” nie odniesie żadnego skutku. Jest on przesłaniany przez element CallerFilePathAttribute. @@ -8323,8 +8453,8 @@ - Used to introduce a block of code that might generate an exception. Used together with with or finally. - Używane do wprowadzania bloku kodu, który może generować wyjątek. Używane razem ze słowem kluczowym with lub finally. + Used to introduce a block of code that might generate an exception. Used together with 'with' or 'finally'. + Używane do wprowadzania bloku kodu, który może generować wyjątek. Używane razem ze słowem kluczowym with lub finally. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 59138d83890..c49d815ca06 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -124,12 +124,12 @@ A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). - A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). + Um membro de interface não virtual abstrato estático só deve ser chamado via parâmetro de tipo (por exemplo: ''T.{0}). Classes cannot contain static abstract members. - Classes cannot contain static abstract members. + Classes não podem conter membros abstratos estáticos. @@ -192,6 +192,11 @@ Parâmetro de tipo conhecido: {0} + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + Argument at index {0} doesn't match O argumento no índice {0} não corresponde @@ -202,6 +207,16 @@ O argumento '{0}' não corresponde + + The type '{0}' supports 'null' but a non-null type is expected + The type '{0}' supports 'null' but a non-null type is expected + + + + The type '{0}' uses 'null' as a representation value but a non-null type is expected + The type '{0}' uses 'null' as a representation value but a non-null type is expected + + The constraints 'unmanaged' and 'not struct' are inconsistent As restrições "unmanaged" e "not struct" são inconsistentes @@ -227,6 +242,11 @@ O atributo de assembly '{0}' refere-se a um assembly de designer '{1}' que não pode ser carregado ou que não existe. A exceção relatada foi {2} – {3} + + {0} for F# {1} + {0} for F# {1} + + underscore dot shorthand for accessor only function sublinhado ponto abreviação para função somente acessador @@ -237,6 +257,16 @@ conversões direcionadas por tipos adicionais + + Allow access modifiers to auto properties getters and setters + Allow access modifiers to auto properties getters and setters + + + + Allow object expressions without overrides + Allow object expressions without overrides + + applicative computation expressions expressões de computação aplicáveis @@ -277,6 +307,11 @@ Gera avisos se o atributo "TailCall" for usado em funções não recursivas. + + The interaction between #nowarn and #line is now consistent. + The interaction between #nowarn and #line is now consistent. + + Constraint intersection on flexible types Interseção de restrição em tipos flexíveis @@ -302,6 +337,11 @@ literal float32 sem ponto + + Support for computation expressions with empty bodies: builder {{ }} + Support for computation expressions with empty bodies: builder {{ }} + + Enforce AttributeTargets Impor AttributeTargets @@ -397,9 +437,9 @@ Otimiza determinados usos dos operadores de intervalo integral (...) e de etapa de intervalo (... ..) para loops while rápidos. - - Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to calls to List.map and Array.map when xs is a list or an array, respectively. - Reduz [para x em xs -> f x] e [|para x em xs -> f x|] para chamadas em List.map e Array.map quando xs for uma lista ou uma matriz, respectivamente. + + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. @@ -442,6 +482,11 @@ interoperabilidade opcional anulável + + nullness checking + nullness checking + + open type declaration declaração de tipo aberto @@ -459,17 +504,17 @@ # directives with non-quoted string arguments - # directives with non-quoted string arguments + Diretivas # com argumentos de cadeia de caracteres sem aspas Unexpected identifier '{0}'. - Unexpected identifier '{0}'. + Identificador inesperado "{0}". Unexpected integer literal '{0}'. - Unexpected integer literal '{0}'. + Literal de inteiro inesperado "{0}". @@ -498,7 +543,7 @@ - whitespace relexation + whitespace relaxation atenuação de espaço em branco @@ -702,6 +747,11 @@ Usado em expressões de computação para introduzir um constructo de looping em que a condição é o resultado de outra expressão de computação. + + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + + a byte string may not be interpolated uma cadeia de caracteres de byte não pode ser interpolada @@ -717,11 +767,26 @@ As regiões IF-FSHARP/IF-CAML não são mais suportadas + + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + + + + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + + This is not a valid identifier Este não é um identificador válido + + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + + A '}}' character must be escaped (by doubling) in an interpolated string. Um caractere ''}}' precisa ser de escape (ao duplicar) em uma cadeia de caracteres interpolada. @@ -827,6 +892,11 @@ Imprimir as interfaces inferidas de todos os arquivos de compilação para os arquivos de assinatura associados + + Enable nullness declarations and checks + Enable nullness declarations and checks + + Clear the package manager results cache Limpar o cache de resultados do gerenciador de pacotes @@ -972,21 +1042,26 @@ Esperando uma expressão - - Expecting record field - Esperando campo de registro - - Expecting pattern Padrão esperado + + Expecting record field + Expecting record field + + Expecting type Esperando tipo + + Expecting union case field + Expecting union case field + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Literal de caractere incompleto (exemplo: 'Q') ou invocação de tipo qualificado (exemplo: 'T.Name) @@ -1053,7 +1128,7 @@ - A constrained generic construct occured in the resumable code specification + A constrained generic construct occurred in the resumable code specification Um constructo genérico restrito ocorreu na especificação de código retomável @@ -1068,7 +1143,7 @@ - A 'let rec' occured in the resumable code specification + A 'let rec' occurred in the resumable code specification Ocorreu um "let rec" na especificação do código retomável @@ -1137,24 +1212,29 @@ (Nome sugerido) + + Access modifiers cannot be applied to an SRTP constraint. + Access modifiers cannot be applied to an SRTP constraint. + + This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. - This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. + Este padrão ativo espera argumentos de expressão {0}, por exemplo, ''{1}{2}''. This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. - This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. + Este padrão ativo espera argumento(s) de expressão {0} e um argumento de padrão, por exemplo, ''{1}{2} pat''. This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. - This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. + Este padrão ativo não espera argumentos, ou seja, ele deve ser usado como ''{0}'' em vez de ''{1} x''. This active pattern expects exactly one pattern argument, e.g., '{0} pat'. - This active pattern expects exactly one pattern argument, e.g., '{0} pat'. + Este padrão ativo espera exatamente um argumento de padrão, por exemplo, ''{0} pat''. @@ -1247,6 +1327,11 @@ A sintaxe lambda abreviada só tem suporte para expressões atômicas, como método, propriedade, campo ou indexador no argumento '_' implícito. Por exemplo: 'let f = _. Comprimento'. + + An empty body may only be used if the computation expression builder defines a 'Zero' method. + An empty body may only be used if the computation expression builder defines a 'Zero' method. + + The syntax 'expr1[expr2]' is used for indexing. Consider adding a type annotation to enable indexing, or if calling a function add a space, e.g. 'expr1 [expr2]'. A sintaxe 'expr1[expr2]' é usada para indexação. Considere adicionar uma anotação de tipo para habilitar a indexação ou, se chamar uma função, adicione um espaço, por exemplo, 'expr1 [expr2]'. @@ -1279,7 +1364,7 @@ This expression uses the implicit conversion '{0}' to convert type '{1}' to type '{2}'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn \"3391\". - Essa expressão usa a conversão implícita '{0}' para converter o tipo '{1}' ao tipo '{2}'. Consulte https://aka.ms/fsharp-implicit-convs. Este aviso pode ser desabilitado usando '#nowarn\"3391\". + Essa expressão usa a conversão implícita '{0}' para converter o tipo '{1}' ao tipo '{2}'. Consulte https://aka.ms/fsharp-implicit-convs. Este aviso pode ser desabilitado usando '#nowarn\"3391\". @@ -1363,7 +1448,7 @@ - The following required properties have to be initalized:{0} + The following required properties have to be initialized:{0} As seguintes propriedades necessárias precisam ser inicializadas:{0} @@ -1412,6 +1497,16 @@ O valor '{0}' não é uma função e não dá suporte à notação de índice. + + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + + + + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + + The syntax 'expr1[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use 'expr1.[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction expr1 [expr2]'. A sintaxe '[expr1][expr2]' é ambígua quando usada como um argumento. Consulte https://aka.ms/fsharp-index-notation. Se você pretende indexar ou colocar em fatias, deve usar '(expr1).[expr2]' na posição do argumento. Se chamar uma função com vários argumentos na forma curried, adicione um espaço entre eles, por exemplo, 'someFunction [expr1] [expr2]'. @@ -1437,6 +1532,41 @@ A sintaxe 'expr1[expr2]' agora está reservada para indexação e é ambígua quando usada como um argumento. Consulte https://aka.ms/fsharp-index-notation. Se chamar uma função com vários argumentos na forma curried, adicione um espaço entre eles, por exemplo, 'someFunction expr1 [expr2]'. + + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + + + + Value known to be without null passed to a function meant for nullables: {0} + Value known to be without null passed to a function meant for nullables: {0} + + + + You can remove this |Null|NonNull| pattern usage. + You can remove this |Null|NonNull| pattern usage. + + + + You can remove this |NonNullQuick| pattern usage. + You can remove this |NonNullQuick| pattern usage. + + + + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + + + + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + + + + You can remove this `nonNull` assertion. + You can remove this `nonNull` assertion. + + The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a '{0}' method or appropriate 'MergeSources' and 'Bind' methods O “let! ... and! ...” só poderá ser usada se o construtor de expressão de cálculo definir um método “{0}” ou métodos “MergeSources” e “Bind” apropriados @@ -1453,7 +1583,7 @@ - Invalid resumable code. A 'let rec' occured in the resumable code specification + Invalid resumable code. A 'let rec' occurred in the resumable code specification Código inválido retomável. Ocorreu um "let rec" na especificação do código retomável @@ -1522,6 +1652,11 @@ Uma característica não pode especificar os argumentos optional, in, out, ParamArray, CallerInfo ou Quote + + The type '{0}' does not support a nullness qualification. + The type '{0}' does not support a nullness qualification. + + Invalid interpolated string. {0} Cadeia de caracteres interpolada inválida. {0} @@ -1534,12 +1669,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' normalmente é usado como uma restrição de tipo em código genérico, por exemplo, \"'T when ISomeInterface<'T>\" ou \"let f (x: #ISomeInterface<_>)\". Confira https://aka.ms/fsharp-iwsams para obter as diretrizes. Você pode desabilitar este aviso usando '#nowarn \"3536\"' ou '--nowarn:3536'. + '{0}' normalmente é usado como uma restrição de tipo em código genérico, por exemplo, \"'T when ISomeInterface<'T>\" ou \"let f (x: #ISomeInterface<_>)\". Confira https://aka.ms/fsharp-iwsams para obter as diretrizes. Você pode desabilitar este aviso usando '#nowarn \"3536\"' ou '--nowarn:3536'. Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - Declarando \"interfaces com métodos abstratos estáticos\" é um recurso avançado. Consulte https://aka.ms/fsharp-iwsams para obter diretrizes. Você pode desabilitar esse aviso usando '#nowarn \"3535\"' ou '--nowarn:3535'. + Declarando \"interfaces com métodos abstratos estáticos\" é um recurso avançado. Consulte https://aka.ms/fsharp-iwsams para obter diretrizes. Você pode desabilitar esse aviso usando '#nowarn \"3535\"' ou '--nowarn:3535'. @@ -1564,7 +1699,7 @@ A type has been implicitly inferred as 'obj', which may be unintended. Consider adding explicit type annotations. You can disable this warning by using '#nowarn \"3559\"' or '--nowarn:3559'. - Um tipo foi implicitamente inferido como 'obj', que pode não ser intencional. Considere adicionar anotações de tipo explícitas. Você pode desabilitar esse aviso usando '#nowarn \"3559\"' ou '--nowarn:3559'. + Um tipo foi implicitamente inferido como 'obj', que pode não ser intencional. Considere adicionar anotações de tipo explícitas. Você pode desabilitar esse aviso usando '#nowarn \"3559\"' ou '--nowarn:3559'. @@ -1899,7 +2034,7 @@ Invalid directive. Expected '#time', '#time \"on\"' or '#time \"off\"'. - Diretiva inválida. '#time', '#time \"on\"' ou '#time \"off\"' era esperado. + Diretiva inválida. '#time', '#time \"on\"' ou '#time \"off\"' era esperado. @@ -4823,8 +4958,8 @@ - This is not a valid name for an active pattern - Este não é um nome válido para um padrão ativo + '{0}' is not a valid method name. Use a 'let' binding instead. + '{0}' is not a valid method name. Use a 'let' binding instead. @@ -5768,7 +5903,7 @@ - Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debuggging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). + Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debugging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). Especificar tipo de depuração: completo, portátil, incorporado, somente PDB. ('{0}' será o padrão se nenhum tipo de depuração for especificado e permite anexar um depurador a um programa em execução; 'portátil' é um formato multiplataforma; 'incorporado' é um formato multiplataforma incorporado no arquivo de saída). @@ -6388,8 +6523,8 @@ - This byte array literal contains characters that do not encode as a single byte - Este literal matriz de byte contém caracteres não codificados como um byte simples + This byte array literal contains {0} characters that do not encode as a single byte + This byte array literal contains {0} characters that do not encode as a single byte @@ -6472,11 +6607,6 @@ Este não é um literal numérico válido. Os literais numéricos válidos incluem 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/ sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - - This is not a valid byte literal - Este não é um literal de byte válido - - This is not a valid character literal Este não é um literal de caractere válido @@ -7028,7 +7158,7 @@ - The resident compilation service was not used because a problem occured in communicating with the server. + The resident compilation service was not used because a problem occurred in communicating with the server. O serviço de compilação residente não foi usado porque houve um problema de comunicação com o servidor. @@ -7228,7 +7358,7 @@ - An error occured applying the static arguments to a provided type + An error occurred applying the static arguments to a provided type Erro ao aplicar os argumentos estáticos a um tipo fornecido @@ -7293,7 +7423,7 @@ - Assembly '{0}' hase TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name + Assembly '{0}' has TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name O assembly '{0}' possui um atributo TypeProviderAssembly com valor inválido '{1}'. O valor deve ser um nome de assembly válido @@ -7878,7 +8008,7 @@ - An error occured applying the static arguments to a provided method + An error occurred applying the static arguments to a provided method Ocorreu um erro ao aplicar os argumentos estáticos para um método fornecido @@ -8007,7 +8137,7 @@ Se um tipo de união multicase for um struct, todos os casos união deverão ter nomes exclusivos. Por exemplo: tipo A = B de b: int | C de c: int'. - + The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute. O CallerMemberNameAttribute aplicado ao parâmetro "{0}" não terá efeito. Ele é substituído pelo CallerFilePathAttribute. @@ -8323,8 +8453,8 @@ - Used to introduce a block of code that might generate an exception. Used together with with or finally. - Usado para introduzir um bloco de código que pode gerar uma exceção. Usado junto com with ou finally. + Used to introduce a block of code that might generate an exception. Used together with 'with' or 'finally'. + Usado para introduzir um bloco de código que pode gerar uma exceção. Usado junto com with ou finally. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 58c625f0746..495089d8c53 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -124,12 +124,12 @@ A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). - A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). + Статический абстрактный невиртуальный элемент интерфейса должен вызываться только с помощью параметра типа (например, 'T.{0}). Classes cannot contain static abstract members. - Classes cannot contain static abstract members. + Классы не могут содержать статические абстрактные элементы. @@ -192,6 +192,11 @@ Известный параметр типа: {0} + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + Argument at index {0} doesn't match Аргумент в индексе {0} не соответствует @@ -202,6 +207,16 @@ Аргумент "{0}" не соответствует + + The type '{0}' supports 'null' but a non-null type is expected + The type '{0}' supports 'null' but a non-null type is expected + + + + The type '{0}' uses 'null' as a representation value but a non-null type is expected + The type '{0}' uses 'null' as a representation value but a non-null type is expected + + The constraints 'unmanaged' and 'not struct' are inconsistent Ограничения "unmanaged" и "not struct" несовместимы @@ -227,6 +242,11 @@ Атрибут сборки "{0}" ссылается на сборку конструктора "{1}", которая не может быть загружена или не существует. Получено исключение: {2} — {3} + + {0} for F# {1} + {0} for F# {1} + + underscore dot shorthand for accessor only function символ подчеркивания, сокращение точки для функции только для метода доступа @@ -237,6 +257,16 @@ дополнительные преобразования на основе типа + + Allow access modifiers to auto properties getters and setters + Allow access modifiers to auto properties getters and setters + + + + Allow object expressions without overrides + Allow object expressions without overrides + + applicative computation expressions применимые вычислительные выражения @@ -277,6 +307,11 @@ Выдает предупреждения, если атрибут TailCall используется в нерекурсивных функциях. + + The interaction between #nowarn and #line is now consistent. + The interaction between #nowarn and #line is now consistent. + + Constraint intersection on flexible types Пересечение ограничений на гибких типах @@ -302,6 +337,11 @@ литерал float32 без точки + + Support for computation expressions with empty bodies: builder {{ }} + Support for computation expressions with empty bodies: builder {{ }} + + Enforce AttributeTargets Принудительно применить AttributeTargets @@ -397,9 +437,9 @@ Оптимизирует определенные варианты использования операторов целого диапазона (..) и шага диапазона (.. ..) для быстрых циклов while. - - Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to calls to List.map and Array.map when xs is a list or an array, respectively. - Понижает [для x в xs -> f x] и [|для x в xs -> f x|] для вызовов List.map и Array.map, если xs является списком или массивом соответственно. + + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. @@ -442,6 +482,11 @@ необязательное взаимодействие, допускающее значение NULL + + nullness checking + nullness checking + + open type declaration объявление открытого типа @@ -459,17 +504,17 @@ # directives with non-quoted string arguments - # directives with non-quoted string arguments + Директивы # с аргументами строк без кавычек Unexpected identifier '{0}'. - Unexpected identifier '{0}'. + Недопустимый идентификатор: "{0}". Unexpected integer literal '{0}'. - Unexpected integer literal '{0}'. + Непредвиденный литерал целого числа "{0}". @@ -498,7 +543,7 @@ - whitespace relexation + whitespace relaxation уменьшение строгости для пробелов @@ -702,6 +747,11 @@ Используется в вычислительных выражениях для введения циклической конструкции, в которой условие является результатом другого вычислительного выражения. + + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + + a byte string may not be interpolated невозможно выполнить интерполяцию для строки байтов @@ -717,11 +767,26 @@ Регионы IF-FSHARP/IF-CAML больше не поддерживаются + + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + + + + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + + This is not a valid identifier Это недопустимый идентификатор + + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + + A '}}' character must be escaped (by doubling) in an interpolated string. Символ "}}" необходимо экранировать (путем дублирования) в интерполированной строке. @@ -827,6 +892,11 @@ Печать определяемых интерфейсов всех файлов компиляции в связанные файлы подписей + + Enable nullness declarations and checks + Enable nullness declarations and checks + + Clear the package manager results cache Очистка кэша результатов диспетчера пакетов @@ -972,21 +1042,26 @@ Ожидается выражение - - Expecting record field - Ожидается поле записи - - Expecting pattern Ожидается шаблон + + Expecting record field + Expecting record field + + Expecting type Требуется тип + + Expecting union case field + Expecting union case field + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Неполный символьный литерал (например: "Q") или вызов квалифицированного типа (например: "T.Name) @@ -1053,7 +1128,7 @@ - A constrained generic construct occured in the resumable code specification + A constrained generic construct occurred in the resumable code specification В спецификации возобновляемого кода возникла ограниченная универсальная конструкция @@ -1068,7 +1143,7 @@ - A 'let rec' occured in the resumable code specification + A 'let rec' occurred in the resumable code specification В спецификации возобновляемого кода возникла ошибка "let rec" @@ -1137,24 +1212,29 @@ (предложенное имя) + + Access modifiers cannot be applied to an SRTP constraint. + Access modifiers cannot be applied to an SRTP constraint. + + This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. - This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. + Этот активный шаблон ожидает аргументы выражения ({0}), например "{1}{2}". This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. - This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. + Этот активный шаблон ожидает аргументы выражения ({0}) и аргумент шаблона, например "{1}{2} pat". This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. - This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. + Этот активный шаблон не ожидает аргументов, то есть его следует использовать как "{0}" вместо "{1} x". This active pattern expects exactly one pattern argument, e.g., '{0} pat'. - This active pattern expects exactly one pattern argument, e.g., '{0} pat'. + Этот активный шаблон ожидает ровно один аргумент шаблона, например "{0} pat". @@ -1247,6 +1327,11 @@ Сокращенный синтаксис лямбда-выражений поддерживается только для атомарных выражений, таких как метод, свойство, поле или индексатор подразумеваемого аргумента «_». Например: 'let f = _.Length'. + + An empty body may only be used if the computation expression builder defines a 'Zero' method. + An empty body may only be used if the computation expression builder defines a 'Zero' method. + + The syntax 'expr1[expr2]' is used for indexing. Consider adding a type annotation to enable indexing, or if calling a function add a space, e.g. 'expr1 [expr2]'. Для индексирования используется синтаксис "expr1[expr2]". Рассмотрите возможность добавления аннотации типа для включения индексации или при вызове функции добавьте пробел, например "expr1 [expr2]". @@ -1279,7 +1364,7 @@ This expression uses the implicit conversion '{0}' to convert type '{1}' to type '{2}'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn \"3391\". - Это выражение использует неявное преобразование "{0}" для преобразования типа "{1}" в тип "{2}". См. сведения на странице https://aka.ms/fsharp-implicit-convs. Это предупреждение можно отключить, используя параметр '#nowarn \"3391\" + Это выражение использует неявное преобразование "{0}" для преобразования типа "{1}" в тип "{2}". См. сведения на странице https://aka.ms/fsharp-implicit-convs. Это предупреждение можно отключить, используя параметр '#nowarn \"3391\" @@ -1363,7 +1448,7 @@ - The following required properties have to be initalized:{0} + The following required properties have to be initialized:{0} Необходимо инициализировать следующие обязательные свойства:{0} @@ -1412,6 +1497,16 @@ Значение {0} не является функцией и не поддерживает нотацию индекса. + + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + + + + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + + The syntax 'expr1[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use 'expr1.[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction expr1 [expr2]'. Синтаксис "expr1[expr2]" неоднозначен при использовании в качестве аргумента. См. https://aka.ms/fsharp-index-notation. Если вы намереваетесь индексировать или разрезать, необходимо использовать "expr1.[expr2]" в позиции аргумента. При вызове функции с несколькими каррированными аргументами добавьте пробел между ними, например "someFunction expr1 [expr2]". @@ -1437,6 +1532,41 @@ Синтаксис "(expr1)[expr2]" теперь зарезервирован для индексирования и неоднозначен при использовании в качестве аргумента. См. https://aka.ms/fsharp-index-notation. При вызове функции с несколькими каррированными аргументами добавьте между ними пробел, например "someFunction (expr1) [expr2]". + + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + + + + Value known to be without null passed to a function meant for nullables: {0} + Value known to be without null passed to a function meant for nullables: {0} + + + + You can remove this |Null|NonNull| pattern usage. + You can remove this |Null|NonNull| pattern usage. + + + + You can remove this |NonNullQuick| pattern usage. + You can remove this |NonNullQuick| pattern usage. + + + + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + + + + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + + + + You can remove this `nonNull` assertion. + You can remove this `nonNull` assertion. + + The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a '{0}' method or appropriate 'MergeSources' and 'Bind' methods Конструкцию "let! ... and! ..." можно использовать только в том случае, если построитель выражений с вычислениями определяет либо метод "{0}", либо соответствующие методы "MergeSources" и "Bind" @@ -1453,7 +1583,7 @@ - Invalid resumable code. A 'let rec' occured in the resumable code specification + Invalid resumable code. A 'let rec' occurred in the resumable code specification Недопустимый возобновляемый код. В спецификации возобновляемого кода возникла ошибка "let rec" @@ -1522,6 +1652,11 @@ Признак не может указывать необязательные аргументы in, out, ParamArray, CallerInfo или Quote + + The type '{0}' does not support a nullness qualification. + The type '{0}' does not support a nullness qualification. + + Invalid interpolated string. {0} Недопустимая интерполированная строка. {0} @@ -1534,12 +1669,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - "{0}" обычно используется в качестве ограничения типа в универсальном коде, например \"'T when ISomeInterface<"T>\" или \"let f (x: #ISomeInterface<_>)\". См. руководство на https://aka.ms/fsharp-iwsams. Это предупреждение можно отключить с помощью "#nowarn \"3536\"" или "--nowarn:3536". + "{0}" обычно используется в качестве ограничения типа в универсальном коде, например \"'T when ISomeInterface<"T>\" или \"let f (x: #ISomeInterface<_>)\". См. руководство на https://aka.ms/fsharp-iwsams. Это предупреждение можно отключить с помощью "#nowarn \"3536\"" или "--nowarn:3536". Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - Объявление \"интерфейсов со статическими абстрактными методами\" является расширенной функцией. См. руководство на https://aka.ms/fsharp-iwsams. Это предупреждение можно отключить с помощью используя "#nowarn \"3535\"" or "--nowarn:3535". + Объявление \"интерфейсов со статическими абстрактными методами\" является расширенной функцией. См. руководство на https://aka.ms/fsharp-iwsams. Это предупреждение можно отключить с помощью используя "#nowarn \"3535\"" or "--nowarn:3535". @@ -1564,7 +1699,7 @@ A type has been implicitly inferred as 'obj', which may be unintended. Consider adding explicit type annotations. You can disable this warning by using '#nowarn \"3559\"' or '--nowarn:3559'. - Тип неявно определен как "obj", что может быть непреднамеренными. Рекомендуется добавить явные аннотации к типу. Это предупреждение можно отключить с помощью "#nowarn \"3559\"" или "--nowarn:3559". + Тип неявно определен как "obj", что может быть непреднамеренными. Рекомендуется добавить явные аннотации к типу. Это предупреждение можно отключить с помощью "#nowarn \"3559\"" или "--nowarn:3559". @@ -1899,7 +2034,7 @@ Invalid directive. Expected '#time', '#time \"on\"' or '#time \"off\"'. - Недопустимая директива. Требуется ''#time'', ''#time \"on\"'' или ''#time \"off\"''. + Недопустимая директива. Требуется ''#time'', ''#time \"on\"'' или ''#time \"off\"''. @@ -4823,8 +4958,8 @@ - This is not a valid name for an active pattern - Недопустимое имя для активного шаблона + '{0}' is not a valid method name. Use a 'let' binding instead. + '{0}' is not a valid method name. Use a 'let' binding instead. @@ -5768,7 +5903,7 @@ - Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debuggging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). + Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debugging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). Укажите тип отладки: full, portable, embedded, pdbonly (если тип отладки не указан, по умолчанию используется тип "{0}", позволяющий подключить отладчик к выполняющейся программе; тип portable представляет собой кроссплатформенный формат; тип embedded — кроссплатформенный формат, встроенный в выходной файл). @@ -6388,8 +6523,8 @@ - This byte array literal contains characters that do not encode as a single byte - Этот литерал массива байтов содержит знаки, не поддерживающие однобайтовую кодировку + This byte array literal contains {0} characters that do not encode as a single byte + This byte array literal contains {0} characters that do not encode as a single byte @@ -6472,11 +6607,6 @@ Это значение не является допустимым числовым литералом. Допустимые числовые литералы: 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1,0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - - This is not a valid byte literal - Не является допустимым байтовым литералом. - - This is not a valid character literal Не является допустимым символьным литералом. @@ -7028,7 +7158,7 @@ - The resident compilation service was not used because a problem occured in communicating with the server. + The resident compilation service was not used because a problem occurred in communicating with the server. Служба резидентной компиляции не использовалась, поскольку возникла проблема при взаимодействии с сервером. @@ -7228,7 +7358,7 @@ - An error occured applying the static arguments to a provided type + An error occurred applying the static arguments to a provided type Ошибка при применении статических аргументов к предоставленному типу @@ -7293,7 +7423,7 @@ - Assembly '{0}' hase TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name + Assembly '{0}' has TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name У сборки "{0}" имеется атрибут TypeProviderAssembly с недопустимым значением "{1}". Значение должно представлять собой допустимое имя сборки @@ -7878,7 +8008,7 @@ - An error occured applying the static arguments to a provided method + An error occurred applying the static arguments to a provided method Произошла ошибка при применении статических аргументов к предоставленному методу @@ -8007,7 +8137,7 @@ Если тип объединения с несколькими регистрами является структурой, все случаи объединения должны иметь уникальные имена. Например: "type A = B of b: int | C of c: int". - + The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute. Атрибут CallerMemberNameAttribute, примененный для параметра "{0}", не будет действовать. Он будет переопределен атрибутом CallerFilePathAttribute. @@ -8323,8 +8453,8 @@ - Used to introduce a block of code that might generate an exception. Used together with with or finally. - Используется для введения блока кода, который может создать исключение. Используется вместе с with или finally. + Used to introduce a block of code that might generate an exception. Used together with 'with' or 'finally'. + Используется для введения блока кода, который может создать исключение. Используется вместе с with или finally. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index cfe703430c0..93dfdedb2bd 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -124,12 +124,12 @@ A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). - A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). + Statik soyut sanal olmayan arabirim üyesi yalnızca tür parametresi aracılığıyla çağrılmalıdır (örneğin: 'T.{0}). Classes cannot contain static abstract members. - Classes cannot contain static abstract members. + Sınıflar statik soyut üyeler içeremez. @@ -192,6 +192,11 @@ Bilinen tür parametresi: {0} + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + Argument at index {0} doesn't match {0} dizinindeki bağımsız değişken eşleşmiyor @@ -202,6 +207,16 @@ '{0}' bağımsız değişkeni eşleşmiyor + + The type '{0}' supports 'null' but a non-null type is expected + The type '{0}' supports 'null' but a non-null type is expected + + + + The type '{0}' uses 'null' as a representation value but a non-null type is expected + The type '{0}' uses 'null' as a representation value but a non-null type is expected + + The constraints 'unmanaged' and 'not struct' are inconsistent 'unmanaged' ve 'not struct' kısıtlamaları tutarsız @@ -227,6 +242,11 @@ '{0}' bütünleştirilmiş kod özniteliği, yüklenemeyen veya mevcut olmayan '{1}' tasarımcı bütünleştirilmiş koduna başvuruyor. Bildirilen özel durum: {2} - {3} + + {0} for F# {1} + {0} for F# {1} + + underscore dot shorthand for accessor only function yalnızca erişimci işlevi için alt çizgi nokta kısaltma @@ -237,6 +257,16 @@ ek tür ile yönlendirilen dönüştürmeler + + Allow access modifiers to auto properties getters and setters + Allow access modifiers to auto properties getters and setters + + + + Allow object expressions without overrides + Allow object expressions without overrides + + applicative computation expressions uygulama hesaplama ifadeleri @@ -277,6 +307,11 @@ 'TailCall' özniteliği özyinelemeli olmayan işlevlerde kullanılıyorsa uyarılar oluşturur. + + The interaction between #nowarn and #line is now consistent. + The interaction between #nowarn and #line is now consistent. + + Constraint intersection on flexible types Esnek türlerde kısıtlama kesişimi @@ -302,6 +337,11 @@ noktasız float32 sabit değeri + + Support for computation expressions with empty bodies: builder {{ }} + Support for computation expressions with empty bodies: builder {{ }} + + Enforce AttributeTargets AttributeTargets'ı zorla @@ -397,9 +437,9 @@ İntegral aralığı (..) ve aralık adımı (.. ..) işleçlerinin belirli kullanımlarını hızlı while döngüsünde en iyi duruma getirir. - - Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to calls to List.map and Array.map when xs is a list or an array, respectively. - Xs bir liste veya dizi olduğunda [for x in xs -> f x] ve [|for x in xs -> f x|] çağrılarını sırasıyla List.map ve Array.map olarak indirger. + + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. @@ -442,6 +482,11 @@ null atanabilir isteğe bağlı birlikte çalışma + + nullness checking + nullness checking + + open type declaration açık tür bildirimi @@ -459,17 +504,17 @@ # directives with non-quoted string arguments - # directives with non-quoted string arguments + Tırnak içine alınmamış dize bağımsız değişkenlerine sahip # yönergeleri Unexpected identifier '{0}'. - Unexpected identifier '{0}'. + Beklenmeyen tanımlayıcı: '{0}'. Unexpected integer literal '{0}'. - Unexpected integer literal '{0}'. + Beklenmeyen tamsayı değişmez değeri '{0}'. @@ -498,7 +543,7 @@ - whitespace relexation + whitespace relaxation boşluk genişlemesi @@ -702,6 +747,11 @@ Hesaplama ifadelerinde, koşulun başka bir hesaplama ifadesinin sonucu olduğu bir döngü yapısı eklemek için kullanılır. + + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + + a byte string may not be interpolated bir bayt dizesi, düz metin arasına kod eklenerek kullanılamaz @@ -717,11 +767,26 @@ IF-FSHARP/IF-CAML bölgeleri artık desteklenmiyor + + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + + + + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + + This is not a valid identifier Bu, geçerli bir tanımlayıcı değil + + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + + A '}}' character must be escaped (by doubling) in an interpolated string. Bir '}}' karakteri, düz metin arasına kod eklenmiş bir dizede kaçış dizisi ile (yineleme yapılarak) belirtilir. @@ -827,6 +892,11 @@ Tüm derleme dosyalarının çıkarsanan arabirimlerini ilişkili imza dosyalarına yazdır + + Enable nullness declarations and checks + Enable nullness declarations and checks + + Clear the package manager results cache Paket yöneticisi sonuçları önbelleğini temizle @@ -972,21 +1042,26 @@ İfade bekleniyor - - Expecting record field - Kayıt alanı bekleniyor - - Expecting pattern Desen bekleniyor + + Expecting record field + Expecting record field + + Expecting type Tür bekleniyor + + Expecting union case field + Expecting union case field + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) Eksik karakter değişmez değeri (örnek: 'Q') veya tam tür çağrısı (örnek: 'T.Name) @@ -1053,7 +1128,7 @@ - A constrained generic construct occured in the resumable code specification + A constrained generic construct occurred in the resumable code specification Sürdürülebilir kod belirtiminde kısıtlanmış bir genel yapı oluştu @@ -1068,7 +1143,7 @@ - A 'let rec' occured in the resumable code specification + A 'let rec' occurred in the resumable code specification Sürdürülebilir kod belirtiminde 'let rec' oluştu @@ -1137,24 +1212,29 @@ (Önerilen ad) + + Access modifiers cannot be applied to an SRTP constraint. + Access modifiers cannot be applied to an SRTP constraint. + + This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. - This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. + Bu etkin desen, {0} ifade bağımsız değişkenlerini bekliyor, ör. '{1}{2}'. This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. - This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. + Bu etkin desen, {0} bağımsız değişkenlerini ve desen bağımsız değişkenlerini bekliyor, ör. '{1}{2}. This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. - This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. + Bu etkin desen herhangi bir bağımsız değişken beklemiyor, yani '{1} x' yerine '{0}' gibi kullanılmalıdır. This active pattern expects exactly one pattern argument, e.g., '{0} pat'. - This active pattern expects exactly one pattern argument, e.g., '{0} pat'. + Bu etkin desen, tam olarak bir desen bağımsız değişkeni bekliyor, ör. '{0} pat'. @@ -1247,6 +1327,11 @@ Toplu lambda söz dizimi yalnızca örtülü '_' bağımsız değişkeninde yöntem, özellik, alan veya dizin oluşturucu gibi atomik ifadeler için destekleniyor. Örnek: 'let f = _.Length'. + + An empty body may only be used if the computation expression builder defines a 'Zero' method. + An empty body may only be used if the computation expression builder defines a 'Zero' method. + + The syntax 'expr1[expr2]' is used for indexing. Consider adding a type annotation to enable indexing, or if calling a function add a space, e.g. 'expr1 [expr2]'. Söz dizimi “expr1[expr2]” dizin oluşturma için kullanılıyor. Dizin oluşturmayı etkinleştirmek için bir tür ek açıklama eklemeyi düşünün veya bir işlev çağırıyorsanız bir boşluk ekleyin, örn. “expr1 [expr2]”. @@ -1279,7 +1364,7 @@ This expression uses the implicit conversion '{0}' to convert type '{1}' to type '{2}'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn \"3391\". - Bu ifade '{1}' türünü '{2}' türüne dönüştürmek için '{0}' örtük dönüştürmesini kullanır. https://aka.ms/fsharp-implicit-convs adresine bakın. Bu uyarı '#nowarn \"3391\" kullanılarak devre dışı bırakılabilir. + Bu ifade '{1}' türünü '{2}' türüne dönüştürmek için '{0}' örtük dönüştürmesini kullanır. https://aka.ms/fsharp-implicit-convs adresine bakın. Bu uyarı '#nowarn \"3391\" kullanılarak devre dışı bırakılabilir. @@ -1363,7 +1448,7 @@ - The following required properties have to be initalized:{0} + The following required properties have to be initialized:{0} Aşağıdaki gerekli özelliklerin başlatılması gerekiyor:{0} @@ -1412,6 +1497,16 @@ “{0}” değeri bir işlev değildir ve dizin gösterimini desteklemez. + + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + + + + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + + The syntax 'expr1[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use 'expr1.[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction expr1 [expr2]'. Söz dizimi “expr1[expr2]” artık dizin oluşturma için ayrılmıştır ve bağımsız değişken olarak kullanıldığında belirsizdir. https://aka.ms/fsharp-index-notation'a bakın. Dizin oluşturmayı veya dilimlemeyi düşünüyorsanız, bağımsız değişken konumunda “expr1.[expr2]” kullanmalısınız. Birden çok curry bağımsız değişkenli bir işlev çağırıyorsanız, aralarına bir boşluk ekleyin, örn. “someFunction expr1 [expr2]”. @@ -1437,6 +1532,41 @@ Söz dizimi “(expr1)[expr2]” artık dizin oluşturma için ayrılmıştır ve bağımsız değişken olarak kullanıldığında belirsizdir. https://aka.ms/fsharp-index-notation'a bakın. Birden çok curry bağımsız değişkenli bir işlev çağırıyorsanız, aralarına bir boşluk ekleyin, örn. “someFunction (expr1) [expr2]”. + + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + + + + Value known to be without null passed to a function meant for nullables: {0} + Value known to be without null passed to a function meant for nullables: {0} + + + + You can remove this |Null|NonNull| pattern usage. + You can remove this |Null|NonNull| pattern usage. + + + + You can remove this |NonNullQuick| pattern usage. + You can remove this |NonNullQuick| pattern usage. + + + + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + + + + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + + + + You can remove this `nonNull` assertion. + You can remove this `nonNull` assertion. + + The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a '{0}' method or appropriate 'MergeSources' and 'Bind' methods 'let! ... and! ...' yapısı, yalnızca hesaplama ifadesi oluşturucu bir '{0}' metodunu ya da uygun 'MergeSources' ve 'Bind' metotlarını tanımlarsa kullanılabilir @@ -1453,7 +1583,7 @@ - Invalid resumable code. A 'let rec' occured in the resumable code specification + Invalid resumable code. A 'let rec' occurred in the resumable code specification Geçersiz sürdürülebilir kod. Sürdürülebilir kod belirtiminde bir 'let rec' oluştu @@ -1522,6 +1652,11 @@ Bir nitelik optional, in, out, ParamArray, CallerInfo veya Quote bağımsız değişkenlerini belirtemiyor + + The type '{0}' does not support a nullness qualification. + The type '{0}' does not support a nullness qualification. + + Invalid interpolated string. {0} Geçersiz düz metin arasına kod eklenmiş dize. {0} @@ -1534,12 +1669,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' normalde genel kodda tür kısıtlaması olarak kullanılır, ör. \"'T when ISomeInterface<'T>\" veya \"let f (x: #ISomeInterface<_>)\". Rehber için bkz. https://aka.ms/fsharp-iwsams. '#nowarn \"3536\"' veya '--nowarn:3536' kullanarak bu uyarıyı devre dışı bırakabilirsiniz. + '{0}' normalde genel kodda tür kısıtlaması olarak kullanılır, ör. \"'T when ISomeInterface<'T>\" veya \"let f (x: #ISomeInterface<_>)\". Rehber için bkz. https://aka.ms/fsharp-iwsams. '#nowarn \"3536\"' veya '--nowarn:3536' kullanarak bu uyarıyı devre dışı bırakabilirsiniz. Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - \"interfaces with static abstract methods\" bildirimi gelişmiş bir özelliktir. Rehber için bkz. https://aka.ms/fsharp-iwsams. '#nowarn \"3535\"' veya '--nowarn:3535'. kullanarak bu uyarıyı devre dışı bırakabilirsiniz. + \"interfaces with static abstract methods\" bildirimi gelişmiş bir özelliktir. Rehber için bkz. https://aka.ms/fsharp-iwsams. '#nowarn \"3535\"' veya '--nowarn:3535'. kullanarak bu uyarıyı devre dışı bırakabilirsiniz. @@ -1564,7 +1699,7 @@ A type has been implicitly inferred as 'obj', which may be unintended. Consider adding explicit type annotations. You can disable this warning by using '#nowarn \"3559\"' or '--nowarn:3559'. - Tür örtük bir şekilde 'obj' olarak çıkarsandı. Bu, beklenmeyen bir durum olabilir. Açık tür ek açıklamaları eklemeyi deneyin. '#nowarn \"3559\"' veya '--nowarn:3559' kullanarak bu uyarıyı devre dışı bırakabilirsiniz. + Tür örtük bir şekilde 'obj' olarak çıkarsandı. Bu, beklenmeyen bir durum olabilir. Açık tür ek açıklamaları eklemeyi deneyin. '#nowarn \"3559\"' veya '--nowarn:3559' kullanarak bu uyarıyı devre dışı bırakabilirsiniz. @@ -1899,7 +2034,7 @@ Invalid directive. Expected '#time', '#time \"on\"' or '#time \"off\"'. - Geçersiz yönerge. Beklenen: '#time', '#time \"on\"' veya '#time \"off\"'. + Geçersiz yönerge. Beklenen: '#time', '#time \"on\"' veya '#time \"off\"'. @@ -4823,8 +4958,8 @@ - This is not a valid name for an active pattern - Etkin desen için bu geçerli bir ad değil + '{0}' is not a valid method name. Use a 'let' binding instead. + '{0}' is not a valid method name. Use a 'let' binding instead. @@ -5768,7 +5903,7 @@ - Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debuggging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). + Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debugging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). Hata ayıklama türünü belirtin: full, portable, embedded, pdbonly. (Hata ayıklama türü belirtilmemişse '{0}' varsayılandır ve çalışan bir programa hata ayıklayıcı iliştirmeyi etkinleştirir. 'portable' bir çoklu platform biçimidir, 'embedded' çıkış dosyasına gömülü bir çoklu platform biçimidir). @@ -6388,8 +6523,8 @@ - This byte array literal contains characters that do not encode as a single byte - Bu bayt dizisi sabit değeri tek bayt olarak kodlanmayan karakterler içeriyor + This byte array literal contains {0} characters that do not encode as a single byte + This byte array literal contains {0} characters that do not encode as a single byte @@ -6472,11 +6607,6 @@ Bu, geçerli bir sayısal değişmez değer değil. Geçerli sayısal değişmez değerler şunları içerir: 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint). - - This is not a valid byte literal - Bu geçerli bir bayt sabit değeri değil - - This is not a valid character literal Bu geçerli bir karakter sabit değeri değil @@ -7028,7 +7158,7 @@ - The resident compilation service was not used because a problem occured in communicating with the server. + The resident compilation service was not used because a problem occurred in communicating with the server. Sunucuyla iletişimde bir sorun oluştuğu için yerleşik derleme hizmeti kullanılmadı. @@ -7228,7 +7358,7 @@ - An error occured applying the static arguments to a provided type + An error occurred applying the static arguments to a provided type Sağlanan türe statik bağımsız değişkenler uygulanırken bir hata oluştu @@ -7293,7 +7423,7 @@ - Assembly '{0}' hase TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name + Assembly '{0}' has TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name {0}' bütünleştirilmiş kodunun geçersiz '{1}' değerli TypeProviderAssembly özniteliği var. Bu değer geçerli bir bütünleştirilmiş kod adı olmalıdır @@ -7878,7 +8008,7 @@ - An error occured applying the static arguments to a provided method + An error occurred applying the static arguments to a provided method Sağlanan metoda statik bağımsız değişkenler uygulanırken bir sorun oluştu @@ -8007,7 +8137,7 @@ Çok durumlu bir birleşim türü bir yapıysa, tüm birleşim durumlarının adları benzersiz olmalıdır. Örneğin: 'type A = B of b: int | C of c: int'. - + The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute. {0}' parametresi için geçerli olan CallerMemberNameAttribute öğesinin hiçbir etkisi olmaz. CallerFilePathAttribute tarafından geçersiz kılındı. @@ -8323,8 +8453,8 @@ - Used to introduce a block of code that might generate an exception. Used together with with or finally. - Özel durum oluşturabilen bir kod bloğunu tanıtmak için kullanılır. with veya finally ile birlikte kullanılır. + Used to introduce a block of code that might generate an exception. Used together with 'with' or 'finally'. + Özel durum oluşturabilen bir kod bloğunu tanıtmak için kullanılır. with veya finally ile birlikte kullanılır. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index d707003f18f..54f6b088094 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -124,12 +124,12 @@ A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). - A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). + 应仅通过类型参数调用静态抽象非虚拟接口成员(例如: “T.{0}”)。 Classes cannot contain static abstract members. - Classes cannot contain static abstract members. + 类不能包含静态抽象成员。 @@ -192,6 +192,11 @@ 已知类型参数: {0} + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + Argument at index {0} doesn't match 索引 {0} 处的参数不匹配 @@ -202,6 +207,16 @@ 参数 "{0}" 不匹配 + + The type '{0}' supports 'null' but a non-null type is expected + The type '{0}' supports 'null' but a non-null type is expected + + + + The type '{0}' uses 'null' as a representation value but a non-null type is expected + The type '{0}' uses 'null' as a representation value but a non-null type is expected + + The constraints 'unmanaged' and 'not struct' are inconsistent 约束 "unmanaged" 和 "not struct" 不一致 @@ -227,6 +242,11 @@ 程序集属性“{0}”引用了无法加载或不存在的设计器程序集“{1}”。报告的异常是: {2} - {3} + + {0} for F# {1} + {0} for F# {1} + + underscore dot shorthand for accessor only function 用于仅存取器函数的下划线点速记 @@ -237,6 +257,16 @@ 附加类型定向转换 + + Allow access modifiers to auto properties getters and setters + Allow access modifiers to auto properties getters and setters + + + + Allow object expressions without overrides + Allow object expressions without overrides + + applicative computation expressions 适用的计算表达式 @@ -277,6 +307,11 @@ 如果在非递归函数上使用“TailCall”属性,则引发警告。 + + The interaction between #nowarn and #line is now consistent. + The interaction between #nowarn and #line is now consistent. + + Constraint intersection on flexible types 灵活类型的约束交集 @@ -302,6 +337,11 @@ 无点 float32 文本 + + Support for computation expressions with empty bodies: builder {{ }} + Support for computation expressions with empty bodies: builder {{ }} + + Enforce AttributeTargets 强制使用 AttributeTargets @@ -397,9 +437,9 @@ 将整型范围 (..) 和范围步骤 (.. ..) 运算符的某些用途优化为快速 while 循环。 - - Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to calls to List.map and Array.map when xs is a list or an array, respectively. - 当 xs 是列表或数组时,将 [for x in xs -> f x] 和 [|for x in xs -> f x|] 分别降级为对 List.map 和 Array.map 的调用。 + + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. @@ -442,6 +482,11 @@ 可以为 null 的可选互操作 + + nullness checking + nullness checking + + open type declaration 开放类型声明 @@ -459,17 +504,17 @@ # directives with non-quoted string arguments - # directives with non-quoted string arguments + # 指令的字符串参数不带引号 Unexpected identifier '{0}'. - Unexpected identifier '{0}'. + 意外的标识符:“{0}”。 Unexpected integer literal '{0}'. - Unexpected integer literal '{0}'. + 意外的整数文本“{0}”。 @@ -498,7 +543,7 @@ - whitespace relexation + whitespace relaxation 空格松弛法 @@ -702,6 +747,11 @@ 在计算表达式中用于引入循环构造,其中条件是另一个计算表达式的结果。 + + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + + a byte string may not be interpolated 不能内插字节字符串 @@ -717,11 +767,26 @@ 不再支持 IF-FSHARP/IF-CAML 区域 + + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + + + + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + + This is not a valid identifier 这不是有效的标识符 + + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + + A '}}' character must be escaped (by doubling) in an interpolated string. 在内插字符串中,必需对 "}}" 字符进行转义(通过加倍)。 @@ -827,6 +892,11 @@ 将所有编译文件的推断接口打印到关联的签名文件 + + Enable nullness declarations and checks + Enable nullness declarations and checks + + Clear the package manager results cache 清除包管理器结果缓存 @@ -972,21 +1042,26 @@ 应为表达式 - - Expecting record field - 应为记录字段 - - Expecting pattern 预期模式 + + Expecting record field + Expecting record field + + Expecting type 预期类型 + + Expecting union case field + Expecting union case field + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) 字符文本不完整(示例: "Q")或限定类型调用(示例: "T.Name") @@ -1053,7 +1128,7 @@ - A constrained generic construct occured in the resumable code specification + A constrained generic construct occurred in the resumable code specification 可恢复代码规范中发生受约束的泛型构造 @@ -1068,7 +1143,7 @@ - A 'let rec' occured in the resumable code specification + A 'let rec' occurred in the resumable code specification 可恢复代码规范中出现 "let rec" @@ -1137,24 +1212,29 @@ (建议名称) + + Access modifiers cannot be applied to an SRTP constraint. + Access modifiers cannot be applied to an SRTP constraint. + + This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. - This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. + 此活动模式需要 {0} 个表达式参数,例如“{1}{2}”。 This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. - This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. + 此活动模式需要 {0} 个表达式参数和一个模式参数,例如 “{1}{2} pat”。 This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. - This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. + 此活动模式不需要任何参数,即它应像“{0}”而不是 “{1}x” 一样使用。 This active pattern expects exactly one pattern argument, e.g., '{0} pat'. - This active pattern expects exactly one pattern argument, e.g., '{0} pat'. + 此活动模式只需要一个模式参数,例如 “{0} pat”。 @@ -1247,6 +1327,11 @@ 仅原子表达式支持速记 lambda 语法,例如隐含的“_”参数上的方法、属性、字段或索引器。例如:“let f = _.Length”。 + + An empty body may only be used if the computation expression builder defines a 'Zero' method. + An empty body may only be used if the computation expression builder defines a 'Zero' method. + + The syntax 'expr1[expr2]' is used for indexing. Consider adding a type annotation to enable indexing, or if calling a function add a space, e.g. 'expr1 [expr2]'. 语法“expr1[expr2]”用于索引。考虑添加类型批注来启用索引,或者在调用函数添加空格,例如“expr1 [expr2]”。 @@ -1279,7 +1364,7 @@ This expression uses the implicit conversion '{0}' to convert type '{1}' to type '{2}'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn \"3391\". - 此表达式使用隐式转换“{0}”将类型“{1}”转换为类型“{2}”。请参阅 https://aka.ms/fsharp-implicit-convs。可使用 '#nowarn \"3391\" 禁用此警告。 + 此表达式使用隐式转换“{0}”将类型“{1}”转换为类型“{2}”。请参阅 https://aka.ms/fsharp-implicit-convs。可使用 '#nowarn \"3391\" 禁用此警告。 @@ -1363,7 +1448,7 @@ - The following required properties have to be initalized:{0} + The following required properties have to be initialized:{0} 必须初始化以下必需属性: {0} @@ -1412,6 +1497,16 @@ 值 '{0}' 不是函数,不支持索引表示法。 + + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + + + + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + + The syntax 'expr1[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use 'expr1.[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction expr1 [expr2]'. 语法“expr1[expr2]”用作参数时不明确。请参阅 https://aka.ms/fsharp-index-notation。如果要索引或切片,则必须在参数位置使用“expr1.[expr2]”。如果使用多个扩充参数调用函数,请在它们之间添加空格,例如“someFunction expr1 [expr2]”。 @@ -1437,6 +1532,41 @@ 语法“(expr1)[expr2]”现在保留用于索引,用作参数时不明确。请参见 https://aka.ms/fsharp-index-notation。如果使用多个扩充参数调用函数, 请在它们之间添加空格,例如“someFunction (expr1) [expr2]”。 + + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + + + + Value known to be without null passed to a function meant for nullables: {0} + Value known to be without null passed to a function meant for nullables: {0} + + + + You can remove this |Null|NonNull| pattern usage. + You can remove this |Null|NonNull| pattern usage. + + + + You can remove this |NonNullQuick| pattern usage. + You can remove this |NonNullQuick| pattern usage. + + + + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + + + + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + + + + You can remove this `nonNull` assertion. + You can remove this `nonNull` assertion. + + The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a '{0}' method or appropriate 'MergeSources' and 'Bind' methods 仅当计算表达式生成器定义了 "{0}" 方法或适当的 "MergeSources" 和 "Bind" 方法时,才可以使用 "let! ... and! ..." 构造 @@ -1453,7 +1583,7 @@ - Invalid resumable code. A 'let rec' occured in the resumable code specification + Invalid resumable code. A 'let rec' occurred in the resumable code specification 可恢复代码无效。可恢复代码规范中出现 "let rec" @@ -1522,6 +1652,11 @@ 特征不能指定 option、in、out、ParamArray、CallerInfo 或 Quote 参数 + + The type '{0}' does not support a nullness qualification. + The type '{0}' does not support a nullness qualification. + + Invalid interpolated string. {0} 内插字符串无效。{0} @@ -1534,12 +1669,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - "{0}" 通常用作泛型代码中的类型约束,例如 \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\"。有关指南,请参阅 https://aka.ms/fsharp-iwsams。可以使用 '#nowarn \"3536\"' 或 '--nowarn:3536' 禁用此警告。 + "{0}" 通常用作泛型代码中的类型约束,例如 \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\"。有关指南,请参阅 https://aka.ms/fsharp-iwsams。可以使用 '#nowarn \"3536\"' 或 '--nowarn:3536' 禁用此警告。 Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - 声明“使用静态抽象方法的接口”是一项高级功能。有关指南,请参阅 https://aka.ms/fsharp-iwsams。可以使用 "#nowarn \"3535\"' 或 '--nowarn:3535' 禁用此警告。 + 声明“使用静态抽象方法的接口”是一项高级功能。有关指南,请参阅 https://aka.ms/fsharp-iwsams。可以使用 "#nowarn \"3535\"' 或 '--nowarn:3535' 禁用此警告。 @@ -1564,7 +1699,7 @@ A type has been implicitly inferred as 'obj', which may be unintended. Consider adding explicit type annotations. You can disable this warning by using '#nowarn \"3559\"' or '--nowarn:3559'. - 类型已被隐式推断为 "obj",这可能是意外的。请考虑添加显式类型注释。可以使用"#nowarn\"3559\" 或 "--nowarn:3559" 禁用此警告。 + 类型已被隐式推断为 "obj",这可能是意外的。请考虑添加显式类型注释。可以使用"#nowarn\"3559\" 或 "--nowarn:3559" 禁用此警告。 @@ -1899,7 +2034,7 @@ Invalid directive. Expected '#time', '#time \"on\"' or '#time \"off\"'. - 指令无效。应为 '#time'、'#time \"on\"' 或 '#time \"off\"'。 + 指令无效。应为 '#time'、'#time \"on\"' 或 '#time \"off\"'。 @@ -4823,8 +4958,8 @@ - This is not a valid name for an active pattern - 对于活动模式来说,这不是有效的名称 + '{0}' is not a valid method name. Use a 'let' binding instead. + '{0}' is not a valid method name. Use a 'let' binding instead. @@ -5768,7 +5903,7 @@ - Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debuggging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). + Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debugging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). 指定调试类型: full、portable、embedded、pdbonly。(若未指定调试类型,则默认为“{0}”,它允许将调试程序附加到正在运行的程序。"portable" 是跨平台格式,"embedded" 是嵌入到输出文件中的跨平台格式)。 @@ -6388,8 +6523,8 @@ - This byte array literal contains characters that do not encode as a single byte - 此字节数组文本包含不会以单字节形式进行编码的字符 + This byte array literal contains {0} characters that do not encode as a single byte + This byte array literal contains {0} characters that do not encode as a single byte @@ -6472,11 +6607,6 @@ 这不是有效的数值文本。有效数值包括 1、0x1、0o1、0b1、1l (int/int32)、1u (uint/uint32)、1L (int64)、1UL (uint64)、1s (int16)、1us (uint16)、1y (int8/sbyte)、1uy (uint8/byte)、1.0 (float/double)、1.0f (float32/single)、1.0m (decimal)、1I (bigint)。 - - This is not a valid byte literal - 这不是有效的字节文本 - - This is not a valid character literal 这不是有效的字符文本 @@ -7028,7 +7158,7 @@ - The resident compilation service was not used because a problem occured in communicating with the server. + The resident compilation service was not used because a problem occurred in communicating with the server. 未使用驻留编译服务,因为与服务器通信时发生问题。 @@ -7228,7 +7358,7 @@ - An error occured applying the static arguments to a provided type + An error occurred applying the static arguments to a provided type 将静态参数应用于所提供类型时发生错误 @@ -7293,7 +7423,7 @@ - Assembly '{0}' hase TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name + Assembly '{0}' has TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name 程序集“{0}”的 TypeProviderAssembly 特性具有无效值“{1}”。该值应为有效的程序集名称 @@ -7878,7 +8008,7 @@ - An error occured applying the static arguments to a provided method + An error occurred applying the static arguments to a provided method 将静态参数应用于提供的方法时发生错误 @@ -8007,7 +8137,7 @@ 如果多事例联合类型是结构,则所有联合事例都必须具有唯一的名称。例如: “type A = B of b: int | C of c: int”。 - + The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute. 应用于参数“{0}”的 CallerMemberNameAttribute 不会起作用。它已由 CallerFilePathAttribute 替代。 @@ -8323,8 +8453,8 @@ - Used to introduce a block of code that might generate an exception. Used together with with or finally. - 用于引入可能产生异常的代码块。与 with 或 finally 配合使用。 + Used to introduce a block of code that might generate an exception. Used together with 'with' or 'finally'. + 用于引入可能产生异常的代码块。与 with 或 finally 配合使用。 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 5cc67b951b6..df3a706ae28 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -124,12 +124,12 @@ A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). - A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.{0}). + 靜態抽象非虛擬介面成員只能透過型別參數 (呼叫,例如 'T.{0})。 Classes cannot contain static abstract members. - Classes cannot contain static abstract members. + 類別不能包含靜態抽象成員。 @@ -192,6 +192,11 @@ 已知的型別參數: {0} + + The constraints 'null' and 'not null' are inconsistent + The constraints 'null' and 'not null' are inconsistent + + Argument at index {0} doesn't match 位於索引 {0} 的引數不相符 @@ -202,6 +207,16 @@ 引數 '{0}' 不相符 + + The type '{0}' supports 'null' but a non-null type is expected + The type '{0}' supports 'null' but a non-null type is expected + + + + The type '{0}' uses 'null' as a representation value but a non-null type is expected + The type '{0}' uses 'null' as a representation value but a non-null type is expected + + The constraints 'unmanaged' and 'not struct' are inconsistent 條件約束 'unmanaged' 與 'not struct' 不一致 @@ -227,6 +242,11 @@ 無法載入組件屬性 '{0}' 參考的設計工具組件 '{1}' 或其不存在。回報的例外狀況: {2} - {3} + + {0} for F# {1} + {0} for F# {1} + + underscore dot shorthand for accessor only function 僅存取子函式的底線點速記 @@ -237,6 +257,16 @@ 其他類型導向轉換 + + Allow access modifiers to auto properties getters and setters + Allow access modifiers to auto properties getters and setters + + + + Allow object expressions without overrides + Allow object expressions without overrides + + applicative computation expressions 適用的計算運算式 @@ -277,6 +307,11 @@ 如果 'TailCall' 屬性用於非遞迴函數,則引發警告。 + + The interaction between #nowarn and #line is now consistent. + The interaction between #nowarn and #line is now consistent. + + Constraint intersection on flexible types 彈性類型上的條件約束交集 @@ -302,6 +337,11 @@ 無點號的 float32 常值 + + Support for computation expressions with empty bodies: builder {{ }} + Support for computation expressions with empty bodies: builder {{ }} + + Enforce AttributeTargets 強制使用 AttributeTargets @@ -397,9 +437,9 @@ 最佳化整數範圍 (..) 和 range 步驟 (.. ..) 運算子的特定用法,以加快 while 迴圈。 - - Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to calls to List.map and Array.map when xs is a list or an array, respectively. - 當 xs 是清單或陣列時,分別將 [for x in xs -> f x] 和 [|for x in xs -> f x|] 降低至 List.map 和 Array.map 的呼叫。 + + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. + Lowers [for x in xs -> f x] and [|for x in xs -> f x|] to fast loops when xs is a list or an array, respectively. @@ -442,6 +482,11 @@ 可為 Null 的選擇性 Interop + + nullness checking + nullness checking + + open type declaration 開放式類型宣告 @@ -459,17 +504,17 @@ # directives with non-quoted string arguments - # directives with non-quoted string arguments + # 個具有非引號字串引數的指示詞 Unexpected identifier '{0}'. - Unexpected identifier '{0}'. + 未預期的識別碼 '{0}'。 Unexpected integer literal '{0}'. - Unexpected integer literal '{0}'. + 未預期的整數常值 '{0}'。 @@ -498,7 +543,7 @@ - whitespace relexation + whitespace relaxation 空白字元放寬 @@ -702,6 +747,11 @@ 用於計算運算式中,以引進迴圈建構,其中條件是另一個計算運算式的結果。 + + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + This byte array literal contains {0} non-ASCII characters. All characters should be < 128y. + + a byte string may not be interpolated 位元組字串不能是插補字串 @@ -717,11 +767,26 @@ 不再支援 IF-FSHARP/IF-CAML 區域 + + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + This is not a valid byte character literal. The value must be less than or equal to '\127'B. + + + + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + '{0}' is not a valid character literal.\nNote: Currently the value is wrapped around byte range to '{1}'. In a future F# version this warning will be promoted to an error. + + This is not a valid identifier 這不是有效的識別項 + + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + This is not a valid byte character literal. The value must be less than or equal to '\127'B.\nNote: In a future F# version this warning will be promoted to an error. + + A '}}' character must be escaped (by doubling) in an interpolated string. 在插補字串中,必須將 '}}' 字元逸出 (重複一次)。 @@ -827,6 +892,11 @@ 將所有編譯檔案的推斷介面列印至相關聯的簽章檔案 + + Enable nullness declarations and checks + Enable nullness declarations and checks + + Clear the package manager results cache 清除封裝管理員結果快取 @@ -972,21 +1042,26 @@ 必須是運算式 - - Expecting record field - 必須是記錄欄位 - - Expecting pattern 必須是模式 + + Expecting record field + Expecting record field + + Expecting type 必須是類型 + + Expecting union case field + Expecting union case field + + Incomplete character literal (example: 'Q') or qualified type invocation (example: 'T.Name) 不完整的字元文字 (範例: 'Q') 或限定類型調用 (範例: 'T.Name) @@ -1053,7 +1128,7 @@ - A constrained generic construct occured in the resumable code specification + A constrained generic construct occurred in the resumable code specification 可繼續的程式碼規格中出現了限制式泛型建構 @@ -1068,7 +1143,7 @@ - A 'let rec' occured in the resumable code specification + A 'let rec' occurred in the resumable code specification 可繼續的程式碼規格中發生 'let rec' @@ -1137,24 +1212,29 @@ (建議的名稱) + + Access modifiers cannot be applied to an SRTP constraint. + Access modifiers cannot be applied to an SRTP constraint. + + This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. - This active pattern expects {0} expression argument(s), e.g., '{1}{2}'. + 此現用模式需要 {0} 運算式引數,例如 '{1}{2}'。 This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. - This active pattern expects {0} expression argument(s) and a pattern argument, e.g., '{1}{2} pat'. + 此現用模式需要 {0} 運算式引數和模式引數,例如 '{1}{2} pat'。 This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. - This active pattern does not expect any arguments, i.e., it should be used like '{0}' instead of '{1} x'. + 這個現用模式並不需要任何引數,例如,應該使用像是 '{0}' 而不是 '{1} x'。 This active pattern expects exactly one pattern argument, e.g., '{0} pat'. - This active pattern expects exactly one pattern argument, e.g., '{0} pat'. + 此現用模式需要剛好一個模式引數,例如 '{0} pat'。 @@ -1247,6 +1327,11 @@ 只有不可部分完成運算式才支援速記 Lambda 語法,例如隱含 '_' 引數上的方法、屬性、欄位或索引子。例如: 'let f = _.Length'。 + + An empty body may only be used if the computation expression builder defines a 'Zero' method. + An empty body may only be used if the computation expression builder defines a 'Zero' method. + + The syntax 'expr1[expr2]' is used for indexing. Consider adding a type annotation to enable indexing, or if calling a function add a space, e.g. 'expr1 [expr2]'. 語法 'expr1[expr2]' 已用於編製索引。請考慮新增類型註釋來啟用編製索引,或是呼叫函式並新增空格,例如 'expr1 [expr2]'。 @@ -1279,7 +1364,7 @@ This expression uses the implicit conversion '{0}' to convert type '{1}' to type '{2}'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn \"3391\". - 此運算式使用隱含轉換 '{0}' 將類型 '{1}' 轉換為類型 '{2}'。請參閱 https://aka.ms/fsharp-implicit-convs。可使用 '#nowarn \"3391\" 停用此警告。 + 此運算式使用隱含轉換 '{0}' 將類型 '{1}' 轉換為類型 '{2}'。請參閱 https://aka.ms/fsharp-implicit-convs。可使用 '#nowarn \"3391\" 停用此警告。 @@ -1363,7 +1448,7 @@ - The following required properties have to be initalized:{0} + The following required properties have to be initialized:{0} 下列必要的屬性必須初始化:{0} @@ -1412,6 +1497,16 @@ 值 '{0}' 並非函式,不支援索引標記法。 + + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function. + + + + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored. + + The syntax 'expr1[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use 'expr1.[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction expr1 [expr2]'. 語法 'expr1[expr2]' 用作引數時不明確。請參閱 https://aka.ms/fsharp-index-notation。如果您要編製索引或切割,則必須在引數位置使用 'expr1.[expr2]'。如果要呼叫具有多個調用引數的函式,請在它們之間新增空格,例如 'someFunction expr1 [expr2]'。 @@ -1437,6 +1532,41 @@ 語法 '(expr1)[expr2]' 現已為編製索引保留,但用作引數時不明確。請參閱 https://aka.ms/fsharp-index-notation。如果要呼叫具有多個調用引數的函式,請在它們之間新增空格,例如 'someFunction (expr1) [expr2]'。 + + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern. + + + + Value known to be without null passed to a function meant for nullables: {0} + Value known to be without null passed to a function meant for nullables: {0} + + + + You can remove this |Null|NonNull| pattern usage. + You can remove this |Null|NonNull| pattern usage. + + + + You can remove this |NonNullQuick| pattern usage. + You can remove this |NonNullQuick| pattern usage. + + + + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value. + + + + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value. + + + + You can remove this `nonNull` assertion. + You can remove this `nonNull` assertion. + + The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a '{0}' method or appropriate 'MergeSources' and 'Bind' methods 只有在計算運算式產生器定義 '{0}' 方法或正確的 'MergeSource' 和 'Bind' 方法時,才可使用 'let! ... and! ...' 建構 @@ -1453,7 +1583,7 @@ - Invalid resumable code. A 'let rec' occured in the resumable code specification + Invalid resumable code. A 'let rec' occurred in the resumable code specification 可繼續的程式碼無效。可繼續的程式碼規格中發生 'let rec' @@ -1522,6 +1652,11 @@ 特徵不能指定選擇性、in、out、ParamArray、CallerInfo 或 Quote 引數 + + The type '{0}' does not support a nullness qualification. + The type '{0}' does not support a nullness qualification. + + Invalid interpolated string. {0} 插補字串無效。{0} @@ -1534,12 +1669,12 @@ '{0}' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'. - '{0}' 通常做為一般程式碼中的類型限制式,例如 \"'T when ISomeInterface<'T>\" 或 \"let f (x: #ISomeInterface<_>)\"。請參閱 https://aka.ms/fsharp-iwsams 以尋求指引。您可以使用 '#nowarn \"3536\"' 或 '--nowarn:3536' 來停用此警告。 + '{0}' 通常做為一般程式碼中的類型限制式,例如 \"'T when ISomeInterface<'T>\" 或 \"let f (x: #ISomeInterface<_>)\"。請參閱 https://aka.ms/fsharp-iwsams 以尋求指引。您可以使用 '#nowarn \"3536\"' 或 '--nowarn:3536' 來停用此警告。 Declaring \"interfaces with static abstract methods\" is an advanced feature. See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3535\"' or '--nowarn:3535'. - 使用「靜態抽象方法宣告介面」是進階的功能。請參閱 https://aka.ms/fsharp-iwsams 以尋求指引。您可以使用 '#nowarn \"3535\"' 或 '--nowarn:3535' 來停用此警告。 + 使用「靜態抽象方法宣告介面」是進階的功能。請參閱 https://aka.ms/fsharp-iwsams 以尋求指引。您可以使用 '#nowarn \"3535\"' 或 '--nowarn:3535' 來停用此警告。 @@ -1564,7 +1699,7 @@ A type has been implicitly inferred as 'obj', which may be unintended. Consider adding explicit type annotations. You can disable this warning by using '#nowarn \"3559\"' or '--nowarn:3559'. - 類型已隱含推斷為 'obj',這可能是意外的。請考慮新增明確類型註釋。您可以使用 '#nowarn \"3559\" 或 '--nowarn:3559' 停用此警告。 + 類型已隱含推斷為 'obj',這可能是意外的。請考慮新增明確類型註釋。您可以使用 '#nowarn \"3559\" 或 '--nowarn:3559' 停用此警告。 @@ -1899,7 +2034,7 @@ Invalid directive. Expected '#time', '#time \"on\"' or '#time \"off\"'. - 無效的指示詞。必須是 '#time'、'#time \"on\"' 或 '#time \"off\"'。 + 無效的指示詞。必須是 '#time'、'#time \"on\"' 或 '#time \"off\"'。 @@ -4823,8 +4958,8 @@ - This is not a valid name for an active pattern - 這不是現用模式的有效名稱 + '{0}' is not a valid method name. Use a 'let' binding instead. + '{0}' is not a valid method name. Use a 'let' binding instead. @@ -5768,7 +5903,7 @@ - Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debuggging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). + Specify debugging type: full, portable, embedded, pdbonly. ('{0}' is the default if no debugging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). 指定偵錯類型: full、portable、embedded、pdbonly。(如果未指定偵錯類型,即預設為 '{0}',並允許將偵錯工具附加到正在執行的程式,'portable' 為跨平台格式,'embedded' 為輸出檔案內嵌的跨平台格式)。 @@ -6388,8 +6523,8 @@ - This byte array literal contains characters that do not encode as a single byte - 這個位元組陣列常值包含不會編碼成單一位元組的字元 + This byte array literal contains {0} characters that do not encode as a single byte + This byte array literal contains {0} characters that do not encode as a single byte @@ -6472,11 +6607,6 @@ 這不是有效的數值常值。有效的數值常值包括 1, 0x1、0o1、0b1、1l (int/int32)、1u (uint/uint32)、1L (int64)、1UL (uint64)、1s (int16)、1us (uint16)、1y (int8/sbyte)、1uy (uint8/byte)、1.0 (float/double)、1.0f (float32/single)、1.0m (decimal)、1I (bigint)。 - - This is not a valid byte literal - 這不是有效的位元組常值 - - This is not a valid character literal 這不是有效的字元常值 @@ -7028,7 +7158,7 @@ - The resident compilation service was not used because a problem occured in communicating with the server. + The resident compilation service was not used because a problem occurred in communicating with the server. 未使用常駐編譯服務,因為伺服器發生通訊問題。 @@ -7228,7 +7358,7 @@ - An error occured applying the static arguments to a provided type + An error occurred applying the static arguments to a provided type 將靜態引數套用至提供的類型時發生錯誤 @@ -7293,7 +7423,7 @@ - Assembly '{0}' hase TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name + Assembly '{0}' has TypeProviderAssembly attribute with invalid value '{1}'. The value should be a valid assembly name 組件 '{0}' 的 TypeProviderAssembly 屬性值 '{1}' 無效。此值必須是有效的屬性名稱 @@ -7878,7 +8008,7 @@ - An error occured applying the static arguments to a provided method + An error occurred applying the static arguments to a provided method 將靜態引數套用至所提供的方法時,發生錯誤 @@ -8007,7 +8137,7 @@ 如果多案例聯集類型是結構,則所有聯集案例都必須有唯一的名稱。例如: 'type A = B of b: int | C of c: int'。 - + The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute. 套用至參數 '{0}' 的 CallerMemberNameAttribute 將不會有作用。CallerFilePathAttribute 會加以覆寫。 @@ -8323,8 +8453,8 @@ - Used to introduce a block of code that might generate an exception. Used together with with or finally. - 用於引入可能會產生例外狀況的程式碼區塊。這會與 with 或 finally 並用。 + Used to introduce a block of code that might generate an exception. Used together with 'with' or 'finally'. + 用於引入可能會產生例外狀況的程式碼區塊。這會與 with 或 finally 並用。 diff --git a/src/Compiler/xlf/FSStrings.cs.xlf b/src/Compiler/xlf/FSStrings.cs.xlf index 083a6e2e12f..810091c59f0 100644 --- a/src/Compiler/xlf/FSStrings.cs.xlf +++ b/src/Compiler/xlf/FSStrings.cs.xlf @@ -12,6 +12,26 @@ Definice {0} pro typ {1} v signatuře a implementaci nejsou kompatibilní, protože se liší zkratky:\n {2}\noproti\n {3} + + Nullness warning: {0}. + Nullness warning: {0}. + + + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + + + + Nullness warning: The type '{0}' does not support 'null'. + Nullness warning: The type '{0}' does not support 'null'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n Neshoda typů Očekává se řazená kolekce členů o délce {0} typu\n {1} \nale odevzdala se řazená kolekce členů o délce {2} typu\n {3}{4}\n @@ -37,6 +57,11 @@ Očekává se statický člen. + + symbol '|' (directly before 'null') + symbol '|' (directly before 'null') + + symbol '..^' symbol ..^ @@ -178,7 +203,7 @@ - The {0} '{1}' can not be defined because the name '{2}' clashes with the {3} '{4}' in this type or module + The {0} '{1}' cannot be defined because the name '{2}' clashes with the {3} '{4}' in this type or module {0} {1} se nedá definovat, protože název {2} a {3} {4} v tomto typu nebo modulu jsou v konfliktu. @@ -249,7 +274,7 @@ Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. - Tento typ je abstract, protože se neimplementovali někteří abstraktní členové. Pokud je to záměr, pak k typu přidejte atribut [<AbstractClass>]. + Neabstraktní třídy nemohou obsahovat abstraktní členy. Poskytněte výchozí implementaci členů nebo přidejte k danému typu atribut [<AbstractClass>]. @@ -1379,7 +1404,7 @@ This recursive use will be checked for initialization-soundness at runtime. This warning is usually harmless, and may be suppressed by using '#nowarn "21"' or '--nowarn:21'. - U tohoto rekurzivního použití se bude kontrolovat stabilita inicializace za běhu. Toto upozornění je obvykle neškodné a pomocí #nowarn "21" nebo --nowarn:21 se dá potlačit. + U tohoto rekurzivního použití se bude kontrolovat stabilita inicializace za běhu. Toto upozornění je obvykle neškodné a pomocí #nowarn "21" nebo --nowarn:21 se dá potlačit. @@ -1404,7 +1429,7 @@ This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'. - U tohoto a dalších rekurzivních odkazů na definované objekty se bude kontrolovat stabilita inicializace za běhu pomocí zpožděného odkazování. Je to kvůli tomu, že definujete rekurzivní objekty místo rekurzivních funkcí. Toto upozornění se dá pomocí #nowarn "40" nebo --nowarn:40 potlačit. + U tohoto a dalších rekurzivních odkazů na definované objekty se bude kontrolovat stabilita inicializace za běhu pomocí zpožděného odkazování. Je to kvůli tomu, že definujete rekurzivní objekty místo rekurzivních funkcí. Toto upozornění se dá pomocí #nowarn "40" nebo --nowarn:40 potlačit. @@ -1524,12 +1549,12 @@ {0}. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. - {0}. Toto upozornění se dá pomocí --nowarn:57 nebo #nowarn "57" vypnout. + {0}. Toto upozornění se dá pomocí --nowarn:57 nebo #nowarn "57" vypnout. Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'. - Použití tohoto konstruktoru může způsobit vygenerování neověřitelného kódu .NET IL. Toto upozornění se dá pomocí --nowarn:9 nebo #nowarn "9" vypnout. + Použití tohoto konstruktoru může způsobit vygenerování neověřitelného kódu .NET IL. Toto upozornění se dá pomocí --nowarn:9 nebo #nowarn "9" vypnout. @@ -1574,7 +1599,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using '#nowarn "69"' if you have checked this is not the case. - Implementace rozhraní by obvykle měly být zadány pro počáteční deklaraci typu. Implementace rozhraní v rozšířeních mohou vést k přístupu ke statickým vazbám před jejich inicializací, ale pouze v případě, že je implementace rozhraní vyvolána během inicializace statických dat a následně umožní přístup ke statickým datům. Toto upozornění můžete odebrat pomocí #nowarn „69“, pokud jste ověřili, že tomu tak není. + Implementace rozhraní by se měly normálně provádět při počáteční deklaraci typu. Implementace rozhraní v postupných krocích mohou vést k přístupu ke statickým vazbám před jejich inicializací, ale pouze v případě, že je implementace rozhraní vyvolána během inicializace statických dat, a následně může dojít k přístupu ke statickým datům. Toto upozornění můžete odebrat pomocí #nowarn "69", pokud jste zkontrolovali, že tomu tak není. @@ -1594,12 +1619,12 @@ #I directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file, add a '-I' compiler option for this reference or delimit the directive with delimit it with '#if INTERACTIVE'/'#endif'. - Direktivy #I se můžou vyskytovat jenom v souborech skriptu F# (s příponou .fsx nebo .fsscript). Přesuňte tento kód do souboru skriptu nebo přidejte pro tento odkaz možnost kompilátoru -I anebo direktivu ohraničte pomocí notace #if INTERACTIVE/#endif. + Direktivy #I se můžou používat jenom v souborech skriptu F# (s příponou .fsx nebo .fsscript). Přesuňte tento kód do souboru skriptu nebo přidejte pro tento odkaz možnost kompilátoru -I anebo direktivu ohraničte pomocí notace #if INTERACTIVE/#endif. #r directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file or replace this reference with the '-r' compiler option. If this directive is being executed as user input, you may delimit it with '#if INTERACTIVE'/'#endif'. - Direktivy #r se můžou vyskytovat jenom v souborech skriptu F# (s příponou .fsx nebo .fsscript). Buď přesuňte tento kód do souboru skriptu, nebo nahraďte tento odkaz možností kompilátoru -r. Pokud se tato direktiva provádí jako uživatelský vstup, můžete ji ohraničit pomocí notace #if INTERACTIVE'/'#endif. + Direktivy #r se můžou vyskytovat jenom v souborech skriptu F# (s příponou .fsx nebo .fsscript). Buď tento kód přesuňte do souboru skriptu, nebo nahraďte tento odkaz možností kompilátoru -r. Pokud se tato direktiva spouští jako uživatelský vstup, můžete ji oddělit #if INTERACTIVE / #endif. diff --git a/src/Compiler/xlf/FSStrings.de.xlf b/src/Compiler/xlf/FSStrings.de.xlf index 742b4876bb8..12a7cc8d720 100644 --- a/src/Compiler/xlf/FSStrings.de.xlf +++ b/src/Compiler/xlf/FSStrings.de.xlf @@ -12,6 +12,26 @@ Die {0}-Definitionen für den Typ „{1}“ in der Signatur und in der Implementierung sind aufgrund unterschiedlicher Abkürzungen nicht kompatibel:\n {2}\nversus\n {3} + + Nullness warning: {0}. + Nullness warning: {0}. + + + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + + + + Nullness warning: The type '{0}' does not support 'null'. + Nullness warning: The type '{0}' does not support 'null'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n Typenkonflikt. Es wurde ein Tupel der Länge {0} des Typs\n {1} \nerwartet, aber ein Tupel der Länge {2} des Typs\n {3}{4}\n angegeben. @@ -37,6 +57,11 @@ Ein statischer Member wird erwartet. + + symbol '|' (directly before 'null') + symbol '|' (directly before 'null') + + symbol '..^' Symbol "..^" @@ -178,7 +203,7 @@ - The {0} '{1}' can not be defined because the name '{2}' clashes with the {3} '{4}' in this type or module + The {0} '{1}' cannot be defined because the name '{2}' clashes with the {3} '{4}' in this type or module {0} "{1}" kann nicht definiert werden, weil der Name "{2}" einen Konflikt mit {3} "{4}" in diesem Typ oder Modul verursacht. @@ -249,7 +274,7 @@ Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. - Der Typ entspricht „abstract“, da einige abstrakte Member nicht mit einer Implementierung versehen wurden. Wenn dies Ihre Absicht ist, fügen Sie das [<AbstractClass>]-Attribut zu Ihrem Typ hinzu. + Nicht abstrakte Klassen dürfen keine abstrakten Member enthalten. Stellen Sie entweder eine Standardmemberimplementierung bereit, oder fügen Sie Ihrem Typ das Attribut „[<AbstractClass>]“ hinzu. @@ -1379,7 +1404,7 @@ This recursive use will be checked for initialization-soundness at runtime. This warning is usually harmless, and may be suppressed by using '#nowarn "21"' or '--nowarn:21'. - Diese rekursive Verwendung wird zur Laufzeit auf ihre ordnungsgemäße Initialisierung geprüft. Diese Warnung ist in der Regel harmlos und kann mithilfe von "#nowarn "21"" oder "--nowarn 21" unterdrückt werden. + Diese rekursive Verwendung wird zur Laufzeit auf ihre ordnungsgemäße Initialisierung geprüft. Diese Warnung ist in der Regel harmlos und kann mithilfe von "#nowarn "21"" oder "--nowarn 21" unterdrückt werden. @@ -1404,7 +1429,7 @@ This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'. - Dieser und andere rekursive Verweise auf das bzw. die definierte(n) Objekt(e) werden zur Laufzeit mithilfe eines verzögerten Verweises auf ihre ordnungsgemäße Initialisierung geprüft. Der Grund hierfür ist, dass Sie mindestens ein rekursives Objekt definieren, keine rekursiven Funktionen. Diese Warnung kann mithilfe von "#nowarn "40"" oder "--nowarn 40" unterdrückt werden. + Dieser und andere rekursive Verweise auf das bzw. die definierte(n) Objekt(e) werden zur Laufzeit mithilfe eines verzögerten Verweises auf ihre ordnungsgemäße Initialisierung geprüft. Der Grund hierfür ist, dass Sie mindestens ein rekursives Objekt definieren, keine rekursiven Funktionen. Diese Warnung kann mithilfe von "#nowarn "40"" oder "--nowarn 40" unterdrückt werden. @@ -1524,12 +1549,12 @@ {0}. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. - {0}. Diese Warnung kann mit "--nowarn 57" oder "#nowarn "57"" deaktiviert werden. + {0}. Diese Warnung kann mit "--nowarn 57" oder "#nowarn "57"" deaktiviert werden. Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'. - Die Verwendung dieses Konstrukts kann die Erzeugung von nicht verifizierbarem .NET-IL-Code zur Folge haben. Diese Warnung kann mit "--nowarn 9" oder "#nowarn "9"" deaktiviert werden. + Die Verwendung dieses Konstrukts kann die Erzeugung von nicht verifizierbarem .NET-IL-Code zur Folge haben. Diese Warnung kann mit "--nowarn 9" oder "#nowarn "9"" deaktiviert werden. @@ -1574,7 +1599,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using '#nowarn "69"' if you have checked this is not the case. - Die Implementierung von Schnittstellen sollte normalerweise in der ersten Deklaration eines Typs angegeben werden. Schnittstellenimplementierungen in Augmentationen können dazu führen, dass vor der Initialisierung auf statische Bindungen zugegriffen wird. Die gilt allerdings nur, wenn die Schnittstellenimplementierung während der Initialisierung der statischen Daten aufgerufen wird, und wiederum auf die statischen Daten zugreift. Sie können diese Warnung mit #nowarn "69" entfernen, wenn Sie überprüft haben, dass dies nicht der Fall ist. + Schnittstellenimplementierungen sollten normalerweise in der ersten Deklaration eines Typs angegeben werden. Schnittstellenimplementierungen in Augmentationen können dazu führen, dass auf statische Bindungen zugegriffen wird, bevor sie initialisiert werden. Dies gilt jedoch nur, wenn die Schnittstellenimplementierung während der Initialisierung der statischen Daten aufgerufen wird und sie wiederum auf die statischen Daten zugreift. Sie können diese Warnung mithilfe von "#nowarn "69"" entfernen, wenn Sie überprüft haben, dass dies nicht der Fall ist. @@ -1594,12 +1619,12 @@ #I directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file, add a '-I' compiler option for this reference or delimit the directive with delimit it with '#if INTERACTIVE'/'#endif'. - #I-Direktiven dürfen nur in F#-Skriptdateien (Dateierweiterungen .fsx oder .fsscript) verwendet werden. Verschieben Sie entweder diesen Code in eine Skriptdatei, fügen Sie die Compileroption "-I" für diesen Verweis hinzu, oder trennen Sie die Direktive mit "#if INTERACTIVE"/"#endif" ab. + #I-Direktiven dürfen nur in F#-Skriptdateien (Dateierweiterungen .fsx oder .fsscript) verwendet werden. Verschieben Sie entweder diesen Code in eine Skriptdatei, fügen Sie die Compileroption "-I" für diesen Verweis hinzu, oder trennen Sie die Direktive mit "#if INTERACTIVE"/"#endif" ab. #r directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file or replace this reference with the '-r' compiler option. If this directive is being executed as user input, you may delimit it with '#if INTERACTIVE'/'#endif'. - #r-Anweisungen dürfen nur in F#-Skriptdateien (Dateierweiterungen .fsx oder .fsscript) verwendet werden. Verschieben Sie entweder diesen Code in eine Skriptdatei, oder ersetzen Sie diesen Verweis durch die Compileroption "-r". Wenn diese Anweisung als Benutzereingabe ausgeführt wird, trennen Sie sie mit "#if INTERACTIVE"/"#endif" ab. + #r-Direktiven dürfen nur in F#-Skriptdateien (Dateierweiterungen .fsx oder .fsscript) verwendet werden. Verschieben Sie entweder diesen Code in eine Skriptdatei, oder ersetzen Sie diesen Verweis durch die Compileroption "-r". Wenn diese Anweisung als Benutzereingabe ausgeführt wird, trennen Sie sie mit "#if INTERACTIVE"/"#endif" ab. diff --git a/src/Compiler/xlf/FSStrings.es.xlf b/src/Compiler/xlf/FSStrings.es.xlf index e1f17ab30dd..85b2e6b1cd4 100644 --- a/src/Compiler/xlf/FSStrings.es.xlf +++ b/src/Compiler/xlf/FSStrings.es.xlf @@ -12,6 +12,26 @@ Las definiciones de {0} para el tipo "{1}" de la firma y la implementación no son compatibles porque las abreviaciones difieren:\n {2}\nversus\n {3} + + Nullness warning: {0}. + Nullness warning: {0}. + + + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + + + + Nullness warning: The type '{0}' does not support 'null'. + Nullness warning: The type '{0}' does not support 'null'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n Error de coincidencia de tipos. Se espera una tupla de longitud {0} de tipo\n {1} \nperero se ha proporcionado una tupla de longitud {2} de tipo\n {3}{4}\n @@ -37,6 +57,11 @@ Se espera un miembro estático. + + symbol '|' (directly before 'null') + symbol '|' (directly before 'null') + + symbol '..^' símbolo "..^" @@ -178,7 +203,7 @@ - The {0} '{1}' can not be defined because the name '{2}' clashes with the {3} '{4}' in this type or module + The {0} '{1}' cannot be defined because the name '{2}' clashes with the {3} '{4}' in this type or module No se puede definir el {0} '{1}' porque el nombre '{2}' está en conflicto con el {3} '{4}' de este tipo o módulo. @@ -249,7 +274,7 @@ Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. - Este tipo es "abstract" ya que a algunos miembros abstractos no se les ha dado una implementación. Si esto es intencional, agregue el atributo "[<AbstractClass>]" + Las clases no abstractas no pueden contener miembros abstractos. Proporcione una implementación de miembros predeterminados o agregue el atributo "[<AbstractClass>]" al tipo. @@ -1379,7 +1404,7 @@ This recursive use will be checked for initialization-soundness at runtime. This warning is usually harmless, and may be suppressed by using '#nowarn "21"' or '--nowarn:21'. - Este uso recursivo se comprobará para ver si tiene inicialización silenciosa en tiempo de ejecución. Esta advertencia suele ser inocua y se puede suprimir con '#nowarn "21"' o '--nowarn:21'. + Este uso recursivo se comprobará para ver si tiene inicialización silenciosa en tiempo de ejecución. Esta advertencia suele ser inocua y se puede suprimir con '#nowarn "21"' o '--nowarn:21'. @@ -1404,7 +1429,7 @@ This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'. - Esta y otras referencias recursivas al objeto que se va a definir se comprobarán para ver si tienen inicialización silenciosa en tiempo de ejecución mediante el uso de una referencia retardada. Esto se debe a que está definiendo uno o varios objetos recursivos en lugar de funciones recursivas. Esta advertencia se puede suprimir con '#nowarn "40" o --nowarn:40'. + Esta y otras referencias recursivas al objeto que se va a definir se comprobarán para ver si tienen inicialización silenciosa en tiempo de ejecución mediante el uso de una referencia retardada. Esto se debe a que está definiendo uno o varios objetos recursivos en lugar de funciones recursivas. Esta advertencia se puede suprimir con '#nowarn "40" o --nowarn:40'. @@ -1524,12 +1549,12 @@ {0}. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. - {0}. Esta advertencia se puede deshabilitar con '--nowarn:57' o '#nowarn "57"'. + {0}. Esta advertencia se puede deshabilitar con '--nowarn:57' o '#nowarn "57"'. Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'. - El uso de esta construcción puede dar lugar a que se genere código .NET de IL que no se puede comprobar. Esta advertencia se puede deshabilitar con '--nowarn:9' o '#nowarn "9"'. + El uso de esta construcción puede dar lugar a que se genere código .NET de IL que no se puede comprobar. Esta advertencia se puede deshabilitar con '--nowarn:9' o '#nowarn "9"'. @@ -1574,7 +1599,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using '#nowarn "69"' if you have checked this is not the case. - Normalmente, las implementaciones de interfaz deben proporcionarse en la declaración inicial de un tipo. Las implementaciones de interfaz en aumentos pueden dar lugar al acceso a enlaces estáticos antes de inicializarse, aunque solo si la implementación de interfaz se invoca durante la inicialización de los datos estáticos y, a su vez, obtiene acceso a los datos estáticos. Puede quitar esta advertencia con #nowarn "69" si ha comprobado que este no es el caso. + Normalmente, las implementaciones de interfaz deben proporcionarse en la declaración inicial de un tipo. Las implementaciones de interfaz en aumentos pueden dar lugar al acceso a enlaces estáticos antes de inicializarse, aunque solo si la implementación de interfaz se invoca durante la inicialización de los datos estáticos y, a su vez, obtiene acceso a los datos estáticos. Puede quitar esta advertencia con 'nowarn "69"' si ha comprobado que este no es el caso. @@ -1594,12 +1619,12 @@ #I directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file, add a '-I' compiler option for this reference or delimit the directive with delimit it with '#if INTERACTIVE'/'#endif'. - Las directivas #I pueden existir solo en archivos de script de F# (extensiones .fsx o .fsscript). Mueva este código a un archivo de script, agregue una opción de compilador '-I' para esta referencia o delimite la directiva con '#if INTERACTIVE'/'#endif'. + Las directivas #I solo pueden utilizarse en archivos de script de F# (extensiones .fsx o .fsscript). Mueva este código a un archivo de script, agregue una opción de compilador '-I' para esta referencia o delimite la directiva con '#if INTERACTIVE'/'#endif'. #r directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file or replace this reference with the '-r' compiler option. If this directive is being executed as user input, you may delimit it with '#if INTERACTIVE'/'#endif'. - Las directivas #r pueden existir solo en archivos de script de F# (extensiones .fsx o .fsscript). Mueva este código a un archivo de script o sustituta esta referencia por la opción de compilador '-r'. Si esta directiva se ejecuta como entrada de usuario, puede delimitarla con '#if INTERACTIVE'/'#endif'. + Las directivas #r solo pueden utilizarse en archivos de script de F# (extensiones .fsx o .fsscript). Mueva este código a un archivo de script o sustituta esta referencia por la opción de compilador '-r'. Si esta directiva se ejecuta como entrada de usuario, puede delimitarla con '#if INTERACTIVE'/'#endif'. diff --git a/src/Compiler/xlf/FSStrings.fr.xlf b/src/Compiler/xlf/FSStrings.fr.xlf index 52bbd21deb4..b3627df28f8 100644 --- a/src/Compiler/xlf/FSStrings.fr.xlf +++ b/src/Compiler/xlf/FSStrings.fr.xlf @@ -12,6 +12,26 @@ Les définitions {0} pour le type « {1} » dans la signature et l'implémentation ne sont pas compatibles, car les abréviations sont différentes :\n {2}\npar opposition à\n {3} + + Nullness warning: {0}. + Nullness warning: {0}. + + + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + + + + Nullness warning: The type '{0}' does not support 'null'. + Nullness warning: The type '{0}' does not support 'null'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n Incompatibilité de type. Tuple de longueur attendu {0} de type\n {1} \nmais tuple de longueur {2} de type\n {3}{4}\n @@ -37,6 +57,11 @@ Un membre statique est attendu. + + symbol '|' (directly before 'null') + symbol '|' (directly before 'null') + + symbol '..^' symbole '..^' @@ -178,7 +203,7 @@ - The {0} '{1}' can not be defined because the name '{2}' clashes with the {3} '{4}' in this type or module + The {0} '{1}' cannot be defined because the name '{2}' clashes with the {3} '{4}' in this type or module Impossible de définir le {0} '{1}', car le nom '{2}' est en conflit avec le {3} '{4}' dans ce type ou module @@ -249,7 +274,7 @@ Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. - Ce type est 'abstract', car des membres abstraits n'ont pas reçu d'implémentation. Si cela est intentionnel, ajoutez l'attribut '[<AbstractClass>]' à votre type. + Les classes non abstraites ne peuvent pas contenir de membres abstraits. Fournissez une implémentation de membre par défaut ou ajoutez l’attribut « [<AbstractClass>] » à votre type. @@ -1379,7 +1404,7 @@ This recursive use will be checked for initialization-soundness at runtime. This warning is usually harmless, and may be suppressed by using '#nowarn "21"' or '--nowarn:21'. - Cette utilisation récursive sera soumise à un contrôle de l'initialisation au moment de l'exécution. En règle générale, cet avertissement est sans danger et peut être supprimé à l'aide de '#nowarn "21"' ou '--nowarn:21'. + Cette utilisation récursive sera soumise à un contrôle de l'initialisation au moment de l'exécution. En règle générale, cet avertissement est sans danger et peut être supprimé à l'aide de '#nowarn "21"' ou '--nowarn:21'. @@ -1404,7 +1429,7 @@ This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'. - Toutes les références récursives aux objets définis seront soumises à un contrôle de l'initialisation au moment de l'exécution via l'utilisation d'une référence différée. En effet, vous définissez un ou plusieurs objets récursifs à la place de fonctions récursives. Cet avertissement peut être supprimé à l'aide de '#nowarn "40"' ou '--nowarn:40'. + Toutes les références récursives aux objets définis seront soumises à un contrôle de l'initialisation au moment de l'exécution via l'utilisation d'une référence différée. En effet, vous définissez un ou plusieurs objets récursifs à la place de fonctions récursives. Cet avertissement peut être supprimé à l'aide de '#nowarn "40"' ou '--nowarn:40'. @@ -1524,12 +1549,12 @@ {0}. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. - {0}. Cet avertissement peut être désactivé à l'aide de '--nowarn:57' ou '#nowarn "57"'. + {0}. Cet avertissement peut être désactivé à l'aide de '--nowarn:57' ou '#nowarn "57"'. Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'. - Les utilisations de cette construction peuvent entraîner la génération de code IL (Intermediate Language) .NET non vérifiable. Cet avertissement peut être désactivé à l'aide de '--nowarn:9' ou '#nowarn "9"'. + Les utilisations de cette construction peuvent entraîner la génération de code IL (Intermediate Language) .NET non vérifiable. Cet avertissement peut être désactivé à l'aide de '--nowarn:9' ou '#nowarn "9"'. @@ -1574,7 +1599,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using '#nowarn "69"' if you have checked this is not the case. - Les implémentations d’interfaces doivent normalement être fournies lors de la déclaration initiale d’un type. Les implémentations d’interface dans les augmentations peuvent entraîner l’accès à des liaisons statiques avant leur initialisation, mais seulement si l’implémentation de l’interface est invoquée pendant l’initialisation des données statiques, et accède à son tour aux données statiques. Vous pouvez supprimer cet avertissement en utilisant #nowarn « 69 » si vous avez vérifié que ce n’est pas le cas. + Les implémentations d’interfaces doivent normalement être fournies lors de la déclaration initiale d’un type. Les implémentations d’interface dans les augmentations peuvent entraîner l’accès à des liaisons statiques avant leur initialisation, mais seulement si l’implémentation de l’interface est invoquée pendant l’initialisation des données statiques, et accède à son tour aux données statiques. Vous pouvez supprimer cet avertissement à l’aide de '#nowarn "69"' si vous avez vérifié que ce n’est pas le cas. @@ -1594,12 +1619,12 @@ #I directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file, add a '-I' compiler option for this reference or delimit the directive with delimit it with '#if INTERACTIVE'/'#endif'. - Les directives #I ne peuvent être présentes que dans les fichiers de script F# (extensions .fsx ou .fsscript). Déplacez ce code vers un fichier de script, ajoutez une option de compilateur '-I' pour cette référence ou délimitez la directive par '#if INTERACTIVE'/'#endif'. + #I directives ne peuvent être utilisées que dans les fichiers de script F# (extensions .fsx ou .fsscript). Déplacez ce code vers un fichier de script, ajoutez une option de compilateur '-I' pour cette référence ou délimitez la directive par '#if INTERACTIVE'/'#endif'. #r directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file or replace this reference with the '-r' compiler option. If this directive is being executed as user input, you may delimit it with '#if INTERACTIVE'/'#endif'. - Les directives #r ne peuvent être présentes que dans les fichiers de script F# (extensions .fsx ou .fsscript). Déplacez ce code vers un fichier de script ou remplacez cette référence par l'option de compilateur '-r'. Si cette directive est exécutée en tant qu'entrée d'utilisateur, vous pouvez la délimiter avec '#if INTERACTIVE'/'#endif'. + #r directives ne peuvent être utilisées que dans les fichiers de script F# (extensions .fsx ou .fsscript). Déplacez ce code vers un fichier de script ou remplacez cette référence par l'option de compilateur '-r'. Si cette directive est exécutée en tant qu'entrée d'utilisateur, vous pouvez la délimiter avec '#if INTERACTIVE'/'#endif'. diff --git a/src/Compiler/xlf/FSStrings.it.xlf b/src/Compiler/xlf/FSStrings.it.xlf index bda61376f4f..b042d7704b2 100644 --- a/src/Compiler/xlf/FSStrings.it.xlf +++ b/src/Compiler/xlf/FSStrings.it.xlf @@ -12,6 +12,26 @@ Le definizioni di {0} per il tipo '{1}' nella firma e nell'implementazione non sono compatibili perché le abbreviazioni sono diverse:\n {2}\n anziché \n {3} + + Nullness warning: {0}. + Nullness warning: {0}. + + + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + + + + Nullness warning: The type '{0}' does not support 'null'. + Nullness warning: The type '{0}' does not support 'null'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n Tipo non corrispondente. È prevista una tupla di lunghezza {0} di tipo\n {1} \n, ma è stata specificata una tupla di lunghezza {2} di tipo\n {3}{4}\n @@ -37,6 +57,11 @@ È previsto un membro statico. + + symbol '|' (directly before 'null') + symbol '|' (directly before 'null') + + symbol '..^' simbolo '..^' @@ -178,7 +203,7 @@ - The {0} '{1}' can not be defined because the name '{2}' clashes with the {3} '{4}' in this type or module + The {0} '{1}' cannot be defined because the name '{2}' clashes with the {3} '{4}' in this type or module Non è possibile definire {0} '{1}' perché il nome '{2}' è in conflitto con {3} '{4}' in questo tipo o modulo @@ -249,7 +274,7 @@ Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. - Questo tipo è 'abstract' perché non è stata specificata un'implementazione per alcuni membri astratti. Se questa scelta è intenzionale, aggiungere l'attributo '[<AbstractClass>]' al tipo. + Le classi non astratte non possono contenere membri astratti. Specificare un'implementazione di membro predefinita o aggiungere l'attributo '[<AbstractClass>]' al tipo. @@ -1379,7 +1404,7 @@ This recursive use will be checked for initialization-soundness at runtime. This warning is usually harmless, and may be suppressed by using '#nowarn "21"' or '--nowarn:21'. - La correttezza dell'inizializzazione al runtime di questo utilizzo ricorsivo verrà verificata. Questo avviso non indica in genere un problema concreto e può essere disabilitato mediante '#nowarn "21"' o '--nowarn:21'. + La correttezza dell'inizializzazione al runtime di questo utilizzo ricorsivo verrà verificata. Questo avviso non indica in genere un problema concreto e può essere disabilitato mediante '#nowarn "21"' o '--nowarn:21'. @@ -1404,7 +1429,7 @@ This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'. - Questo e altri riferimenti ricorsivi a uno o più oggetti in fase di definizione verranno controllati per verificare la correttezza dell'inizializzazione al runtime tramite un riferimento ritardato. Tale verifica è necessaria perché si stanno definendo uno o più oggetti ricorsivi, invece di funzioni ricorsive. La visualizzazione di questo avviso può essere impedita mediante '#nowarn "40"' o '--nowarn:40'. + Questo e altri riferimenti ricorsivi a uno o più oggetti in fase di definizione verranno controllati per verificare la correttezza dell'inizializzazione al runtime tramite un riferimento ritardato. Tale verifica è necessaria perché si stanno definendo uno o più oggetti ricorsivi, invece di funzioni ricorsive. La visualizzazione di questo avviso può essere impedita mediante '#nowarn "40"' o '--nowarn:40'. @@ -1524,12 +1549,12 @@ {0}. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. - {0}. Questo avviso può essere disabilitato mediante '--nowarn:57' o '#nowarn "57"'. + {0}. Questo avviso può essere disabilitato mediante '--nowarn:57' o '#nowarn "57"'. Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'. - Gli utilizzi di questo costruttore potrebbero determinare la generazione di codice IL .NET non verificabile. Questo avviso può essere disabilitato mediante '--nowarn:9' o '#nowarn "9"'. + Gli utilizzi di questo costruttore potrebbero determinare la generazione di codice IL .NET non verificabile. Questo avviso può essere disabilitato mediante '--nowarn:9' o '#nowarn "9"'. @@ -1574,7 +1599,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using '#nowarn "69"' if you have checked this is not the case. - In genere, le implementazioni di interfaccia devono essere specificate nella dichiarazione iniziale di un tipo. Le implementazioni di interfaccia negli aumenti possono portare all'accesso ai binding statici prima dell'inizializzazione, anche se l'implementazione dell'interfaccia viene richiamata durante l'inizializzazione dei dati statici e a sua volta accede ai dati statici. È possibile rimuovere questo avviso utilizzando #nowarn "69" se è stato verificato che il caso specifico non lo richiede. + In genere, le implementazioni di interfaccia devono essere specificate nella dichiarazione iniziale di un tipo. Le implementazioni di interfaccia negli aumenti possono portare all'accesso ai binding statici prima dell'inizializzazione, anche se l'implementazione dell'interfaccia viene richiamata durante l'inizializzazione dei dati statici e a sua volta accede ai dati statici. È possibile rimuovere questo avviso utilizzando '#nowarn "69"' se è stato verificato che il caso specifico non lo richiede. @@ -1594,12 +1619,12 @@ #I directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file, add a '-I' compiler option for this reference or delimit the directive with delimit it with '#if INTERACTIVE'/'#endif'. - Le direttive #I possono trovarsi solo in file di script F# (estensioni fsx o fsscript). Spostare il codice in un file di script, aggiungere un'opzione di compilazione '-I' per questo riferimento oppure delimitare la direttiva con '#if INTERACTIVE'/'#endif'. + Le direttive #I possono essere usate solo in file di script F# (estensioni fsx o fsscript). Spostare il codice in un file di script, aggiungere un'opzione di compilazione '-I' per questo riferimento oppure delimitare la direttiva con '#if INTERACTIVE'/'#endif'. #r directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file or replace this reference with the '-r' compiler option. If this directive is being executed as user input, you may delimit it with '#if INTERACTIVE'/'#endif'. - Le direttive #r possono trovarsi solo in file di script F# (estensioni fsx o fsscript). Spostare il codice in un file di script oppure sostituire questo riferimento con l'opzione del compilatore '-r'. Se questa direttiva viene eseguita come input utente, è possibile delimitarla con '#if INTERACTIVE'/'#endif'. + #r direttive #I possono essere usate solo in file di script F# (estensioni fsx o fsscript). Spostare il codice in un file di script oppure sostituire questo riferimento con l'opzione del compilatore '-r'. Se questa direttiva viene eseguita come input utente, è possibile delimitarla con '#if INTERACTIVE'/'#endif'. diff --git a/src/Compiler/xlf/FSStrings.ja.xlf b/src/Compiler/xlf/FSStrings.ja.xlf index bc58f13ccad..3b9c4d98e21 100644 --- a/src/Compiler/xlf/FSStrings.ja.xlf +++ b/src/Compiler/xlf/FSStrings.ja.xlf @@ -12,6 +12,26 @@ シグネチャおよび実装内の型 '{0}' の {1} 定義は、省略形が異なるため\n ({2}\nと \n {3})、互換性がありません + + Nullness warning: {0}. + Nullness warning: {0}. + + + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + + + + Nullness warning: The type '{0}' does not support 'null'. + Nullness warning: The type '{0}' does not support 'null'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n 型が一致しません。型の長さ {0} のタプルが必要です\n {1} \nただし、型の長さ {2} のタプルが指定された場合\n {3}{4}\n @@ -37,6 +57,11 @@ 静的メンバーが必要です。 + + symbol '|' (directly before 'null') + symbol '|' (directly before 'null') + + symbol '..^' シンボル '..^' @@ -178,7 +203,7 @@ - The {0} '{1}' can not be defined because the name '{2}' clashes with the {3} '{4}' in this type or module + The {0} '{1}' cannot be defined because the name '{2}' clashes with the {3} '{4}' in this type or module 名前 '{2}' がこの型またはモジュールの {3} '{4}' と競合するため、{0} '{1}' を定義できません @@ -249,7 +274,7 @@ Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. - これは 'abstract' 型です。一部の抽象メンバーに実装がありません。意図的な場合には、型に '[<AbstractClass>]' 属性を追加してください。 + 非抽象クラスに抽象メンバーを含めることはできません。既定のメンバー実装を指定するか、'[<AbstractClass>]' 属性を型に追加してください。 @@ -1379,7 +1404,7 @@ This recursive use will be checked for initialization-soundness at runtime. This warning is usually harmless, and may be suppressed by using '#nowarn "21"' or '--nowarn:21'. - この再帰的な用法は、実行時に初期化の正常性がチェックされます。通常、この警告は害がないため、'#nowarn "21"' または '--nowarn:21' を使用して抑制することができます。 + この再帰的な用法は、実行時に初期化の正常性がチェックされます。通常、この警告は害がないため、'#nowarn "21"' または '--nowarn:21' を使用して抑制することができます。 @@ -1404,7 +1429,7 @@ This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'. - 定義されるオブジェクトに対するこの再帰参照および他の再帰参照は、遅延参照を使用して、実行時に初期化の正常性がチェックされます。これは、再帰関数ではなく、1 つまたは複数の再帰オブジェクトを定義しているためです。この警告を抑制するには、'#nowarn "40"' または '--nowarn:40' を使用してください。 + 定義されるオブジェクトに対するこの再帰参照および他の再帰参照は、遅延参照を使用して、実行時に初期化の正常性がチェックされます。これは、再帰関数ではなく、1 つまたは複数の再帰オブジェクトを定義しているためです。この警告を抑制するには、'#nowarn "40"' または '--nowarn:40' を使用してください。 @@ -1524,12 +1549,12 @@ {0}. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. - {0}。この警告を無効にするには、'--nowarn:57' または '#nowarn "57"' を使用します。 + {0}。この警告を無効にするには、'--nowarn:57' または '#nowarn "57"' を使用します。 Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'. - このコンストラクトを使用すると、検証できない .NET IL コードが生成される可能性があります。この警告を無効にするには、'--nowarn:9' または '#nowarn "9"' を使用してください。 + このコンストラクトを使用すると、検証できない .NET IL コードが生成される可能性があります。この警告を無効にするには、'--nowarn:9' または '#nowarn "9"' を使用してください。 @@ -1574,7 +1599,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using '#nowarn "69"' if you have checked this is not the case. - インターフェイスの実装には、通常、最初に型を指定する必要があります。拡張のインターフェイス実装は、初期化前に静的バインディングにアクセスする可能性があります。ただし、静的データの初期化中にインターフェイスの実装が呼び出され、静的データにアクセスする場合のみです。この警告は、#nowarn "69" を使用して削除できます。この点をすでにチェックしている場合は該当しません。 + 通常、インターフェイスの実装は、型の最初の宣言で指定する必要があります。拡張でのインターフェイス実装は、初期化前の静的バインディングへのアクセスを引き起こすことがあります。ただし、静的データの初期化中にそのインターフェイスの実装が呼び出された後に、静的データにアクセスする場合のみです。この件が問題でないと確認できたら、この警告を '#nowarn "69"' を使用して削除できます。 @@ -1594,12 +1619,12 @@ #I directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file, add a '-I' compiler option for this reference or delimit the directive with delimit it with '#if INTERACTIVE'/'#endif'. - #I ディレクティブを使用できるのは F# スクリプト ファイル (拡張子は .fsx または .fsscript) のみです。このコードをスクリプト ファイルに移動するか、この参照に '-I' コンパイラー オプションを追加するか、ディレクティブを '#if INTERACTIVE'/'#endif' で区切ってください。 + #I ディレクティブを使用できるのは F# スクリプト ファイル (拡張子が .fsx または .fsscript) のみです。このコードをスクリプト ファイルに移動し、この参照に '-I' コンパイラー オプションを追加するか、ディレクティブを '#if INTERACTIVE'/'#endif' で区切ってください。 #r directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file or replace this reference with the '-r' compiler option. If this directive is being executed as user input, you may delimit it with '#if INTERACTIVE'/'#endif'. - #r ディレクティブは F# スクリプト ファイル (拡張子は .fsx または .fsscript) 内でのみ使用できます。このコードをスクリプト ファイルに移動するか、この参照を '-r' コンパイラ オプションに置き換えてください。このディレクティブがユーザー入力として実行されている場合は、'#if INTERACTIVE'/'#endif' でディレクティブを区切ることができます。 + #r ディレクティブを使用できるのは F# スクリプト ファイル (拡張子が .fsx または .fsscript) のみです。このコードをスクリプト ファイルに移動するか、この参照を '-r' コンパイラ オプションに置き換えてください。このディレクティブがユーザー入力として実行されている場合は、'#if INTERACTIVE'/'#endif' でディレクティブを区切ることができます。 diff --git a/src/Compiler/xlf/FSStrings.ko.xlf b/src/Compiler/xlf/FSStrings.ko.xlf index 063db206b23..51c8cb1365f 100644 --- a/src/Compiler/xlf/FSStrings.ko.xlf +++ b/src/Compiler/xlf/FSStrings.ko.xlf @@ -12,6 +12,26 @@ 약어가 다르기 때문에 시그니처 및 구현의 '{1}' 형식에 대한 {0} 정의가 호환되지 않습니다.\n {2}\n 대 \n {3} + + Nullness warning: {0}. + Nullness warning: {0}. + + + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + + + + Nullness warning: The type '{0}' does not support 'null'. + Nullness warning: The type '{0}' does not support 'null'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n 유형 불일치. 형식이 \n {1}이고 길이가 {0}인 튜플이 필요합니다. \n그러나 형식이 \n {3}이고 길이가 {2}인 튜플이 제공되었습니다.{4}\n @@ -37,6 +57,11 @@ 정적 멤버가 필요합니다. + + symbol '|' (directly before 'null') + symbol '|' (directly before 'null') + + symbol '..^' 기호 '..^' @@ -178,7 +203,7 @@ - The {0} '{1}' can not be defined because the name '{2}' clashes with the {3} '{4}' in this type or module + The {0} '{1}' cannot be defined because the name '{2}' clashes with the {3} '{4}' in this type or module 이름 '{2}'이(가) 이 형식 또는 모듈의 {3} '{4}'과(와) 충돌하므로 {0} '{1}'을(를) 정의할 수 없습니다. @@ -249,7 +274,7 @@ Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. - 일부 추상 멤버에 구현이 지정되지 않았으므로 이 형식은 'abstract'입니다. 의도적으로 구현을 지정하지 않은 경우에는 형식에 '[<AbstractClass>]' 특성을 추가하세요. + 비 추상 클래스는 추상 구성원을 포함할 수 없습니다. 기본 구성원 구현을 제공하거나 형식에 '[<AbstractClass>]' 특성을 추가하세요. @@ -1379,7 +1404,7 @@ This recursive use will be checked for initialization-soundness at runtime. This warning is usually harmless, and may be suppressed by using '#nowarn "21"' or '--nowarn:21'. - 이러한 재귀적 사용은 런타임에 초기화 적합성이 확인됩니다. 이 경고는 일반적으로 무해하며 '#nowarn "21"' 또는 '--nowarn:21'을 사용하여 표시하지 않을 수 있습니다. + 이러한 재귀적 사용은 런타임에 초기화 적합성이 확인됩니다. 이 경고는 일반적으로 무해하며 '#nowarn "21"' 또는 '--nowarn:21'을 사용하여 표시하지 않을 수 있습니다. @@ -1404,7 +1429,7 @@ This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'. - 이 재귀 참조와 정의 대상 개체에 대한 기타 재귀 참조는 런타임에 지연된 참조를 사용하여 초기화 적합성이 확인됩니다. 이는 사용자가 재귀 함수 대신 하나 이상의 재귀적 개체를 정의하기 때문입니다. 이 경고는 '#nowarn "40"' 또는 '--nowarn:40'을 사용하여 표시하지 않을 수 있습니다. + 이 재귀 참조와 정의 대상 개체에 대한 기타 재귀 참조는 런타임에 지연된 참조를 사용하여 초기화 적합성이 확인됩니다. 이는 사용자가 재귀 함수 대신 하나 이상의 재귀적 개체를 정의하기 때문입니다. 이 경고는 '#nowarn "40"' 또는 '--nowarn:40'을 사용하여 표시하지 않을 수 있습니다. @@ -1524,12 +1549,12 @@ {0}. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. - {0}. 이 경고는 '--nowarn:57' 또는 '#nowarn "57"'을 통해 사용할 수 없도록 설정할 수 있습니다. + {0}. 이 경고는 '--nowarn:57' 또는 '#nowarn "57"'을 통해 사용할 수 없도록 설정할 수 있습니다. Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'. - 이 구문을 사용하면 확인할 수 없는 .NET IL 코드가 생성될 수 있습니다. 이 경고는 '--nowarn:9' 또는 '#nowarn "9"'를 통해 사용할 수 없도록 설정할 수 있습니다. + 이 구문을 사용하면 확인할 수 없는 .NET IL 코드가 생성될 수 있습니다. 이 경고는 '--nowarn:9' 또는 '#nowarn "9"'를 통해 사용할 수 없도록 설정할 수 있습니다. @@ -1574,7 +1599,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using '#nowarn "69"' if you have checked this is not the case. - 인터페이스 구현은 일반적으로 유형의 초기 선언에 제공되어야 합니다. 확대의 인터페이스 구현은 초기화되기 전에 정적 바인딩에 액세스할 수 있지만 정적 데이터의 초기화 중에 인터페이스 구현이 호출되어 정적 데이터에 액세스하는 경우에만 가능합니다. 사실이 아님을 확인한 경우 #nowarn "69"를 사용하여 이 경고를 제거할 수 있습니다. + 인터페이스 구현은 일반적으로 유형의 초기 선언에 제공되어야 합니다. 확대의 인터페이스 구현은 초기화되기 전에 정적 바인딩에 액세스할 수 있지만 정적 데이터의 초기화 중에 인터페이스 구현이 호출되어 정적 데이터에 액세스하는 경우에만 가능합니다. 사실이 아님을 확인한 경우 #nowarn "69"를 사용하여 이 경고를 제거할 수 있습니다. @@ -1594,12 +1619,12 @@ #I directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file, add a '-I' compiler option for this reference or delimit the directive with delimit it with '#if INTERACTIVE'/'#endif'. - #I 지시문은 F# 스크립트 파일(확장명 .fsx 또는 .fsscript)에서만 발생할 수 있습니다. 이 코드를 스크립트 파일로 이동하거나, 이 참조에 대한 '-I' 컴파일러 옵션을 추가하거나, 지시문을 '#if INTERACTIVE'/'#endif'로 구분하세요. + #I 지시문은 F# 스크립트 파일(확장명 .fsx 또는 .fsscript)에서만 사용할 수 있습니다. 이 코드를 스크립트 파일로 이동하거나, 이 참조에 대한 '-I' 컴파일러 옵션을 추가하거나, 지시문을 '#if INTERACTIVE'/'#endif'로 구분하세요. #r directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file or replace this reference with the '-r' compiler option. If this directive is being executed as user input, you may delimit it with '#if INTERACTIVE'/'#endif'. - #r 지시문은 F# 스크립트 파일(확장명 .fsx 또는 .fsscript)에서만 발생할 수 있습니다. 이 코드를 스크립트 파일로 이동하거나 이 참조를 '-r' 컴파일러 옵션으로 바꾸세요. 이 지시문이 사용자 입력으로 실행되는 경우 지시문을 '#if INTERACTIVE'/'#endif'로 구분할 수 있습니다. + #r 지시문은 F# 스크립트 파일(확장명 .fsx 또는 .fsscript)에서만 사용할 수 있습니다. 이 코드를 스크립트 파일로 이동하거나 이 참조를 '-r' 컴파일러 옵션으로 바꾸세요. 이 지시문이 사용자 입력으로 실행되는 경우 지시문을 '#if INTERACTIVE'/'#endif'로 구분할 수 있습니다. diff --git a/src/Compiler/xlf/FSStrings.pl.xlf b/src/Compiler/xlf/FSStrings.pl.xlf index 24b40f575fa..29e36ab5bc9 100644 --- a/src/Compiler/xlf/FSStrings.pl.xlf +++ b/src/Compiler/xlf/FSStrings.pl.xlf @@ -12,6 +12,26 @@ Definicje {0} dla typu „{1}” w sygnaturze i implementacji są niezgodne, ponieważ skróty są różne:\n {2}\nversus\n {3} + + Nullness warning: {0}. + Nullness warning: {0}. + + + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + + + + Nullness warning: The type '{0}' does not support 'null'. + Nullness warning: The type '{0}' does not support 'null'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n Niezgodność. Oczekiwano krotki o długości {0} typu\n {1} \nale otrzymano krotkę o długości {2} typu\n {3}{4}\n @@ -37,6 +57,11 @@ Oczekiwano statycznego elementu członkowskiego. + + symbol '|' (directly before 'null') + symbol '|' (directly before 'null') + + symbol '..^' symbol „..^” @@ -178,7 +203,7 @@ - The {0} '{1}' can not be defined because the name '{2}' clashes with the {3} '{4}' in this type or module + The {0} '{1}' cannot be defined because the name '{2}' clashes with the {3} '{4}' in this type or module Nie można zdefiniować elementu {0} „{1}”, ponieważ nazwa „{2}” powoduje konflikt z elementem {3} „{4}” w tym typie lub module @@ -249,7 +274,7 @@ Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. - Ten typ ma wartość „abstract”, ponieważ niektóre abstrakcyjne składowe nie mają określonej implementacji. Jeśli jest to zamierzone działanie, dodaj atrybut „[<AbstractClass>]” do typu. + Klasy nieabstrakcyjne nie mogą zawierać abstrakcyjnych składowych. Podaj domyślną implementację składowej lub dodaj atrybut „[<AbstractClass>]” do typu. @@ -1379,7 +1404,7 @@ This recursive use will be checked for initialization-soundness at runtime. This warning is usually harmless, and may be suppressed by using '#nowarn "21"' or '--nowarn:21'. - To użycie cykliczne zostanie sprawdzone pod kątem poprawności inicjalizacji w środowisku uruchomieniowym. To ostrzeżenie zazwyczaj nie jest szkodliwe i można je pominąć przy użyciu elementu „#nowarn "21"” lub „--nowarn:21”. + To użycie cykliczne zostanie sprawdzone pod kątem poprawności inicjalizacji w środowisku uruchomieniowym. To ostrzeżenie zazwyczaj nie jest szkodliwe i można je pominąć przy użyciu elementu „#nowarn "21"” lub „--nowarn:21”. @@ -1404,7 +1429,7 @@ This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'. - To i inne odwołania rekursywne do definiowanych obiektów zostaną sprawdzone pod kątem poprawności inicjalizacji w środowisku uruchomieniowym przy użyciu opóźnionego odwołania. Jest to spowodowane tym, że definiujesz co najmniej jeden obiekt rekursywny zamiast funkcji rekursywnych. To ostrzeżenie można pominąć przy użyciu elementu „#nowarn "40"” lub „--nowarn:40”. + To i inne odwołania rekursywne do definiowanych obiektów zostaną sprawdzone pod kątem poprawności inicjalizacji w środowisku uruchomieniowym przy użyciu opóźnionego odwołania. Jest to spowodowane tym, że definiujesz co najmniej jeden obiekt rekursywny zamiast funkcji rekursywnych. To ostrzeżenie można pominąć przy użyciu elementu „#nowarn "40"” lub „--nowarn:40”. @@ -1524,12 +1549,12 @@ {0}. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. - {0}. To ostrzeżenie można wyłączyć przy użyciu elementu „--nowarn:57” lub „#nowarn "57"”. + {0}. To ostrzeżenie można wyłączyć przy użyciu elementu „--nowarn:57” lub „#nowarn "57"”. Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'. - Użycie tej konstrukcji może spowodować wygenerowanie kodu .NET IL, którego nie można zweryfikować. To ostrzeżenie można wyłączyć przy użyciu elementu „--nowarn:9” lub „#nowarn "9"”. + Użycie tej konstrukcji może spowodować wygenerowanie kodu .NET IL, którego nie można zweryfikować. To ostrzeżenie można wyłączyć przy użyciu elementu „--nowarn:9” lub „#nowarn "9"”. @@ -1574,7 +1599,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using '#nowarn "69"' if you have checked this is not the case. - Implementacje interfejsu powinny być zwykle podane w początkowej deklaracji typu. Implementacje interfejsu w rozszerzeniach mogą prowadzić do uzyskania dostępu do powiązań statycznych przed ich zainicjowaniem, chociaż tylko wtedy, gdy implementacja interfejsu jest wywoływana podczas inicjowania danych statycznych i z kolei uzyskuje dostęp do danych statycznych. To ostrzeżenie można usunąć przy użyciu #nowarn "69" jeśli zaznaczono, że tak nie jest. + Implementacje interfejsu powinny być zwykle podane w początkowej deklaracji typu. Implementacje interfejsu w rozszerzeniach mogą prowadzić do uzyskania dostępu do powiązań statycznych przed ich zainicjowaniem, chociaż tylko wtedy, gdy implementacja interfejsu jest wywoływana podczas inicjowania danych statycznych i z kolei uzyskuje dostęp do danych statycznych. To ostrzeżenie można usunąć przy użyciu #nowarn „69” jeśli zaznaczono, że tak nie jest. @@ -1594,12 +1619,12 @@ #I directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file, add a '-I' compiler option for this reference or delimit the directive with delimit it with '#if INTERACTIVE'/'#endif'. - Dyrektywy #I mogą występować tylko w plikach skryptu języka F# (rozszerzenie fsx lub fsscript). Przenieś ten kod do pliku skryptu, dodaj opcję kompilatora „-I” dla tego odwołania lub rozdziel dyrektywę przy użyciu elementu „#if INTERACTIVE”/„#endif”. + Dyrektywy #I mogą być używane tylko w plikach skryptów języka F# (rozszerzenia FSX lub FSSCRIPT). Przenieś ten kod do pliku skryptu, dodaj opcję kompilatora „-I” dla tego odwołania lub rozdziel dyrektywę przy użyciu elementu „#if INTERACTIVE'/'#endif”. #r directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file or replace this reference with the '-r' compiler option. If this directive is being executed as user input, you may delimit it with '#if INTERACTIVE'/'#endif'. - Dyrektywy #r mogą występować tylko w plikach skryptu języka F# (rozszerzenie fsx lub fsscript). Przenieś ten kod do pliku skryptu lub zastąp to odwołanie za pomocą opcji kompilatora „-r”. Jeśli ta dyrektywa jest wykonywana jako dane wejściowe użytkownika, możesz ją ograniczyć przy użyciu elementu „#if INTERACTIVE”/„#endif”. + Dyrektywy #r mogą być używane tylko w plikach skryptów języka F# (rozszerzenia FSX lub FSSCRIPT). Przenieś ten kod do pliku skryptu lub zastąp to odwołanie za pomocą opcji kompilatora „-r”. Jeśli ta dyrektywa jest wykonywana jako dane wejściowe użytkownika, możesz ją ograniczyć przy użyciu elementu „#if INTERACTIVE'/'#endif”. diff --git a/src/Compiler/xlf/FSStrings.pt-BR.xlf b/src/Compiler/xlf/FSStrings.pt-BR.xlf index 7bef6c4c7b3..b606d7339c5 100644 --- a/src/Compiler/xlf/FSStrings.pt-BR.xlf +++ b/src/Compiler/xlf/FSStrings.pt-BR.xlf @@ -12,6 +12,26 @@ As definições {0} para o tipo '{1}' na assinatura e na implementação não são compatíveis porque as abreviações são diferentes:\n {2}\nversus\n {3} + + Nullness warning: {0}. + Nullness warning: {0}. + + + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + + + + Nullness warning: The type '{0}' does not support 'null'. + Nullness warning: The type '{0}' does not support 'null'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n Tipo incompatível. Esperando uma tupla de comprimento {0} do tipo\n {1} \nmas recebeu uma tupla de comprimento {2} do tipo\n {3}{4}\n @@ -37,6 +57,11 @@ O membro estático é esperado. + + symbol '|' (directly before 'null') + symbol '|' (directly before 'null') + + symbol '..^' símbolo '..^' @@ -178,7 +203,7 @@ - The {0} '{1}' can not be defined because the name '{2}' clashes with the {3} '{4}' in this type or module + The {0} '{1}' cannot be defined because the name '{2}' clashes with the {3} '{4}' in this type or module O {0} '{1}' não pode ser definido porque o nome '{2}' conflita com {3} '{4}' neste tipo ou módulo @@ -249,7 +274,7 @@ Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. - Esse tipo é 'abstrato', pois alguns membros abstratos não receberam uma implementação. Se isso for intencional, adicione o atributo '[<AbstractClass>]' ao seu tipo. + Classes não abstratas não podem conter membros abstratos. Forneça uma implantação de membro padrão ou adicione o atributo '[<AbstractClass>]' ao seu tipo. @@ -1379,7 +1404,7 @@ This recursive use will be checked for initialization-soundness at runtime. This warning is usually harmless, and may be suppressed by using '#nowarn "21"' or '--nowarn:21'. - Este uso recursivo passará por verificação de solidez de inicialização no tempo de execução. Este aviso normalmente é inofensivo e pode ser suprimido usando '#nowarn "21"' ou '--nowarn:21'. + Este uso recursivo passará por verificação de solidez de inicialização no tempo de execução. Este aviso normalmente é inofensivo e pode ser suprimido usando '#nowarn "21"' ou '--nowarn:21'. @@ -1404,7 +1429,7 @@ This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'. - Esta e outras referências recursivas dos objetos que estão sendo definidos passarão por verificação de solidez de inicialização em tempo de execução através do uso de uma referência atrasada. Isto porque você está definindo um ou mais objetos recursivos ao invés de funções recursivas. Este aviso pode ser suprimido com o uso de '#nowarn "40"' ou '--nowarn:40'. + Esta e outras referências recursivas dos objetos que estão sendo definidos passarão por verificação de solidez de inicialização em tempo de execução através do uso de uma referência atrasada. Isto porque você está definindo um ou mais objetos recursivos ao invés de funções recursivas. Este aviso pode ser suprimido com o uso de '#nowarn "40"' ou '--nowarn:40'. @@ -1524,12 +1549,12 @@ {0}. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. - {0}. Este aviso foi desabilitado com o uso de '--nowarn:57' ou '#nowarn "57"'. + {0}. Este aviso foi desabilitado com o uso de '--nowarn:57' ou '#nowarn "57"'. Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'. - O uso desse construto pode resultar na geração de código .NET IL não verificável. Este aviso pode ser desabilitado usando '--nowarn:9' ou '#nowarn "9"'. + O uso desse construto pode resultar na geração de código .NET IL não verificável. Este aviso pode ser desabilitado usando '--nowarn:9' ou '#nowarn "9"'. @@ -1574,7 +1599,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using '#nowarn "69"' if you have checked this is not the case. - As implementações de interface normalmente devem ser fornecidas na declaração inicial de um tipo. As implementações de interface em aumentos podem levar ao acesso a associações estáticas antes de serem inicializadas, embora somente se a implementação de interface for chamada durante a inicialização dos dados estáticos e, por sua vez, o acesso aos dados estáticos. Você pode remover este aviso usando #nowarn "69" se tiver verificado que não é o caso. + As implementações de interface normalmente devem ser fornecidas na declaração inicial de um tipo. As implementações de interface em aumentos podem levar ao acesso a associações estáticas antes de serem inicializadas, embora somente se a implementação de interface for chamada durante a inicialização dos dados estáticos e, por sua vez, o acesso aos dados estáticos. Você poderá remover este aviso usando #nowarn "69" se tiver verificado que este não é o caso. @@ -1594,12 +1619,12 @@ #I directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file, add a '-I' compiler option for this reference or delimit the directive with delimit it with '#if INTERACTIVE'/'#endif'. - Diretivas #I só podem ocorrer em arquivos de script F# (extensões .fsx ou .fsscript). Mova este código para o arquivo de script e adicione uma opção de compilador '-I' para esta referência, ou então, delimite a diretiva com '#if INTERACTIVE'/'#endif'. + Diretivas #I só podem ser usadas em arquivos de script F# (extensões .fsx ou .fsscript). Mova este código para o arquivo de script e adicione uma opção de compilador "-I" para esta referência, ou então, delimite a diretiva com "#if INTERACTIVE"/"#endif". #r directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file or replace this reference with the '-r' compiler option. If this directive is being executed as user input, you may delimit it with '#if INTERACTIVE'/'#endif'. - Diretivas #r só podem ocorrer em arquivos de script F# (extensões .fsx ou .fsscript). Mova este código para um arquivo de script ou substitua essa referência com a opção do compilador '-r'. Se essa diretiva estiver sendo executada como uma entrada do usuário, você poderá delimitá-lo com '#if INTERACTIVE'/'#endif'. + Diretivas #r só podem ser usadas em arquivos de script F# (extensões .fsx ou .fsscript). Mova este código para um arquivo de script ou substitua essa referência com a opção do compilador "-r". Se essa diretiva estiver sendo executada como uma entrada do usuário, você poderá delimitá-lo com "#if INTERACTIVE"/"#endif". diff --git a/src/Compiler/xlf/FSStrings.ru.xlf b/src/Compiler/xlf/FSStrings.ru.xlf index 4611759c3c4..6367fb6f835 100644 --- a/src/Compiler/xlf/FSStrings.ru.xlf +++ b/src/Compiler/xlf/FSStrings.ru.xlf @@ -12,6 +12,26 @@ Определения {0} для типа "{1}" в сигнатуре и реализации несовместимы, так как сокращения различаются:\n {2}\nв сравнении с\n {3} + + Nullness warning: {0}. + Nullness warning: {0}. + + + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + + + + Nullness warning: The type '{0}' does not support 'null'. + Nullness warning: The type '{0}' does not support 'null'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n Несоответствие типов. Ожидается кортеж длиной {0} типа\n {1}, \nно предоставлен кортеж длиной {2} типа\n {3}{4}\n @@ -37,6 +57,11 @@ Ожидается статический элемент. + + symbol '|' (directly before 'null') + symbol '|' (directly before 'null') + + symbol '..^' символ "..^" @@ -178,7 +203,7 @@ - The {0} '{1}' can not be defined because the name '{2}' clashes with the {3} '{4}' in this type or module + The {0} '{1}' cannot be defined because the name '{2}' clashes with the {3} '{4}' in this type or module {0} "{1}" не удается определить, так как имя "{2}" конфликтует с {3} "{4}" в данном типе или модуле @@ -249,7 +274,7 @@ Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. - Этот тип является абстрактным ('abstract'), так как для нескольких абстрактных членов не указана реализация. Если это сделано намеренно, добавьте атрибут '[<AbstractClass>]' к своему типу. + Неабстрактные классы не могут содержать абстрактные элементы. Укажите реализацию элемента по умолчанию или добавьте атрибут "[<AbstractClass>]" в тип. @@ -1379,7 +1404,7 @@ This recursive use will be checked for initialization-soundness at runtime. This warning is usually harmless, and may be suppressed by using '#nowarn "21"' or '--nowarn:21'. - Это рекурсивное использование будет проверено на правильность инициализации во время выполнения. Данное предупреждение обычно безвредно; его можно отменить, используя #nowarn "21" или --nowarn 21. + Это рекурсивное использование будет проверено на правильность инициализации во время выполнения. Данное предупреждение обычно безвредно; его можно отменить, используя #nowarn "21" или --nowarn 21. @@ -1404,7 +1429,7 @@ This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'. - Эта и другие рекурсивные ссылки на определяемый объект будут проверены на правильность инициализации во время выполнения посредством использования отложенной ссылки. Это происходит потому, что вы определяете один или несколько рекурсивных объектов, а не рекурсивных функций. Данное предупреждение можно отменить, используя #nowarn "40" или --nowarn 40. + Эта и другие рекурсивные ссылки на определяемый объект будут проверены на правильность инициализации во время выполнения посредством использования отложенной ссылки. Это происходит потому, что вы определяете один или несколько рекурсивных объектов, а не рекурсивных функций. Данное предупреждение можно отменить, используя #nowarn "40" или --nowarn 40. @@ -1524,12 +1549,12 @@ {0}. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. - {0}. Данное предупреждение можно отключить, используя --nowarn 57 или #nowarn "57". + {0}. Данное предупреждение можно отключить, используя --nowarn 57 или #nowarn "57". Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'. - Использование данной конструкции может повлечь за собой создание непроверяемого кода .NET IL. Данное предупреждение можно отключить, используя --nowarn 9 или #nowarn "9". + Использование данной конструкции может повлечь за собой создание непроверяемого кода .NET IL. Данное предупреждение можно отключить, используя --nowarn 9 или #nowarn "9". @@ -1574,7 +1599,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using '#nowarn "69"' if you have checked this is not the case. - Реализации интерфейса обычно следует указывать при первоначальном объявлении типа. Реализации интерфейса в приращениях могут привести к доступу к статическим привязкам до их инициализации, но только в том случае, если реализация интерфейса вызвана во время инициализации статических данных. Это, в свою очередь, приведет к доступу к статическим данным. Это предупреждение можно удалить с помощью #nowarn "69", если вы убедились, что это не так. + Реализации интерфейса обычно следует указывать при начальном объявлении типа. Реализации интерфейса в расширениях могут привести к доступу к статическим привязкам до их инициализации, но только в том случае, если реализация интерфейса вызывается во время инициализации статических данных и, в свою очередь, осуществляет доступ к статическим данным. Вы можете удалить это предупреждение, используя "#nowarn "69"", если это не так. @@ -1594,12 +1619,12 @@ #I directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file, add a '-I' compiler option for this reference or delimit the directive with delimit it with '#if INTERACTIVE'/'#endif'. - Директивы #I могут встречаться только в файлах скриптов F# (расширения .fsx или .fsscript). Нужно либо переместить данный код в файл скрипта, либо добавить для данной ссылки параметр компилятора "-I", либо ограничить директиву с помощью "#if INTERACTIVE"/"#endif". + Директивы #I можно использовать только в файлах сценариев F# (расширения .fsx или .fsscript). Нужно либо переместить данный код в файл скрипта, либо добавить для данной ссылки параметр компилятора "-I", либо ограничить директиву с помощью "#if INTERACTIVE"/"#endif". #r directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file or replace this reference with the '-r' compiler option. If this directive is being executed as user input, you may delimit it with '#if INTERACTIVE'/'#endif'. - Директивы #r могут встречаться только в файлах сценариев F# (файлы с расширениями .fsx или .fsscript). Переместите этот код в файл сценария или замените эту ссылку параметром компилятора "-r". Если эта директива выполняется в качестве пользовательских входных данных, вы можете заключить ее в блок "#if INTERACTIVE"/"#endif". + Директивы #r можно использовать только в файлах сценариев F# (расширения .fsx или .fsscript). Переместите этот код в файл сценария или замените эту ссылку параметром компилятора "-r". Если эта директива выполняется в качестве пользовательских входных данных, вы можете заключить ее в блок "#if INTERACTIVE"/"#endif". diff --git a/src/Compiler/xlf/FSStrings.tr.xlf b/src/Compiler/xlf/FSStrings.tr.xlf index 6df00c20f72..029b16cd9b5 100644 --- a/src/Compiler/xlf/FSStrings.tr.xlf +++ b/src/Compiler/xlf/FSStrings.tr.xlf @@ -12,6 +12,26 @@ Kısaltmalar \n {2}\nile\n {3} olarak farklı olduğundan imzadaki ve uygulamadaki '{1}' türü için {0} tanımları uyumlu değil + + Nullness warning: {0}. + Nullness warning: {0}. + + + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + + + + Nullness warning: The type '{0}' does not support 'null'. + Nullness warning: The type '{0}' does not support 'null'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n Tür uyuşmazlığı. {0} uzunluğunda türü\n {1} \nolan bir demet bekleniyordu ancak {2} uzunluğunda türü\n {3}{4}\nolan bir demet verildi @@ -37,6 +57,11 @@ Statik üye bekleniyor. + + symbol '|' (directly before 'null') + symbol '|' (directly before 'null') + + symbol '..^' '..^' sembolü @@ -178,7 +203,7 @@ - The {0} '{1}' can not be defined because the name '{2}' clashes with the {3} '{4}' in this type or module + The {0} '{1}' cannot be defined because the name '{2}' clashes with the {3} '{4}' in this type or module {2}' adı bu türde veya modülde {3} '{4}' ile çakıştığı için {0} '{1}' tanımlanamıyor @@ -249,7 +274,7 @@ Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. - Bazı soyut üyelere bir uygulama verilmediğinden bu bir 'abstract' türdür. Bu bilerek yapıldıysa türünüze '[<AbstractClass>]' özniteliğini ekleyin. + Soyut olmayan sınıflar soyut üyeler içeremez. Varsayılan bir üye uygulaması belirtin veya türünüze '[<AbstractClass>]' özniteliğini ekleyin. @@ -1379,7 +1404,7 @@ This recursive use will be checked for initialization-soundness at runtime. This warning is usually harmless, and may be suppressed by using '#nowarn "21"' or '--nowarn:21'. - Bu özyinelemeli kullanım çalışma zamanında başlatma sağlamlığı açısından denetlenecek. Bu uyarı genellikle zararsızdır ve '#nowarn "21"' veya '--nowarn:21' kullanılarak gizlenebilir. + Bu özyinelemeli kullanım çalışma zamanında başlatma sağlamlığı açısından denetlenecek. Bu uyarı genellikle zararsızdır ve '#nowarn "21"' veya '--nowarn:21' kullanılarak gizlenebilir. @@ -1404,7 +1429,7 @@ This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'. - Tanımlanmakta olan nesnelere yönelik bu ve diğer özyinelemeli başvurular, gecikmeli başvuru kullanımı aracılığıyla başlatma sağlamlığı açısından çalışma zamanında denetlenecek. Bunun nedeni, özyinelemeli işlev yerine bir veya daha fazla özyinelemeli nesne tanımlamanızdır. Bu uyarı, '#nowarn "40"' veya '--nowarn:40' kullanılarak gizlenebilir. + Tanımlanmakta olan nesnelere yönelik bu ve diğer özyinelemeli başvurular, gecikmeli başvuru kullanımı aracılığıyla başlatma sağlamlığı açısından çalışma zamanında denetlenecek. Bunun nedeni, özyinelemeli işlev yerine bir veya daha fazla özyinelemeli nesne tanımlamanızdır. Bu uyarı, '#nowarn "40"' veya '--nowarn:40' kullanılarak gizlenebilir. @@ -1524,12 +1549,12 @@ {0}. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. - {0}. Bu uyarı, '--nowarn:57' veya '#nowarn "57"' kullanılarak devre dışı bırakılabilir. + {0}. Bu uyarı, '--nowarn:57' veya '#nowarn "57"' kullanılarak devre dışı bırakılabilir. Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'. - Bu yapının kullanılması doğrulanamayan .NET IL kodunun oluşturulmasıyla sonuçlanabilir. Bu uyarı, '--nowarn:9' veya '#nowarn "9"' kullanılarak devre dışı bırakılabilir. + Bu yapının kullanılması doğrulanamayan .NET IL kodunun oluşturulmasıyla sonuçlanabilir. Bu uyarı, '--nowarn:9' veya '#nowarn "9"' kullanılarak devre dışı bırakılabilir. @@ -1574,7 +1599,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using '#nowarn "69"' if you have checked this is not the case. - Arabirim uygulamaları normalde bir türün ilk bildiriminde verilmelidir. Genişletmelerdeki arabirim uygulamaları, başlatılmadan önce statik bağlamalara erişilmesine neden olabilirse de bu yalnızca arabirim uygulaması statik verilerin başlatılması sırasında çağrılmışsa ve buna bağlı olarak statik verilere erişiyorsa olur. Bunun söz konusu olmadığından eminseniz #nowarn "69" seçeneğini kullanarak bu uyarıyı kaldırabilirsiniz. + Arabirim uygulamaları normalde bir türün ilk bildiriminde verilmelidir. Genişletmelerdeki arabirim uygulamaları, başlatılmadan önce statik bağlamalara erişilmesine neden olabilirse de bu yalnızca arabirim uygulaması statik verilerin başlatılması sırasında çağrılmışsa ve buna bağlı olarak statik verilere erişiyorsa olur. Bunun söz konusu olmadığından eminseniz #nowarn "69" seçeneğini kullanarak bu uyarıyı kaldırabilirsiniz. @@ -1594,12 +1619,12 @@ #I directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file, add a '-I' compiler option for this reference or delimit the directive with delimit it with '#if INTERACTIVE'/'#endif'. - #I yönergeleri yalnızca F# betik dosyalarında (.fsx veya .fsscript uzantılı) görülebilir. Ya bu kodu bir betik dosyasına taşıyıp bu başvuru için bir '-I' derleyici seçeneği ekleyin ya da yönergeyi '#if INTERACTIVE'/'#endif' ile sınırlandırın. + #I yönergeleri yalnızca F# betik dosyalarında (.fsx veya .fsscript uzantılı) kullanılabilir. Ya bu kodu bir betik dosyasına taşıyıp bu başvuru için bir '-I' derleyici seçeneği ekleyin ya da yönergeyi '#if INTERACTIVE'/'#endif' ile sınırlandırın. #r directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file or replace this reference with the '-r' compiler option. If this directive is being executed as user input, you may delimit it with '#if INTERACTIVE'/'#endif'. - #r yönergeleri yalnızca F# betik dosyalarında (.fsx veya .fsscript uzantılı) görülebilir. Bu kodu bir betik dosyasına taşıyın veya bu başvuruyu '-r' derleyici seçeneği ile değiştirin. Yönerge kullanıcı girişi olarak yürütülüyorsa, yönergeyi '#if INTERACTIVE'/'#endif' ile sınırlandırabilirsiniz. + #I yönergeleri yalnızca F# betik dosyalarında (.fsx veya .fsscript uzantılı) kullanılabilir. Bu kodu bir betik dosyasına taşıyın veya bu başvuruyu '-r' derleyici seçeneği ile değiştirin. Yönerge kullanıcı girişi olarak yürütülüyorsa, yönergeyi '#if INTERACTIVE'/'#endif' ile sınırlandırabilirsiniz. diff --git a/src/Compiler/xlf/FSStrings.zh-Hans.xlf b/src/Compiler/xlf/FSStrings.zh-Hans.xlf index c18049f72ed..54599b23672 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hans.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hans.xlf @@ -12,6 +12,26 @@ 签名和实现中类型“{1}”的 {0} 定义不兼容,因为缩写不同:\n {2}\nversus\n {3} + + Nullness warning: {0}. + Nullness warning: {0}. + + + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + + + + Nullness warning: The type '{0}' does not support 'null'. + Nullness warning: The type '{0}' does not support 'null'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n 类型不匹配。应为长度为 {0} 的类型的元组\n {1} \n但提供了长度为 {2} 的类型的元组\n {3}{4}\n @@ -37,6 +57,11 @@ 应为静态成员。 + + symbol '|' (directly before 'null') + symbol '|' (directly before 'null') + + symbol '..^' 符号 "..^" @@ -178,7 +203,7 @@ - The {0} '{1}' can not be defined because the name '{2}' clashes with the {3} '{4}' in this type or module + The {0} '{1}' cannot be defined because the name '{2}' clashes with the {3} '{4}' in this type or module 无法定义 {0}“{1}”,因为名称“{2}”与此类型或模块中的 {3}“{4}”冲突 @@ -249,7 +274,7 @@ Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. - 由于未向一些抽象成员提供实现,因此该类型为 "abstract"。如果是故意如此,请向你的类型添加 "[<AbstractClass>]" 属性。 + 非抽象类不能包含抽象成员。提供默认成员实现或将 “[<AbstractClass>]” 属性添加到类型。 @@ -1379,7 +1404,7 @@ This recursive use will be checked for initialization-soundness at runtime. This warning is usually harmless, and may be suppressed by using '#nowarn "21"' or '--nowarn:21'. - 将检查此递归使用能否在运行时完整地进行初始化。此警告通常是无害的,可以使用“#nowarn "21"”或“--nowarn:21”来取消显示此警告。 + 将检查此递归使用能否在运行时完整地进行初始化。此警告通常是无害的,可以使用“#nowarn "21"”或“--nowarn:21”来取消显示此警告。 @@ -1404,7 +1429,7 @@ This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'. - 将检查对要定义的对象的此引用和其他递归引用,以查看其在运行时能否通过使用延迟的引用来完整地进行初始化。这是因为您定义的是一个或多个递归对象,而不是递归函数。可以使用“#nowarn "40"”或“--nowarn:40”来禁止显示此警告。 + 将检查对要定义的对象的此引用和其他递归引用,以查看其在运行时能否通过使用延迟的引用来完整地进行初始化。这是因为您定义的是一个或多个递归对象,而不是递归函数。可以使用“#nowarn "40"”或“--nowarn:40”来禁止显示此警告。 @@ -1524,12 +1549,12 @@ {0}. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. - {0}。可以使用“--nowarn:57”或“#nowarn "57"”禁用此警告。 + {0}。可以使用“--nowarn:57”或“#nowarn "57"”禁用此警告。 Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'. - 使用此构造可能会导致生成不可验证的 .NET IL 代码。可以使用“--nowarn:9”或“#nowarn "9"”禁用此警告。 + 使用此构造可能会导致生成不可验证的 .NET IL 代码。可以使用“--nowarn:9”或“#nowarn "9"”禁用此警告。 @@ -1574,7 +1599,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using '#nowarn "69"' if you have checked this is not the case. - 通常应在类型的初始声明中提供接口实现。扩充中的接口实现可能会导致在初始化静态绑定之前访问静态绑定,尽管只有在静态数据初始化期间调用了接口实现,并进而访问静态数据时才会发生这种情况。如果已经核实并非如此,则可以使用 #nowarn "69" 移除此警告。 + 通常应在类型的初始声明中提供接口实现。扩充中的接口实现可能会导致在初始化静态绑定之前访问静态绑定,尽管只有在静态数据初始化期间调用了接口实现,并进而访问静态数据时才会发生这种情况。如果已经核实并非如此,则可以使用 '#nowarn "69"' 移除此警告。 @@ -1594,12 +1619,12 @@ #I directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file, add a '-I' compiler option for this reference or delimit the directive with delimit it with '#if INTERACTIVE'/'#endif'. - #I 指令只能出现在 F# 脚本文件(扩展名为 .fsx 或 .fsscript)中。请将此代码添加到脚本文件中、添加此引用的“-I”编译器选项或使用“#if INTERACTIVE”/“#endif”分隔此指令。 + #I 指令只能用于 F# 脚本文件中(文件扩展名为 .fsx 或 .fsscript)。请将此代码添加到脚本文件中、添加此引用的 "-I" 编译器选项或使用 "#if INTERACTIVE"/"#endif" 分隔此指令。 #r directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file or replace this reference with the '-r' compiler option. If this directive is being executed as user input, you may delimit it with '#if INTERACTIVE'/'#endif'. - #r 指令只能出现在 F# 脚本文件(扩展名为 .fsx 或 .fsscript)中。请将此代码移动到脚本文件或使用 "-r" 编译器选项替换此引用。如果该指令作为用户输入执行,则可以使用 "#if INTERACTIVE'/'#endif" 分隔它。 + #r 指令只能用于 F# 脚本文件中(文件扩展名为 .fsx 或 .fsscript)。请将此代码移动到脚本文件或使用 "-r" 编译器选项替换此引用。如果该指令作为用户输入执行,则可以使用 "#if INTERACTIVE"/"#endif" 分隔它。 diff --git a/src/Compiler/xlf/FSStrings.zh-Hant.xlf b/src/Compiler/xlf/FSStrings.zh-Hant.xlf index 2563bb39b11..c200aa576c1 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hant.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hant.xlf @@ -12,6 +12,26 @@ 簽章與實作中類型 '{1}' 的 {0} 定義不相容,因為縮寫不同:\n {2}\n與\n {3} + + Nullness warning: {0}. + Nullness warning: {0}. + + + + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + Nullness warning: The types '{0}' and '{1}' do not have equivalent nullability. + + + + Nullness warning: The type '{0}' does not support 'null'. + Nullness warning: The type '{0}' does not support 'null'. + + + + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + Nullness warning: The types '{0}' and '{1}' do not have compatible nullability. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n 類型不符。必須是類型為\n {1} \n 的元組長度 {0},但提供的是類型為\n {3}{4}\n 的元組長度 {2} @@ -37,6 +57,11 @@ 必須是靜態成員。 + + symbol '|' (directly before 'null') + symbol '|' (directly before 'null') + + symbol '..^' 符號 '..^' @@ -178,7 +203,7 @@ - The {0} '{1}' can not be defined because the name '{2}' clashes with the {3} '{4}' in this type or module + The {0} '{1}' cannot be defined because the name '{2}' clashes with the {3} '{4}' in this type or module 無法定義 {0} '{1}',因為名稱 '{2}' 與這個類型或模組中的 {3} '{4}' 相衝突 @@ -249,7 +274,7 @@ Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. - 因為未提供實作給某些抽象成員,所以此類型為 'abstract'。如果這是預期的情況,則請將 '[<AbstractClass>]' 屬性新增到您的類型。 + 非抽象類別不能包含抽象成員。請提供預設成員實作,或將 '[<AbstractClass>]' 屬性新增至您的類型。 @@ -1379,7 +1404,7 @@ This recursive use will be checked for initialization-soundness at runtime. This warning is usually harmless, and may be suppressed by using '#nowarn "21"' or '--nowarn:21'. - 這個遞迴用途會在執行階段檢查初始化是否正確。這個警告通常是無害的,可以使用 '#nowarn "21"' 或 '--nowarn:21' 予以隱藏。 + 這個遞迴用途會在執行階段檢查初始化是否正確。這個警告通常是無害的,可以使用 '#nowarn "21"' 或 '--nowarn:21' 予以隱藏。 @@ -1404,7 +1429,7 @@ This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'. - 這個和其他對所定義物件的遞迴參考,將在執行階段透過使用延遲參考來檢查初始化是否正確。這是因為您定義的是一個或多個遞迴物件,而不是遞迴函式。使用 '#nowarn "40"' 或 '--nowarn:40' 可以隱藏這個警告。 + 這個和其他對所定義物件的遞迴參考,將在執行階段透過使用延遲參考來檢查初始化是否正確。這是因為您定義的是一個或多個遞迴物件,而不是遞迴函式。使用 '#nowarn "40"' 或 '--nowarn:40' 可以隱藏這個警告。 @@ -1524,12 +1549,12 @@ {0}. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. - {0}。使用 '--nowarn:57' 或 '#nowarn "57"' 可以停用這個警告。 + {0}。使用 '--nowarn:57' 或 '#nowarn "57"' 可以停用這個警告。 Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'. - 使用這個建構可能導致產生無法驗證的 .NET IL 程式碼。使用 '--nowarn:9' 或 '#nowarn "9"' 可以停用這個警告。 + 使用這個建構可能導致產生無法驗證的 .NET IL 程式碼。使用 '--nowarn:9' 或 '#nowarn "9"' 可以停用這個警告。 @@ -1574,7 +1599,7 @@ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using '#nowarn "69"' if you have checked this is not the case. - 通常應該在類型的初始宣告上指定介面實作。擴增中的介面實作可能會在初始化之前存取靜態繫結,但只有在初始化靜態資料時叫用介面實作,並依序存取靜態資料。如果您未檢查過這種情況,可以使用 #nowarn 「69」 移除此警告。 + 通常應該在類型的初始宣告上指定介面實作。擴增中的介面實作可能會在初始化之前存取靜態繫結,但只有在初始化靜態資料時叫用介面實作,並依序存取靜態資料。如果您未檢查過這種情況,可以使用「#nowarn "69"」移除此警告。 @@ -1594,12 +1619,12 @@ #I directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file, add a '-I' compiler option for this reference or delimit the directive with delimit it with '#if INTERACTIVE'/'#endif'. - #I 指示詞只能出現在 F# 指令碼檔案 (副檔名 .fsx 或 .fsscript) 中。請將這個程式碼移到指令碼檔案、為這個參考加入 '-I' 編譯器選項,或用 '#if INTERACTIVE'/'#endif' 分隔這個指示詞。 + #I 指示詞只能用於 F# 指令碼檔案 (副檔名 .fsx 或 .fsscript) 中。請將這個程式碼移到指令碼檔案、為這個參考加入 '-I' 編譯器選項,或用 '#if INTERACTIVE'/'#endif' 分隔這個指示詞。 #r directives may only be used in F# script files (extensions .fsx or .fsscript). Either move this code to a script file or replace this reference with the '-r' compiler option. If this directive is being executed as user input, you may delimit it with '#if INTERACTIVE'/'#endif'. - #r 指示詞只能出現在 F# 指令碼檔案 (副檔名為 .fsx 或 .fsscript) 中。請將此程式碼移至指令碼檔案,或以 '-r' 編譯器選項取代此參考。若此指示詞要以使用者輸入的方式執行,可以使用 '#if INTERACTIVE'/'#endif' 加以分隔。 + #r 指示詞只能用於 F# 指令碼檔案 (副檔名為 .fsx 或 .fsscript) 中。請將此程式碼移至指令碼檔案,或以 '-r' 編譯器選項取代此參考。若此指示詞要以使用者輸入的方式執行,可以使用 '#if INTERACTIVE'/'#endif' 加以分隔。 diff --git a/src/FSharp.Build/FSharp.Build.fsproj b/src/FSharp.Build/FSharp.Build.fsproj index 70f2f534c30..3c392ef1158 100644 --- a/src/FSharp.Build/FSharp.Build.fsproj +++ b/src/FSharp.Build/FSharp.Build.fsproj @@ -4,11 +4,12 @@ Library - netstandard2.0 + netstandard2.0 netstandard2.0 FSharp.Build $(NoWarn);75 true + true $(DefineConstants);LOCALIZATION_FSBUILD $(NoWarn);NU1701;FS0075 true @@ -30,6 +31,7 @@ + diff --git a/src/FSharp.Build/FSharpCommandLineBuilder.fs b/src/FSharp.Build/FSharpCommandLineBuilder.fs index bf86d185edc..51d7b12f1b7 100644 --- a/src/FSharp.Build/FSharpCommandLineBuilder.fs +++ b/src/FSharp.Build/FSharpCommandLineBuilder.fs @@ -15,7 +15,7 @@ do () // Shim to match nullness checking library support in preview [] module Utils = - +#if NO_CHECKNULLS /// Match on the nullness of an argument. let inline (|Null|NonNull|) (x: 'T) : Choice = match x with @@ -24,7 +24,12 @@ module Utils = /// Indicates that a type may be null. 'MaybeNull' used internally in the F# compiler as unchecked /// replacement for 'string?' for example for future FS-1060. - type 'T MaybeNull when 'T: null and 'T: not struct = 'T + type MaybeNull<'T when 'T : null> = 'T +#else + /// Indicates that a type may be null. 'MaybeNull' used internally in the F# compiler as unchecked + /// replacement for 'string?' for example for future FS-1060. + type MaybeNull<'T when 'T : not null and 'T : not struct> = 'T | null +#endif type FSharpCommandLineBuilder() = @@ -84,6 +89,12 @@ type FSharpCommandLineBuilder() = if s <> String.Empty then args <- s :: args + member this.AppendOptionalSwitch(switch: string, value: bool option) = + match value with + | Some true -> this.AppendSwitch($"{switch}+") + | Some false -> this.AppendSwitch($"{switch}-") + | None -> () + member _.AppendSwitchUnquotedIfNotNull(switch: string, value: string MaybeNull) = assert (switch = "") // we only call this method for "OtherFlags" // Unfortunately we still need to mimic what cmd.exe does, but only for "OtherFlags". diff --git a/src/FSharp.Build/FSharpEmbedResourceText.fs b/src/FSharp.Build/FSharpEmbedResourceText.fs index 397842b41f6..ac0adf8329d 100644 --- a/src/FSharp.Build/FSharpEmbedResourceText.fs +++ b/src/FSharp.Build/FSharpEmbedResourceText.fs @@ -288,7 +288,12 @@ open Printf if isNull s then System.Diagnostics.Debug.Assert(false, sprintf ""**RESOURCE ERROR**: Resource token %s does not exist!"" name) #endif + #if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT s + #else + Unchecked.nonNull s + #endif + static let mkFunctionValue (tys: System.Type[]) (impl:obj->obj) = FSharpValue.MakeFunction(FSharpType.MakeFunctionType(tys.[0],tys.[1]), impl) @@ -313,7 +318,11 @@ open Printf // PERF: this technique is a bit slow (e.g. in simple cases, like 'sprintf ""%x""') mkFunctionValue tys (fun inp -> impl rty inp) + #if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT static let capture1 (fmt:string) i args ty (go: obj list -> System.Type -> int -> obj) : obj = + #else + static let capture1 (fmt:string) i args ty (go: objnull list -> System.Type -> int -> obj) : obj = + #endif match fmt.[i] with | '%' -> go args ty (i+1) | 'd' @@ -335,7 +344,11 @@ open Printf if i >= len || (fmt.[i] = '%' && i+1 >= len) then let b = new System.Text.StringBuilder() b.AppendFormat(messageString, [| for x in List.rev args -> x |]) |> ignore + #if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT box(b.ToString()) + #else + box(b.ToString()) |> Unchecked.nonNull + #endif // REVIEW: For these purposes, this should be a nop, but I'm leaving it // in incase we ever decide to support labels for the error format string // E.g., ""%s%d"" @@ -361,6 +374,8 @@ open Printf messageString <- postProcessString messageString createMessageString messageString fmt + static member GetTextOpt(key:string) = GetString(key) |> Option.ofObj + /// If set to true, then all error messages will just return the filled 'holes' delimited by ',,,'s - this is for language-neutral testing (e.g. localization-invariant baselines). static member SwallowResourceText with get () = swallowResourceText and set (b) = swallowResourceText <- b @@ -369,6 +384,9 @@ open Printf let StringBoilerPlateSignature = " // BEGIN BOILERPLATE + + static member GetTextOpt: key:string -> string option + /// If set to true, then all error messages will just return the filled 'holes' delimited by ',,,'s - this is for language-neutral testing (e.g. localization-invariant baselines). static member SwallowResourceText: bool with get, set // END BOILERPLATE" diff --git a/src/FSharp.Build/Fsc.fs b/src/FSharp.Build/Fsc.fs index 74e499ad86e..c18b42a3989 100644 --- a/src/FSharp.Build/Fsc.fs +++ b/src/FSharp.Build/Fsc.fs @@ -27,7 +27,7 @@ type public Fsc() as this = let mutable codePage: string MaybeNull = null let mutable commandLineArgs: ITaskItem list = [] let mutable compilerTools: ITaskItem[] = [||] - let mutable compressMetadata = false + let mutable compressmetadata: bool option = None let mutable debugSymbols = false let mutable debugType: string MaybeNull = null let mutable defineConstants: ITaskItem[] = [||] @@ -56,7 +56,7 @@ type public Fsc() as this = let mutable preferredUILang: string MaybeNull = null let mutable publicSign: bool = false let mutable provideCommandLineArgs: bool = false - let mutable realsig: bool = false + let mutable realsig: bool option = None let mutable references: ITaskItem[] = [||] let mutable referencePath: string MaybeNull = null let mutable refOnly: bool = false @@ -95,6 +95,7 @@ type public Fsc() as this = let mutable vslcid: string MaybeNull = null let mutable utf8output: bool = false let mutable useReflectionFreeCodeGen: bool = false + let mutable nullable: bool option = None /// Trim whitespace ... spaces, tabs, newlines,returns, Double quotes and single quotes let wsCharsToTrim = [| ' '; '\t'; '\"'; '\'' |] @@ -167,8 +168,7 @@ type public Fsc() as this = builder.AppendSwitchIfNotNull("--baseaddress:", baseAddress) // CompressMetadata - if compressMetadata then - builder.AppendSwitch("--compressmetadata") + builder.AppendOptionalSwitch("--compressmetadata", compressmetadata) // DefineConstants for item in defineConstants do @@ -196,15 +196,19 @@ type public Fsc() as this = builder.AppendSwitch("--optimize-") // realsig - if realsig then - builder.AppendSwitch("--realsig+") - else - builder.AppendSwitch("--realsig-") + builder.AppendOptionalSwitch("--realsig", realsig) // Tailcalls if not tailcalls then builder.AppendSwitch("--tailcalls-") + match nullable with + | Some true -> + builder.AppendSwitch("--checknulls+") + builder.AppendSwitch("--define:NULLABLE") + | Some false -> builder.AppendSwitch("--checknulls-") + | None -> () + // PdbFile builder.AppendSwitchIfNotNull("--pdb:", pdbFile) // Platform @@ -230,16 +234,13 @@ type public Fsc() as this = // checksumAlgorithm builder.AppendSwitchIfNotNull( "--checksumalgorithm:", - let ToUpperInvariant (s: string) = - if isNull s then - null - else - s.ToUpperInvariant() - - match ToUpperInvariant(checksumAlgorithm) with - | "SHA1" -> "Sha1" - | "SHA256" -> "Sha256" - | _ -> null + match checksumAlgorithm with + | Null -> null + | NonNull checksumAlgorithm -> + match checksumAlgorithm.ToUpperInvariant() with + | "SHA1" -> "Sha1" + | "SHA256" -> "Sha256" + | _ -> null ) // Resources @@ -380,10 +381,13 @@ type public Fsc() as this = with get () = compilerTools and set (a) = compilerTools <- a - // CompressMetadata + // compressmetadata[+-] member _.CompressMetadata - with get () = compressMetadata - and set (v) = compressMetadata <- v + with get () = + match compressmetadata with + | Some true -> true + | _ -> false + and set (v) = compressmetadata <- Some v // -g: Produce debug file. Disables optimizations if a -O flag is not given. member _.DebugSymbols @@ -539,8 +543,11 @@ type public Fsc() as this = // --realsig[+-] member _.RealSig - with get () = realsig - and set (b) = realsig <- b + with get () = + match realsig with + | Some true -> true + | _ -> false + and set (b) = realsig <- Some b // -r : Reference an F# or .NET assembly. member _.References @@ -652,6 +659,18 @@ type public Fsc() as this = with get () = subsystemVersion and set (p) = subsystemVersion <- p + member _.Nullable + with get () = + match nullable with + | None -> "" + | Some true -> "enable" + | Some false -> "disable" + and set (p) = + match p with + | "enable" -> nullable <- Some true + | "disable" -> nullable <- Some false + | _ -> () + member _.HighEntropyVA with get () = highEntropyVA and set (p) = highEntropyVA <- p diff --git a/src/FSharp.Build/Microsoft.FSharp.Targets b/src/FSharp.Build/Microsoft.FSharp.Targets index 0ac058e30ba..7334f979086 100644 --- a/src/FSharp.Build/Microsoft.FSharp.Targets +++ b/src/FSharp.Build/Microsoft.FSharp.Targets @@ -412,7 +412,8 @@ this file. WarnOn="$(WarnOn)" Win32IconFile="$(ApplicationIcon)" Win32ManifestFile="$(Win32Manifest)" - Win32ResourceFile="$(Win32Resource)"> + Win32ResourceFile="$(Win32Resource)" + Nullable="$(Nullable)"> diff --git a/src/FSharp.Build/SubstituteText.fs b/src/FSharp.Build/SubstituteText.fs index 2e4950a62b3..97e8758ce55 100644 --- a/src/FSharp.Build/SubstituteText.fs +++ b/src/FSharp.Build/SubstituteText.fs @@ -24,7 +24,7 @@ type SubstituteText() = override _.Execute() = copiedFiles.Clear() - if not (isNull embeddedResources) then + if not (isNull (box embeddedResources)) then // this check can't fail, the type is non-nullable for item in embeddedResources do // Update ITaskItem metadata to point to new location let sourcePath = item.GetMetadata("FullPath") diff --git a/src/FSharp.Compiler.Interactive.Settings/fsiaux.fsi b/src/FSharp.Compiler.Interactive.Settings/fsiaux.fsi index 38373efb9bc..1ba7c48ad09 100644 --- a/src/FSharp.Compiler.Interactive.Settings/fsiaux.fsi +++ b/src/FSharp.Compiler.Interactive.Settings/fsiaux.fsi @@ -65,7 +65,7 @@ type InteractiveSession = /// returned by System.Environment.GetCommandLineArgs. member CommandLineArgs: string[] with get, set - /// Gets or sets a the current event loop being used to process interactions. + /// Gets or sets the current event loop being used to process interactions. member EventLoop: IEventLoop with get, set /// Sets the current event loop being used to process interactions. diff --git a/src/FSharp.Core/FSCore.resx b/src/FSharp.Core/FSCore.resx index b90b5442f20..5d5eb67dfde 100644 --- a/src/FSharp.Core/FSCore.resx +++ b/src/FSharp.Core/FSCore.resx @@ -453,7 +453,7 @@ Bad format specifier:{0} - + Bad integer supplied to dynamic formatter @@ -471,7 +471,7 @@ Not a function type - + Bad format specifier (precision) diff --git a/src/FSharp.Core/FSharp.Core.fsproj b/src/FSharp.Core/FSharp.Core.fsproj index 32aeb2fc498..97a02162fa4 100644 --- a/src/FSharp.Core/FSharp.Core.fsproj +++ b/src/FSharp.Core/FSharp.Core.fsproj @@ -34,7 +34,7 @@ FSharp.Core.nuspec true FSharp.Core redistributables from F# Tools version $(FSProductVersionPrefix) For F# $(FSLanguageVersion). Contains code from the F# Software Foundation. - /blob/main/release-notes.md#FSharp-Core-$(FSCoreReleaseNotesVersion) + /blob/main/docs/release-notes/.FSharp.Core/$(FSharpLibrariesChangelogVersion).md Debug;Release;Proto @@ -47,7 +47,7 @@ false false - false + true @@ -68,7 +68,7 @@ - + Primitives/prim-types-prelude.fsi diff --git a/src/FSharp.Core/ILLink.LinkAttributes.xml b/src/FSharp.Core/ILLink.LinkAttributes.xml index 70eba54ff4e..47a3ff01f02 100644 --- a/src/FSharp.Core/ILLink.LinkAttributes.xml +++ b/src/FSharp.Core/ILLink.LinkAttributes.xml @@ -169,5 +169,11 @@ + + + + + + diff --git a/src/FSharp.Core/ILLink.Substitutions.xml b/src/FSharp.Core/ILLink.Substitutions.xml index 42d44a0b4c4..13ceee32a14 100644 --- a/src/FSharp.Core/ILLink.Substitutions.xml +++ b/src/FSharp.Core/ILLink.Substitutions.xml @@ -4,5 +4,10 @@ + + + + + diff --git a/src/FSharp.Core/Linq.fs b/src/FSharp.Core/Linq.fs index cf7033e09db..12ae077dfdb 100644 --- a/src/FSharp.Core/Linq.fs +++ b/src/FSharp.Core/Linq.fs @@ -55,15 +55,15 @@ module LeafExpressionConverter = tyargs.[0], tyargs.[1] let StringConcat = - methodhandleof (fun (x:obj, y:obj) -> String.Concat (x, y)) + methodhandleof (fun (x:objnull, y:objnull) -> String.Concat (x, y)) |> System.Reflection.MethodInfo.GetMethodFromHandle :?> MethodInfo - let SubstHelperRaw (q:Expr, x:Var array, y:obj array) : Expr = + let SubstHelperRaw (q:Expr, x:Var array, y:objnull array) : Expr = let d = Map.ofArray (Array.zip x y) q.Substitute(fun v -> v |> d.TryFind |> Option.map (fun x -> Expr.Value (x, v.Type))) - let SubstHelper<'T> (q:Expr, x:Var array, y:obj array) : Expr<'T> = + let SubstHelper<'T> (q:Expr, x:Var array, y:objnull array) : Expr<'T> = SubstHelperRaw(q, x, y) |> Expr.Cast let showAll = @@ -393,12 +393,12 @@ module LeafExpressionConverter = //let (|ArrayAssignQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun -> LanguagePrimitives.IntrinsicFunctions.SetArray : int array -> int -> int -> unit)) //let (|ArrayTypeQ|_|) (ty:System.Type) = if ty.IsArray && ty.GetArrayRank() = 1 then Some (ty.GetElementType()) else None let substHelperMeth = - methodhandleof (fun (x:Expr, y:Var array, z:obj array) -> SubstHelper (x, y, z)) + methodhandleof (fun (x:Expr, y:Var array, z:objnull array) -> SubstHelper (x, y, z)) |> System.Reflection.MethodInfo.GetMethodFromHandle :?> MethodInfo let substHelperRawMeth = - methodhandleof (fun (x:Expr, y:Var array, z:obj array) -> SubstHelperRaw (x, y, z)) + methodhandleof (fun (x:Expr, y:Var array, z:objnull array) -> SubstHelperRaw (x, y, z)) |> System.Reflection.MethodInfo.GetMethodFromHandle :?> MethodInfo @@ -895,7 +895,7 @@ module LeafExpressionConverter = // provides no other way to evaluate the expression. // // REVIEW: It is possible it is just better to interpret the expression in many common cases, e.g. property-gets, values etc. - let EvaluateQuotation (e: Microsoft.FSharp.Quotations.Expr) : obj = + let EvaluateQuotation (e: Microsoft.FSharp.Quotations.Expr) : objnull = #if FX_NO_QUOTATIONS_COMPILE raise (new NotSupportedException()) #else diff --git a/src/FSharp.Core/Linq.fsi b/src/FSharp.Core/Linq.fsi index 5064de12f55..f03cc7976d3 100644 --- a/src/FSharp.Core/Linq.fsi +++ b/src/FSharp.Core/Linq.fsi @@ -71,21 +71,21 @@ module LeafExpressionConverter = /// /// /// - val EvaluateQuotation: Expr -> obj + val EvaluateQuotation: Expr -> objnull /// /// A runtime helper used to evaluate nested quotation literals. /// /// /// - val SubstHelper: Expr * Var array * obj array -> Expr<'T> + val SubstHelper: Expr * Var array * objnull array -> Expr<'T> /// /// A runtime helper used to evaluate nested quotation literals. /// /// /// - val SubstHelperRaw: Expr * Var array * obj array -> Expr + val SubstHelperRaw: Expr * Var array * objnull array -> Expr val internal (|SpecificCallToMethod|_|): System.RuntimeMethodHandle -> (Expr -> (Expr option * Reflection.MethodInfo * Expr list) option) diff --git a/src/FSharp.Core/Query.fs b/src/FSharp.Core/Query.fs index 9905362371d..de1435df688 100644 --- a/src/FSharp.Core/Query.fs +++ b/src/FSharp.Core/Query.fs @@ -372,7 +372,7 @@ module Query = let CallGenericStaticMethod (methHandle:System.RuntimeMethodHandle) = let methInfo = methHandle |> System.Reflection.MethodInfo.GetMethodFromHandle :?> MethodInfo - fun (tyargs: Type list, args: obj list) -> + fun (tyargs: Type list, args: objnull list) -> let methInfo = if methInfo.IsGenericMethod then methInfo.MakeGenericMethod(Array.ofList tyargs) else methInfo try methInfo.Invoke(null, Array.ofList args) @@ -381,7 +381,7 @@ module Query = let CallGenericInstanceMethod (methHandle:System.RuntimeMethodHandle) = let methInfo = methHandle |> System.Reflection.MethodInfo.GetMethodFromHandle :?> MethodInfo - fun (objExpr:obj, tyargs: Type list, args: obj list) -> + fun (objExpr:obj, tyargs: Type list, args: objnull list) -> let methInfo = if methInfo.IsGenericMethod then methInfo.MakeGenericMethod(Array.ofList tyargs) else methInfo try methInfo.Invoke(objExpr, Array.ofList args) @@ -467,7 +467,7 @@ module Query = else ME ([srcItemTy], [src; key]) - let Call (isIQ, srcItemTy, src:obj, key: Expr) = + let Call (isIQ, srcItemTy, src:objnull, key: Expr) = let key = key |> LeafExpressionConverter.EvaluateQuotation let C = if isIQ then CQ else CE C ([srcItemTy], [src; box key]) @@ -496,7 +496,7 @@ module Query = else ME ([srcItemTy; keyElemTy], [src; valSelector]) - let Call (isIQ, srcItemTy: Type, _keyItemTy: Type, src:obj, keyElemTy: Type, v: Var, res: Expr) = + let Call (isIQ, srcItemTy: Type, _keyItemTy: Type, src:objnull, keyElemTy: Type, v: Var, res: Expr) = if isIQ then let selector = FuncExprToLinqFunc2Expression (srcItemTy, keyElemTy, v, res) CQ ([srcItemTy; keyElemTy], [src; box selector]) @@ -505,7 +505,7 @@ module Query = CE ([srcItemTy; keyElemTy], [src; selector]) Make, Call - let (MakeMinBy: bool * Expr * Var * Expr -> Expr), (CallMinBy : bool * Type * Type * obj * Type * Var * Expr -> obj) = + let (MakeMinBy: bool * Expr * Var * Expr -> Expr), (CallMinBy : bool * Type * Type * objnull * Type * Var * Expr -> obj) = let FQ = methodhandleof (fun (x, y: Expression>) -> System.Linq.Queryable.Min(x, y)) let FE = methodhandleof (fun (x, y: Func<_, 'Result>) -> Enumerable.Min(x, y)) MakeOrCallMinByOrMaxBy FQ FE @@ -539,7 +539,7 @@ module Query = else ME ([srcItemTy], [src; predicate]) - let Call (isIQ, srcItemTy: Type, src:obj, v: Var, res: Expr) = + let Call (isIQ, srcItemTy: Type, src:objnull, v: Var, res: Expr) = if isIQ then let selector = FuncExprToLinqFunc2Expression (srcItemTy, boolTy, v, res) CQ ([srcItemTy], [src; box selector]) @@ -612,7 +612,7 @@ module Query = let selector = Expr.Lambda (v, res) ME (qb, [srcItemTy; qTy; resTyNoNullable], [src; selector]) - let Call (qb:obj, isIQ, srcItemTy: Type, resTyNoNullable: Type, src:obj, resTy: Type, v: Var, res: Expr) = + let Call (qb:obj, isIQ, srcItemTy: Type, resTyNoNullable: Type, src:objnull, resTy: Type, v: Var, res: Expr) = if isIQ then let selector = FuncExprToLinqFunc2Expression (srcItemTy, resTy, v, res) let caller = @@ -1260,12 +1260,12 @@ module Query = | TransInnerResult.Select(canElim, isQTy, mutSource, mutSelectorVar, mutSelectorBody) -> MakeSelect(canElim, isQTy, CommitTransInnerResult mutSource, mutSelectorVar, mutSelectorBody) - /// Given a the inner of query expression in terms of query.For, query.Select, query.Yield, query.Where etc., + /// Given the inner of query expression in terms of query.For, query.Select, query.Yield, query.Where etc., /// and including immutable tuples and immutable records, build an equivalent query expression /// in terms of LINQ operators, operating over mutable tuples. Return the conversion /// information for the immutable-to-mutable conversion performed so we can undo it where needed. /// - /// Here 'inner' refers the the part of the query that produces a sequence of results. + /// Here 'inner' refers the part of the query that produces a sequence of results. /// /// The output query will use either Queryable.* or Enumerable.* operators depending on whether /// the inputs to the queries have type IQueryable or IEnumerable. @@ -1605,7 +1605,7 @@ module Query = // propagate a immutable-->mutable-->immutable translation if any. // /// This is used on recursive translations of yielded elements to translate nested queries - /// in 'yield' position and still propagate information about a possible imutable->mutable->mutable + /// in 'yield' position and still propagate information about a possible immutable->mutable->mutable // translation. // e.g. yield (1, query { ... }) and TransInnerNoCheck e = @@ -1657,7 +1657,7 @@ module Query = /// Given a query expression in terms of query.For, query.Select, query.Yield, query.Where etc., /// and including immutable tuples and immutable records, build an equivalent query expression - /// in terms of LINQ operators, operating over mutable tuples. If necessary, also add a "postifx" in-memory transformation + /// in terms of LINQ operators, operating over mutable tuples. If necessary, also add a "postfix" in-memory transformation /// converting the data back to immutable tuples and records. let TransInnerWithFinalConsume canElim immutSource = let mutSource, sourceConv = TransInnerAndCommit canElim true immutSource diff --git a/src/FSharp.Core/array.fs b/src/FSharp.Core/array.fs index 77153012a5e..63df73e5014 100644 --- a/src/FSharp.Core/array.fs +++ b/src/FSharp.Core/array.fs @@ -836,12 +836,21 @@ module Array = count +#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT let private createMask<'a> (f: 'a -> bool) (src: 'a array) (maskArrayOut: byref) (leftoverMaskOut: byref) = +#else + let private createMask<'a> + (f: 'a -> bool) + (src: array<'a>) + (maskArrayOut: byref | null>) + (leftoverMaskOut: byref) + = +#endif let maskArrayLength = src.Length / 0x20 // null when there are less than 32 items in src array. @@ -1031,7 +1040,11 @@ module Array = dstIdx +#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT let private filterViaMask (maskArray: uint32 array) (leftoverMask: uint32) (count: int) (src: _ array) = +#else + let private filterViaMask (maskArray: uint32 array | null) (leftoverMask: uint32) (count: int) (src: _ array) = +#endif let dst = Microsoft.FSharp.Primitives.Basics.Array.zeroCreateUnchecked count let mutable dstIdx = 0 @@ -2166,9 +2179,8 @@ module Array = // Not exists $condition <==> (opposite of $condition is true forall) exists (predicate >> not) array |> not - [] - let tryFindIndex predicate (array: _ array) = - checkNonNull "array" array + let inline tryFindIndexAux predicate (array: _ array) = + checkNonNull (nameof array) array let pResult = Parallel.For( @@ -2179,16 +2191,24 @@ module Array = pState.Break()) ) - pResult.LowestBreakIteration |> Option.ofNullable |> Option.map int + pResult.LowestBreakIteration + + [] + let tryFindIndex predicate (array: _ array) = + let i = tryFindIndexAux predicate array + if i.HasValue then Some (int (i.GetValueOrDefault())) + else None [] let tryFind predicate (array: _ array) = - array |> tryFindIndex predicate |> Option.map (fun i -> array[i]) + let i = tryFindIndexAux predicate array + if i.HasValue then Some array[int (i.GetValueOrDefault())] + else None [] let tryPick chooser (array: _ array) = checkNonNull "array" array - let allChosen = new System.Collections.Concurrent.ConcurrentDictionary<_, _>() + let allChosen = System.Collections.Concurrent.ConcurrentDictionary() let pResult = Parallel.For( @@ -2202,9 +2222,8 @@ module Array = pState.Break()) ) - pResult.LowestBreakIteration - |> Option.ofNullable - |> Option.bind (fun i -> allChosen[int i]) + if pResult.LowestBreakIteration.HasValue then allChosen[int (pResult.LowestBreakIteration.GetValueOrDefault())] + else None [] let choose chooser (array: 'T array) = @@ -2700,12 +2719,12 @@ module Array = | _ -> let left, right = partitioningFunc segment // If either of the two is too small, sort small segments straight away. - // If the other happens to be big, leave it with all workes in it's recursive step + // If the other happens to be big, leave it with all works in its recursive step if left.Count <= minChunkSize || right.Count <= minChunkSize then sortChunk left freeWorkers sortChunk right freeWorkers else - // Pivot-based partitions might be inbalanced. Split free workers for left/right proportional to their size + // Pivot-based partitions might be unbalanced. Split free workers for left/right proportional to their size let itemsPerWorker = Operators.max ((left.Count + right.Count) / freeWorkers) 1 let workersForLeftTask = @@ -2777,8 +2796,8 @@ module Array = let sortingComparer: IComparer<'T> = LanguagePrimitives.FastGenericComparerCanBeNull<'T> - let partioningFunc = compare - sortInPlaceWithHelper partioningFunc sortingComparer array + let partitioningFunc = compare + sortInPlaceWithHelper partitioningFunc sortingComparer array [] let sortWith (comparer: 'T -> 'T -> int) (array: 'T array) = diff --git a/src/FSharp.Core/array.fsi b/src/FSharp.Core/array.fsi index 8947a2a8d07..6e76dbc32c6 100644 --- a/src/FSharp.Core/array.fsi +++ b/src/FSharp.Core/array.fsi @@ -2090,7 +2090,7 @@ module Array = /// | In i -> acc + i /// | Out o -> acc - o) /// - /// Evaluates to [|0; 1; -1; 2|]. Note 0 is the intial + /// Evaluates to [|0; 1; -1; 2|]. Note 0 is the initial /// state, 1 the next state, -1 the next state, and 2 the final state. /// [] @@ -2119,7 +2119,7 @@ module Array = /// | In i -> acc + i /// | Out o -> acc - o) /// - /// Evaluates to [|2; 1; 3; 0|] by processing each input from back to front. Note 0 is the intial + /// Evaluates to [|2; 1; 3; 0|] by processing each input from back to front. Note 0 is the initial /// state, 3 the next state, 1 the next state, and 2 the final state. /// [] @@ -3443,7 +3443,6 @@ module Array = /// /// [] - [] val forall: predicate: ('T -> bool) -> array: 'T array -> bool /// Tests if any element of the array satisfies the given predicate. @@ -3477,7 +3476,6 @@ module Array = /// Evaluates to false /// [] - [] val exists: predicate: ('T -> bool) -> array: 'T array -> bool /// Returns the first element for which the given function returns True. @@ -3508,7 +3506,6 @@ module Array = /// Evaluates to None /// [] - [] val tryFind: predicate: ('T -> bool) -> array: 'T array -> 'T option /// Returns the index of the first element in the array @@ -3539,7 +3536,6 @@ module Array = /// Evaluates to None /// [] - [] val tryFindIndex: predicate: ('T -> bool) -> array: 'T array -> int option /// Applies the given function to successive elements, returning the first @@ -3572,7 +3568,6 @@ module Array = /// /// [] - [] val tryPick: chooser: ('T -> 'U option) -> array: 'T array -> 'U option /// Applies a function to each element of the array in parallel, threading an accumulator argument @@ -3600,7 +3595,6 @@ module Array = /// [] - [] val inline reduce: reduction: ('T -> 'T -> 'T) -> array: 'T array -> 'T /// Applies a projection function to each element of the array in parallel, reducing elements in each thread with a dedicated 'reduction' function. @@ -3628,7 +3622,6 @@ module Array = /// [] - [] val reduceBy: projection: ('T -> 'U) -> reduction: ('U -> 'U -> 'U) -> array: 'T array -> 'U /// Returns the greatest of all elements of the array, compared via Operators.max. @@ -3660,7 +3653,6 @@ module Array = /// Throws System.ArgumentException. /// [] - [] val inline max: array: 'T array -> 'T when 'T: comparison /// Returns the greatest of all elements of the array, compared via Operators.max on the function result. @@ -3693,7 +3685,6 @@ module Array = /// Throws System.ArgumentException. /// [] - [] val inline maxBy: projection: ('T -> 'U) -> array: 'T array -> 'T when 'U: comparison /// Returns the smallest of all elements of the array, compared via Operators.min. @@ -3725,7 +3716,6 @@ module Array = /// Throws System.ArgumentException. /// [] - [] val inline min: array: 'T array -> 'T when 'T: comparison /// Returns the lowest of all elements of the array, compared via Operators.min on the function result. @@ -3758,7 +3748,6 @@ module Array = /// Throws System.ArgumentException. /// [] - [] val inline minBy: projection: ('T -> 'U) -> array: 'T array -> 'T when 'U: comparison /// Returns the sum of the elements in the array. @@ -3778,7 +3767,6 @@ module Array = /// Evaluates to 11. /// [] - [] val inline sum: array: ^T array -> ^T when ^T: (static member (+): ^T * ^T -> ^T) and ^T: (static member Zero: ^T) @@ -3800,7 +3788,6 @@ module Array = /// Evaluates to 7. /// [] - [] val inline sumBy: projection: ('T -> ^U) -> array: 'T array -> ^U when ^U: (static member (+): ^U * ^U -> ^U) and ^U: (static member Zero: ^U) @@ -3828,7 +3815,6 @@ module Array = /// Throws ArgumentException /// [] - [] val inline average: array: ^T array -> ^T when ^T: (static member (+): ^T * ^T -> ^T) and ^T: (static member DivideByInt: ^T * int -> ^T) @@ -3866,7 +3852,6 @@ module Array = /// Throws ArgumentException /// [] - [] val inline averageBy: projection: ('T -> ^U) -> array: 'T array -> ^U when ^U: (static member (+): ^U * ^U -> ^U) and ^U: (static member DivideByInt: ^U * int -> ^U) @@ -4012,7 +3997,6 @@ module Array = /// [] - [] val groupBy: projection: ('T -> 'Key) -> array: 'T array -> ('Key * 'T array) array when 'Key: equality /// Apply the given function to each element of the array. @@ -4132,7 +4116,6 @@ module Array = /// Evaluates to [| 1; 1 3; 4; 6; 8 |]. /// [] - [] val sort: array: 'T array -> 'T array when 'T: comparison /// Sorts the elements of an array in parallel, using the given projection for the keys and returning a new array. @@ -4158,7 +4141,6 @@ module Array = /// [] - [] val sortBy: projection: ('T -> 'Key) -> array: 'T array -> 'T array when 'Key: comparison /// Sorts the elements of an array in parallel, using the given comparison function as the order, returning a new array. @@ -4187,7 +4169,6 @@ module Array = /// Evaluates to [|(0, "aa"); (2, "cc"); (3, "dd"); (1, "bbb")|]. /// [] - [] val sortWith: comparer: ('T -> 'T -> int) -> array: 'T array -> 'T array /// Sorts the elements of an array by mutating the array in-place in parallel, using the given projection for the keys. @@ -4210,7 +4191,6 @@ module Array = /// After evaluation array contains [|"a"; "dd"; "bbb"; "cccc"|]. /// [] - [] val sortInPlaceBy: projection: ('T -> 'Key) -> array: 'T array -> unit when 'Key: comparison /// Sorts the elements of an array by mutating the array in-place in parallel, using the given comparison function as the order. @@ -4234,7 +4214,6 @@ module Array = /// After evaluation array contains [|(0, "aa"); (2, "cc"); (3, "dd"); (1, "bbb")|]. /// [] - [] val sortInPlaceWith: comparer: ('T -> 'T -> int) -> array: 'T array -> unit /// Sorts the elements of an array by mutating the array in-place in parallel, using the given comparison function. @@ -4253,7 +4232,6 @@ module Array = /// After evaluation array contains [| 1; 1; 3; 4; 6; 8 |]. /// [] - [] val sortInPlace: array: 'T array -> unit when 'T: comparison /// Sorts the elements of an array in parallel, in descending order, returning a new array. Elements are compared using . @@ -4274,7 +4252,6 @@ module Array = /// Evaluates to [| 8; 6; 4; 3; 1; 1 |]. /// [] - [] val sortDescending: array: 'T array -> 'T array when 'T: comparison /// Sorts the elements of an array in parallel, in descending order, using the given projection for the keys and returning a new array. @@ -4297,7 +4274,6 @@ module Array = /// Evaluates to [|"cccc"; "bbb"; "dd"; "a"|]. /// [] - [] val sortByDescending: projection: ('T -> 'Key) -> array: 'T array -> 'T array when 'Key: comparison /// Combines the two arrays into an array of pairs. The two arrays must have equal lengths, otherwise an ArgumentException is @@ -4321,7 +4297,6 @@ module Array = /// Evaluates to [| (1, "one"); (2, "two") |]. /// [] - [] val zip: array1: 'T1 array -> array2: 'T2 array -> ('T1 * 'T2) array /// Returns a new collection containing only the elements of the collection @@ -4343,5 +4318,4 @@ module Array = /// Evaluates to [| 2; 4 |] /// [] - [] val filter: predicate: ('T -> bool) -> array: 'T array -> 'T array diff --git a/src/FSharp.Core/async.fs b/src/FSharp.Core/async.fs index 9f9a2d1ef48..1c5138b93dc 100644 --- a/src/FSharp.Core/async.fs +++ b/src/FSharp.Core/async.fs @@ -822,7 +822,7 @@ module AsyncPrimitives = WhileLoop()) #endif - /// Implement the for loop construct of async commputation expressions + /// Implement the for loop construct of async computation expressions /// - No initial cancellation check before GetEnumerator call. /// - No initial cancellation check before entering protection of implied try/finally /// - Cancellation check after 'entering' the implied try/finally and before loop @@ -867,8 +867,12 @@ module AsyncPrimitives = #endif /// - Initial cancellation check - /// - Call syncCtxt.Post with exception protection. THis may fail as it is arbitrary user code + /// - Call syncCtxt.Post with exception protection. This may fail as it is arbitrary user code +#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT let CreateSwitchToAsync (syncCtxt: SynchronizationContext) = +#else + let CreateSwitchToAsync (syncCtxt: SynchronizationContext | null) = +#endif MakeAsyncWithCancelCheck(fun ctxt -> ctxt.PostWithTrampoline syncCtxt ctxt.cont) /// - Initial cancellation check @@ -1072,7 +1076,7 @@ module AsyncPrimitives = /// Create an instance of an arbitrary delegate type delegating to the given F# function type FuncDelegate<'T>(f) = - member _.Invoke(sender: obj, a: 'T) : unit = + member _.Invoke(sender: objnull, a: 'T) : unit = ignore sender f a @@ -1305,7 +1309,7 @@ module AsyncPrimitives = | None -> () [] - type AsyncIAsyncResult<'T>(callback: System.AsyncCallback, state: obj) = + type AsyncIAsyncResult<'T>(callback: System.AsyncCallback, state: objnull) = // This gets set to false if the result is not available by the // time the IAsyncResult is returned to the caller of Begin let mutable completedSynchronously = true @@ -2031,7 +2035,7 @@ type Async = // Register the result. resultCell.RegisterResult(res, reuseThread = true) |> unfake) - let (iar: IAsyncResult) = beginAction (callback, (null: obj)) + let (iar: IAsyncResult) = beginAction (callback, (null: objnull)) if iar.CompletedSynchronously then // Ensure cancellation is not possible beyond this point @@ -2063,7 +2067,7 @@ type Async = static member AsBeginEnd<'Arg, 'T> (computation: ('Arg -> Async<'T>)) // The 'Begin' member - : ('Arg * System.AsyncCallback * obj -> System.IAsyncResult) * + : ('Arg * System.AsyncCallback * objnull -> System.IAsyncResult) * (System.IAsyncResult -> 'T) * (System.IAsyncResult -> unit) = @@ -2330,7 +2334,7 @@ module WebExtensions = Async.FromContinuations(fun (cont, econt, ccont) -> let userToken = obj () - let rec delegate' (_: obj) (args: #ComponentModel.AsyncCompletedEventArgs) = + let rec delegate' (_: objnull) (args: #ComponentModel.AsyncCompletedEventArgs) = // ensure we handle the completed event from correct download call if userToken = args.UserState then event.RemoveHandler handle diff --git a/src/FSharp.Core/async.fsi b/src/FSharp.Core/async.fsi index 6b621176c9d..1cd02f9694b 100644 --- a/src/FSharp.Core/async.fsi +++ b/src/FSharp.Core/async.fsi @@ -860,7 +860,7 @@ namespace Microsoft.FSharp.Control /// Legacy .NET Async Interoperability /// /// - static member FromBeginEnd : beginAction:(System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction : (unit -> unit) -> Async<'T> + static member FromBeginEnd : beginAction:(System.AsyncCallback * objnull -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction : (unit -> unit) -> Async<'T> /// /// Creates an asynchronous computation in terms of a Begin/End pair of actions in @@ -885,7 +885,7 @@ namespace Microsoft.FSharp.Control /// Legacy .NET Async Interoperability /// /// - static member FromBeginEnd : arg:'Arg1 * beginAction:('Arg1 * System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction : (unit -> unit) -> Async<'T> + static member FromBeginEnd : arg:'Arg1 * beginAction:('Arg1 * System.AsyncCallback * objnull -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction : (unit -> unit) -> Async<'T> /// /// Creates an asynchronous computation in terms of a Begin/End pair of actions in @@ -909,7 +909,7 @@ namespace Microsoft.FSharp.Control /// Legacy .NET Async Interoperability /// /// - static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * beginAction:('Arg1 * 'Arg2 * System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction : (unit -> unit) -> Async<'T> + static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * beginAction:('Arg1 * 'Arg2 * System.AsyncCallback * objnull -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction : (unit -> unit) -> Async<'T> /// Creates an asynchronous computation in terms of a Begin/End pair of actions in /// the style used in .NET 2.0 APIs. @@ -933,7 +933,7 @@ namespace Microsoft.FSharp.Control /// Legacy .NET Async Interoperability /// /// - static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * arg3:'Arg3 * beginAction:('Arg1 * 'Arg2 * 'Arg3 * System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction : (unit -> unit) -> Async<'T> + static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * arg3:'Arg3 * beginAction:('Arg1 * 'Arg2 * 'Arg3 * System.AsyncCallback * objnull -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction : (unit -> unit) -> Async<'T> /// Creates three functions that can be used to implement the .NET 1.0 Asynchronous /// Programming Model (APM) for a given asynchronous computation. @@ -948,7 +948,7 @@ namespace Microsoft.FSharp.Control /// static member AsBeginEnd : computation:('Arg -> Async<'T>) -> // The 'Begin' member - ('Arg * System.AsyncCallback * obj -> System.IAsyncResult) * + ('Arg * System.AsyncCallback * objnull -> System.IAsyncResult) * // The 'End' member (System.IAsyncResult -> 'T) * // The 'Cancel' member @@ -1040,7 +1040,7 @@ namespace Microsoft.FSharp.Control /// /// /// If no cancellation token is provided then the default cancellation token is used. - /// You may prefer using this method if you want to achive a similar behviour to async await in C# as + /// You may prefer using this method if you want to achieve a similar behavior to async await in C# as /// async computation starts on the current thread with an ability to return a result. /// /// diff --git a/src/FSharp.Core/collections.fsi b/src/FSharp.Core/collections.fsi index 9baf6097394..782de2a3364 100644 --- a/src/FSharp.Core/collections.fsi +++ b/src/FSharp.Core/collections.fsi @@ -101,7 +101,7 @@ module HashIdentity = val inline NonStructural<'T> : IEqualityComparer< ^T > when ^T: equality and ^T: (static member (=): ^T * ^T -> bool) - /// Get an implementation of equality semantics semantics using limited structural equality and structural hashing. + /// Get an implementation of equality semantics using limited structural equality and structural hashing. /// /// The limit on the number of hashing operations used. /// diff --git a/src/FSharp.Core/event.fs b/src/FSharp.Core/event.fs index 338d7275fc3..483ea38d64f 100644 --- a/src/FSharp.Core/event.fs +++ b/src/FSharp.Core/event.fs @@ -31,7 +31,7 @@ module private Atomic = type DelegateEvent<'Delegate when 'Delegate :> System.Delegate>() = let mutable multicast: System.Delegate = null - member x.Trigger(args: obj array) = + member x.Trigger(args: objnull array) = match multicast with | null -> () | d -> d.DynamicInvoke(args) |> ignore @@ -54,30 +54,30 @@ type EventDelegee<'Args>(observer: System.IObserver<'Args>) = assert false null // should not be called, one-argument case don't use makeTuple function - member x.Invoke(_sender: obj, args: 'Args) = + member x.Invoke(_sender: objnull, args: 'Args) = observer.OnNext args - member x.Invoke(_sender: obj, a, b) = + member x.Invoke(_sender: objnull, a, b) = let args = makeTuple ([| a; b |]) :?> 'Args observer.OnNext args - member x.Invoke(_sender: obj, a, b, c) = + member x.Invoke(_sender: objnull, a, b, c) = let args = makeTuple ([| a; b; c |]) :?> 'Args observer.OnNext args - member x.Invoke(_sender: obj, a, b, c, d) = + member x.Invoke(_sender: objnull, a, b, c, d) = let args = makeTuple ([| a; b; c; d |]) :?> 'Args observer.OnNext args - member x.Invoke(_sender: obj, a, b, c, d, e) = + member x.Invoke(_sender: objnull, a, b, c, d, e) = let args = makeTuple ([| a; b; c; d; e |]) :?> 'Args observer.OnNext args - member x.Invoke(_sender: obj, a, b, c, d, e, f) = + member x.Invoke(_sender: objnull, a, b, c, d, e, f) = let args = makeTuple ([| a; b; c; d; e; f |]) :?> 'Args observer.OnNext args -type EventWrapper<'Delegate, 'Args> = delegate of 'Delegate * obj * 'Args -> unit +type EventWrapper<'Delegate, 'Args> = delegate of 'Delegate * objnull * 'Args -> unit [] type Event<'Delegate, 'Args @@ -122,7 +122,7 @@ type Event<'Delegate, 'Args else mi - member x.Trigger(sender: obj, args: 'Args) = + member x.Trigger(sender: objnull, args: 'Args) = // Copy multicast value into local variable to avoid changing during member call. let multicast = multicast diff --git a/src/FSharp.Core/event.fsi b/src/FSharp.Core/event.fsi index 09225b9b0fa..0a52d440c0e 100644 --- a/src/FSharp.Core/event.fsi +++ b/src/FSharp.Core/event.fsi @@ -23,7 +23,7 @@ type DelegateEvent<'Delegate when 'Delegate :> System.Delegate> = /// The parameters for the event. /// /// - member Trigger: args: obj array -> unit + member Trigger: args: objnull array -> unit /// Publishes the event as a first class event value. /// @@ -49,7 +49,7 @@ type Event<'Delegate, 'Args /// The parameters for the event. /// /// - member Trigger: sender: obj * args: 'Args -> unit + member Trigger: sender: objnull * args: 'Args -> unit /// Publishes the event as a first class event value. /// diff --git a/src/FSharp.Core/fslib-extra-pervasives.fs b/src/FSharp.Core/fslib-extra-pervasives.fs index b5cf5dee3af..8ce025606eb 100644 --- a/src/FSharp.Core/fslib-extra-pervasives.fs +++ b/src/FSharp.Core/fslib-extra-pervasives.fs @@ -483,7 +483,7 @@ type ITypeProvider = abstract GetStaticParameters: typeWithoutArguments: Type -> ParameterInfo array abstract ApplyStaticArguments: - typeWithoutArguments: Type * typePathWithArguments: string array * staticArguments: obj array -> Type + typeWithoutArguments: Type * typePathWithArguments: string array * staticArguments: objnull array -> Type abstract GetInvokerExpression: syntheticMethodBase: MethodBase * parameters: Expr array -> Expr @@ -496,4 +496,5 @@ type ITypeProvider2 = abstract GetStaticParametersForMethod: methodWithoutArguments: MethodBase -> ParameterInfo array abstract ApplyStaticArgumentsForMethod: - methodWithoutArguments: MethodBase * methodNameWithArguments: string * staticArguments: obj array -> MethodBase + methodWithoutArguments: MethodBase * methodNameWithArguments: string * staticArguments: objnull array -> + MethodBase diff --git a/src/FSharp.Core/fslib-extra-pervasives.fsi b/src/FSharp.Core/fslib-extra-pervasives.fsi index 97120245f87..aff5d162b0a 100644 --- a/src/FSharp.Core/fslib-extra-pervasives.fsi +++ b/src/FSharp.Core/fslib-extra-pervasives.fsi @@ -542,7 +542,7 @@ namespace Microsoft.FSharp.Core.CompilerServices /// the static parameters, indexed by name /// /// - abstract ApplyStaticArguments : typeWithoutArguments:Type * typePathWithArguments:string array * staticArguments:obj array -> Type + abstract ApplyStaticArguments : typeWithoutArguments:Type * typePathWithArguments:string array * staticArguments:objnull array -> Type /// /// Called by the compiler to ask for an Expression tree to replace the given MethodBase with. @@ -586,4 +586,4 @@ namespace Microsoft.FSharp.Core.CompilerServices /// the values of the static parameters, indexed by name /// /// The provided method definition corresponding to the given static parameter values - abstract ApplyStaticArgumentsForMethod : methodWithoutArguments:MethodBase * methodNameWithArguments:string * staticArguments:obj array -> MethodBase + abstract ApplyStaticArgumentsForMethod : methodWithoutArguments:MethodBase * methodNameWithArguments:string * staticArguments:objnull array -> MethodBase diff --git a/src/FSharp.Core/list.fsi b/src/FSharp.Core/list.fsi index 5393fd14439..e14fe7eb447 100644 --- a/src/FSharp.Core/list.fsi +++ b/src/FSharp.Core/list.fsi @@ -821,7 +821,7 @@ module List = /// | Tails, Tails -> acc + 1 /// | _ -> acc) /// - /// Evaluates to 1. Note acc is a commonly used abbreviation for "accumulator". + /// Evaluates to 2. Note acc is a commonly used abbreviation for "accumulator". /// [] val fold2<'T1,'T2,'State> : folder:('State -> 'T1 -> 'T2 -> 'State) -> state:'State -> list1:'T1 list -> list2:'T2 list -> 'State diff --git a/src/FSharp.Core/local.fs b/src/FSharp.Core/local.fs index 1e7df3c2ec8..206ccf4ee3d 100644 --- a/src/FSharp.Core/local.fs +++ b/src/FSharp.Core/local.fs @@ -1090,7 +1090,11 @@ module internal Array = if array.Length > 1 then Array.Sort<_>(array, fastComparerForArraySort()) +#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT let stableSortWithKeysAndComparer (cFast:IComparer<'Key>) (c:IComparer<'Key>) (array:'T array) (keys: 'Key array) = +#else + let stableSortWithKeysAndComparer (cFast:IComparer<'Key> | null) (c:IComparer<'Key>) (array:array<'T>) (keys:array<'Key>) = +#endif // 'places' is an array or integers storing the permutation performed by the sort let len = array.Length let places = zeroCreateUnchecked len diff --git a/src/FSharp.Core/local.fsi b/src/FSharp.Core/local.fsi index 9de6b8c8152..11f645c9788 100644 --- a/src/FSharp.Core/local.fsi +++ b/src/FSharp.Core/local.fsi @@ -6,8 +6,8 @@ open Microsoft.FSharp.Core [] module internal DetailedExceptions = - val inline invalidArgFmt: arg: string -> format: string -> paramArray: obj array -> 'T - val inline invalidOpFmt: format: string -> paramArray: obj array -> 'T + val inline invalidArgFmt: arg: string -> format: string -> paramArray: objnull array -> 'T + val inline invalidOpFmt: format: string -> paramArray: objnull array -> 'T val invalidArgDifferentListLength: arg1: string -> arg2: string -> diff: int -> 'T val invalidArg3ListsDifferent: diff --git a/src/FSharp.Core/mailbox.fs b/src/FSharp.Core/mailbox.fs index a743afc3f41..a938263a05b 100644 --- a/src/FSharp.Core/mailbox.fs +++ b/src/FSharp.Core/mailbox.fs @@ -55,7 +55,7 @@ module AsyncHelpers = ) // Note: It is ok to use "NoDirectCancel" here because the started computations use the same // cancellation token and will register a cancelled result if cancellation occurs. - // Note: It is ok to use "NoDirectTimeout" here because the child compuation above looks after the timeout. + // Note: It is ok to use "NoDirectTimeout" here because the child computation above looks after the timeout. resultCell.AwaitResult_NoDirectCancelOrTimeout [] diff --git a/src/FSharp.Core/map.fs b/src/FSharp.Core/map.fs index 43459ecdf33..b46bd9d357d 100644 --- a/src/FSharp.Core/map.fs +++ b/src/FSharp.Core/map.fs @@ -958,7 +958,7 @@ type Map<[] 'Key, [ as m2 -> Seq.compareWith diff --git a/src/FSharp.Core/map.fsi b/src/FSharp.Core/map.fsi index e6b0b1afb30..5b982141a34 100644 --- a/src/FSharp.Core/map.fsi +++ b/src/FSharp.Core/map.fsi @@ -215,7 +215,7 @@ type Map<[] 'Key, [> interface IReadOnlyDictionary<'Key, 'Value> - override Equals: obj -> bool + override Equals: objnull -> bool /// Contains operations for working with values of type . [] diff --git a/src/FSharp.Core/math/z.fs b/src/FSharp.Core/math/z.fs index 28d0deead19..f3eec1b950e 100644 --- a/src/FSharp.Core/math/z.fs +++ b/src/FSharp.Core/math/z.fs @@ -28,10 +28,10 @@ module NumericLiterals = module NumericLiteralI = - let tab64 = new System.Collections.Generic.Dictionary() - let tabParse = new System.Collections.Generic.Dictionary() + let tab64 = new System.Collections.Generic.Dictionary() + let tabParse = new System.Collections.Generic.Dictionary() - let FromInt64Dynamic (value: int64) : obj = + let FromInt64Dynamic (value: int64) : objnull = lock tab64 (fun () -> let mutable res = Unchecked.defaultof<_> let ok = tab64.TryGetValue(value, &res) @@ -82,7 +82,7 @@ module NumericLiterals = tabParse.[s] <- res res) - let FromStringDynamic (text: string) : obj = + let FromStringDynamic (text: string) : objnull = getParse text let FromString (text: string) : 'T = diff --git a/src/FSharp.Core/math/z.fsi b/src/FSharp.Core/math/z.fsi index 2dc51708530..9c2261ff5b6 100644 --- a/src/FSharp.Core/math/z.fsi +++ b/src/FSharp.Core/math/z.fsi @@ -43,7 +43,7 @@ module NumericLiterals = val FromString: text: string -> 'T /// Provides a default implementations of F# numeric literal syntax for literals of the form 'dddI' - val FromInt64Dynamic: value: int64 -> obj + val FromInt64Dynamic: value: int64 -> objnull /// Provides a default implementations of F# numeric literal syntax for literals of the form 'dddI' - val FromStringDynamic: text: string -> obj + val FromStringDynamic: text: string -> objnull diff --git a/src/FSharp.Core/nativeptr.fsi b/src/FSharp.Core/nativeptr.fsi index 81bdd5b1d2d..75ad378acfe 100644 --- a/src/FSharp.Core/nativeptr.fsi +++ b/src/FSharp.Core/nativeptr.fsi @@ -9,7 +9,7 @@ open Microsoft.FSharp.Collections /// result in the generation of unverifiable code. /// /// -/// Library functionality for native interopability. See +/// Library functionality for native interoperability. See /// also F# External Functions in /// the F# Language Guide. /// diff --git a/src/FSharp.Core/option.fs b/src/FSharp.Core/option.fs index 205eac0265a..1b29141df64 100644 --- a/src/FSharp.Core/option.fs +++ b/src/FSharp.Core/option.fs @@ -148,10 +148,11 @@ module Option = [] let inline ofNullable (value: System.Nullable<'T>) = if value.HasValue then - Some value.Value + Some (value.GetValueOrDefault()) else None +#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT [] let inline ofObj value = match value with @@ -163,6 +164,31 @@ module Option = match value with | None -> null | Some x -> x +#else + [] + let inline ofObj (value: 'T | null) : 'T option when 'T: not struct and 'T : not null = + match value with + | null -> None + | _ -> Some value + + [] + let inline toObj (value: 'T option) : 'T | null when 'T: not struct (* and 'T : not null *) = + match value with + | None -> null + | Some x -> x +#endif + + [] + let inline ofValueOption (voption: 'T voption) = + match voption with + | ValueNone -> None + | ValueSome x -> Some x + + [] + let inline toValueOption (option: 'T option) = + match option with + | None -> ValueNone + | Some x -> ValueSome x module ValueOption = @@ -312,10 +338,11 @@ module ValueOption = [] let inline ofNullable (value: System.Nullable<'T>) = if value.HasValue then - ValueSome value.Value + ValueSome (value.GetValueOrDefault()) else ValueNone +#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT [] let inline ofObj value = match value with @@ -327,3 +354,28 @@ module ValueOption = match value with | ValueNone -> null | ValueSome x -> x +#else + [] + let inline ofObj (value: 'T | null) : 'T voption when 'T: not struct and 'T : not null = + match value with + | null -> ValueNone + | _ -> ValueSome value + + [] + let inline toObj (value : 'T voption) : 'T | null when 'T: not struct (* and 'T : not null *) = + match value with + | ValueNone -> null + | ValueSome x -> x +#endif + + [] + let inline ofOption (option: 'T option) = + match option with + | None -> ValueNone + | Some x -> ValueSome x + + [] + let inline toOption (voption: 'T voption) = + match voption with + | ValueNone -> None + | ValueSome x -> Some x diff --git a/src/FSharp.Core/option.fsi b/src/FSharp.Core/option.fsi index d6375c6d39e..57adb485cb4 100644 --- a/src/FSharp.Core/option.fsi +++ b/src/FSharp.Core/option.fsi @@ -440,7 +440,13 @@ module Option = /// /// [] - val inline ofObj: value: 'T -> 'T option when 'T: null +#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT + val inline ofObj: value: 'T -> 'T option when 'T : null +#else + // TODO NULLNESS: assess this change - is it a breaking change? + [] + val inline ofObj: value: 'T | null -> 'T option when 'T : not null and 'T : not struct +#endif /// Convert an option to a potentially null value. /// @@ -455,7 +461,42 @@ module Option = /// /// [] - val inline toObj: value: 'T option -> 'T when 'T: null +#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT + val inline toObj: value: 'T option -> 'T when 'T : null +#else + // TODO NULLNESS: assess this change - is it a breaking change? + val inline toObj: value: 'T option -> 'T | null when 'T : not struct (* and 'T : not null *) +#endif + + /// Convert a value option to an option. + /// + /// The input value option. + /// + /// The resulting option. + /// + /// + /// + /// ValueSome 42 |> Option.ofValueOption // evaluates to Some 42 + /// (ValueNone: int voption) |> Option.ofValueOption // evaluates to None + /// + /// + [] + val inline ofValueOption: voption: 'T voption -> 'T option + + /// Convert an option to a value option. + /// + /// The input option. + /// + /// The resulting value option. + /// + /// + /// + /// Some 42 |> Option.toValueOption // evaluates to ValueSome 42 + /// (None: int option) |> Option.toValueOption // evaluates to ValueNone + /// + /// + [] + val inline toValueOption: option: 'T option -> 'T voption /// Contains operations for working with value options. /// @@ -888,7 +929,13 @@ module ValueOption = /// /// [] - val inline ofObj: value: 'T -> 'T voption when 'T: null +#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT + val inline ofObj: value: 'T -> 'T voption when 'T : null +#else + // TODO NULLNESS: assess this change - is it a breaking change? + [] + val inline ofObj: value: 'T | null -> 'T voption when 'T : not struct and 'T : not null +#endif /// Convert an option to a potentially null value. /// @@ -903,4 +950,39 @@ module ValueOption = /// /// [] - val inline toObj: value: 'T voption -> 'T when 'T: null +#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT + val inline toObj: value: 'T voption -> 'T when 'T : null +#else + // TODO NULLNESS: assess this change - is it a breaking change? + val inline toObj: value: 'T voption -> 'T | null when 'T : not struct (* and 'T : not null *) +#endif + + /// Convert an option to a value option. + /// + /// The input option. + /// + /// The resulting value option. + /// + /// + /// + /// Some 42 |> ValueOption.ofOption // evaluates to ValueSome 42 + /// (None: int option) |> ValueOption.ofOption // evaluates to ValueNone + /// + /// + [] + val inline ofOption: option: 'T option -> 'T voption + + /// Convert a value option to an option. + /// + /// The input value option. + /// + /// The resulting option. + /// + /// + /// + /// ValueSome 42 |> ValueOption.toOption // evaluates to Some 42 + /// (ValueNone: int voption) |> ValueOption.toOption // evaluates to None + /// + /// + [] + val inline toOption: voption: 'T voption -> 'T option diff --git a/src/FSharp.Core/prim-types-prelude.fs b/src/FSharp.Core/prim-types-prelude.fs index 9a002450382..12ed91cfba2 100644 --- a/src/FSharp.Core/prim-types-prelude.fs +++ b/src/FSharp.Core/prim-types-prelude.fs @@ -6,6 +6,11 @@ namespace Microsoft.FSharp.Core // Basic type abbreviations type obj = System.Object +#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT + type objnull = obj +#else + type objnull = obj | null +#endif type exn = System.Exception type nativeint = System.IntPtr type unativeint = System.UIntPtr diff --git a/src/FSharp.Core/prim-types-prelude.fsi b/src/FSharp.Core/prim-types-prelude.fsi index b9bbc5c125f..8cc0515350d 100644 --- a/src/FSharp.Core/prim-types-prelude.fsi +++ b/src/FSharp.Core/prim-types-prelude.fsi @@ -18,6 +18,16 @@ namespace Microsoft.FSharp.Core /// Basic Types type obj = System.Object + /// An abbreviation for the CLI type or null. + /// With the 'nullable reference types' feature, this is an alias to 'obj | null'. + /// + /// Basic Types +#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT + type objnull = obj +#else + type objnull = obj | null +#endif + /// An abbreviation for the CLI type . /// /// Basic Types diff --git a/src/FSharp.Core/prim-types.fs b/src/FSharp.Core/prim-types.fs index 556fb1bcde5..e1f093e13eb 100644 --- a/src/FSharp.Core/prim-types.fs +++ b/src/FSharp.Core/prim-types.fs @@ -9,6 +9,8 @@ #nowarn "69" // Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case. #nowarn "77" // Member constraints with the name 'Exp' are given special status by the F# compiler... #nowarn "3218" // mismatch of parameter name for 'fst' and 'snd' +#nowarn "3244" // no nullness checking +#nowarn "3245" // no nullness checking namespace Microsoft.FSharp.Core @@ -23,11 +25,11 @@ namespace Microsoft.FSharp.Core type Unit() = override _.GetHashCode() = 0 - override _.Equals(obj:obj) = + override _.Equals(obj:objnull) = match obj with null -> true | :? Unit -> true | _ -> false interface System.IComparable with - member _.CompareTo(_obj:obj) = 0 + member _.CompareTo(_obj:objnull) = 0 and unit = Unit @@ -88,7 +90,7 @@ namespace Microsoft.FSharp.Core type VolatileFieldAttribute() = inherit Attribute() - [] + [] [] type DefaultAugmentationAttribute(value:bool) = inherit Attribute() @@ -99,12 +101,12 @@ namespace Microsoft.FSharp.Core type CLIEventAttribute() = inherit Attribute() - [] + [] [] type CLIMutableAttribute() = inherit Attribute() - [] + [] [] type AutoSerializableAttribute(value:bool) = inherit Attribute() @@ -165,6 +167,7 @@ namespace Microsoft.FSharp.Core AttributeTargets.Parameter ||| AttributeTargets.Method ||| AttributeTargets.Property ||| AttributeTargets.Constructor ||| AttributeTargets.Delegate, AllowMultiple=false)>] + [] type ReflectedDefinitionAttribute(includeValue: bool) = inherit Attribute() @@ -180,7 +183,7 @@ namespace Microsoft.FSharp.Core inherit Attribute() member _.CompiledName = compiledName - [] + [] [] type StructAttribute() = inherit Attribute() @@ -376,6 +379,13 @@ namespace Microsoft.FSharp.Core type NoCompilerInliningAttribute() = inherit Attribute() + [] + [] + type WarnOnWithoutNullArgumentAttribute(warningMessage:string) = + inherit Attribute() + member _.WarningMessage = warningMessage + member val internal Localize = false with get, set + [] [] type TailCallAttribute() = @@ -495,8 +505,8 @@ namespace Microsoft.FSharp.Core type outref<'T> = byref<'T, ByRefKinds.Out> module internal BasicInlinedOperations = - let inline unboxPrim<'T>(x:obj) = (# "unbox.any !0" type ('T) x : 'T #) - let inline box (x:'T) = (# "box !0" type ('T) x : obj #) + let inline unboxPrim<'T>(x:objnull) = (# "unbox.any !0" type ('T) x : 'T #) + let inline box (x:'T) = (# "box !0" type ('T) x : objnull #) let inline convPrim<'T1, 'T2>(x: 'T1) : 'T2 = unboxPrim<'T2> (box x) let inline not (b:bool) = (# "ceq" b false : bool #) let inline (=) (x:int) (y:int) = (# "ceq" x y : bool #) @@ -531,7 +541,7 @@ namespace Microsoft.FSharp.Core let set (arr: 'T array) (n:int) (x:'T) = (# "stelem.any !0" type ('T) arr n x #) - let inline objEq (xobj:obj) (yobj:obj) = (# "ceq" xobj yobj : bool #) + let inline objEq (xobj:objnull) (yobj:objnull) = (# "ceq" xobj yobj : bool #) let inline int64Eq (x:int64) (y:int64) = (# "ceq" x y : bool #) let inline int32Eq (x:int32) (y:int32) = (# "ceq" x y : bool #) let inline floatEq (x:float) (y:float) = (# "ceq" x y : bool #) @@ -556,16 +566,19 @@ namespace Microsoft.FSharp.Core (# "sizeof !0" type('T) : int #) let inline unsafeDefault<'T> : 'T = (# "ilzero !0" type ('T) : 'T #) - let inline isinstPrim<'T>(x:obj) = (# "isinst !0" type ('T) x : obj #) + let inline isinstPrim<'T>(x:objnull) = (# "isinst !0" type ('T) x : objnull #) let inline castclassPrim<'T>(x:obj) = (# "castclass !0" type ('T) x : 'T #) let inline notnullPrim<'T when 'T : not struct>(x:'T) = (# "ldnull cgt.un" x : bool #) - let inline iscastPrim<'T when 'T : not struct>(x:obj) = (# "isinst !0" type ('T) x : 'T #) + let inline iscastPrim<'T when 'T : not struct>(x:objnull) = (# "isinst !0" type ('T) x : 'T #) let inline mask (n:int) (m:int) = (# "and" n m : int #) open BasicInlinedOperations + // This exists solely so that it can be used in the CollectionBuilderAttribute on List<'T> in prim-types.fsi. + module internal TypeOfUtils = + let inline typeof<'T> = typeof<'T> module TupleUtils = @@ -703,7 +716,7 @@ namespace Microsoft.FSharp.Core // IL_0006: brtrue.s IL_000e // worst case: nothing known about source or destination - let UnboxGeneric<'T>(source: obj) = + let UnboxGeneric<'T>(source: objnull) = if notnullPrim(source) or TypeInfo<'T>.TypeInfo <> TypeNullnessSemantics_NullNotLiked then unboxPrim<'T>(source) else @@ -711,19 +724,19 @@ namespace Microsoft.FSharp.Core raise (System.NullReferenceException()) // better: source is NOT TypeNullnessSemantics_NullNotLiked - let inline UnboxFast<'T>(source: obj) = + let inline UnboxFast<'T>(source: objnull) = // assert not(TypeInfo<'T>.TypeInfo = TypeNullnessSemantics_NullNotLiked) unboxPrim<'T>(source) // worst case: nothing known about source or destination - let TypeTestGeneric<'T>(source: obj) = + let TypeTestGeneric<'T>(source: objnull) = if notnullPrim(isinstPrim<'T>(source)) then true elif notnullPrim(source) then false else (TypeInfo<'T>.TypeInfo = TypeNullnessSemantics_NullTrueValue) // quick entry: source is NOT TypeNullnessSemantics_NullTrueValue - let inline TypeTestFast<'T>(source: obj) = + let inline TypeTestFast<'T>(source: objnull) = //assert not(TypeInfo<'T>.TypeInfo = TypeNullnessSemantics_NullTrueValue) notnullPrim(isinstPrim<'T>(source)) @@ -923,7 +936,7 @@ namespace Microsoft.FSharp.Core let inline HashCombine nr x y = (x <<< 1) + y + 631 * nr - let GenericHashObjArray (iec : IEqualityComparer) (x: obj array) : int = + let GenericHashObjArray (iec : IEqualityComparer) (x: objnull array) : int = let len = x.Length let mutable i = len - 1 if i > defaultHashNodes then i <- defaultHashNodes // limit the hash @@ -989,7 +1002,7 @@ namespace Microsoft.FSharp.Core // Arrays are structurally hashed through a separate technique. // // "iec" is either fsEqualityComparerUnlimitedHashingER, fsEqualityComparerUnlimitedHashingPER or a CountLimitedHasherPER. - let rec GenericHashParamObj (iec : IEqualityComparer) (x: obj) : int = + let rec GenericHashParamObj (iec : IEqualityComparer) (x: objnull) : int = match x with | null -> 0 | (:? System.Array as a) -> @@ -1053,7 +1066,7 @@ namespace Microsoft.FSharp.Core /// Implements generic comparison between two objects. This corresponds to the pseudo-code in the F# /// specification. The treatment of NaNs is governed by "comp". - let rec GenericCompare (comp:GenericComparer) (xobj:obj, yobj:obj) = + let rec GenericCompare (comp:GenericComparer) (xobj:objnull, yobj:objnull) = match xobj,yobj with | null,null -> 0 | null,_ -> -1 @@ -1185,7 +1198,7 @@ namespace Microsoft.FSharp.Core check 0 /// optimized case: Core implementation of structural comparison on object arrays. - and GenericComparisonObjArrayWithComparer (comp:GenericComparer) (x:obj array) (y:obj array) : int = + and GenericComparisonObjArrayWithComparer (comp:GenericComparer) (x:objnull array) (y:objnull array) : int = let lenx = x.Length let leny = y.Length let c = intOrder lenx leny @@ -1216,7 +1229,7 @@ namespace Microsoft.FSharp.Core type GenericComparer with interface IComparer with - override c.Compare(x:obj,y:obj) = GenericCompare c (x,y) + override c.Compare(x:objnull,y:objnull) = GenericCompare c (x,y) /// The unique object for comparing values in PER mode (where local exceptions are thrown when NaNs are compared) let fsComparerPER = GenericComparer(true) @@ -1552,7 +1565,7 @@ namespace Microsoft.FSharp.Core // // If "er" is true the "iec" is fsEqualityComparerUnlimitedHashingER // If "er" is false the "iec" is fsEqualityComparerUnlimitedHashingPER - let rec GenericEqualityObj (er:bool) (iec:IEqualityComparer) ((xobj:obj),(yobj:obj)) : bool = + let rec GenericEqualityObj (er:bool) (iec:IEqualityComparer) ((xobj:objnull),(yobj:objnull)) : bool = (*if objEq xobj yobj then true else *) match xobj,yobj with | null,null -> true @@ -1641,7 +1654,7 @@ namespace Microsoft.FSharp.Core check 0 /// optimized case: Core implementation of structural equality on object arrays. - and GenericEqualityObjArray er iec (x:obj array) (y:obj array) : bool = + and GenericEqualityObjArray er iec (x:objnull array) (y:objnull array) : bool = let lenx = x.Length let leny = y.Length let c = (lenx = leny ) @@ -1744,12 +1757,12 @@ namespace Microsoft.FSharp.Core checkType 0 [| rootType |] let arrayEqualityComparer<'T> er comparer = - let arrayEquals (er: bool) (iec: IEqualityComparer) (xobj: obj) (yobj: obj) : bool = + let arrayEquals (er: bool) (iec: IEqualityComparer) (xobj: objnull) (yobj: objnull) : bool = match xobj, yobj with | null, null -> true | null, _ -> false | _, null -> false - | (:? (obj array) as arr1), (:? (obj array) as arr2) -> GenericEqualityObjArray er iec arr1 arr2 + | (:? (objnull array) as arr1), (:? (objnull array) as arr2) -> GenericEqualityObjArray er iec arr1 arr2 | (:? (byte array) as arr1), (:? (byte array) as arr2) -> GenericEqualityByteArray arr1 arr2 | (:? (int32 array) as arr1), (:? (int32 array) as arr2) -> GenericEqualityInt32Array arr1 arr2 | (:? (int64 array) as arr1), (:? (int64 array) as arr2) -> GenericEqualityInt64Array arr1 arr2 @@ -1759,10 +1772,10 @@ namespace Microsoft.FSharp.Core | (:? Array as arr1), (:? Array as arr2) -> GenericEqualityArbArray er iec arr1 arr2 | _ -> raise (Exception "invalid logic - expected array") - let getHashCode (iec, xobj: obj) = + let getHashCode (iec, xobj: objnull) = match xobj with | null -> 0 - | :? (obj array) as oa -> GenericHashObjArray iec oa + | :? (objnull array) as oa -> GenericHashObjArray iec oa | :? (byte array) as ba -> GenericHashByteArray ba | :? (int array) as ia -> GenericHashInt32Array ia | :? (int64 array) as ia -> GenericHashInt64Array ia @@ -1948,9 +1961,9 @@ namespace Microsoft.FSharp.Core type CountLimitedHasherPER with interface IEqualityComparer with - override iec.Equals(x:obj,y:obj) = + override iec.Equals(x:objnull,y:objnull) = GenericEqualityObj false iec (x,y) - override iec.GetHashCode(x:obj) = + override iec.GetHashCode(x:objnull) = iec.nodeCount <- iec.nodeCount - 1 if iec.nodeCount > 0 then GenericHashParamObj iec x @@ -1961,14 +1974,14 @@ namespace Microsoft.FSharp.Core type UnlimitedHasherER with interface IEqualityComparer with - override iec.Equals(x:obj,y:obj) = GenericEqualityObj true iec (x,y) - override iec.GetHashCode(x:obj) = GenericHashParamObj iec x + override iec.Equals(x:objnull,y:objnull) = GenericEqualityObj true iec (x,y) + override iec.GetHashCode(x:objnull) = GenericHashParamObj iec x /// Fill in the implementation of UnlimitedHasherPER type UnlimitedHasherPER with interface IEqualityComparer with - override iec.Equals(x:obj,y:obj) = GenericEqualityObj false iec (x,y) - override iec.GetHashCode(x:obj) = GenericHashParamObj iec x + override iec.Equals(x:objnull,y:objnull) = GenericEqualityObj false iec (x,y) + override iec.GetHashCode(x:objnull) = GenericHashParamObj iec x /// Intrinsic for calls to depth-unlimited structural hashing that were not optimized by static conditionals. // @@ -4069,6 +4082,23 @@ namespace Microsoft.FSharp.Core and 'T voption = ValueOption<'T> +// These attributes only exist in .NET 8 and up. +namespace System.Runtime.CompilerServices + open System + open Microsoft.FSharp.Core + + [] + [] + type internal CollectionBuilderAttribute (builderType: Type, methodName: string) = + inherit Attribute () + member _.BuilderType = builderType + member _.MethodName = methodName + + [] + [] + type internal ScopedRefAttribute () = + inherit Attribute () + namespace Microsoft.FSharp.Collections //------------------------------------------------------------------------- @@ -4086,6 +4116,9 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicFunctions open Microsoft.FSharp.Core.BasicInlinedOperations +#if NETSTANDARD2_1_OR_GREATER + [, "Create")>] +#endif [] [>)>] [] @@ -4111,6 +4144,19 @@ namespace Microsoft.FSharp.Collections and 'T list = List<'T> +#if NETSTANDARD2_1_OR_GREATER + and [] List = + [] + static member Create([] items: System.ReadOnlySpan<'T>) = + let mutable list : 'T list = [] + for i = items.Length - 1 downto 0 do + list <- items[i] :: list + list +#endif + //------------------------------------------------------------------------- // List (debug view) //------------------------------------------------------------------------- @@ -4342,20 +4388,20 @@ namespace Microsoft.FSharp.Core let seq (sequence: seq<'T>) = sequence [] - let inline unbox (value: obj) = UnboxGeneric(value) + let inline unbox (value: objnull) = UnboxGeneric(value) [] - let inline box (value: 'T) = (# "box !0" type ('T) value : obj #) + let inline box (value: 'T) = (# "box !0" type ('T) value : objnull #) [] - let inline tryUnbox (value:obj) = + let inline tryUnbox (value:objnull) = match value with | :? 'T as v -> Some v | _ -> None [] - let inline isNull (value : 'T) = - match value with + let inline isNull (value : 'T when 'T : null) = + match box value with | null -> true | _ -> false @@ -4365,6 +4411,68 @@ namespace Microsoft.FSharp.Core | null -> false | _ -> true +#if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT + + [] + let inline isNullV (value : Nullable<'T>) = not value.HasValue + + [] + let inline nonNull (value : 'T | null when 'T : not null and 'T : not struct) = + match box value with + | null -> raise (NullReferenceException()) + | _ -> (# "" value : 'T #) + + [] + let inline nonNullV (value : Nullable<'T>) = + if value.HasValue then + value.Value + else + raise (NullReferenceException()) + + [] + let inline (|Null|NonNull|) (value : 'T | null when 'T : not null and 'T : not struct) = + match value with + | null -> Null () + | _ -> NonNull (# "" value : 'T #) + + [] + let inline (|NullV|NonNullV|) (value : Nullable<'T>) = + if value.HasValue then NonNullV value.Value + else NullV () + + [] + let inline (|NonNullQuick|) (value : 'T | null when 'T : not null and 'T : not struct) = + match box value with + | null -> raise (NullReferenceException()) + | _ -> (# "" value : 'T #) + + [] + let inline (|NonNullQuickV|) (value : Nullable<'T>) = + if value.HasValue then value.Value + else raise (NullReferenceException()) + + [] + let inline withNull (value : 'T when 'T : not null and 'T : not struct) = (# "" value : 'T | null #) + + [] + let inline withNullV (value : 'T) : Nullable<'T> = Nullable<'T>(value) + + [] + let inline nullV<'T when 'T : struct and 'T : (new : unit -> 'T) and 'T :> ValueType> = Nullable<'T>() + + [] + let inline nullArgCheck (argumentName:string) (value: 'T | null when 'T : not null and 'T : not struct) = + match value with + | null -> raise (new ArgumentNullException(argumentName)) + | _ -> (# "" value : 'T #) +#else + [] + let inline (|Null|NonNull|) (value : 'T) : Choice when 'T : null and 'T : not struct = + match value with + | null -> Null () + | _ -> NonNull (# "" value : 'T #) +#endif + [] let inline raise (exn: exn) = (# "throw" exn : 'T #) @@ -4457,6 +4565,16 @@ namespace Microsoft.FSharp.Core [] let defaultValueArg arg defaultValue = match arg with ValueNone -> defaultValue | ValueSome v -> v +#if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT + [] + let inline defaultIfNull defaultValue (arg: 'T | null when 'T : not null and 'T : not struct) = + match arg with null -> defaultValue | _ -> (# "" arg : 'T #) + + [] + let inline defaultIfNullV defaultValue (arg: Nullable<'T>) = + if arg.HasValue then arg.Value else defaultValue +#endif + [] let inline (~-) (n: ^T) : ^T = UnaryNegationDynamic<(^T), (^T)> n @@ -5085,7 +5203,7 @@ namespace Microsoft.FSharp.Core | :? IFormattable as f -> f.ToString(null, CultureInfo.InvariantCulture) | _ -> value.ToString() - // other commmon mscorlib reference types + // other common mscorlib reference types when 'T : StringBuilder = if value = unsafeDefault<'T> then "" else let x = (# "" value : StringBuilder #) in x.ToString() @@ -5387,7 +5505,7 @@ namespace Microsoft.FSharp.Core module Unchecked = [] - let inline unbox<'T> (v:obj) = unboxPrim<'T> v + let inline unbox<'T> (v:objnull) = unboxPrim<'T> v [] let inline defaultof<'T> = unsafeDefault<'T> @@ -5401,6 +5519,24 @@ namespace Microsoft.FSharp.Core [] let inline hash x = GenericHash x + #if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT + + [] + let inline nonNull (x: 'T | null when 'T : not null and 'T : not struct) : 'T = (# "" x : 'T #) + + [] + let inline (|NonNullQuick|) (value : 'T | null when 'T : not null and 'T : not struct) = nonNull value + + #else + + [] + let inline nonNull (x: 'T ) : 'T = x + + [] + let inline (|NonNullQuick|) (value) = nonNull value + + #endif + module Checked = let inline (+) (x: ^T) (y: ^U) : ^V = @@ -5710,7 +5846,7 @@ namespace Microsoft.FSharp.Core // Notes on "inline" with range ienumerable generation. // "inline" is used to ensure that primitive ops like add,sub etc. are direct calls. - // However, it is not used to ensure all explicit lambda arguments can be reduced by the optimiser. + // However, it is not used to ensure all explicit lambda arguments can be reduced by the optimizer. type Mode = | NotStarted = 0 @@ -5720,7 +5856,7 @@ namespace Microsoft.FSharp.Core [] type BaseRangeEnumerator<'T>() = // Generate enumerator from mutable state "z". - // Marked "inline" to ensure argument functions are reduced (by optimiser). + // Marked "inline" to ensure argument functions are reduced (by optimizer). let mutable mode = Mode.NotStarted let getCurrent(x:BaseRangeEnumerator<'T>) = match mode with @@ -5974,7 +6110,7 @@ namespace Microsoft.FSharp.Core else false // NOTE: The ordering Before is an argument. It will be < or > depending on direction. - // We assume assume "Before n m" + // We assume "Before n m" abstract Before: 'T -> 'T -> bool abstract Equal: 'T -> 'T -> bool abstract Step: 'T -> 'T @@ -7196,7 +7332,7 @@ namespace Microsoft.FSharp.Control inherit IObservable<'Args> [] - type Handler<'Args> = delegate of sender:obj * args:'Args -> unit + type Handler<'Args> = delegate of sender:objnull * args:'Args -> unit type IEvent<'Args> = IEvent, 'Args> diff --git a/src/FSharp.Core/prim-types.fsi b/src/FSharp.Core/prim-types.fsi index 2b3bcf1ac7c..15264b3a14e 100644 --- a/src/FSharp.Core/prim-types.fsi +++ b/src/FSharp.Core/prim-types.fsi @@ -1,3 +1,4 @@ + // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. #nowarn "35" // This construct is deprecated: the treatment of this operator is now handled directly by the F# compiler and its meaning may not be redefined. @@ -199,7 +200,7 @@ namespace Microsoft.FSharp.Core /// Adding this attribute to a type causes it to be represented using a CLI struct. /// /// Attributes - [] + [] [] type StructAttribute = inherit Attribute @@ -309,7 +310,7 @@ namespace Microsoft.FSharp.Core /// with a default constructor with property getters and setters. /// /// Attributes - [] + [] [] type CLIMutableAttribute = inherit Attribute @@ -323,7 +324,7 @@ namespace Microsoft.FSharp.Core /// and accessor members for the generated CLI class for that type. /// /// Attributes - [] + [] [] type DefaultAugmentationAttribute = inherit Attribute @@ -954,6 +955,24 @@ namespace Microsoft.FSharp.Core /// NoCompilerInliningAttribute new: unit -> NoCompilerInliningAttribute + /// When used in a compilation with null-checking enabled, indicates that a function is meant to be used only with potentially-nullable values and warns accordingly. + /// + /// Attributes + [] + [] + type WarnOnWithoutNullArgumentAttribute = + inherit Attribute + + /// Creates an instance of the attribute + /// The message displayed when the annotated function is used with a value known to be without null + /// WarnOnWithoutNullArgumentAttribute + new: warningMessage:string -> WarnOnWithoutNullArgumentAttribute + + /// Warning message displayed when the annotated function is used with a value known to be without null + member WarningMessage: string + + member internal Localize: bool with get,set + /// Indicates a function that should be called in a tail recursive way inside its recursive scope. /// A warning is emitted if the function is analyzed as not tail recursive after the optimization phase. /// @@ -1238,6 +1257,10 @@ namespace Microsoft.FSharp.Core /// ByRef and Pointer Types type outref<'T> = byref<'T, ByRefKinds.Out> + // This exists solely so that it can be used in the CollectionBuilderAttribute on List<'T> below. + module internal TypeOfUtils = + val inline typeof<'T>: Type + /// Language primitives associated with the F# language /// /// Language Primitives @@ -1368,7 +1391,11 @@ namespace Microsoft.FSharp.Core val inline FastGenericComparer<'T> : System.Collections.Generic.IComparer<'T> when 'T: comparison /// Make an F# comparer object for the given type, where it can be null if System.Collections.Generic.Comparer<'T>.Default - val internal FastGenericComparerCanBeNull<'T> : System.Collections.Generic.IComparer<'T> when 'T: comparison +#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT + val internal FastGenericComparerCanBeNull<'T> : System.Collections.Generic.IComparer<'T> when 'T : comparison +#else + val internal FastGenericComparerCanBeNull<'T> : System.Collections.Generic.IComparer<'T> | null when 'T : comparison +#endif /// Make an F# hash/equality object for the given type val inline FastGenericEqualityComparer<'T> : System.Collections.Generic.IEqualityComparer<'T> when 'T: equality @@ -1740,19 +1767,19 @@ namespace Microsoft.FSharp.Core /// A compiler intrinsic that implements the ':?>' operator [] - val UnboxGeneric<'T> : source: obj -> 'T + val UnboxGeneric<'T> : source: objnull -> 'T /// A compiler intrinsic that implements the ':?>' operator [] - val inline UnboxFast<'T> : source: obj -> 'T + val inline UnboxFast<'T> : source: objnull -> 'T /// A compiler intrinsic that implements the ':?' operator [] - val TypeTestGeneric<'T> : source: obj -> bool + val TypeTestGeneric<'T> : source: objnull -> bool /// A compiler intrinsic that implements the ':?' operator [] - val inline TypeTestFast<'T> : source: obj -> bool + val inline TypeTestFast<'T> : source: objnull -> bool /// Primitive used by pattern match compilation //[] @@ -2578,12 +2605,46 @@ namespace Microsoft.FSharp.Core /// Represents an Error or a Failure. The code failed with a value of 'TError representing what went wrong. | Error of ErrorValue:'TError +// These attributes only exist in .NET 8 and up. +namespace System.Runtime.CompilerServices + open System + open Microsoft.FSharp.Core + + [] + [] + type internal CollectionBuilderAttribute = + inherit Attribute + + /// Initialize the attribute to refer to the method on the type. + /// The type of the builder to use to construct the collection. + /// The name of the method on the builder to use to construct the collection. + /// + /// must refer to a static method that accepts a single parameter of + /// type and returns an instance of the collection being built containing + /// a copy of the data from that span. In future releases of .NET, additional patterns may be supported. + /// + new: builderType: Type * methodName: string -> CollectionBuilderAttribute + + /// Gets the type of the builder to use to construct the collection. + member BuilderType: Type + + /// Gets the name of the method on the builder to use to construct the collection. + /// This should match the metadata name of the target method. For example, this might be ".ctor" if targeting the type's constructor. + member MethodName: string + + [] + [] + type internal ScopedRefAttribute = + inherit Attribute + new: unit -> ScopedRefAttribute + namespace Microsoft.FSharp.Collections open System open System.Collections open System.Collections.Generic open Microsoft.FSharp.Core + open Microsoft.FSharp.Core.TypeOfUtils /// The type of immutable singly-linked lists. /// @@ -2593,6 +2654,9 @@ namespace Microsoft.FSharp.Collections /// /// /// +#if NETSTANDARD2_1_OR_GREATER + [, "Create")>] +#endif [] [] [] @@ -2646,7 +2710,7 @@ namespace Microsoft.FSharp.Collections /// /// The list with head appended to the front of tail. static member Cons: head: 'T * tail: 'T list -> 'T list - + interface IEnumerable<'T> interface IEnumerable interface IReadOnlyCollection<'T> @@ -2664,6 +2728,21 @@ namespace Microsoft.FSharp.Collections /// and 'T list = List<'T> +#if NETSTANDARD2_1_OR_GREATER + /// Contains methods for compiler use related to lists. + and [] List = + /// Creates a list with the specified items. + /// + /// The items to store in the list. + /// + /// A list containing the specified items. + [] + static member Create: [] items: System.ReadOnlySpan<'T> -> 'T list +#endif + /// An abbreviation for the CLI type type ResizeArray<'T> = System.Collections.Generic.List<'T> @@ -2709,7 +2788,7 @@ namespace Microsoft.FSharp.Core /// /// /// 2 + 2 // Evaluates to 4 - /// "Hello " + "Word" // Evaluates to "Hello World" + /// "Hello " + "World" // Evaluates to "Hello World" /// /// /// @@ -2906,7 +2985,7 @@ namespace Microsoft.FSharp.Core /// /// The result of the comparison. /// - /// + /// /// /// 5 > 1 // Evaluates to true /// 5 > 5 // Evaluates to false @@ -3123,6 +3202,22 @@ namespace Microsoft.FSharp.Core /// val inline (<|||): func: ('T1 -> 'T2 -> 'T3 -> 'U) -> arg1: 'T1 * arg2: 'T2 * arg3: 'T3 -> 'U +#if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT + /// Used to specify a default value for a nullable reference argument in the implementation of a function + /// The default value of the argument. + /// A nullable value representing the argument. + /// The argument value. If it is null, the defaultValue is returned. + [] + val inline defaultIfNull : defaultValue:'T -> arg:'T | null -> 'T when 'T : not null and 'T : not struct + + /// Used to specify a default value for an nullable value argument in the implementation of a function + /// The default value of the argument. + /// A nullable value representing the argument. + /// The argument value. If it is null, the defaultValue is returned. + [] + val inline defaultIfNullV : defaultValue:'T -> arg:Nullable<'T> -> 'T +#endif + /// Used to specify a default value for an optional argument in the implementation of a function /// /// An option representing the argument. @@ -3366,7 +3461,7 @@ namespace Microsoft.FSharp.Core /// /// [] - val inline unbox: value: obj -> 'T + val inline unbox: value: objnull -> 'T /// Boxes a strongly typed value. /// @@ -3384,7 +3479,7 @@ namespace Microsoft.FSharp.Core /// /// [] - val inline box: value: 'T -> obj + val inline box: value: 'T -> objnull /// Try to unbox a strongly typed value. /// @@ -3402,7 +3497,7 @@ namespace Microsoft.FSharp.Core /// /// [] - val inline tryUnbox: value: obj -> 'T option + val inline tryUnbox: value: objnull -> 'T option /// Determines whether the given value is null. /// @@ -3420,13 +3515,91 @@ namespace Microsoft.FSharp.Core [] val inline isNull: value: 'T -> bool when 'T: null +#if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT + /// Determines whether the given value is null. + /// The value to check. + /// A choice indicating whether the value is null or not-null. + [] + [] + val inline (|Null|NonNull|) : value: 'T | null -> Choice when 'T : not null and 'T : not struct + + /// Determines whether the given value is null. + /// In a future revision of nullness support this may be unified with 'Null|NonNull'. + /// The value to check. + /// A choice indicating whether the value is null or not-null. + [] + val inline (|NullV|NonNullV|) : value: Nullable<'T> -> Choice + + /// When used in a pattern checks the given value is not null. + /// The value to check. + /// The non-null value. + [] + [] + val inline (|NonNullQuick|) : value: 'T | null -> 'T when 'T : not null and 'T : not struct + + /// When used in a pattern checks the given value is not null. + /// In a future revision of nullness support this may be unified with 'NonNullQuick'. + /// The value to check. + /// The non-null value. + [] + val inline (|NonNullQuickV|) : value: Nullable<'T> -> 'T + + /// Determines whether the given value is null. + /// In a future revision of nullness support this may be unified with 'isNull'. + /// The value to check. + /// True when value is null, false otherwise. + [] + val inline isNullV : value:Nullable<'T> -> bool +#else + /// Determines whether the given value is null. + /// The value to check. + /// A choice indicating whether the value is null or not-null. + [] + val inline (|Null|NonNull|) : value: 'T -> Choice when 'T : null and 'T : not struct +#endif + /// Determines whether the given value is not null. /// /// The value to check. /// /// True when value is not null, false otherwise. [] - val inline internal isNotNull: value: 'T -> bool when 'T: null + val inline internal isNotNull: value:'T -> bool when 'T : null + +#if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT + /// Get the null value for a value type. + /// In a future revision of nullness support this may be unified with 'null'. + /// The null value for a value type. + [] + val inline nullV<'T when 'T : struct and 'T : (new : unit -> 'T) and 'T :> ValueType> : Nullable<'T> + + /// Asserts that the value is non-null. + /// The value to check. + /// The value when it is not null. If the value is null an exception is raised. + [] + [] + val inline nonNull : value: 'T | null -> 'T when 'T : not null and 'T : not struct + + /// Asserts that the value is non-null. + /// In a future revision of nullness support this may be unified with 'nonNull'. + /// The value to check. + /// True when value is null, false otherwise. + [] + val inline nonNullV : value:Nullable<'T> -> 'T + + /// Asserts that the value is non-null. + /// The value to check. + /// True when value is null, false otherwise. + [] + val inline withNull : value:'T -> 'T | null when 'T : not null and 'T : not struct + + /// Asserts that the value is non-null. + /// In a future revision of nullness support this may be unified with 'withNull'. + /// The value to check. + /// True when value is null, false otherwise. + [] + val inline withNullV : value:'T -> Nullable<'T> +#endif /// Throw a exception. /// @@ -3492,6 +3665,16 @@ namespace Microsoft.FSharp.Core [] val inline nullArg: argumentName: string -> 'T +#if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT + /// Throw a System.ArgumentNullException if the given value is null exception + /// + /// The argument name. + /// + /// The result value. + [] + val inline nullArgCheck : argumentName:string -> 'T | null -> 'T when 'T : not null and 'T : not struct +#endif + /// Throw a exception /// /// The exception message. @@ -3623,7 +3806,7 @@ namespace Microsoft.FSharp.Core /// /// let l1 = ['a'; 'b'; 'c'] /// let l2 = ['d'; 'e'; 'f'] - /// l1 @ l2 // Evalulates to ['a'; 'b'; 'c'; 'd'; 'e'; 'f'] + /// l1 @ l2 // Evaluates to ['a'; 'b'; 'c'; 'd'; 'e'; 'f'] /// /// /// @@ -3666,7 +3849,7 @@ namespace Microsoft.FSharp.Core /// otherwise raise an exception. Calls . /// /// The exit code to use. - /// + /// /// Never returns. /// /// @@ -5582,7 +5765,7 @@ namespace Microsoft.FSharp.Core /// /// [] - val inline unbox<'T> : value: obj -> 'T + val inline unbox<'T> : value: objnull -> 'T /// Generate a default value for any type. This is null for reference types, /// For structs, this is struct value where all fields have the default value. @@ -5621,6 +5804,26 @@ namespace Microsoft.FSharp.Core [] val inline hash: 'T -> int + /// Unsafely retypes the value from ('T | null) to 'T without doing any null check at runtime. This is an unsafe operation. + /// The possibly nullable value. + /// The same value as in the input. + [] + #if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT + val inline nonNull : value: 'T | null -> 'T when 'T : not null and 'T : not struct + #else + val inline nonNull : value: 'T -> 'T + #endif + + /// When used in a pattern forgets 'nullness' of the value without any runtime check. This is an unsafe operation, as null check is being skipped and null value can be returned. + /// The value to retype from ('T | null) to 'T . + /// The non-null value. + [] + #if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT + val inline (|NonNullQuick|) : value: 'T | null -> 'T when 'T : not null and 'T : not struct + #else + val inline (|NonNullQuick|) : value: 'T -> 'T + #endif + /// A module of comparison and equality operators that are statically resolved, but which are not fully generic and do not make structural comparison. Opening this /// module may make code that relies on structural or generic comparison no longer compile. module NonStructuralComparison = @@ -6040,7 +6243,7 @@ namespace Microsoft.FSharp.Control /// /// Events and Observables [] - type Handler<'T> = delegate of sender:obj * args:'T -> unit + type Handler<'T> = delegate of sender:objnull * args:'T -> unit /// First-class listening points (i.e. objects that permit you to register a callback /// activated when the event is triggered). diff --git a/src/FSharp.Core/printf.fs b/src/FSharp.Core/printf.fs index a326492c672..b2b42f23370 100644 --- a/src/FSharp.Core/printf.fs +++ b/src/FSharp.Core/printf.fs @@ -19,7 +19,7 @@ open LanguagePrimitives.IntrinsicOperators type PrintfFormat<'Printer, 'State, 'Residue, 'Result> [] - (value:string, captures: obj array, captureTys: Type array) = + (value:string, captures: objnull array, captureTys: Type array) = [] new (value) = new PrintfFormat<'Printer, 'State, 'Residue, 'Result>(value, null, null) @@ -246,7 +246,7 @@ module internal PrintfImpl = let p = parsePrecision s &i2 let typeChar = parseTypeChar s &i2 - // shortcut for the simpliest case + // shortcut for the simplest case // if typeChar is not % or it has star as width\precision - resort to long path if typeChar = '%' && not (w = StarValue || p = StarValue) then buf.Append('%') |> ignore @@ -263,14 +263,14 @@ module internal PrintfImpl = /// Represents one step in the execution of a format string [] type Step = - | StepWithArg of prefix: string * conv: (obj -> string) - | StepWithTypedArg of prefix: string * conv: (obj -> Type -> string) + | StepWithArg of prefix: string * conv: (objnull -> string) + | StepWithTypedArg of prefix: string * conv: (objnull -> Type -> string) | StepString of prefix: string | StepLittleT of prefix: string | StepLittleA of prefix: string - | StepStar1 of prefix: string * conv: (obj -> int -> string) + | StepStar1 of prefix: string * conv: (objnull -> int -> string) | StepPercentStar1 of prefix: string - | StepStar2 of prefix: string * conv: (obj -> int -> int -> string) + | StepStar2 of prefix: string * conv: (objnull -> int -> int -> string) | StepPercentStar2 of prefix: string // Count the number of string fragments in a sequence of steps @@ -323,7 +323,7 @@ module internal PrintfImpl = if not (String.IsNullOrEmpty s) then env.Write s - member env.RunSteps (args: obj array, argTys: Type array, steps: Step array) = + member env.RunSteps (args: objnull array, argTys: Type array, steps: Step array) = let mutable argIndex = 0 let mutable tyIndex = 0 @@ -359,7 +359,7 @@ module internal PrintfImpl = argIndex <- argIndex + 1 let arg = args.[argIndex] argIndex <- argIndex + 1 - let f = farg :?> ('State -> obj -> 'Residue) + let f = farg :?> ('State -> objnull -> 'Residue) env.WriteT(f env.State arg) | StepStar1(prefix, conv) -> @@ -395,7 +395,7 @@ module internal PrintfImpl = /// Type of results produced by specialization. /// /// This is a function that accepts a thunk to create PrintfEnv on demand (at the very last - /// appliction of an argument) and returns a concrete instance of an appriate curried printer. + /// application of an argument) and returns a concrete instance of an appropriate curried printer. /// /// After all arguments are collected, specialization obtains concrete PrintfEnv from the thunk /// and uses it to output collected data. @@ -410,7 +410,7 @@ module internal PrintfImpl = /// If we captured into an mutable array then these would interfere type PrintfInitial<'State, 'Residue, 'Result> = (unit -> PrintfEnv<'State, 'Residue, 'Result>) type PrintfFuncFactory<'Printer, 'State, 'Residue, 'Result> = - delegate of obj list * PrintfInitial<'State, 'Residue, 'Result> -> 'Printer + delegate of objnull list * PrintfInitial<'State, 'Residue, 'Result> -> 'Printer [] let MaxArgumentsInSpecialization = 3 @@ -477,7 +477,7 @@ module internal PrintfImpl = static member CaptureLittleA<'A, 'Tail>(next: PrintfFuncFactory<_, 'State, 'Residue, 'Result>) = PrintfFuncFactory<_, 'State, 'Residue, 'Result>(fun args initial -> (fun (f: 'State -> 'A -> 'Residue) (arg1: 'A) -> - let args = box arg1 :: box (fun s (arg:obj) -> f s (unbox arg)) :: args + let args = box arg1 :: box (fun s (arg:objnull) -> f s (unbox arg)) :: args next.Invoke(args, initial) : 'Tail ) ) @@ -546,12 +546,12 @@ module internal PrintfImpl = /// A wrapper struct used to slightly strengthen the types of "ValueConverter" objects produced during composition of /// the dynamic implementation. These are always functions but sometimes they take one argument, sometimes two. [] - type ValueConverter internal (f: obj) = + type ValueConverter internal (f: objnull) = member x.FuncObj = f - static member inline Make (f: obj -> string) = ValueConverter(box f) - static member inline Make (f: obj -> int -> string) = ValueConverter(box f) - static member inline Make (f: obj -> int-> int -> string) = ValueConverter(box f) + static member inline Make (f: objnull -> string) = ValueConverter(box f) + static member inline Make (f: objnull -> int -> string) = ValueConverter(box f) + static member inline Make (f: objnull -> int-> int -> string) = ValueConverter(box f) let getFormatForFloat (ch: char) (prec: int) = ch.ToString() + prec.ToString() @@ -569,7 +569,7 @@ module internal PrintfImpl = /// pad here is function that converts T to string with respect of justification /// basic - function that converts T to string without applying justification rules /// adaptPaddedFormatted returns boxed function that has various number of arguments depending on if width\precision flags has '*' value - let adaptPaddedFormatted (spec: FormatSpecifier) getFormat (basic: string -> obj -> string) (pad: string -> int -> obj -> string) : ValueConverter = + let adaptPaddedFormatted (spec: FormatSpecifier) getFormat (basic: string -> objnull -> string) (pad: string -> int -> objnull -> string) : ValueConverter = if spec.IsStarWidth then if spec.IsStarPrecision then // width=*, prec=* @@ -609,7 +609,7 @@ module internal PrintfImpl = /// pad here is function that converts T to string with respect of justification /// basic - function that converts T to string without applying justification rules /// adaptPadded returns boxed function that has various number of arguments depending on if width flags has '*' value - let adaptPadded (spec: FormatSpecifier) (basic: obj -> string) (pad: int -> obj -> string) : ValueConverter = + let adaptPadded (spec: FormatSpecifier) (basic: objnull -> string) (pad: int -> objnull -> string) : ValueConverter = if spec.IsStarWidth then // width=*, prec=? ValueConverter.Make (fun v width -> @@ -624,7 +624,7 @@ module internal PrintfImpl = ValueConverter.Make ( basic) - let withPaddingFormatted (spec: FormatSpecifier) getFormat (defaultFormat: string) (f: string -> obj -> string) left right : ValueConverter = + let withPaddingFormatted (spec: FormatSpecifier) getFormat (defaultFormat: string) (f: string -> objnull -> string) left right : ValueConverter = if not (spec.IsWidthSpecified || spec.IsPrecisionSpecified) then ValueConverter.Make (f defaultFormat) else @@ -633,7 +633,7 @@ module internal PrintfImpl = else adaptPaddedFormatted spec getFormat f right - let withPadding (spec: FormatSpecifier) (f: obj -> string) left right : ValueConverter = + let withPadding (spec: FormatSpecifier) (f: objnull -> string) left right : ValueConverter = if not spec.IsWidthSpecified then ValueConverter.Make f else @@ -644,11 +644,11 @@ module internal PrintfImpl = /// Contains functions to handle left/right justifications for non-numeric types (strings/bools) module Basic = - let leftJustify (f: obj -> string) padChar = + let leftJustify (f: objnull -> string) padChar = fun (w: int) v -> (f v).PadRight(w, padChar) - let rightJustify (f: obj -> string) padChar = + let rightJustify (f: objnull -> string) padChar = fun (w: int) v -> (f v).PadLeft(w, padChar) @@ -725,16 +725,16 @@ module internal PrintfImpl = else str /// noJustification handler for f: 'T -> string - basic integer types - let noJustification (f: obj -> string) (prefix: string) isUnsigned = + let noJustification (f: objnull -> string) (prefix: string) isUnsigned = if isUnsigned then - fun (v: obj) -> noJustificationCore (f v) true true prefix + fun (v: objnull) -> noJustificationCore (f v) true true prefix else - fun (v: obj) -> noJustificationCore (f v) true (isPositive v) prefix + fun (v: objnull) -> noJustificationCore (f v) true (isPositive v) prefix /// contains functions to handle left/right and no justification case for numbers module Integer = - let eliminateNative (v: obj) = + let eliminateNative (v: objnull) = match v with | :? nativeint as n -> if IntPtr.Size = 4 then box (n.ToInt32()) @@ -744,7 +744,7 @@ module internal PrintfImpl = else box (uint64 (n.ToUInt64())) | _ -> v - let rec toString (v: obj) = + let rec toString (v: objnull) = match v with | :? int32 as n -> n.ToString(CultureInfo.InvariantCulture) | :? int64 as n -> n.ToString(CultureInfo.InvariantCulture) @@ -770,7 +770,7 @@ module internal PrintfImpl = | :? nativeint | :? unativeint -> toFormattedString fmt (eliminateNative v) | _ -> failwith "toFormattedString: unreachable" - let rec toUnsigned (v: obj) = + let rec toUnsigned (v: objnull) = match v with | :? int32 as n -> box (uint32 n) | :? int64 as n -> box (uint64 n) @@ -780,35 +780,35 @@ module internal PrintfImpl = | _ -> v /// Left justification handler for f: 'T -> string - basic integer types - let leftJustify isGFormat (f: obj -> string) (prefix: string) padChar isUnsigned = + let leftJustify isGFormat (f: objnull -> string) (prefix: string) padChar isUnsigned = if isUnsigned then if isGFormat then - fun (w: int) (v: obj) -> + fun (w: int) (v: objnull) -> GenericNumber.leftJustifyWithGFormat (f v) true true true w prefix padChar else - fun (w: int) (v: obj) -> + fun (w: int) (v: objnull) -> GenericNumber.leftJustifyWithNonGFormat (f v) true true w prefix padChar else if isGFormat then - fun (w: int) (v: obj) -> + fun (w: int) (v: objnull) -> GenericNumber.leftJustifyWithGFormat (f v) true true (GenericNumber.isPositive v) w prefix padChar else - fun (w: int) (v: obj) -> + fun (w: int) (v: objnull) -> GenericNumber.leftJustifyWithNonGFormat (f v) true (GenericNumber.isPositive v) w prefix padChar /// Right justification handler for f: 'T -> string - basic integer types let rightJustify f (prefixForPositives: string) padChar isUnsigned = if isUnsigned then if padChar = '0' then - fun (w: int) (v: obj) -> + fun (w: int) (v: objnull) -> GenericNumber.rightJustifyWithZeroAsPadChar (f v) true true w prefixForPositives else System.Diagnostics.Debug.Assert((padChar = ' ')) - fun (w: int) (v: obj) -> + fun (w: int) (v: objnull) -> GenericNumber.rightJustifyWithSpaceAsPadChar (f v) true true w prefixForPositives else if padChar = '0' then - fun (w: int) (v: obj) -> + fun (w: int) (v: objnull) -> GenericNumber.rightJustifyWithZeroAsPadChar (f v) true (GenericNumber.isPositive v) w prefixForPositives else @@ -819,7 +819,7 @@ module internal PrintfImpl = /// Computes a new function from 'f' that wraps the basic conversion given /// by 'f' with padding for 0, spacing and justification, if the flags specify /// it. If they don't, f is made into a value converter - let withPadding (spec: FormatSpecifier) isUnsigned (f: obj -> string) = + let withPadding (spec: FormatSpecifier) isUnsigned (f: objnull -> string) = let allowZeroPadding = not (isLeftJustify spec.Flags) || spec.IsDecimalFormat let padChar, prefix = spec.GetPadAndPrefix allowZeroPadding Padding.withPadding spec @@ -838,13 +838,13 @@ module internal PrintfImpl = | 'X' -> withPadding spec true (toFormattedString "X") | 'o' -> - withPadding spec true (fun (v: obj) -> + withPadding spec true (fun (v: objnull) -> // Convert.ToInt64 throws for uint64 with values above int64 range so cast directly match toUnsigned v with | :? uint64 as u -> Convert.ToString(int64 u, 8) | u -> Convert.ToString(Convert.ToInt64 u, 8)) | 'B' -> - withPadding spec true (fun (v: obj) -> + withPadding spec true (fun (v: objnull) -> match toUnsigned v with | :? uint64 as u -> Convert.ToString(int64 u, 2) | u -> Convert.ToString(Convert.ToInt64 u, 2)) @@ -910,7 +910,7 @@ module internal PrintfImpl = type ObjectPrinter = static member ObjectToString(spec: FormatSpecifier) : ValueConverter = - Basic.withPadding spec (fun (v: obj) -> + Basic.withPadding spec (fun (v: objnull) -> match v with | null -> "" | x -> x.ToString()) @@ -921,7 +921,7 @@ module internal PrintfImpl = match spec.InteropHoleDotNetFormat with | ValueNone -> null | ValueSome fmt -> "{0:" + fmt + "}" - Basic.withPadding spec (fun (vobj: obj) -> + Basic.withPadding spec (fun (vobj: objnull) -> match vobj with | null -> "" | x -> @@ -953,7 +953,7 @@ module internal PrintfImpl = match spec.IsStarWidth, spec.IsStarPrecision with | true, true -> - ValueConverter.Make (fun (vobj: obj) (width: int) (prec: int) -> + ValueConverter.Make (fun (vobj: objnull) (width: int) (prec: int) -> let v = unbox<'T> vobj let opts = { opts with PrintSize = prec } let opts = if not useZeroWidth then { opts with PrintWidth = width} else opts @@ -961,19 +961,19 @@ module internal PrintfImpl = ) | true, false -> - ValueConverter.Make (fun (vobj: obj) (width: int) -> + ValueConverter.Make (fun (vobj: objnull) (width: int) -> let v = unbox<'T> vobj let opts = if not useZeroWidth then { opts with PrintWidth = width} else opts ObjectPrinter.GenericToStringCore(v, opts, bindingFlags)) | false, true -> - ValueConverter.Make (fun (vobj: obj) (prec: int) -> + ValueConverter.Make (fun (vobj: objnull) (prec: int) -> let v = unbox<'T> vobj let opts = { opts with PrintSize = prec } ObjectPrinter.GenericToStringCore(v, opts, bindingFlags) ) | false, false -> - ValueConverter.Make (fun (vobj: obj) -> + ValueConverter.Make (fun (vobj: objnull) -> let v = unbox<'T> vobj ObjectPrinter.GenericToStringCore(v, opts, bindingFlags)) @@ -992,7 +992,7 @@ module internal PrintfImpl = | 's' -> Basic.withPadding spec (unbox >> stringToSafeString) | 'c' -> - Basic.withPadding spec (fun (c: obj) -> (unbox c).ToString()) + Basic.withPadding spec (fun (c: objnull) -> (unbox c).ToString()) | 'M' -> FloatAndDecimal.withPadding spec (fun _ -> "G") "G" // %M ignores precision | 'd' | 'i' | 'u' | 'B' | 'o' | 'x' | 'X' -> @@ -1149,10 +1149,10 @@ module internal PrintfImpl = let argTy = match argTys with null -> typeof | _ -> argTys.[argTys.Length - 1] let conv = getValueConverter argTy spec if isTwoStar then - let convFunc = conv.FuncObj :?> (obj -> int -> int -> string) + let convFunc = conv.FuncObj :?> (objnull -> int -> int -> string) StepStar2 (prefix, convFunc) else - let convFunc = conv.FuncObj :?> (obj -> int -> string) + let convFunc = conv.FuncObj :?> (objnull -> int -> string) StepStar1 (prefix, convFunc) else // For interpolated string format processing, the static types of the '%A' arguments @@ -1162,7 +1162,7 @@ module internal PrintfImpl = let convFunc arg argTy = let mi = mi_GenericToString.MakeGenericMethod [| argTy |] let f = mi.Invoke(null, [| box spec |]) :?> ValueConverter - let f2 = f.FuncObj :?> (obj -> string) + let f2 = f.FuncObj :?> (objnull -> string) f2 arg StepWithTypedArg (prefix, convFunc) @@ -1172,7 +1172,7 @@ module internal PrintfImpl = // are provided via the argument typed extracted from the curried function. They are known on first phase. let argTy = match argTys with null -> typeof | _ -> argTys.[0] let conv = getValueConverter argTy spec - let convFunc = conv.FuncObj :?> (obj -> string) + let convFunc = conv.FuncObj :?> (objnull -> string) StepWithArg (prefix, convFunc) let parseSpec (i: byref) = diff --git a/src/FSharp.Core/printf.fsi b/src/FSharp.Core/printf.fsi index 2e4d009c537..5bbe8405535 100644 --- a/src/FSharp.Core/printf.fsi +++ b/src/FSharp.Core/printf.fsi @@ -31,14 +31,14 @@ type PrintfFormat<'Printer, 'State, 'Residue, 'Result> = /// The types of expressions for %A expression gaps in interpolated string. /// The PrintfFormat containing the formatted result. new: - value: string * captures: obj array * captureTys: Type array -> + value: string * captures: objnull array * captureTys: Type array -> PrintfFormat<'Printer, 'State, 'Residue, 'Result> /// The raw text of the format string. member Value: string /// The captures associated with an interpolated string. - member Captures: obj array + member Captures: objnull array /// The capture types associated with an interpolated string. member CaptureTypes: System.Type array @@ -71,7 +71,7 @@ type PrintfFormat<'Printer, 'State, 'Residue, 'Result, 'Tuple> = /// /// The created format string. new: - value: string * captures: obj array * captureTys: Type array -> + value: string * captures: objnull array * captureTys: Type array -> PrintfFormat<'Printer, 'State, 'Residue, 'Result, 'Tuple> /// Type of a formatting expression. diff --git a/src/FSharp.Core/quotations.fs b/src/FSharp.Core/quotations.fs index 4c71bf0d928..2f90f7a48ee 100644 --- a/src/FSharp.Core/quotations.fs +++ b/src/FSharp.Core/quotations.fs @@ -140,13 +140,13 @@ type Var(name: string, typ: Type, ?isMutable: bool) = override _.GetHashCode() = base.GetHashCode() - override v.Equals(obj: obj) = + override v.Equals(obj: objnull) = match obj with | :? Var as v2 -> System.Object.ReferenceEquals(v, v2) | _ -> false interface System.IComparable with - member v.CompareTo(obj: obj) = + member v.CompareTo(obj: objnull) = match obj with | :? Var as v2 -> if System.Object.ReferenceEquals(v, v2) then @@ -223,15 +223,15 @@ and [] ExprConstInfo = | ForIntegerRangeLoopOp | WhileLoopOp // Arbitrary spliced values - not serialized - | ValueOp of obj * Type * string option - | WithValueOp of obj * Type + | ValueOp of objnull * Type * string option + | WithValueOp of objnull * Type | DefaultValueOp of Type and [] Expr(term: Tree, attribs: Expr list) = member x.Tree = term member x.CustomAttributes = attribs - override x.Equals obj = + override x.Equals(obj: objnull) = match obj with | :? Expr as y -> let rec eq t1 t2 = @@ -2655,7 +2655,7 @@ type Expr with static member Value(value: 'T) = mkValue (box value, typeof<'T>) - static member Value(value: obj, expressionType: Type) = + static member Value(value: objnull, expressionType: Type) = checkNonNull "expressionType" expressionType mkValue (value, expressionType) @@ -2663,7 +2663,7 @@ type Expr with checkNonNull "name" name mkValueWithName (box value, typeof<'T>, name) - static member ValueWithName(value: obj, expressionType: Type, name: string) = + static member ValueWithName(value: objnull, expressionType: Type, name: string) = checkNonNull "expressionType" expressionType checkNonNull "name" name mkValueWithName (value, expressionType, name) @@ -2672,7 +2672,7 @@ type Expr with let raw = mkValueWithDefn (box value, typeof<'T>, definition) new Expr<'T>(raw.Tree, raw.CustomAttributes) - static member WithValue(value: obj, expressionType: Type, definition: Expr) = + static member WithValue(value: objnull, expressionType: Type, definition: Expr) = checkNonNull "expressionType" expressionType mkValueWithDefn (value, expressionType, definition) @@ -2917,7 +2917,7 @@ module DerivedPatterns = module ExprShape = open Patterns - let RebuildShapeCombination (shape: obj, arguments) = + let RebuildShapeCombination (shape: objnull, arguments) = // preserve the attributes let op, attrs = unbox (shape) diff --git a/src/FSharp.Core/quotations.fsi b/src/FSharp.Core/quotations.fsi index ad69f801996..ebb3d1021ef 100644 --- a/src/FSharp.Core/quotations.fsi +++ b/src/FSharp.Core/quotations.fsi @@ -187,7 +187,7 @@ type Expr = /// member CustomAttributes: Expr list - override Equals: obj: obj -> bool + override Equals: obj: objnull -> bool /// Builds an expression that represents getting the address of a value. /// @@ -214,7 +214,7 @@ type Expr = /// /// The resulting expression. /// - /// + /// /// /// open FSharp.Quotations /// @@ -330,7 +330,7 @@ type Expr = /// /// The resulting expression. /// - /// In this example, we show how to use a witness to cosntruct an `op_Addition` call for a type that doesn't support addition directly: + /// In this example, we show how to use a witness to construct an `op_Addition` call for a type that doesn't support addition directly: /// /// open FSharp.Quotations /// open FSharp.Quotations.Patterns @@ -1047,7 +1047,7 @@ type Expr = /// /// Evaluates to a quotation with the same structure as <@ 1 @>. /// - static member Value: value: obj * expressionType: Type -> Expr + static member Value: value: objnull * expressionType: Type -> Expr /// Builds an expression that represents a constant value /// @@ -1096,7 +1096,7 @@ type Expr = /// /// Evaluates to a quotation with the same structure as <@ 1 @> and associated information that the name of the value is "name". /// - static member ValueWithName: value: obj * expressionType: Type * name: string -> Expr + static member ValueWithName: value: objnull * expressionType: Type * name: string -> Expr /// Builds an expression that represents a value and its associated reflected definition as a quotation /// @@ -1131,7 +1131,7 @@ type Expr = /// /// Evaluates to a quotation that displays as WithValue (1, Call (None, op_Subtraction, [Value (2), Value (1)])). /// - static member WithValue: value: obj * expressionType: Type * definition: Expr -> Expr + static member WithValue: value: objnull * expressionType: Type * definition: Expr -> Expr /// Builds an expression that represents a variable /// @@ -1255,7 +1255,7 @@ type Expr = /// Expr.TryGetReflectedDefinition(methInfoAtString) /// /// Evaluates to a quotation with the same structure as <@ fun (x: string) -> (x, x) @>, which is the implementation of the - /// generic method f instanatiated at type string. + /// generic method f instantiated at type string. /// static member TryGetReflectedDefinition: methodBase: MethodBase -> Expr option @@ -1349,7 +1349,7 @@ type Expr = member ToString: full: bool -> string /// Type-carrying quoted expressions. Expressions are generated either -/// by quotations in source text or programatically +/// by quotations in source text or programmatically and [] Expr<'T> = inherit Expr /// Gets the raw expression associated with this type-carrying expression @@ -1709,7 +1709,7 @@ module Patterns = /// /// [] - val (|Value|_|): input: Expr -> (obj * Type) option + val (|Value|_|): input: Expr -> (objnull * Type) option /// An active pattern to recognize expressions that represent a constant value /// @@ -1719,7 +1719,7 @@ module Patterns = /// /// [] - val (|ValueWithName|_|): input: Expr -> (obj * Type * string) option + val (|ValueWithName|_|): input: Expr -> (objnull * Type * string) option /// An active pattern to recognize expressions that are a value with an associated definition /// @@ -1729,7 +1729,7 @@ module Patterns = /// /// [] - val (|WithValue|_|): input: Expr -> (obj * Type * Expr) option + val (|WithValue|_|): input: Expr -> (objnull * Type * Expr) option /// An active pattern to recognize expressions that represent a variable /// @@ -2188,8 +2188,8 @@ module DerivedPatterns = /// | _ -> failwith "unexpected" /// /// Evaluates implExpr to a quotation with the same structure as <@ fun (x: int) -> (x, x) @>, which is the implementation of the - /// method f. Note that the correct generic instantaition has been applied to the implementation to reflect - /// the the type at the callsite. + /// method f. Note that the correct generic instantiation has been applied to the implementation to reflect + /// the type at the callsite. /// /// [] @@ -2219,8 +2219,8 @@ module DerivedPatterns = /// | _ -> failwith "unexpected" /// /// Evaluates implExpr to a quotation with the same structure as <@ fun (x: C<int>) () -> x @>, which is the implementation of the - /// property Identity. Note that the correct generic instantaition has been applied to the implementation to reflect - /// the the type at the callsite. + /// property Identity. Note that the correct generic instantiation has been applied to the implementation to reflect + /// the type at the callsite. /// /// [] @@ -2250,8 +2250,8 @@ module DerivedPatterns = /// | _ -> failwith "unexpected" /// /// Evaluates implExpr to a quotation with the same structure as <@ fun (x: C<int>) (v: int) -> () @>, which is the implementation of the - /// setter for the property Count. Note that the correct generic instantaition has been applied to the implementation to reflect - /// the the type at the callsite. + /// setter for the property Count. Note that the correct generic instantiation has been applied to the implementation to reflect + /// the type at the callsite. /// /// [] @@ -2269,7 +2269,7 @@ module ExprShape = /// /// [] - val (|ShapeVar|ShapeLambda|ShapeCombination|): input: Expr -> Choice + val (|ShapeVar|ShapeLambda|ShapeCombination|): input: Expr -> Choice /// Re-build combination expressions. The first parameter should be an object /// returned by the ShapeCombination case of the active pattern in this module. @@ -2280,4 +2280,4 @@ module ExprShape = /// The rebuilt expression. /// /// - val RebuildShapeCombination: shape: obj * arguments: Expr list -> Expr + val RebuildShapeCombination: shape: objnull * arguments: Expr list -> Expr diff --git a/src/FSharp.Core/reflect.fs b/src/FSharp.Core/reflect.fs index 6b27929933b..f8c8e57d695 100644 --- a/src/FSharp.Core/reflect.fs +++ b/src/FSharp.Core/reflect.fs @@ -47,7 +47,7 @@ module internal Impl = else Type.op_Equality (ty1, ty2) - let func = typedefof<(obj -> obj)> + let func = typedefof<(objnull -> objnull)> let isOptionType typ = equivHeadTypes typ (typeof) @@ -87,7 +87,7 @@ module internal Impl = Expression.Property(Expression.Convert(param, prop.DeclaringType), prop) let expr = - Expression.Lambda>(Expression.Convert(propExpr, typeof), param) + Expression.Lambda>(Expression.Convert(propExpr, typeof), param) expr.Compile() @@ -96,7 +96,7 @@ module internal Impl = let typedParam = Expression.Variable typ let expr = - Expression.Lambda>( + Expression.Lambda>( Expression.Block( [ typedParam ], Expression.Assign(typedParam, Expression.Convert(param, typ)), @@ -115,10 +115,10 @@ module internal Impl = let compileRecordConstructorFunc (ctorInfo: ConstructorInfo) = let ctorParams = ctorInfo.GetParameters() - let paramArray = Expression.Parameter(typeof, "paramArray") + let paramArray = Expression.Parameter(typeof, "paramArray") let expr = - Expression.Lambda>( + Expression.Lambda>( Expression.Convert( Expression.New( ctorInfo, @@ -139,10 +139,10 @@ module internal Impl = let compileUnionCaseConstructorFunc (methodInfo: MethodInfo) = let methodParams = methodInfo.GetParameters() - let paramArray = Expression.Parameter(typeof, "param") + let paramArray = Expression.Parameter(typeof, "param") let expr = - Expression.Lambda>( + Expression.Lambda>( Expression.Convert( Expression.Call( methodInfo, @@ -169,7 +169,7 @@ module internal Impl = | Choice1Of2 info -> Expression.Call(info, Expression.Convert(param, info.DeclaringType)) :> Expression | Choice2Of2 info -> Expression.Property(Expression.Convert(param, info.DeclaringType), info) :> _ - let expr = Expression.Lambda>(tag, param) + let expr = Expression.Lambda>(tag, param) expr.Compile() let compileTupleConstructor tupleEncField getTupleConstructorMethod typ = @@ -192,10 +192,10 @@ module internal Impl = ] ) - let elements = Expression.Parameter(typeof, "elements") + let elements = Expression.Parameter(typeof, "elements") let expr = - Expression.Lambda>( + Expression.Lambda>( Expression.Convert(constituentTuple typ elements 0, typeof), elements ) @@ -246,7 +246,7 @@ module internal Impl = genericArgs.Length let expr = - Expression.Lambda>( + Expression.Lambda>( Expression.Block( [ outputArray ], [ @@ -516,7 +516,7 @@ module internal Impl = let getUnionCaseRecordReader (typ: Type, tag: int, bindingFlags) = let props = fieldsPropsOfUnionCase (typ, tag, bindingFlags) - (fun (obj: obj) -> + (fun (obj: objnull) -> props |> Array.map (fun prop -> prop.GetValue(obj, bindingFlags, null, null, null))) @@ -526,9 +526,9 @@ module internal Impl = let caseTyp = if isNull caseTyp then typ else caseTyp compileRecordOrUnionCaseReaderFunc(caseTyp, props).Invoke - let getUnionTagReader (typ: Type, bindingFlags) : (obj -> int) = + let getUnionTagReader (typ: Type, bindingFlags) : (objnull -> int) = if isOptionType typ then - (fun (obj: obj) -> + (fun (obj: objnull) -> match obj with | null -> 0 | _ -> 1) @@ -536,19 +536,19 @@ module internal Impl = let tagMap = getUnionTypeTagNameMap (typ, bindingFlags) if tagMap.Length <= 1 then - (fun (_obj: obj) -> 0) + (fun (_obj: objnull) -> 0) else match getInstancePropertyReader (typ, "Tag", bindingFlags) with - | Some reader -> (fun (obj: obj) -> reader obj :?> int) + | Some reader -> (fun (obj: objnull) -> reader obj :?> int) | None -> let m2b = typ.GetMethod("GetTag", BindingFlags.Static ||| bindingFlags, null, [| typ |], null) - (fun (obj: obj) -> m2b.Invoke(null, [| obj |]) :?> int) + (fun (obj: objnull) -> m2b.Invoke(null, [| obj |]) :?> int) - let getUnionTagReaderCompiled (typ: Type, bindingFlags) : (obj -> int) = + let getUnionTagReaderCompiled (typ: Type, bindingFlags) : (objnull -> int) = if isOptionType typ then - (fun (obj: obj) -> + (fun (obj: objnull) -> match obj with | null -> 0 | _ -> 1) @@ -556,7 +556,7 @@ module internal Impl = let tagMap = getUnionTypeTagNameMap (typ, bindingFlags) if tagMap.Length <= 1 then - (fun (_obj: obj) -> 0) + (fun (_obj: objnull) -> 0) else match getInstancePropertyInfo (typ, "Tag", bindingFlags) with | null -> @@ -831,7 +831,7 @@ module internal Impl = let getTupleCtor (typ: Type) = let ctor = getTupleConstructorMethod typ - (fun (args: obj array) -> + (fun (args: objnull array) -> ctor.Invoke(BindingFlags.InvokeMethod ||| BindingFlags.Instance ||| BindingFlags.Public, null, args, null)) let getTupleElementAccessors (typ: Type) = @@ -872,7 +872,7 @@ module internal Impl = let tyBenc = etys.[tupleEncField] let maker2 = getTupleConstructor tyBenc - (fun (args: obj array) -> + (fun (args: objnull array) -> let encVal = maker2 args.[tupleEncField..] maker1 (Array.append args.[0 .. tupleEncField - 1] [| encVal |])) @@ -991,7 +991,7 @@ module internal Impl = let getRecordConstructor (typ: Type, bindingFlags) = let ctor = getRecordConstructorMethod (typ, bindingFlags) - (fun (args: obj array) -> + (fun (args: objnull array) -> ctor.Invoke(BindingFlags.InvokeMethod ||| BindingFlags.Instance ||| bindingFlags, null, args, null)) let getRecordConstructorCompiled (typ: Type, bindingFlags) = @@ -1104,7 +1104,7 @@ type UnionCaseInfo(typ: System.Type, tag: int) = override x.GetHashCode() = typ.GetHashCode() + tag - override _.Equals(obj: obj) = + override _.Equals(obj: objnull) = match obj with | :? UnionCaseInfo as uci -> uci.DeclaringType = typ && uci.Tag = tag | _ -> false @@ -1260,11 +1260,11 @@ type FSharpValue = getRecordReader (typ, bindingFlags) record - static member PreComputeRecordFieldReader(info: PropertyInfo) : obj -> obj = + static member PreComputeRecordFieldReader(info: PropertyInfo) : obj -> objnull = checkNonNull "info" info compilePropGetterFunc(info).Invoke - static member PreComputeRecordReader(recordType: Type, ?bindingFlags) : (obj -> obj array) = + static member PreComputeRecordReader(recordType: Type, ?bindingFlags) : (obj -> objnull array) = let bindingFlags = defaultArg bindingFlags BindingFlags.Public checkRecordType ("recordType", recordType, bindingFlags) getRecordReaderCompiled (recordType, bindingFlags) @@ -1279,7 +1279,7 @@ type FSharpValue = checkRecordType ("recordType", recordType, bindingFlags) getRecordConstructorMethod (recordType, bindingFlags) - static member MakeFunction(functionType: Type, implementation: (obj -> obj)) = + static member MakeFunction(functionType: Type, implementation: (objnull -> objnull)) = checkNonNull "functionType" functionType if not (isFunctionType functionType) then @@ -1291,10 +1291,10 @@ type FSharpValue = let dynCloMakerTy = typedefof> let saverTy = dynCloMakerTy.MakeGenericType [| domain; range |] let o = Activator.CreateInstance saverTy - let (f: (obj -> obj) -> obj) = downcast o + let (f: (objnull -> objnull) -> obj) = downcast o f implementation - static member MakeTuple(tupleElements: obj array, tupleType: Type) = + static member MakeTuple(tupleElements: objnull array, tupleType: Type) = checkNonNull "tupleElements" tupleElements checkTupleType ("tupleType", tupleType) getTupleConstructor tupleType tupleElements @@ -1327,7 +1327,7 @@ type FSharpValue = fields.[index] - static member PreComputeTupleReader(tupleType: Type) : (obj -> obj array) = + static member PreComputeTupleReader(tupleType: Type) : (obj -> objnull array) = checkTupleType ("tupleType", tupleType) (compileTupleReader tupleEncField getTupleElementAccessors tupleType).Invoke @@ -1345,7 +1345,7 @@ type FSharpValue = checkTupleType ("tupleType", tupleType) getTupleConstructorInfo tupleType - static member MakeUnion(unionCase: UnionCaseInfo, args: obj array, ?bindingFlags) = + static member MakeUnion(unionCase: UnionCaseInfo, args: objnull array, ?bindingFlags) = let bindingFlags = defaultArg bindingFlags BindingFlags.Public checkNonNull "unionCase" unionCase getUnionCaseConstructor (unionCase.DeclaringType, unionCase.Tag, bindingFlags) args @@ -1360,10 +1360,10 @@ type FSharpValue = checkNonNull "unionCase" unionCase getUnionCaseConstructorMethod (unionCase.DeclaringType, unionCase.Tag, bindingFlags) - static member GetUnionFields(value: obj, unionType: Type, ?bindingFlags) = + static member GetUnionFields(value: objnull, unionType: Type, ?bindingFlags) = let bindingFlags = defaultArg bindingFlags BindingFlags.Public - let ensureType (typ: Type, obj: obj) = + let ensureType (typ: Type, obj: objnull) = match typ with | null -> match obj with @@ -1381,7 +1381,7 @@ type FSharpValue = let flds = getUnionCaseRecordReader (unionType, tag, bindingFlags) value UnionCaseInfo(unionType, tag), flds - static member PreComputeUnionTagReader(unionType: Type, ?bindingFlags) : (obj -> int) = + static member PreComputeUnionTagReader(unionType: Type, ?bindingFlags) : (objnull -> int) = let bindingFlags = defaultArg bindingFlags BindingFlags.Public checkNonNull "unionType" unionType let unionType = getTypeOfReprType (unionType, bindingFlags) @@ -1395,7 +1395,7 @@ type FSharpValue = checkUnionType (unionType, bindingFlags) getUnionTagMemberInfo (unionType, bindingFlags) - static member PreComputeUnionReader(unionCase: UnionCaseInfo, ?bindingFlags) : (obj -> obj array) = + static member PreComputeUnionReader(unionCase: UnionCaseInfo, ?bindingFlags) : (objnull -> objnull array) = let bindingFlags = defaultArg bindingFlags BindingFlags.Public checkNonNull "unionCase" unionCase let typ = unionCase.DeclaringType @@ -1450,7 +1450,7 @@ module FSharpReflectionExtensions = ( recordType: Type, ?allowAccessToPrivateRepresentation - ) : (obj -> obj array) = + ) : (obj -> objnull array) = let bindingFlags = getBindingFlags allowAccessToPrivateRepresentation FSharpValue.PreComputeRecordReader(recordType, bindingFlags) @@ -1462,7 +1462,7 @@ module FSharpReflectionExtensions = let bindingFlags = getBindingFlags allowAccessToPrivateRepresentation FSharpValue.PreComputeRecordConstructorInfo(recordType, bindingFlags) - static member MakeUnion(unionCase: UnionCaseInfo, args: obj array, ?allowAccessToPrivateRepresentation) = + static member MakeUnion(unionCase: UnionCaseInfo, args: objnull array, ?allowAccessToPrivateRepresentation) = let bindingFlags = getBindingFlags allowAccessToPrivateRepresentation FSharpValue.MakeUnion(unionCase, args, bindingFlags) @@ -1478,11 +1478,15 @@ module FSharpReflectionExtensions = let bindingFlags = getBindingFlags allowAccessToPrivateRepresentation FSharpValue.PreComputeUnionTagMemberInfo(unionType, bindingFlags) - static member GetUnionFields(value: obj, unionType: Type, ?allowAccessToPrivateRepresentation) = + static member GetUnionFields(value: objnull, unionType: Type, ?allowAccessToPrivateRepresentation) = let bindingFlags = getBindingFlags allowAccessToPrivateRepresentation FSharpValue.GetUnionFields(value, unionType, bindingFlags) - static member PreComputeUnionTagReader(unionType: Type, ?allowAccessToPrivateRepresentation) : (obj -> int) = + static member PreComputeUnionTagReader + ( + unionType: Type, + ?allowAccessToPrivateRepresentation + ) : (objnull -> int) = let bindingFlags = getBindingFlags allowAccessToPrivateRepresentation FSharpValue.PreComputeUnionTagReader(unionType, bindingFlags) @@ -1490,7 +1494,7 @@ module FSharpReflectionExtensions = ( unionCase: UnionCaseInfo, ?allowAccessToPrivateRepresentation - ) : (obj -> obj array) = + ) : (objnull -> objnull array) = let bindingFlags = getBindingFlags allowAccessToPrivateRepresentation FSharpValue.PreComputeUnionReader(unionCase, bindingFlags) diff --git a/src/FSharp.Core/reflect.fsi b/src/FSharp.Core/reflect.fsi index 9aa76f62a69..e4a5a546677 100644 --- a/src/FSharp.Core/reflect.fsi +++ b/src/FSharp.Core/reflect.fsi @@ -209,7 +209,7 @@ type FSharpValue = /// The field from the record. /// /// - static member GetRecordField: record: obj * info: PropertyInfo -> obj + static member GetRecordField: record: obj * info: PropertyInfo -> objnull /// Precompute a function for reading a particular field from a record. /// Assumes the given type is a RecordType with a field of the given name. @@ -226,7 +226,7 @@ type FSharpValue = /// A function to read the specified field from the record. /// /// - static member PreComputeRecordFieldReader: info: PropertyInfo -> (obj -> obj) + static member PreComputeRecordFieldReader: info: PropertyInfo -> (obj -> objnull) /// Creates an instance of a record type. /// @@ -243,7 +243,7 @@ type FSharpValue = /// static member MakeRecord: [] recordType: Type * - values: obj array * + values: objnull array * ?bindingFlags: BindingFlags -> obj @@ -258,7 +258,7 @@ type FSharpValue = /// The array of fields from the record. /// /// - static member GetRecordFields: record: obj * ?bindingFlags: BindingFlags -> obj array + static member GetRecordFields: record: obj * ?bindingFlags: BindingFlags -> objnull array /// Precompute a function for reading all the fields from a record. The fields are returned in the /// same order as the fields reported by a call to Microsoft.FSharp.Reflection.Type.GetInfo for @@ -282,7 +282,7 @@ type FSharpValue = static member PreComputeRecordReader: [] recordType: Type * ?bindingFlags: BindingFlags -> - (obj -> obj array) + (obj -> objnull array) /// Precompute a function for constructing a record value. /// @@ -300,7 +300,7 @@ type FSharpValue = static member PreComputeRecordConstructor: [] recordType: Type * ?bindingFlags: BindingFlags -> - (obj array -> obj) + (objnull array -> obj) /// Get a ConstructorInfo for a record type /// @@ -324,7 +324,7 @@ type FSharpValue = /// The constructed union case. /// /// - static member MakeUnion: unionCase: UnionCaseInfo * args: obj array * ?bindingFlags: BindingFlags -> obj + static member MakeUnion: unionCase: UnionCaseInfo * args: objnull array * ?bindingFlags: BindingFlags -> objnull /// Identify the union case and its fields for an object /// @@ -343,10 +343,10 @@ type FSharpValue = /// /// static member GetUnionFields: - value: obj * + value: objnull * [] unionType: Type * ?bindingFlags: BindingFlags -> - UnionCaseInfo * obj array + UnionCaseInfo * objnull array /// Assumes the given type is a union type. /// If not, is raised during pre-computation. @@ -363,7 +363,7 @@ type FSharpValue = /// static member PreComputeUnionTagReader: [] unionType: Type * ?bindingFlags: BindingFlags -> - (obj -> int) + (objnull -> int) /// Precompute a property or static method for reading an integer representing the case tag of a union type. /// @@ -387,7 +387,8 @@ type FSharpValue = /// A function to for reading the fields of the given union case. /// /// - static member PreComputeUnionReader: unionCase: UnionCaseInfo * ?bindingFlags: BindingFlags -> (obj -> obj array) + static member PreComputeUnionReader: + unionCase: UnionCaseInfo * ?bindingFlags: BindingFlags -> (objnull -> objnull array) /// Precompute a function for constructing a discriminated union value for a particular union case. /// @@ -398,7 +399,7 @@ type FSharpValue = /// /// static member PreComputeUnionConstructor: - unionCase: UnionCaseInfo * ?bindingFlags: BindingFlags -> (obj array -> obj) + unionCase: UnionCaseInfo * ?bindingFlags: BindingFlags -> (objnull array -> objnull) /// A method that constructs objects of the given case /// @@ -422,7 +423,7 @@ type FSharpValue = /// The fields from the given exception. /// /// - static member GetExceptionFields: exn: obj * ?bindingFlags: BindingFlags -> obj array + static member GetExceptionFields: exn: obj * ?bindingFlags: BindingFlags -> objnull array /// Creates an instance of a tuple type /// @@ -436,7 +437,7 @@ type FSharpValue = /// An instance of the tuple type with the given elements. /// /// - static member MakeTuple: tupleElements: obj array * tupleType: Type -> obj + static member MakeTuple: tupleElements: objnull array * tupleType: Type -> obj /// Reads a field from a tuple value. /// @@ -448,7 +449,7 @@ type FSharpValue = /// The value of the field. /// /// - static member GetTupleField: tuple: obj * index: int -> obj + static member GetTupleField: tuple: obj * index: int -> objnull /// Reads all fields from a tuple. /// @@ -461,7 +462,7 @@ type FSharpValue = /// An array of the fields from the given tuple. /// /// - static member GetTupleFields: tuple: obj -> obj array + static member GetTupleFields: tuple: obj -> objnull array /// Precompute a function for reading the values of a particular tuple type /// @@ -476,7 +477,7 @@ type FSharpValue = /// /// static member PreComputeTupleReader: - [] tupleType: Type -> (obj -> obj array) + [] tupleType: Type -> (obj -> objnull array) /// Gets information that indicates how to read a field of a tuple /// @@ -503,7 +504,7 @@ type FSharpValue = /// /// static member PreComputeTupleConstructor: - [] tupleType: Type -> (obj array -> obj) + [] tupleType: Type -> (objnull array -> obj) /// Gets a method that constructs objects of the given tuple type. /// For small tuples, no additional type will be returned. @@ -535,7 +536,7 @@ type FSharpValue = /// static member MakeFunction: [] functionType: Type * - implementation: (obj -> obj) -> + implementation: (objnull -> objnull) -> obj /// Contains operations associated with constructing and analyzing F# types such as records, unions and tuples @@ -745,7 +746,7 @@ module FSharpReflectionExtensions = /// static member MakeRecord: [] recordType: Type * - values: obj array * + values: objnull array * ?allowAccessToPrivateRepresentation: bool -> obj @@ -764,7 +765,7 @@ module FSharpReflectionExtensions = static member GetRecordFields: [] record: obj * ?allowAccessToPrivateRepresentation: bool -> - obj array + objnull array /// Precompute a function for reading all the fields from a record. The fields are returned in the /// same order as the fields reported by a call to Microsoft.FSharp.Reflection.Type.GetInfo for @@ -788,7 +789,7 @@ module FSharpReflectionExtensions = static member PreComputeRecordReader: [] recordType: Type * ?allowAccessToPrivateRepresentation: bool -> - (obj -> obj array) + (obj -> objnull array) /// Precompute a function for constructing a record value. /// @@ -806,7 +807,7 @@ module FSharpReflectionExtensions = static member PreComputeRecordConstructor: [] recordType: Type * ?allowAccessToPrivateRepresentation: bool -> - (obj array -> obj) + (objnull array -> obj) /// Get a ConstructorInfo for a record type /// @@ -831,7 +832,7 @@ module FSharpReflectionExtensions = /// /// static member MakeUnion: - unionCase: UnionCaseInfo * args: obj array * ?allowAccessToPrivateRepresentation: bool -> obj + unionCase: UnionCaseInfo * args: objnull array * ?allowAccessToPrivateRepresentation: bool -> objnull /// Identify the union case and its fields for an object /// @@ -851,10 +852,10 @@ module FSharpReflectionExtensions = /// /// static member GetUnionFields: - value: obj * + value: objnull * [] unionType: Type * ?allowAccessToPrivateRepresentation: bool -> - UnionCaseInfo * obj array + UnionCaseInfo * objnull array /// Assumes the given type is a union type. /// If not, is raised during pre-computation. @@ -872,7 +873,7 @@ module FSharpReflectionExtensions = static member PreComputeUnionTagReader: [] unionType: Type * ?allowAccessToPrivateRepresentation: bool -> - (obj -> int) + (objnull -> int) /// Precompute a property or static method for reading an integer representing the case tag of a union type. /// @@ -898,7 +899,7 @@ module FSharpReflectionExtensions = /// /// static member PreComputeUnionReader: - unionCase: UnionCaseInfo * ?allowAccessToPrivateRepresentation: bool -> (obj -> obj array) + unionCase: UnionCaseInfo * ?allowAccessToPrivateRepresentation: bool -> (objnull -> objnull array) /// Precompute a function for constructing a discriminated union value for a particular union case. /// @@ -909,7 +910,7 @@ module FSharpReflectionExtensions = /// /// static member PreComputeUnionConstructor: - unionCase: UnionCaseInfo * ?allowAccessToPrivateRepresentation: bool -> (obj array -> obj) + unionCase: UnionCaseInfo * ?allowAccessToPrivateRepresentation: bool -> (objnull array -> objnull) /// A method that constructs objects of the given case /// @@ -934,7 +935,7 @@ module FSharpReflectionExtensions = /// The fields from the given exception. /// /// - static member GetExceptionFields: exn: obj * ?allowAccessToPrivateRepresentation: bool -> obj array + static member GetExceptionFields: exn: obj * ?allowAccessToPrivateRepresentation: bool -> objnull array type FSharpType with diff --git a/src/FSharp.Core/resumable.fs b/src/FSharp.Core/resumable.fs index 24131ea155f..27e91a93256 100644 --- a/src/FSharp.Core/resumable.fs +++ b/src/FSharp.Core/resumable.fs @@ -63,7 +63,7 @@ and ResumptionFunc<'Data> = delegate of byref> -> b and [] ResumptionDynamicInfo<'Data>(initial: ResumptionFunc<'Data>) = member val ResumptionFunc: ResumptionFunc<'Data> = initial with get, set - member val ResumptionData: obj = null with get, set + member val ResumptionData: objnull = null with get, set abstract MoveNext: machine: byref> -> unit abstract SetStateMachine: machine: byref> * machineState: IAsyncStateMachine -> unit @@ -75,7 +75,7 @@ type MoveNextMethodImpl<'Data> = delegate of byref> /// Defines the implementation of the SetStateMachine method for a struct state machine. type SetStateMachineMethodImpl<'Data> = delegate of byref> * IAsyncStateMachine -> unit -/// Defines the implementation of the code reun after the creation of a struct state machine. +/// Defines the implementation of the code run after the creation of a struct state machine. type AfterCode<'Data, 'Result> = delegate of byref> -> 'Result [] diff --git a/src/FSharp.Core/resumable.fsi b/src/FSharp.Core/resumable.fsi index 3cd295f71e4..466301dc36b 100644 --- a/src/FSharp.Core/resumable.fsi +++ b/src/FSharp.Core/resumable.fsi @@ -49,7 +49,7 @@ and member ResumptionFunc: ResumptionFunc<'Data> with get, set /// Additional data associated with the state machine - member ResumptionData: obj with get, set + member ResumptionData: objnull with get, set /// Executes the MoveNext implementation of the state machine abstract MoveNext: machine: byref> -> unit diff --git a/src/FSharp.Core/seq.fsi b/src/FSharp.Core/seq.fsi index c1e5a6f0ba9..790a486e850 100644 --- a/src/FSharp.Core/seq.fsi +++ b/src/FSharp.Core/seq.fsi @@ -1182,7 +1182,7 @@ module Seq = /// Thrown when the input sequence is null. /// Thrown when the input does not have precisely one element. /// - /// + /// /// /// let inputs = ["banana"] /// @@ -1191,7 +1191,7 @@ module Seq = /// Evaluates to banana /// /// - /// + /// /// /// let inputs = ["pear"; "banana"] /// @@ -1200,7 +1200,7 @@ module Seq = /// Throws ArgumentException /// /// - /// + /// /// /// [] |> Seq.exactlyOne /// @@ -1217,7 +1217,7 @@ module Seq = /// /// Thrown when the input sequence is null. /// - /// + /// /// /// let inputs = ["banana"] /// @@ -1226,7 +1226,7 @@ module Seq = /// Evaluates to Some banana /// /// - /// + /// /// /// let inputs = ["pear"; "banana"] /// @@ -1235,7 +1235,7 @@ module Seq = /// Evaluates to None /// /// - /// + /// /// /// [] |> Seq.tryExactlyOne /// @@ -2073,7 +2073,7 @@ module Seq = /// | In i -> acc + i /// | Out o -> acc - o) /// - /// Evaluates to a sequence yielding the same results as seq { 0; 1; -1; 2 }. Note 0 is the intial + /// Evaluates to a sequence yielding the same results as seq { 0; 1; -1; 2 }. Note 0 is the initial /// state, 1 the next state, -1 the next state, and 2 the final state. /// [] @@ -2106,7 +2106,7 @@ module Seq = /// | In i -> acc + i /// | Out o -> acc - o) /// - /// Evaluates to a sequence yielding the same results as seq { 2; 1; 3; 0 } by processing each input from back to front. Note 0 is the intial + /// Evaluates to a sequence yielding the same results as seq { 2; 1; 3; 0 } by processing each input from back to front. Note 0 is the initial /// state, 3 the next state, 1 the next state, and 2 the final state, and the states /// are produced from back to front. /// diff --git a/src/FSharp.Core/seqcore.fs b/src/FSharp.Core/seqcore.fs index 68b8c35c48a..89cd432ee9a 100644 --- a/src/FSharp.Core/seqcore.fs +++ b/src/FSharp.Core/seqcore.fs @@ -169,7 +169,7 @@ module internal IEnumerator = f() } - let inline checkNonNull argName arg = + let inline checkNonNull argName (arg: 'T when 'T : null) = if isNull arg then nullArg argName @@ -451,7 +451,7 @@ module RuntimeHelpers = // Enumeration has finished. In this case, we do NOT invoke the exception handlers for the .Dispose() call | None -> disposeOriginal()})) - let CreateEvent (addHandler : 'Delegate -> unit) (removeHandler : 'Delegate -> unit) (createHandler : (obj -> 'Args -> unit) -> 'Delegate ) :IEvent<'Delegate,'Args> = + let CreateEvent (addHandler : 'Delegate -> unit) (removeHandler : 'Delegate -> unit) (createHandler : (objnull -> 'Args -> unit) -> 'Delegate ) :IEvent<'Delegate,'Args> = { new obj() with member x.ToString() = "" interface IEvent<'Delegate,'Args> with diff --git a/src/FSharp.Core/seqcore.fsi b/src/FSharp.Core/seqcore.fsi index e58e1f6ce68..52b4eeb403d 100644 --- a/src/FSharp.Core/seqcore.fsi +++ b/src/FSharp.Core/seqcore.fsi @@ -125,7 +125,7 @@ module RuntimeHelpers = val CreateEvent: addHandler: ('Delegate -> unit) -> removeHandler: ('Delegate -> unit) -> - createHandler: ((obj -> 'Args -> unit) -> 'Delegate) -> + createHandler: ((objnull -> 'Args -> unit) -> 'Delegate) -> Microsoft.FSharp.Control.IEvent<'Delegate, 'Args> /// The F# compiler emits implementations of this type for compiled sequence expressions. diff --git a/src/FSharp.Core/set.fs b/src/FSharp.Core/set.fs index b47bef257c1..85fc718c461 100644 --- a/src/FSharp.Core/set.fs +++ b/src/FSharp.Core/set.fs @@ -697,6 +697,9 @@ module internal SetTree = let ofArray comparer l = Array.fold (fun acc k -> add comparer k acc) empty l +#if NETSTANDARD2_1_OR_GREATER +[, "Create")>] +#endif [] [] [>)>] @@ -901,7 +904,7 @@ type Set<[] 'T when 'T: comparison>(comparer: IComparer<' | _ -> false interface System.IComparable with - member this.CompareTo(that: obj) = + member this.CompareTo(that: objnull) = SetTree.compare this.Comparer this.Tree ((that :?> Set<'T>).Tree) interface IStructuralEquatable with @@ -1023,6 +1026,22 @@ type Set<[] 'T when 'T: comparison>(comparer: IComparer<' .Append("; ... ]") .ToString() +#if NETSTANDARD2_1_OR_GREATER +and [] Set = + [] + static member Create([] items: System.ReadOnlySpan<'T>) = + let comparer = LanguagePrimitives.FastGenericComparer<'T> + let mutable acc = SetTree.empty + + for item in items do + acc <- SetTree.add comparer item acc + + Set(comparer, acc) +#endif + and [] SetDebugView<'T when 'T: comparison>(v: Set<'T>) = [] diff --git a/src/FSharp.Core/set.fsi b/src/FSharp.Core/set.fsi index 58615cedaa9..1be1ad557df 100644 --- a/src/FSharp.Core/set.fsi +++ b/src/FSharp.Core/set.fsi @@ -13,6 +13,9 @@ open Microsoft.FSharp.Collections /// See the module for further operations on sets. /// /// All members of this class are thread-safe and may be used concurrently from multiple threads. +#if NETSTANDARD2_1_OR_GREATER +[, "Create")>] +#endif [] [] type Set<[] 'T when 'T: comparison> = @@ -231,7 +234,22 @@ type Set<[] 'T when 'T: comparison> = interface System.IComparable interface System.Collections.IStructuralEquatable interface IReadOnlyCollection<'T> - override Equals: obj -> bool + override Equals: objnull -> bool + +#if NETSTANDARD2_1_OR_GREATER +/// Contains methods for compiler use related to sets. +and [] Set = + /// Creates a set with the specified items. + /// + /// The items to store in the set. + /// + /// A set containing the specified items. + [] + static member Create: [] items: System.ReadOnlySpan<'T> -> Set<'T> +#endif namespace Microsoft.FSharp.Collections diff --git a/src/FSharp.Core/string.fsi b/src/FSharp.Core/string.fsi index 3fd18d511ee..e7c6ef062ad 100644 --- a/src/FSharp.Core/string.fsi +++ b/src/FSharp.Core/string.fsi @@ -165,7 +165,7 @@ module String = /// The function to be applied to each character of the string. /// The input string. /// - /// Printing the ASCII code for each characater in the string + /// Printing the ASCII code for each character in the string /// /// let input = "Hello" /// input |> String.iter (fun c -> printfn "%c %d" c (int c)) @@ -189,7 +189,7 @@ module String = /// The input string. /// /// Numbering the characters and printing the associated ASCII code - /// for each characater in the input string + /// for each character in the input string /// /// let input = "Hello" /// input |> String.iteri (fun i c -> printfn "%d. %c %d" (i + 1) c (int c)) diff --git a/src/FSharp.Core/tasks.fsi b/src/FSharp.Core/tasks.fsi index 087066d7dea..47713a60a3f 100644 --- a/src/FSharp.Core/tasks.fsi +++ b/src/FSharp.Core/tasks.fsi @@ -82,13 +82,13 @@ type TaskBuilderBase = member inline Return: value: 'T -> TaskCode<'T, 'T> /// - /// Specifies a unit of task code which excuted using try/finally semantics + /// Specifies a unit of task code which executed using try/finally semantics /// member inline TryFinally: body: TaskCode<'TOverall, 'T> * [] compensation: (unit -> unit) -> TaskCode<'TOverall, 'T> /// - /// Specifies a unit of task code which excuted using try/with semantics + /// Specifies a unit of task code which executed using try/with semantics /// member inline TryWith: body: TaskCode<'TOverall, 'T> * catch: (exn -> TaskCode<'TOverall, 'T>) -> TaskCode<'TOverall, 'T> diff --git a/src/FSharp.Core/xlf/FSCore.cs.xlf b/src/FSharp.Core/xlf/FSCore.cs.xlf index c1837555d36..436ba705358 100644 --- a/src/FSharp.Core/xlf/FSCore.cs.xlf +++ b/src/FSharp.Core/xlf/FSCore.cs.xlf @@ -562,7 +562,7 @@ Chybný specifikátor formátu: {0} - + Bad integer supplied to dynamic formatter Dynamickému formátovacímu modulu byla předána chybná celočíselná hodnota. @@ -592,7 +592,7 @@ Nejedná se o typ funkce. - + Bad format specifier (precision) Chybný specifikátor formátu (přesnost) diff --git a/src/FSharp.Core/xlf/FSCore.de.xlf b/src/FSharp.Core/xlf/FSCore.de.xlf index bb113a5dd44..df2b28aaecb 100644 --- a/src/FSharp.Core/xlf/FSCore.de.xlf +++ b/src/FSharp.Core/xlf/FSCore.de.xlf @@ -562,7 +562,7 @@ Ungültiger Formatbezeichner: {0} - + Bad integer supplied to dynamic formatter Für den dynamischen Formatierer wurde ein ungültiger Integer bereitgestellt. @@ -592,7 +592,7 @@ Kein Funktionstyp. - + Bad format specifier (precision) Ungültiger Formatbezeichner (precision) diff --git a/src/FSharp.Core/xlf/FSCore.es.xlf b/src/FSharp.Core/xlf/FSCore.es.xlf index da7f8919363..a1e7d0f7fa8 100644 --- a/src/FSharp.Core/xlf/FSCore.es.xlf +++ b/src/FSharp.Core/xlf/FSCore.es.xlf @@ -562,7 +562,7 @@ Especificador de formato incorrecto: {0} - + Bad integer supplied to dynamic formatter Se proporcionó un entero incorrecto a un formateador dinámico. @@ -592,7 +592,7 @@ No es un tipo de función. - + Bad format specifier (precision) Especificador de formato incorrecto (precisión). diff --git a/src/FSharp.Core/xlf/FSCore.fr.xlf b/src/FSharp.Core/xlf/FSCore.fr.xlf index 7dc0ce7839d..ff8acfc83c4 100644 --- a/src/FSharp.Core/xlf/FSCore.fr.xlf +++ b/src/FSharp.Core/xlf/FSCore.fr.xlf @@ -562,7 +562,7 @@ Spécificateur de format incorrect :{0} - + Bad integer supplied to dynamic formatter Entier incorrect fourni au formateur dynamique @@ -592,7 +592,7 @@ N'est pas un type de fonction - + Bad format specifier (precision) Spécificateur de format incorrect (précision) diff --git a/src/FSharp.Core/xlf/FSCore.it.xlf b/src/FSharp.Core/xlf/FSCore.it.xlf index 170e1e51a8c..3643c1ce16c 100644 --- a/src/FSharp.Core/xlf/FSCore.it.xlf +++ b/src/FSharp.Core/xlf/FSCore.it.xlf @@ -562,7 +562,7 @@ Identificatore di formato non valido: {0} - + Bad integer supplied to dynamic formatter Intero non valido fornito al formattatore dinamico @@ -592,7 +592,7 @@ Non è un tipo di funzione - + Bad format specifier (precision) Identificatore di formato non valido (precision) diff --git a/src/FSharp.Core/xlf/FSCore.ja.xlf b/src/FSharp.Core/xlf/FSCore.ja.xlf index 23b3da2999c..285dfb02872 100644 --- a/src/FSharp.Core/xlf/FSCore.ja.xlf +++ b/src/FSharp.Core/xlf/FSCore.ja.xlf @@ -562,7 +562,7 @@ 書式指定子が正しくありません: {0} - + Bad integer supplied to dynamic formatter 動的フォーマッタに対して指定された整数が正しくありません @@ -592,7 +592,7 @@ 関数型ではありません - + Bad format specifier (precision) 書式指定子 (精度) が正しくありません diff --git a/src/FSharp.Core/xlf/FSCore.ko.xlf b/src/FSharp.Core/xlf/FSCore.ko.xlf index 0b5c94149ab..e5a88b267b0 100644 --- a/src/FSharp.Core/xlf/FSCore.ko.xlf +++ b/src/FSharp.Core/xlf/FSCore.ko.xlf @@ -562,7 +562,7 @@ 잘못된 형식 지정자: {0} - + Bad integer supplied to dynamic formatter 동적 포맷터에 제공된 정수가 잘못되었습니다. @@ -592,7 +592,7 @@ 함수 형식이 아닙니다. - + Bad format specifier (precision) 잘못된 형식 지정자(전체 자릿수) diff --git a/src/FSharp.Core/xlf/FSCore.pl.xlf b/src/FSharp.Core/xlf/FSCore.pl.xlf index 2fdde8861c9..a64948b4609 100644 --- a/src/FSharp.Core/xlf/FSCore.pl.xlf +++ b/src/FSharp.Core/xlf/FSCore.pl.xlf @@ -562,7 +562,7 @@ Błędny specyfikator formatu:{0} - + Bad integer supplied to dynamic formatter Do dynamicznego modułu formatującego została przekazana błędna liczba całkowita. @@ -592,7 +592,7 @@ To nie jest typ funkcji. - + Bad format specifier (precision) Błędny specyfikator formatu (dokładności). diff --git a/src/FSharp.Core/xlf/FSCore.pt-BR.xlf b/src/FSharp.Core/xlf/FSCore.pt-BR.xlf index 78d9107a472..591a8e6560f 100644 --- a/src/FSharp.Core/xlf/FSCore.pt-BR.xlf +++ b/src/FSharp.Core/xlf/FSCore.pt-BR.xlf @@ -562,7 +562,7 @@ Especificador de formato incorreto:{0} - + Bad integer supplied to dynamic formatter Inteiro incorreto fornecido a formatador dinâmico @@ -592,7 +592,7 @@ Não é um tipo de função - + Bad format specifier (precision) Especificador de formato incorreto (precisão) diff --git a/src/FSharp.Core/xlf/FSCore.ru.xlf b/src/FSharp.Core/xlf/FSCore.ru.xlf index c45569be955..edb281a0102 100644 --- a/src/FSharp.Core/xlf/FSCore.ru.xlf +++ b/src/FSharp.Core/xlf/FSCore.ru.xlf @@ -562,7 +562,7 @@ Неверный спецификатор формата:{0} - + Bad integer supplied to dynamic formatter Динамическому форматтеру передано неверное целое @@ -592,7 +592,7 @@ Не является типом функции - + Bad format specifier (precision) Неверный спецификатор формата (точность) diff --git a/src/FSharp.Core/xlf/FSCore.tr.xlf b/src/FSharp.Core/xlf/FSCore.tr.xlf index f168225ae6f..d0ab6c80129 100644 --- a/src/FSharp.Core/xlf/FSCore.tr.xlf +++ b/src/FSharp.Core/xlf/FSCore.tr.xlf @@ -562,7 +562,7 @@ Hatalı biçim belirticisi: {0} - + Bad integer supplied to dynamic formatter Dinamik biçimlendiriciye yanlış tamsayı sağlandı @@ -592,7 +592,7 @@ Bir işlev türü değil - + Bad format specifier (precision) Hatalı biçim belirticisi (duyarlık) diff --git a/src/FSharp.Core/xlf/FSCore.zh-Hans.xlf b/src/FSharp.Core/xlf/FSCore.zh-Hans.xlf index 4995ea34088..498188f67af 100644 --- a/src/FSharp.Core/xlf/FSCore.zh-Hans.xlf +++ b/src/FSharp.Core/xlf/FSCore.zh-Hans.xlf @@ -562,7 +562,7 @@ 错误的格式说明符: {0} - + Bad integer supplied to dynamic formatter 提供给动态格式化程序的整数错误 @@ -592,7 +592,7 @@ 不是函数类型 - + Bad format specifier (precision) 错误的格式说明符(精度) diff --git a/src/FSharp.Core/xlf/FSCore.zh-Hant.xlf b/src/FSharp.Core/xlf/FSCore.zh-Hant.xlf index e89c723874d..7e5727be136 100644 --- a/src/FSharp.Core/xlf/FSCore.zh-Hant.xlf +++ b/src/FSharp.Core/xlf/FSCore.zh-Hant.xlf @@ -562,7 +562,7 @@ 不正確的格式規範: {0} - + Bad integer supplied to dynamic formatter 提供給動態格式器的整數錯誤 @@ -592,7 +592,7 @@ 不是函式類型 - + Bad format specifier (precision) 不正確的格式修飾詞 (精確度) diff --git a/src/FSharp.DependencyManager.Nuget/FSDependencyManager.txt b/src/FSharp.DependencyManager.Nuget/FSDependencyManager.txt index 77dece7bf41..e70d2691151 100644 --- a/src/FSharp.DependencyManager.Nuget/FSDependencyManager.txt +++ b/src/FSharp.DependencyManager.Nuget/FSDependencyManager.txt @@ -1,5 +1,5 @@ # FSharp.Build resource strings -cantReferenceSystemPackage,"PackageManager can not reference the System Package '%s'" +cantReferenceSystemPackage,"PackageManager cannot reference the System Package '%s'" requiresAValue,"%s requires a value" unableToApplyImplicitArgument,"Unable to apply implicit argument number %d" notUsed,"Not used" diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Nuget.fsproj b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Nuget.fsproj index eacd502af68..4700c172f52 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Nuget.fsproj +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Nuget.fsproj @@ -32,6 +32,7 @@ + diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs index 3cbac354977..6b9d33ff663 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs @@ -154,16 +154,16 @@ module internal Utilities = let result = ResizeArray() let mutable insideSQ = false let mutable start = 0 - let isSeperator c = c = ',' + let isSeparator c = c = ',' for i = 0 to last do match text[i], insideSQ with - | c, false when isSeperator c -> // split when seeing a separator + | c, false when isSeparator c -> // split when seeing a separator result.Add(text.Substring(start, i - start)) insideSQ <- false start <- i + 1 | _, _ when i = last -> result.Add(text.Substring(start, i - start + 1)) - | c, true when isSeperator c -> // keep reading if a separator is inside quotation + | c, true when isSeparator c -> // keep reading if a separator is inside quotation insideSQ <- true | '\'', _ when isNotQuotedQuotation text i -> // open or close quotation insideSQ <- not insideSQ // keep reading diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs index c6c7247b0df..fe0433f71cf 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs @@ -253,7 +253,7 @@ module FSharpDependencyManager = type ResolveDependenciesResult (success: bool, stdOut: string array, stdError: string array, resolutions: string seq, sourceFiles: string seq, roots: string seq) = - /// Succeded? + /// Succeeded? member _.Success = success /// The resolution output log @@ -306,7 +306,7 @@ type FSharpDependencyManager(outputDirectory: string option, useResultsCache: bo // if the path wasn't supplied or not rooted use the temp directory as the root. let specialDir = let getProfilePath = - // If it has a directory seperator remove it + // If it has a directory separator remove it let path = Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile) if diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fsi b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fsi index 56d037274af..defe300d6ff 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fsi +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fsi @@ -15,7 +15,7 @@ module internal FSharpDependencyManager = [] type ResolveDependenciesResult = - /// Succeded? + /// Succeeded? member Success: bool /// The resolution output log @@ -39,7 +39,7 @@ type ResolveDependenciesResult = /// the dependency manager will be able to probe and resolve any native dependencies /// required by the nuget package. /// - /// This path is also equivant to + /// This path is also equivalent to /// #I @"c:\somepath\to\packages\ResolvedPackage\1.1.1\" member Roots: seq diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.cs.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.cs.xlf index 2866d233f47..2f9b9728cd8 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.cs.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.cs.xlf @@ -3,7 +3,7 @@ - PackageManager can not reference the System Package '{0}' + PackageManager cannot reference the System Package '{0}' PackageManager se nemůže odkazovat na systémový balíček {0}. diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.de.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.de.xlf index 3d060a10414..233c6a93dd3 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.de.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.de.xlf @@ -3,7 +3,7 @@ - PackageManager can not reference the System Package '{0}' + PackageManager cannot reference the System Package '{0}' PackageManager kann nicht auf das Systempaket "{0}" verweisen. diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.es.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.es.xlf index 5b8974e7605..2f7b192634c 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.es.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.es.xlf @@ -3,7 +3,7 @@ - PackageManager can not reference the System Package '{0}' + PackageManager cannot reference the System Package '{0}' PackageManager no puede hacer referencia al paquete del sistema "{0}". diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.fr.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.fr.xlf index 58f97bce018..5d83dfd795a 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.fr.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.fr.xlf @@ -3,7 +3,7 @@ - PackageManager can not reference the System Package '{0}' + PackageManager cannot reference the System Package '{0}' PackageManager ne peut pas référencer le package système '{0}' diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.it.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.it.xlf index e840741112b..9a40ea0246c 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.it.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.it.xlf @@ -3,7 +3,7 @@ - PackageManager can not reference the System Package '{0}' + PackageManager cannot reference the System Package '{0}' PackageManager non può fare riferimento al pacchetto di sistema '{0}' diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ja.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ja.xlf index f0437133108..74a4a7a452c 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ja.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ja.xlf @@ -3,7 +3,7 @@ - PackageManager can not reference the System Package '{0}' + PackageManager cannot reference the System Package '{0}' PackageManager がシステム パッケージ '{0}' を参照できません diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ko.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ko.xlf index 53d85ca1b4f..9837ed7ad3a 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ko.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ko.xlf @@ -3,7 +3,7 @@ - PackageManager can not reference the System Package '{0}' + PackageManager cannot reference the System Package '{0}' PackageManager에서 시스템 패키지 '{0}'을(를) 참조할 수 없습니다. diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pl.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pl.xlf index 9a908307899..6b7b5475c99 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pl.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pl.xlf @@ -3,7 +3,7 @@ - PackageManager can not reference the System Package '{0}' + PackageManager cannot reference the System Package '{0}' Program PacketManager nie może odwoływać się do pakietu systemowego „{0}” diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pt-BR.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pt-BR.xlf index af23785016a..2fb1ed02a8a 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pt-BR.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pt-BR.xlf @@ -3,7 +3,7 @@ - PackageManager can not reference the System Package '{0}' + PackageManager cannot reference the System Package '{0}' PackageManager não pode referenciar o pacote do sistema '{0}' diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ru.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ru.xlf index f57d66e3342..c1193b57c8b 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ru.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ru.xlf @@ -3,7 +3,7 @@ - PackageManager can not reference the System Package '{0}' + PackageManager cannot reference the System Package '{0}' PackageManager не может ссылаться на системный пакет "{0}" diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.tr.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.tr.xlf index d628c815565..5a870233d01 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.tr.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.tr.xlf @@ -3,7 +3,7 @@ - PackageManager can not reference the System Package '{0}' + PackageManager cannot reference the System Package '{0}' PackageManager, '{0}' Sistem Paketine başvuramıyor diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hans.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hans.xlf index 65cd28177b1..520ae8c35a4 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hans.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hans.xlf @@ -3,7 +3,7 @@ - PackageManager can not reference the System Package '{0}' + PackageManager cannot reference the System Package '{0}' PackageManager 无法引用系统包“{0}” diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hant.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hant.xlf index 580ca08a73f..e8bde94aaff 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hant.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hant.xlf @@ -3,7 +3,7 @@ - PackageManager can not reference the System Package '{0}' + PackageManager cannot reference the System Package '{0}' PackageManager 無法參考系統套件 '{0}' diff --git a/src/LegacyMSBuildResolver/LegacyMSBuildReferenceResolver.fs b/src/LegacyMSBuildResolver/LegacyMSBuildReferenceResolver.fs index e1f6f41b9dc..c4230868740 100644 --- a/src/LegacyMSBuildResolver/LegacyMSBuildReferenceResolver.fs +++ b/src/LegacyMSBuildResolver/LegacyMSBuildReferenceResolver.fs @@ -38,7 +38,7 @@ let DotNetFrameworkReferenceAssembliesRootDirectory = // 1. List of frameworks // 2. DeriveTargetFrameworkDirectoriesFor45Plus // 3. HighestInstalledRefAssembliesOrDotNETFramework -// 4. GetPathToDotNetFrameworkImlpementationAssemblies +// 4. GetPathToDotNetFrameworkImplementationAssemblies [] let private Net45 = "v4.5" @@ -74,7 +74,7 @@ let SupportedDesktopFrameworkVersions = /// Get the path to the .NET Framework implementation assemblies by using ToolLocationHelper.GetPathToDotNetFramework /// This is only used to specify the "last resort" path for assembly resolution. -let GetPathToDotNetFrameworkImlpementationAssemblies v : string list = +let GetPathToDotNetFrameworkImplementationAssemblies v : string list = let v = match v with | Net45 -> Some TargetDotNetFrameworkVersion.Version45 @@ -341,7 +341,7 @@ let ResolveCore yield "{AssemblyFolders}" yield "{GAC}" // use path to implementation assemblies as the last resort - yield! GetPathToDotNetFrameworkImlpementationAssemblies targetFrameworkVersion + yield! GetPathToDotNetFrameworkImplementationAssemblies targetFrameworkVersion |] let assemblies = diff --git a/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.fsproj b/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.fsproj index 48865a60de5..6acddc6b86a 100644 --- a/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.fsproj +++ b/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.fsproj @@ -7,7 +7,7 @@ Microsoft.FSharp.Compiler.nuspec true .NET Core compatible version of the F# compiler fsc.exe. - /blob/main/release-notes.md#FSharp-Tools-$(FSProductVersionReleaseNotesVersion) + /blob/main/docs/release-notes/.Language/$(FSLanguageVersion).md true @@ -28,6 +28,10 @@ + + + + @@ -59,9 +63,9 @@ diff --git a/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec b/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec index fed8e38fae3..4322ee7d965 100644 --- a/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec +++ b/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec @@ -44,6 +44,9 @@ + + + diff --git a/src/fsc/fscProject/fsc.fsproj b/src/fsc/fscProject/fsc.fsproj index 889ece967ad..a8d694360c1 100644 --- a/src/fsc/fscProject/fsc.fsproj +++ b/src/fsc/fscProject/fsc.fsproj @@ -9,9 +9,18 @@ + linux + + linux + windows_nt + $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant) + $(MibcTargetOS)-$(MibcTargetArchitecture) + $(ArtifactsDir)mibc-proto\optimization.$(MibcCurrentMachineArcitecture).mibc.runtime\DotNet_FSharp.mibc + $(FSharpNetCoreProductTargetFramework) $(EnablePublishReadyToRun) $(NETCoreSdkRuntimeIdentifier) + $(MibcFile) @@ -24,6 +33,10 @@ $(ArtifactsDir)obj/$(MSBuildProjectName)/$(Configuration)/ + + + + diff --git a/src/fsi/console.fs b/src/fsi/console.fs index 0c1f056533d..6be943317ec 100644 --- a/src/fsi/console.fs +++ b/src/fsi/console.fs @@ -8,6 +8,18 @@ open System.Collections.Generic open System.Runtime.InteropServices open FSharp.Compiler.DiagnosticsLogger +[] +module internal ConsoleHelpers = + +#if NO_CHECKNULLS + type MaybeNull<'T when 'T : null> = 'T + + // Shim to match nullness checking library support in preview + let inline (|Null|NonNull|) (x: 'T) : Choice = match x with null -> Null | v -> NonNull v +#else + type MaybeNull<'T when 'T : not null> = 'T | null +#endif + type internal Style = | Prompt | Out @@ -30,24 +42,20 @@ type internal History() = list.Clear() current <- -1 - member _.Add line = - match line with - | null + member _.Add (line: string MaybeNull) = + match line with + | Null | "" -> () - | _ -> list.Add(line) + | NonNull line -> list.Add(line) - member _.AddLast line = - match line with - | null + member _.AddLast (line: string MaybeNull) = + match line with + | Null | "" -> () - | _ -> + | NonNull line -> list.Add(line) current <- list.Count - // Dead code - // member x.First() = current <- 0; x.Current - // member x.Last() = current <- list.Count - 1; x.Current - member x.Previous() = if (list.Count > 0) then current <- ((current - 1) + list.Count) % list.Count @@ -191,7 +199,7 @@ module internal Utils = /// /// if BufferWidth = Console.BufferWidth - 1, the output will be /// - /// #> 一二三四五六七八九零一二三四五六七八九零# (零 is printed, but will not correctly cauculate cursor position) + /// #> 一二三四五六七八九零一二三四五六七八九零# (零 is printed, but will not correctly calculate cursor position) /// /// #一二三四五六七八九零 # (cursor may appear in the middle of the character) /// diff --git a/tests/AheadOfTime/Equality/Equality.fsproj b/tests/AheadOfTime/Equality/Equality.fsproj index f5a243c65b9..b4d38e1417b 100644 --- a/tests/AheadOfTime/Equality/Equality.fsproj +++ b/tests/AheadOfTime/Equality/Equality.fsproj @@ -2,7 +2,7 @@ Exe - net8.0 + net9.0 preview true @@ -16,8 +16,8 @@ - $(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Release/net8.0/fsc.dll - $(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Release/net8.0/fsc.dll + $(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Release/net9.0/fsc.dll + $(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Release/net9.0/fsc.dll False True diff --git a/tests/AheadOfTime/Equality/check.ps1 b/tests/AheadOfTime/Equality/check.ps1 index b20d99a439f..b98083d2635 100644 --- a/tests/AheadOfTime/Equality/check.ps1 +++ b/tests/AheadOfTime/Equality/check.ps1 @@ -1,6 +1,6 @@ -Write-Host "Publish and Execute: net8.0 - Equality" +Write-Host "Publish and Execute: net9.0 - Equality" -$build_output = dotnet publish -restore -c release -f:net8.0 $(Join-Path $PSScriptRoot Equality.fsproj) +$build_output = dotnet publish -restore -c release -f:net9.0 $(Join-Path $PSScriptRoot Equality.fsproj) # Checking that the build succeeded if ($LASTEXITCODE -ne 0) @@ -10,7 +10,7 @@ if ($LASTEXITCODE -ne 0) } $process = Start-Process ` - -FilePath $(Join-Path $PSScriptRoot bin\release\net8.0\win-x64\publish\Equality.exe) ` + -FilePath $(Join-Path $PSScriptRoot bin\release\net9.0\win-x64\publish\Equality.exe) ` -Wait ` -NoNewWindow ` -PassThru ` diff --git a/tests/AheadOfTime/Trimming/Program.fs b/tests/AheadOfTime/Trimming/Program.fs index 22de634e776..fbdda4cfdd4 100644 --- a/tests/AheadOfTime/Trimming/Program.fs +++ b/tests/AheadOfTime/Trimming/Program.fs @@ -9091,7 +9091,7 @@ module PercentAPublicTests = let data = { A = "Hello, World!"; B = 1.027m; C = 1028; D = 1.029 } test "test8900" (lazy (sprintf "%A" data).Replace("\n", ";")) """{ A = "Hello, World!"; B = 1.027M; C = 1028; D = 1.029 }""" - let testPercentAMyAnnonymousRecord () = + let testPercentAMyAnonymousRecord () = let data = {| A = "Hello, World!"; B = 1.027m; C = 1028; D = 1.029 |} test "test8901" (lazy (sprintf "%A" data).Replace("\n", ";")) """{ A = "Hello, World!"; B = 1.027M; C = 1028; D = 1.029 }""" @@ -9126,7 +9126,7 @@ module PercentAPublicTests = let tests () = testPercentAMyRecord () - testPercentAMyAnnonymousRecord () + testPercentAMyAnonymousRecord () testDiscriminatedUnion () testPercentAOptionChoiceTypes () testUnit () diff --git a/tests/AheadOfTime/Trimming/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj b/tests/AheadOfTime/Trimming/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj index 90842baa584..eb14a3b02dc 100644 --- a/tests/AheadOfTime/Trimming/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj +++ b/tests/AheadOfTime/Trimming/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj @@ -2,7 +2,7 @@ Exe - net8.0 + net9.0 preview true @@ -16,8 +16,8 @@ - $(MSBuildThisFileDirectory)../../../../artifacts/bin/fsc/Release/net8.0/fsc.dll - $(MSBuildThisFileDirectory)../../../../artifacts/bin/fsc/Release/net8.0/fsc.dll + $(MSBuildThisFileDirectory)../../../../artifacts/bin/fsc/Release/net9.0/fsc.dll + $(MSBuildThisFileDirectory)../../../../artifacts/bin/fsc/Release/net9.0/fsc.dll False True diff --git a/tests/AheadOfTime/Trimming/StaticLinkedFSharpCore_Trimming_Test/StaticLinkedFSharpCore_Trimming_Test.fsproj b/tests/AheadOfTime/Trimming/StaticLinkedFSharpCore_Trimming_Test/StaticLinkedFSharpCore_Trimming_Test.fsproj index 7fd0dc7091c..44505002299 100644 --- a/tests/AheadOfTime/Trimming/StaticLinkedFSharpCore_Trimming_Test/StaticLinkedFSharpCore_Trimming_Test.fsproj +++ b/tests/AheadOfTime/Trimming/StaticLinkedFSharpCore_Trimming_Test/StaticLinkedFSharpCore_Trimming_Test.fsproj @@ -2,7 +2,7 @@ Exe - net8.0 + net9.0 preview true false @@ -18,8 +18,8 @@ - $(MSBuildThisFileDirectory)../../../../artifacts/bin/fsc/Release/net8.0/fsc.dll - $(MSBuildThisFileDirectory)../../../../artifacts/bin/fsc/Release/net8.0/fsc.dll + $(MSBuildThisFileDirectory)../../../../artifacts/bin/fsc/Release/net9.0/fsc.dll + $(MSBuildThisFileDirectory)../../../../artifacts/bin/fsc/Release/net9.0/fsc.dll False True diff --git a/tests/AheadOfTime/Trimming/check.ps1 b/tests/AheadOfTime/Trimming/check.ps1 index c9699c66c1b..f375accd624 100644 --- a/tests/AheadOfTime/Trimming/check.ps1 +++ b/tests/AheadOfTime/Trimming/check.ps1 @@ -1,5 +1,6 @@ function CheckTrim($root, $tfm, $outputfile, $expected_len) { Write-Host "Publish and Execute: ${tfm} - ${root}" + Write-Host "Expecting ${expected_len}" $cwd = Get-Location Set-Location (Join-Path $PSScriptRoot "${root}") @@ -42,7 +43,7 @@ function CheckTrim($root, $tfm, $outputfile, $expected_len) { # error NETSDK1124: Trimming assemblies requires .NET Core 3.0 or higher. # Check net7.0 trimmed assemblies -CheckTrim -root "SelfContained_Trimming_Test" -tfm "net8.0" -outputfile "FSharp.Core.dll" -expected_len 284672 +CheckTrim -root "SelfContained_Trimming_Test" -tfm "net9.0" -outputfile "FSharp.Core.dll" -expected_len 297984 # Check net8.0 trimmed assemblies -CheckTrim -root "StaticLinkedFSharpCore_Trimming_Test" -tfm "net8.0" -outputfile "StaticLinkedFSharpCore_Trimming_Test.dll" -expected_len 8818176 +CheckTrim -root "StaticLinkedFSharpCore_Trimming_Test" -tfm "net9.0" -outputfile "StaticLinkedFSharpCore_Trimming_Test.dll" -expected_len 9148416 diff --git a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.DesignTime.fsproj b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.DesignTime.fsproj index ded811ee6b8..207ac178db9 100644 --- a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.DesignTime.fsproj +++ b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.DesignTime.fsproj @@ -2,7 +2,7 @@ Library - net8.0;net472 + net9.0;net472 typeproviders NO_GENERATIVE IS_DESIGNTIME diff --git a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj index 5da0cbb3bfb..98144131089 100644 --- a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj +++ b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj @@ -2,7 +2,7 @@ Library - net8.0 + net9.0 $(TestTargetFramework) false NO_GENERATIVE diff --git a/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.fsproj b/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.fsproj index 96006f06673..24c2188c543 100644 --- a/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.fsproj +++ b/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.fsproj @@ -2,7 +2,7 @@ Library - net8.0;net472 + net9.0;net472 typeproviders $(FSharpCoreShippedPackageVersionValue) typeproviders diff --git a/tests/EndToEndBuildTests/BasicProvider/TestBasicProvider.cmd b/tests/EndToEndBuildTests/BasicProvider/TestBasicProvider.cmd index 7de66b4e7f8..38e87f02572 100644 --- a/tests/EndToEndBuildTests/BasicProvider/TestBasicProvider.cmd +++ b/tests/EndToEndBuildTests/BasicProvider/TestBasicProvider.cmd @@ -42,8 +42,8 @@ echo dotnet test BasicProvider.Tests\BasicProvider.Tests.fsproj -c %configuratio dotnet test BasicProvider.Tests\BasicProvider.Tests.fsproj -c %configuration% -v minimal -p:TestTargetFramework=net472 -p:FSharpTestCompilerVersion=net40 if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure -echo dotnet test BasicProvider.Tests\BasicProvider.Tests.fsproj -c %configuration% -v minimal -p:TestTargetFramework=net8.0 -p:FSharpTestCompilerVersion=coreclr - dotnet test BasicProvider.Tests\BasicProvider.Tests.fsproj -c %configuration% -v minimal -p:TestTargetFramework=net8.0 -p:FSharpTestCompilerVersion=coreclr +echo dotnet test BasicProvider.Tests\BasicProvider.Tests.fsproj -c %configuration% -v minimal -p:TestTargetFramework=net9.0 -p:FSharpTestCompilerVersion=coreclr + dotnet test BasicProvider.Tests\BasicProvider.Tests.fsproj -c %configuration% -v minimal -p:TestTargetFramework=net9.0 -p:FSharpTestCompilerVersion=coreclr if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure rem @@ -60,8 +60,8 @@ echo dotnet test BasicProvider.Tests\BasicProvider.Tests.fsproj -c %configuratio dotnet test BasicProvider.Tests\BasicProvider.Tests.fsproj -c %configuration% -v minimal -p:TestTargetFramework=net472 -p:FSharpTestCompilerVersion=net40 if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure -echo dotnet test BasicProvider.Tests\BasicProvider.Tests.fsproj -c %configuration% -v minimal -p:TestTargetFramework=net8.0 -p:FSharpTestCompilerVersion=coreclr - dotnet test BasicProvider.Tests\BasicProvider.Tests.fsproj -c %configuration% -v minimal -p:TestTargetFramework=net8.0 -p:FSharpTestCompilerVersion=coreclr +echo dotnet test BasicProvider.Tests\BasicProvider.Tests.fsproj -c %configuration% -v minimal -p:TestTargetFramework=net9.0 -p:FSharpTestCompilerVersion=coreclr + dotnet test BasicProvider.Tests\BasicProvider.Tests.fsproj -c %configuration% -v minimal -p:TestTargetFramework=net9.0 -p:FSharpTestCompilerVersion=coreclr if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure :success diff --git a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs index 1ea0a67a187..7e93e9fd9c1 100644 --- a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs +++ b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs @@ -276,7 +276,7 @@ namespace ProviderImplementation.ProvidedTypes // // - However, these quotation values are a bit fragile. Using existing FSharp.Core.Quotations.Patterns // active patterns on these quotation nodes will generally work correctly. But using ExprShape.RebuildShapeCombination - // on these new nodes will not succed, nor will operations that build new quotations such as Expr.Call. + // on these new nodes will not succeed, nor will operations that build new quotations such as Expr.Call. // Instead, use the replacement provided in this module. // // - Likewise, some operations in these quotation values like "expr.Type" may be a bit fragile, possibly returning non cross-targeted types in @@ -684,7 +684,7 @@ namespace ProviderImplementation.ProvidedTypes | ProvidedTypeSymbolKind.Generic gty -> gty.MetadataToken | ProvidedTypeSymbolKind.FSharpTypeAbbreviation _ -> typeof.MetadataToken - override this.GetEvents() = this.GetEvents(BindingFlags.Public ||| BindingFlags.Instance ||| BindingFlags.Static) // Needed because TypeDelegator.cs provides a delegting implementation of this, and we are self-delegating + override this.GetEvents() = this.GetEvents(BindingFlags.Public ||| BindingFlags.Instance ||| BindingFlags.Static) // Needed because TypeDelegator.cs provides a delegating implementation of this, and we are self-delegating override this.ToString() = this.FullName @@ -798,12 +798,12 @@ namespace ProviderImplementation.ProvidedTypes let mutable hasReflectedDefinition = false // XML doc text that we only compute once, if any. This must _not_ be forced until the ConstructorArguments - // property of the custom attribute is foced. + // property of the custom attribute is forced. let xmlDocDelayedText = lazy (match xmlDocDelayed with None -> assert false; "" | Some f -> f()) - // Custom atttributes that we only compute once + // Custom attributes that we only compute once let customAttributesOnce = lazy [| if hideObjectMethods then yield mkEditorHideMethodsCustomAttributeData() @@ -1517,8 +1517,8 @@ namespace ProviderImplementation.ProvidedTypes override __.GetElementType() = notRequired this "Module" this.Name override __.InvokeMember(_name, _invokeAttr, _binder, _target, _args, _modifiers, _culture, _namedParameters) = notRequired this "Module" this.Name override __.AssemblyQualifiedName = notRequired this "Module" this.Name - // Needed because TypeDelegator.cs provides a delegting implementation of this, and we are self-delegating - override this.GetEvents() = this.GetEvents(BindingFlags.Public ||| BindingFlags.Instance ||| BindingFlags.Static) // Needed because TypeDelegator.cs provides a delegting implementation of this, and we are self-delegating + // Needed because TypeDelegator.cs provides a delegating implementation of this, and we are self-delegating + override this.GetEvents() = this.GetEvents(BindingFlags.Public ||| BindingFlags.Instance ||| BindingFlags.Static) // Needed because TypeDelegator.cs provides a delegating implementation of this, and we are self-delegating // Get the model member __.BelongsToTargetModel = isTgt @@ -1699,7 +1699,7 @@ namespace ProviderImplementation.ProvidedTypes // AssemblyReader for ProvidedTypesContext // // A lightweight .NET assembly reader that fits in a single F# file. Based on the well-tested Abstract IL -// binary reader code. Used by the type provider to read referenced asssemblies. +// binary reader code. Used by the type provider to read referenced assemblies. namespace ProviderImplementation.ProvidedTypes.AssemblyReader @@ -4493,8 +4493,8 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader let subsys = seekReadUInt16 is (peOptionalHeaderPhysLoc + 68) (* SubSystem Subsystem required to run this image. Shall be either IMAGE_SUBSYSTEM_WINDOWS_CE_GUI (!0x3) or IMAGE_SUBSYSTEM_WINDOWS_GUI (!0x2). QUERY: Why is this 3 on the images ILASM produces??? *) let useHighEntropyVA = let n = seekReadUInt16 is (peOptionalHeaderPhysLoc + 70) - let highEnthropyVA = 0x20us - (n &&& highEnthropyVA) = highEnthropyVA + let highEntropyVA = 0x20us + (n &&& highEntropyVA) = highEntropyVA (* x86: 000000e0 *) (* x86: 000000f0, x64: 00000100 *) @@ -5626,12 +5626,12 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader and byteAsCallConv b = let cc = - let ccMaxked = b &&& 0x0Fuy - if ccMaxked = e_IMAGE_CEE_CS_CALLCONV_FASTCALL then ILArgConvention.FastCall - elif ccMaxked = e_IMAGE_CEE_CS_CALLCONV_STDCALL then ILArgConvention.StdCall - elif ccMaxked = e_IMAGE_CEE_CS_CALLCONV_THISCALL then ILArgConvention.ThisCall - elif ccMaxked = e_IMAGE_CEE_CS_CALLCONV_CDECL then ILArgConvention.CDecl - elif ccMaxked = e_IMAGE_CEE_CS_CALLCONV_VARARG then ILArgConvention.VarArg + let ccMasked = b &&& 0x0Fuy + if ccMasked = e_IMAGE_CEE_CS_CALLCONV_FASTCALL then ILArgConvention.FastCall + elif ccMasked = e_IMAGE_CEE_CS_CALLCONV_STDCALL then ILArgConvention.StdCall + elif ccMasked = e_IMAGE_CEE_CS_CALLCONV_THISCALL then ILArgConvention.ThisCall + elif ccMasked = e_IMAGE_CEE_CS_CALLCONV_CDECL then ILArgConvention.CDecl + elif ccMasked = e_IMAGE_CEE_CS_CALLCONV_VARARG then ILArgConvention.VarArg else ILArgConvention.Default let generic = (b &&& e_IMAGE_CEE_CS_CALLCONV_GENERIC) <> 0x0uy generic, Callconv (byteAsHasThis b,cc) @@ -7185,7 +7185,7 @@ namespace ProviderImplementation.ProvidedTypes override this.MakePointerType() = TypeSymbol(TypeSymbolKind.Pointer, [| this |]) :> Type override this.MakeByRefType() = TypeSymbol(TypeSymbolKind.ByRef, [| this |]) :> Type - override this.GetEvents() = this.GetEvents(BindingFlags.Public ||| BindingFlags.Instance ||| BindingFlags.Static) // Needed because TypeDelegator.cs provides a delegting implementation of this, and we are self-delegating + override this.GetEvents() = this.GetEvents(BindingFlags.Public ||| BindingFlags.Instance ||| BindingFlags.Static) // Needed because TypeDelegator.cs provides a delegating implementation of this, and we are self-delegating override this.ToString() = this.FullName @@ -7654,7 +7654,7 @@ namespace ProviderImplementation.ProvidedTypes override __.GetEnumUnderlyingType() = if this.IsEnum then - txILType ([| |], [| |]) ilGlobals.typ_Int32 // TODO: in theory the assumption of "Int32" is not accurate for all enums, howver in practice .NET only uses enums with backing field Int32 + txILType ([| |], [| |]) ilGlobals.typ_Int32 // TODO: in theory the assumption of "Int32" is not accurate for all enums, however in practice .NET only uses enums with backing field Int32 else failwithf "not enum type" override __.IsArrayImpl() = false @@ -7702,7 +7702,7 @@ namespace ProviderImplementation.ProvidedTypes member __.MakeEventInfo (declTy: Type) md = txILEventDef declTy md member __.MakeFieldInfo (declTy: Type) md = txILFieldDef declTy md member __.MakeNestedTypeInfo (declTy: Type) md = asm.TxILTypeDef (Some declTy) md - override this.GetEvents() = this.GetEvents(BindingFlags.Public ||| BindingFlags.Instance ||| BindingFlags.Static) // Needed because TypeDelegator.cs provides a delegting implementation of this, and we are self-delegating + override this.GetEvents() = this.GetEvents(BindingFlags.Public ||| BindingFlags.Instance ||| BindingFlags.Static) // Needed because TypeDelegator.cs provides a delegating implementation of this, and we are self-delegating and TargetModule(location: string) = inherit Module() @@ -8558,7 +8558,7 @@ namespace ProviderImplementation.ProvidedTypes | _ -> let msg = if toTgt then sprintf "The design-time type '%O' utilized by a type provider was not found in the target reference assembly set '%A'. You may be referencing a profile which contains fewer types than those needed by the type provider you are using." t (getTargetAssemblies() |> Seq.toList) - elif getSourceAssemblies() |> Seq.length = 0 then sprintf "A failure occured while determining compilation references" + elif getSourceAssemblies() |> Seq.length = 0 then sprintf "A failure occurred while determining compilation references" else sprintf "The target type '%O' utilized by a type provider was not found in the design-time assembly set '%A'. Please report this problem to the project site for the type provider." t (getSourceAssemblies() |> Seq.toList) failwith msg @@ -8747,7 +8747,7 @@ namespace ProviderImplementation.ProvidedTypes | ShapeVarUnchecked v -> Expr.Var (convVarToTgt v) | ShapeLambdaUnchecked _ as d -> - failwithf "It's not possible to use construct %O when cross targetting to a different FSharp.Core. Make sure you're not calling a function with signature A->(B->C) instead of A->B->C (using |> causes this)." d + failwithf "It's not possible to use construct %O when cross targeting to a different FSharp.Core. Make sure you're not calling a function with signature A->(B->C) instead of A->B->C (using |> causes this)." d | ShapeCombinationUnchecked (o, exprs) -> RebuildShapeCombinationUnchecked (o, List.map convExprToTgt exprs) @@ -9698,7 +9698,7 @@ namespace ProviderImplementation.ProvidedTypes else failwith "getTypeDefOrRefAsUncodedToken" getUncodedToken tab idx - // REVIEW: write into an accumuating buffer + // REVIEW: write into an accumulating buffer let EmitArrayShape (bb: ByteBuffer) (ILArrayShape shape) = let sized = Array.filter (function (_, Some _) -> true | _ -> false) shape let lobounded = Array.filter (function (Some _, _) -> true | _ -> false) shape @@ -9726,7 +9726,7 @@ namespace ProviderImplementation.ProvidedTypes | ILArgConvention.VarArg -> e_IMAGE_CEE_CS_CALLCONV_VARARG) - // REVIEW: write into an accumuating buffer + // REVIEW: write into an accumulating buffer let rec EmitTypeSpec cenv env (bb: ByteBuffer) (et, tspec:ILTypeSpec) = if isEmpty tspec.GenericArgs then bb.EmitByte et @@ -9837,7 +9837,7 @@ namespace ProviderImplementation.ProvidedTypes let rec GetFieldInitAsBlobIdx cenv (x:ILFieldInit) = GetBytesAsBlobIdx cenv (emitBytesViaBuffer (fun bb -> GetFieldInit bb x)) - // REVIEW: write into an accumuating buffer + // REVIEW: write into an accumulating buffer and GetFieldInit (bb: ByteBuffer) x = match x with | :? string as b -> bb.EmitBytes (Encoding.Unicode.GetBytes b) @@ -9898,7 +9898,7 @@ namespace ProviderImplementation.ProvidedTypes | ILTypeDefAccess.Nested ILMemberAccess.FamilyAndAssembly -> 0x00000006 | ILTypeDefAccess.Nested ILMemberAccess.FamilyOrAssembly -> 0x00000007 | ILTypeDefAccess.Nested ILMemberAccess.Assembly -> 0x00000005 - | ILTypeDefAccess.Nested ILMemberAccess.CompilerControlled -> failwith "bad type acccess" + | ILTypeDefAccess.Nested ILMemberAccess.CompilerControlled -> failwith "bad type access" let rec GetTypeDefAsRow cenv env _enc (td:ILTypeDef) = let nselem, nelem = GetTypeNameAsElemPair cenv (td.Namespace, td.Name) @@ -10077,7 +10077,7 @@ namespace ProviderImplementation.ProvidedTypes // -------------------------------------------------------------------- // ILMethodRef --> ILMethodDef. // - // Only successfuly converts ILMethodRef's referring to + // Only successfully converts ILMethodRef's referring to // methods in the module being emitted. // -------------------------------------------------------------------- @@ -10258,7 +10258,7 @@ namespace ProviderImplementation.ProvidedTypes let fenv = envForFieldSpec fspec FindOrAddSharedRow cenv ILTableNames.MemberRef (GetFieldSpecAsMemberRefRow cenv env fenv fspec) - // REVIEW: write into an accumuating buffer + // REVIEW: write into an accumulating buffer and EmitFieldSpecSig cenv env (bb: ByteBuffer) (fspec:ILFieldSpec) = bb.EmitByte e_IMAGE_CEE_CS_CALLCONV_FIELD EmitType cenv env bb fspec.FormalType @@ -11678,7 +11678,7 @@ namespace ProviderImplementation.ProvidedTypes // manifest --> generate Assembly row // -------------------------------------------------------------------- - and GetManifsetAsAssemblyRow cenv m = + and GetManifestAsAssemblyRow cenv m = UnsharedRow [|ULong m.AuxModuleHashAlgorithm UShort (match m.Version with UNone -> 0us | USome v -> uint16 v.Major) @@ -11703,7 +11703,7 @@ namespace ProviderImplementation.ProvidedTypes (match m.Locale with UNone -> StringE 0 | USome x -> StringE (GetStringHeapIdx cenv x)) |] and GenManifestPass3 cenv m = - let aidx = AddUnsharedRow cenv ILTableNames.Assembly (GetManifsetAsAssemblyRow cenv m) + let aidx = AddUnsharedRow cenv ILTableNames.Assembly (GetManifestAsAssemblyRow cenv m) #if EMIT_SECURITY_DECLS GenSecurityDeclsPass3 cenv (hds_Assembly, aidx) m.SecurityDecls.Entries #endif @@ -11891,7 +11891,7 @@ namespace ProviderImplementation.ProvidedTypes let pdbData = () #endif - let idxForNextedTypeDef (tds:ILTypeDef list, td:ILTypeDef) = + let idxForNestedTypeDef (tds:ILTypeDef list, td:ILTypeDef) = let enc = tds |> List.map (fun td -> td.Name) GetIdxForTypeDef cenv (TdKey(enc, td.Namespace, td.Name)) @@ -11904,18 +11904,18 @@ namespace ProviderImplementation.ProvidedTypes // turn idx tbls into token maps let mappings = { TypeDefTokenMap = (fun t -> - getUncodedToken ILTableNames.TypeDef (idxForNextedTypeDef t)) + getUncodedToken ILTableNames.TypeDef (idxForNestedTypeDef t)) FieldDefTokenMap = (fun t fd -> - let tidx = idxForNextedTypeDef t + let tidx = idxForNestedTypeDef t getUncodedToken ILTableNames.Field (GetFieldDefAsFieldDefIdx cenv tidx fd)) MethodDefTokenMap = (fun t md -> - let tidx = idxForNextedTypeDef t + let tidx = idxForNestedTypeDef t getUncodedToken ILTableNames.Method (FindMethodDefIdx cenv (GetKeyForMethodDef tidx md))) PropertyTokenMap = (fun t pd -> - let tidx = idxForNextedTypeDef t + let tidx = idxForNestedTypeDef t getUncodedToken ILTableNames.Property (cenv.propertyDefs.GetTableEntry (GetKeyForPropertyDef tidx pd))) EventTokenMap = (fun t ed -> - let tidx = idxForNextedTypeDef t + let tidx = idxForNestedTypeDef t getUncodedToken ILTableNames.Event (cenv.eventDefs.GetTableEntry (EventKey (tidx, ed.Name)))) } // New return the results let data = cenv.data.Close() @@ -12663,7 +12663,7 @@ namespace ProviderImplementation.ProvidedTypes let timestamp = int final.[16] ||| (int final.[17] <<< 8) ||| (int final.[18] <<< 16) ||| (int (final.[19] ||| 128uy) <<< 24) writeInt32 os timestamp // Update pdbData with new guid and timestamp. Portable and embedded PDBs don't need the ModuleID - // Full and PdbOnly aren't supported under deterministic builds currently, they rely on non-determinsitic Windows native code + // Full and PdbOnly aren't supported under deterministic builds currently, they rely on non-deterministic Windows native code { pdbData with ModuleID = final.[0..15] ; Timestamp = timestamp } else writeInt32 os timestamp // date since 1970 @@ -13404,8 +13404,8 @@ namespace ProviderImplementation.ProvidedTypes lambdaLocals.[v] <- l let expectedState = if (retType = ILType.Void) then ExpectedStackState.Empty else ExpectedStackState.Value - let lambadParamVars = [| Var("this", typeof); v|] - let codeGen = CodeGenerator(assemblyMainModule, genUniqueTypeName, implicitCtorArgsAsFields, convTypeToTgt, transType, transFieldSpec, transMeth, transMethRef, transCtorSpec, ilg, lambdaLocals, lambadParamVars) + let lambdaParamVars = [| Var("this", typeof); v|] + let codeGen = CodeGenerator(assemblyMainModule, genUniqueTypeName, implicitCtorArgsAsFields, convTypeToTgt, transType, transFieldSpec, transMeth, transMethRef, transCtorSpec, ilg, lambdaLocals, lambdaParamVars) codeGen.EmitExpr (expectedState, body) ilg.Emit(I_ret) @@ -14035,14 +14035,14 @@ namespace ProviderImplementation.ProvidedTypes |> Seq.choose (function :? ProvidedConstructor as pcinfo when not pcinfo.IsTypeInitializer -> Some pcinfo | _ -> None) |> Seq.toList - let implictCtorArgs = + let implicitCtorArgs = match ctors |> List.filter (fun x -> x.IsImplicitConstructor) with | [] -> [] | [ pcinfo ] -> [ for p in pcinfo.GetParameters() -> p ] | _ -> failwith "at most one implicit constructor allowed" let implicitCtorArgsAsFields = - [ for ctorArg in implictCtorArgs -> + [ for ctorArg in implicitCtorArgs -> tb.DefineField(ctorArg.Name, transType ctorArg.ParameterType, FieldAttributes.Private) ] diff --git a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fsi b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fsi index 2f1042c08be..5da7a352a41 100644 --- a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fsi +++ b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fsi @@ -43,7 +43,7 @@ namespace ProviderImplementation.ProvidedTypes type ProvidedStaticParameter = inherit ParameterInfo - /// Create a new provided static parameter, for use with DefineStaticParamaeters on a provided type definition. + /// Create a new provided static parameter, for use with DefineStaticParameters on a provided type definition. new: parameterName: string * parameterType: Type * ?parameterDefaultValue: obj -> ProvidedStaticParameter /// Add XML documentation information to this provided constructor @@ -434,7 +434,7 @@ namespace ProviderImplementation.ProvidedTypes /// this method should not be used directly when authoring a type provider. member ConvertTargetTypeToSource: Type -> Type - /// Returns a quotation rebuilt with resepct to the types from the target referenced assemblies. Normally + /// Returns a quotation rebuilt with respect to the types from the target referenced assemblies. Normally /// this method should not be used directly when authoring a type provider. member ConvertSourceExprToTarget: Expr -> Expr @@ -483,7 +483,7 @@ namespace ProviderImplementation.ProvidedTypes /// Invoked by the host of the type provider to get the static parameters for a method. member GetStaticParametersForMethod: MethodBase -> ParameterInfo[] - /// Invoked by the host of the type provider to apply the static argumetns for a method. + /// Invoked by the host of the type provider to apply the static arguments for a method. member ApplyStaticArgumentsForMethod: MethodBase * string * obj[] -> MethodBase #if !FX_NO_LOCAL_FILESYSTEM diff --git a/tests/FSharp.Build.UnitTests/MapSourceRootsTests.fs b/tests/FSharp.Build.UnitTests/MapSourceRootsTests.fs index d19515c86b3..bdefa03d96a 100644 --- a/tests/FSharp.Build.UnitTests/MapSourceRootsTests.fs +++ b/tests/FSharp.Build.UnitTests/MapSourceRootsTests.fs @@ -267,7 +267,7 @@ type MapSourceRootsTests() = SourceRoot(path3, [], []) |] - /// because this test isn't one to one we have to put the expecations in another structure + /// because this test isn't one to one we have to put the expectations in another structure let actualExpectations = [| SourceRoot(path1, [], [ "SourceControl", "git" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Line.fs b/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Line.fs new file mode 100644 index 00000000000..4844fb232b3 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Line.fs @@ -0,0 +1,66 @@ +namespace CompilerDirectives + +open Microsoft.FSharp.Control +open Xunit +open FSharp.Test.Compiler +open FSharp.Compiler.CodeAnalysis +open FSharp.Compiler.Text +open FSharp.Compiler.Syntax + +module Line = + + let checker = FSharpChecker.Create() + + let parse (source: string) = + let langVersion = "preview" + let sourceFileName = __SOURCE_FILE__ + let parsingOptions = + { FSharpParsingOptions.Default with + SourceFiles = [| sourceFileName |] + LangVersionText = langVersion + ApplyLineDirectives = true + } + checker.ParseFile(sourceFileName, SourceText.ofString source, parsingOptions) |> Async.RunSynchronously + + + [] + let private case1 = """module A +#line 1 "xyz.fs" +( +printfn "" +) + """ + + [] + let private case2 = """module A +( +#line 1 "xyz.fs" +printfn "" +) + """ + + [] + let private case3 = """module A +( +#line 1 "xyz.fs" +) + """ + + [] + [] + [] + [] + let ``check expr range interacting with line directive`` (case, source, expectedRange) = + let parseResults = parse source + if parseResults.ParseHadErrors then failwith "unexpected: parse error" + let exprRange = + match parseResults.ParseTree with + | ParsedInput.ImplFile(ParsedImplFileInput(contents = contents)) -> + let (SynModuleOrNamespace(decls = decls)) = List.exactlyOne contents + match List.exactlyOne decls with + | SynModuleDecl.Expr(_, range) -> $"{range.FileName}:{range}" + | _ -> failwith $"unexpected: not an expr" + | ParsedInput.SigFile _ -> failwith "unexpected: sig file" + if exprRange <> expectedRange then + failwith $"case{case}: expected: {expectedRange}, found {exprRange}" + \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/Directives.fs b/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/NonStringArgs.fs similarity index 85% rename from tests/FSharp.Compiler.ComponentTests/ErrorMessages/Directives.fs rename to tests/FSharp.Compiler.ComponentTests/CompilerDirectives/NonStringArgs.fs index 2f1dda5d400..080811bd7c2 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/Directives.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/NonStringArgs.fs @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -namespace ErrorMessages +namespace CompilerDirectives open Xunit open FSharp.Test.Compiler -module HashDirectives = +module NonStringArgs = [] - [] + [] [] let ``#nowarn - errors`` (languageVersion) = @@ -27,9 +27,9 @@ module HashDirectives = |> withDiagnostics[ if languageVersion = "8.0" then (Warning 203, Line 6, Col 1, Line 6, Col 13, "Invalid warning number 'FS'") - (Error 3350, Line 3, Col 9, Line 3, Col 11, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 4, Col 9, Line 4, Col 15, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 5, Col 9, Line 5, Col 13, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") + (Error 3350, Line 3, Col 9, Line 3, Col 11, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 4, Col 9, Line 4, Col 15, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 5, Col 9, Line 5, Col 13, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") else (Warning 203, Line 3, Col 1, Line 3, Col 11, "Invalid warning number 'FS'") (Warning 203, Line 6, Col 1, Line 6, Col 13, "Invalid warning number 'FS'") @@ -37,7 +37,7 @@ module HashDirectives = [] - [] + [] [] let ``#nowarn - errors - collected`` (languageVersion) = @@ -58,16 +58,16 @@ module HashDirectives = |> withDiagnostics[ if languageVersion = "8.0" then (Warning 203, Line 2, Col 1, Line 9, Col 11, "Invalid warning number 'FS'") - (Error 3350, Line 4, Col 5, Line 4, Col 7, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 5, Col 5, Line 5, Col 11, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 6, Col 5, Line 6, Col 9, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") + (Error 3350, Line 4, Col 5, Line 4, Col 7, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 5, Col 5, Line 5, Col 11, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 6, Col 5, Line 6, Col 9, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") else (Warning 203, Line 2, Col 1, Line 9, Col 11, "Invalid warning number 'FS'") ] [] - [] + [] [] let ``#nowarn - errors - inline`` (languageVersion) = @@ -82,16 +82,16 @@ module HashDirectives = |> withDiagnostics [ if languageVersion = "8.0" then (Warning 203, Line 3, Col 1, Line 3, Col 44, "Invalid warning number 'FS'") - (Error 3350, Line 3, Col 9, Line 3, Col 11, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 3, Col 12, Line 3, Col 18, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 3, Col 19, Line 3, Col 23, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") + (Error 3350, Line 3, Col 9, Line 3, Col 11, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 3, Col 12, Line 3, Col 18, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 3, Col 19, Line 3, Col 23, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") else (Warning 203, Line 3, Col 1, Line 3, Col 44, "Invalid warning number 'FS'") ] [] - [] + [] [] let ``#nowarn - realcode`` (langVersion) = @@ -126,8 +126,8 @@ module DoBinding = |> shouldFail |> withDiagnostics [ (Warning 1104, Line 5, Col 15, Line 5, Col 31, "Identifiers containing '@' are reserved for use in F# code generation") - (Error 3350, Line 2, Col 9, Line 2, Col 11, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 2, Col 12, Line 2, Col 18, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") + (Error 3350, Line 2, Col 9, Line 2, Col 11, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 2, Col 12, Line 2, Col 18, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") ] else compileResult @@ -135,7 +135,7 @@ module DoBinding = [] - [] + [] [] let ``#time - mixed - Fsc`` (langversion) = @@ -161,14 +161,14 @@ printfn "Hello, World" |> shouldFail |> withDiagnostics [ if langversion = "8.0" then - (Error 3350, Line 2, Col 7, Line 2, Col 9, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 3, Col 7, Line 3, Col 10, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 4, Col 7, Line 4, Col 11, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 5, Col 7, Line 5, Col 12, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 6, Col 7, Line 6, Col 17, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 7, Col 7, Line 7, Col 10, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 8, Col 7, Line 8, Col 9, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 8, Col 10, Line 8, Col 13, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") + (Error 3350, Line 2, Col 7, Line 2, Col 9, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 3, Col 7, Line 3, Col 10, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 4, Col 7, Line 4, Col 11, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 5, Col 7, Line 5, Col 12, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 6, Col 7, Line 6, Col 17, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 7, Col 7, Line 7, Col 10, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 8, Col 7, Line 8, Col 9, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 8, Col 10, Line 8, Col 13, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") (Error 235, Line 12, Col 1, Line 12, Col 13, """Invalid directive. Expected '#time', '#time "on"' or '#time "off"'.""") (Error 235, Line 13, Col 1, Line 13, Col 17, """Invalid directive. Expected '#time', '#time "on"' or '#time "off"'.""") else @@ -183,7 +183,7 @@ printfn "Hello, World" [] - [] + [] [] let ``#time - mixed - Fsx`` (langversion) = @@ -209,14 +209,14 @@ printfn "Hello, World" |> shouldFail |> withDiagnostics [ if langversion = "8.0" then - (Error 3350, Line 2, Col 7, Line 2, Col 9, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 3, Col 7, Line 3, Col 10, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 4, Col 7, Line 4, Col 11, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 5, Col 7, Line 5, Col 12, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 6, Col 7, Line 6, Col 17, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 7, Col 7, Line 7, Col 10, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 8, Col 7, Line 8, Col 9, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 8, Col 10, Line 8, Col 13, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") + (Error 3350, Line 2, Col 7, Line 2, Col 9, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 3, Col 7, Line 3, Col 10, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 4, Col 7, Line 4, Col 11, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 5, Col 7, Line 5, Col 12, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 6, Col 7, Line 6, Col 17, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 7, Col 7, Line 7, Col 10, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 8, Col 7, Line 8, Col 9, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 8, Col 10, Line 8, Col 13, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") (Error 235, Line 12, Col 1, Line 12, Col 13, """Invalid directive. Expected '#time', '#time "on"' or '#time "off"'.""") (Error 235, Line 13, Col 1, Line 13, Col 17, """Invalid directive. Expected '#time', '#time "on"' or '#time "off"'.""") else @@ -275,11 +275,10 @@ printfn "Hello, World" |> asExe |> compile |> shouldFail - |> withDiagnostics[ + |> withDiagnostics [ (Warning 3353, Line 2, Col 9, Line 2, Col 11, "Invalid directive '#r '") (Warning 213, Line 3, Col 9, Line 3, Col 14, "'' is not a valid assembly name") (Error 3869, Line 4, Col 12, Line 4, Col 17, "Unexpected identifier 'Ident'.") (Error 3869, Line 5, Col 12, Line 5, Col 22, "Unexpected identifier 'Long.Ident'.") (Error 3869, Line 6, Col 12, Line 6, Col 15, "Unexpected integer literal '123'.") - ] - + ] diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Nowarn.fs b/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Nowarn.fs new file mode 100644 index 00000000000..78067aa8c32 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Nowarn.fs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +namespace CompilerDirectives + +open Xunit +open FSharp.Test.Compiler + +module Nowarn = + + let warn20Text = "The result of this expression has type 'string' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'." + + let checkFileBugSource = """ +module A +#nowarn "20" +#line 1 "xyz.fs" +"" + """ + + let checkFileBugSource2 = """ +module A +#line 1 "xyz.fs" +#nowarn "20" +"" + """ + + + [] + let ``checkFile bug simulation for compatibility`` () = + + FSharp checkFileBugSource + |> withLangVersion80 + |> compile + |> shouldSucceed + + [] + let ``checkFile bug fixed leads to new warning`` () = + + FSharp checkFileBugSource + |> withLangVersion90 + |> compile + |> shouldFail + |> withDiagnostics [ + (Warning 20, Line 1, Col 1, Line 1, Col 3, warn20Text) + ] + + [] + let ``checkFile bug fixed, no warning if nowarn is correctly used`` () = + + FSharp checkFileBugSource2 + |> withLangVersion90 + |> compile + |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/unrecogarg.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/unrecogarg.fs index a43a8065e16..83ccc907b79 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/unrecogarg.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/unrecogarg.fs @@ -1,4 +1,4 @@ // #Regression #NoMT #CompilerOptions -//Unrecognized option: .+ + #light exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/E_InvalidArgument.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/E_InvalidArgument.fs index f98f7d8d8dc..ce39f3e7a5e 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/E_InvalidArgument.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/E_InvalidArgument.fs @@ -3,7 +3,7 @@ // Actual message is: error FS0191: Valid values are between 0 and 65535, inclusive. // Parameter Name: codepage // but is is localized! -//Problem with codepage '65536': Valid values are between 0 and 65535, inclusive + exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/pathmapRequiresPortablePdb.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/pathmapRequiresPortablePdb.fs index 80243879471..378d2d50fb0 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/pathmapRequiresPortablePdb.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/pathmapRequiresPortablePdb.fs @@ -1,3 +1,3 @@ // #NoMT #CompilerOptions #Determinism -//--pathmap can only be used with portable PDBs \(--debug:portable or --debug:embedded\) + exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/pathmapValid.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/pathmapValid.fs index 1ec61fc9a8f..378d2d50fb0 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/pathmapValid.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/determinism/pathmapValid.fs @@ -1,3 +1,3 @@ // #NoMT #CompilerOptions #Determinism -//Invalid path map\. Mappings must be comma separated and of the format 'path=sourcePath' + exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine01.fs index fcb5e10f2ae..c75810c3381 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine01.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine01.fs @@ -1,6 +1,6 @@ // #Regression #NoMT #CompilerOptions #RequiresENU // Test that without [--flaterrors] flag multi-line errors are emitted in a regular way, i.e. spanned to more that one line -//This expression was expected to have type + // ''a list' //but here has type // 'seq<'b>' diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine03.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine03.fs index 7df7e334e11..023e419d510 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine03.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/E_MultiLine03.fs @@ -1,5 +1,5 @@ // #Regression #NoMT #CompilerOptions // Test that using [--flaterrors] does not make an impact on regular single-line error messages -//The value or constructor 'b' is not defined + let a = b diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/env.lst b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/env.lst index 3567d73aece..f0b17c83831 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/env.lst +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors/env.lst @@ -10,10 +10,10 @@ ReqENU SOURCE=E_MultiLine01.fs # E_MultiLine01.fs # Last one wins... (multiple-usage) SOURCE=E_MultiLine02.fs COMPILE_ONLY=1 SCFLAGS="--flaterrors --flaterrors" # MultipleUse -# Option is case sentitive +# Option is case-sensitive SOURCE=E_MultiLine04.fs COMPILE_ONLY=1 SCFLAGS="--FlatErrors" # CaseSensitive01 SOURCE=E_MultiLine04.fs COMPILE_ONLY=1 SCFLAGS="--FLATERRORS" # CaseSensitive02 -# Mispelled options - SOURCE=E_MultiLine04.fs COMPILE_ONLY=1 SCFLAGS="-flaterrors" # Mispelled01 - SOURCE=E_MultiLine04.fs COMPILE_ONLY=1 SCFLAGS="--flaterrors+" # Mispelled02 \ No newline at end of file +# Misspelled options + SOURCE=E_MultiLine04.fs COMPILE_ONLY=1 SCFLAGS="-flaterrors" # Misspelled01 + SOURCE=E_MultiLine04.fs COMPILE_ONLY=1 SCFLAGS="--flaterrors+" # Misspelled02 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/langversion.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/langversion.fs index 7b004b32296..67701cff02a 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/langversion.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/langversion.fs @@ -9,7 +9,7 @@ open FSharp.Test.Compiler module langversion = [] - let ``fsc langversion is case insensitive - --langversion:pRevIew``() = + let ``fsc langversion is case-insensitive - --langversion:pRevIew``() = FSharp """ printfn "Hello, World" """ @@ -20,7 +20,7 @@ printfn "Hello, World" |> ignore [] - let ``fsi langversion is case insensitive - --langversion:pRevIew``() = + let ``fsi langversion is case-insensitive - --langversion:pRevIew``() = FSharp """ printfn "Hello, World" """ @@ -31,7 +31,7 @@ printfn "Hello, World" |> ignore [] - let ``fsc langversion is case insensitive - --langversion:laTestmaJor``() = + let ``fsc langversion is case-insensitive - --langversion:laTestmaJor``() = FSharp """ printfn "Hello, World" """ @@ -42,7 +42,7 @@ printfn "Hello, World" |> ignore [] - let ``fsi langversion is case insensitive - --langversion:laTestmaJor``() = + let ``fsi langversion is case-insensitive - --langversion:laTestmaJor``() = FSharp """ printfn "Hello, World" """ diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/compiler_help_output.bsl b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/compiler_help_output.bsl index 8e207799112..75e32680e65 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/compiler_help_output.bsl +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/compiler_help_output.bsl @@ -49,8 +49,8 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. - CODE GENERATION - --debug[+|-] Emit debug information (Short form: -g) --debug:{full|pdbonly|portable|embedded} Specify debugging type: full, portable, embedded, pdbonly. ('full' is the - default if no debuggging type specified and enables attaching a debugger to - a running program, 'portable' is a cross-platform format, 'embedded' is a + default if no debugging type specified and enables attaching a debugger to a + running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). --embed[+|-] Embed all source files in the portable PDB file --embed: Embed specific source files in the portable PDB file @@ -71,6 +71,7 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. --warn: Set a warning level (0-5) --nowarn: Disable specific warning messages --warnon: Enable specific warnings that may be off by default +--checknulls[+|-] Enable nullness declarations and checks --consolecolors[+|-] Output warning and error messages in color diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_01.fs index cd6867c3341..cde67b9fbc1 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_01.fs @@ -1,4 +1,4 @@ // #Regression #NoMT #CompilerOptions -//Unrecognized option: '--PLATFORM' + printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_02.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_02.fs index 86e246c9f84..6fd8f9ab285 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_02.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_02.fs @@ -1,5 +1,5 @@ // #Regression #NoMT #CompilerOptions -//Unrecognized option: '--PlatForm' + printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_03.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_03.fs index 5bcabe032da..8fa5ee03684 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_03.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_03.fs @@ -1,5 +1,5 @@ // #Regression #NoMT #CompilerOptions -//Unrecognized platform 'ITANIUM', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_04.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_04.fs index be32ba84233..8fa5ee03684 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_04.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_04.fs @@ -1,5 +1,5 @@ // #Regression #NoMT #CompilerOptions -//Unrecognized platform 'ANYCPU', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_05.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_05.fs index 92aa8efd70e..8fa5ee03684 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_05.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_05.fs @@ -1,5 +1,5 @@ // #Regression #NoMT #CompilerOptions -//Unrecognized platform 'X86', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_06.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_06.fs index 3935e374ab0..8fa5ee03684 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_06.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_06.fs @@ -1,5 +1,5 @@ // #Regression #NoMT #CompilerOptions -//Unrecognized platform 'X64', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_07.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_07.fs index d7843110bbc..8fa5ee03684 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_07.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_07.fs @@ -1,5 +1,5 @@ // #Regression #NoMT #CompilerOptions -//Unrecognized platform 'IA64', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_08.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_08.fs index 7096eeb2147..8fa5ee03684 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_08.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_08.fs @@ -1,5 +1,5 @@ // #Regression #NoMT #CompilerOptions -//Unrecognized platform 'i386', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_09.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_09.fs index a44c7d415a3..1b2d4603e12 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_09.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_09.fs @@ -1,4 +1,4 @@ // #Regression #NoMT #CompilerOptions -//Unrecognized platform 'AMD64', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_10.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_10.fs index 2f372c0fac0..8fa5ee03684 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_10.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_10.fs @@ -1,5 +1,5 @@ // #Regression #NoMT #CompilerOptions -//Unrecognized platform 'PPC', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_11.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_11.fs index ced265728c1..1b2d4603e12 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_11.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_11.fs @@ -1,4 +1,4 @@ // #Regression #NoMT #CompilerOptions -//Unrecognized option: '--platform-' + printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_12.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_12.fs index 3fe0e61c758..1b2d4603e12 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_12.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_12.fs @@ -1,4 +1,4 @@ // #Regression #NoMT #CompilerOptions -//Unrecognized option: '--PLATFORM\+' + printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_13.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_13.fs index a44f40b2631..8fa5ee03684 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_13.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_13.fs @@ -1,5 +1,5 @@ // #Regression #NoMT #CompilerOptions -//Unrecognized option: '---platform' + printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_15.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_15.fs index 5b842b5f711..8fa5ee03684 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_15.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_15.fs @@ -1,5 +1,5 @@ // #Regression #NoMT #CompilerOptions -//Unrecognized platform 'ARM', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_16.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_16.fs index 9c778d01340..581e41236a9 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_16.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/error_16.fs @@ -1,5 +1,5 @@ // #Regression #NoMT #CompilerOptions -//The 'anycpu32bitpreferred' platform can only be used with EXE targets\. You must use 'anycpu' instead\. + module M printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/platform.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/platform.fs index c125ee64e38..9b320af3d8a 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/platform.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/platform.fs @@ -9,7 +9,7 @@ open FSharp.Test.Compiler module platform = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //The 'anycpu32bitpreferred' platform can only be used with EXE targets\. You must use 'anycpu' instead\. + [] let ``platform - error_16_fs - --target:library --platform:anycpu32bitpreferred`` compilation = compilation @@ -22,7 +22,7 @@ module platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized option: '--PLATFORM' + [] let ``platform - error_01_fs - --PLATFORM:anycpu`` compilation = compilation @@ -35,7 +35,7 @@ module platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized option: '--PlatForm' + [] let ``platform - error_02_fs - --PlatForm:anycpu`` compilation = compilation @@ -48,7 +48,7 @@ module platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized platform 'ITANIUM', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + [] let ``platform - error_03_fs - --platform:ITANIUM`` compilation = compilation @@ -61,7 +61,7 @@ module platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized platform 'ANYCPU', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + [] let ``platform - error_04_fs - --platform:ANYCPU`` compilation = compilation @@ -74,7 +74,7 @@ module platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized platform 'X86', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + [] let ``platform - error_05_fs - --platform:X86`` compilation = compilation @@ -87,7 +87,7 @@ module platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized platform 'X64', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + [] let ``platform - error_06_fs - --platform:X64`` compilation = compilation @@ -100,7 +100,7 @@ module platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized platform 'IA64', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + [] let ``platform - error_07_fs - --platform:IA64`` compilation = compilation @@ -113,7 +113,7 @@ module platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized platform 'i386', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + [] let ``platform - error_08_fs - --platform:i386`` compilation = compilation @@ -126,7 +126,7 @@ module platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized platform 'AMD64', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + [] let ``platform - error_09_fs - --platform:AMD64`` compilation = compilation @@ -139,7 +139,7 @@ module platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized platform 'PPC', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + [] let ``platform - error_10_fs - --platform:PPC`` compilation = compilation @@ -152,7 +152,7 @@ module platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized platform 'ARM', valid values are 'x86', 'x64', 'Arm', 'Arm64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' + [] let ``platform - error_15_fs - --platform:ARM`` compilation = compilation @@ -165,7 +165,7 @@ module platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized option: '--platform-' + [] let ``platform - error_11_fs - --platform-:anycpu`` compilation = compilation @@ -178,7 +178,7 @@ module platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized option: '--PLATFORM\+' + [] let ``platform - error_12_fs - --PLATFORM+:anycpu`` compilation = compilation @@ -191,7 +191,7 @@ module platform = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - //Unrecognized option: '---platform' + [] let ``platform - error_13_fs - ---platform:anycpu`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_01.fs index 6b2ab71b578..c40e6ae6e6a 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_01.fs @@ -1,4 +1,4 @@ // #Regression #NoMT #CompilerOptions -//Unrecognized option: '--Times' + #light printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_02.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_02.fs index 43d462138b9..c40e6ae6e6a 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_02.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_02.fs @@ -1,4 +1,4 @@ // #Regression #NoMT #CompilerOptions -//Unrecognized option: '--times-' + #light printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_03.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_03.fs index 8b3121132b3..c40e6ae6e6a 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_03.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/error_03.fs @@ -1,4 +1,4 @@ // #Regression #NoMT #CompilerOptions -//Unrecognized option: '--times\+' + #light printfn "Finished" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/times.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/times.fs index a52aa63cf15..b18e5472ec0 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/times.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/times.fs @@ -11,7 +11,7 @@ open System.IO module times = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/times) - //Unrecognized option: '--Times' + [] let ``times - error_01_fs - --Times`` compilation = compilation @@ -24,7 +24,7 @@ module times = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/times) - //Unrecognized option: '--times-' + [] let ``times - error_02_fs - --times-`` compilation = compilation @@ -37,7 +37,7 @@ module times = |> ignore // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/times) - //Unrecognized option: '--times\+' + [] let ``times - error_03_fs - --times+`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror01.fs index 5dc5695eaa3..458844f51d0 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror01.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror01.fs @@ -1,6 +1,6 @@ // #Regression #NoMT #CompilerOptions // Regression test for FSHARP1.0:4867 // nowarn has no effect if "Warning level = 4" and "Warnings as errors" -//This and other recursive references to the object\(s\) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference\. This is because you are defining one or more recursive objects, rather than recursive functions\. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'\.$ + let rec f = new System.EventHandler(fun _ _ -> f.Invoke(null,null)) diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror02.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror02.fs index 0c562f06251..125259add60 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror02.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/nowarn_with_warnaserror02.fs @@ -1,7 +1,7 @@ // #Regression #NoMT #CompilerOptions // Regression test for FSHARP1.0:4867 // nowarn has no effect if "Warning level = 4" and "Warnings as errors" -//This and other recursive references to the object\(s\) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference\. This is because you are defining one or more recursive objects, rather than recursive functions\. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40' + #nowarn "21" let rec f = new System.EventHandler(fun _ _ -> f.Invoke(null,null)) diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level6.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level6.fs index bf705870aa4..585191cf226 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level6.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn_level6.fs @@ -1,3 +1,3 @@ // #Regression #NoMT #CompilerOptions -//Invalid warning level '6' + diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs b/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs index 51631e0c466..72dd62e397c 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs @@ -12,7 +12,7 @@ open FSharp.Compiler.Diagnostics open FSharp.Compiler.BuildGraph -let timeout = TimeSpan.FromSeconds 10 +let timeout = TimeSpan.FromSeconds 10. let waitFor (mre: ManualResetEvent) = if not <| mre.WaitOne timeout then @@ -36,8 +36,11 @@ let rec internal spinFor (duration: TimeSpan) = return! spinFor remaining } - +#if BUILDING_WITH_LKG type internal EventRecorder<'a, 'b, 'c when 'a : equality and 'b : equality>(memoize: AsyncMemoize<'a,'b,'c>) as self = +#else +type internal EventRecorder<'a, 'b, 'c when 'a : equality and 'b : equality and 'a:not null and 'b:not null>(memoize: AsyncMemoize<'a,'b,'c>) as self = +#endif let events = ConcurrentQueue() @@ -249,7 +252,7 @@ let ``Job is restarted if first requestor cancels but keeps running if second re type ExpectedException() = inherit Exception() -[] +[] let ``Stress test`` () = let seed = System.Random().Next() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/Basic.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/Basic.fs index 37add29d802..869e4ba9930 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/Basic.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/Basic.fs @@ -188,3 +188,42 @@ module AccessibilityAnnotations_Basic = compilation |> verifyCompileAndRun |> shouldSucceed + + [] + let ``C# protected property can be assigned in a F# inherit constructor call`` () = + + let csharp = + CSharp + """ +namespace Consumer +{ + public class Foo + { + protected string Value { get; set; } = ""; + } +} +""" + |> withName "CSLib" + + let fsharp = + FSharp + """ +module Hello +open Consumer + +type Bar() = + inherit Foo(Value = "Works") + +type Bar2() as this = + inherit Foo() + do this.Value <- "Works" + +{ new Foo(Value = "OK") with member x.ToString() = "OK" } |> ignore +""" + |> withLangVersion80 + |> withName "FSLib" + |> withReferences [ csharp ] + + fsharp + |> compile + |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_ExposeLessVisible01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_ExposeLessVisible01.fs index 4aab325f965..c4523e978ed 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_ExposeLessVisible01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_ExposeLessVisible01.fs @@ -1,5 +1,5 @@ // #Regression #Conformance #DeclarationElements #Accessibility -//The type 'A' is less accessible than the value, member or type 'x' it is used in + type internal A = { x : int } type public B = { x : A[] } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_LocalLetBinding02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_LocalLetBinding02.fs index 0ea152deb86..d4de396d610 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_LocalLetBinding02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_LocalLetBinding02.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Accessibility // Let bindings in classes are always private -//Multiple visibility attributes have been specified for this identifier\. 'let' bindings in classes are always private, as are any 'let' bindings inside expressions + type internal A() = class end type public B() = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_MoreAccessibleBaseClass01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_MoreAccessibleBaseClass01.fs index 9107f78af85..17de14bc669 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_MoreAccessibleBaseClass01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_MoreAccessibleBaseClass01.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Accessibility // Verify error associated with more accessible base class than super class -//The type 'C1' is less accessible than the value, member or type 'C2' it is used in + // Class inheritance: diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_MoreAccessibleBaseClass02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_MoreAccessibleBaseClass02.fs index 3f84aea4ba3..50232b13bbf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_MoreAccessibleBaseClass02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_MoreAccessibleBaseClass02.fs @@ -1,9 +1,9 @@ // #Regression #Conformance #DeclarationElements #Accessibility // Verify error when inheriting from less accessible base class -//The type 'I2' is less accessible than the value, member or type 'D' it is used in -//The type 'I3' is less accessible than the value, member or type 'IAmAnotherInterface' it is used in + + // Delegate signature: type private I2 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_PrivateImplicitCtor01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_PrivateImplicitCtor01.fs index 370fa232ff1..b1930a5b04d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_PrivateImplicitCtor01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_PrivateImplicitCtor01.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Accessibility // Verify error when using a private implicit constructor -//Method or object constructor 'C' not found + type A public (x : int) = member this.Value = x diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_ProtectedThingsInaccessible01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_ProtectedThingsInaccessible01.fs index 9900a015a19..f80799d2a14 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_ProtectedThingsInaccessible01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_ProtectedThingsInaccessible01.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Accessibility // Regression test for FSharp1.0:4227 - protected access checks are not correctly implemented -//Method 'MemberwiseClone' is not accessible from this code location + type C1() as this = inherit System.MarshalByRefObject() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible02.fs index a81ab93c252..9be4c482f28 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible02.fs @@ -3,12 +3,12 @@ // Private modules // Private type or module is private to its immediately enclosing module. This means the module PrivateModule in the repro // is indeed accessible to the rest of the implicit enclosing module. -//The value 'x' is not accessible from this code location -//The value 'f' is not accessible from this code location -//The value 'y' is not accessible from this code location -//The value 'g' is not accessible from this code location -//The type 'PrivateModule' is not accessible from this code location -//The type 'PrivateModule' is not accessible from this code location + + + + + + module M = let private y = 42 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible03.fs index 6cbba2d0880..f803007448b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible03.fs @@ -1,8 +1,8 @@ // #Regression #Conformance #DeclarationElements #Accessibility // Regression test for FSHARP1.0:2738 -//The type 'PrivateModule' is not accessible from this code location$ -//The value 'x' is not accessible from this code location$ -//The value, namespace, type or module 'PrivateModule' is not defined + + + module M = module private PrivateModule = let x = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible04.fs index ad8230267ad..b301dd94e59 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible04.fs @@ -3,10 +3,10 @@ // Private modules // Private type or module is private to its immediately enclosing module. This means the module PrivateModule in the repro // is indeed accessible to the rest of the implicit enclosing module. -//The value, namespace, type or module 'PrivateModule' is not defined -//The value, namespace, type or module 'PrivateModule' is not defined -//The value or constructor 'y' is not defined -//The value or constructor 'g' is not defined + + + + module M = let private y = 42 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible05.fs index ad630fc84f7..3df5fa06128 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/E_privateThingsInaccessible05.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Accessibility // Regression test for FSharp1.0:2236 - unexpected "record field" in accessibility error -//The record, struct or class field 'foo' is not accessible from this code location + type Foo = class diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_InterfaceImpl01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_InterfaceImpl01.fs index 7ac96ec6491..185e992a739 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_InterfaceImpl01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_InterfaceImpl01.fs @@ -1,9 +1,9 @@ // #Regression #Conformance #DeclarationElements #Accessibility #Overloading // Regression test for FSHARP1.0:4485 // Visibility decl on interface implementation -//Accessibility modifiers are not permitted on overrides or interface implementations -//Accessibility modifiers are not permitted on overrides or interface implementations -//Accessibility modifiers are not permitted on overrides or interface implementations + + + type IFoo = interface abstract M1 : int -> unit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides01.fs index 6732f4a1ab6..506d9e42250 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides01.fs @@ -1,9 +1,9 @@ // #Regression #Conformance #DeclarationElements #Accessibility #Overloading // Regression test for FSHARP1.0:4485 // Visibility decl on overrides (class inheritance) -//Accessibility modifiers are not permitted on overrides or interface implementations -//Accessibility modifiers are not permitted on overrides or interface implementations -//Accessibility modifiers are not permitted on overrides or interface implementations + + + type C() = class abstract member M : int end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides02.fs index 67006948499..7c448fd77fc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides02.fs @@ -1,9 +1,9 @@ // #Regression #Conformance #DeclarationElements #Accessibility #Overloading // Regression test for FSHARP1.0:4485 // Visibility decl on overrides (class inheritance) -//Accessibility modifiers are not permitted on overrides or interface implementations -//Accessibility modifiers are not permitted on overrides or interface implementations -//Accessibility modifiers are not permitted on overrides or interface implementations + + + [] type D() = class abstract P : int with get, set diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides03.fs index d8ad2c3ad1e..603027363c7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides03.fs @@ -1,9 +1,9 @@ // #Regression #Conformance #DeclarationElements #Accessibility #Overloading // Regression test for FSHARP1.0:4485 // Visibility decl on overrides (class inheritance) -//Accessibility modifiers are not permitted on overrides or interface implementations -//Accessibility modifiers are not permitted on overrides or interface implementations -//Accessibility modifiers are not permitted on overrides or interface implementations + + + [] type D() = class diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides04.fs index de5211d23c1..8262a98c8a5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides04.fs @@ -1,9 +1,9 @@ // #Regression #Conformance #DeclarationElements #Accessibility #Overloading // Regression test for FSHARP1.0:4485 // Visibility decl on overrides (class inheritance) -//Accessibility modifiers are not permitted on overrides or interface implementations -//Accessibility modifiers are not permitted on overrides or interface implementations -//Accessibility modifiers are not permitted on overrides or interface implementations + + + [] type D() = class abstract P : int with get, set diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides05.fs index 25cc44717ed..0475e9bd564 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnOverridesAndIFaceImpl/E_OnOverrides05.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #DeclarationElements #Accessibility #Overloading // Regression test for FSHARP1.0:4485 // Visibility desc on overrides (inheritance chain) -//Accessibility modifiers are not permitted on overrides or interface implementations + [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_OnProperty02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_OnProperty02.fs index 57f66907afa..ed13f1fea2a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_OnProperty02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/E_OnProperty02.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #DeclarationElements #Accessibility #MethodsAndProperties #MemberDefinitions // Regression test for FSharp1.0:4169 // Title: Accessibility modifier in front of property is ignored if either get() or set() is mentioned explicitly -// Verify accessibility annotations can not be duplicated in various places with properties +// Verify accessibility annotations cannot be duplicated in various places with properties //Unexpected symbol '\)' in pattern //Multiple accessibilities given for property getter or setter diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnRecords.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnRecords.fs index aaff3250bda..f34c40c9cac 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnRecords.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnRecords.fs @@ -2,9 +2,9 @@ #light // See bug 1537. -//Accessibility modifiers are not permitted on record fields\. Use 'type R = internal \.\.\.' or 'type R = private \.\.\.' to give an accessibility to the whole representation -//Accessibility modifiers are not permitted on record fields\. Use 'type R = internal \.\.\.' or 'type R = private \.\.\.' to give an accessibility to the whole representation -//Accessibility modifiers are not permitted on record fields\. Use 'type R = internal \.\.\.' or 'type R = private \.\.\.' to give an accessibility to the whole representation + + + type Person = { public Name : string; @@ -39,7 +39,7 @@ let p = Person.CreatePerson() let {Name = x; Age = y; ID = z} = p // The record field 'ID' is not accessible from this code location. 18 6 -// If we consider allowing accessibility modifers on records, then this +// If we consider allowing accessibility modifiers on records, then this // should work, but does not. let {Name = x2; Age = y2; ID = _} = p //The record field 'ID' is not accessible from this code location. 23 6 *) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnRecords02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnRecords02.fs index 4bdf241e094..b334c1d8f61 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnRecords02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_accessibilityOnRecords02.fs @@ -2,7 +2,7 @@ // Regression test for FSHARP1.0:1537 // The warning is emitted _and_ the code compiles just fine. // As of 1/16/2009, the warning is now an error - so this code does not compile! -//Accessibility modifiers are not permitted on record fields\. Use 'type R = internal \.\.\.' or 'type R = private \.\.\.' to give an accessibility to the whole representation + module M type R = { private i : int } // err diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_let01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_let01.fs index ee3566c7113..c2ddc7889a4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_let01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_let01.fs @@ -1,10 +1,10 @@ // #Regression #Conformance #DeclarationElements #Accessibility // On let -//Accessibility modifiers should come immediately prior to the identifier naming a construct -//Possible incorrect indentation: this token is offside of context started at position \(11:23\)\. Try indenting this token further or using standard formatting conventions -//Accessibility modifiers should come immediately prior to the identifier naming a construct -//Possible incorrect indentation: this token is offside of context started at position \(12:23\)\. Try indenting this token further or using standard formatting conventions -//Accessibility modifiers should come immediately prior to the identifier naming a construct + + + + + module M = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_member01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_member01.fs index 029614acfa5..0ef4f0247e8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_member01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_member01.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Accessibility // On member -//Accessibility modifiers should come immediately prior to the identifier naming a construct + #light module M = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_module01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_module01.fs index 1f56aac8817..659fa0b0b11 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_module01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_module01.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Accessibility // On module -//Accessibility modifiers should come immediately prior to the identifier naming a construct + #light public module ModuleDef = // here diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_type01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_type01.fs index b98d87b5764..40eb1258898 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_type01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/PermittedLocations/E_orderingOfAccessibilityKeyword_type01.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Accessibility // On type -//Accessibility modifiers should come immediately prior to the identifier naming a construct + #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeInheritance/InheritedAttribute_001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeInheritance/InheritedAttribute_001.fs index 37d1064c94b..0b31c183225 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeInheritance/InheritedAttribute_001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeInheritance/InheritedAttribute_001.fs @@ -1,8 +1,8 @@ // Ensures that we get an error when warnings as error specified -//This type does not inherit Attribute, it will not work correctly with other .NET languages. -namespace FSharp.Conformance.DeclaratioElements.CustomAttributes.InheritedAttribute + +namespace FSharp.Conformance.DeclarationElements.CustomAttributes.InheritedAttribute open System diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeInheritance/InheritedAttribute_002.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeInheritance/InheritedAttribute_002.fs index c8c64df1e79..0b31c183225 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeInheritance/InheritedAttribute_002.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeInheritance/InheritedAttribute_002.fs @@ -1,8 +1,8 @@ // Ensures that we get an error when warnings as error specified -//This type does not inherit Attribute, it will not work correctly with other .NET languages. -namespace FSharp.Conformance.DeclaratioElements.CustomAttributes.InheritedAttribute + +namespace FSharp.Conformance.DeclarationElements.CustomAttributes.InheritedAttribute open System diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AllowNullLiteral01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AllowNullLiteral01.fs new file mode 100644 index 00000000000..a51ad77a443 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AllowNullLiteral01.fs @@ -0,0 +1,3 @@ +[] +type D() = + member x.P = 1 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsClass.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsClass.fs index 8f587dcf099..0c9af2292e4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsClass.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsClass.fs @@ -24,3 +24,27 @@ type SemanticClassificationItem = type ILTableName(idx: int) = member __.Index = idx static member FromIndex n = ILTableName n + +[] +[] +type Record = { Prop: string } + +[] +[] +type Record2 = { Prop: string } + +[] +type ClassUnion = + | StructUnionCase of int + | StructUnionCase2 of string + +[] +type ClassUnionId = Id + +[] +type ClassUnionId2 = Id + +[] +type UnionCase = + | UnionCase of int + | UnionCase2 of string diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsCtor01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsCtor01.fs index 0f11dc4d6aa..d979d5b70a4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsCtor01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsCtor01.fs @@ -1,5 +1,5 @@ // #Regression #Conformance #DeclarationElements #Attributes -// FSharp1.0:4780 - Attributes targetting constructors are not allowed on explicit constructors 'new() = { ... }' +// FSharp1.0:4780 - Attributes targeting constructors are not allowed on explicit constructors 'new() = { ... }' // Make sure custom attributes can be applied to explicit and implicit constructors #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsProperty.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsProperty.fs index 42c94f1e474..ae150dc3034 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsProperty.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsProperty.fs @@ -7,4 +7,4 @@ type PropertyLevelAttribute() = type U = | [] A - | [] B + | [] B \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsStruct.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsStruct.fs index 9b64c7cb33f..9269f786c0e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsStruct.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsStruct.fs @@ -21,3 +21,33 @@ type SemanticClassificationItem = type ILTableName(idx: int) = member __.Index = idx static member FromIndex n = ILTableName n + +[] +[] +type StructRecord = { Prop: string } + +[] +[] +type StructUnion = + | StructUnionCase of a: int + | StructUnionCase2 of string + +[] +[] +type StructUnionId = Id + +[] +[] +type StructUnionId2 = Id + +[] +[] +type Union1 = + | UnionCase of a: int + | UnionCase2 of string + +[] +[] +type Union2 = + | UnionCase of a: int * b: int + | UnionCase2 of c: string * d: string \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs index 1e68d9d5ee8..bf413c777d3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Conformance.BasicGrammarElements @@ -59,31 +59,31 @@ module CustomAttributes_AttributeUsage = // SOURCE=AttributeTargetsIsMethod01.fs # AttributeTargetsIsMethod01.fs [] - let ``AttributeTargetsIsMethod01_fs`` compilation = + let ``AttributeTargetsIsMethod01_fs 8.0`` compilation = compilation + |> withLangVersion80 |> verifyCompileAndRun |> shouldSucceed // SOURCE=AttributeTargetsIsMethod01.fs # AttributeTargetsIsMethod01.fs [] - let ``AttributeTargetsIsMethod01_fs preview`` compilation = + let ``AttributeTargetsIsMethod01_fs`` compilation = compilation - |> withLangVersionPreview |> verifyCompileAndRun |> shouldSucceed // SOURCE=AttributeTargetsIsProperty.fs # AttributeTargetsIsProperty.fs [] - let ``AttributeTargetsIsProperty_fs`` compilation = + let ``AttributeTargetsIsProperty_fs 8.0`` compilation = compilation + |> withLangVersion80 |> verifyCompile |> shouldSucceed // SOURCE=AttributeTargetsIsProperty.fs # AttributeTargetsIsProperty.fs [] - let ``AttributeTargetsIsProperty_fs preview`` compilation = + let ``AttributeTargetsIsProperty_fs`` compilation = compilation - |> withLangVersionPreview |> verifyCompile |> shouldSucceed @@ -98,12 +98,14 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargets01_fs`` compilation = compilation + |> withLangVersionPreview |> verifyCompile |> shouldFail |> withDiagnostics [ (Error 842, Line 21, Col 21, Line 21, Col 22, "This attribute is not valid for use on this language element") (Error 842, Line 24, Col 21, Line 24, Col 29, "This attribute is not valid for use on this language element") (Error 842, Line 27, Col 7, Line 27, Col 16, "This attribute is not valid for use on this language element") + (Error 842, Line 18, Col 7, Line 18, Col 8, "This attribute is not valid for use on this language element") ] // SOURCE=E_AttributeTargets02.fs # E_AttributeTargets02.fs @@ -120,7 +122,7 @@ module CustomAttributes_AttributeUsage = // SOURCE=E_AttributeTargetIsField01.fs # E_AttributeTargetIsField01.fs [] - let ``E_AttributeTargetIsField01_fs`` compilation = + let ``E_AttributeTargetIsField01_fs 8_0`` compilation = compilation |> withLangVersion80 |> withOptions ["--nowarn:25"] @@ -129,10 +131,10 @@ module CustomAttributes_AttributeUsage = // SOURCE=E_AttributeTargetIsField01.fs # E_AttributeTargetIsField01.fs [] - let ``E_AttributeTargetIsField01_fs preview`` compilation = + let ``E_AttributeTargetIsField01_fs`` compilation = compilation - |> withLangVersionPreview |> withOptions ["--nowarn:25"] + |> withLangVersionPreview |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -157,7 +159,7 @@ module CustomAttributes_AttributeUsage = // SOURCE=E_AttributeTargetIsField02.fs # E_AttributeTargetIsField02.fs [] - let ``E_AttributeTargetIsField02_fs`` compilation = + let ``E_AttributeTargetIsField02_fs 8.0`` compilation = compilation |> withLangVersion80 |> withOptions ["--nowarn:25"] @@ -166,16 +168,15 @@ module CustomAttributes_AttributeUsage = // SOURCE=E_AttributeTargetIsField02.fs # E_AttributeTargetIsField02.fs [] - let ``E_AttributeTargetIsField02_fs preview`` compilation = + let ``E_AttributeTargetIsField02_fs`` compilation = compilation - |> withLangVersionPreview |> withOptions ["--nowarn:25"] |> verifyCompile |> shouldSucceed // SOURCE=E_AttributeTargetIsMethod02.fs # E_AttributeTargetIsMethod02.fs [] - let ``E_AttributeTargetIsMethod02_fs`` compilation = + let ``E_AttributeTargetIsMethod02_fs 8_0`` compilation = compilation |> withLangVersion80 |> withOptions ["--nowarn:25"] @@ -184,7 +185,7 @@ module CustomAttributes_AttributeUsage = // SOURCE=E_AttributeTargetIsMethod02.fs # E_AttributeTargetIsMethod02.fs [] - let ``E_AttributeTargetIsMethod02_fs preview`` compilation = + let ``E_AttributeTargetIsMethod02_fs`` compilation = compilation |> withLangVersionPreview |> withOptions ["--nowarn:25"] @@ -206,7 +207,7 @@ module CustomAttributes_AttributeUsage = // SOURCE=E_AttributeTargetIsMethod03.fs # E_AttributeTargetIsMethod03.fs [] - let ``E_AttributeTargetIsMethod03_fs`` compilation = + let ``E_AttributeTargetIsMethod03_fs 8_0`` compilation = compilation |> withLangVersion80 |> withOptions ["--nowarn:25"] @@ -215,7 +216,7 @@ module CustomAttributes_AttributeUsage = // SOURCE=E_AttributeTargetIsMethod03.fs # E_AttributeTargetIsMethod03.fs [] - let ``E_AttributeTargetIsMethod03_fs preview`` compilation = + let ``E_AttributeTargetIsMethod03_fs`` compilation = compilation |> withLangVersionPreview |> withOptions ["--nowarn:25"] @@ -295,44 +296,45 @@ module CustomAttributes_AttributeUsage = // SOURCE=AttributeTargetIsStruct.fs # AttributeTargetIsStruct.fs [] - let ``AttributeTargetIsStruct_fs`` compilation = + let ``AttributeTargetIsStruct_fs 8.0`` compilation = compilation + |> withLangVersion80 |> verifyCompile |> shouldSucceed // SOURCE=AttributeTargetIsStruct.fs # AttributeTargetIsStruct.fs [] - let ``AttributeTargetIsStruct_fs preview`` compilation = + let ``AttributeTargetIsStruct_fs`` compilation = compilation - |> withLangVersionPreview |> verifyCompile |> shouldSucceed // SOURCE=AttributeTargetIsClass.fs # AttributeTargetIsClass.fs [] - let ``AttributeTargetIsClass_fs`` compilation = + let ``AttributeTargetIsClass_fs 8.0`` compilation = compilation + |> withLangVersion80 |> verifyCompile |> shouldSucceed // SOURCE=AttributeTargetIsClass.fs # AttributeTargetIsClass.fs [] - let ``AttributeTargetIsClass_fs preview`` compilation = + let ``AttributeTargetIsClass_fs`` compilation = compilation - |> withLangVersionPreview |> verifyCompile |> shouldSucceed // SOURCE=E_AttributeTargetIsStruct.fs # E_AttributeTargetIsStruct.fs [] - let ``E_AttributeTargetIsStruct_fs`` compilation = + let ``E_AttributeTargetIsStruct_fs 8.0`` compilation = compilation + |> withLangVersion80 |> verifyCompile |> shouldSucceed // SOURCE=E_AttributeTargetIsStruct.fs # E_AttributeTargetIsStruct.fs [] - let ``E_AttributeTargetIsStruct_fs preview`` compilation = + let ``E_AttributeTargetIsStruct_fs`` compilation = compilation |> withLangVersionPreview |> verifyCompile @@ -342,25 +344,27 @@ module CustomAttributes_AttributeUsage = (Error 842, Line 19, Col 3, Line 19, Col 14, "This attribute is not valid for use on this language element") (Error 842, Line 22, Col 11, Line 22, Col 22, "This attribute is not valid for use on this language element") (Error 842, Line 25, Col 3, Line 25, Col 14, "This attribute is not valid for use on this language element") + (Error 842, Line 34, Col 3, Line 34, Col 18, "This attribute is not valid for use on this language element") + (Error 842, Line 35, Col 3, Line 35, Col 15, "This attribute is not valid for use on this language element") + (Error 842, Line 40, Col 3, Line 40, Col 14, "This attribute is not valid for use on this language element") + (Error 842, Line 41, Col 3, Line 41, Col 18, "This attribute is not valid for use on this language element") + (Error 842, Line 49, Col 3, Line 49, Col 18, "This attribute is not valid for use on this language element") + (Error 842, Line 50, Col 3, Line 50, Col 15, "This attribute is not valid for use on this language element") + (Error 842, Line 53, Col 3, Line 53, Col 14, "This attribute is not valid for use on this language element") + (Error 842, Line 54, Col 3, Line 54, Col 18, "This attribute is not valid for use on this language element") ] // SOURCE=E_AttributeTargetIsClass.fs # E_AttributeTargetIsClass.fs [] - let ``E_AttributeTargetIsClass_fs`` compilation = - compilation - |> verifyCompile - |> shouldSucceed - - // SOURCE=E_AttributeTargetIsClass01.fs # E_AttributeTargetIsClass01.fs - [] - let ``E_AttributeTargetIsClass01_fs`` compilation = + let ``E_AttributeTargetIsClass_fs 8_0`` compilation = compilation + |> withLangVersion80 |> verifyCompile |> shouldSucceed // SOURCE=E_AttributeTargetIsClass.fs # E_AttributeTargetIsClass.fs [] - let ``E_AttributeTargetIsClass_fs preview`` compilation = + let ``E_AttributeTargetIsClass_fs`` compilation = compilation |> withLangVersionPreview |> verifyCompile @@ -373,7 +377,15 @@ module CustomAttributes_AttributeUsage = // SOURCE=E_AttributeTargetIsClass01.fs # E_AttributeTargetIsClass01.fs [] - let ``E_AttributeTargetIsClass01_fs preview`` compilation = + let ``E_AttributeTargetIsClass01_fs 8_0`` compilation = + compilation + |> withLangVersion80 + |> verifyCompile + |> shouldSucceed + + // SOURCE=E_AttributeTargetIsClass01.fs # E_AttributeTargetIsClass01.fs + [] + let ``E_AttributeTargetIsClass01_fs`` compilation = compilation |> withLangVersionPreview |> verifyCompile @@ -460,8 +472,9 @@ module CustomAttributes_AttributeUsage = // SOURCE=E_AttributeTargetIsField03.fs # E_AttributeTargetIsField03.fs [] - let ``E_AttributeTargetIsField03_fs`` compilation = + let ``E_AttributeTargetIsField03_fs 8_0`` compilation = compilation + |> withLangVersion80 |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -470,7 +483,7 @@ module CustomAttributes_AttributeUsage = // SOURCE=E_AttributeTargetIsField03.fs # E_AttributeTargetIsField03.fs [] - let ``E_AttributeTargetIsField03_fs preview`` compilation = + let ``E_AttributeTargetIsField03_fs`` compilation = compilation |> withLangVersionPreview |> verifyCompile @@ -482,14 +495,15 @@ module CustomAttributes_AttributeUsage = // SOURCE=E_AttributeTargetIsProperty01.fs # E_AttributeTargetIsField03.fs [] - let ``E_AttributeTargetIsProperty01_fs`` compilation = + let ``E_AttributeTargetIsProperty01_fs 8_0`` compilation = compilation + |> withLangVersion80 |> verifyCompile |> shouldSucceed // SOURCE=E_AttributeTargetIsProperty01.fs # E_AttributeTargetIsField03.fs [] - let ``E_AttributeTargetIsProperty01_fs preview`` compilation = + let ``E_AttributeTargetIsProperty01_fs`` compilation = compilation |> withLangVersionPreview |> verifyCompile @@ -501,14 +515,15 @@ module CustomAttributes_AttributeUsage = // SOURCE=E_AttributeTargetIsCtor01.fs # E_AttributeTargetIsCtor01.fs [] - let ``E_AttributeTargetIsCtor01_fs`` compilation = + let ``E_AttributeTargetIsCtor01_fs 8_0`` compilation = compilation + |> withLangVersion80 |> verifyCompile |> shouldSucceed // SOURCE=E_AttributeTargetIsCtor01.fs # E_AttributeTargetIsCtor01.fs [] - let ``E_AttributeTargetIsCtor01_fs preview`` compilation = + let ``E_AttributeTargetIsCtor01_fs`` compilation = compilation |> withLangVersionPreview |> verifyCompile @@ -522,29 +537,30 @@ module CustomAttributes_AttributeUsage = // SOURCE=AttributeTargetsIsEnum01.fs # AttributeTargetsIsEnum01.fs [] - let ``AttributeTargetsIsEnum01_fs`` compilation = + let ``AttributeTargetsIsEnum01_fs 8.0`` compilation = compilation + |> withLangVersion80 |> verifyCompile |> shouldSucceed // SOURCE=AttributeTargetsIsEnum01.fs # AttributeTargetsIsEnum01.fs [] - let ``AttributeTargetsIsEnum01_fs preview`` compilation = + let ``AttributeTargetsIsEnum01_fs`` compilation = compilation - |> withLangVersionPreview |> verifyCompile |> shouldSucceed // SOURCE=E_AttributeTargetIsEnum01.fs # E_AttributeTargetIsEnum01.fs [] - let ``E_AttributeTargetIsEnum01_fs`` compilation = + let ``E_AttributeTargetIsEnum01_fs 8_0`` compilation = compilation + |> withLangVersion80 |> verifyCompile |> shouldSucceed // SOURCE=E_AttributeTargetIsEnum01.fs # E_AttributeTargetIsEnum01.fs [] - let ``E_AttributeTargetIsEnum01_fs preview`` compilation = + let ``E_AttributeTargetIsEnum01_fs`` compilation = compilation |> withLangVersionPreview |> verifyCompile @@ -554,33 +570,34 @@ module CustomAttributes_AttributeUsage = (Error 842, Line 20, Col 3, Line 20, Col 14, "This attribute is not valid for use on this language element") (Error 842, Line 21, Col 3, Line 21, Col 18, "This attribute is not valid for use on this language element") (Error 842, Line 22, Col 3, Line 22, Col 17, "This attribute is not valid for use on this language element") - ] - + ] + // SOURCE=AttributeTargetsIsDelegate01.fs # AttributeTargetsIsDelegate01.fs [] - let ``AttributeTargetsIsDelegate01_fs`` compilation = + let ``AttributeTargetsIsDelegate01_fs 8.0`` compilation = compilation + |> withLangVersion80 |> verifyCompile |> shouldSucceed // SOURCE=AttributeTargetsIsDelegate01.fs # AttributeTargetsIsDelegate01.fs [] - let ``AttributeTargetsIsDelegate01_fs preview`` compilation = + let ``AttributeTargetsIsDelegate01_fs`` compilation = compilation - |> withLangVersionPreview |> verifyCompile |> shouldSucceed // SOURCE=E_AttributeTargetIsDelegate01.fs # E_AttributeTargetIsDelegate01.fs [] - let ``E_AttributeTargetIsDelegate01_fs`` compilation = + let ``E_AttributeTargetIsDelegate01_fs 8.0`` compilation = compilation + |> withLangVersion80 |> verifyCompile |> shouldSucceed // SOURCE=E_AttributeTargetIsDelegate01.fs # E_AttributeTargetIsDelegate01.fs [] - let ``E_AttributeTargetsIsDelegate01_fs preview`` compilation = + let ``E_AttributeTargetsIsDelegate01_fs`` compilation = compilation |> withLangVersionPreview |> verifyCompile @@ -600,35 +617,36 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = [] let mutable valueFactory = valueFactory """ - |> withLangVersionPreview |> compile |> shouldSucceed // SOURCE=AttributeTargetsIsInterface.fs # AttributeTargetsIsInterface.fs [] - let ``AttributeTargetsIsInterface_fs`` compilation = + let ``AttributeTargetsIsInterface_fs 8.0`` compilation = compilation + |> withLangVersion80 |> verifyCompile |> shouldSucceed // SOURCE=AttributeTargetsIsInterface.fs # AttributeTargetsIsInterface.fs [] - let ``AttributeTargetsIsInterface_fs preview`` compilation = + let ``AttributeTargetsIsInterface_fs`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldSucceed // SOURCE=E_AttributeTargetIsInterface.fs # E_AttributeTargetIsInterface.fs [] - let ``E_AttributeTargetIsInterface_fs`` compilation = + let ``E_AttributeTargetIsInterface_fs 8_0`` compilation = compilation + |> withLangVersion80 |> verifyCompile |> shouldSucceed // SOURCE=E_AttributeTargetIsInterface.fs # E_AttributeTargetIsInterface.fs [] - let ``E_AttributeTargetIsInterface_fs preview`` compilation = + let ``E_AttributeTargetIsInterface_fs`` compilation = compilation |> withLangVersionPreview |> verifyCompile @@ -638,4 +656,280 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = (Error 842, Line 14, Col 3, Line 14, Col 15, "This attribute is not valid for use on this language element") (Error 842, Line 18, Col 3, Line 18, Col 14, "This attribute is not valid for use on this language element") (Error 842, Line 19, Col 3, Line 19, Col 15, "This attribute is not valid for use on this language element") - ] \ No newline at end of file + ] + + // SOURCE= E_AttributeTargetIsClass02.fs # E_AttributeTargetIsClass02.fs + [] + let ``E_AttributeTargetIsClass02_fs 8.0`` compilation = + compilation + |> withLangVersion80 + |> verifyCompile + |> shouldSucceed + + // SOURCE=E_AttributeTargetIsClass02.fs # E_AttributeTargetIsClass02.fs + [] + let ``E_AttributeTargetIsClass02_fs`` compilation = + compilation + |> withLangVersionPreview + |> verifyCompile + |> shouldFail + |> withDiagnostics [ + (Error 842, Line 15, Col 3, Line 15, Col 18, "This attribute is not valid for use on this language element"); + (Error 842, Line 16, Col 3, Line 16, Col 15, "This attribute is not valid for use on this language element") + (Error 842, Line 20, Col 3, Line 20, Col 14, "This attribute is not valid for use on this language element") + (Error 842, Line 21, Col 3, Line 21, Col 18, "This attribute is not valid for use on this language element") + (Error 842, Line 26, Col 3, Line 26, Col 14, "This attribute is not valid for use on this language element") + (Error 842, Line 27, Col 3, Line 27, Col 18, "This attribute is not valid for use on this language element") + (Error 842, Line 34, Col 3, Line 34, Col 14, "This attribute is not valid for use on this language element") + (Error 842, Line 35, Col 3, Line 35, Col 18, "This attribute is not valid for use on this language element") + (Error 842, Line 43, Col 3, Line 43, Col 18, "This attribute is not valid for use on this language element") + (Error 842, Line 44, Col 3, Line 44, Col 15, "This attribute is not valid for use on this language element") + (Error 842, Line 47, Col 3, Line 47, Col 14, "This attribute is not valid for use on this language element") + (Error 842, Line 48, Col 3, Line 48, Col 18, "This attribute is not valid for use on this language element") + ] + + // SOURCE= CLIMutableAttribute01.fs # CLIMutableAttribute01.fs + [] + let ``CLIMutableAttribute01 8.0`` compilation = + compilation + |> withLangVersion80 + |> verifyCompile + |> shouldSucceed + + // SOURCE=CLIMutableAttribute01.fs # CLIMutableAttribute01.fs + [] + let ``CLIMutableAttribute01 preview`` compilation = + compilation + |> withLangVersionPreview + |> verifyCompile + |> shouldSucceed + + // SOURCE= E_CLIMutableAttribute.fs # E_CLIMutableAttribute.fs + [] + let ``E_CLIMutableAttribute 8.0`` compilation = + compilation + |> withLangVersion80 + |> verifyCompile + |> shouldFail + |> withDiagnostics [ + (Error 3132, Line 4, Col 8, Line 4, Col 16, "This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.") + (Error 3132, Line 7, Col 8, Line 7, Col 16, "This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.") + (Error 3132, Line 10, Col 8, Line 10, Col 20, "This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.") + (Error 3132, Line 13, Col 8, Line 13, Col 17, "This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.") + (Error 3132, Line 16, Col 8, Line 16, Col 15, "This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.") + (Error 3132, Line 19, Col 8, Line 19, Col 19, "This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.") + (Error 3132, Line 22, Col 8, Line 22, Col 17, "This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.") + (Error 3132, Line 25, Col 8, Line 25, Col 18, "This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.") + ] + + // SOURCE=E_CLIMutableAttribute.fs # E_CLIMutableAttribute.fs + [] + let ``E_CLIMutableAttribute preview`` compilation = + compilation + |> withLangVersionPreview + |> verifyCompile + |> shouldFail + |> withDiagnostics [ + (Error 3132, Line 4, Col 8, Line 4, Col 16, "This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.") + (Error 3132, Line 7, Col 8, Line 7, Col 16, "This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.") + (Error 3132, Line 10, Col 8, Line 10, Col 20, "This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.") + (Error 3132, Line 13, Col 8, Line 13, Col 17, "This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.") + (Error 3132, Line 16, Col 8, Line 16, Col 15, "This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.") + (Error 3132, Line 19, Col 8, Line 19, Col 19, "This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.") + (Error 3132, Line 22, Col 8, Line 22, Col 17, "This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.") + (Error 3132, Line 25, Col 8, Line 25, Col 18, "This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.") + ] + + // SOURCE= E_AllowNullLiteral.fs # E_AllowNullLiteral.fs + [] + let ``E_AllowNullLiteral 8.0`` compilation = + compilation + |> withLangVersion80 + |> verifyCompile + |> shouldFail + |> withDiagnostics [ + (Error 935, Line 15, Col 10, Line 15, Col 11, "Types with the 'AllowNullLiteral' attribute may only inherit from or implement types which also allow the use of the null literal") + (Error 934, Line 27, Col 10, Line 27, Col 11, "Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute") + (Error 934, Line 30, Col 10, Line 30, Col 11, "Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute") + (Error 934, Line 33, Col 10, Line 33, Col 11, "Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute") + (Error 934, Line 36, Col 10, Line 36, Col 11, "Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute") + (Error 934, Line 39, Col 10, Line 39, Col 13, "Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute") + (Error 842, Line 41, Col 7, Line 41, Col 23, "This attribute is not valid for use on this language element") + (Error 842, Line 44, Col 7, Line 44, Col 23, "This attribute is not valid for use on this language element") + (Error 935, Line 54, Col 10, Line 54, Col 11, "Types with the 'AllowNullLiteral' attribute may only inherit from or implement types which also allow the use of the null literal") + ] + + // SOURCE=E_AllowNullLiteral.fs # E_AllowNullLiteral.fs + [] + let ``E_AllowNullLiteral preview`` compilation = + compilation + |> withLangVersionPreview + |> verifyCompile + |> shouldFail + |> withDiagnostics [ + (Error 935, Line 15, Col 10, Line 15, Col 11, "Types with the 'AllowNullLiteral' attribute may only inherit from or implement types which also allow the use of the null literal") + (Error 934, Line 27, Col 10, Line 27, Col 11, "Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute") + (Error 934, Line 30, Col 10, Line 30, Col 11, "Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute") + (Error 934, Line 33, Col 10, Line 33, Col 11, "Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute") + (Error 934, Line 36, Col 10, Line 36, Col 11, "Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute") + (Error 934, Line 39, Col 10, Line 39, Col 13, "Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute") + (Error 842, Line 41, Col 7, Line 41, Col 23, "This attribute is not valid for use on this language element") + (Error 842, Line 44, Col 7, Line 44, Col 23, "This attribute is not valid for use on this language element") + (Error 935, Line 54, Col 10, Line 54, Col 11, "Types with the 'AllowNullLiteral' attribute may only inherit from or implement types which also allow the use of the null literal") + ] + + // SOURCE= AllowNullLiteral01.fs # AllowNullLiteral01.fs + [] + let ``AllowNullLiteral01 8.0`` compilation = + compilation + |> withLangVersion80 + |> verifyCompile + |> shouldSucceed + + // SOURCE=AllowNullLiteral01.fs # AllowNullLiteral01.fs + [] + let ``AllowNullLiteral01 preview`` compilation = + compilation + |> withLangVersionPreview + |> verifyCompile + |> shouldSucceed + + // SOURCE= E_VolatileField.fs # E_VolatileField.fs + [] + let ``E_VolatileField 9.0`` compilation = + compilation + |> withLangVersion90 + |> verifyCompile + |> shouldFail + |> withDiagnostics [ + (Error 823, Line 4, Col 15, Line 4, Col 16, "The 'VolatileField' attribute may only be used on 'let' bindings in classes") + (Error 823, Line 7, Col 11, Line 7, Col 12, "The 'VolatileField' attribute may only be used on 'let' bindings in classes") + (Error 879, Line 7, Col 11, Line 7, Col 12, "Volatile fields must be marked 'mutable' and cannot be thread-static") + (Error 823, Line 10, Col 7, Line 10, Col 9, "The 'VolatileField' attribute may only be used on 'let' bindings in classes") + (Error 879, Line 10, Col 7, Line 10, Col 9, "Volatile fields must be marked 'mutable' and cannot be thread-static") + (Error 823, Line 26, Col 17, Line 26, Col 18, "The 'VolatileField' attribute may only be used on 'let' bindings in classes") + (Error 879, Line 14, Col 16, Line 14, Col 19, "Volatile fields must be marked 'mutable' and cannot be thread-static") + (Error 879, Line 17, Col 16, Line 17, Col 17, "Volatile fields must be marked 'mutable' and cannot be thread-static") + (Error 879, Line 20, Col 9, Line 20, Col 11, "Volatile fields must be marked 'mutable' and cannot be thread-static") + (Error 879, Line 23, Col 9, Line 23, Col 10, "Volatile fields must be marked 'mutable' and cannot be thread-static") + ] + + // SOURCE=E_VolatileField.fs # E_VolatileField.fs + [] + let ``E_VolatileField preview`` compilation = + compilation + |> withLangVersionPreview + |> verifyCompile + |> shouldFail + |> withDiagnostics [ + (Error 823, Line 4, Col 15, Line 4, Col 16, "The 'VolatileField' attribute may only be used on 'let' bindings in classes") + (Error 823, Line 7, Col 11, Line 7, Col 12, "The 'VolatileField' attribute may only be used on 'let' bindings in classes") + (Error 879, Line 7, Col 11, Line 7, Col 12, "Volatile fields must be marked 'mutable' and cannot be thread-static") + (Error 823, Line 10, Col 7, Line 10, Col 9, "The 'VolatileField' attribute may only be used on 'let' bindings in classes") + (Error 879, Line 10, Col 7, Line 10, Col 9, "Volatile fields must be marked 'mutable' and cannot be thread-static") + (Error 823, Line 26, Col 17, Line 26, Col 18, "The 'VolatileField' attribute may only be used on 'let' bindings in classes") + (Error 879, Line 14, Col 16, Line 14, Col 19, "Volatile fields must be marked 'mutable' and cannot be thread-static") + (Error 879, Line 17, Col 16, Line 17, Col 17, "Volatile fields must be marked 'mutable' and cannot be thread-static") + (Error 879, Line 20, Col 9, Line 20, Col 11, "Volatile fields must be marked 'mutable' and cannot be thread-static") + (Error 879, Line 23, Col 9, Line 23, Col 10, "Volatile fields must be marked 'mutable' and cannot be thread-static") + ] + + // SOURCE= VolatileField01.fs # VolatileField01.fs + [] + let ``VolatileField01 9.0`` compilation = + compilation + |> withLangVersion90 + |> verifyCompile + |> shouldSucceed + + // SOURCE=VolatileField01.fs # VolatileField01.fs + [] + let ``VolatileField01 preview`` compilation = + compilation + |> withLangVersionPreview + |> verifyCompile + |> shouldSucceed + + // SOURCE= E_SealedAttribute01.fs # E_SealedAttribute01.fs + [] + let ``E_SealedAttribute01 9.0`` compilation = + compilation + |> withLangVersion90 + |> verifyCompile + |> shouldFail + |> withDiagnostics [ + (Error 942, Line 2, Col 6, Line 2, Col 31, "Struct types are always sealed") + (Error 948, Line 8, Col 6, Line 8, Col 24, "Interface types cannot be sealed") + (Error 942, Line 14, Col 6, Line 14, Col 33, "Delegate types are always sealed") + ] + + // SOURCE=E_SealedAttribute01.fs # E_SealedAttribute01.fs + [] + let ``E_SealedAttribute01 preview`` compilation = + compilation + |> withLangVersionPreview + |> verifyCompile + |> shouldFail + |> withDiagnostics [ + (Error 942, Line 2, Col 6, Line 2, Col 31, "Struct types are always sealed") + (Error 948, Line 8, Col 6, Line 8, Col 24, "Interface types cannot be sealed") + (Error 942, Line 14, Col 6, Line 14, Col 33, "Delegate types are always sealed") + ] + + // SOURCE= E_StructLayout01.fs # E_StructLayout01.fs + [] + let ``E_StructLayout01 9.0`` compilation = + compilation + |> withLangVersion90 + |> verifyCompile + |> shouldFail + |> withDiagnostics [ + (Error 937, Line 2, Col 6, Line 2, Col 8, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute") + (Error 937, Line 7, Col 6, Line 7, Col 8, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute") + (Error 937, Line 11, Col 6, Line 11, Col 8, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute") + (Error 937, Line 14, Col 6, Line 14, Col 8, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute") + (Error 937, Line 17, Col 6, Line 17, Col 8, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute") + ] + + // SOURCE=E_StructLayout01.fs # E_StructLayout01.fs + [] + let ``E_StructLayout01 preview`` compilation = + compilation + |> withLangVersionPreview + |> verifyCompile + |> shouldFail + |> withDiagnostics [ + (Error 937, Line 2, Col 6, Line 2, Col 8, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute") + (Error 937, Line 7, Col 6, Line 7, Col 8, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute") + (Error 937, Line 11, Col 6, Line 11, Col 8, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute") + (Error 937, Line 14, Col 6, Line 14, Col 8, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute") + (Error 937, Line 17, Col 6, Line 17, Col 8, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute") + ] + +#if NETCOREAPP + let missingConstructorRepro = + """ +open System.Text.Json.Serialization + +type internal ApplicationTenantJsonDerivedTypeAttribute () = + inherit JsonDerivedTypeAttribute (typeof, "a") + +// -------------------------------------------------------------------------- +// IMPORTANT: Read ReadMe before modifying this сlass and any referenced types +// -------------------------------------------------------------------------- +and [] + ApplicationTenant + [] (id, name, loginProvider, allowedDomains, authorizedTenants, properties) = + + member _.Id = "" + """ + + [] + [] + [] + let ``Regression for - F# 9 compiler cannot find constructor for attribute`` langVersion = + FSharp missingConstructorRepro + |> withLangVersion langVersion + |> verifyCompile + |> shouldSucceed +#endif diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/CLIMutableAttribute01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/CLIMutableAttribute01.fs new file mode 100644 index 00000000000..a269cabf557 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/CLIMutableAttribute01.fs @@ -0,0 +1,6 @@ +[] +type Record = { X: int } + +[] +[] +type StructRecord = { X: int } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AllowNullLiteral.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AllowNullLiteral.fs new file mode 100644 index 00000000000..0f376db3122 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AllowNullLiteral.fs @@ -0,0 +1,57 @@ +module AllowNullLiteralTest = begin + + //[] + type I = + interface + abstract P : int + end + + //[] + type C() = + member x.P = 1 + + + [] + type D() = + inherit C() + interface I with + member x.P = 2 + member x.P = 1 + + let d = (null : D) + + let d2 = ((box null) :?> D) + + + [] // expect an error here + type S(c:int) = struct end + + [] // expect an error here + type R = { r : int } + + [] // expect an error here + type U = A | B of int + + [] // expect an error here + type E = A = 1 | B = 2 + + [] // expect an error here + type Del = delegate of int -> int + + [] // expect an error here + let x = 1 + + [] // expect an error here + let f x = 1 + +end + +module AllowNullLiteralWithArgumentTest = begin + + type A() = class end + + [] // expect an error here + type B() = inherit A() + +end + \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsClass02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsClass02.fs new file mode 100644 index 00000000000..532509f0ad5 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsClass02.fs @@ -0,0 +1,51 @@ +open System + +[] +type ClassTargetAttribute() = + inherit Attribute() + +[] +type InterfaceTargetAttribute() = + inherit Attribute() + +[] +type StructTargetAttribute() = + inherit Attribute() + +[] +[] +[] +type Record = { Prop: string } + +[] +[] +[] +[] +type StructRecord = { Prop: string } + +[] +[] +[] +[] +type UnionCase = + | UnionCase of a: int + | UnionCase2 of string + +[] +[] +[] +[] +type UnionCase2 = + | UnionCase of a: int * b: int + | UnionCase2 of c: string * d: string + +[] +[] +[] +type StructUnionId = Id + +[] +[] +[] +[] +type StructUnionId2 = Id \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsProperty01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsProperty01.fs index 4627c3680dd..65a9ea17bd8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsProperty01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsProperty01.fs @@ -12,4 +12,5 @@ type PropertyOrFieldLevelAttribute() = type SomeUnion = | [] Case1 of int // Should fail -| [] Case2 of int // Should fail \ No newline at end of file +| [] Case2 of int // Should fail + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsStruct.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsStruct.fs index ace0b6a5c39..8e3fe0259d3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsStruct.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargetIsStruct.fs @@ -24,4 +24,34 @@ type Struct4 = struct end [] [] -type Struct5 = struct end \ No newline at end of file +type Struct5 = struct end + +[] +type InterfaceTargetAttribute() = + inherit Attribute() + +[] +[] +[] +type UnionCase = + | UnionCase of int + | UnionCase2 of string + +[] +[] +[] +[] +type UnionCase2 = + | UnionCase of a: int * b: int + | UnionCase2 of c: string * d: string + +[] +[] +[] +type StructUnionId = Id + +[] +[] +[] +[] +type StructUnionId2 = Id \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargets01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargets01.fs index 15bfe1a8e1d..6856fec0e79 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargets01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargets01.fs @@ -3,8 +3,8 @@ // Title: AttributeTargets from AttributeUsage are not being checked/honored // Descr: Verify an attribute targeting methods, can't be applied to any other language elements. -//This attribute is not valid for use on this language element -//This attribute is not valid for use on this language element + + open System @@ -20,13 +20,15 @@ type A() = [] val mutable m_Index : int - + [] val mutable m_Name : string - + [] member this.Index with [] get () = 5 and [] set (x : int) = () [] static member (+) (op1 : A, op2 : A) = new A() + + member this.DoIt() = someVal diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargets02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargets02.fs index 555bfd5f829..99d25d9a68d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargets02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_AttributeTargets02.fs @@ -2,7 +2,7 @@ // Regression test for FSHARP1.0:4727 // Title: once we start compiling them as real mutable fields, you should not be able to target both "property" for "val mutable" fields in classes -//This attribute is not valid for use on this language element + open System diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_CLIMutableAttribute.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_CLIMutableAttribute.fs new file mode 100644 index 00000000000..b0835dd4094 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_CLIMutableAttribute.fs @@ -0,0 +1,35 @@ +module BogusUseOfCLIMutable = begin + + [] + type BadClass() = member x.P = 1 + + [] + type BadUnion = A | B + + [] + type BadInterface = interface end + + [] + type BadClass2 = class end + + [] + type BadEnum = | A = 1 | B = 2 + + [] + type BadDelegate = delegate of int * int -> int + + [] + type BadStruct = struct val x : int end + + [] + type BadStruct2(x:int) = struct member v.X = x end + + [] + type Good1 = { x : int; y : int } + let good1 = { x = 1; y = 2 } + + [] + type Good2 = { x : int } + let good2 = { x = 1 } + +end \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_ConditionalAttribute.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_ConditionalAttribute.fs index 390a80d0030..12710cc5e91 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_ConditionalAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_ConditionalAttribute.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #DeclarationElements #Attributes // Regression for FSHARP1.0:6098 // conditionalattribute on a class should fail with a diagnostic -//Attribute 'System.Diagnostics.ConditionalAttribute' is only valid on methods or attribute classes + module M open System.Diagnostics diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_SealedAttribute01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_SealedAttribute01.fs new file mode 100644 index 00000000000..1a58c154ca4 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_SealedAttribute01.fs @@ -0,0 +1,14 @@ +[] +type UnnecessarilySealedStruct = + struct + member x.P = 1 + end + +[] +type BadSealedInterface = + interface + abstract P : int + end + +[] +type UnnecessarilySealedDelegate = delegate of int -> int \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_StructLayout01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_StructLayout01.fs new file mode 100644 index 00000000000..0e0130e5a9f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_StructLayout01.fs @@ -0,0 +1,17 @@ +[] +type X1 = + abstract M : unit -> 'a + +[] +[] +type X2() = + abstract M : unit -> 'a + +[] +type X4 = R1 | R2 + +[] +type X5 = R1 = 1 | R2 = 2 + +[] +type X6 = delegate of int -> int \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_VolatileField.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_VolatileField.fs new file mode 100644 index 00000000000..d35abffe475 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_VolatileField.fs @@ -0,0 +1,31 @@ +module VolatileFieldSanityChecks = begin + + [] + let mutable x = 1 + + [] + let rec f x = 1 + + [] + let x2 = 1 + + type C() = + [] + static let sx2 = 1 // expect an error - not mutable + + [] + static let f x2 = 1 // expect an error - not mutable + + [] + let x2 = 1 // expect an error - not mutable + + [] + let f x2 = 1 // expect an error - not mutable + + [] + val mutable x : int // expect an error - not supported + + member x.P = 1 + +end + \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_WithBitwiseOr01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_WithBitwiseOr01.fsx index 35490c04049..bec6d3f2e77 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_WithBitwiseOr01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/E_WithBitwiseOr01.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #DeclarationElements #Attributes // Regression test for FSHARP1.0:3797 // Attributes defined in F# and whose AttributeUsage is specified using bitwise or do MUST have the attribute usage checked by the F# compiler -//This attribute is not valid for use on this language element + #light [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/VolatileField01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/VolatileField01.fs new file mode 100644 index 00000000000..77e2721da10 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/VolatileField01.fs @@ -0,0 +1,12 @@ +type InterruptibleLazy (value) = + [] + let mutable valueFactory = value + + [] + static let mutable valueFactory2 = Unchecked.defaultof<_> + + [] + let mutable add1 = fun x -> x + 1 + + [] + static let mutable add2 = fun x -> x + 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/W_AssemblyVersion01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/W_AssemblyVersion01.fs index 957a3ec7189..573c7d5544d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/W_AssemblyVersion01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/W_AssemblyVersion01.fs @@ -1,5 +1,5 @@ // #Regression #Conformance #DeclarationElements #Attributes -//The attribute System.Reflection.AssemblyVersionAttribute specified version '1\.2\.3\.4\.5\.6', but this value is invalid and has been ignored + [] do diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/W_AssemblyVersion02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/W_AssemblyVersion02.fs index e44827056a4..6768fc8e004 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/W_AssemblyVersion02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/W_AssemblyVersion02.fs @@ -1,5 +1,5 @@ // #Regression #Conformance #DeclarationElements #Attributes -//The attribute System.Reflection.AssemblyVersionAttribute specified version '1\.2\.\*\.4', but this value is invalid and has been ignored + [] do diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/X_AssemblyVersion01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/X_AssemblyVersion01.fs index d50086febb0..0019bc85b26 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/X_AssemblyVersion01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/X_AssemblyVersion01.fs @@ -1,5 +1,5 @@ // #Regression #Conformance #DeclarationElements #Attributes -//The attribute System.Reflection.AssemblyFileVersionAttribute specified version '9\.8\.7\.6\.5', but this value is invalid and has been ignored + [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/X_AssemblyVersion02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/X_AssemblyVersion02.fs index 8cff47895b9..6f76b962f5d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/X_AssemblyVersion02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/X_AssemblyVersion02.fs @@ -1,5 +1,5 @@ // #Regression #Conformance #DeclarationElements #Attributes -//The attribute System.Reflection.AssemblyFileVersionAttribute specified version '9\.8\.\*\.6', but this value is invalid and has been ignored + [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/Basic.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/Basic.fs index f90c9b30e3e..1e3c99dc8a5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/Basic.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/Basic.fs @@ -92,8 +92,11 @@ module CustomAttributes_Basic = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 824, Line 8, Col 5, Line 8, Col 20, "Attributes are not permitted on 'let' bindings in expressions") - (Warning 20, Line 8, Col 1, Line 8, Col 41, "The result of this expression has type 'int' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.") + (Error 824, Line 8, Col 13, Line 8, Col 14, "Attributes are not permitted on 'let' bindings in expressions") + (Warning 20, Line 8, Col 28, Line 8, Col 41, "The result of this expression has type 'int' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.") + (Error 824, Line 10, Col 14, Line 10, Col 15, "Attributes are not permitted on 'let' bindings in expressions") + (Error 824, Line 10, Col 26, Line 10, Col 27, "Attributes are not permitted on 'let' bindings in expressions") + (Warning 20, Line 8, Col 1, Line 10, Col 60, "The result of this expression has type 'int' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.") ] // SOURCE=E_AttributeApplication07.fs # E_AttributeApplication07.fs @@ -156,6 +159,7 @@ module CustomAttributes_Basic = [] let ``E_StructLayoutSequentialNeg_DU2_fs`` compilation = compilation + |> withLangVersionPreview |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -166,6 +170,7 @@ module CustomAttributes_Basic = [] let ``E_StructLayoutSequentialNeg_Delegate_fs`` compilation = compilation + |> withLangVersionPreview |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -176,6 +181,7 @@ module CustomAttributes_Basic = [] let ``E_StructLayoutSequentialNeg_Interface_fs`` compilation = compilation + |> withLangVersionPreview |> verifyCompile |> shouldFail |> withDiagnostics [ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication01.fs index 987a8db16e6..a2d1b04eab5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication01.fs @@ -2,7 +2,7 @@ #light // FSB 1036, Assembly-level attributes attached to non-do bindings -//This attribute is not valid for use on this language element\. Assembly attributes should be attached to a 'do \(\)' declaration, if necessary within an F# module + [] let f = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication02.fs index 11b7e3b77d1..4d8eb3f403f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication02.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Attributes // Regression test for FSHARP1.0:1475 // F# attributes in prim-types.fs do not specify attribute targets -//The attribute type 'MeasureAttribute' has 'AllowMultiple=false'\. Multiple instances of this attribute cannot be attached to a single language element\.$ + [] [] type m diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication03.fs index f73f5ad8723..bd32c8cc6e7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication03.fs @@ -4,7 +4,7 @@ open System // FSharp1.0#1475: validate that an incorrect attribute application reports an error. -//This attribute is not valid for use on this language element + type TestType() = [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication04.fs index e16ad854335..2db59fa3dc7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication04.fs @@ -4,7 +4,7 @@ open System // FSharp1.0#1475: validate that an incorrect attribute application reports an error. -//This attribute is not valid for use on this language element + type TestType() = [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication06.fs index 5727ec89087..745e5e8b3fa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication06.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeApplication06.fs @@ -5,5 +5,7 @@ [] type A() = inherit System.Attribute() -let foo ( [] x ) = 1 in foo 2 + foo 3 +let foo ( [] x ) = 1 in foo 2 + foo 3 + +let foo2 ( [] x ) ( [] y ) = 1 in foo2 2 3 + foo2 4 5 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeTargetSpecifications.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeTargetSpecifications.fs index 2dbdf726f18..d04fea1556d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeTargetSpecifications.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_AttributeTargetSpecifications.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Attributes // Regression test for FSharp1.0:1089 - Support "module" and other attribute target specifications in parser -//Unrecognized attribute target\. Valid attribute targets are 'assembly', 'module', 'type', 'method', 'property', 'return', 'param', 'field', 'event', 'constructor' + #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_AbstractClass.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_AbstractClass.fs index 2b026e92ef4..ad68e248585 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_AbstractClass.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_AbstractClass.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Attributes // Regression: FSB 4014 -// Need to tighten up our imlementation of StructLayout.Sequential. +// Need to tighten up our implementation of StructLayout.Sequential. //Only structs and classes without primary constructors may be given the 'StructLayout' attribute$ module NegativeTests = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_DU1.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_DU1.fs index dfe51161810..76705f7590e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_DU1.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_DU1.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Attributes // Regression: FSB 4014 -// Need to tighten up our imlementation of StructLayout.Sequential. +// Need to tighten up our implementation of StructLayout.Sequential. //Only structs and classes without primary constructors may be given the 'StructLayout' attribute$ module NegativeTests = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_DU2.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_DU2.fs index 07ad7c1abab..2b261d1b884 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_DU2.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_DU2.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Attributes // Regression: FSB 4014 -// Need to tighten up our imlementation of StructLayout.Sequential. +// Need to tighten up our implementation of StructLayout.Sequential. //Only structs and classes without primary constructors may be given the 'StructLayout' attribute$ module NegativeTests = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_Delegate.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_Delegate.fs index a963d0de594..0e18c2cf330 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_Delegate.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_Delegate.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Attributes // Regression: FSB 4014 -// Need to tighten up our imlementation of StructLayout.Sequential. +// Need to tighten up our implementation of StructLayout.Sequential. //Only structs and classes without primary constructors may be given the 'StructLayout' attribute$ module NegativeTests = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_Interface.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_Interface.fs index 77c6f311dc4..3c6e0d79589 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_Interface.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/E_StructLayoutSequentialNeg_Interface.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Attributes // Regression: FSB 4014 -// Need to tighten up our imlementation of StructLayout.Sequential. +// Need to tighten up our implementation of StructLayout.Sequential. //Only structs and classes without primary constructors may be given the 'StructLayout' attribute$ module NegativeTests = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/StructLayoutSequentialPos_Exception.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/StructLayoutSequentialPos_Exception.fs index 277fed1f847..ab882a58561 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/StructLayoutSequentialPos_Exception.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/StructLayoutSequentialPos_Exception.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Attributes // Regression: FSB 4014 -// Need to tighten up our imlementation of StructLayout.Sequential. +// Need to tighten up our implementation of StructLayout.Sequential. module PositiveTests = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/TypeofTypedefofInAttribute.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/TypeofTypedefofInAttribute.fs index 0d23a3137f8..e4ac032b68a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/TypeofTypedefofInAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/TypeofTypedefofInAttribute.fs @@ -2,7 +2,7 @@ #light // FSB 3565, verify typeof<_> and typedefof<_> can be used in -// attributes. Also, verify that their behaivor is the same in +// attributes. Also, verify that their behavior is the same in // attributes as in normal usage. open System diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_ReturnType03b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_ReturnType03b.fs index 5fa46042bca..b6de23eaa7c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_ReturnType03b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_ReturnType03b.fs @@ -3,7 +3,7 @@ // F# supports custom attributes on return type. // Multiple attributes on the same return value (same attribute repeated twice) not allowed by default (AllowMultiple is false) // Note: the syntax is kind of awkward... -//The attribute type 'CA1' has 'AllowMultiple=false'\. Multiple instances of this attribute cannot be attached to a single language element\.$ + type CA1 = class diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutExplicit01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutExplicit01.fs index 8f8f7e81905..c113f274609 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutExplicit01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutExplicit01.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Attributes -// FSB 3573: Add unveriofiability warning for StructLayout: ICE when you set Explicit struct layout but don't provide offsets for each field -//Uses of this construct may result in the generation of unverifiable \.NET IL code\. This warning can be disabled using '--nowarn:9' or '#nowarn "9"' +// FSB 3573: Add unverifiability warning for StructLayout: ICE when you set Explicit struct layout but don't provide offsets for each field + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutSequentialPos_AbstractClass.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutSequentialPos_AbstractClass.fs index 3ff802beb24..e0ff2033779 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutSequentialPos_AbstractClass.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutSequentialPos_AbstractClass.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Attributes // Regression: FSB 4014 -// Need to tighten up our imlementation of StructLayout.Sequential. +// Need to tighten up our implementation of StructLayout.Sequential. module PositiveTests = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutSequentialPos_ClassExpliCtr.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutSequentialPos_ClassExpliCtr.fs index f25dae1229e..bbe7431b03c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutSequentialPos_ClassExpliCtr.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutSequentialPos_ClassExpliCtr.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Attributes // Regression: FSB 4014 -// Need to tighten up our imlementation of StructLayout.Sequential. +// Need to tighten up our implementation of StructLayout.Sequential. module PositiveTests = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutSequentialPos_ClassnoCtr.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutSequentialPos_ClassnoCtr.fs index ec6074499ae..2ff9efdcac4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutSequentialPos_ClassnoCtr.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutSequentialPos_ClassnoCtr.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Attributes // Regression: FSB 4014 -// Need to tighten up our imlementation of StructLayout.Sequential. +// Need to tighten up our implementation of StructLayout.Sequential. module PositiveTests = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutSequentialPos_Record.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutSequentialPos_Record.fs index c566ed1c69c..8085cf2ed70 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutSequentialPos_Record.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/W_StructLayoutSequentialPos_Record.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #Attributes // Regression: FSB 4014 -// Need to tighten up our imlementation of StructLayout.Sequential. +// Need to tighten up our implementation of StructLayout.Sequential. module PositiveTests = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_InvalidSignature02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_InvalidSignature02.fs index fee3d25c56f..15d9f361dc3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_InvalidSignature02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_InvalidSignature02.fs @@ -4,7 +4,7 @@ // Verify error when signature for the [] doesn't // match expected. -// + [] let main (args : string[]) = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_invalidsignature001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_invalidsignature001.fs index 2fee1a8881b..bda3e297737 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_invalidsignature001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_invalidsignature001.fs @@ -1,8 +1,8 @@ // #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1793 -// Explicit program entry point: [] +// Explicit program entry point: [] // Function does not have type string [] -> unit -// + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_oninvalidlanguageelement001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_oninvalidlanguageelement001.fs index 7c387aeed65..8a478ee193f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_oninvalidlanguageelement001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_oninvalidlanguageelement001.fs @@ -1,8 +1,8 @@ // #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 - FSHARP1.0:3783 -// Explicit program entry point: [] +// Explicit program entry point: [] // attribute on invalid language element (error) -//This attribute is not valid for use on this language element + #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twoattributesonsamefunction001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twoattributesonsamefunction001.fs index 1508a47dd3c..fd41f0135fa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twoattributesonsamefunction001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twoattributesonsamefunction001.fs @@ -1,8 +1,8 @@ // #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1793 -// Explicit program entry point: [] +// Explicit program entry point: [] // Two attributes same function (compile with --all-warnings-as-errors to make sure we are totally silent) -//The attribute type 'EntryPointAttribute' has 'AllowMultiple=false'\. Multiple instances of this attribute cannot be attached to a single language element\.$ + module M = let func (args : string[]) = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twoentrypoints001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twoentrypoints001.fs index ab5028ccc8a..aaad0c1779a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twoentrypoints001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twoentrypoints001.fs @@ -1,9 +1,9 @@ // #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 -// Explicit program entry point: [] +// Explicit program entry point: [] // attribute on multiple functions //Hello -//A function labeled with the 'EntryPointAttribute' attribute must be the last declaration in the last file in the compilation sequence. + #light module M = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twofiles_002a.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twofiles_002a.fs index 207af0d529b..fa9d09fac4a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twofiles_002a.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twofiles_002a.fs @@ -1,6 +1,6 @@ // #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 -// Explicit program entry point: [] +// Explicit program entry point: [] // Attribute is last declaration on first file module M diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twofiles_002b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twofiles_002b.fs index bafbd8f597c..3e0a986f4f4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twofiles_002b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/E_twofiles_002b.fs @@ -1,9 +1,9 @@ // #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 -// Explicit program entry point: [] +// Explicit program entry point: [] // Attribute is last declaration on first file //Hello -//A function labeled with the 'EntryPointAttribute' attribute must be the last declaration in the last file in the compilation sequence. + module TestModule [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/EntryPoint.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/EntryPoint.fs index 509fe8c9adb..ce51bcf6c14 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/EntryPoint.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/EntryPoint.fs @@ -51,7 +51,7 @@ module EntryPoint = |> compile |> shouldFail |> withDiagnostics [ - (Error 433, Line 18, Col 5, Line 19, Col 19, "A function labeled with the 'EntryPointAttribute' attribute must be the last declaration in the last file in the compilation sequence.") + (Error 433, Line 19, Col 9, Line 19, Col 14, "A function labeled with the 'EntryPointAttribute' attribute must be the last declaration in the last file in the compilation sequence.") ] // SOURCE="E_twofiles_002b.fs E_twofiles_002a.fs" SCFLAGS="--test:ErrorRanges" # E_twofiles_002b/a diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointInLastModuleInsideMultipleNamespace.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointInLastModuleInsideMultipleNamespace.fs index 886bea8bee9..5f0ecb0aa25 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointInLastModuleInsideMultipleNamespace.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointInLastModuleInsideMultipleNamespace.fs @@ -2,7 +2,7 @@ // Empty program entry point warning // Lack of entry point produces warning with correct source location when compiled to *.exe // when multiple namespaces with multiple modules declared in source file -//Main module of program is empty: nothing will happen when it is run + #light namespace MyNamespace1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointModuleInNamespace.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointModuleInNamespace.fs index ceaaceef2d3..1583ae0a70c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointModuleInNamespace.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointModuleInNamespace.fs @@ -2,7 +2,7 @@ // Empty program entry point warning // Lack of entry point produces warning with correct source location when compiled to *.exe // when single module declared inside namespace -//Main module of program is empty: nothing will happen when it is run + #light namespace MyNamespace1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointMultipleModules.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointMultipleModules.fs index f9f22900900..fdcb24fb866 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointMultipleModules.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointMultipleModules.fs @@ -2,7 +2,7 @@ // Empty program entry point warning // Lack of entry point produces warning with correct source location when compiled to *.exe // when multiple modules declared without declaring namespace -//Main module of program is empty: nothing will happen when it is run + #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointTypeInNamespace.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointTypeInNamespace.fs index d83961f2101..2be0ddb9d36 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointTypeInNamespace.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/W_NoEntryPointTypeInNamespace.fs @@ -2,7 +2,7 @@ // Empty program entry point warning // Lack of entry point produces warning with correct source location when compiled to *.exe // when source file declares type inside namespace -//Main module of program is empty: nothing will happen when it is run + #light namespace MyNamespace1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/behavior001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/behavior001.fs index 1bbaa34c252..416520c7cc8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/behavior001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/behavior001.fs @@ -1,6 +1,6 @@ // #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 -// Explicit program entry point: [] +// Explicit program entry point: [] // Verify that static initializers are invoked before entering the 'main' function // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointandFSI.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointandFSI.fs index a8f28497cd8..03e2ff1b57d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointandFSI.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointandFSI.fs @@ -1,6 +1,6 @@ // #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:2209 - existence of this attribute should not confuse FSI -// Explicit program entry point: [] +// Explicit program entry point: [] // #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointandFSI02.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointandFSI02.fsx index 535ab9aa2f4..cf1de1d8d88 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointandFSI02.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointandFSI02.fsx @@ -1,6 +1,6 @@ // #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:2209 - existence of this attribute should not confuse FSI -// Explicit program entry point: [] +// Explicit program entry point: [] // module M = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointfunctionnotmain001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointfunctionnotmain001.fs index 5d5659a9022..0a01df0be8a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointfunctionnotmain001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/entrypointfunctionnotmain001.fs @@ -1,6 +1,6 @@ // #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1793 -// Explicit program entry point: [] +// Explicit program entry point: [] // Entry point function does not have to be called 'main' // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/inamodule001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/inamodule001.fs index 71070cb0266..dff5b47531e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/inamodule001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/inamodule001.fs @@ -1,6 +1,6 @@ // #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 -// Explicit program entry point: [] +// Explicit program entry point: [] // 'main' function is in a module //Hello // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/noarguments001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/noarguments001.fs index 08b4ef60cf4..c5353b0601e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/noarguments001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/noarguments001.fs @@ -1,6 +1,6 @@ // #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 -// Explicit program entry point: [] +// Explicit program entry point: [] // 'main' function invoked with no arguments // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/oneargument001.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/oneargument001.fs index c50c8334ac8..b5e9907f9c2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/oneargument001.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/oneargument001.fs @@ -1,6 +1,6 @@ // #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 -// Explicit program entry point: [] +// Explicit program entry point: [] // 'main' function invoked with 1 argument //Hello // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/twofiles_001a.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/twofiles_001a.fs index 89db75bb9e2..9d4226980b4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/twofiles_001a.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/twofiles_001a.fs @@ -1,6 +1,6 @@ // #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 -// Explicit program entry point: [] +// Explicit program entry point: [] // 'main' function invoked with no arguments //Hello // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/twofiles_001b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/twofiles_001b.fs index 41a6d23c11d..2b5beb7c616 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/twofiles_001b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/twofiles_001b.fs @@ -1,6 +1,6 @@ // #Regression #NoMT #EntryPoint // Regression test for FSHARP1.0:1304 -// Explicit program entry point: [] +// Explicit program entry point: [] // 'main' function invoked with no arguments //Hello // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression01.fs index e812513f1c9..d9ed16a64fb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression01.fs @@ -11,67 +11,67 @@ type Action = | LeaveAlone // Sanity check events can be defined, fired, and all subscribers notified. -type SqueekyToy() = - let squeekEvent = new Event<_>() - let triggerSqueekEvent = squeekEvent.Trigger +type SqueakyToy() = + let squeakEvent = new Event<_>() + let triggerSqueakEvent = squeakEvent.Trigger - // This event fire whenever the squeeky toy squeeks - member this.Squeek with get () = squeekEvent + // This event fire whenever the squeaky toy squeaks + member this.Squeak with get () = squeakEvent member this.ApplyAction act = match act with - | Squeeze -> triggerSqueekEvent(act) - | Poke -> triggerSqueekEvent(act) + | Squeeze -> triggerSqueakEvent(act) + | Poke -> triggerSqueakEvent(act) | LeaveAlone -> () // Test events let test() = // Nothing wired up... - let mutable pinkSqueekyToy = new SqueekyToy() + let mutable pinkSqueakyToy = new SqueakyToy() // Hook up event handler, so when the event fires // m_eventFlag is set to whatever the param was. let mutable m_eventFlag1 = None let eventHandler1 = new Handler (fun (_ : obj) (arg : Action) -> m_eventFlag1 <- Some(arg)) - pinkSqueekyToy.Squeek.Publish.AddHandler(eventHandler1) + pinkSqueakyToy.Squeak.Publish.AddHandler(eventHandler1) - // Poke the toy, which should cause it to squeek + // Poke the toy, which should cause it to squeak m_eventFlag1 <- None - pinkSqueekyToy.ApplyAction(Poke) + pinkSqueakyToy.ApplyAction(Poke) if m_eventFlag1 <> Some(Poke) then failwith "Failed: 1" // Now add another event handler let mutable m_eventFlag2 = None let eventHandler2 = new Handler (fun _ act -> m_eventFlag2 <- Some(act)) - pinkSqueekyToy.Squeek.Publish.AddHandler(eventHandler2) + pinkSqueakyToy.Squeak.Publish.AddHandler(eventHandler2) // Now squeeze the toy, verifying that both event handlers // were called. m_eventFlag1 <- None m_eventFlag2 <- None - pinkSqueekyToy.ApplyAction(Squeeze) + pinkSqueakyToy.ApplyAction(Squeeze) if m_eventFlag1 <> Some(Squeeze) then failwith "Failed: 2" if m_eventFlag2 <> Some(Squeeze) then failwith "Failed: 3" // Remove one of the event handlers - pinkSqueekyToy.Squeek.Publish.RemoveHandler(eventHandler1) + pinkSqueakyToy.Squeak.Publish.RemoveHandler(eventHandler1) m_eventFlag1 <- None m_eventFlag2 <- None // Event handler 1 should not have fired. - pinkSqueekyToy.ApplyAction(Squeeze) + pinkSqueakyToy.ApplyAction(Squeeze) if m_eventFlag1 <> None then failwith "Failed: 4" if m_eventFlag2 <> Some(Squeeze) then failwith "Failed: 5" // Remove the last event handler - pinkSqueekyToy.Squeek.Publish.RemoveHandler(eventHandler2) + pinkSqueakyToy.Squeak.Publish.RemoveHandler(eventHandler2) m_eventFlag1 <- None m_eventFlag2 <- None // Event handler 1 should not have fired. - pinkSqueekyToy.ApplyAction(Squeeze) + pinkSqueakyToy.ApplyAction(Squeeze) if m_eventFlag1 <> None then failwith "Failed: 6" if m_eventFlag2 <> None then failwith "Failed: 7" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression03.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression03.fsx index 6166c950d02..90d81d3a006 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression03.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Regression03.fsx @@ -15,8 +15,8 @@ let btn = new System.Windows.Forms.Button() let mutable counter = 0 let evt = btn.Click |> Observable.map(fun x -> counter <- counter + 1) -let unsubsribe = evt.Subscribe(fun x -> printfn "%A" x) -unsubsribe.Dispose() +let unsubscribe = evt.Subscribe(fun x -> printfn "%A" x) +unsubscribe.Dispose() btn.PerformClick() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/SanityCheck.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/SanityCheck.fs index bf13e5ff97d..354bcd50dd2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/SanityCheck.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/SanityCheck.fs @@ -6,68 +6,68 @@ type Action = | LeaveAlone // Sanity check events can be defined, fired, and all subscribers notified. -type SqueekyToy() = - let squeekEvent = new Event<_>() - let triggerSqueekEvent = squeekEvent.Trigger +type SqueakyToy() = + let squeakEvent = new Event<_>() + let triggerSqueakEvent = squeakEvent.Trigger - // This event fire whenever the squeeky toy squeeks - member this.Squeek with get () = squeekEvent + // This event fire whenever the squeaky toy squeaks + member this.Squeak with get () = squeakEvent member this.ApplyAction act = match act with - | Squeeze -> triggerSqueekEvent(act) - | Poke -> triggerSqueekEvent(act) + | Squeeze -> triggerSqueakEvent(act) + | Poke -> triggerSqueakEvent(act) | LeaveAlone -> () // Test events // Nothing wired up... -let pinkSqueekyToy = new SqueekyToy() -pinkSqueekyToy.ApplyAction(Squeeze) +let pinkSqueakyToy = new SqueakyToy() +pinkSqueakyToy.ApplyAction(Squeeze) // Hook up event handler, so when the event fires // m_eventFlag is set to whatever the param was. let mutable m_eventFlag1 : Action option = None let eventHandler1 = new Handler (fun (_ : obj) (arg : Action) -> m_eventFlag1 <- Some(arg)) -pinkSqueekyToy.Squeek.Publish.AddHandler(eventHandler1) +pinkSqueakyToy.Squeak.Publish.AddHandler(eventHandler1) -// Poke the toy, which should cause it to squeek +// Poke the toy, which should cause it to squeak m_eventFlag1 <- None -pinkSqueekyToy.ApplyAction(Poke) +pinkSqueakyToy.ApplyAction(Poke) if m_eventFlag1 <> Some(Poke) then failwith "Failed: 1" // Now add another event handler let mutable m_eventFlag2 : Action option = None let eventHandler2 = new Handler (fun _ act -> m_eventFlag2 <- Some(act)) -pinkSqueekyToy.Squeek.Publish.AddHandler(eventHandler2) +pinkSqueakyToy.Squeak.Publish.AddHandler(eventHandler2) // Now squeeze the toy, verifying that both event handlers // were called. m_eventFlag1 <- None m_eventFlag2 <- None -pinkSqueekyToy.ApplyAction(Squeeze) +pinkSqueakyToy.ApplyAction(Squeeze) if m_eventFlag1 <> Some(Squeeze) then failwith "Failed: 2" if m_eventFlag2 <> Some(Squeeze) then failwith "Failed: 3" // Remove one of the event handlers -pinkSqueekyToy.Squeek.Publish.RemoveHandler(eventHandler1) +pinkSqueakyToy.Squeak.Publish.RemoveHandler(eventHandler1) m_eventFlag1 <- None m_eventFlag2 <- None // Event handler 1 should not have fired. -pinkSqueekyToy.ApplyAction(Squeeze) +pinkSqueakyToy.ApplyAction(Squeeze) if m_eventFlag1 <> None then failwith "Failed: 4" if m_eventFlag2 <> Some(Squeeze) then failwith "Failed: 5" // Remove the last event handler -pinkSqueekyToy.Squeek.Publish.RemoveHandler(eventHandler2) +pinkSqueakyToy.Squeak.Publish.RemoveHandler(eventHandler2) m_eventFlag1 <- None m_eventFlag2 <- None // Event handler 1 should not have fired. -pinkSqueekyToy.ApplyAction(Squeeze) +pinkSqueakyToy.ApplyAction(Squeeze) if m_eventFlag1 <> None then failwith "Failed: 6" if m_eventFlag2 <> None then failwith "Failed: 7" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_Abbreviation_NonMatchingObjConstructor.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_Abbreviation_NonMatchingObjConstructor.fsx index 9708c1cb070..1ed53c64260 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_Abbreviation_NonMatchingObjConstructor.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_Abbreviation_NonMatchingObjConstructor.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Exceptions // Exception type - incorrect abbreviation -//Abbreviations for Common IL exception types must have a matching object constructor + // F# exception definition + abbreviation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_AssertionFailureExn.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_AssertionFailureExn.fs index f3453252c3b..de4c8c08253 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_AssertionFailureExn.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_AssertionFailureExn.fs @@ -2,7 +2,7 @@ // Regression test for FSharp1.0:3583 - Remove AssertionFailureException -//The type 'AssertionFailureException' is not defined + let foo = try diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_BeginWithUppercase01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_BeginWithUppercase01.fsx index 3f70d6fdb7b..11406618e0b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_BeginWithUppercase01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_BeginWithUppercase01.fsx @@ -1,8 +1,8 @@ // #Regression #Conformance #TypesAndModules #Exceptions // Exception types // Exception labels must begin with an uppercase letter -//Discriminated union cases and exception labels must be uppercase identifiers -//Discriminated union cases and exception labels must be uppercase identifiers + + #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_BeginWithUppercase02.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_BeginWithUppercase02.fsx index 3b9ba374668..58a6138795d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_BeginWithUppercase02.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_BeginWithUppercase02.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Exceptions // Exception types // Exception labels must begin with an uppercase letter -//Unexpected integer literal in exception definition\. Expected identifier or other token + #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_BeginWithUppercase03.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_BeginWithUppercase03.fsx index b645e15ab48..f58b7d66d78 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_BeginWithUppercase03.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_BeginWithUppercase03.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Exceptions // Exception types // Exception labels must begin with an uppercase letter -//Unexpected string literal in exception definition\. Expected identifier or other token + #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_BeginWithUppercase04.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_BeginWithUppercase04.fsx index 2fd0f621f9c..15a4f7ea114 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_BeginWithUppercase04.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_BeginWithUppercase04.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Exceptions // Exception types // Exception labels must begin with an uppercase letter -//Unexpected reserved keyword in exception definition\. Expected identifier or other token + #light exception ``null diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_ExnAsDiscriminatedUnion01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_ExnAsDiscriminatedUnion01.fsx index 7e8ad2eabd8..468d44a4efc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_ExnAsDiscriminatedUnion01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_ExnAsDiscriminatedUnion01.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Exceptions // Exception definition define new discriminated union cases // Verify that we cannot use "sig-spec" when defining an exception -//Unexpected symbol ':' in implementation file + #light // This is the corresponding case for DU (deprecated, but ok) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_ExnConstructorBadFieldName.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_ExnConstructorBadFieldName.fs index 640fc4a532b..fc6d75ea9c0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_ExnConstructorBadFieldName.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_ExnConstructorBadFieldName.fs @@ -1,7 +1,7 @@ // #Conformance #TypesAndModules #Exceptions // Make sure we properly detect bogus named field in constructors -//The exception 'AAA' does not have a field named 'V3'\. -//The exception 'AAA' does not have a field named 'V3'\. + + exception AAA of V1 : int * V2 : string diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_ExnFieldConflictingName.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_ExnFieldConflictingName.fs index db51a6e7dda..5e445f9e573 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_ExnFieldConflictingName.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_ExnFieldConflictingName.fs @@ -1,8 +1,10 @@ // #Conformance #TypesAndModules #Exception // Make sure we properly detect field naming collisions -//Named field 'Data1' conflicts with autogenerated name for anonymous field\. -//Named field 'A' is used more than once\. + + exception AAA of Data1 : int * string -exception BBB of A : int * A : string \ No newline at end of file +exception BBB of A : int * A : string + +exception CCC of A : int * A : string * A : int \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_FieldMemberClash.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_FieldMemberClash.fs index 7298a68ac0f..0c1f7a3f959 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_FieldMemberClash.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_FieldMemberClash.fs @@ -1,8 +1,8 @@ // #Conformance #TypesAndModules #Exception // Make sure we properly detect when field names collide with member names -//The member 'Data0' can not be defined because the name 'Data0' clashes with the field 'Data0' in this type or module -//The member 'Data1' can not be defined because the name 'Data1' clashes with the field 'Data1' in this type or module -//The member 'V3' can not be defined because the name 'V3' clashes with the field 'V3' in this type or module + + + exception AAA of int * string * V3 : float with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_FieldNameUsedMulti.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_FieldNameUsedMulti.fs index 312e8ae4637..dff3b979fdf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_FieldNameUsedMulti.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_FieldNameUsedMulti.fs @@ -1,7 +1,7 @@ // #Conformance #TypesAndModules #Exceptions // Make sure we properly detect field names specified multiple times -//Union case/exception field 'V1' cannot be used more than once\. -//Union case/exception field 'V2' cannot be used more than once\. + + exception AAA of V1 : int * V2 : string diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_GeneratedTypeNameClash02.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_GeneratedTypeNameClash02.fsx index ad37e1f9e8b..6a90bf8ba2f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_GeneratedTypeNameClash02.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_GeneratedTypeNameClash02.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Exceptions // An exception definition generates a type with name idException // In this case we check and see what happens when such a type already exist -//Duplicate definition of type, exception or module 'EException' + type EException = | E diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_InheritException.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_InheritException.fs index da42f8f0e3f..02b9d43e703 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_InheritException.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_InheritException.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Exceptions // Verify error when trying to inherit from F# exception types -//Cannot inherit a sealed type -//No constructors are available for the type 'FSharpExn' + + exception FSharpExn of int * string diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_MustStartWithCap01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_MustStartWithCap01.fs index 11495602e4f..22473a3a2e7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_MustStartWithCap01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/E_MustStartWithCap01.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Exceptions // Verify error if you try to start an exception definition with a lower case letter // Regression test for FSHARP1.0:2817 -//Discriminated union cases and exception labels must be uppercase identifiers + #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/ExceptionAsDerivedFromSystemException01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/ExceptionAsDerivedFromSystemException01.fsx index 69add3ebe37..abd223ab5d0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/ExceptionAsDerivedFromSystemException01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/ExceptionAsDerivedFromSystemException01.fsx @@ -1,6 +1,6 @@ // #Conformance #TypesAndModules #Exceptions // Exception values may be generated by defining and using classes that extends System.Exception -// In this test we verify that both defitions can be used interchangably +// In this test we verify that both definitions can be used interchangably // type E1(s) = class diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/ExceptionDefinitions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/ExceptionDefinitions.fs index 9e39ffa3233..fb7785d3758 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/ExceptionDefinitions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/ExceptionDefinitions.fs @@ -226,8 +226,10 @@ module ExceptionDefinition = |> compile |> shouldFail |> withDiagnostics [ - (Error 3176, Line 6, Col 18, Line 6, Col 23, "Named field 'Data1' conflicts with autogenerated name for anonymous field.") - (Error 3176, Line 8, Col 28, Line 8, Col 29, "Named field 'A' is used more than once.") + (Error 3176, Line 6, Col 18, Line 6, Col 23, "Named field 'Data1' conflicts with autogenerated name for anonymous field."); + (Error 3176, Line 8, Col 18, Line 8, Col 19, "Named field 'A' is used more than once."); + (Error 3176, Line 10, Col 18, Line 10, Col 19, "Named field 'A' is used more than once."); + (Error 3176, Line 10, Col 28, Line 10, Col 29, "Named field 'A' is used more than once.") ] // SOURCE=E_FieldNameUsedMulti.fs SCFLAGS="--test:ErrorRanges" # E_FieldNameUsedMulti.fs @@ -250,9 +252,9 @@ module ExceptionDefinition = |> compile |> shouldFail |> withDiagnostics [ - (Error 23, Line 9, Col 17, Line 9, Col 22, "The member 'Data0' can not be defined because the name 'Data0' clashes with the field 'Data0' in this type or module") - (Error 23, Line 10, Col 17, Line 10, Col 22, "The member 'Data1' can not be defined because the name 'Data1' clashes with the field 'Data1' in this type or module") - (Error 23, Line 11, Col 17, Line 11, Col 19, "The member 'V3' can not be defined because the name 'V3' clashes with the field 'V3' in this type or module") + (Error 23, Line 9, Col 17, Line 9, Col 22, "The member 'Data0' cannot be defined because the name 'Data0' clashes with the field 'Data0' in this type or module") + (Error 23, Line 10, Col 17, Line 10, Col 22, "The member 'Data1' cannot be defined because the name 'Data1' clashes with the field 'Data1' in this type or module") + (Error 23, Line 11, Col 17, Line 11, Col 19, "The member 'V3' cannot be defined because the name 'V3' clashes with the field 'V3' in this type or module") ] // SOURCE=E_GeneratedTypeName01.fsx SCFLAGS="--test:ErrorRanges" # E_GeneratedTypeName01.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/NamedFields01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/NamedFields01.fsx index 598851e43e7..f1978138ac7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/NamedFields01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/NamedFields01.fsx @@ -31,5 +31,5 @@ exception DDD of V1 : int with member this.Data0 = "" -// Message field name should not conflict with base System.Exeption.Message member +// Message field name should not conflict with base System.Exception.Message member exception EEE of Message : int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/Override01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/Override01.fsx index 1cb548bd737..fc851f61412 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/Override01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExceptionDefinitions/Override01.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Exceptions // Exception definition define new discriminated union cases // Verify that we can use misc types (notice that the "sig-spec" cannot be used [covered in another testcase] -// This is reqgression test for FSHARP1.0:3725 +// This is regression test for FSHARP1.0:3725 // [] type Kg diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/ExplicitObjectConstructors.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/ExplicitObjectConstructors.fs index 18af78f58c4..e61dacdbc26 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/ExplicitObjectConstructors.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/ExplicitObjectConstructors.fs @@ -18,7 +18,7 @@ module ExplicitObjectConstructors = |> ignore // This test was automatically generated (moved from FSharpQA suite - Conformance/ClassTypes/ExplicitObjectConstructors) - //Message2 + [] let ``WithAttribute01_fs`` compilation = compilation @@ -31,7 +31,7 @@ module ExplicitObjectConstructors = |> ignore // This test was automatically generated (moved from FSharpQA suite - Conformance/ClassTypes/ExplicitObjectConstructors) - //Message1 + [] let ``WithAttribute02_fs`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/WithAttribute01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/WithAttribute01.fs index 18e93d2a9e0..63f76a63d48 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/WithAttribute01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/WithAttribute01.fs @@ -1,9 +1,9 @@ // #Regression #Conformance #ObjectOrientedTypes #Classes #ObjectConstructors // Regression test for FSHARP1.0:4212 // Attribute is placed on both the explicit and the implicit constructors -//Message2 -//Message3 -//Message2 + + + module M // explicit syntax type Foo [] (x:int) = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/WithAttribute02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/WithAttribute02.fs index 84e02e9947f..74542e14b75 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/WithAttribute02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ExplicitObjectConstructors/WithAttribute02.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #ObjectOrientedTypes #Classes #ObjectConstructors // Regression test for FSHARP1.0:4212 // Attribute is placed on the explicit constructor only -//Message1 + module M // explicit syntax type Foo (x:int) = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/E_StaticField01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/E_StaticField01.fs index 0086745694c..67af4cd259a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/E_StaticField01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/E_StaticField01.fs @@ -8,6 +8,6 @@ type Foo() = class [] - static val thingey : int + static val thingy : int end diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/FieldMembers.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/FieldMembers.fs index 138cf45e723..70e859d8da6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/FieldMembers.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/FieldMembers.fs @@ -34,8 +34,8 @@ module FieldMembers = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 880, Line 11, Col 20, Line 11, Col 27, "Uninitialized 'val' fields must be mutable and marked with the '[]' attribute. Consider using a 'let' binding instead of a 'val' field.") - (Error 881, Line 11, Col 20, Line 11, Col 27, "Static 'val' fields in types must be mutable, private and marked with the '[]' attribute. They are initialized to the 'null' or 'zero' value for their type. Consider also using a 'static let mutable' binding in a class type.") + (Error 880, Line 11, Col 20, Line 11, Col 26, "Uninitialized 'val' fields must be mutable and marked with the '[]' attribute. Consider using a 'let' binding instead of a 'val' field.") + (Error 881, Line 11, Col 20, Line 11, Col 26, "Static 'val' fields in types must be mutable, private and marked with the '[]' attribute. They are initialized to the 'null' or 'zero' value for their type. Consider also using a 'static let mutable' binding in a class type.") ] // SOURCE=E_StaticField02a.fs # E_StaticField02a.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImplicitObjectConstructors/ImplicitObjectConstructors.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImplicitObjectConstructors/ImplicitObjectConstructors.fs index 168451ca348..3e4eebe7de1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImplicitObjectConstructors/ImplicitObjectConstructors.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImplicitObjectConstructors/ImplicitObjectConstructors.fs @@ -9,7 +9,7 @@ open FSharp.Test.Compiler module ImplicitObjectConstructors = // This test was automatically generated (moved from FSharpQA suite - Conformance/ClassTypes/ImplicitObjectConstructors) - //Message1 + [] let ``WithAttribute_fs`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImplicitObjectConstructors/WithAttribute.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImplicitObjectConstructors/WithAttribute.fs index 3728618ecf0..6cf6470bc46 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImplicitObjectConstructors/WithAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImplicitObjectConstructors/WithAttribute.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #ObjectOrientedTypes #Classes #ObjectConstructors // Regression test for FSHARP1.0:4212 -//Message1 + module M // implicit syntax type Foo1 [] () = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_OpenUnknownNS.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_OpenUnknownNS.fs index dfffde1803d..0918c893f04 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_OpenUnknownNS.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/E_OpenUnknownNS.fs @@ -2,7 +2,7 @@ #light // Verify error when opening an unknown module or namespace -//The namespace or module 'SomeUnknownNamespace' is not defined + open SomeUnknownNamespace.SomeUnknownModule diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/W_OpenUnqualifiedNamespace01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/W_OpenUnqualifiedNamespace01.fs index bf590bdc800..af215b3d668 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/W_OpenUnqualifiedNamespace01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/W_OpenUnqualifiedNamespace01.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #DeclarationElements #Import // Verify warning when opening a non-fully qualified namespace -//This declaration opens the namespace or module 'System\.Collections\.Generic' through a partially qualified path\. Adjust this code to use the full path of the namespace\. This change will make your code more robust as new constructs are added to the F# and CLI libraries\.$ -//This declaration opens the namespace or module 'System\.Collections\.Generic' through a partially qualified path\. Adjust this code to use the full path of the namespace\. This change will make your code more robust as new constructs are added to the F# and CLI libraries\.$ + + open System.Collections open Generic diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/InterfaceSpecificationsAndImplementations/ConcreteUnitOnInterface01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/InterfaceSpecificationsAndImplementations/ConcreteUnitOnInterface01.fs index 18e47a3ef8a..bc79c1c539e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/InterfaceSpecificationsAndImplementations/ConcreteUnitOnInterface01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/InterfaceSpecificationsAndImplementations/ConcreteUnitOnInterface01.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #DeclarationElements #InterfacesAndImplementations #light -// FS1 2504, Generic interface instatiated with unit +// FS1 2504, Generic interface instantiated with unit type IT<'state> = abstract Init: 'state -> unit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ActivePatternBindings/parameterizedActivePattern.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ActivePatternBindings/parameterizedActivePattern.fs index 0af04735146..3fd995a52e6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ActivePatternBindings/parameterizedActivePattern.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ActivePatternBindings/parameterizedActivePattern.fs @@ -3,7 +3,7 @@ let (|MulN|_|) (n:int) (inp:int) = if inp % 3 = 0 then Some(inp/n) else None -// Verify it works as exected. +// Verify it works as excepted. let posCase = match 30 with | MulN 10 result -> if result <> 3 then failwith "Failed: 1" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_AttributesOnLet01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_AttributesOnLet01.fs index 378d694328c..c7dfe001b95 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_AttributesOnLet01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_AttributesOnLet01.fs @@ -4,10 +4,10 @@ // Regression test for FSharp1.0:3744 - Unable to apply attributes on individual patterns in a tupled pattern match let binding - Implementation doesn't match spec // Test against error emitted when attributes applied within pattern -//Attributes are not allowed within patterns -//This attribute is not valid for use on this language element -//Attributes are not allowed within patterns -//This attribute is not valid for use on this language element + + + + open System diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_ErrorsForInlineValue.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_ErrorsForInlineValue.fs index 41905b59974..4d6507bb674 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_ErrorsForInlineValue.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_ErrorsForInlineValue.fs @@ -3,8 +3,8 @@ // Regression test for FSharp1.0:4165 // Sweep all deprecation warnings and change to errors where reasonable [WAS: Inline values should be an error, not a warning] -//Only functions may be marked 'inline' -//Only functions may be marked 'inline' + + let inline inc = (+) 1;; diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_GenericTypeAnnotations01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_GenericTypeAnnotations01.fs index 44bb3497817..b116b7c63ac 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_GenericTypeAnnotations01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_GenericTypeAnnotations01.fs @@ -2,6 +2,6 @@ #light // Regression test for FSharp1.0:1943 - Better error message when unknown unicode characters are used - in particular the � character -//Unexpected reserved keyword in pattern + let foo(x : `a) = ([] : `a list) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological01.fs index 63d4b876ce5..d52bad34237 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological01.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #DeclarationElements #LetBindings // Interesting pathological tests // The code is odd. It used to parse, but not it is an error. See FSHARP1.0:4980, test since updated for triple quoted string support -//End of file in triple-quote string begun at or before here + let f _ _ _ _ _ _ _ _ _ _ = () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological03.fs index 4e80d65f54b..42555f70332 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological03.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #DeclarationElements #LetBindings // Interesting pathological tests // The code is odd. It used to parse, but not it is an error. See FSHARP1.0:4980, test since updated for triple quoted string support -//End of file in string begun at or before here + let f _ _ _ _ _ _ _ _ _ _ = () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological05.fs index 7bce94da4c0..7b796ab9b79 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological05.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #DeclarationElements #LetBindings // Interesting pathological tests // The code is odd. It used to parse, but not it is an error. See FSHARP1.0:4980, since updated for triple quoted string support -//End of file in verbatim string begun at or before here + let f _ _ _ _ _ _ _ _ _ _ = () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological06.fs index 8d5016ddfb7..24252b70ba2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological06.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/E_Pathological06.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #DeclarationElements #LetBindings // Interesting pathological tests // The code is odd. It used to parse, but not it is an error. See FSHARP1.0:4980, since updated for triple quote strings -//End of file in triple-quote string begun at or before here + let f _ _ _ _ _ _ _ _ _ _ = () diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/SanityCheck.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/SanityCheck.fs index a678fbaf4b5..88b14b7d9a7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/SanityCheck.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/SanityCheck.fs @@ -13,7 +13,7 @@ let _ = factorial 2 * factorial 2 let (f1,f2,f3,f4) = factorial 1, factorial 2, factorial 3, factorial 4 if f4 <> 4 * 3 * 2 then failwith "Failed: 1" -do factorial 10 |> ignore; printfn "Do statements"; printfn "Seperated by semicolons" +do factorial 10 |> ignore; printfn "Do statements"; printfn "Separated by semicolons" let mutable x = 10 x <- f x x @@ -21,7 +21,7 @@ if x <> 100 then failwith "Failed: 2" // function which takes one arg of unit // returning a function taking and returning an int -let somefuntion (arg : unit) : int -> int = +let somefunction_ (arg : unit) : int -> int = let nestedfunction1 x y z = let nestedfunction2 x y = let nestedfunction3 x y z = @@ -32,5 +32,5 @@ let somefuntion (arg : unit) : int -> int = let curriedNF3_2 = curriedNF3 20 curriedNF3_2 -if (somefuntion ()) 30 <> 60 then failwith "Failed: 3" +if (somefunction_ ()) 30 <> 60 then failwith "Failed: 3" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/W_DoBindingsNotUnit01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/W_DoBindingsNotUnit01.fs index 9e6b0df342b..2d530b5d860 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/W_DoBindingsNotUnit01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/W_DoBindingsNotUnit01.fs @@ -2,7 +2,7 @@ #light // Verify warning when 'do-bindings' do not return unit. -//The result of this expression has type 'int' and is implicitly ignored + let square x = x * x diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ExplicitTypeParameters/W_TypeParamsWhenNotNeeded.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ExplicitTypeParameters/W_TypeParamsWhenNotNeeded.fs index f39af26eb9c..7f5d7476b76 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ExplicitTypeParameters/W_TypeParamsWhenNotNeeded.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/ExplicitTypeParameters/W_TypeParamsWhenNotNeeded.fs @@ -2,7 +2,7 @@ // Verify warning when providing explicit type parameters when // the function is defined without them. -//The method or function 'f' should not be given explicit type argument\(s\) because it does not declare its type parameters explicitly + let f x y = (x, y) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_NoTypeFuncsInTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_NoTypeFuncsInTypes.fs index 25a09f247ec..240c0df186d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_NoTypeFuncsInTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_NoTypeFuncsInTypes.fs @@ -1,6 +1,7 @@ // #Regression #Conformance #DeclarationElements #LetBindings #TypeTests -// Verify error asssociated with putting type functions inside types -//A property cannot have explicit type parameters\. Consider using a method instead\.$ +// Verify error associated with putting type functions inside types + type Foo() = member this.TypeFunc<'a> = typeof<'a>.Name + member this.TypeFunc2<'a, 'b> = typeof<'a>.Name diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_typeof_measure_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_typeof_measure_01.fs index ab442fc8a9b..1aa85f5cead 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_typeof_measure_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_typeof_measure_01.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #DeclarationElements #LetBindings #TypeTests // Regression test for FSHARP1.0:2320 // A is a measure -//Expected type, not unit-of-measure + #light [] type A diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_typeof_undefined_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_typeof_undefined_01.fs index 61684c8730e..b1b1f9fa23d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_typeof_undefined_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/E_typeof_undefined_01.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #DeclarationElements #LetBindings #TypeTests // Regression test for FSHARP1.0:2320 // A is an not defined -//This type requires a definition + #light type A diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/TypeFunctions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/TypeFunctions.fs index 66e2276a0be..3754e59055c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/TypeFunctions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/TypeFunctions/TypeFunctions.fs @@ -36,7 +36,7 @@ module LetBindings_TypeFunctions = |> verifyCompileAndRun |> shouldSucceed - //Expected type, not unit-of-measure + [] let ``E_typeof_measure_01_fs`` compilation = compilation @@ -55,10 +55,11 @@ module LetBindings_TypeFunctions = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 671, Line 6, Col 12, Line 6, Col 29, "A property cannot have explicit type parameters. Consider using a method instead.") + (Error 671, Line 6, Col 26, Line 6, Col 28, "A property cannot have explicit type parameters. Consider using a method instead."); + (Error 671, Line 7, Col 27, Line 7, Col 33, "A property cannot have explicit type parameters. Consider using a method instead.") ] - //This type requires a definition + [] let ``E_typeof_undefined_01_fs`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/AutoPropsWithModifierBeforeGetSet.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/AutoPropsWithModifierBeforeGetSet.fs new file mode 100644 index 00000000000..676746d96f5 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/AutoPropsWithModifierBeforeGetSet.fs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +module Conformance.BasicGrammarElements.AutoPropsWithModifierBeforeGetSet + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +let verifyCompile compilation = + compilation + |> asExe + |> withOptions ["--nowarn:988"] + |> compile + +let verifyCompileAndRun compilation = + compilation + |> asExe + |> withOptions ["--nowarn:988"] + |> compileAndRun + +[] +let ``Instance Properties Test`` () = + Fs """type InstancePropertiesTest() = + member val B1: int = 0 with get + // should fail + member val B2: int = 0 with set + member val B3: int = 0 with get, set + member val B4: int = 0 with internal get + // should fail + member val B5: int = 0 with internal set + member val B6: int = 0 with internal get, internal set + member val B7: int = 0 with internal get, set + member val B8: int = 0 with get, internal set + // should fail + member val internal B11: int = 0 with internal get, set + // should fail + member val internal B12: int = 0 with internal get + // should fail + member val internal B13: int = 0 with internal set + member val internal B14: int = 0 with get, set + member val internal B15: int = 0 with get + // should fail + member val internal B16: int = 0 with set""" + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3135, Line 4, Col 33, Line 4, Col 36, "To indicate that this property can be set, use 'member val PropertyName = expr with get,set'.") + (Error 3135, Line 8, Col 42, Line 8, Col 45, "To indicate that this property can be set, use 'member val PropertyName = expr with get,set'.") + (Error 0558, Line 13, Col 43, Line 13, Col 51, "When the visibility for a property is specified, setting the visibility of the set or get method is not allowed.") + (Error 0558, Line 15, Col 43, Line 15, Col 51, "When the visibility for a property is specified, setting the visibility of the set or get method is not allowed.") + (Error 3135, Line 17, Col 52, Line 17, Col 55, "To indicate that this property can be set, use 'member val PropertyName = expr with get,set'.") + (Error 0558, Line 17, Col 43, Line 17, Col 51, "When the visibility for a property is specified, setting the visibility of the set or get method is not allowed.") + (Error 3135, Line 21, Col 43, Line 21, Col 46, "To indicate that this property can be set, use 'member val PropertyName = expr with get,set'.") + ] + +[] +let ``Static Properties Test`` () = + Fs """type StaticPropertiesTest() = + static member val B1: int = 0 with get + // should fail + static member val B2: int = 0 with set + static member val B3: int = 0 with get, set + static member val B4: int = 0 with internal get + // should fail + static member val B5: int = 0 with internal set + static member val B6: int = 0 with internal get, internal set + static member val B7: int = 0 with internal get, set + static member val B8: int = 0 with get, internal set + // should fail + static member val internal B11: int = 0 with internal get, set + // should fail + static member val internal B12: int = 0 with internal get + // should fail + static member val internal B13: int = 0 with internal set + static member val internal B14: int = 0 with get, set + static member val internal B15: int = 0 with get + // should fail + static member val internal B16: int = 0 with set""" + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3135, Line 4, Col 40, Line 4, Col 43, "To indicate that this property can be set, use 'member val PropertyName = expr with get,set'.") + (Error 3135, Line 8, Col 49, Line 8, Col 52, "To indicate that this property can be set, use 'member val PropertyName = expr with get,set'.") + (Error 0558, Line 13, Col 50, Line 13, Col 58, "When the visibility for a property is specified, setting the visibility of the set or get method is not allowed.") + (Error 0558, Line 15, Col 50, Line 15, Col 58, "When the visibility for a property is specified, setting the visibility of the set or get method is not allowed.") + (Error 3135, Line 17, Col 59, Line 17, Col 62, "To indicate that this property can be set, use 'member val PropertyName = expr with get,set'.") + (Error 0558, Line 17, Col 50, Line 17, Col 58, "When the visibility for a property is specified, setting the visibility of the set or get method is not allowed.") + (Error 3135, Line 21, Col 50, Line 21, Col 53, "To indicate that this property can be set, use 'member val PropertyName = expr with get,set'.") + ] + +[] +let ``Abstract Properties Test: access modifiers are not allowed`` () = + Fs """type ``Abstract Properties Test`` = + abstract member B1: int with get, set + abstract member B2: int with get + abstract member B3: int with set + // should fail + abstract member B4: int with internal get, set + // should fail + abstract member B5: int with get, internal set + // should fail + abstract member B6: int with internal get, internal set + // should fail + abstract member B7: int with internal get + // should fail + abstract member B8: int with internal set""" + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 0561, Line 6, Col 5, Line 6, Col 51, "Accessibility modifiers are not allowed on this member. Abstract slots always have the same visibility as the enclosing type.") + (Error 0561, Line 8, Col 5, Line 8, Col 51, "Accessibility modifiers are not allowed on this member. Abstract slots always have the same visibility as the enclosing type.") + (Error 0561, Line 10, Col 5, Line 10, Col 60, "Accessibility modifiers are not allowed on this member. Abstract slots always have the same visibility as the enclosing type.") + (Error 0561, Line 12, Col 5, Line 12, Col 46, "Accessibility modifiers are not allowed on this member. Abstract slots always have the same visibility as the enclosing type.") + (Error 0561, Line 14, Col 5, Line 14, Col 46, "Accessibility modifiers are not allowed on this member. Abstract slots always have the same visibility as the enclosing type.") + ] + +[] +let ``Signature File Test: no access modifiers before getter and setter`` () = + Fsi """module Program + +type A = + new: unit -> A + member internal B: int + member internal C: int with get, set + member D: int with internal get, private set + abstract E: int with get, set + abstract F: int with get, private set""" + |> withLangVersionPreview + |> verifyCompile + |> shouldFail + |> withDiagnostics [ + (Error 240, Line 1, Col 1, Line 9, Col 42, "The signature file 'Program' does not have a corresponding implementation file. If an implementation file exists then check the 'module' and 'namespace' declarations in the signature and implementation files match.") + ] + +[] +let ``Signature And Implement File Test`` () = + let encodeFs = + FsSource """module Program + +type A() = + member val B: int = 0 with internal get, internal set + member val C: int = 0 with internal get, internal set + member val D: int = 0 with internal get, private set + member val E: int = 0 with internal get, private set""" + Fsi """module Program + +type A = + new: unit -> A + member internal B: int + member internal C: int with get, set + member D: int with internal get, private set + member E: int with get, set""" + |> withAdditionalSourceFile encodeFs + |> withLangVersionPreview + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 0034, Line 7, Col 16, Line 7, Col 17, "Module 'Program' contains + member A.E: int with private set +but its signature specifies + member A.E: int with set +The accessibility specified in the signature is more than that specified in the implementation") + (Error 0034, Line 7, Col 16, Line 7, Col 17, "Module 'Program' contains + member A.E: int with internal get +but its signature specifies + member A.E: int with get +The accessibility specified in the signature is more than that specified in the implementation") + ] + +[] +let ``Cannot use in F# 8.0`` () = + let encodeFs = + FsSource """module Program + +type A() = + member val B: int = 0 with internal get + member _.C with internal set (v: int) = () + member val D: int = 0 with internal get, private set""" + Fsi """module Program + +type A = + new: unit -> A + member B: int with internal get + member C: int with internal set + member D: int with internal get, private set""" + |> withAdditionalSourceFile encodeFs + |> withLangVersion80 + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 3350, Line 5, Col 24, Line 5, Col 32, "Feature 'Allow access modifiers to auto properties getters and setters' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") + (Error 3350, Line 6, Col 24, Line 6, Col 32, "Feature 'Allow access modifiers to auto properties getters and setters' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") + (Error 3350, Line 7, Col 24, Line 7, Col 32, "Feature 'Allow access modifiers to auto properties getters and setters' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") + (Error 3350, Line 4, Col 32, Line 4, Col 40, "Feature 'Allow access modifiers to auto properties getters and setters' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") + (Error 3350, Line 6, Col 32, Line 6, Col 40, "Feature 'Allow access modifiers to auto properties getters and setters' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") + ] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractAndConcereteProp.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractAndConcreteProp.fs similarity index 62% rename from tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractAndConcereteProp.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractAndConcreteProp.fs index a457e1a67a6..7f6711b3230 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractAndConcereteProp.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractAndConcreteProp.fs @@ -2,7 +2,7 @@ // Verify error when you have a property with both an abstract and concrete component // Regression from FSB 4496 -//The property 'State' of type 'X' has a getter and a setter that do not match\. If one is abstract then the other must be as well\.$ + [] type X() = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractProperties02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractProperties02.fs index 10098a28a23..becb917dbdf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractProperties02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractProperties02.fs @@ -2,7 +2,7 @@ // Regression test for FSHARP1.0:4160 // ICE when trying to compile code with abstract properties // See also FSHARP1.0:3661 and 4981 -//The property 'A' of type 'T' has a getter and a setter that do not match\. If one is abstract then the other must be as well + type T = abstract A : int override x.A with get() = 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractProperties03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractProperties03.fs index 1cbafc417d6..71821325974 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractProperties03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_AbstractProperties03.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Regression test for FSHARP1.0:4265 - Disallow an abstract setter with concrete getter -//The property 'State' of type 'X' has a getter and a setter that do not match\. If one is abstract then the other must be as well + // See also FSHARP1.0:3661 and 4981 [] type X() = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_ActivePatternMember03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_ActivePatternMember03.fs new file mode 100644 index 00000000000..2a61a9bf3ef --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_ActivePatternMember03.fs @@ -0,0 +1,24 @@ +module APUsageInModule +let (|A|) = 6 +let (|A|B|) x = if x = "Foo" then A else B + +let (|A|B|_|) = None + +type APUsageInClass() = + + let (|A|) = 7 + + let (|A|B|) x = + if x = "Foo" then A + else B + + let (|A|B|_|) = None + + let (|A|B|) x = + if x = "Foo" then A + else B + + static member (|A|) = 7 + static member (|A|B|) = ValueNone + static member (|C|) = 5 + static member (|A|B|) x = A \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_DeclarePropertyTwice01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_DeclarePropertyTwice01.fs index 1d6e4fe347a..a101431ae35 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_DeclarePropertyTwice01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_DeclarePropertyTwice01.fs @@ -2,7 +2,7 @@ #light // Verify error if you declare a setter twice -//Duplicate definition of value 'Vector.set_Length.2' + type Vector3 = | Vector3 of float * float * float diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_DuplicateProperty01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_DuplicateProperty01.fs index 1aac4f9aea9..1c5fb053dcc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_DuplicateProperty01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_DuplicateProperty01.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Regression test for FSHARP1.0:2435 (ICE on duplicate property definitions.) // See also bug FSHARP1.0:4925 (this test will have to be updated once that bug is resolved) -//Duplicate method\. The method 'get_Property001' has the same name and signature as another method in type 'NM.ClassMembers' + module NM = type ClassMembers () = let mutable adjustableInstanceValue = "3" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerArityMismatch01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerArityMismatch01.fs index 2312290d362..fc9b29c1f83 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerArityMismatch01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerArityMismatch01.fs @@ -1,10 +1,10 @@ // #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Regression test for FSHARP1.0:1407 (Poor error message when arguments do not match signature of overloaded operator. Also incorrect span.) -//This expression was expected to have type. ''a\[,\]' .but here has type. 'int\[\]' -//This expression was expected to have type. ''a\[\]' .but here has type. 'int\[,\]' -//This expression was expected to have type. ''a\[\]' .but here has type. 'int\[,,\]' -//This expression was expected to have type. ''a\[\]' .but here has type. 'int\[,,,\]' + + + + let foo (arr : int[,]) = arr.[1,2] // ok diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerArityMismatch02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerArityMismatch02.fs index 5370f0c7c7e..6c23f7f2e7a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerArityMismatch02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerArityMismatch02.fs @@ -1,10 +1,10 @@ // #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Regression test for FSHARP1.0:1407 (Poor error message when arguments do not match signature of overloaded operator. Also incorrect span.) -//This expression was expected to have type. ''a\[,,\]' .but here has type. 'int\[\]' -//This expression was expected to have type. ''a\[\]' .but here has type. 'int\[,\]' -//This expression was expected to have type. ''a\[,,\]' .but here has type. 'int\[,,,\]' -//This expression was expected to have type. ''a\[,\]' .but here has type. 'int\[,,,]' + + + + let foo (arr : int[,]) = arr.[1,2] // ok diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerNotSpecified01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerNotSpecified01.fs index 07cfb3f2b06..e1a86f1fbd1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerNotSpecified01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_IndexerNotSpecified01.fs @@ -2,7 +2,7 @@ #light // Verify error if the type doesn't support an indexer -//The type 'Foo' does not define the field, constructor or member 'Item' + type Foo(x : int) = member this.Value = x diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_OutscopeThisPtr01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_OutscopeThisPtr01.fs index 86f514853e8..5215e303134 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_OutscopeThisPtr01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_OutscopeThisPtr01.fs @@ -2,7 +2,7 @@ #light // Regression test for FSHARP1.0:579 // Verify the ability to outscope the this pointer: it's an error! -//'this' is bound twice in this pattern + type Foo() = member this.Square this = this * this diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_Properties02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_Properties02.fs index 06e13920ce3..fec44ef0402 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_Properties02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_Properties02.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Setter declared using curried syntax // Expected: invalid declaration syntax -//Invalid declaration syntax + let mutable globalPt : obj = null type Pt = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_Properties06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_Properties06.fs index ecdcee92919..754458273c2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_Properties06.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_Properties06.fs @@ -2,7 +2,7 @@ // Regression test for FSHARP1.0:4163 // Setter with no arguments (curried or uncurried?) // Used to crash the compiler! -//This expression was expected to have type. 'unit' .but here has type. 'int' + //See FSHARP1.0:5456 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_SettersMustHaveUnit01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_SettersMustHaveUnit01.fs index 227d6997e3f..463c10e84a7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_SettersMustHaveUnit01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_SettersMustHaveUnit01.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Verify property setters must have type unit -//This expression was expected to have type + type immut = { diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_SettersMustHaveUnit02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_SettersMustHaveUnit02.fs index 3b2ca082bf2..109e40167bd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_SettersMustHaveUnit02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_SettersMustHaveUnit02.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // Verify error message when property setter doesn't return unit. -//This expression was expected to have type.*'unit'.*but here has type.*'string' + type Foo() = let mutable m_value = 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_UndefinedThisVariable02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_UndefinedThisVariable02.fs index 86548d853a0..ab651a9cb18 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_UndefinedThisVariable02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/E_UndefinedThisVariable02.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties // FSB 1007, internal error tripped by property member without this -//This instance member needs a parameter to represent the object being invoked + type DUType = | A diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Indexer01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Indexer01.fs index 38a3c472f17..425753e3ef4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Indexer01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/Indexer01.fs @@ -1,7 +1,7 @@ // #Conformance #DeclarationElements #MemberDefinitions #MethodsAndProperties #light -// Verify creating a propery named Item creates an indexer +// Verify creating a property named Item creates an indexer type Foo() = member this.Item (x : decimal) = 42 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/MethodsAndProperties.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/MethodsAndProperties.fs index a71f63cbfb9..6f5331abcbb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/MethodsAndProperties.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/MethodsAndProperties.fs @@ -11,25 +11,30 @@ module MemberDefinitions_MethodsAndProperties = let verifyCompile compilation = compilation |> asExe - |> withOptions ["--nowarn:988"] + |> withOptions ["--nowarn:988"; "--nowarn:FS3581"] |> compile - let verifyCompileAndRun compilation = + let verifyCompileAndRun = verifyCompile >> run + + // SOURCE=PartiallyOverriddenProperty.fs + [] + let ``Partially Overridden Property`` compilation = compilation - |> asExe - |> withOptions ["--nowarn:988"] - |> compileAndRun + |> withCheckNulls + |> typecheck + |> shouldSucceed // SOURCE=AbstractProperties01.fs # AbstractProperties01.fs [] let ``AbstractProperties01_fs`` compilation = compilation + |> withCheckNulls |> verifyCompileAndRun |> shouldSucceed - // SOURCE=E_AbstractAndConcereteProp.fs SCFLAGS="--test:ErrorRanges" # E_AbstractAndConcereteProp.fs - [] - let ``E_AbstractAndConcereteProp_fs`` compilation = + // SOURCE=E_AbstractAndConcreteProp.fs SCFLAGS="--test:ErrorRanges" # E_AbstractAndConcreteProp.fs + [] + let ``E_AbstractAndConcreteProp_fs`` compilation = compilation |> verifyCompile |> shouldFail @@ -65,7 +70,7 @@ module MemberDefinitions_MethodsAndProperties = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 827, Line 10, Col 19, Line 10, Col 37, "This is not a valid name for an active pattern") + (Error 827, Line 10, Col 20, Line 10, Col 29, "'(|Foo|Bar|)' is not a valid method name. Use a 'let' binding instead.") (Error 39, Line 21, Col 10, Line 21, Col 13, "The type 'FaaBor' does not define the field, constructor or member 'Foo'.") ] @@ -76,7 +81,23 @@ module MemberDefinitions_MethodsAndProperties = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 827, Line 6, Col 12, Line 6, Col 27, "This is not a valid name for an active pattern") + (Error 827, Line 6, Col 15, Line 6, Col 24, "'(|Foo|Bar|)' is not a valid method name. Use a 'let' binding instead.") + (Error 3868, Line 16, Col 11, Line 16, Col 14, "This active pattern expects 1 expression argument(s) and a pattern argument, e.g., 'Foo e1 pat'."); + (Error 3868, Line 17, Col 11, Line 17, Col 14, "This active pattern expects 1 expression argument(s) and a pattern argument, e.g., 'Bar e1 pat'."); + (Warning 25, Line 15, Col 15, Line 15, Col 16, "Incomplete pattern matches on this expression.") + ] + + + // SOURCE=E_ActivePatternMember03.fs SCFLAGS="--test:ErrorRanges" # E_ActivePatternMember03.fs + [] + let ``E_ActivePatternMember03_fs`` compilation = + compilation + |> verifyCompile + |> shouldFail + |> withDiagnostics [ + (Error 3872, Line 5, Col 6, Line 5, Col 13, "Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern.") + (Error 3872, Line 15, Col 10, Line 15, Col 17, "Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern.") + (Error 827, Line 24, Col 20, Line 24, Col 25, "'(|A|B|)' is not a valid method name. Use a 'let' binding instead.") ] // SOURCE=E_DuplicateProperty01.fs SCFLAGS="--test:ErrorRanges" # E_DuplicateProperty01.fs @@ -589,7 +610,6 @@ type MyIndexerClass() = with get (index: int): string = "" and set (index: int) (value: float) = () """ - |> withLangVersionPreview |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 3581, Line 3, Col 14, Line 3, Col 22, "An indexed property's getter and setter must have the same type. Property 'Indexer1' has getter of type 'string' but setter of type 'float'.") @@ -602,7 +622,6 @@ type MyIndexerClass() = with get (index) = 1 and set (index) (value: float) = () """ - |> withLangVersionPreview |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 3581, Line 3, Col 14, Line 3, Col 22, "An indexed property's getter and setter must have the same type. Property 'Indexer2' has getter of type 'int' but setter of type 'float'.") @@ -616,7 +635,6 @@ type MyIndexerClass() = member x.Indexer3 with set index (value: float) = () """ - |> withLangVersionPreview |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 3581, Line 3, Col 14, Line 3, Col 22, "An indexed property's getter and setter must have the same type. Property 'Indexer3' has getter of type 'int' but setter of type 'float'.") @@ -629,7 +647,6 @@ type MyIndexerClass() = with get (index: int, index2: int): float = 0.0 and set (index1: int, index2: int) (value: string) = () """ - |> withLangVersionPreview |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 3581, Line 3, Col 14, Line 3, Col 22, "An indexed property's getter and setter must have the same type. Property 'Indexer4' has getter of type 'float' but setter of type 'string'.") @@ -642,7 +659,6 @@ type MyIndexerClass() = with get (index, index2) = 0.0 and set (index1, index2) value = () """ - |> withLangVersionPreview |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 3581, Line 3, Col 14, Line 3, Col 22, "An indexed property's getter and setter must have the same type. Property 'Indexer5' has getter of type 'float' but setter of type 'obj'.") @@ -664,7 +680,6 @@ type GenericIndexer<'indexerArgs,'indexerOutput,'indexerInput>() = m_lastArgs <- args m_lastInput <- input """ - |> withLangVersionPreview |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 3581, Line 9, Col 17, Line 9, Col 21, "An indexed property's getter and setter must have the same type. Property 'Item' has getter of type ''indexerOutput' but setter of type ''indexerInput'.") \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/PartiallyOverriddenProperty.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/PartiallyOverriddenProperty.fs new file mode 100644 index 00000000000..472ee4ea8ec --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/PartiallyOverriddenProperty.fs @@ -0,0 +1,15 @@ +module MyLib + +type BaseType() = + abstract Msg : string with get,set + default this.Msg + with get() = "" + and set x = printfn "%s" x + +type DerivedType() = + inherit BaseType() + override this.Msg with get() = "getterOnly" + +let d = new DerivedType() +d.Msg <- "" //invoking setter +printfn "%s" d.Msg //invoking getter diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/tupesAndFuncsAsArgs.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/tupesAndFuncsAsArgs.fs index d070b124bf6..ec8697a3114 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/tupesAndFuncsAsArgs.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/MethodsAndProperties/tupesAndFuncsAsArgs.fs @@ -5,7 +5,7 @@ type Foo() = static member ExecuteFunction (func : (int * string) -> bool) (args : (int * string)) = func args - // Type infered tuples + // Type inferred tuples member this.AddTupes (a : (int*int*int)) (b : (int*int*int*int)) c = let a1, a2, a3 = a let b1, b2, b3, b4 = b diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_MisspeltParam01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_MisspeltParam01.fs index e1bd09871b8..d98346d3608 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_MisspeltParam01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_MisspeltParam01.fs @@ -1,5 +1,5 @@ // #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments // Verify error when you misspell named parameters -//No accessible member or object constructor named 'ProcessStartInfo' takes 0 arguments\. The named argument 'Argument' doesn't correspond to any argument or settable return property for any overload + let _ = new System.Diagnostics.ProcessStartInfo(FileName = "test", Argument = "testarg") diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_MustBePrefix.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_MustBePrefix.fs index 99f3726f1cf..eb801ce5e80 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_MustBePrefix.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_MustBePrefix.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments // Verify warning when named arguments do not form _prefix_ of unnamed arguments. -//This construct is deprecated: The unnamed arguments do not form a prefix of the arguments of the method called + type IFoo = interface abstract NamedMeth1 : arg1:int * arg2:int * arg3:int * arg4:int-> unit diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_NonNamedAfterNamed.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_NonNamedAfterNamed.fs index db6d3c7019b..d0a01f375b6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_NonNamedAfterNamed.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_NonNamedAfterNamed.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments #light -//Named arguments must appear after all other arguments + type Foo = static member DoStuff (a:int, b:int, c:int, d:int, e:int) = a + b + c + d + e diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_NumParamMismatch01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_NumParamMismatch01.fs index 62e9d270297..aaf831ae650 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_NumParamMismatch01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_NumParamMismatch01.fs @@ -1,8 +1,8 @@ // #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments // FSB 1433, Count of supplied parameters incorrect in error message if named parameters are used. -//Accessibility modifiers are not permitted on overrides or interface implementations -//The member or object constructor 'NamedMeth1' requires 1 additional argument\(s\)\. The required signature is 'abstract IFoo\.NamedMeth1: arg1: int \* arg2: int \* arg3: int \* arg4: int -> float' -//The member or object constructor 'NamedMeth1' requires 4 argument\(s\) but is here given 2 unnamed and 3 named argument\(s\)\. The required signature is 'abstract IFoo\.NamedMeth1: arg1: int \* arg2: int \* arg3: int \* arg4: int -> float' + + + type IFoo = interface abstract NamedMeth1 : arg1:int * arg2:int * arg3:int * arg4:int-> float diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_SyntaxErrors01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_SyntaxErrors01.fs index 9b6757172ae..816881967bc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_SyntaxErrors01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/NamedArguments/E_SyntaxErrors01.fs @@ -1,8 +1,8 @@ // #Regression #Conformance #DeclarationElements #MemberDefinitions #NamedArguments // FSB 1430, Compiler spits out duplicate errors when given bogus syntax for named arguments -//The value or constructor 'arg1' is not defined -//The value or constructor 'arg2' is not defined -//This value is not a function and cannot be applied + + + type Foo() = class member this.Stuff : arg1:int * arg2:int = arg1 + arg2 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_OptionalNamedArgs.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_OptionalNamedArgs.fs index 11cb8d88671..97c7ce2fa8a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_OptionalNamedArgs.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_OptionalNamedArgs.fs @@ -1,5 +1,5 @@ // #435263: compiler crash with .net optional parameters and F# optional syntax -//This expression was expected to have type + // 'string option' //but here has type // 'string' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_SanityCheck.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_SanityCheck.fs index f23ee18581b..284b3a63a2a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_SanityCheck.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_SanityCheck.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments // Regression for FSHARP1.0: 6040 -//Optional arguments must come at the end of the argument list, after any non-optional arguments + module M type Foo = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_SanityCheck02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_SanityCheck02.fs index 02107aa4c61..6106f83070b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_SanityCheck02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/E_SanityCheck02.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #MemberDefinitions #OptionalArguments // Regression for FSHARP1.0: 6040 -//Optional arguments must come at the end of the argument list, after any non-optional arguments + module M type Foo = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityCheck02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityCheck02.fs index 2f889a501c4..d0e4078b6bb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityCheck02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalArguments/SanityCheck02.fs @@ -41,7 +41,7 @@ if test.ILO <> None then failwith "Failed: 4" let x = 42 test.MegaOptParams(x = x) -// Verify default values were obtained, and modifed +// Verify default values were obtained, and modified if test.Prim <> 100.0 then failwith "Failed: 1" if test.DU <> Jane(Joe(0)) then failwith "Failed: 2" if test.Obj <> "" then failwith "Failed: 3" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/E_OnlyDefault.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/E_OnlyDefault.fs index 9d3909fa926..52ef42e5a09 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/E_OnlyDefault.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/E_OnlyDefault.fs @@ -1,6 +1,6 @@ // #Conformance #DeclarationElements #MemberDefinitions #OptionalDefaultParameterValueArguments -//This expression was expected to have type + // 'int' //but here has type // 'unit' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/Library.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/Library.fs index d2be3f6a748..d945639ff85 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/Library.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/Library.fs @@ -37,7 +37,7 @@ type Class() = static member Mix3(a:int, []b:string, []c:int, []d: int) = (b,c,d) - // compiler should be able to figure out default to pass to Optional parameters without DefaultPaarameterValue. + // compiler should be able to figure out default to pass to Optional parameters without DefaultParameterValue. static member Optional1([]a: int) = a static member Optional2([]a: obj) = a static member Optional3([]a: DateTime) = a diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/Sanity.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/Sanity.fs index cb4bde4e951..5e9d98b61d3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/Sanity.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/Sanity.fs @@ -35,7 +35,7 @@ type Class() = static member Mix3(a:int, []b:string, []c:int, []d: int) = (b,c,d) - // compiler should be able to figure out default to pass to Optional parameters without DefaultPaarameterValue. + // compiler should be able to figure out default to pass to Optional parameters without DefaultParameterValue. static member Optional1([]a: int) = a static member Optional2([]a: obj) = a static member Optional3([]a: DateTime) = a diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/W_WrongDefaultType.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/W_WrongDefaultType.fs index e0068e6ec8e..89b002a9238 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/W_WrongDefaultType.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OptionalDefaultParamArgs/W_WrongDefaultType.fs @@ -1,6 +1,6 @@ // #Conformance #DeclarationElements #MemberDefinitions #OptionalDefaultParameterValueArguments -//The default value does not have the same type as the argument. + //The DefaultParameterValue attribute and any Optional attribute will be ignored. //Note: 'null' needs to be annotated with the correct type, e.g. 'DefaultParameterValue(null:obj)'. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_OverloadCurriedFunc.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_OverloadCurriedFunc.fs index 01aca130648..2a4f637f2ab 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_OverloadCurriedFunc.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_OverloadCurriedFunc.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading // Verify error when overloading a curried function -//One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form + type C = [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_OverloadMismatch.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_OverloadMismatch.fs index 475883baf66..1a1efc83992 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_OverloadMismatch.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_OverloadMismatch.fs @@ -1,4 +1,4 @@ -//No implementation was given for + open System open System.IO diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_ReturnGenericUnit01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_ReturnGenericUnit01.fs index 02a14e40203..789bb742ece 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_ReturnGenericUnit01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_ReturnGenericUnit01.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading // Verify error message when returning a 'a which is of type unit -//The member 'M: unit -> unit' does not have the correct type to override the corresponding abstract method + [] type 'a ``base`` = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_UnsolvableConstraints01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_UnsolvableConstraints01.fs index 597dd6040b9..f1c1529da1c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_UnsolvableConstraints01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/E_UnsolvableConstraints01.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DeclarationElements #MemberDefinitions #Overloading // Regression for FSHARP1.0:6164 -//Type inference problem too complicated \(maximum iteration depth reached\)\. Consider adding further type annotations\. + type 'a D = static member inline (+)(_:^b D, _:^b) : ^b when ^b : (static member (+) : ^b * ^b -> ^b) = failwith "Not implemented" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OverloadResolutionUsingFunction.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OverloadResolutionUsingFunction.fs new file mode 100644 index 00000000000..33560ae9389 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OverloadResolutionUsingFunction.fs @@ -0,0 +1,42 @@ +open System +let ae = new AggregateException() + +ae.Handle(fun e -> + match e with + | :? OperationCanceledException -> true + | _ -> false + ) + +ae.Handle(function + | :? OperationCanceledException -> true + | _ -> false + ) + +ae.Handle( + Func( + function + | :? OperationCanceledException -> true + | _ -> false + )) + +module M1 = + type T = + static member M (_ : Func) = () + + T.M (function _ -> function :? ArgumentException -> 3 | _ -> 4) + T.M (function 0 -> (function _ -> 3) | _ -> function :? ArgumentException -> 3 | _ -> 4) + +module M2 = + type T = + static member M (_ : Func) = () + + T.M (function 0 -> (function _ -> 1) | _ -> (function 0 -> 3 | _ -> 4)) + T.M (function 0 -> id | _ -> (function 0 -> 3 | _ -> 4)) + T.M (function 0 -> (function 0 -> 3 | _ -> 4) | _ -> id) + +module M3 = + type T = + static member M (_ : Func) = () + + T.M (function 0 -> (function 0 -> (function 0 -> 1 | _ -> 0) | _ -> (function 0 -> 2 | _ -> 3)) | _ -> (function 0 -> (function _ -> 3) | _ -> (function 3 -> 4 | _ -> 5))) + T.M (function 0 -> (function 0 -> id | _ -> (function 0 -> 2 | _ -> 3)) | _ -> (function 0 -> (function _ -> 3) | _ -> (function 3 -> 4 | _ -> 5))) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OverloadingMembers.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OverloadingMembers.fs index 1bc2d332247..e0b4c824187 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OverloadingMembers.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions/OverloadingMembers/OverloadingMembers.fs @@ -229,3 +229,9 @@ module MemberDefinitions_OverloadingMembers = |> withDefines ["TOO_GENERIC"] |> verifyCompileAndRun |> shouldSucceed + + [] + let ``OverloadResolutionUsingFunction_fs`` compilation = + compilation + |> verifyCompileAndRun + |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_AbbreviationOnNamespace01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_AbbreviationOnNamespace01.fs index 2dfe4aca08f..330cb151922 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_AbbreviationOnNamespace01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_AbbreviationOnNamespace01.fs @@ -1,10 +1,10 @@ // #Regression #Conformance #DeclarationElements #Modules // This used to be a positive test. Now it is not. -//The path 'System\.IO' is a namespace. A module abbreviation may not abbreviate a namespace\. -//The value, namespace, type or module 'IO' is not defined. -//The path 'System\.Text\.RegularExpressions' is a namespace. A module abbreviation may not abbreviate a namespace\. -//The namespace or module 'rx' is not defined -//Lookup on object of indeterminate type based on information prior to this program point\..+ + + + + + // Test 1 -------------------------- diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_InvalidAbbrevName02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_InvalidAbbrevName02.fs index 3e66981a8b4..31d6688f320 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_InvalidAbbrevName02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_InvalidAbbrevName02.fs @@ -1,5 +1,5 @@ // #Regression #Conformance #DeclarationElements #Modules // Verify error when using a dot in the name -//A module abbreviation must be a simple name, not a path + module MS.FS.Co.L = Microsoft.FSharp.Collections.List diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_NameConflict01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_NameConflict01.fs index 614d807092c..8a37336d05f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_NameConflict01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/E_NameConflict01.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #DeclarationElements #Modules #light -//The field, constructor or member 'sum' is not defined + // Define a function diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideModuleDef.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideModuleDef.fs index 2b4b6d3be32..45649608579 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideModuleDef.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleAbbreviations/useInsideModuleDef.fs @@ -17,5 +17,5 @@ module TestModule1 = module ABC = A.B.C let dsc = ABC.DirectorySeparatorChar - printfn "Current directory seperator char is %c" dsc + printfn "Current directory separator char is %c" dsc diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen01.fs index a92023a9ceb..a597fa93654 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen01.fs @@ -8,7 +8,7 @@ module M = let x = 0 -// While processing the anonomous module (this file) nested module M +// While processing the anonymous module (this file) nested module M // will automatically be opened, bringing x into scope. if x <> 0 then failwith "Failed: 1" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen02.fs index 4d4c1c60109..357612a9bf0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/AutoOpen02.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Modules #light -//The value or constructor 'x' is not defined + module A = [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleSuffix01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleSuffix01.fsx index fcfb6a9f140..0f12338ad6a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleSuffix01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleSuffix01.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Modules // Clashing module names and use of CompilationRepresentation attribute // This is regression test for FSHARP1.0:3749 -//Duplicate definition of type or module 'module' + namespace N diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleSuffix_NameClash01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleSuffix_NameClash01.fsx index a71a352b0c8..a0d88f88e14 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleSuffix_NameClash01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleSuffix_NameClash01.fsx @@ -2,7 +2,7 @@ // Decorating a module with the CompilationRepresentation // will append 'Module' to the module name. // This code won't compile since there's a name clash ('mModule') -//Duplicate definition of type, exception or module 'mModule' + [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleWithExpression02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleWithExpression02.fs index b9b86abfbdb..18e89713381 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleWithExpression02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleWithExpression02.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Modules // Regression test for FSHARP1.0:2644 (a module may start with an expression) // This is unfortunate, but this is the current behavior for this release. -//The namespace 'DateTime' is not defined + #light module M2 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleWithSameNameInNamespace01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleWithSameNameInNamespace01.fsx index 57aaa4248f7..c633864466c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleWithSameNameInNamespace01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleWithSameNameInNamespace01.fsx @@ -1,6 +1,6 @@ // #Regression #Conformance #TypesAndModules #Modules // Can't have 2 modules with the same name in the same namespace -//Duplicate definition of type, exception or module 'module' + namespace N module ``module`` = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleWithSameNameInNamespace02a.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleWithSameNameInNamespace02a.fsx index 87fea6ed057..e1e0661c725 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleWithSameNameInNamespace02a.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ModuleWithSameNameInNamespace02a.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Modules // Can't have 2 modules with the same name in the same namespace // Compile with the corresponding 02b.fsx file -//Two modules named 'N\.module' occur in two parts of this assembly + namespace N module ``module`` = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ObsoleteAttribOnModules01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ObsoleteAttribOnModules01.fs index 156ea6b0a1c..e6217efea91 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ObsoleteAttribOnModules01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/E_ObsoleteAttribOnModules01.fs @@ -1,10 +1,10 @@ // #Regression #Conformance #TypesAndModules #Modules #light // Regression test for: FSharp1.0:2030 - We should honor System.Obsolete on modules -//This construct is deprecated\. Don't use this module\. -//This construct is deprecated\. Don't use this module\. -//This construct is deprecated\. Don't use this module\. -//This construct is deprecated\. Don't use this nested module\. + + + + [] module ObsoleteModule = module NestedModule = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/W_ModuleAbbreviationWithNamespace01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/W_ModuleAbbreviationWithNamespace01.fs index fb902632d30..cacd7409943 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/W_ModuleAbbreviationWithNamespace01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/W_ModuleAbbreviationWithNamespace01.fs @@ -2,7 +2,7 @@ // Regression test for FSHARP1.0:2644 (a module may start with an expression) // Module abbreviation: Trying to abbreviate a namespace is deprecated // See also FSHARP1.0:2848 -//The path 'Microsoft\.FSharp\.Core' is a namespace\. A module abbreviation may not abbreviate a namespace\. + // Module abbreviations module M2 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/W_Production_OCamlCompat.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/W_Production_OCamlCompat.fsx index 1375ef3619b..1665d43135c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/W_Production_OCamlCompat.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/W_Production_OCamlCompat.fsx @@ -1,13 +1,13 @@ // #Regression #Conformance #TypesAndModules #Modules // Productions // Compile without: --mlcompatibility -//This construct is for ML compatibility\. The syntax 'module \.\.\. = struct \.\. end' is not used in F# code\. Consider using 'module \.\.\. = begin \.\. end' -//This construct is for ML compatibility\. The syntax 'module \.\.\. = struct \.\. end' is not used in F# code\. Consider using 'module \.\.\. = begin \.\. end' -//This construct is for ML compatibility\. The syntax 'module \.\.\. = struct \.\. end' is not used in F# code\. Consider using 'module \.\.\. = begin \.\. end' -//This construct is for ML compatibility\. The syntax 'module \.\.\. = struct \.\. end' is not used in F# code\. Consider using 'module \.\.\. = begin \.\. end' -//This construct is for ML compatibility\. The syntax 'module \.\.\. = struct \.\. end' is not used in F# code\. Consider using 'module \.\.\. = begin \.\. end' -//This construct is for ML compatibility\. The syntax 'module \.\.\. = struct \.\. end' is not used in F# code\. Consider using 'module \.\.\. = begin \.\. end' -//This construct is for ML compatibility\. The syntax 'module \.\.\. = struct \.\. end' is not used in F# code\. Consider using 'module \.\.\. = begin \.\. end' + + + + + + + #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NullRepresentations/E_NullInvalidForFSTypes01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NullRepresentations/E_NullInvalidForFSTypes01.fs index bb7b27c36a8..38ab92b0dae 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NullRepresentations/E_NullInvalidForFSTypes01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/NullRepresentations/E_NullInvalidForFSTypes01.fs @@ -3,9 +3,9 @@ // Verify that 'null' is not a valid value for F# types -//The type 'int list' does not have 'null' as a proper value -//The type 'DU' does not have 'null' as a proper value -//The type 'RecType' does not have 'null' as a proper value + + + type RecType = {RTag1 : int * string; RTag2 : int list option} diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/E_BasicOperatorNames01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/E_BasicOperatorNames01.fs index 7d4d9c37184..ab23c121a29 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/E_BasicOperatorNames01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/OperatorNames/E_BasicOperatorNames01.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #BasicGrammarElements #Operators -//This construct is deprecated: '\$' is not permitted as a character in operator names and is reserved for future use -//This construct is deprecated: '\$' is not permitted as a character in operator names and is reserved for future use + + module TestModule // Const diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/DotNotationAfterGenericMethod01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/DotNotationAfterGenericMethod01.fs index fc0a346280b..1f53b80e3ff 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/DotNotationAfterGenericMethod01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/DotNotationAfterGenericMethod01.fs @@ -1,5 +1,5 @@ // #Regression #Conformance #BasicGrammarElements #Operators -// FSharp1.0:4760 - A method(with,arguments) can not appear mid-way down a path-lookup +// FSharp1.0:4760 - A method(with,arguments) cannot appear mid-way down a path-lookup diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_ExclamationMark01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_ExclamationMark01.fs index bb7c03a4ce9..71d48009eb7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_ExclamationMark01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/E_ExclamationMark01.fs @@ -3,8 +3,8 @@ // Prefix only operators: !OP, ?OP, ~OP // Try to use !OP as an infix-op is an error // ?OP ~OP -//This value is not a function and cannot be applied -//This value is not a function and cannot be applied + + module M diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/VerticalbarOptionalinDU.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/VerticalbarOptionalinDU.fs index acd20077e40..f4ac477bdba 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/VerticalbarOptionalinDU.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/PrecedenceAndOperators/VerticalbarOptionalinDU.fs @@ -3,5 +3,5 @@ -type Monchrome = +type Monochrome = Black = 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_AbbreviatedTypeAlreadyUsed01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_AbbreviatedTypeAlreadyUsed01.fsx index 43d41f1f156..94105d29da7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_AbbreviatedTypeAlreadyUsed01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_AbbreviatedTypeAlreadyUsed01.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules // Type abbreviation // Abbreviated type already used (redefined) -//Duplicate definition of type, exception or module 'T' + #light type T = Microsoft.FSharp.Math.BigInt type T = Microsoft.FSharp.Math.BigNum // error! diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_AbbreviatedTypeDoesNotExist01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_AbbreviatedTypeDoesNotExist01.fsx index 3f566223ea7..1169f31af29 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_AbbreviatedTypeDoesNotExist01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_AbbreviatedTypeDoesNotExist01.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules // Type abbreviation // Type tp abbreviate a type that does not exist -//The namespace or module 'X' is not defined + #light type Z = X.Y.Z.W // error diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_Constraints_SampleFromSpec02.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_Constraints_SampleFromSpec02.fsx index a1955725f2b..1c64fc0dff2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_Constraints_SampleFromSpec02.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_Constraints_SampleFromSpec02.fsx @@ -1,6 +1,6 @@ // #Regression #Conformance #TypesAndModules // Abbreviation: the constraints on the right-hand-side are not sufficient -//A type parameter is missing a constraint 'when 'b :> IB' + #light type IA = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_DroppedTypeVariable01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_DroppedTypeVariable01.fsx index 9483daffd63..6f4f65b4de6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_DroppedTypeVariable01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_DroppedTypeVariable01.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules // Abbreviation: it is not allowed to drop variable types // Regression test for FSHARP1.0:3740 -//This construct is deprecated: This type abbreviation has one or more declared type parameters that do not appear in the type being abbreviated\. Type abbreviations must use all declared type parameters in the type being abbreviated\. Consider removing one or more type parameters, or use a concrete type definition that wraps an underlying type, such as 'type C<'a> = C of \.\.\.'\. + type Drop<'a,'b> = 'a * 'a diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_FlexibleType01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_FlexibleType01.fsx index b0a8b095ffb..6ad4f724f43 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_FlexibleType01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_FlexibleType01.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules -// Incorrect right hand side: flexibe type. +// Incorrect right hand side: flexible type. // See also FSHARP1.0:4957 -//Unexpected infix operator in implementation file + / exception E of int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_FlexibleTypeInSignature01.fsi b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_FlexibleTypeInSignature01.fsi index d8a543dc610..d8f91e0aaf7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_FlexibleTypeInSignature01.fsi +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_FlexibleTypeInSignature01.fsi @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules // Type abbreviation - flexible type in signature // Regression test for FSHARP1.0:3742 -//Anonymous type variables are not permitted in this declaration + module E_FlexibleTypeInSignature01 type C = class diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_FlexibleTypeInSignature01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_FlexibleTypeInSignature01.fsx index 688d9c5c860..54eba504310 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_FlexibleTypeInSignature01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_FlexibleTypeInSignature01.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules // Type abbreviation - flexible type in signature // Regression test for FSHARP1.0:3742 -//AAA + module E_FlexibleTypeInSignature01 type C = class diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_IncorrectRightSide_Hash.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_IncorrectRightSide_Hash.fsx index 45ebc17af0e..4201327517b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_IncorrectRightSide_Hash.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_IncorrectRightSide_Hash.fsx @@ -1,6 +1,6 @@ // #Regression #Conformance #TypesAndModules // Incorrect right hand side: hash -//Incomplete structured construct at or before this point in type definition + type BadType = # diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_IncorrectRightSide_Keyword.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_IncorrectRightSide_Keyword.fsx index b89c2c6a4bc..72795a72372 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_IncorrectRightSide_Keyword.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_IncorrectRightSide_Keyword.fsx @@ -1,6 +1,6 @@ // #Regression #Conformance #TypesAndModules // Incorrect right hand side: quotation -//Unexpected keyword 'of' in type definition + #light type BadType = of int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_IncorrectRightSide_Quotation.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_IncorrectRightSide_Quotation.fsx index 8bc50d1db19..8c219138a84 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_IncorrectRightSide_Quotation.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_IncorrectRightSide_Quotation.fsx @@ -1,6 +1,6 @@ // #Regression #Conformance #TypesAndModules // Incorrect right hand side: quotation -//Unexpected start of quotation in type definition$ + #light type BadType = <@ @> // -> int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InfiniteAbbreviation01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InfiniteAbbreviation01.fs index 4a672cbb502..1175c587b16 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InfiniteAbbreviation01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InfiniteAbbreviation01.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules // Verify error if creating a type abbreviation which results in an infinite type expression. -//This type definition involves an immediate cyclic reference through an abbreviation -//This expression was expected to have type 'X' but here has type ''a option' + + type X = option diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InfiniteAbbreviation02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InfiniteAbbreviation02.fs index 978257133a9..09a7e1ed103 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InfiniteAbbreviation02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InfiniteAbbreviation02.fs @@ -2,7 +2,7 @@ #light // Verify error if creating a type abbreviation which results in an infinite type expression. -//This type definition involves an immediate cyclic reference through an abbreviation + type Y = Y * Y diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InheritTypeAbrev.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InheritTypeAbbrev.fs similarity index 73% rename from tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InheritTypeAbrev.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InheritTypeAbbrev.fs index 71be3ebf46c..6a5fdb842de 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InheritTypeAbrev.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_InheritTypeAbbrev.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #TypesAndModules // Verify error when trying to inherit from type abbreviations. -//Cannot inherit a sealed type + type Type1 = A | B type Type2 = Type1 * int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_PrivateTypeAbbreviation02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_PrivateTypeAbbreviation02.fs index 7f86c4be06a..73b1ac81118 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_PrivateTypeAbbreviation02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_PrivateTypeAbbreviation02.fs @@ -2,7 +2,7 @@ // Regression test for FSharp1.0:5229 // Title: Allow private type abbreviations -//The type 'X' is not accessible from this code location + module M = type private X = int * int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_Recursive01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_Recursive01.fsx index dc406569cd6..aaeda5532eb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_Recursive01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_Recursive01.fsx @@ -2,7 +2,7 @@ // Type abbreviation // Recursive definition: using measures // This is regression test for FSHARP1.0:3784 -//This type definition involves an immediate cyclic reference through an abbreviation + #light [] type Kg = Kg // cyclic diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_Recursive02.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_Recursive02.fsx index 4efc81b7080..b9f338a73a0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_Recursive02.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_Recursive02.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules // Type abbreviation // Recursive definition: using list of... -//This type definition involves an immediate cyclic reference through an abbreviation + #light type X = X list // cyclic diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_Recursive03.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_Recursive03.fsx index cb02de00e0c..051a36ee390 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_Recursive03.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_Recursive03.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules // Type abbreviation // Recursive definition: using generic type -//This type definition involves an immediate cyclic reference through an abbreviation + #light type Y<'a> = Y<'a> diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_UnexpectedCharInTypeName01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_UnexpectedCharInTypeName01.fs index 65a9bbecca1..d5b609d17f3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_UnexpectedCharInTypeName01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/E_UnexpectedCharInTypeName01.fs @@ -1,5 +1,5 @@ // #Regression #Conformance #TypesAndModules // Regression test for FSHARP1.0:2431 -//Unexpected character '.+' + type  = int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/TypeAbbreviations.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/TypeAbbreviations.fs index c186a0d33e9..80db08b3025 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/TypeAbbreviations.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/TypeAbbreviations/TypeAbbreviations.fs @@ -150,9 +150,9 @@ module TypeAbbreviations = (Error 10, Line 6, Col 16, Line 6, Col 18, "Unexpected start of quotation in type definition") ] - //SOURCE=E_InheritTypeAbrev.fs # E_InheritTypeAbrev.fs - [] - let ``E_InheritTypeAbrev_fs`` compilation = + //SOURCE=E_InheritTypeAbbrev.fs # E_InheritTypeAbbrev.fs + [] + let ``E_InheritTypeAbbrev_fs`` compilation = compilation |> verifyCompile |> shouldFail diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindings.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindings.fs index 09c9e18c12a..8196a9fe286 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindings.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindings.fs @@ -37,7 +37,7 @@ type private Disposable() = do Disposable.constructedTimes <- Disposable.constructedTimes + 1 static member DisposeCallCount() = Disposable.disposedTimes - static member ConsturctorCallCount() = Disposable.constructedTimes + static member ConstructorCallCount() = Disposable.constructedTimes interface System.IDisposable with member _.Dispose() = @@ -51,7 +51,7 @@ let disposeCalls = Disposable.DisposeCallCount() if disposeCalls <> 1 then failwith "was not disposed or disposed too many times" -let ctorCalls = Disposable.ConsturctorCallCount() +let ctorCalls = Disposable.ConstructorCallCount() if ctorCalls <> 1 then failwithf "unexpected constructor call count: %i" ctorCalls diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/E_NotMemberOrFunction01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/E_NotMemberOrFunction01.fsx index 5cb7755a083..4e59ead5ad3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/E_NotMemberOrFunction01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/E_NotMemberOrFunction01.fsx @@ -1,6 +1,6 @@ // #Conformance #ObjectOrientedTypes #Classes #TypeInference #ValueRestriction -//Value restriction: The value 'x1' has an inferred generic function type val x1: \('_a -> unit\)However, values cannot have generic type variables like '_a in "let f: '_a". You should define 'x1' as a function instead by doing one of the following:- Add an explicit parameter that is applied instead of using a partial application "let f param"- Add a unit parameter like "let f\(\)"- Write explicit type parameters like "let f<'a>"or if you do not intend for it to be generic, either:- Add an explicit type annotation like "let f : obj -> obj"- Apply arguments of non-generic types to the function value in later code for type inference like "do f\(\)"\.This error is because a let binding without parameters defines a value, not a function\. Values cannot be generic because reading a value is assumed to result in the same everywhere but generic type parameters may invalidate this assumption by enabling type-dependent results\.$ + // We expect a value restriction here. The inferred signature is: // val x1: (?1 -> unit) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/MemberOrFunction01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/MemberOrFunction01.fsx index 52f4b7e5b69..7ad95714e6b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/MemberOrFunction01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/MemberOrFunction01.fsx @@ -2,7 +2,7 @@ // -// We expect no value restriciton here. The inferred signature is: +// We expect no value restriction here. The inferred signature is: // type C0 = // new : unit -> C0 // member ToList : unit -> ?1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/MemberOrFunction01Gen.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/MemberOrFunction01Gen.fsx index 7bc094a5bd0..19d057fd2e4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/MemberOrFunction01Gen.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/MemberOrFunction01Gen.fsx @@ -2,7 +2,7 @@ // -// We expect no value restriciton here. The inferred signature is: +// We expect no value restriction here. The inferred signature is: // type C1<'T> = // new : unit -> C1<'T> // member ToList : unit -> ?1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/MemberOrFunction02.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/MemberOrFunction02.fsx index e7b378265d3..a2d91b7f803 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/MemberOrFunction02.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/MemberOrFunction02.fsx @@ -2,7 +2,7 @@ // -// We expect no value restriciton here. The inferred signature is: +// We expect no value restriction here. The inferred signature is: // type SC0 = // new : unit -> SC0 // static member ToList : unit -> ?1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/MemberOrFunction02Gen.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/MemberOrFunction02Gen.fsx index 746d46c8697..013674b1e7e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/MemberOrFunction02Gen.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/MemberOrFunction02Gen.fsx @@ -2,7 +2,7 @@ // -// We expect no value restriciton here. The inferred signature is: +// We expect no value restriction here. The inferred signature is: // type SC1<'T> = // new : unit -> SC0 // static member ToList : unit -> ?1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/TypeFunction01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/TypeFunction01.fsx index 6ac3a450efe..c3c1d395aef 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/TypeFunction01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ValueRestriction/TypeFunction01.fsx @@ -2,7 +2,7 @@ // -// We expect no value restriciton here. The inferred signature is: +// We expect no value restriction here. The inferred signature is: // val f1<'T> : ?1 // Here 'f1' is a type function, so the value restriction is not applied. The type inference variable // represents hidden state with no possible generalization point in the signature. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Constraints/Unmanaged.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Constraints/Unmanaged.fs index 085027df320..5b9af3c8f20 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Constraints/Unmanaged.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Constraints/Unmanaged.fs @@ -495,7 +495,6 @@ type FsharpStructWrapper<'TInner when 'TInner: unmanaged> = val Item : 'TInner with static member Hi() = typeof<'TInner>.Name""" |> asLibrary - |> withLangVersionPreview |> withName "fsLib" let app = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/BindingExpressions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/BindingExpressions.fs index 4aa7ff3999a..056350802fe 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/BindingExpressions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/BindingExpressions.fs @@ -14,6 +14,12 @@ module BindingExpressions = |> withOptions ["--test:ErrorRanges"] |> compile + let verifyCompileAsExe compilation = + compilation + |> asExe + |> withOptions ["--test:ErrorRanges"] + |> compile + // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/ApplicationExpressions/BasicApplication) // SOURCE=AmbigLetBinding.fs # AmbigLetBinding [] @@ -102,11 +108,10 @@ module BindingExpressions = [] let ``in05_fs`` compilation = compilation - |> verifyCompile + |> verifyCompileAsExe |> shouldFail |> withDiagnostics [ (Error 1, Line 12, Col 13, Line 12, Col 14, "The type 'int' does not match the type 'unit'") - (Error 1, Line 12, Col 18, Line 12, Col 24, "Type mismatch. Expecting a\n ''a -> 'b' \nbut given a\n ''a -> unit' \nThe type 'int' does not match the type 'unit'") (Warning 20, Line 13, Col 5, Line 13, Col 10, "The result of this expression has type 'bool' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.") ] @@ -119,7 +124,6 @@ module BindingExpressions = |> shouldFail |> withDiagnostics [ (Error 1, Line 10, Col 9, Line 10, Col 10, "The type 'int' does not match the type 'unit'") - (Error 1, Line 10, Col 14, Line 10, Col 20, "Type mismatch. Expecting a\n ''a -> 'b' \nbut given a\n ''a -> unit' \nThe type 'int' does not match the type 'unit'") ] // SOURCE=MutableLocals01.fs SCFLAGS="--warnon:3180 --optimize+ --test:ErrorRanges" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/MutableLocals01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/MutableLocals01.fs index b517535d9d1..9a4805bdddf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/MutableLocals01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/MutableLocals01.fs @@ -175,7 +175,7 @@ module IntTests = ix7_NO <- 3 res -module StringtTests = +module StringTests = let test1() = let mutable sx1 = "1" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/W_TypeInferforGenericType.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/W_TypeInferforGenericType.fs index 1f11f19c1a6..bac193f6376 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/W_TypeInferforGenericType.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/W_TypeInferforGenericType.fs @@ -5,6 +5,6 @@ namespace One module One = // Regression test for bug 4083: Extend "inferred type is less generic than the given type annotations" warning to cover cases where a user-authored 'b is constrained to be an 'a - //This construct causes code to be less generic than indicated by the type annotations\. The type variable 'b has been constrained to be type ''a' + let f2 (x : 'a) (y : 'b) = x : 'b diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/in05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/in05.fs index 583f27de4e8..0c386d1676d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/in05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/in05.fs @@ -4,9 +4,9 @@ // I'm adding these cases to make sure we do not accidentally change the behavior from version to version // Eventually, we will deprecated them - and the specs will be updated. //The type 'int' does not match the type 'unit'$ -//Type mismatch\. Expecting a. ''a -> 'b' .but given a. ''a -> unit' .The type 'int' does not match the type 'unit'$ //The result of this expression has type 'bool' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ -module E + +module E = let a = 3 in a + 1 |> ignore a + 1 |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ComputationExpressions/ComputationExpressions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ComputationExpressions/ComputationExpressions.fs new file mode 100644 index 00000000000..2738c701134 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ComputationExpressions/ComputationExpressions.fs @@ -0,0 +1,264 @@ +module Conformance.Expressions.ComputationExpressions + +open Xunit +open FSharp.Test.Compiler + +[] +let ``[] without explicit name is allowed, uses method name as operation name`` () = + FSharp """ + module CustomOperationTest + type CBuilder() = + [] + member this.Foo _ = "Foo" + [] + member this.foo _ = "foo" + [] + member this.bar _ = "bar" + member this.Yield _ = () + member this.Zero _ = () + + + [] + let main _ = + let cb = CBuilder() + + let x = cb { Foo } + let y = cb { foo } + let z = cb { bar } + printfn $"{x}" + printfn $"{y}" + + if x <> "Foo" then + failwith "not Foo" + if y <> "foo" then + failwith "not foo" + if z <> "bar" then + failwith "not bar" + 0 + """ + |> asExe + |> compileAndRun + |> shouldSucceed + +/// Tests for empty-bodied computation expressions: builder { } +module EmptyBodied = + /// F# 8.0 and below do not support empty-bodied computation expressions. + module Unsupported = + [] + let ``seq { } does not compile`` () = + Fsx """ + let xs : int seq = seq { } + """ + |> withLangVersion80 + |> asExe + |> compile + |> shouldFail + |> withErrorCode 789 + |> withErrorMessage "'{ }' is not a valid expression. Records must include at least one field. Empty sequences are specified by using Seq.empty or an empty list '[]'." + + [] + let ``async { } does not compile`` () = + Fsx """ + let a : Async = async { } + """ + |> withLangVersion80 + |> asExe + |> compile + |> shouldFail + |> withErrorCode 3 + |> withErrorMessage "This value is not a function and cannot be applied." + + [] + let ``task { } does not compile`` () = + Fsx """ + open System.Threading.Tasks + + let t : Task = task { } + """ + |> withLangVersion80 + |> asExe + |> compile + |> shouldFail + |> withErrorCode 3 + |> withErrorMessage "This value is not a function and cannot be applied." + + [] + let ``builder { } does not compile`` () = + FSharp """ + type Builder () = + member _.Zero () = Seq.empty + member _.Delay f = f + member _.Run f = f () + + let builder = Builder () + + let xs : int seq = builder { } + """ + |> withLangVersion80 + |> asExe + |> compile + |> shouldFail + |> withErrorCode 3 + |> withErrorMessage "This value is not a function and cannot be applied." + + [] + let ``builder { () } and no Zero: FS0708`` () = + FSharp """ + type Builder () = + member _.Delay f = f + member _.Run f = f () + + let builder = Builder () + + let xs : int seq = builder { () } + """ + |> withLangVersion80 + |> asExe + |> compile + |> shouldFail + |> withErrorCode 708 + |> withErrorMessage "This control construct may only be used if the computation expression builder defines a 'Zero' method" + + [] + let ``builder { () } ≡ seq { () } when Zero () = Seq.empty`` () = + Fsx """ + type Builder () = + member _.Zero () = Seq.empty + member _.Delay f = f + member _.Run f = f () + + let builder = Builder () + + if List.ofSeq (builder { () }) <> List.ofSeq (seq { () }) then + failwith "builder { () } ≢ seq { () }" + """ + |> withLangVersion80 + |> runFsi + |> shouldSucceed + + [] + let ``Unchecked﹒defaultof<'a> { }`` () = + FSharp """ + Unchecked.defaultof<'a> { } + """ + |> withLangVersion80 + |> asExe + |> compile + |> shouldFail + |> withErrorCode 789 + |> withErrorMessage "'{ }' is not a valid expression. Records must include at least one field. Empty sequences are specified by using Seq.empty or an empty list '[]'." + + /// F# 9.0 and above support empty-bodied computation expressions. + module Supported = + /// The language version that supports empty-bodied computation expressions. + /// TODO: Update this to the appropriate version when the feature comes out of preview. + let [] SupportedLanguageVersion = "preview" + + [] + let ``seq { } ≡ seq { () }`` () = + Fsx """ + if List.ofSeq (seq { }) <> List.ofSeq (seq { () }) then + failwith "seq { } ≢ seq { () }" + """ + |> withLangVersion SupportedLanguageVersion + |> runFsi + |> shouldSucceed + + [] + let ``async { } ≡ async { () }`` () = + Fsx """ + if + [|(); ()|] <> ( + [|async { }; async { () }|] + |> Async.Parallel + |> Async.RunSynchronously + ) + then + failwith "async { } ≢ async { () }" + """ + |> withLangVersion SupportedLanguageVersion + |> runFsi + |> shouldSucceed + + [] + let ``task { } ≡ task { () }`` () = + Fsx """ + open System.Threading.Tasks + + // We wrap this in a function to avoid https://github.com/dotnet/fsharp/issues/12038 + let f () = + if + [|(); ()|] <> Task.WhenAll(task { }, task { () }).GetAwaiter().GetResult() + then + failwith "task { } ≢ task { () }" + + f () + """ + |> withLangVersion SupportedLanguageVersion + |> runFsi + |> shouldSucceed + + [] + let ``builder { () } and no Zero: FS0708`` () = + FSharp """ + type Builder () = + member _.Delay f = f + member _.Run f = f () + + let builder = Builder () + + let xs : int seq = builder { () } + """ + |> withLangVersion SupportedLanguageVersion + |> asExe + |> compile + |> shouldFail + |> withErrorCode 708 + |> withErrorMessage "This control construct may only be used if the computation expression builder defines a 'Zero' method" + + [] + let ``builder { } and no Zero: FS0708 and new message`` () = + FSharp """ + type Builder () = + member _.Delay f = f + member _.Run f = f () + + let builder = Builder () + + let xs : int seq = builder { } + """ + |> withLangVersion SupportedLanguageVersion + |> asExe + |> compile + |> shouldFail + |> withErrorCode 708 + |> withErrorMessage "An empty body may only be used if the computation expression builder defines a 'Zero' method." + + [] + let ``builder { } ≡ seq { } when Zero () = Seq.empty`` () = + Fsx """ + type Builder () = + member _.Zero () = Seq.empty + member _.Delay f = f + member _.Run f = f () + + let builder = Builder () + + if List.ofSeq (builder { }) <> List.ofSeq (seq { }) then + failwith "builder { } ≢ seq { }" + """ + |> withLangVersion SupportedLanguageVersion + |> runFsi + |> shouldSucceed + + [] + let ``Unchecked﹒defaultof<'a> { }`` () = + FSharp """ + Unchecked.defaultof<'a> { } + """ + |> withLangVersion SupportedLanguageVersion + |> asExe + |> compile + |> shouldFail + |> withErrorCode 789 + |> withErrorMessage "'{ }' is not a valid expression. Records must include at least one field. Empty sequences are specified by using Seq.empty or an empty list '[]'." diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ComputationExpressions/CustomOperations.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ComputationExpressions/CustomOperations.fs deleted file mode 100644 index 28e9ff22c7a..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ComputationExpressions/CustomOperations.fs +++ /dev/null @@ -1,43 +0,0 @@ -namespace Conformance.Expressions.ComputationExpressions - -open Xunit -open FSharp.Test.Compiler - -module CustomOperations = - - [] - let ``[] without explicit name is allowed, uses method name as operation name`` () = - FSharp """ - module CustomOperationTest - type CBuilder() = - [] - member this.Foo _ = "Foo" - [] - member this.foo _ = "foo" - [] - member this.bar _ = "bar" - member this.Yield _ = () - member this.Zero _ = () - - - [] - let main _ = - let cb = CBuilder() - - let x = cb { Foo } - let y = cb { foo } - let z = cb { bar } - printfn $"{x}" - printfn $"{y}" - - if x <> "Foo" then - failwith "not Foo" - if y <> "foo" then - failwith "not foo" - if z <> "bar" then - failwith "not bar" - 0 - """ - |> asExe - |> compileAndRun - |> shouldSucceed \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/PatternMatching.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/PatternMatching.fs index 729bc351ab3..9f8b10bc05b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/PatternMatching.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/PatternMatching.fs @@ -9,7 +9,7 @@ open FSharp.Test.Compiler module PatternMatching = // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/ControlFlowExpressions/PatternMatching) - //'Some \(\(_,true\)\)' + [] let ``W_PatternMatchingCounterExample01_fs`` compilation = compilation @@ -22,7 +22,7 @@ module PatternMatching = ] // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/ControlFlowExpressions/PatternMatching) - //Incomplete pattern matches on this expression\. For example, the value '\[_;true\]' may indicate a case not covered by the pattern\(s\) + [] let ``W_PatternMatchingCounterExample02_fs`` compilation = compilation @@ -35,7 +35,7 @@ module PatternMatching = ] // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/ControlFlowExpressions/PatternMatching) - //Incomplete pattern matches on this expression + [] let ``W_PatternMatchingCounterExample03_fs`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample01.fs index 85e14dd2b4e..cf5e42308af 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample01.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #ControlFlow // Regression test for FSHARP1.0:1986 (conter example in complex pattern matching) -//'Some \(\(_,true\)\)' + #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample02.fs index e377c113fa6..1359030837b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample02.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #ControlFlow // Regression test for FSHARP1.0:1986 (conter example in complex pattern matching) -//Incomplete pattern matches on this expression\. For example, the value '\[_;true\]' may indicate a case not covered by the pattern\(s\) + #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample03.fs index 07bda7e9260..24a5f6a125d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/W_PatternMatchingCounterExample03.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #ControlFlow // Regression test for FSHARP1.0:1986 (counter example in complex pattern matching) -//Incomplete pattern matches on this expression + let h = function | [||] -> 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/SequenceIteration.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/SequenceIteration.fs index 1a991a53f63..478fcaebf2b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/SequenceIteration.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/SequenceIteration.fs @@ -9,7 +9,7 @@ open FSharp.Test.Compiler module SequenceIteration = // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/ControlFlowExpressions/SequenceIteration) - //Incomplete pattern matches on this expression\. For example, the value 'None' may indicate a case not covered by the pattern\(s\)\.$ + [] let ``W_IncompleteMatchFor01_fs`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/W_IncompleteMatchFor01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/W_IncompleteMatchFor01.fs index bea1c969a11..341002098fc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/W_IncompleteMatchFor01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/W_IncompleteMatchFor01.fs @@ -1,12 +1,12 @@ // #Regression #Conformance #ControlFlow #Sequences // Regression for FSHARP1.0:5733 // For expressions should warn when elements will be skipped just like computation expressions do -//Incomplete pattern matches on this expression\. For example, the value 'None' may indicate a case not covered by the pattern\(s\)\. Unmatched elements will be ignored\.$ -//Incomplete pattern matches on this expression\. For example, the value 'None' may indicate a case not covered by the pattern\(s\)\. Unmatched elements will be ignored\.$ -//Incomplete pattern matches on this expression\. For example, the value 'Some \(0\)' may indicate a case not covered by the pattern\(s\)\. Unmatched elements will be ignored\.$ -//Incomplete pattern matches on this expression\. For example, the value '0' may indicate a case not covered by the pattern\(s\)\. Unmatched elements will be ignored\.$ -//Incomplete pattern matches on this expression\. For example, the value 'None' may indicate a case not covered by the pattern\(s\)\.$ -//Incomplete pattern matches on this expression\. For example, the value 'None' may indicate a case not covered by the pattern\(s\)\.$ + + + + + + for Some x in [Some 3; None] do () let s = [Some 3; None] :> seq<_> diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_rigidtypeannotation02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_rigidtypeannotation02.fs index 4de91d2b113..0c557791d3f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_rigidtypeannotation02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_rigidtypeannotation02.fs @@ -1,8 +1,8 @@ // #Regression #Conformance #TypeRelatedExpressions #TypeAnnotations // Regression test for FSHARP1.0:2346 -//This expression was expected to have type. 'obj' .but here has type. 'int' -//This expression was expected to have type. 'obj' .but here has type. 'string' -//This expression was expected to have type. 'seq<'a>' .but here has type. ''b list' + + + (1 : obj) ("Hello" : obj) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_rigidtypeannotation02b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_rigidtypeannotation02b.fs index 49b034a71b6..ce96329a6e1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_rigidtypeannotation02b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/E_rigidtypeannotation02b.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #TypeRelatedExpressions #TypeAnnotations // Regression test for FSHARP1.0:2346 -//This expression was expected to have type. 'obj' .but here has type. 'float' -//This expression was expected to have type. 'seq<'a>' .but here has type. ''b list' + + [] type s (1.0 : obj) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ObjectExpressions/ObjectExpressions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ObjectExpressions/ObjectExpressions.fs index a53252356de..45e97d5748c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ObjectExpressions/ObjectExpressions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ObjectExpressions/ObjectExpressions.fs @@ -16,13 +16,42 @@ type IFirst = let x = { new _ with member this.MyMember() = 42 } """ - |> withLangVersion80 + |> withLangVersion90 |> typecheck |> shouldFail |> withDiagnostics [ (Error 772, Line 5, Col 11, Line 5, Col 16, "'new' must be used with a named type") ] + [] + let ``Object expression can not implement a class class end`` () = + Fsx """ +type Class() = class end + +let implementer = { new Class() } + """ + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 738, Line 4, Col 19, Line 4, Col 35, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces.") + ] + + [] + let ``Object expression can not implement a class without members`` () = + Fsx """ +type Class() = + member this.Do() = () + +let implementer = { new Class() } + """ + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 738, Line 5, Col 19, Line 5, Col 35, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces.") + ] + [] let ``Object expression implementing an interface without members`` () = Fsx """ @@ -30,10 +59,97 @@ type IFirst = interface end let implementer() ={ new IFirst } """ - |> withLangVersion80 + |> withLangVersion90 + |> typecheck + |> shouldSucceed + + [] + let ``Object expression can construct an abstract class and also implement interfaces with and without abstract members.`` () = + Fsx """ +type IFirst = interface end + +type ISecond = + abstract member M : unit -> unit + +[] +type MyClass() = class end + +{ new MyClass() with + member x.ToString() = "OK" + + interface IFirst + + interface ISecond with + member this.M() = () } |> ignore + """ + |> withLangVersion90 |> typecheck |> shouldSucceed + [] + let ``Object expression can construct an abstract class(missing with...) and also implement interfaces with and without abstract members.`` () = + Fsx """ +type IFirst = interface end + +type ISecond = + abstract member M : unit -> unit + +[] +type MyClass() = class end + +{ new MyClass() interface IFirst + + interface ISecond with + member this.M() = () } |> ignore + """ + |> withLangVersion90 + |> typecheck + |> shouldSucceed + + [] + let ``Object expression can construct an abstract class(missing with... and interface in the next line) and also implement interfaces with and without abstract members.`` () = + Fsx """ +type IFirst = interface end + +type ISecond = + abstract member M : unit -> unit + +[] +type MyClass() = class end + +{ new MyClass() + interface IFirst + + interface ISecond with + member this.M() = () } |> ignore + """ + |> withLangVersion90 + |> typecheck + |> shouldSucceed + + [] + let ``Verifies that the object expression built type has the interface.`` () = + Fsx """ +type IFirst = interface end + +type ISecond = + abstract member M : unit -> unit + +[] +type MyClass() = + interface ISecond with + member this.M() = printfn "It works" + +let expr = { new MyClass() interface IFirst } +(expr:> ISecond).M() + """ + |> withLangVersion90 + |> compileExeAndRun + |> shouldSucceed + |> withStdOutContainsAllInOrder [ + "It works" + ] + [] let ``Parameterized object expression implementing an interface with members`` () = Fsx """ @@ -53,32 +169,307 @@ let implSomeDU someDu = | B b -> b | C c -> string c } """ - |> withLangVersion80 + |> withLangVersion90 |> typecheck |> shouldSucceed [] - let ``Object expression can not implement an abstract class having no abstract members.`` () = + let ``Object expression cannot implement an abstract class having no abstract members.`` () = Fsx """ [] type Foo() = class end -let foo = { new Foo() } // Approved suggestion to allow this https://github.com/fsharp/fslang-suggestions/issues/632 +let foo = { new Foo() } + +let foo1 = new Foo() // hacky workaround -let foo = { new Foo() with member __.ToString() = base.ToString() } +let foo2 = { new Foo() with member __.ToString() = base.ToString() } + """ + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 738, Line 5, Col 11, Line 5, Col 24, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces."); + (Error 759, Line 7, Col 12, Line 7, Col 21, "Instances of this type cannot be created since it has been marked abstract or not all methods have been given implementations. Consider using an object expression '{ new ... with ... }' instead.") + ] + + [] + let ``Object expression can not implement an abstract class having no abstract members`` () = + Fsx """ +[] +type AbstractClass() = + do printfn "AbstractClass constructor" + +let res = { new AbstractClass() } + """ + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 738, Line 6, Col 11, Line 6, Col 34, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces.") + ] + + [] + let ``Object expression can not implement an abstract class having abstract members with default implementation`` () = + Fsx """ +[] +type AbstractClass() = + abstract member M : unit -> unit + default this.M() = printfn "Im a default implementation" + +let res = { new AbstractClass() } + """ + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 738, Line 7, Col 11, Line 7, Col 34, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces.") + ] + + [] + let ``Object expression can implement an abstract class(overriding a member) having abstract members with default implementation`` () = + Fsx """ +[] +type AbstractClass() = + abstract member M : unit -> unit + default this.M() = printfn "Im a default implementation" + +let res = { new AbstractClass() with + override this.ToString() = "ConcreteMethod" } + """ + |> withLangVersion90 + |> typecheck + |> shouldSucceed + + [] + let ``Object expression can not implement an abstract class having abstract members`` () = + Fsx """ +[] +type AbstractClass() = + do printfn "AbstractClass constructor" + abstract member M : unit -> unit + +let res = { new AbstractClass() } + """ + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 365, Line 7, Col 11, Line 7, Col 34, "No implementation was given for 'abstract AbstractClass.M: unit -> unit'"); + (Error 738, Line 7, Col 11, Line 7, Col 34, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces.") + ] + + [] + let ``Object expression can implement an abstract class and interface having no abstract members.`` () = + Fsx """ +type IFirst = interface end + +[] +type MyClass() = class end + +{ new MyClass() with + member x.ToString() = "OK" + + interface IFirst } |> ignore + """ + |> withLangVersion90 + |> typecheck + |> shouldSucceed + + [] + let ``Object expression shows error when object expression does not implement all abstract members of the abstract class`` () = + Fsx """ +type ISecond = + abstract member M : unit -> unit + +[] +type MyClass() = + abstract member M : unit -> unit + interface ISecond with + member this.M() = printfn "It works" + +let res = { new MyClass() } + """ + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 365, Line 11, Col 11, Line 11, Col 28, "No implementation was given for 'abstract MyClass.M: unit -> unit'"); + (Error 738, Line 11, Col 11, Line 11, Col 28, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces.") + ] + + [] + let ``C# abstract class with protected constructor can not be implemented by F# object expression`` () = + + let csharp = + CSharp + """ +namespace CSLib +{ + using System; + public abstract class Animal + { + protected Animal() + { + Console.WriteLine("Animal is created"); + } + } +} +""" + |> withName "CSLib" + + let fsharp = + FSharp + """ +module FSLib +open CSLib + +let res = { new Animal() } +""" + |> withLangVersion90 + |> withName "FSLib" + |> withReferences [ csharp ] + + fsharp + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 738, Line 5, Col 11, Line 5, Col 27, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces.") + ] + + [] + let ``C# abstract class with protected constructor and abstract method and default implementation can be implemented by F# object expression unless the abstract method is implemented.`` () = + let csharp = + CSharp + """ +namespace CSLib +{ + using System; + public abstract class Animal + { + protected Animal() + { + Console.WriteLine("Animal is created"); + } + + public abstract void M(); + } +} +""" + |> withName "CSLib" + + let fsharp = + FSharp + """ +module FSLib +open CSLib + +let res = { new Animal() } +""" + |> withLangVersion90 + |> withName "FSLib" + |> withReferences [ csharp ] + + fsharp + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 365, Line 5, Col 11, Line 5, Col 27, "No implementation was given for 'Animal.M() : unit'"); + (Error 738, Line 5, Col 11, Line 5, Col 27, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces.") + ] + + [] + let ``C# abstract class with protected constructor and abstract method can not be implemented by F# object expression unless the abstract method is implemented.`` () = + let csharp = + CSharp + """ +namespace CSLib +{ + using System; + public abstract class Animal + { + protected Animal() + { + Console.WriteLine("Animal is created"); + } + + public abstract void M(); + } +} +""" + |> withName "CSLib" + + let fsharp = + FSharp + """ +module FSLib +open CSLib + +let res = { new Animal() } +""" + |> withLangVersion90 + |> withName "FSLib" + |> withReferences [ csharp ] + + fsharp + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 365, Line 5, Col 11, Line 5, Col 27, "No implementation was given for 'Animal.M() : unit'"); + (Error 738, Line 5, Col 11, Line 5, Col 27, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces.") + ] + + [] + let ``Error when object expression does not implement all abstract members of the abstract class`` () = + Fsx """ +[] +type B() = + abstract M : int -> float + abstract M : string -> unit +and [] + C() = + inherit B() + static let v = { new C() with + member x.M(a:int) : float = 1.0 } + default x.M(a:int) : float = 1.0 + +let y = { new C() with + member x.M(a:int) : float = 1.0 } """ - |> withLangVersion80 + |> withLangVersion90 |> typecheck |> shouldFail |> withDiagnostics [ - (Error 759, Line 5, Col 13, Line 5, Col 22, "Instances of this type cannot be created since it has been marked abstract or not all methods have been given implementations. Consider using an object expression '{ new ... with ... }' instead."); - (Error 738, Line 5, Col 11, Line 5, Col 24, "Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces.") - (Error 740, Line 5, Col 11, Line 5, Col 24, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") - ] + (Error 365, Line 9, Col 20, Line 10, Col 60, "No implementation was given for 'abstract B.M: string -> unit'") + (Error 365, Line 13, Col 9, Line 14, Col 49, "No implementation was given for 'abstract B.M: string -> unit'") + ] + + [] + let ``Error when object expression does not implement all abstract members of a generic abstract class`` () = + Fsx """ +[] +type BaseHashtable<'Entry, 'Key>(initialCapacity) = + abstract member Next : entries : 'Entry array -> int + +[] +type StrongToWeakEntry<'Value when 'Value : not struct> = + val mutable public next : int + +let f() = { new BaseHashtable<_,_>(2) with + override this.Next (entries:StrongToWeakEntry<_> array) = 1 + override this.Next entries = 1 + } + """ + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 359, Line 10, Col 11, Line 13, Col 12, "More than one override implements 'Next: StrongToWeakEntry<'a> array -> int when 'a: not struct'") + ] [] - let ``Object expression can not implementing an interface when it contains a method with no types that can refer to the type for which the implementation is being used`` () = + let ``Object expression cannot implement an interface when it contains a method with no types that can refer to the type for which the implementation is being used`` () = Fsx """ type AsString = abstract member asString: unit -> string @@ -113,7 +504,7 @@ let implSomeDU = | B b -> b | C c -> string c} """ - |> withLangVersion80 + |> withLangVersion90 |> typecheck |> shouldFail |> withDiagnostics [ @@ -153,7 +544,7 @@ let implementer() = member this.F() = () member this.G() = () } """ - |> withLangVersion80 + |> withLangVersion90 |> typecheck |> shouldSucceed @@ -171,7 +562,7 @@ let objExpr = member this.Execute1() = false member this.Property = 0 } """ - |> withLangVersion80 + |> withLangVersion90 |> typecheck |> shouldSucceed @@ -188,7 +579,7 @@ let objExpr = member _.Execute2() = () } """ |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] - |> withLangVersion80 + |> withLangVersion90 |> typecheck |> shouldFail |> withDiagnostics [ @@ -211,7 +602,7 @@ let _ = } """ |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] - |> withLangVersion80 + |> withLangVersion90 |> typecheck |> shouldFail |> withDiagnostics [ @@ -233,7 +624,7 @@ let _ = } """ |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] - |> withLangVersion80 + |> withLangVersion90 |> typecheck |> shouldFail |> withDiagnostics [ @@ -260,7 +651,7 @@ let _ = } """ |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] - |> withLangVersion80 + |> withLangVersion90 |> typecheck |> shouldFail |> withDiagnostics [ @@ -285,7 +676,7 @@ let consoleLogger = consoleLogger.Log("Hello World") """ |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] - |> withLangVersion80 + |> withLangVersion90 |> compile |> shouldFail |> withSingleDiagnostic (Error 3860, Line 7, Col 11, Line 7, Col 18, "Object expressions cannot implement interfaces with static abstract members or declare static members.") @@ -307,7 +698,7 @@ let consoleLogger = consoleLogger.Log("Hello World") """ |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] - |> withLangVersion80 + |> withLangVersion90 |> compile |> shouldFail |> withSingleDiagnostic (Error 3860, Line 8, Col 11, Line 8, Col 18, "Object expressions cannot implement interfaces with static abstract members or declare static members.") @@ -328,7 +719,7 @@ let consoleLogger = consoleLogger.Log("Hello World") """ - |> withLangVersion80 + |> withLangVersion90 |> compileExeAndRun |> shouldSucceed @@ -359,3 +750,284 @@ Please restrict it to one of the following: (Error 358, Line 8, Col 19, Line 8, Col 29, "The override for 'Overloaded: string -> bool' was ambiguous") (Error 783, Line 7, Col 11, Line 7, Col 19, "At least one override did not correctly implement its corresponding abstract member") ] + +module AllowObjectExpressionWithoutOverrides = + [] + let ``Object expression can implement a class class end`` () = + Fsx """ +type Class() = class end + +let implementer = { new Class() } + """ + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + + [] + let ``Object expression can implement a class without members`` () = + Fsx """ +type Class() = + member this.Do() = () + +let implementer = { new Class() } + """ + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + + [] + let ``Object expression cannot implement unnamed interface`` () = + Fsx """ +type IFirst = + abstract member MyMember: unit -> int + +let x = { new _ with member this.MyMember() = 42 } + """ + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 772, Line 5, Col 11, Line 5, Col 16, "'new' must be used with a named type") + ] + + [] + let ``Verifies that the object expression built type has the interface`` () = + Fsx """ +type IFirst = interface end + +type ISecond = + abstract member M : unit -> unit + +[] +type MyClass() = + interface ISecond with + member this.M() = printfn "It works" + +let expr = { new MyClass() } +(expr:> ISecond).M() + """ + |> withLangVersionPreview + |> compileExeAndRun + |> shouldSucceed + |> withStdOutContainsAllInOrder [ + "It works" + ] + + [] + let ``Object expression implementing an interface without members`` () = + Fsx """ +type IFirst = interface end + +let implementer() ={ new IFirst } + """ + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + + [] + let ``Object expression can implement an abstract class having abstract members with default implementation`` () = + Fsx """ +[] +type AbstractClass() = + abstract member M : unit -> unit + default this.M() = printfn "Im a default implementation" + +let res = { new AbstractClass() } + """ + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + + [] + let ``Object expression can implement an abstract class(overriding a member) having abstract members with default implementation`` () = + Fsx """ +[] +type AbstractClass() = + abstract member M : unit -> unit + default this.M() = printfn "Im a default implementation" + +let res = { new AbstractClass() with + override this.ToString() = "ConcreteMethod" } + """ + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + + [] + let ``Object expression can implement an abstract class with a protected constructor`` () = + Fsx """ +[] +type AbstractClass() = + do printfn "AbstractClass constructor" + +let res = { new AbstractClass() } + """ + |> withLangVersionPreview + |> compileExeAndRun + |> withStdOutContainsAllInOrder [ + "AbstractClass constructor" + ] + + [] + let ``Object expression can not implement an abstract class having abstract members, unless the abstract members are implemented`` () = + Fsx """ +[] +type AbstractClass() = + do printfn "AbstractClass constructor" + abstract member M : unit -> unit + +let res = { new AbstractClass() } + """ + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 365, Line 7, Col 11, Line 7, Col 34, "No implementation was given for 'abstract AbstractClass.M: unit -> unit'") + ] + + [] + let ``Object expression can implement an abstract class having no abstract members, only if the object expression has an override`` () = + Fsx """ +[] +type Foo() = class end + +let foo = { new Foo() } + +let foo2 = { new Foo() with member __.ToString() = base.ToString() } + """ + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + + [] + let ``Object expression can not implement an abstract class and interface having no abstract members`` () = + Fsx """ +type IFirst = interface end + +[] +type MyClass() = class end + +{ new MyClass() with + member x.ToString() = "OK" + + interface IFirst } |> ignore + """ + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + + [] + let ``Object expression can implement an abstract class having no abstract members. But trying to instantiate an abstract class will fail`` () = + Fsx """ +[] +type Foo() = class end + +let foo = { new Foo() } + +let foo1 = new Foo() + """ + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 759, Line 7, Col 12, Line 7, Col 21, "Instances of this type cannot be created since it has been marked abstract or not all methods have been given implementations. Consider using an object expression '{ new ... with ... }' instead.") + ] + + [] + let ``Object expression shows error when object expression does not implement all abstract members of the abstract class`` () = + Fsx """ +type ISecond = + abstract member M : unit -> unit + +[] +type MyClass() = + abstract member M : unit -> unit + interface ISecond with + member this.M() = printfn "It works" + +let res = { new MyClass() } + """ + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 365, Line 11, Col 11, Line 11, Col 28, "No implementation was given for 'abstract MyClass.M: unit -> unit'") + ] + + [] + let ``C# abstract class with protected constructor can be implemented by F# object expression`` () = + + let csharp = + CSharp + """ +namespace CSLib +{ + using System; + public abstract class Animal + { + protected Animal() + { + Console.WriteLine("Animal is created"); + } + } +} +""" + |> withName "CSLib" + + let fsharp = + FSharp + """ +module FSLib +open CSLib + +let res = { new Animal() } +""" + |> withLangVersionPreview + |> withName "FSLib" + |> withReferences [ csharp ] + + fsharp + |> compile + |> shouldSucceed + + [] + let ``C# abstract class with protected constructor and abstract method can not be implemented by F# object expression unless the abstract method is implemented`` () = + + let csharp = + CSharp + """ +namespace CSLib +{ + using System; + public abstract class Animal + { + protected Animal() + { + Console.WriteLine("Animal is created"); + } + + public abstract void M(); + } +} +""" + |> withName "CSLib" + + let fsharp = + FSharp + """ +module FSLib +open CSLib + +let res = { new Animal() } +""" + |> withLangVersionPreview + |> withName "FSLib" + |> withReferences [ csharp ] + + fsharp + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 365, Line 5, Col 11, Line 5, Col 27, "No implementation was given for 'Animal.M() : unit'") + ] + \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_CustomEqualityEquals01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_CustomEqualityEquals01.fs index 47f3a2893ce..f5dfa111e86 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_CustomEqualityEquals01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_CustomEqualityEquals01.fs @@ -3,9 +3,9 @@ // Make sure F# compiler emits an error message when Record, Union, Struct types override default System.Object.Equals() // without explicitly specifying CustomEquality attribute -//The struct, record or union type 'R' has an explicit implementation of 'Object\.GetHashCode' or 'Object\.Equals'\. You must apply the 'CustomEquality' attribute to the type -//The struct, record or union type 'U' has an explicit implementation of 'Object\.GetHashCode' or 'Object\.Equals'\. You must apply the 'CustomEquality' attribute to the type -//The struct, record or union type 'S' has an explicit implementation of 'Object\.GetHashCode' or 'Object\.Equals'\. You must apply the 'CustomEquality' attribute to the type + + + #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_CustomEqualityGetHashCode01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_CustomEqualityGetHashCode01.fs index 31bb29dd936..329a2aa5bc9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_CustomEqualityGetHashCode01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/E_CustomEqualityGetHashCode01.fs @@ -3,9 +3,9 @@ // Make sure F# compiler emits an error message when Record, Union, Struct types override default System.Object.GetHashCode() // without explicitly specifying CustomEquality attribute -//The struct, record or union type 'R' has an explicit implementation of 'Object\.GetHashCode' or 'Object\.Equals'\. You must apply the 'CustomEquality' attribute to the type -//The struct, record or union type 'U' has an explicit implementation of 'Object\.GetHashCode' or 'Object\.Equals'\. You must apply the 'CustomEquality' attribute to the type -//The struct, record or union type 'S' has an explicit implementation of 'Object\.GetHashCode' or 'Object\.Equals'\. You must apply the 'CustomEquality' attribute to the type + + + #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/W_ImplIComparable.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/W_ImplIComparable.fs index 5072d2665c5..f62da35a5b4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/W_ImplIComparable.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/W_ImplIComparable.fs @@ -2,8 +2,8 @@ // Verify warning when implementing IComparable on structs / classes // See FSB 2653 -//The type 'S' implements 'System\.IComparable'\. Consider also adding an explicit override for 'Object\.Equals' -//The type 'C' implements 'System\.IComparable' explicitly but provides no corresponding override for 'Object\.Equals'\. An implementation of 'Object\.Equals' has been automatically provided, implemented via 'System\.IComparable'\. Consider implementing the override 'Object\.Equals' explicitly + + [] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefAsGenericArgument01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefAsGenericArgument01.fs index e606b9793be..4da2e1ceabf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefAsGenericArgument01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefAsGenericArgument01.fs @@ -4,6 +4,6 @@ // Verify error when trying to use a byref<_> as generic argument. // (Disallowed by CLR.) -//A type instantiation involves a byref type\. This is not permitted by the rules of Common IL\.$ + let test : byref list = [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda01.fs index 1a2d9b05aa9..90819509222 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda01.fs @@ -2,7 +2,7 @@ // Verify that byref values may not escape into inner lambdas. // (Disallowed by the CLR.) -//The byref-typed variable 'byrefValue' is used in an invalid way\. Byrefs cannot be captured by closures or passed to inner functions\.$ + let testFunction() = let mutable x = 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda02.fs index bf0c04cdeac..ef9a349d0da 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda02.fs @@ -2,8 +2,8 @@ // Verify that byref values may not escape into inner lambdas. // (Disallowed by the CLR.) -//The byref-typed variable 'byrefValue' is used in an invalid way\. Byrefs cannot be captured by closures or passed to inner functions\.$ -//The byref-typed variable 'byrefValue' is used in an invalid way\. Byrefs cannot be captured by closures or passed to inner functions\.$ + + let testFunction() = let mutable x = 0 let byrefValue = &x diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda03.fs index d2f4ac930a6..dad0c477b17 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInInnerLambda03.fs @@ -2,7 +2,7 @@ // Verify that byref values may not escape into inner lambdas. // (Disallowed by the CLR.) // This test is currently emitting 2 copies of the same error message due to a known bug -//The byref-typed variable 'byrefValue' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions\.$ + let testFunction() = let mutable x = 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInQuotation01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInQuotation01.fs index 88b04ed0ae3..dc4699c99ab 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInQuotation01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_ByrefUsedInQuotation01.fs @@ -1,8 +1,8 @@ // #Regression #Conformance #TypeInference #ByRef // Attempt to use a byref in a quotation -//A type instantiation involves a byref type\. This is not permitted by the rules of Common IL\.$ -//The address of the variable 'i' cannot be used at this point$ -//A type instantiation involves a byref type\. This is not permitted by the rules of Common IL\.$ + + + open Microsoft.FSharp.Quotations diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_FirstClassFuncTakesByref.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_FirstClassFuncTakesByref.fs index 0040072a6bc..84a89e6502e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_FirstClassFuncTakesByref.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_FirstClassFuncTakesByref.fs @@ -1,5 +1,5 @@ // #Regression #Conformance #TypeInference #ByRef -//This expression was expected to have type. 'byref<'a>' .but here has type. 'int ref' + let f (x : byref<'a>) = () let z1 = f diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref01.fs index 50170740ad1..a26b8a618fb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref01.fs @@ -4,8 +4,8 @@ // Verify error when setting object field to a byref value. // (This is disallowed by the CLR.) -//A type would store a byref typed value\. This is not permitted by Common IL\.$ -//A type instantiation involves a byref type\. This is not permitted by the rules of Common IL\.$ + + type Foo() = let mutable m_byrefOpt : byref option = None diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref02.fs index 00d46db478f..2a55295c347 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref02.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #TypeInference #ByRef // Verify you cannot set an object field to store a byref value -//A byref typed value would be stored here\. Top-level let-bound byref values are not permitted + module ModuleFoo = let mutable x = 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref03.fs index a5abefae229..d15ca81386e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref03.fs @@ -2,8 +2,8 @@ // Verify appropriate error if attempting to assign a ByRef value to an // object field. (Disallowed by the CLR.) -//A type would store a byref typed value\. This is not permitted by Common IL\.$ -//A type instantiation involves a byref type\. This is not permitted by the rules of Common IL\.$ + + type RecordWithByref = {A : byref } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref04.fs index f192ad47c26..14b03d62293 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref04.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref04.fs @@ -2,9 +2,9 @@ // Verify appropriate error if attempting to assign a ByRef value to an // object field. (Disallowed by the CLR.) -//A type instantiation involves a byref type\. This is not permitted by the rules of Common IL\.$ -//The address of the variable 'x' cannot be used at this point$ -//A type instantiation involves a byref type\. This is not permitted by the rules of Common IL\.$ + + + let mutable mutableObjectField : obj = null // Set mutableObjectField to a byref (cast to Object) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref05.fs index c91ab2d64f4..629b6423176 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref05.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/E_SetFieldToByref05.fs @@ -2,8 +2,8 @@ // Verify appropriate error if attempting to assign a ByRef value to an // object field. (Disallowed by the CLR.) -//A type would store a byref typed value\. This is not permitted by Common IL\.$ -//A type instantiation involves a byref type\. This is not permitted by the rules of Common IL\.$ + + type DUWithByref = | A of int * byref diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_CyclicReference01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_CyclicReference01.fs index eca58f55bb7..dd82ad25185 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_CyclicReference01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_CyclicReference01.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #TypeInference #Recursion // FS1 952, VS crash due to bad recursive type definition -//This type definition involves an immediate cyclic reference through an abbreviation$ -//This expression was expected to have type. 'bogusType' .but here has type. 'Map<'a,'b>' + + type bogusType = (int, bogusType) Map diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_DuplicateRecursiveRecords.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_DuplicateRecursiveRecords.fs index 186da1ffb48..a255b4a31b5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_DuplicateRecursiveRecords.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_DuplicateRecursiveRecords.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #TypeInference #Recursion // Regression for FSHARP1.0:5601 // ICE when compiling code with duplicate record type defined recursively -//Duplicate definition of type, exception or module 'Foo' + type Foo = { Name: string; diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_RecursiveInline.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_RecursiveInline.fs index 947bfc49e0a..1330d9e4d3c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_RecursiveInline.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_RecursiveInline.fs @@ -1,9 +1,9 @@ // #Regression #Conformance #TypeInference #Recursion // Regression test for FSharp1.0:3475 - ICE on rec inline function -//The value 'E_RecursiveInline.test' was marked inline but was not bound in the optimization environment -//The value 'test' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible$ -//A value marked as 'inline' has an unexpected value -//Failed to inline the value 'test' marked 'inline', perhaps because a recursive value was marked 'inline' + + + + let rec inline test x = if x then test false else 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_TypeDeclaration01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_TypeDeclaration01.fs index 4572923e75e..c4cb0e79e86 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_TypeDeclaration01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_TypeDeclaration01.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #TypeInference #Recursion // Regression test for FSharp1.0:3187 -// Title: better inference for mutually recursrive generic classes +// Title: better inference for mutually recursive generic classes // Descr: Verify types are inferred correctly for generic classes //This expression was expected to have type diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_TypeDeclaration02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_TypeDeclaration02.fs index d49be3f590c..f2848b95ba7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_TypeDeclaration02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_TypeDeclaration02.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #TypeInference #Recursion // Regression test for FSharp1.0:5423 -// Title: code sample stack overflow from fsc.exe and brings down VS2008 intelisense +// Title: code sample stack overflow from fsc.exe and brings down VS2008 intellisense //This expression was expected to have type //The type 'myint<'d>' is not compatible with the type 'SfsIntTerm<'a>' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_VariationsOnRecursiveStruct.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_VariationsOnRecursiveStruct.fs index 7b84045766f..252c6db4c56 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_VariationsOnRecursiveStruct.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/E_VariationsOnRecursiveStruct.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #TypeInference #Recursion // Regression test for FSharp1.0:4275 - still allowing variations on recursive structs -//This type definition involves an immediate cyclic reference through a struct field or inheritance relation + [] type S2 (def : S2) = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/InfiniteRecursiveExplicitConstructor.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/InfiniteRecursiveExplicitConstructor.fs index 3e211b55ba7..56d368f43a5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/InfiniteRecursiveExplicitConstructor.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/InfiniteRecursiveExplicitConstructor.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #TypeInference #Recursion // Regression test for FSHARP1.0:3541 -// PEVerification failure with infinite recursion in explict constructor -// Note: as per Don's comment in 3541, we shoudl NOT disallow recursive call of own constructor +// PEVerification failure with infinite recursion in explicit constructor +// Note: as per Don's comment in 3541, we should NOT disallow recursive call of own constructor #light open System diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveSafetyAnalysis.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveSafetyAnalysis.fs index 9b9beecfdb0..52bf8601869 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveSafetyAnalysis.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveSafetyAnalysis.fs @@ -49,7 +49,7 @@ module RecursiveSafetyAnalysis = (Error 1114, Line 8, Col 15, Line 8, Col 25, "The value 'E_RecursiveInline.test' was marked inline but was not bound in the optimization environment") (Error 1113, Line 7, Col 16, Line 7, Col 20, "The value 'test' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible") (Warning 1116, Line 8, Col 15, Line 8, Col 25, "A value marked as 'inline' has an unexpected value") - (Warning 1118, Line 8, Col 15, Line 8, Col 25, "Failed to inline the value 'test' marked 'inline', perhaps because a recursive value was marked 'inline'") + (Error 1118, Line 8, Col 15, Line 8, Col 25, "Failed to inline the value 'test' marked 'inline', perhaps because a recursive value was marked 'inline'") ] // SOURCE=E_TypeDeclaration01.fs SCFLAGS="--langversion:5.0 --test:ErrorRanges" COMPILE_ONLY=1 # E_TypeDeclaration01.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveTypeDeclarations02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveTypeDeclarations02.fs index f838e55e103..b1e2087c30d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveTypeDeclarations02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveTypeDeclarations02.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #TypeInference #Recursion // Regression test for FSharp1.0:3187 -// Title: better inference for mutually recursrive generic classes +// Title: better inference for mutually recursive generic classes // Descr: Verify types are inferred correctly for generic classes module OO_Example_Example1 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/ByteStrings.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/ByteStrings.fs new file mode 100644 index 00000000000..b3469959680 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/ByteStrings.fs @@ -0,0 +1,133 @@ +module Conformance.LexicalAnalysis.ByteStrings + +open Xunit +open FSharp.Test.Compiler + +/// `'%s' is not a valid character literal.` with note about wrapped value and error soon +let private invalidCharWarningMsg value wrapped = + FSComp.SR.lexInvalidCharLiteralInString (value, wrapped) + |> snd + +/// `This byte array literal contains %d characters that do not encode as a single byte` +let private invalidTwoByteErrorMsg count = + FSComp.SR.lexByteArrayCannotEncode (count) + |> snd + +/// `This byte array literal contains %d non-ASCII characters.` +let private invalidAsciiWarningMsg count = + FSComp.SR.lexByteArrayOutisdeAscii (count) + |> snd + +[] +let ``Decimal char > 255 is not valid``() = + Fs """ +// Ω +let _ = "\837"B + """ + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 1252, Line 3, Col 10, Line 3, Col 14, invalidCharWarningMsg "\\837" "\\069") + +[] +let ``Decimal char between 128 and 256 is not valid``() = + Fs """ +// ú +let _ = "\250"B + """ + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 1253, Line 3, Col 9, Line 3, Col 16, invalidAsciiWarningMsg 1) + +[] +let ``Decimal char < 128 is valid``() = + Fs """ +let _ = "a\097"B + """ + |> typecheck + |> shouldSucceed + +[] +let ``In verbatim string: \937 is valid and not parsed as single char``() = + Fs """ +if @"\937"B <> "\\937"B then failwith "should not be trigraph" + """ + |> compileExeAndRun + |> shouldSucceed + + +[] +let ``Values in different notations are invalid above 127``() = + Fs """ +[ + "ú"B + "\128"B + "\x80"B + "\u0080"B + "\U00000080"B +] +|> ignore + """ + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 1253, Line 3, Col 5, Line 3, Col 9, invalidAsciiWarningMsg 1) + (Warning 1253, Line 4, Col 5, Line 4, Col 12, invalidAsciiWarningMsg 1) + (Warning 1253, Line 5, Col 5, Line 5, Col 12, invalidAsciiWarningMsg 1) + (Warning 1253, Line 6, Col 5, Line 6, Col 14, invalidAsciiWarningMsg 1) + (Warning 1253, Line 7, Col 5, Line 7, Col 18, invalidAsciiWarningMsg 1) + ] + +[] +let ``Error messages for different notations only span invalid notation``() = + Fs """ +"ok:\061;err:\837;err:\U12345678;err:\U00005678;fin"B +|> printfn "%A" + """ + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 1245, Line 2, Col 23, Line 2, Col 33, "\\U12345678 is not a valid Unicode character escape sequence") + + + // Note: Error for `\U00005678` spans full byte string: + // Is a valid char, but two bytes -> not valid inside byte string + // But check for correct byte happens after string is finished + // (because `B` suffix -> only know at end if it's a byte string) + // -> Don't have direct access to range of invalid char any more + (Error 1140, Line 2, Col 1, Line 2, Col 54,invalidTwoByteErrorMsg 1) + + (Warning 1252, Line 2, Col 14, Line 2, Col 18, invalidCharWarningMsg "\\837" "\\069") + ] + +[] +let ``Decimal char > 255 and > 128 after wrapping triggers two diagnostics``() = + // Currently `\937` trigger TWO diags: + // * Invalid trigraph which gets wrapped -> warning spanning just trigraph + // * Wrapped char is still >= 128 (but < 256) -> warning spanning full byte string + // Those two are checked at different locations (trigraph: while parsing trigraph; 2-byte char: after Byte string was parsed) + // with different infos available (trigraph: trigraph, but don't know if string or byte string; 2-byte-char: byte string, but don't know source notation) + // -> both diags get emitted! + // + // Should be resolved once invalid trigraph gets promoted to error. + Fs """ +// Ω +let _ = "\937"B + """ + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 1252, Line 3, Col 10, Line 3, Col 14, invalidCharWarningMsg "\\937" "\\169") + (Warning 1253, Line 3, Col 9, Line 3, Col 16, invalidAsciiWarningMsg 1) + ] + +[] +let ``Emit both Error and Warning with correct count``() = + Fs """ +let _ = "Ω --- Ω\169 --- Ωä --- Ωü --- Ω"B + """ + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 1140, Line 2, Col 9, Line 2, Col 44,invalidTwoByteErrorMsg 5) + (Warning 1253, Line 2, Col 9, Line 2, Col 44, invalidAsciiWarningMsg 3) + ] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/CharByteLiterals.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/CharByteLiterals.fs new file mode 100644 index 00000000000..87f895709c7 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/CharByteLiterals.fs @@ -0,0 +1,119 @@ +module Conformance.LexicalAnalysis.CharByteLiterals + +open Xunit +open FSharp.Test.Compiler + +/// `This is not a valid ASCII byte literal. Value should be < 128y.` with note that error soon +let private invalidTrigraphCharWarningMsg = + FSComp.SR.lexInvalidTrigraphAsciiByteLiteral () + |> snd + +[] +let ``all byte char notations pass type check`` () = + Fs """ +[ + 'a'B + '\097'B + '\x61'B + '\u0061'B + '\U00000061'B +] +|> ignore + """ + |> typecheck + |> shouldSucceed + +[] +let ``all byte char notations produce correct value``() = + Fs """ +let chars = [ + 'a'B + '\097'B + '\x61'B + '\u0061'B + '\U00000061'B +] +let expected = 97uy +chars +|> List.iteri (fun i actual -> if actual <> expected then failwithf "[%i]: Expected %A, but was %A" i expected actual) + """ + |> compileExeAndRun + |> shouldSucceed + +[] +let ``byte value > 128uy fails in all char notations``() = + Fs """ +[ + 'ú'B + '\250'B + '\xFA'B + '\u00FA'B + '\U000000FA'B +] +|> ignore + """ + |> typecheck + |> withDiagnostics [ + (Error 1157, Line 3, Col 5, Line 3, Col 9, "This is not a valid byte character literal. The value must be less than or equal to '\\127'B.") + (Error 1157, Line 5, Col 5, Line 5, Col 12, "This is not a valid byte character literal. The value must be less than or equal to '\\127'B.") + (Error 1157, Line 6, Col 5, Line 6, Col 14, "This is not a valid byte character literal. The value must be less than or equal to '\\127'B.") + (Error 1157, Line 7, Col 5, Line 7, Col 18, "This is not a valid byte character literal. The value must be less than or equal to '\\127'B.") + + (Warning 1157, Line 4, Col 5, Line 4, Col 12, invalidTrigraphCharWarningMsg) + ] + +[] +let ``127uy typechecks in char notations``() = + Fs """ +[ + // DELETE -> no direct char representation + '\127'B + '\x7F'B + '\u007F'B + '\U0000007F'B +] +|> ignore + """ + |> typecheck + |> shouldSucceed +[] +let ``128uy fails typecheck in char notations``() = + Fs """ +[ + // Padding Character -> no direct char representation + '\128'B + '\x80'B + '\u0080'B + '\U00000080'B +] +|> ignore + """ + |> typecheck + |> withDiagnostics [ + (Error 1157, Line 5, Col 5, Line 5, Col 12, "This is not a valid byte character literal. The value must be less than or equal to '\\127'B.") + (Error 1157, Line 6, Col 5, Line 6, Col 14, "This is not a valid byte character literal. The value must be less than or equal to '\\127'B.") + (Error 1157, Line 7, Col 5, Line 7, Col 18, "This is not a valid byte character literal. The value must be less than or equal to '\\127'B.") + + (Warning 1157, Line 4, Col 5, Line 4, Col 12, invalidTrigraphCharWarningMsg) + ] + +[] +let ``value out of byte range fails in char notations``() = + Fs """ +[ + 'β'B + '\946'B + // requires more than 2 digits -> no decimal representation + '\u03B2'B + '\U000003B2'B +] +|> ignore + """ + |> typecheck + |> withDiagnostics [ + (Error 1157, Line 3, Col 5, Line 3, Col 9, "This is not a valid byte character literal. The value must be less than or equal to '\\127'B.") + (Error 1157, Line 4, Col 5, Line 4, Col 12, "This is not a valid byte character literal. The value must be less than or equal to '\\127'B.") + + (Error 1157, Line 6, Col 5, Line 6, Col 14, "This is not a valid byte character literal. The value must be less than or equal to '\\127'B.") + (Error 1157, Line 7, Col 5, Line 7, Col 18, "This is not a valid byte character literal. The value must be less than or equal to '\\127'B.") + ] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/NumericLiterals.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/NumericLiterals.fs index 52c9daf49da..c2cc87b426c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/NumericLiterals.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/NumericLiterals.fs @@ -114,7 +114,7 @@ module NumericLiterals = |> ignore // This test was automatically generated (moved from FSharpQA suite - Conformance/LexicalAnalysis/NumericLiterals) - //Literal enumerations must have type int, uint, int16, uint16, int64, uint64, byte, sbyte or char + [] let ``NumericLiterals - E_enumNegativeLiterals009_fs - --test:ErrorRanges`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/Strings.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/Strings.fs new file mode 100644 index 00000000000..28922805ca3 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/Strings.fs @@ -0,0 +1,63 @@ +module Conformance.LexicalAnalysis.Strings + +open Xunit +open FSharp.Test.Compiler + +/// `'%s' is not a valid character literal.` with note about wrapped value and error soon +let private invalidCharWarningMsg value wrapped = + FSComp.SR.lexInvalidCharLiteralInString (value, wrapped) + |> snd + +[] +let ``Decimal char > 255 is not valid``() = + Fs """ +printfn "Ω\937" + """ + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 1252, Line 2, Col 11, Line 2, Col 15, invalidCharWarningMsg "\\937" "\\169") + +[] +let ``Decimal char between 128 and 256 is valid``() = + Fs """ +printfn "ú\250" + """ + |> typecheck + |> shouldSucceed + +[] +let ``Decimal char < 128 is valid``() = + Fs """ +printfn "a\097" + """ + |> typecheck + |> shouldSucceed + +[] +let ``In verbatim string: \937 is valid and not parsed as single char``() = + Fs """ +if @"\937" <> "\\937" then failwith "should not be trigraph" + """ + |> compileExeAndRun + |> shouldSucceed + +[] +let ``Error message for invalid decimal char contains only invalid trigraph``() = + Fs """ +printfn "foo\937bar" + """ + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 1252, Line 2, Col 13, Line 2, Col 17, invalidCharWarningMsg "\\937" "\\169") + +[] +let ``Error messages for different notations only span invalid notation``() = + Fs """ +printfn "ok:\061;err:\937;err:\U12345678;ok:\U00005678;fin" + """ + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 1245, Line 2, Col 31, Line 2, Col 41, "\\U12345678 is not a valid Unicode character escape sequence") + (Warning 1252, Line 2, Col 22, Line 2, Col 26, invalidCharWarningMsg "\\937" "\\169") + ] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/InfixTokenPlusOne.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/InfixTokenPlusOne.fs index 71069792981..8abf0b31e71 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/InfixTokenPlusOne.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/InfixTokenPlusOne.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #LexFilter #Exceptions #light -// FSB 1624, LexFilter should consifer infix tokens according to their length +// FSB 1624, LexFilter should consider infix tokens according to their length // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/E_IdentBoundTwice.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/E_IdentBoundTwice.fs index ae14b063a73..ba6cdf04019 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/E_IdentBoundTwice.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/E_IdentBoundTwice.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #PatternMatching #PatternMatchingGuards #light -//'x' is bound twice in this pattern + let test input = match input with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/E_consPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/E_consPattern01.fs index 26e6aff27b4..e0506e3f3af 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/E_consPattern01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/E_consPattern01.fs @@ -1,5 +1,5 @@ // #Regression #Conformance #PatternMatching -//This expression was expected to have type. 'int' .but here has type. ''a list' + // Verify that a '[]' is only valid at the end of a list in a cons pattern // This is OK. Type inference will pick up that this x is a generic list of lists. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamTyTestVarType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamTyTestVarType01.fs index bb9698f08c5..8f128598da0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamTyTestVarType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamTyTestVarType01.fs @@ -4,7 +4,7 @@ // Verify error associated with doing a dynamic type // test on a variable type. -//This runtime coercion or type test from type + // Error, x has type 'a and cannot be used in a dynamic type test. let f x = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamicTestPrimType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamicTestPrimType01.fs index 08240f6da0e..daf3586950a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamicTestPrimType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamicTestPrimType01.fs @@ -4,7 +4,7 @@ // Verify error when using a dynamic type test on // type without any proper sub types. -//The type 'int' does not have any proper subtypes and cannot be used as the source of a type test or runtime coercion + let test (x : int) = match x with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_RedundantPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_RedundantPattern01.fs index 5b31ed91546..ad6bc4de529 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_RedundantPattern01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_RedundantPattern01.fs @@ -3,8 +3,8 @@ // FSB 1488, Implement redundancy checking for dynamic type test patterns -//This rule will never be matched -//This rule will never be matched + + let _ = match box "3" with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_TypeTestWillAlwaysHold01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_TypeTestWillAlwaysHold01.fs index b4e8e83a785..ca6ea64491e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_TypeTestWillAlwaysHold01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_TypeTestWillAlwaysHold01.fs @@ -2,7 +2,7 @@ #light // Verify warning for when dynamic type test will always hold. -//This type test or downcast will always hold + type Foo() = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest03.fs index 46cfe11da48..6b643d04d97 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest03.fs @@ -56,7 +56,7 @@ let rec ageOneYear (l:IAge list) = if totalAge myStuff <> 30 then exit 1 ageOneYear myStuff -// (In this test, wine doesn't age, and cars 'grow older' doesn't incement age') +// (In this test, wine doesn't age, and cars 'grow older' doesn't increment age') if totalAge myStuff <> 31 then exit 2 exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/E_CounterExample01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/E_CounterExample01.fs index a21c10ff946..6c200dc3b4b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/E_CounterExample01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/E_CounterExample01.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #PatternMatching // Regression test for FSHARP1.0:2034 -//Incomplete pattern matches on this expression\. For example, the value '0' may indicate a case not covered by the pattern\(s\) + module TestModule let f x = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_whenGuards01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_whenGuards01.fs index bba3809ea50..11541227240 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_whenGuards01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_whenGuards01.fs @@ -4,7 +4,7 @@ module TestModule // Regression testcase for FSharp 1.0: 2070 // Warn on incomplete match with when guard -//Incomplete pattern matches on this expression\. For example, the value '1' may indicate a case not covered by the pattern\(s\)\. However, a pattern rule with a 'when' clause might successfully match this value + let matchWarning s = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/patterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/patterns01.fs index 92e27717e82..36a957ac766 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/patterns01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/patterns01.fs @@ -1,7 +1,7 @@ // #Conformance #PatternMatching #light -// Verify the first verticle bar in a pattern match is optinal. +// Verify the first vertical bar in a pattern match is optional. let test1 x = match x with "0" -> 0 | "1" -> 1 | _ -> -1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternNotAFuncion.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternNotAFunction.fs similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternNotAFuncion.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternNotAFunction.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns01.fs index 19bf8faee6c..c20b4fa442a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns01.fs @@ -1,13 +1,13 @@ // #Regression #Conformance #PatternMatching #ActivePatterns // Verify error if Active Patterns do not start with an upper case letter -//Active pattern case identifiers must begin with an uppercase letter -//Active pattern case identifiers must begin with an uppercase letter -//Active pattern case identifiers must begin with an uppercase letter -//Active pattern case identifiers must begin with an uppercase letter -//Active pattern case identifiers must begin with an uppercase letter -//The '\|' character is not permitted in active pattern case identifiers -//The '\|' character is not permitted in active pattern case identifiers -//Active pattern case identifiers must begin with an uppercase letter + + + + + + + + let (|positive|negative|) n = if n < 0 then positive else negative let (|`` A``|) (x:int) = x diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns02.fs index 50273c1058f..8fe994b2f3d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns02.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #PatternMatching #ActivePatterns // Verify error if Active Patterns used with named parameters -//A is an active pattern and cannot be treated as a discriminated union case with named fields. + let (|A|B|) n = if n%2 = 0 then A n else B n match 10 with A(hoho=n) -> n | _ -> 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns03.fs new file mode 100644 index 00000000000..6bbebdb858e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns03.fs @@ -0,0 +1,36 @@ +module ActivePatternSanityCHeckTests1 = begin + + let (|Foo|Bar|) x = "BAD DOG!" // expect: type string doesn't match type 'choice' + let (|Foo2|Bar2|_|) x = "BAD DOG!" // expect: invalid name for an active pattern + let (|Foo2b|Bar2b|Baz2b|_|) x = "BAD DOG!" // expect: type string doesn't match type 'choice' + let (|Foo3|_|) x = "BAD DOG!" // expect: type string doesn't match type 'option' + +end +module ActivePatternSanityCHeckTests2 = begin + + let (|Foo|Bar|) (a:int) x = "BAD DOG!" // expect: type string doesn't match type 'choice' + let (|Foo2|Bar2|_|) (a:int) x = "BAD DOG!" // expect: invalid name for an active pattern + let (|Foo2b|Bar2b|Baz2b|_|) (a:int) x = "BAD DOG!" // expect: type string doesn't match type 'choice' + let (|Foo3|_|) (a:int) x = "BAD DOG!" // expect: type string doesn't match type 'option' +end + +module ActivePatternSanityCHeckTests3 = begin + + let rec (|Foo|Bar|) (a:int) x = "BAD DOG!" // expect: type string doesn't match type 'choice' + let rec (|Foo2|Bar2|_|) (a:int) x = "BAD DOG!" // expect: invalid name for an active pattern + let rec (|Foo2b|Bar2b|Baz2b|_|) (a:int) x = "BAD DOG!" // expect: type string doesn't match type 'choice' + let rec (|Foo3|_|) (a:int) x = "BAD DOG!" // expect: type string doesn't match type 'option' + +end + +module ActivePatternIllegalPatterns = begin + + let (|``FooA++``|) (x:int) = x + let (``FooA++``(x)) = 10 + + let (|OneA|``TwoA+``|) (x:int) = if x = 0 then OneA else ``TwoA+`` + + let (|``FooB++``|_|) (x:int) = if x = 0 then Some(x) else None + let (``FooB++``(x)) = 10 + +end \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_LargeActivePat01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_LargeActivePat01.fs index d356af71baa..ca65356eff9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_LargeActivePat01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_LargeActivePat01.fs @@ -1,7 +1,18 @@ // #Regression #Conformance #PatternMatching #ActivePatterns // Verify error when defining an Active Pattern with more than seven 'values' // This is regression test for FSHARP1.0:3562 -//Active patterns cannot return more than 7 possibilities$ + let (|One|Two|Three|Four|Five|Six|Seven|Eight|) x = One +let (|A|B|C|D|E|F|G|H|) x = + match x with + | 0 -> A + | 1 -> B + | 2 -> C + | 3 -> D + | 4 -> E + | 5 -> F + | 6 -> G + | _ -> H + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_MulticasePartialNotAllowed01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_MulticasePartialNotAllowed01.fs index f1633373916..6eeb14906b9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_MulticasePartialNotAllowed01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_MulticasePartialNotAllowed01.fs @@ -2,7 +2,7 @@ // Regression test for FSHARP1.0:4621 // Multi case partial active patterns are not allowed -//This is not a valid name for an active pattern + //The pattern discriminator 'Sentence' is not defined let (|Sentence|Word|Punctuation|WhiteSpace|_|) (input : string) = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ParameterRestrictions01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ParameterRestrictions01.fs index c3e907519e3..1d3c6c0cf80 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ParameterRestrictions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ParameterRestrictions01.fs @@ -2,7 +2,7 @@ #light // Verify error cases for restrictions on active pattern parameters. -//Only active patterns returning exactly one result may accept arguments + // Multi-Case diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/MultiActivePatterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/MultiActivePatterns01.fs index 59b209a258d..35052aafdfe 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/MultiActivePatterns01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/MultiActivePatterns01.fs @@ -1,7 +1,7 @@ // #Conformance #PatternMatching #ActivePatterns #light -// Test ability to spedify multiple active patterns in the same pattern match +// Test ability to specify multiple active patterns in the same pattern match let (|A|_|) x = if x = 'A' then Some() else None let (|B|_|) x = if x = 'B' then Some() else None diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/Named.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/Named.fs index 5fa8cdc7aa8..8f7d5a12362 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/Named.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/Named.fs @@ -160,8 +160,8 @@ module Named = |> withSingleDiagnostic (Error 3174, Line 10, Col 24, Line 10, Col 25, "Active patterns do not have fields. This syntax is invalid.") // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] - let ``Named - E_ActivePatternNotAFuncion_fs - --test:ErrorRanges`` compilation = + [] + let ``Named - E_ActivePatternNotAFunction_fs - --test:ErrorRanges`` compilation = compilation |> asFs |> withOptions ["--test:ErrorRanges"] @@ -200,6 +200,76 @@ module Named = (Error 3210, Line 6, Col 15, Line 6, Col 24, "A is an active pattern and cannot be treated as a discriminated union case with named fields.") (Warning 20, Line 6, Col 1, Line 6, Col 38, "The result of this expression has type 'int' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.") ] + + [] + let ``Named - E_ActivePatterns03_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 1, Line 3, Col 8, Line 3, Col 17, "This expression was expected to have type + 'Choice<'a,'b>' +but here has type + 'string' ") + (Error 3872, Line 4, Col 8, Line 4, Col 21, "Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern."); + (Error 1, Line 4, Col 8, Line 4, Col 21, "This expression was expected to have type + 'Choice<'a,'b> option' +but here has type + 'string' ") + (Error 3872, Line 5, Col 8, Line 5, Col 29, "Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern."); + (Error 1, Line 5, Col 8, Line 5, Col 29, "This expression was expected to have type + 'Choice<'a,'b,'c> option' +but here has type + 'string' ") + (Error 1, Line 6, Col 8, Line 6, Col 16, "This expression was expected to have type + ''a option' +but here has type + 'string' ") + (Error 1, Line 11, Col 8, Line 11, Col 17, "This expression was expected to have type + 'Choice<'a,'b>' +but here has type + 'string' ") + (Error 3872, Line 12, Col 8, Line 12, Col 21, "Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern."); + (Error 1, Line 12, Col 8, Line 12, Col 21, "This expression was expected to have type + 'Choice<'a,'b> option' +but here has type + 'string' ") + (Error 3872, Line 13, Col 8, Line 13, Col 29, "Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern."); + (Error 1, Line 13, Col 8, Line 13, Col 29, "This expression was expected to have type + 'Choice<'a,'b,'c> option' +but here has type + 'string' ") + (Error 1, Line 14, Col 8, Line 14, Col 16, "This expression was expected to have type + ''a option' +but here has type + 'string' ") + (Error 1, Line 19, Col 12, Line 19, Col 21, "This expression was expected to have type + 'Choice<'a,'b>' +but here has type + 'string' ") + (Error 3872, Line 20, Col 12, Line 20, Col 25, "Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern."); + (Error 1, Line 20, Col 12, Line 20, Col 25, "This expression was expected to have type + 'Choice<'a,'b> option' +but here has type + 'string' ") + (Error 3872, Line 21, Col 13, Line 21, Col 34, "Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern."); + (Error 1, Line 21, Col 13, Line 21, Col 34, "This expression was expected to have type + 'Choice<'a,'b,'c> option' +but here has type + 'string' ") + (Error 1, Line 22, Col 12, Line 22, Col 20, "This expression was expected to have type + ''a option' +but here has type + 'string' ") + (Error 39, Line 29, Col 8, Line 29, Col 18, "The pattern discriminator 'FooA++' is not defined.") + (Warning 25, Line 29, Col 7, Line 29, Col 22, "Incomplete pattern matches on this expression.") + (Error 39, Line 31, Col 50, Line 31, Col 54, "The value or constructor 'OneA' is not defined.") + (Error 39, Line 31, Col 60, Line 31, Col 69, "The value or constructor 'TwoA+' is not defined.") + (Error 39, Line 34, Col 8, Line 34, Col 18, "The pattern discriminator 'FooB++' is not defined.") + (Warning 25, Line 34, Col 7, Line 34, Col 22, "Incomplete pattern matches on this expression.") + ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) [] @@ -223,7 +293,7 @@ module Named = |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail - |> withSingleDiagnostic (Error 1, Line 5, Col 9, Line 5, Col 30, "This expression was expected to have type + |> withSingleDiagnostic (Error 1, Line 5, Col 10, Line 5, Col 19, "This expression was expected to have type 'Choice<'a,'b>' but here has type 'string' ") @@ -236,7 +306,14 @@ but here has type |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail - |> withSingleDiagnostic (Error 827, Line 4, Col 9, Line 4, Col 34, "This is not a valid name for an active pattern") + |> withDiagnostics [ + (Error 3872, Line 4, Col 10, Line 4, Col 23, "Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern.") + (Error 1, Line 4, Col 10, Line 4, Col 23, "This expression was expected to have type + 'Choice<'a,'b> option' +but here has type + 'string' ") + ] + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) [] @@ -246,8 +323,14 @@ but here has type |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail - |> withSingleDiagnostic (Error 827, Line 4, Col 10, Line 4, Col 43, "This is not a valid name for an active pattern") - + |> withDiagnostics [ + (Error 3872, Line 4, Col 11, Line 4, Col 32, "Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern.") + (Error 1, Line 4, Col 11, Line 4, Col 32, "This expression was expected to have type + 'Choice<'a,'b,'c> option' +but here has type + 'string' ") + ] + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) [] let ``Named - E_Error_LetRec04_fs - --test:ErrorRanges`` compilation = @@ -256,7 +339,7 @@ but here has type |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail - |> withSingleDiagnostic (Error 1, Line 4, Col 9, Line 4, Col 29, "This expression was expected to have type + |> withSingleDiagnostic (Error 1, Line 4, Col 10, Line 4, Col 18, "This expression was expected to have type ''a option' but here has type 'string' ") @@ -269,7 +352,7 @@ but here has type |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail - |> withSingleDiagnostic (Error 1, Line 4, Col 5, Line 4, Col 18, "This expression was expected to have type + |> withSingleDiagnostic (Error 1, Line 4, Col 6, Line 4, Col 15, "This expression was expected to have type 'Choice<'a,'b>' but here has type 'string' ") @@ -282,7 +365,13 @@ but here has type |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail - |> withSingleDiagnostic (Error 827, Line 4, Col 5, Line 4, Col 22, "This is not a valid name for an active pattern") + |> withDiagnostics [ + (Error 3872, Line 4, Col 6, Line 4, Col 19, "Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern.") + (Error 1, Line 4, Col 6, Line 4, Col 19, "This expression was expected to have type + 'Choice<'a,'b> option' +but here has type + 'string' ") + ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) [] @@ -292,7 +381,13 @@ but here has type |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail - |> withSingleDiagnostic (Error 827, Line 4, Col 5, Line 4, Col 30, "This is not a valid name for an active pattern") + |> withDiagnostics [ + (Error 3872, Line 4, Col 6, Line 4, Col 27, "Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern.") + (Error 1, Line 4, Col 6, Line 4, Col 27, "This expression was expected to have type + 'Choice<'a,'b,'c> option' +but here has type + 'string' ") + ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) [] @@ -302,7 +397,7 @@ but here has type |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail - |> withSingleDiagnostic (Error 1, Line 4, Col 5, Line 4, Col 17, "This expression was expected to have type + |> withSingleDiagnostic (Error 1, Line 4, Col 6, Line 4, Col 14, "This expression was expected to have type ''a option' but here has type 'string' ") @@ -315,7 +410,7 @@ but here has type |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail - |> withSingleDiagnostic (Error 1, Line 4, Col 5, Line 4, Col 26, "This expression was expected to have type + |> withSingleDiagnostic (Error 1, Line 4, Col 6, Line 4, Col 15, "This expression was expected to have type 'Choice<'a,'b>' but here has type 'string' ") @@ -328,7 +423,13 @@ but here has type |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail - |> withSingleDiagnostic (Error 827, Line 4, Col 5, Line 4, Col 31, "This is not a valid name for an active pattern") + |> withDiagnostics [ + (Error 3872, Line 4, Col 6, Line 4, Col 19, "Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern.") + (Error 1, Line 4, Col 6, Line 4, Col 19, "This expression was expected to have type + 'Choice<'a,'b> option' +but here has type + 'string' ") + ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) [] @@ -339,7 +440,11 @@ but here has type |> typecheck |> shouldFail |> withDiagnostics [ - (Error 827, Line 4, Col 5, Line 4, Col 38, "This is not a valid name for an active pattern") + (Error 3872, Line 4, Col 6, Line 4, Col 27, "Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern.") + (Error 1, Line 4, Col 6, Line 4, Col 27, "This expression was expected to have type + 'Choice<'a,'b,'c> option' +but here has type + 'string' ") ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) @@ -351,7 +456,7 @@ but here has type |> typecheck |> shouldFail |> withDiagnostics [ - (Error 1, Line 4, Col 5, Line 4, Col 25, "This expression was expected to have type + (Error 1, Line 4, Col 6, Line 4, Col 14, "This expression was expected to have type ''a option' but here has type 'string' ") @@ -365,8 +470,10 @@ but here has type |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail - |> withSingleDiagnostic (Error 265, Line 6, Col 53, Line 6, Col 56, "Active patterns cannot return more than 7 possibilities") - + |> withDiagnostics [ + (Error 265, Line 6, Col 6, Line 6, Col 47, "Active patterns cannot return more than 7 possibilities") + (Error 265, Line 8, Col 6, Line 8, Col 23, "Active patterns cannot return more than 7 possibilities") + ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) [] @@ -377,15 +484,9 @@ but here has type |> typecheck |> shouldFail |> withDiagnostics [ - (Error 827, Line 8, Col 5, Line 8, Col 64, "This is not a valid name for an active pattern") - (Error 39, Line 20, Col 7, Line 20, Col 15, "The pattern discriminator 'Sentence' is not defined.") - (Error 72, Line 20, Col 25, Line 20, Col 37, "Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.") - (Error 39, Line 21, Col 7, Line 21, Col 11, "The pattern discriminator 'Word' is not defined.") - (Error 72, Line 21, Col 20, Line 21, Col 31, "Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.") - (Warning 49, Line 22, Col 7, Line 22, Col 17, "Uppercase variable identifiers should not generally be used in patterns, and may indicate a missing open declaration or a misspelt pattern name.") - (Error 39, Line 23, Col 7, Line 23, Col 18, "The pattern discriminator 'Punctuation' is not defined.") - (Warning 26, Line 23, Col 7, Line 23, Col 20, "This rule will never be matched") - (Warning 26, Line 24, Col 7, Line 24, Col 8, "This rule will never be matched") + (Error 3872, Line 8, Col 6, Line 8, Col 46, "Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern.") + (Error 3868, Line 22, Col 7, Line 22, Col 17, "This active pattern expects exactly one pattern argument, e.g., 'WhiteSpace pat'."); + (Error 1107, Line 20, Col 7, Line 20, Col 21, "Partial active patterns may only generate one result") ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) @@ -440,8 +541,8 @@ but here has type |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] - let ``Named - ParamertizedPartialActivePattern01_fs - --test:ErrorRanges`` compilation = + [] + let ``Named - ParameterizedPartialActivePattern01_fs - --test:ErrorRanges`` compilation = compilation |> asFs |> withOptions ["--test:ErrorRanges"] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ParamertizedPartialActivePattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ParameterizedPartialActivePattern01.fs similarity index 75% rename from tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ParamertizedPartialActivePattern01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ParameterizedPartialActivePattern01.fs index 896e6dbae8a..9e6f43d2416 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ParamertizedPartialActivePattern01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ParameterizedPartialActivePattern01.fs @@ -4,7 +4,7 @@ // FSB 3502 -let (|DivisbleByTwo|_|) x = +let (|DivisibleByTwo|_|) x = if x % 2 = 0 then Some() else None @@ -17,9 +17,9 @@ let (|DivisibleByX|_|) x y = // Without this fix, you'd have to bind the result of 'DivisibleByX' so you'd write DivisibleByX 3 (), which is lame. let divisibleBy x = match x with - | DivisbleByTwo & DivisibleByX 3 & DivisibleByX 4 -> [2; 3; 4] - | DivisbleByTwo & DivisibleByX 4 -> [2; 4] - | DivisbleByTwo & DivisibleByX 3 -> [2; 3; ] + | DivisibleByTwo & DivisibleByX 3 & DivisibleByX 4 -> [2; 3; 4] + | DivisibleByTwo & DivisibleByX 4 -> [2; 4] + | DivisibleByTwo & DivisibleByX 3 -> [2; 3; ] | DivisibleByX 3 & DivisibleByX 4 -> [3; 4] | DivisibleByX 4 -> [ 4] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/PatternMatchRegressions01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/PatternMatchRegressions01.fs index 2d82c4c91f4..adbe43c609b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/PatternMatchRegressions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/PatternMatchRegressions01.fs @@ -25,5 +25,5 @@ let f e = failwith "" -// Origional bug was problem with PEVerify +// Original bug was problem with PEVerify exit 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/E_notNullCompatible01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/E_notNullCompatible01.fs index 58b30660d1c..b3a185263b6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/E_notNullCompatible01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/E_notNullCompatible01.fs @@ -2,7 +2,7 @@ #light // Verify error when trying to match type against null if it doesn't support that -//The type 'Foo' does not have 'null' as a proper value + type Foo() = member this.Value = 42 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecTypesNotMatch01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecTypesNotMatch01.fs index 9297cb34285..2a48bf46849 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecTypesNotMatch01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecTypesNotMatch01.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #PatternMatching #Records // Verify error if two record types in a pattern match don't match // Verify error if type of a record field is incorrect. -//The record type 'R1' does not contain a label 'A'\. + type R1 = { X : int; Y : int } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecordFieldNotDefined01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecordFieldNotDefined01.fs index fa8ce23bce2..31398f99038 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecordFieldNotDefined01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecordFieldNotDefined01.fs @@ -2,7 +2,7 @@ #light // Verify error if type of a record field is incorrect. -//The record label 'X' is not defined + let testMatch x = match x with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_SyntaxError01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_SyntaxError01.fs index b3b2c41d32d..8f0334f742d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_SyntaxError01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_SyntaxError01.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #PatternMatching #light -//Unexpected symbol'\[' in pattern matching. Expected '->' or other token + let isIntArray (o: obj) = match o with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_ValueCapture01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_ValueCapture01.fs index eb1cc0594dd..170971f3231 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_ValueCapture01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_ValueCapture01.fs @@ -1,10 +1,10 @@ // #Regression #Conformance #PatternMatching #light -//The value or constructor 'ident1' is not defined -//The value or constructor 'ident2' is not defined -// Verifing scoping of value captures + + +// Verifying scoping of value captures let test1() = let x = 1 let _ = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/Simple.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/Simple.fs index 7ddf43cf235..3cd93d8c562 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/Simple.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/Simple.fs @@ -9,7 +9,7 @@ open FSharp.Test.Compiler module Simple = // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - //Incomplete pattern matches on this expression. For example, the value 'Result \(_\)' may indicate a case not covered by the pattern\(s\) + [] let ``Simple - W_Incomplete01_fs - --test:ErrorRanges`` compilation = compilation @@ -20,7 +20,7 @@ module Simple = |> withSingleDiagnostic (Warning 25, Line 92, Col 13, Line 92, Col 14, "Incomplete pattern matches on this expression. For example, the value 'Result (_)' may indicate a case not covered by the pattern(s).") // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - //This rule will never be matched + [] let ``Simple - W_Incomplete02_fs - --test:ErrorRanges`` compilation = compilation @@ -36,9 +36,9 @@ module Simple = ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - //Uppercase variable identifiers should not generally be used in patterns, and may indicate a missing open declaration or a misspelt pattern name - [] - let ``Simple - W_BindCaptialIdent_fs - --test:ErrorRanges`` compilation = + + [] + let ``Simple - W_BindCapitalIdent_fs - --test:ErrorRanges`` compilation = compilation |> asFsx |> withOptions ["--test:ErrorRanges"] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_BindCapitalIdent.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_BindCapitalIdent.fs new file mode 100644 index 00000000000..0420505057d --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_BindCapitalIdent.fs @@ -0,0 +1,11 @@ +// #Regression #Conformance #PatternMatching +// Verify warning when capturing values with capital identifier +// FSB 3954 + + + + +let test x = function + | Foo :: [] -> 1 + | Bar :: _ :: [] -> 2 + | _ -> 3 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_BindCaptialIdent.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_BindCaptialIdent.fs deleted file mode 100644 index 1866794890f..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_BindCaptialIdent.fs +++ /dev/null @@ -1,11 +0,0 @@ -// #Regression #Conformance #PatternMatching -// Verify warning when capturing values with captial identifier -// FSB 3954 - -//Uppercase variable identifiers should not generally be used in patterns, and may indicate a missing open declaration or a misspelt pattern name -//Uppercase variable identifiers should not generally be used in patterns, and may indicate a missing open declaration or a misspelt pattern name - -let test x = function - | Foo :: [] -> 1 - | Bar :: _ :: [] -> 2 - | _ -> 3 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete01.fs index 1438890708d..1788e7fca0b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete01.fs @@ -4,7 +4,7 @@ // Regression testcase for FSharp 1.0:2070 // Warning on incomplete match -//Incomplete pattern matches on this expression. For example, the value 'Result \(_\)' may indicate a case not covered by the pattern\(s\) + module M = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete02.fs index 7fd5bc9a364..dca83d379ae 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete02.fs @@ -5,10 +5,10 @@ // Title: Incomplete pattern in quotation causes error. // Descr: Make sure quotations compile (even with warning) when having incomplete pattern match inside -//Incomplete pattern matches on this expression\. -//Incomplete pattern matches on this expression\. -//This rule will never be matched -//This rule will never be matched + + + + let foo x = <@@ match x with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns11.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns11.fs index 503cb88b8e3..46707f2f82a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns11.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns11.fs @@ -1,8 +1,8 @@ // #Conformance #PatternMatching #light -let sumEvenValues (tupel:int*int) = - match tupel with +let sumEvenValues (tuple:int*int) = + match tuple with | x, y when x % 2 = 0 && y % 2 = 0 -> x + y | x, _ when x % 2 = 0 -> x | _, y when y % 2 = 0 -> y diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns13.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns13.fs index 1bfad47a21f..a747ff6b151 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns13.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns13.fs @@ -8,8 +8,8 @@ module SomeModule = | C module MainModule = - let getCount thingey = - match thingey with + let getCount thingy = + match thingy with | SomeModule.DU.A x -> x | SomeModule.DU.B x -> x.Length | SomeModule.DU.C -> 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_NoRangeConst01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_NoRangeConst01.fs index b88f36e32b9..4f9b4892ff7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_NoRangeConst01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_NoRangeConst01.fs @@ -2,7 +2,7 @@ #light // Verify error when trying to use range constants -//Unexpected symbol '..' in pattern matching. Expected '->' or other token + let areKnownLists l = match l with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bigint.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bigint.fs index da3a23ef76b..62abeccf858 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bigint.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bigint.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: BigInt -//Non-primitive numeric literal constants.+ + #light let isZero x = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bignum40.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bignum40.fs index 430712651ab..56b35655c4f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bignum40.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bignum40.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #PatternMatching #Constants // Pattern Matching - Simple Constants // Type: BigNum -//Non-primitive numeric literal constants.+ + // On NetFx4.0/Dev10, we don't give the deprecation error: this is ok (FSHARP1.0:4599) #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchLiteral01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchLiteral01.fs index a3aaa24faf6..97248bb4c88 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchLiteral01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchLiteral01.fs @@ -2,9 +2,9 @@ #light // Test ability to match a const literal value -//This rule will never be matched -//This rule will never be matched -//This rule will never be matched + + + [] let intLiteral = 42 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchNaN.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchNaN.fs index 9812451d83a..569c8c0f341 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchNaN.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchNaN.fs @@ -21,7 +21,7 @@ and isNaNFloat32 x = | 0.0f -> failwith "Should never match" | _ -> () -// This seems strange, but accoring to the IEEE spec +// This seems strange, but according to the IEEE spec // NaN <> NaN TestIsNaN System.Single.NaN TestIsNaN System.Double.NaN diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_IncompleteMatches01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_IncompleteMatches01.fs index 9efcf49e8b8..777824b3d90 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_IncompleteMatches01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_IncompleteMatches01.fs @@ -2,7 +2,7 @@ // Verify warnings for incomplete pattern matches -//Incomplete pattern matches on this expression. + let test() = function diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern01.fs index f8e38f3ce21..d9c5db1f22f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern01.fs @@ -2,7 +2,7 @@ #light // Verify warning with redundant pattern -//This rule will never be matched + let redPat () = function diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern02.fs index 3015210ce04..d408c16d7dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern02.fs @@ -3,7 +3,7 @@ // Verify warning if all DU tags are matched with and // a wildcard is included. -//This rule will never be matched + type DU = A | B | C of int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/E_typeconstraint01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/E_typeconstraint01.fs new file mode 100644 index 00000000000..8e5a7ef7bc0 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/E_typeconstraint01.fs @@ -0,0 +1,21 @@ +// #Regression #Conformance #PatternMatching #TypeConstraints +// Regression test for FSHARP1.0:1525 +// type constraints on pattern matching are deprecated and are now errors (used to be warnings) +// As of Beta2, we are not even giving the deprecation error. + + + +type A() = class + end + +type B() = class + inherit A() + end + +type C() = class + inherit B() + end + +let test1 (x:#A) = + match x with + | (o :> B) -> o.GetHashCode() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/E_typecontraint01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/E_typecontraint01.fs deleted file mode 100644 index 4ce19c52666..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/E_typecontraint01.fs +++ /dev/null @@ -1,21 +0,0 @@ -// #Regression #Conformance #PatternMatching #TypeConstraints -// Regression test for FSHARP1.0:1525 -// type constraints on pattern matching are deprecated and are now errors (used to be warnings) -// As of Beta2, we are not even giving the deprecation error. -//Unexpected symbol ':>' in pattern. Expected '\)' or other token. -//Unmatched '\('$ -//Files in libraries or multiple-file applications must begin with a namespace or module declaration, e.g. 'namespace SomeNamespace.SubNamespace' or 'module SomeNamespace.SomeModule'. Only the last source file of an application may omit such a declaration. -type A() = class - end - -type B() = class - inherit A() - end - -type C() = class - inherit B() - end - -let test1 (x:#A) = - match x with - | (o :> B) -> o.GetHashCode() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/TypeConstraint.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/TypeConstraint.fs index d2d190f135d..f14f51dd9b1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/TypeConstraint.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/TypeConstraint.fs @@ -8,7 +8,7 @@ open FSharp.Test.Compiler module TypeConstraint = // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/TypeConstraint) - [] + [] let ``TypeConstraint - E_typecontraint01_fs - --test:ErrorRanges`` compilation = compilation |> asFs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_CapturesDiffVal01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_CapturesDiffVal01.fs index 363ab3c29a0..29b54a67162 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_CapturesDiffVal01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_CapturesDiffVal01.fs @@ -3,7 +3,7 @@ // Verify error if two pattern match clauses match // different values -//The two sides of this 'or' pattern bind different sets of variables + let testMatch x = match x with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_NotAllCaptureSameVal01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_NotAllCaptureSameVal01.fs index af9e457cd93..c5ebfcab79b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_NotAllCaptureSameVal01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_NotAllCaptureSameVal01.fs @@ -3,7 +3,7 @@ // Verify error if not all union pattern rules capture the // same set of values -//The two sides of this 'or' pattern bind different sets of variables + let tupeMatch x = match x with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionCapturesDiffType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionCapturesDiffType01.fs index def92d6297b..35ecc16a72b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionCapturesDiffType01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionCapturesDiffType01.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #PatternMatching #Unions // Verify error if two union rules capture values with different types -//This expression was expected to have type. 'int' .but here has type. 'float' + let testMatch x = match x with diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern02.fs index c06ef31ab0a..f3165a69286 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern02.fs @@ -1,7 +1,7 @@ // #Conformance #PatternMatching #Unions #light -// Test a match statement with just one 'match thingey' +// Test a match statement with just one 'match thingy' type Foo = A | B of string | C of int let test x = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern03.fs index 95f9bcb6925..9c032ffa2f8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern03.fs @@ -12,7 +12,7 @@ let test1 x = | D | A -> 4 // The union of patterns should be considered a single entity, and thus -// their relative ordering shoudln't matter. +// their relative ordering shouldn't matter. let test2 x = match x with | B | A -> 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_InheritRecord01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_InheritRecord01.fs index 376371e1e10..13487c0c734 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_InheritRecord01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_InheritRecord01.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Records // Verify error when inheriting from a record // Regression of FSB 4662 -//is not an interface type + type Record = {x:int; y:int} diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_Interface_IComparable.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_Interface_IComparable.fsx index f1d46071ee2..2ac79c0f87f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_Interface_IComparable.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_Interface_IComparable.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Records // By default, record types implement IComparable -//This type test or downcast will always hold -//The type 'I' does not have any proper subtypes and cannot be used as the source of a type test or runtime coercion + + #light [] type Kg diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_Interface_IStructuralHash.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_Interface_IStructuralHash.fsx index b28084f0108..66d410dc7a2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_Interface_IStructuralHash.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_Interface_IStructuralHash.fsx @@ -3,7 +3,7 @@ // We used to, but now we do not anymore. // -//'IStructuralHash' + type r = { A : int; B : bool } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_MutableFields01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_MutableFields01.fsx index 5589f80031e..07a8366155e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_MutableFields01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_MutableFields01.fsx @@ -1,8 +1,8 @@ // #Regression #Conformance #TypesAndModules #Records // Verify that record fields may be marked mutable // Making one field mutable does not make _all_ the fields mutable -//This field is not mutable -//This field is not mutable + + // This is also regression test for FSHARP1.0:3733 #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordCloning01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordCloning01.fs index 16e53eca0a5..da7d9cb5ca7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordCloning01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordCloning01.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #TypesAndModules #Records // Verify error when trying to clone a non-record type -//This expression was expected to have type + type RecType = { A : int; B : string } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordsNotNull01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordsNotNull01.fs index f395d998ccb..b494538ad6b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordsNotNull01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_RecordsNotNull01.fs @@ -2,7 +2,7 @@ #light // Verify records cannot have null as a proper value -//The type 'RecordType' does not have 'null' as a proper value + type RecordType = { X : int } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_Scoping01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_Scoping01.fsx index 19afc465611..fc667065395 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_Scoping01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_Scoping01.fsx @@ -1,6 +1,6 @@ // #Regression #Conformance #TypesAndModules #Records // Field labels have module scope -//The record label 'a' is not defined + #light module M0 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_Scoping02.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_Scoping02.fsx index d8527d432ab..c441825b4e9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_Scoping02.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_Scoping02.fsx @@ -1,6 +1,6 @@ // #Regression #Conformance #TypesAndModules #Records // Field labels have module scope -//This expression uses the implicit conversion 'System\.Decimal\.op_Implicit\(value: int\) : decimal' to convert type 'int' to type 'decimal'. See https:.*$ + type T1 = { a : decimal } module M0 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference01.fs index 363e607f843..e2992b968d3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference01.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Records // Verify appropriate error with ambiguous record inference // Regression test for FSHARP1.0:2780 -//No assignment given for field 'Y' of type 'N\.Blue' + module N diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference01b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference01b.fs index dff437e6396..e4e813a36ad 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference01b.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference01b.fs @@ -2,7 +2,7 @@ // Verify appropriate error with ambiguous record inference // Same as 01, but with generic types // Regression test for FSHARP1.0:2780 -//No assignment given for field 'Y' of type 'N\.M\.Blue+ + namespace N module M = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference02.fs index 45cdedb489e..ccb37810eb9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_TypeInference02.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #TypesAndModules #Records // Verify error when type inference cannot pin down record type -//This record contains fields from inconsistent types + type Foo = { FieldA : int; FieldB : int } type Bar = { FieldB : int; FieldC : int } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_UnitType01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_UnitType01.fsx index 9f489d7288f..4e1cc010f22 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_UnitType01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/E_UnitType01.fsx @@ -2,7 +2,7 @@ // Field has type 'unit' (which is kind of special) // Trying to initialize with null is illegal. // This is regression test for FSHARP1.0:1459 -//The type 'unit' does not have 'null' as a proper value + #light type T1 = { u : unit;} diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/LongIdentifiers01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/LongIdentifiers01.fsx index 1eb7f1ff86e..9475491eabb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/LongIdentifiers01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/LongIdentifiers01.fsx @@ -7,7 +7,7 @@ type ı = int module M0 = - type T1 = { ı : ı;} // no conclict with type defined above + type T1 = { ı : ı;} // no conflict with type defined above module M1 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordCloning03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordCloning03.fs index 98fc2162c2d..39c3a9b72cb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordCloning03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordCloning03.fs @@ -17,7 +17,7 @@ if t.A <> 2 || t.B <> "2" then failwith "Failed" let copy = { t with A = -1 } if copy.A <> -1 || copy.B <> "2" then failwith "Failed" -// Mutate the copy, verify it does NOT affect origional +// Mutate the copy, verify it does NOT affect original copy.A <- -3 copy.B <- "-3" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Scoping04.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Scoping04.fsx index 11e1daaa842..634e7f1a114 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Scoping04.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Scoping04.fsx @@ -7,7 +7,7 @@ type ı = int module M0 = - type T1 = { ı : ı;} // no conclict with type defined above + type T1 = { ı : ı;} // no conflict with type defined above let x : M0.T1 = { ı = 1 } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/StructRecordCloning03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/StructRecordCloning03.fs index e3068c1a6a1..7f85512c604 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/StructRecordCloning03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/StructRecordCloning03.fs @@ -17,7 +17,7 @@ if t.A <> 2 || t.B <> "2" then failwith "Failed" let mutable copy = { t with A = -1 } if copy.A <> -1 || copy.B <> "2" then failwith "Failed" -// Mutate the copy, verify it does NOT affect origional +// Mutate the copy, verify it does NOT affect original copy.A <- -3 copy.B <- "-3" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Syntax01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Syntax01.fs index b23ee05cc4d..b6068c3531c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Syntax01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/Syntax01.fs @@ -1,7 +1,7 @@ // #Conformance #TypesAndModules #Records #light -// Verify sytanx associated with defining and creating records +// Verify syntax associated with defining and creating records // Same line type Rec1 = { A1 : int; B1 : string } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/W_Overrides01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/W_Overrides01.fsx index 93585748653..34abefb7289 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/W_Overrides01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/W_Overrides01.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Records // Trying to override GetHashCode(), Equals() and ToString() yields warnings // See also FSHARP1.0:5446 -//This new member hides the abstract member 'System\.Object\.ToString\(\) : string'\. Rename the member or use 'override' instead\.$ + [] type Kg type I = { A : float ; B : decimal } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/StructActivePatterns.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/StructActivePatterns.fs index 1b121b27766..58da91ef0dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/StructActivePatterns.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/StructActivePatterns.fs @@ -33,7 +33,7 @@ let rec (|IsOne|_|) someNumber = |> withOptions ["--warnaserror+"] |> typecheck |> shouldFail - |> withSingleDiagnostic (Error 1,Line 2, Col 1 , Line 3, Col 31, """This expression was expected to have type + |> withSingleDiagnostic (Error 1,Line 3, Col 10 , Line 3, Col 19, """This expression was expected to have type ''a voption' but here has type 'int option' """) @@ -50,7 +50,7 @@ let rec (|IsOne|_|) someNumber = |> withOptions ["--warnaserror+"] |> typecheck |> shouldFail - |> withSingleDiagnostic (Error 3350, Line 2, Col 9, Line 2, Col 31, "Feature 'Boolean-returning and return-type-directed partial active patterns' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") + |> withSingleDiagnostic (Error 3350, Line 2, Col 10, Line 2, Col 19, "Feature 'Boolean-returning and return-type-directed partial active patterns' is not available in F# 8.0. Please use language version 9.0 or greater.") [] let ``Rec struct active pattern is possible`` () = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs index aa959306198..942219ba172 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs @@ -769,9 +769,7 @@ let main _ = |> shouldSucceed |> verifyIL [ """ - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2 - '|IsEqual|IsNonEqual|'<(class [Potato]Potato.Lib/IPotato`1) T>(!!T x, - !!T y) cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2 '|IsEqual|IsNonEqual|'<(class [Potato]Potato.Lib/IPotato`1) T>(!!T x, !!T y) cil managed { .maxstack 8 @@ -845,11 +843,11 @@ let main _ = [] let ``Interface A with static abstracts can be inherited in interface B and then implemented in type C which inherits B in lang version70`` () = Fsx """ - type IParseable<'T when 'T :> IParseable<'T>> = + type IParsable<'T when 'T :> IParsable<'T>> = static abstract member Parse : string -> 'T type IAction<'T when 'T :> IAction<'T>> = - inherit IParseable<'T> + inherit IParsable<'T> type SomeAction = A | B with interface IAction with @@ -859,7 +857,7 @@ let main _ = | "B" -> B | _ -> failwith "can't parse" - let parse<'T when 'T :> IParseable<'T>> (x: string) : 'T = 'T.Parse x + let parse<'T when 'T :> IParsable<'T>> (x: string) : 'T = 'T.Parse x if parse "A" <> A then failwith "failed" @@ -872,11 +870,11 @@ let main _ = [] let ``Static abstracts can be inherited through multiple levels in lang version70`` () = Fsx """ - type IParseable<'T when 'T :> IParseable<'T>> = + type IParsable<'T when 'T :> IParsable<'T>> = static abstract member Parse : string -> 'T type IAction1<'T when 'T :> IAction1<'T>> = - inherit IParseable<'T> + inherit IParsable<'T> type IAction2<'T when 'T :> IAction2<'T>> = inherit IAction1<'T> @@ -894,7 +892,7 @@ let main _ = | "B" -> B | _ -> failwith "can't parse" - let parse<'T when 'T :> IParseable<'T>> (x: string) : 'T = 'T.Parse x + let parse<'T when 'T :> IParsable<'T>> (x: string) : 'T = 'T.Parse x let altParse<'T when 'T :> IAction3<'T>> (x: string) : 'T = 'T.AltParse x let x: SomeAction = parse "A" @@ -1269,6 +1267,42 @@ type A () = |> withDiagnostics [ (Error 3867, Line 3, Col 21, Line 3, Col 22, "Classes cannot contain static abstract members.") ] + + [] + let ``Access modifiers cannot be applied to an SRTP constraint in preview`` () = + FSharp """ +let inline length (x: ^a when ^a: (member public Length: int)) = x.Length +let inline length2 (x: ^a when ^a: (member Length: int with public get)) = x.Length +let inline length3 (x: ^a when ^a: (member Length: int with public set)) = x.set_Length(1) +let inline length4 (x: ^a when ^a: (member public get_Length: unit -> int)) = x.get_Length() + """ + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3871, Line 2, Col 43, Line 2, Col 49, "Access modifiers cannot be applied to an SRTP constraint.") + (Error 3871, Line 3, Col 61, Line 3, Col 67, "Access modifiers cannot be applied to an SRTP constraint.") + (Error 3871, Line 4, Col 61, Line 4, Col 67, "Access modifiers cannot be applied to an SRTP constraint.") + (Error 3871, Line 5, Col 44, Line 5, Col 50, "Access modifiers cannot be applied to an SRTP constraint.") + ] + + [] + let ``Access modifiers in an SRTP constraint generate warning in F# 8.0`` () = + FSharp """ +let inline length (x: ^a when ^a: (member public Length: int)) = x.Length +let inline length2 (x: ^a when ^a: (member Length: int with public get)) = x.Length +let inline length3 (x: ^a when ^a: (member Length: int with public set)) = x.set_Length(1) +let inline length4 (x: ^a when ^a: (member public get_Length: unit -> int)) = x.get_Length() + """ + |> withLangVersion80 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 3871, Line 2, Col 43, Line 2, Col 49, "Access modifiers cannot be applied to an SRTP constraint.") + (Warning 3871, Line 3, Col 61, Line 3, Col 67, "Access modifiers cannot be applied to an SRTP constraint.") + (Warning 3871, Line 4, Col 61, Line 4, Col 67, "Access modifiers cannot be applied to an SRTP constraint.") + (Warning 3871, Line 5, Col 44, Line 5, Col 50, "Access modifiers cannot be applied to an SRTP constraint.") + ] [] let ``Error for partial implementation of interface with static abstract members`` () = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercase01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercase01.fsx index 1e72231ce66..6695a4f171f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercase01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercase01.fsx @@ -1,8 +1,8 @@ // #Regression #Conformance #TypesAndModules #Unions // Union Types // Discriminated union cases names must begin with an uppercase letter -//Discriminated union cases and exception labels must be uppercase identifiers -//Discriminated union cases and exception labels must be uppercase identifiers + + #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercase02.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercase02.fsx index 58c5bb3ce1e..a82eddbb0b1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercase02.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercase02.fsx @@ -2,7 +2,7 @@ // Union Types // Discriminated union cases names must begin with an uppercase letter // This means it cannot start with a digit -//Unexpected integer literal in union case + #light type a = | 1 of int // err: can't use diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercase03.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercase03.fsx index 6f3b58cf375..0c6c364a344 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercase03.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercase03.fsx @@ -2,7 +2,7 @@ // Union Types // Discriminated union cases names must begin with an uppercase letter // This means it cannot start with a string -//Unexpected string literal in union case + #light type T = | (* *) A // ok diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercase04.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercase04.fsx index 9803ab0ad3f..9fa2ce90e02 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercase04.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercase04.fsx @@ -2,7 +2,7 @@ // Union Types // Discriminated union cases names must begin with an uppercase letter // This means it cannot start with a string -//Unexpected reserved keyword in union case + #light type T = | (* *) A diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercaseNoPipe01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercaseNoPipe01.fsx index 3bffdd03f82..077163a9b23 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercaseNoPipe01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_BeginWithUppercaseNoPipe01.fsx @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Unions // Regression test for FSHARP1.0:3741 -//Discriminated union cases and exception labels must be uppercase identifiers -//Discriminated union cases and exception labels must be uppercase identifiers + + #light module ``*`` = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_FieldMemberClash.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_FieldMemberClash.fs index 6974c873b60..7b43a27e8b2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_FieldMemberClash.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_FieldMemberClash.fs @@ -1,10 +1,10 @@ // #Conformance #TypesAndModules #Unions // Make sure we properly detect when field names collide with member names // Note: this only applies to single-case DUs -//The member 'Item1' can not be defined because the name 'Item1' clashes with the generated property 'Item1' in this type or module -//The member 'Item2' can not be defined because the name 'Item2' clashes with the generated property 'Item2' in this type or module -//The member 'V3' can not be defined because the name 'V3' clashes with the generated property 'V3' in this type or module -//The member 'Item' can not be defined because the name 'Item' clashes with the generated property 'Item' in this type or module + + + + type MyDU = | Case1 of int * string * V3 : float diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_FieldNameUsedMulti.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_FieldNameUsedMulti.fs index 5af3541d47c..1fbc0c34c84 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_FieldNameUsedMulti.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_FieldNameUsedMulti.fs @@ -1,8 +1,8 @@ // #Conformance #TypesAndModules #Unions // Make sure we properly detect field names specified multiple times -//Union case/exception field 'V1' cannot be used more than once\. -//Union case/exception field 'V2' cannot be used more than once\. -//Union case/exception field 'V1' cannot be used more than once\. + + + type MyDU = | Case1 of V1 : int * V2 : string diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_InheritUnion.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_InheritUnion.fs index 88a521a8a90..8be1f4950d9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_InheritUnion.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_InheritUnion.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #TypesAndModules #Unions // Verify error when inherit from union types -//This 'inherit' declaration specifies the inherited type but no arguments. -//Cannot inherit a sealed type + + type DiscUnion = A of int | B of string diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Interface_IComparable.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Interface_IComparable.fsx index f75ef80b98c..e59aa78f745 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Interface_IComparable.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Interface_IComparable.fsx @@ -1,8 +1,8 @@ // #Regression #Conformance #TypesAndModules #Unions // By default, Union types implement IComparable // Q: Is this a bug? I've reported it to fscore for now. -//This type test or downcast will always hold -//The type 'I' does not have any proper subtypes and cannot be used as the source of a type test or runtime coercion + + #light type I = A | B diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Interface_IStructuralHash.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Interface_IStructuralHash.fsx index 575d66ccc10..c43d4cdeef8 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Interface_IStructuralHash.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Interface_IStructuralHash.fsx @@ -2,10 +2,10 @@ // Union types NO LONGER implement IStructuralHash // They used to, but now they don't anymore. // -//The type 'IStructuralHash' is not defined -//Lookup on object of indeterminate type based on information prior to this program point\. A type annotation may be needed prior to this program point to constrain the type of the object\. This may allow the lookup to be resolved -//The type 'IStructuralHash' is not defined -//Lookup on object of indeterminate type based on information prior to this program point\. A type annotation may be needed prior to this program point to constrain the type of the object\. This may allow the lookup to be resolved + + + + type I = | A | B diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_LowercaseDT.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_LowercaseDT.fs index 216a49d46bf..3fc3baf3c3b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_LowercaseDT.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_LowercaseDT.fs @@ -2,7 +2,7 @@ #light // FS1: 325, Case sensitivity reported by Eugene -//Discriminated union cases and exception labels must be uppercase identifiers + type list = cons of int | Conss of int diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Member_Duplicate01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Member_Duplicate01.fsx index 683a7776608..9293d1567eb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Member_Duplicate01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_Member_Duplicate01.fsx @@ -1,8 +1,8 @@ // #Regression #Conformance #TypesAndModules #Unions // DU may include members // Verify that duplicate methods are not allowed -//The member 'IsC' can not be defined because the name 'IsC' clashes with the default augmentation of the union case 'C' in this type or module -//The member 'IsC' can not be defined because the name 'IsC' clashes with the default augmentation of the union case 'C' in this type or module + + #light type T = | C of int * int | D of (int * int) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_SampleFromSpec01d.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_SampleFromSpec01d.fsx index 92082148f01..5713c3110df 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_SampleFromSpec01d.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_SampleFromSpec01d.fsx @@ -4,7 +4,7 @@ // The with/end tokens can be omitted when using the #light syntax option as long as the // type-defn-elements vertically aligns with the first ‘|’ in the union-cases // Regression test for FSHARP1.0:3707 -//.+'member' + #light (* extra space *) type Message = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_SampleFromSpec01d2.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_SampleFromSpec01d2.fsx index 6426b2a89d6..5b1efa6cc97 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_SampleFromSpec01d2.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_SampleFromSpec01d2.fsx @@ -4,7 +4,7 @@ // The with/end tokens can be omitted when using the #light syntax option as long as the // type-defn-elements vertically aligns with the first ‘|’ in the union-cases // Regression test for FSHARP1.0:3707 -//.+'member' + #light type Message = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_ScopeAndDataConstrAndPattern01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_ScopeAndDataConstrAndPattern01.fsx index 09a82f1ff9a..7a26af5b406 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_ScopeAndDataConstrAndPattern01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_ScopeAndDataConstrAndPattern01.fsx @@ -4,7 +4,7 @@ // It also covers the fact that they can be used both as data constructors // and to form patterns. // This is the positive case. -//The value or constructor 'CaseLabel1' is not defined + #light [] type ı diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionConstructorBadFieldName.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionConstructorBadFieldName.fs index 01a238ecd76..ae106f28858 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionConstructorBadFieldName.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionConstructorBadFieldName.fs @@ -1,8 +1,8 @@ // #Conformance #TypesAndModules #Unions // Make sure we properly detect bogus named field in constructors -//The union case 'Case1' does not have a field named 'V3'\. -//The union case 'Case1' does not have a field named 'V3'\. -//The union case 'Case1' does not have a field named 'V4'\. + + + type MyDU = | Case1 of V1 : int * V2 : string diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldConflictingName.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldConflictingName.fs index 828b1f5c1d2..a9b9710a94d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldConflictingName.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldConflictingName.fs @@ -1,10 +1,10 @@ // #Conformance #TypesAndModules #Unions // Make sure we properly detect field naming collisions -//Named field 'Item2' conflicts with autogenerated name for anonymous field\. -//Named field 'A' is used more than once\. + + type MyDU = | Case1 of Item2 : int * string type MyDU2 = - | Case1 of A : int * A : string \ No newline at end of file + | Case1 of A : int * A : string * A : int \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldNamedTag.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldNamedTag.fs index 3a6938dfc67..747932062ac 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldNamedTag.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionFieldNamedTag.fs @@ -1,5 +1,5 @@ // #Conformance #TypesAndModules #Unions -//The union case named 'Tags' conflicts with the generated type 'Tags' + // Regression test for Bug 6308 type BigUnion1 = | Case0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTag.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTag.fs index c24b28593ae..a6e6ec24a88 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTag.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTag.fs @@ -1,7 +1,7 @@ // #Conformance #TypesAndModules #Unions // RegressionTest for bug 6308 //The union case named 'Tags' conflicts with the generated type 'Tags' -//The member 'Tag' can not be defined because the name 'Tag' clashes with the generated property 'Tag' in this type or module +//The member 'Tag' cannot be defined because the name 'Tag' clashes with the generated property 'Tag' in this type or module [] type BigUnion2 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTagNoDefault.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTagNoDefault.fs index 6e1bc0a2086..c662f61244d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTagNoDefault.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTagNoDefault.fs @@ -1,6 +1,6 @@ // #Conformance #TypesAndModules #Unions // RegressionTest for bug 6308 -//The member 'Tag' can not be defined because the name 'Tag' clashes with the generated property 'Tag' in this type or module +//The member 'Tag' cannot be defined because the name 'Tag' clashes with the generated property 'Tag' in this type or module [] type BigUnion2 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTags.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTags.fs index fa6d2461106..983154ac285 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTags.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTags.fs @@ -1,6 +1,6 @@ // #Conformance #TypesAndModules #Unions // RegressionTest for bug 6308 -//The member 'Tags' can not be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module +//The member 'Tags' cannot be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module [] type BigUnion2 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTagsNoDefault.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTagsNoDefault.fs index 30ddf26481a..326d73f5bc0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTagsNoDefault.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionMemberNamedTagsNoDefault.fs @@ -1,6 +1,6 @@ // #Conformance #TypesAndModules #Unions // RegressionTest for bug 6308 -//The member 'Tags' can not be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module +//The member 'Tags' cannot be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module [] type BigUnion2 = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionsNotNull01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionsNotNull01.fs index e7f0346ff0b..dff134951b0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionsNotNull01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/E_UnionsNotNull01.fs @@ -2,7 +2,7 @@ #light // Verify that null is not a proper value for a Discriminated Union -//The type 'DU' does not have 'null' as a proper value + type DU = A of string | B of int | C diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Parenthesis01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Parenthesis01.fsx index ede29b8377d..0c837580080 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Parenthesis01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Parenthesis01.fsx @@ -1,5 +1,5 @@ // #Conformance #TypesAndModules #Unions -// Paretheses are significant in DU definitions +// Parentheses are significant in DU definitions // #light diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Parenthesis02.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Parenthesis02.fsx index 768dc1db62e..ee6e3a21687 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Parenthesis02.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/Parenthesis02.fsx @@ -1,5 +1,5 @@ // #Regression #Conformance #TypesAndModules #Unions -// Parethesis are no longer ignificant in DU definitions +// Parentheses are no longer significant in DU definitions // See FSHARP1.0:4787 (Discriminated union constructors as first class values) // diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/ReflectionOnUnionTypes01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/ReflectionOnUnionTypes01.fs index 768209899c5..66d250bc079 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/ReflectionOnUnionTypes01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/ReflectionOnUnionTypes01.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #TypesAndModules #Unions // Regression test for FSHARP1.0:4331 -// Either provide F# reflection access to attributes on union cases, or remove the ability in the language to apply thes +// Either provide F# reflection access to attributes on union cases, or remove the ability in the language to apply this type X = | [] A diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/SampleFromSpec01d.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/SampleFromSpec01d.fsx index 6b7f7019bd3..e898c568c1a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/SampleFromSpec01d.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/SampleFromSpec01d.fsx @@ -12,7 +12,7 @@ | Request of int * string member x.Name = match x with Result(nm) -> nm | Request(_,nm) -> nm -type MessagX = +type MessageX = | Result of string | Request of int * string member x.Name = match x with Result(nm) -> nm | Request(_,nm) -> nm diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs index 574f1695d62..9b126ab7827 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs @@ -68,7 +68,6 @@ let main _args = printf "BasicThreeLongs=%i;GenericOfInt=%i;GenericOfString=%i;MixWithBool=%i;MixWithString=%i;Erasure=%i" structUnionSize genericSizeForInt genericSizeForString sizeForMixingWithBool sizeForMixingWithString sizeForSharingAfterErasure 0 """ - |> withLangVersionPreview |> asExe |> compile |> shouldSucceed @@ -215,7 +214,6 @@ type StructUnion = | B of string | C of string """ - |> withLangVersionPreview |> typecheck |> shouldSucceed @@ -288,7 +286,6 @@ type StructUnion = | A of Item: int | B of Item: string """ - |> withLangVersionPreview |> typecheck |> shouldFail |> withDiagnostics [ @@ -305,7 +302,6 @@ type StructUnion = | A of Item: int | B of item : string """ - |> withLangVersionPreview |> typecheck |> shouldSucceed @@ -352,7 +348,6 @@ type StructUnion = | A of Item: int * item: string | B of string """ - |> withLangVersionPreview |> typecheck |> shouldFail |> withDiagnostics [ @@ -368,7 +363,6 @@ type StructUnion = | A of Item: int * item: string | B of item: string """ - |> withLangVersionPreview |> typecheck |> shouldSucceed @@ -408,7 +402,9 @@ type StructUnion = |> typecheck |> shouldFail |> withDiagnostics [ - (Error 3176, Line 5, Col 27, Line 5, Col 31, "Named field 'item' is used more than once.") + (Error 3176, Line 5, Col 12, Line 5, Col 16, "Named field 'item' is used more than once."); + (Error 3585, Line 5, Col 12, Line 5, Col 16, "If a multicase union type is a struct, then all fields with the same name must be of the same type. This rule applies also to the generated 'Item' name in case of unnamed fields."); + (Error 3585, Line 5, Col 27, Line 5, Col 31, "If a multicase union type is a struct, then all fields with the same name must be of the same type. This rule applies also to the generated 'Item' name in case of unnamed fields.") ] [] @@ -423,7 +419,10 @@ type StructUnion = |> typecheck |> shouldFail |> withDiagnostics [ - (Error 3176, Line 5, Col 27, Line 5, Col 31, "Named field 'Item' is used more than once.") + (Error 3176, Line 5, Col 12, Line 5, Col 16, "Named field 'Item' is used more than once."); + (Error 3585, Line 5, Col 12, Line 5, Col 16, "If a multicase union type is a struct, then all fields with the same name must be of the same type. This rule applies also to the generated 'Item' name in case of unnamed fields."); + (Error 3585, Line 5, Col 27, Line 5, Col 31, "If a multicase union type is a struct, then all fields with the same name must be of the same type. This rule applies also to the generated 'Item' name in case of unnamed fields."); + (Error 3585, Line 6, Col 12, Line 6, Col 18, "If a multicase union type is a struct, then all fields with the same name must be of the same type. This rule applies also to the generated 'Item' name in case of unnamed fields.") ] [] @@ -527,7 +526,6 @@ namespace Foo [] type StructUnion = A of int | B of string """ - |> withLangVersionPreview |> typecheck |> shouldFail |> withDiagnostics [ @@ -556,7 +554,6 @@ type StructUnion = | B of string | C of string """ - |> withLangVersionPreview |> typecheck |> shouldSucceed @@ -571,7 +568,6 @@ type StructUnion = | B of string | C of string """ - |> withLangVersionPreview |> typecheck |> shouldSucceed @@ -585,7 +581,6 @@ type StructUnion = | B of string | C of string """ - |> withLangVersionPreview |> typecheck |> shouldSucceed @@ -599,7 +594,6 @@ type StructUnion = | B of string | C of string """ - |> withLangVersionPreview |> typecheck |> shouldSucceed @@ -652,7 +646,6 @@ type StructUnion = | B of string * b: string | C of c: string * string * c3: int """ - |> withLangVersionPreview |> typecheck |> shouldSucceed @@ -713,7 +706,7 @@ let main _argv = [] [] [] - let ``Struct DU compilation does not embarassingly fail when having many data-less cases`` (countOfCases:int) = + let ``Struct DU compilation does not embarrassingly fail when having many data-less cases`` (countOfCases:int) = createMassiveStructDuProgram countOfCases |> asExe |> compile @@ -778,6 +771,7 @@ type Foo = let foo = [Baz 42; Bat; Batman] printf "%A" foo""" + |> withLangVersionPreview |> asExe |> compile |> shouldSucceed @@ -877,8 +871,7 @@ let main args = IL_0002: newobj instance void Foo/StructUnion::.ctor(int32) IL_0007: ret }""";(*This is a 'maker method' New{CaseName} used for cases which do have fields associated with them, + the _tag gets initialized*)""" - NewCase3(string _field1_3, - string _field2_3) cil managed + NewCase3(string _field1_3, string _field2_3) cil managed { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, int32) = ( 01 00 08 00 00 00 02 00 00 00 00 00 ) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs index fb11a41005d..26acb4b9d0f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs @@ -135,8 +135,9 @@ module UnionTypes = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 23, Line 9, Col 19, Line 9, Col 22, "The member 'IsC' can not be defined because the name 'IsC' clashes with the default augmentation of the union case 'C' in this type or module") - (Error 23, Line 13, Col 24, Line 13, Col 27, "The member 'IsC' can not be defined because the name 'IsC' clashes with the default augmentation of the union case 'C' in this type or module") + (Error 434, Line 7, Col 12, Line 7, Col 13, "The property 'IsC' has the same name as a method in type 'T'.") + (Error 23, Line 9, Col 19, Line 9, Col 22, "The member 'IsC' cannot be defined because the name 'IsC' clashes with the default augmentation of the union case 'C' in this type or module") + (Error 23, Line 13, Col 24, Line 13, Col 27, "The member 'IsC' cannot be defined because the name 'IsC' clashes with the default augmentation of the union case 'C' in this type or module") ] //SOURCE=E_ScopeAndDataConstrAndPattern01.fsx SCFLAGS="--test:ErrorRanges" # E_ScopeAndDataConstrAndPattern01.fsx @@ -181,10 +182,10 @@ module UnionTypes = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 23, Line 12, Col 17, Line 12, Col 22, "The member 'Item1' can not be defined because the name 'Item1' clashes with the generated property 'Item1' in this type or module") - (Error 23, Line 13, Col 17, Line 13, Col 22, "The member 'Item2' can not be defined because the name 'Item2' clashes with the generated property 'Item2' in this type or module") - (Error 23, Line 14, Col 17, Line 14, Col 19, "The member 'V3' can not be defined because the name 'V3' clashes with the generated property 'V3' in this type or module") - (Error 23, Line 19, Col 17, Line 19, Col 21, "The member 'Item' can not be defined because the name 'Item' clashes with the generated property 'Item' in this type or module") + (Error 23, Line 12, Col 17, Line 12, Col 22, "The member 'Item1' cannot be defined because the name 'Item1' clashes with the generated property 'Item1' in this type or module") + (Error 23, Line 13, Col 17, Line 13, Col 22, "The member 'Item2' cannot be defined because the name 'Item2' clashes with the generated property 'Item2' in this type or module") + (Error 23, Line 14, Col 17, Line 14, Col 19, "The member 'V3' cannot be defined because the name 'V3' clashes with the generated property 'V3' in this type or module") + (Error 23, Line 19, Col 17, Line 19, Col 21, "The member 'Item' cannot be defined because the name 'Item' clashes with the generated property 'Item' in this type or module") ] //SOURCE=E_InheritUnion.fs # E_InheritUnion.fs @@ -271,7 +272,8 @@ module UnionTypes = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 3176, Line 7, Col 16, Line 7, Col 21, "Named field 'Item2' conflicts with autogenerated name for anonymous field.") + (Error 3176, Line 7, Col 16, Line 7, Col 21, "Named field 'Item2' conflicts with autogenerated name for anonymous field."); + (Error 3176, Line 10, Col 16, Line 10, Col 17, "Named field 'A' is used more than once."); (Error 3176, Line 10, Col 26, Line 10, Col 27, "Named field 'A' is used more than once.") ] @@ -312,7 +314,7 @@ module UnionTypes = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 23, Line 19, Col 14, Line 19, Col 17, "The member 'Tag' can not be defined because the name 'Tag' clashes with the generated property 'Tag' in this type or module") + (Error 23, Line 19, Col 14, Line 19, Col 17, "The member 'Tag' cannot be defined because the name 'Tag' clashes with the generated property 'Tag' in this type or module") ] //SOURCE=E_UnionMemberNamedTags.fs SCFLAGS="--test:ErrorRanges" # E_UnionMemberNamedTags.fs @@ -322,7 +324,7 @@ module UnionTypes = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 23, Line 19, Col 14, Line 19, Col 18, "The member 'Tags' can not be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module") + (Error 23, Line 19, Col 14, Line 19, Col 18, "The member 'Tags' cannot be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module") ] //SOURCE=E_UnionMemberNamedTagsNoDefault.fs SCFLAGS="--test:ErrorRanges" # E_UnionMemberNamedTagsNoDefault.fs @@ -332,7 +334,7 @@ module UnionTypes = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 23, Line 19, Col 14, Line 19, Col 18, "The member 'Tags' can not be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module") + (Error 23, Line 19, Col 14, Line 19, Col 18, "The member 'Tags' cannot be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module") ] //SOURCE=E_UnionsNotNull01.fs # E_UnionsNotNull01.fs @@ -656,7 +658,6 @@ module {kwrec} FileName (fsFromString myLibraryFsi) |> FS |> withAdditionalSourceFiles [myLibraryFs; myFileFs] |> asLibrary - |> withLangVersionPreview |> withName "MyLibrary" Fs """ @@ -667,7 +668,6 @@ printfn "%b %A %b" x y z """ |> asExe |> withReferences [myLibrary] - |> withLangVersionPreview |> compileAndRun |> shouldSucceed @@ -748,6 +748,62 @@ type MyId = |> typecheck |> shouldFail |> withDiagnostics [ - (Error 23, Line 7, Col 17, Line 7, Col 20, "The member 'IdA' can not be defined because the name 'IdA' clashes with the union case 'IdA' in this type or module") - (Error 23, Line 17, Col 17, Line 17, Col 20, "The member 'IdC' can not be defined because the name 'IdC' clashes with the union case 'IdC' in this type or module") + (Error 23, Line 7, Col 17, Line 7, Col 20, "The member 'IdA' cannot be defined because the name 'IdA' clashes with the union case 'IdA' in this type or module") + (Error 23, Line 17, Col 17, Line 17, Col 20, "The member 'IdC' cannot be defined because the name 'IdC' clashes with the union case 'IdC' in this type or module") + ] + + + [] + let ``Union field appears multiple times in union declaration`` () = + Fsx """ +type X = + | A of a: int * a: int + """ + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3176, Line 3, Col 12, Line 3, Col 13, "Named field 'a' is used more than once.") + ] + + [] + let ``Union field appears multiple times in union declaration 2`` () = + Fsx """ +type X = + | A of a: int * a: int + | B of a: int * a: int + """ + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3176, Line 3, Col 12, Line 3, Col 13, "Named field 'a' is used more than once.") + (Error 3176, Line 4, Col 12, Line 4, Col 13, "Named field 'a' is used more than once.") + ] + + [] + let ``Union field appears multiple times in union declaration 3`` () = + Fsx """ +type X = + | A of a: int * a: int * a: int + """ + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3176, Line 3, Col 12, Line 3, Col 13, "Named field 'a' is used more than once.") + (Error 3176, Line 3, Col 21, Line 3, Col 22, "Named field 'a' is used more than once.") + ] + + [] + let ``Union field appears multiple times in union declaration 4`` () = + Fsx """ +type X = + | A of a: int * a: int +let x = A (1, 2) +match x with +| A(a = 1) -> () +| _ -> () + """ + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3176, Line 3, Col 12, Line 3, Col 13, "Named field 'a' is used more than once.") ] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/W_SampleFromSpec01c.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/W_SampleFromSpec01c.fsx index 8df029ab073..c1647f8094b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/W_SampleFromSpec01c.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/W_SampleFromSpec01c.fsx @@ -2,7 +2,7 @@ // Union Types // Sample from spec - using #light (but with incorrect indentation) // Q: Why this warning is emitted twice? -//Possible incorrect indentation: this token is offside of context started at position \(8:19\)\. Try indenting this token further or using standard formatting conventions + #light (* extra space *) type Message = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/W_UnionCaseProduction01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/W_UnionCaseProduction01.fsx index 9b9226b076e..1d5e1e948fa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/W_UnionCaseProduction01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/W_UnionCaseProduction01.fsx @@ -4,8 +4,8 @@ // | id -- nullary union case // | id of type * ... * type -- n-ary union case // | id : sig-spec -- n-ary union case -//This construct is deprecated: it is only for use in the F# library -//This construct is deprecated: it is only for use in the F# library + + #light type T = | D : int -> T diff --git a/tests/FSharp.Compiler.ComponentTests/Diagnostics/Records.fs b/tests/FSharp.Compiler.ComponentTests/Diagnostics/Records.fs index 7b6bd70d729..1299422c974 100644 --- a/tests/FSharp.Compiler.ComponentTests/Diagnostics/Records.fs +++ b/tests/FSharp.Compiler.ComponentTests/Diagnostics/Records.fs @@ -72,14 +72,14 @@ let ``Warning not emitted for generated record updates within a nested copy-and- Fsx """ type AnotherNestedRecTy = { A: int; B: int } -type NestdRecTy = { C: {| c: AnotherNestedRecTy |} } +type NestedRecTy = { C: {| c: AnotherNestedRecTy |} } -type RecTy = { D: NestdRecTy; I: int } +type RecTy = { D: NestedRecTy; I: int } -// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv -let t1 (x: NestdRecTy) = { x with C.c = Unchecked.defaultof<_> } +// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv +let t1 (x: NestedRecTy) = { x with C.c = Unchecked.defaultof<_> } -// Do not report for the nested NestdRecTy update +// Do not report for the nested NestedRecTy update let t2 (x: RecTy) (a: AnotherNestedRecTy) = { x with D.C.c = { a with A = 3 } } // vvvvvvvvvvvvvvvvvvvvvvv @@ -90,7 +90,7 @@ let t3 (x: RecTy) (a: AnotherNestedRecTy) = { x with D.C.c = { a with A = 3; B = |> typecheck |> shouldFail |> withDiagnostics [ - (Warning 3560, Line 9, Col 26, Line 9, Col 65, "This copy-and-update record expression changes all fields of record type 'Test.NestdRecTy'. Consider using the record construction syntax instead.") + (Warning 3560, Line 9, Col 27, Line 9, Col 66, "This copy-and-update record expression changes all fields of record type 'Test.NestedRecTy'. Consider using the record construction syntax instead.") (Warning 3560, Line 15, Col 62, Line 15, Col 85, "This copy-and-update record expression changes all fields of record type 'Test.AnotherNestedRecTy'. Consider using the record construction syntax instead.") ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOff.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOff.il.debug.bsl index 82a10de0414..c95b446032a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOff.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOff.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOff.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOff.il.release.bsl index 82a10de0414..c95b446032a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOff.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOff.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOn.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOn.il.debug.bsl index b8ab856f75a..90c7d53851c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOn.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOn.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOn.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOn.il.release.bsl index b8ab856f75a..90c7d53851c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOn.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOn.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOff.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOff.il.debug.bsl index c0cf50565a5..416b71131a9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOff.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOff.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOff.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOff.il.release.bsl index c0cf50565a5..416b71131a9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOff.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOff.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOn.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOn.il.debug.bsl index 39b879bc70a..bdcb8cfe3a1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOn.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOn.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOn.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOn.il.release.bsl index 39b879bc70a..bdcb8cfe3a1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOn.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOn.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOff.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOff.il.debug.bsl index 6bcd63ba991..86e0cc6afbd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOff.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOff.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOff.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOff.il.release.bsl index 3f1adc33c23..f564cc5c3c6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOff.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOff.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.il.debug.bsl index a6484ab298b..38d888ef90e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.il.release.bsl index ebae270051a..69e251eafbf 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOff.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOff.il.debug.bsl index 6fc76280ddb..77d0d57a799 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOff.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOff.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOff.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOff.il.release.bsl index fecd8306a54..62f0e29565a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOff.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOff.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.il.debug.bsl index 968ce31a441..57fce064655 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.il.release.bsl index 222deea406e..8d15000dc25 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.il.debug.bsl index feb35843543..537e2ce83d7 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.il.release.bsl index 158eda80f85..2b8dd85d274 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.il.debug.bsl index 2962a173205..9c7a9399b77 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.il.release.bsl index 7690231f5e1..e192d2bc639 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOff.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOff.il.debug.bsl index 58549416de2..e68776c8dac 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOff.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOff.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOff.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOff.il.release.bsl index e5965d67a7a..723f29b7d82 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOff.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOff.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.il.debug.bsl index 6565fbe138b..d731307a799 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.il.release.bsl index 4daf09ef651..6dd4c2cb2fc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Default.fs.RealInternalSignatureOff.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Default.fs.RealInternalSignatureOff.il.debug.bsl index 89771b5a558..2c3e14a8a7e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Default.fs.RealInternalSignatureOff.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Default.fs.RealInternalSignatureOff.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Default.fs.RealInternalSignatureOff.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Default.fs.RealInternalSignatureOff.il.release.bsl index 89771b5a558..2c3e14a8a7e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Default.fs.RealInternalSignatureOff.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Default.fs.RealInternalSignatureOff.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Default.fs.RealInternalSignatureOn.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Default.fs.RealInternalSignatureOn.il.debug.bsl index fdd3ee27a69..cb55a4490dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Default.fs.RealInternalSignatureOn.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Default.fs.RealInternalSignatureOn.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Default.fs.RealInternalSignatureOn.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Default.fs.RealInternalSignatureOn.il.release.bsl index fdd3ee27a69..cb55a4490dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Default.fs.RealInternalSignatureOn.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Default.fs.RealInternalSignatureOn.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Field.fs.RealInternalSignatureOff.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Field.fs.RealInternalSignatureOff.il.debug.bsl index 44b0f450734..e411f0829da 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Field.fs.RealInternalSignatureOff.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Field.fs.RealInternalSignatureOff.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Field.fs.RealInternalSignatureOff.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Field.fs.RealInternalSignatureOff.il.release.bsl index 44b0f450734..e411f0829da 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Field.fs.RealInternalSignatureOff.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Field.fs.RealInternalSignatureOff.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Field.fs.RealInternalSignatureOn.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Field.fs.RealInternalSignatureOn.il.debug.bsl index c5544f82a78..3a3ddefaf4b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Field.fs.RealInternalSignatureOn.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Field.fs.RealInternalSignatureOn.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Field.fs.RealInternalSignatureOn.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Field.fs.RealInternalSignatureOn.il.release.bsl index c5544f82a78..3a3ddefaf4b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Field.fs.RealInternalSignatureOn.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Field.fs.RealInternalSignatureOn.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOff.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOff.il.debug.bsl index 5ae2beb6a23..34e072d5694 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOff.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOff.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOff.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOff.il.release.bsl index 5ae2beb6a23..34e072d5694 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOff.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOff.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOn.il.bsl index 1abdfba7578..f2331b55c3d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOn.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOn.il.debug.bsl index 1abdfba7578..f2331b55c3d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOn.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOn.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOnil.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOnil.release.bsl index f4a6cfcd6df..c76b811ec57 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOnil.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AttributeTargets/Property.fs.RealInternalSignatureOnil.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ByRefTests.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ByRefTests.fs index ef8dbac0f0d..7f74deee082 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ByRefTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ByRefTests.fs @@ -252,7 +252,7 @@ let test () = """ [] - let ``Cannot take native address to get a nativeptr of an immmutable value`` () = + let ``Cannot take native address to get a nativeptr of an immutable value`` () = CompilerAssert.TypeCheckWithErrors """ #nowarn "51" @@ -283,9 +283,7 @@ type C() = .get instance int32& modreq([runtime]System.Runtime.InteropServices.InAttribute) Test/C::get_X() }""" - let verifyMethod = """.method public hidebysig specialname - instance int32& modreq([runtime]System.Runtime.InteropServices.InAttribute) - get_X() cil managed + let verifyMethod = """.method public hidebysig specialname instance int32& modreq([runtime]System.Runtime.InteropServices.InAttribute) get_X() cil managed { .param [0] .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )""" @@ -313,9 +311,7 @@ type C() = .get instance int32& modreq([netstandard]System.Runtime.InteropServices.InAttribute) Test/C::get_X() }""" - let verifyMethod = """.method public hidebysig specialname - instance int32& modreq([netstandard]System.Runtime.InteropServices.InAttribute) - get_X() cil managed + let verifyMethod = """.method public hidebysig specialname instance int32& modreq([netstandard]System.Runtime.InteropServices.InAttribute) get_X() cil managed { .param [0] .custom instance void System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )""" @@ -452,9 +448,7 @@ type C<'T>() = abstract X<'U> : unit -> inref<'U> """ - let verifyMethod = """.method public hidebysig abstract virtual - instance !!U& modreq([runtime]System.Runtime.InteropServices.InAttribute) - X() cil managed + let verifyMethod = """.method public hidebysig abstract virtual instance !!U& modreq([runtime]System.Runtime.InteropServices.InAttribute) X() cil managed { .param [0] .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )""" @@ -481,9 +475,7 @@ type C = .get instance int32& modreq([runtime]System.Runtime.InteropServices.InAttribute) Test/C::get_X() }""" - let verifyMethod = """.method public hidebysig specialname abstract virtual - instance int32& modreq([runtime]System.Runtime.InteropServices.InAttribute) - get_X() cil managed + let verifyMethod = """.method public hidebysig specialname abstract virtual instance int32& modreq([runtime]System.Runtime.InteropServices.InAttribute) get_X() cil managed { .param [0] .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )""" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember.fs index 248532a1638..79dc02b6c4c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember.fs @@ -105,7 +105,6 @@ type ILArrayShape = | One """)) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -132,7 +131,6 @@ type ILArrayShape = | One """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -146,3 +144,59 @@ type ILArrayShape = ] |> shouldSucceed + [] // RealSig + [] // Regular + [] + let ``private DU in module`` (realSig, expected) = + FSharp """ +module RealInternalSignature +module Module = + type private DU = ABC | YYZ + + let publicFunction () : bool = + ABC = YYZ + +Module.publicFunction () |> printfn "%b" +""" + |> asExe + |> withRealInternalSignature realSig + |> compileAndRun + |> withILContains [ + $$""" + .method {{expected}} hidebysig instance bool Equals(class RealInternalSignature/Module/DU obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (int32 V_0, + int32 V_1) + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_001b + + IL_0003: ldarg.1 + IL_0004: brfalse.s IL_0019 + + IL_0006: ldarg.0 + IL_0007: ldfld int32 RealInternalSignature/Module/DU::_tag + IL_000c: stloc.0 + IL_000d: ldarg.1 + IL_000e: ldfld int32 RealInternalSignature/Module/DU::_tag + IL_0013: stloc.1 + IL_0014: ldloc.0 + IL_0015: ldloc.1 + IL_0016: ceq + IL_0018: ret + + IL_0019: ldc.i4.0 + IL_001a: ret + + IL_001b: ldarg.1 + IL_001c: ldnull + IL_001d: cgt.un + IL_001f: ldc.i4.0 + IL_0020: ceq + IL_0022: ret + } +""" + ] + |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOff.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOff.il.net472.bsl index 36f2188c863..77f8af77dd1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOff.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOff.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOff.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOff.il.netcore.bsl index e37f7b7c7b3..7da09957b3e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOff.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOff.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.net472.bsl index 962a0f7a013..31a1741c78f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.netcore.bsl index 1d580c36200..9949b5576be 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember02a.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember02a.fs.RealInternalSignatureOff.il.bsl index c596a4cb2f5..eebec5a906a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember02a.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember02a.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember02a.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember02a.fs.RealInternalSignatureOn.il.bsl index 2c5467b662b..687c049cf84 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember02a.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember02a.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember03a.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember03a.fs.RealInternalSignatureOff.il.bsl index 82cac9772c1..cbf876f2754 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember03a.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember03a.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember03a.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember03a.fs.RealInternalSignatureOn.il.bsl index 978d0e366ea..5b42eca78ec 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember03a.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember03a.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs.RealInternalSignatureOff.il.bsl index 223c63fd7e3..2eb0131c709 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs.RealInternalSignatureOn.il.bsl index 315a9ab425d..8a8ad8366f3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute01.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute01.fs.il.debug.bsl index 9a5ab04f5bf..a0f7ca09f18 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute01.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute01.fs.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute01.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute01.fs.il.release.bsl index 9a5ab04f5bf..a0f7ca09f18 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute01.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute01.fs.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute02.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute02.fs.il.debug.bsl index 04cf6a0fbe4..2f05c7e1c1a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute02.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute02.fs.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute02.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute02.fs.il.release.bsl index 04cf6a0fbe4..2f05c7e1c1a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute02.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute02.fs.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute03.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute03.fs.il.debug.bsl index 7d899510426..c504a714904 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute03.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute03.fs.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute03.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute03.fs.il.release.bsl index 7d899510426..c504a714904 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute03.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute03.fs.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOff.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOff.fs.il.net472.debug.bsl index 3d9cae250c3..6c6892a055a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOff.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOff.fs.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOff.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOff.fs.il.net472.release.bsl index 3d9cae250c3..6c6892a055a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOff.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOff.fs.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOff.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOff.fs.il.netcore.debug.bsl index 71747396c31..10a3cdf05f0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOff.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOff.fs.il.netcore.debug.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOff.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOff.fs.il.netcore.release.bsl index 71747396c31..10a3cdf05f0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOff.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOff.fs.il.netcore.release.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOn.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOn.fs.il.net472.debug.bsl index a3a27ae3c42..5d540ddd409 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOn.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOn.fs.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOn.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOn.fs.il.net472.release.bsl index a3a27ae3c42..5d540ddd409 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOn.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOn.fs.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOn.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOn.fs.il.netcore.debug.bsl index e25b36742eb..8c7754ca717 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOn.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOn.fs.il.netcore.debug.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOn.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOn.fs.il.netcore.release.bsl index e25b36742eb..8c7754ca717 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOn.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute04_RealInternalSignatureOn.fs.il.netcore.release.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompilerGeneratedAttributeOnAccessors.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompilerGeneratedAttributeOnAccessors.fs index 2d2f4fdede3..d1556c9aa4c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompilerGeneratedAttributeOnAccessors.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CompilerGeneratedAttributeOnAccessors.fs @@ -183,7 +183,7 @@ module ``Auto-generated accessors have CompilerGenerated attribute`` = |> should haveAttribute "DebuggerNonUserCodeAttribute" // Regression: https://github.com/dotnet/fsharp/issues/14652 -module ``Let bindings in classes shoulnd't have DebuggerNonUserCodeAttribute`` = +module ``Let bindings in classes shouldn't have DebuggerNonUserCodeAttribute`` = let withRealInternalSignature realSig compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr01.fs.RealInternalSignatureOff.il.bsl index 0ffa9021a8b..2281677205c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr01.fs.RealInternalSignatureOff.il.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr01.fs.RealInternalSignatureOn.il.bsl index b0676e7e397..2d0aaaa94e1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr01.fs.RealInternalSignatureOn.il.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr02.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr02.fs.RealInternalSignatureOff.il.bsl index 6cd61a10cd0..9021049bf78 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr02.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr02.fs.RealInternalSignatureOff.il.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr02.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr02.fs.RealInternalSignatureOn.il.bsl index bf700dceabe..2420bd020cb 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr02.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr02.fs.RealInternalSignatureOn.il.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr03.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr03.fs.RealInternalSignatureOff.il.bsl index f5f20503b19..f27f8256dfa 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr03.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr03.fs.RealInternalSignatureOff.il.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr03.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr03.fs.RealInternalSignatureOn.il.bsl index 50ce6ea0746..72f38d7e7cf 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr03.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr03.fs.RealInternalSignatureOn.il.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr04.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr04.fs.RealInternalSignatureOff.il.bsl index 64e755d264f..c45991ef668 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr04.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr04.fs.RealInternalSignatureOff.il.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr04.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr04.fs.RealInternalSignatureOn.il.bsl index 5b286edf1c4..6c1bb207389 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr04.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr04.fs.RealInternalSignatureOn.il.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr05.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr05.fs.RealInternalSignatureOff.il.bsl index 1868fb32858..76da36887ba 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr05.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr05.fs.RealInternalSignatureOff.il.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr05.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr05.fs.RealInternalSignatureOn.il.bsl index 9e005d2638d..2ded267c8d4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr05.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr05.fs.RealInternalSignatureOn.il.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr06.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr06.fs.RealInternalSignatureOff.il.bsl index 5553e1bfff9..ab5da5714ec 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr06.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr06.fs.RealInternalSignatureOff.il.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr06.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr06.fs.RealInternalSignatureOn.il.bsl index be250545d89..1de6dde9c11 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr06.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr06.fs.RealInternalSignatureOn.il.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs.RealInternalSignatureOff.il.bsl index 1af6d7ef89d..c03a1b71958 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs.RealInternalSignatureOff.il.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs.RealInternalSignatureOn.il.bsl index 8e72593dcde..35ed4a6c946 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs.RealInternalSignatureOn.il.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { @@ -166,7 +166,10 @@ { .maxstack 9 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0) + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + int32 V_3) IL_0000: ldc.i4.1 IL_0001: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::.ctor(!0) IL_0006: stloc.0 @@ -175,32 +178,52 @@ IL_000d: ldarg.0 IL_000e: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ IL_0013: ldc.i4.0 - IL_0014: ldc.i4.1 - IL_0015: ldc.i4.3 - IL_0016: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_001b: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0020: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0025: ldarg.0 - IL_0026: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ - IL_002b: ldloc.0 - IL_002c: newobj instance void Program/'res7@10-1'::.ctor(class [ComputationExprLibrary]Library.EventuallyBuilder, + IL_0014: conv.i8 + IL_0015: stloc.2 + IL_0016: ldc.i4.0 + IL_0017: stloc.3 + IL_0018: ldloc.2 + IL_0019: ldc.i4.4 + IL_001a: conv.i8 + IL_001b: bge.un.s IL_0032 + + IL_001d: ldloca.s V_1 + IL_001f: ldloc.3 + IL_0020: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0025: nop + IL_0026: ldloc.3 + IL_0027: ldc.i4.1 + IL_0028: add + IL_0029: stloc.3 + IL_002a: ldloc.2 + IL_002b: ldc.i4.1 + IL_002c: conv.i8 + IL_002d: add + IL_002e: stloc.2 + IL_002f: nop + IL_0030: br.s IL_0018 + + IL_0032: ldloca.s V_1 + IL_0034: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0039: ldarg.0 + IL_003a: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ + IL_003f: ldloc.0 + IL_0040: newobj instance void Program/'res7@10-1'::.ctor(class [ComputationExprLibrary]Library.EventuallyBuilder, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_0031: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::For(class [runtime]System.Collections.Generic.IEnumerable`1, + IL_0045: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::For(class [runtime]System.Collections.Generic.IEnumerable`1, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0036: ldarg.0 - IL_0037: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ - IL_003c: ldarg.0 - IL_003d: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ - IL_0042: ldloc.0 - IL_0043: newobj instance void Program/'res7@12-2'::.ctor(class [ComputationExprLibrary]Library.EventuallyBuilder, + IL_004a: ldarg.0 + IL_004b: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ + IL_0050: ldarg.0 + IL_0051: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ + IL_0056: ldloc.0 + IL_0057: newobj instance void Program/'res7@12-2'::.ctor(class [ComputationExprLibrary]Library.EventuallyBuilder, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_0048: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_004d: tail. - IL_004f: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::Combine(class [ComputationExprLibrary]Library.Eventually`1, + IL_005c: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0061: tail. + IL_0063: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::Combine(class [ComputationExprLibrary]Library.Eventually`1, class [ComputationExprLibrary]Library.Eventually`1) - IL_0054: ret + IL_0068: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ComputedCollections.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ComputedCollections.fs index 7aa8f64ebcb..6b4788a5103 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ComputedCollections.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ComputedCollections.fs @@ -8,7 +8,6 @@ module ComputedCollections = let verifyCompilation compilation = compilation |> asExe - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withOptimize |> withEmbeddedPdb |> withEmbedAllSource diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeArrays.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeArrays.fs index e2466ab7f5f..b7fe4dddd21 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeArrays.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeArrays.fs @@ -2,6 +2,13 @@ let f00 f g = [|for n in 1..10 do f (); g (); yield n|] let f000 f = [|for n in 1..10 do f (); yield n; yield n + 1|] let f0000 () = [|for n in 1..10 do yield n|] +let f00000 () = [|for n in 1..10 do n|] +let f000000 () = [|for n in 1..10 do let n = n in n|] +let f0000000 () = [|for n in 1..10 do let n = n in yield n|] +let f00000000 () = [|for n in 1..10 do let n = n in let n = n in yield n|] +let f000000000 x y = [|for n in 1..10 do let foo = n + x in let bar = n + y in yield n + foo + bar|] +let f0000000000 f g = [|for n in 1..10 do f (); g (); n|] +let f00000000000 (f : unit -> int) (g : unit -> int) = [|for n in 1..10 do f (); g (); n|] let f1 () = [|for n in 1..10 -> n|] let f2 () = [|for n in 10..1 -> n|] let f3 () = [|for n in 1..1..10 -> n|] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeArrays.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeArrays.fs.il.bsl index 980616689ba..681768099ef 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeArrays.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeArrays.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { @@ -260,6 +260,378 @@ IL_0028: ret } + .method public static int32[] f00000() cil managed + { + + .maxstack 5 + .locals init (int32[] V_0, + uint64 V_1, + int32 V_2, + int32 V_3) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: conv.ovf.i.un + IL_0004: newarr [runtime]System.Int32 + IL_0009: stloc.0 + IL_000a: ldc.i4.0 + IL_000b: conv.i8 + IL_000c: stloc.1 + IL_000d: ldc.i4.1 + IL_000e: stloc.2 + IL_000f: br.s IL_0021 + + IL_0011: ldloc.0 + IL_0012: ldloc.1 + IL_0013: conv.i + IL_0014: ldloc.2 + IL_0015: stloc.3 + IL_0016: ldloc.3 + IL_0017: stelem.i4 + IL_0018: ldloc.2 + IL_0019: ldc.i4.1 + IL_001a: add + IL_001b: stloc.2 + IL_001c: ldloc.1 + IL_001d: ldc.i4.1 + IL_001e: conv.i8 + IL_001f: add + IL_0020: stloc.1 + IL_0021: ldloc.1 + IL_0022: ldc.i4.s 10 + IL_0024: conv.i8 + IL_0025: blt.un.s IL_0011 + + IL_0027: ldloc.0 + IL_0028: ret + } + + .method public static int32[] f000000() cil managed + { + + .maxstack 5 + .locals init (int32[] V_0, + uint64 V_1, + int32 V_2, + int32 V_3) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: conv.ovf.i.un + IL_0004: newarr [runtime]System.Int32 + IL_0009: stloc.0 + IL_000a: ldc.i4.0 + IL_000b: conv.i8 + IL_000c: stloc.1 + IL_000d: ldc.i4.1 + IL_000e: stloc.2 + IL_000f: br.s IL_0022 + + IL_0011: ldloc.0 + IL_0012: ldloc.1 + IL_0013: conv.i + IL_0014: ldloc.2 + IL_0015: stloc.3 + IL_0016: nop + IL_0017: ldloc.3 + IL_0018: stelem.i4 + IL_0019: ldloc.2 + IL_001a: ldc.i4.1 + IL_001b: add + IL_001c: stloc.2 + IL_001d: ldloc.1 + IL_001e: ldc.i4.1 + IL_001f: conv.i8 + IL_0020: add + IL_0021: stloc.1 + IL_0022: ldloc.1 + IL_0023: ldc.i4.s 10 + IL_0025: conv.i8 + IL_0026: blt.un.s IL_0011 + + IL_0028: ldloc.0 + IL_0029: ret + } + + .method public static int32[] f0000000() cil managed + { + + .maxstack 5 + .locals init (int32[] V_0, + uint64 V_1, + int32 V_2, + int32 V_3) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: conv.ovf.i.un + IL_0004: newarr [runtime]System.Int32 + IL_0009: stloc.0 + IL_000a: ldc.i4.0 + IL_000b: conv.i8 + IL_000c: stloc.1 + IL_000d: ldc.i4.1 + IL_000e: stloc.2 + IL_000f: br.s IL_0022 + + IL_0011: ldloc.0 + IL_0012: ldloc.1 + IL_0013: conv.i + IL_0014: ldloc.2 + IL_0015: stloc.3 + IL_0016: nop + IL_0017: ldloc.3 + IL_0018: stelem.i4 + IL_0019: ldloc.2 + IL_001a: ldc.i4.1 + IL_001b: add + IL_001c: stloc.2 + IL_001d: ldloc.1 + IL_001e: ldc.i4.1 + IL_001f: conv.i8 + IL_0020: add + IL_0021: stloc.1 + IL_0022: ldloc.1 + IL_0023: ldc.i4.s 10 + IL_0025: conv.i8 + IL_0026: blt.un.s IL_0011 + + IL_0028: ldloc.0 + IL_0029: ret + } + + .method public static int32[] f00000000() cil managed + { + + .maxstack 5 + .locals init (int32[] V_0, + uint64 V_1, + int32 V_2, + int32 V_3) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: conv.ovf.i.un + IL_0004: newarr [runtime]System.Int32 + IL_0009: stloc.0 + IL_000a: ldc.i4.0 + IL_000b: conv.i8 + IL_000c: stloc.1 + IL_000d: ldc.i4.1 + IL_000e: stloc.2 + IL_000f: br.s IL_0023 + + IL_0011: ldloc.0 + IL_0012: ldloc.1 + IL_0013: conv.i + IL_0014: ldloc.2 + IL_0015: stloc.3 + IL_0016: nop + IL_0017: nop + IL_0018: ldloc.3 + IL_0019: stelem.i4 + IL_001a: ldloc.2 + IL_001b: ldc.i4.1 + IL_001c: add + IL_001d: stloc.2 + IL_001e: ldloc.1 + IL_001f: ldc.i4.1 + IL_0020: conv.i8 + IL_0021: add + IL_0022: stloc.1 + IL_0023: ldloc.1 + IL_0024: ldc.i4.s 10 + IL_0026: conv.i8 + IL_0027: blt.un.s IL_0011 + + IL_0029: ldloc.0 + IL_002a: ret + } + + .method public static int32[] f000000000(int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 6 + .locals init (int32[] V_0, + uint64 V_1, + int32 V_2, + int32 V_3, + int32 V_4, + int32 V_5) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: conv.ovf.i.un + IL_0004: newarr [runtime]System.Int32 + IL_0009: stloc.0 + IL_000a: ldc.i4.0 + IL_000b: conv.i8 + IL_000c: stloc.1 + IL_000d: ldc.i4.1 + IL_000e: stloc.2 + IL_000f: br.s IL_0031 + + IL_0011: ldloc.0 + IL_0012: ldloc.1 + IL_0013: conv.i + IL_0014: ldloc.2 + IL_0015: stloc.3 + IL_0016: ldloc.3 + IL_0017: ldarg.0 + IL_0018: add + IL_0019: stloc.s V_4 + IL_001b: ldloc.3 + IL_001c: ldarg.1 + IL_001d: add + IL_001e: stloc.s V_5 + IL_0020: ldloc.3 + IL_0021: ldloc.s V_4 + IL_0023: add + IL_0024: ldloc.s V_5 + IL_0026: add + IL_0027: stelem.i4 + IL_0028: ldloc.2 + IL_0029: ldc.i4.1 + IL_002a: add + IL_002b: stloc.2 + IL_002c: ldloc.1 + IL_002d: ldc.i4.1 + IL_002e: conv.i8 + IL_002f: add + IL_0030: stloc.1 + IL_0031: ldloc.1 + IL_0032: ldc.i4.s 10 + IL_0034: conv.i8 + IL_0035: blt.un.s IL_0011 + + IL_0037: ldloc.0 + IL_0038: ret + } + + .method public static int32[] f0000000000(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 g) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 6 + .locals init (int32[] V_0, + uint64 V_1, + int32 V_2, + int32 V_3) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: conv.ovf.i.un + IL_0004: newarr [runtime]System.Int32 + IL_0009: stloc.0 + IL_000a: ldc.i4.0 + IL_000b: conv.i8 + IL_000c: stloc.1 + IL_000d: ldc.i4.1 + IL_000e: stloc.2 + IL_000f: br.s IL_0031 + + IL_0011: ldloc.0 + IL_0012: ldloc.1 + IL_0013: conv.i + IL_0014: ldloc.2 + IL_0015: stloc.3 + IL_0016: ldarg.0 + IL_0017: ldnull + IL_0018: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001d: pop + IL_001e: ldarg.1 + IL_001f: ldnull + IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0025: pop + IL_0026: ldloc.3 + IL_0027: stelem.i4 + IL_0028: ldloc.2 + IL_0029: ldc.i4.1 + IL_002a: add + IL_002b: stloc.2 + IL_002c: ldloc.1 + IL_002d: ldc.i4.1 + IL_002e: conv.i8 + IL_002f: add + IL_0030: stloc.1 + IL_0031: ldloc.1 + IL_0032: ldc.i4.s 10 + IL_0034: conv.i8 + IL_0035: blt.un.s IL_0011 + + IL_0037: ldloc.0 + IL_0038: ret + } + + .method public static int32[] f00000000000(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 g) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + class [runtime]System.IDisposable V_4) + IL_0000: nop + IL_0001: ldc.i4.1 + IL_0002: ldc.i4.1 + IL_0003: ldc.i4.s 10 + IL_0005: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000a: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_000f: stloc.1 + .try + { + IL_0010: br.s IL_0040 + + IL_0012: ldloc.1 + IL_0013: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0018: stloc.3 + IL_0019: ldloca.s V_0 + IL_001b: ldarg.0 + IL_001c: ldnull + IL_001d: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0022: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0027: nop + IL_0028: ldloca.s V_0 + IL_002a: ldarg.1 + IL_002b: ldnull + IL_002c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0031: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0036: nop + IL_0037: ldloca.s V_0 + IL_0039: ldloc.3 + IL_003a: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_003f: nop + IL_0040: ldloc.1 + IL_0041: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0046: brtrue.s IL_0012 + + IL_0048: ldnull + IL_0049: stloc.2 + IL_004a: leave.s IL_0061 + + } + finally + { + IL_004c: ldloc.1 + IL_004d: isinst [runtime]System.IDisposable + IL_0052: stloc.s V_4 + IL_0054: ldloc.s V_4 + IL_0056: brfalse.s IL_0060 + + IL_0058: ldloc.s V_4 + IL_005a: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_005f: endfinally + IL_0060: endfinally + } + IL_0061: ldloc.2 + IL_0062: pop + IL_0063: ldloca.s V_0 + IL_0065: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_006a: ret + } + .method public static int32[] f1() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeLists.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeLists.fs index 28a0890e1e4..277b51060c8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeLists.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeLists.fs @@ -2,6 +2,13 @@ let f00 f g = [|for n in 1..10 do f (); g (); yield n|] let f000 f = [for n in 1..10 do f (); yield n; yield n + 1] let f0000 () = [for n in 1..10 do yield n] +let f00000 () = [for n in 1..10 do n] +let f000000 () = [for n in 1..10 do let n = n in n] +let f0000000 () = [for n in 1..10 do let n = n in yield n] +let f00000000 () = [for n in 1..10 do let n = n in let n = n in yield n] +let f000000000 x y = [for n in 1..10 do let foo = n + x in let bar = n + y in yield n + foo + bar] +let f0000000000 f g = [for n in 1..10 do f (); g (); n] +let f00000000000 (f : unit -> int) (g : unit -> int) = [for n in 1..10 do f (); g (); n] let f1 () = [for n in 1..10 -> n] let f2 () = [for n in 10..1 -> n] let f3 () = [for n in 1..1..10 -> n] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeLists.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeLists.fs.il.bsl index 5b7741302d7..e4145ab1e12 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeLists.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeLists.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { @@ -250,6 +250,351 @@ IL_0028: ret } + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f00000() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + uint64 V_1, + int32 V_2, + int32 V_3) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.1 + IL_0003: ldc.i4.1 + IL_0004: stloc.2 + IL_0005: br.s IL_001b + + IL_0007: ldloca.s V_0 + IL_0009: ldloc.2 + IL_000a: stloc.3 + IL_000b: ldloc.3 + IL_000c: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0011: nop + IL_0012: ldloc.2 + IL_0013: ldc.i4.1 + IL_0014: add + IL_0015: stloc.2 + IL_0016: ldloc.1 + IL_0017: ldc.i4.1 + IL_0018: conv.i8 + IL_0019: add + IL_001a: stloc.1 + IL_001b: ldloc.1 + IL_001c: ldc.i4.s 10 + IL_001e: conv.i8 + IL_001f: blt.un.s IL_0007 + + IL_0021: ldloca.s V_0 + IL_0023: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0028: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f000000() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + uint64 V_1, + int32 V_2, + int32 V_3) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.1 + IL_0003: ldc.i4.1 + IL_0004: stloc.2 + IL_0005: br.s IL_001c + + IL_0007: ldloca.s V_0 + IL_0009: ldloc.2 + IL_000a: stloc.3 + IL_000b: nop + IL_000c: ldloc.3 + IL_000d: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0012: nop + IL_0013: ldloc.2 + IL_0014: ldc.i4.1 + IL_0015: add + IL_0016: stloc.2 + IL_0017: ldloc.1 + IL_0018: ldc.i4.1 + IL_0019: conv.i8 + IL_001a: add + IL_001b: stloc.1 + IL_001c: ldloc.1 + IL_001d: ldc.i4.s 10 + IL_001f: conv.i8 + IL_0020: blt.un.s IL_0007 + + IL_0022: ldloca.s V_0 + IL_0024: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0029: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f0000000() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + uint64 V_1, + int32 V_2, + int32 V_3) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.1 + IL_0003: ldc.i4.1 + IL_0004: stloc.2 + IL_0005: br.s IL_001c + + IL_0007: ldloca.s V_0 + IL_0009: ldloc.2 + IL_000a: stloc.3 + IL_000b: nop + IL_000c: ldloc.3 + IL_000d: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0012: nop + IL_0013: ldloc.2 + IL_0014: ldc.i4.1 + IL_0015: add + IL_0016: stloc.2 + IL_0017: ldloc.1 + IL_0018: ldc.i4.1 + IL_0019: conv.i8 + IL_001a: add + IL_001b: stloc.1 + IL_001c: ldloc.1 + IL_001d: ldc.i4.s 10 + IL_001f: conv.i8 + IL_0020: blt.un.s IL_0007 + + IL_0022: ldloca.s V_0 + IL_0024: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0029: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f00000000() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + uint64 V_1, + int32 V_2, + int32 V_3) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.1 + IL_0003: ldc.i4.1 + IL_0004: stloc.2 + IL_0005: br.s IL_001d + + IL_0007: ldloca.s V_0 + IL_0009: ldloc.2 + IL_000a: stloc.3 + IL_000b: nop + IL_000c: nop + IL_000d: ldloc.3 + IL_000e: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0013: nop + IL_0014: ldloc.2 + IL_0015: ldc.i4.1 + IL_0016: add + IL_0017: stloc.2 + IL_0018: ldloc.1 + IL_0019: ldc.i4.1 + IL_001a: conv.i8 + IL_001b: add + IL_001c: stloc.1 + IL_001d: ldloc.1 + IL_001e: ldc.i4.s 10 + IL_0020: conv.i8 + IL_0021: blt.un.s IL_0007 + + IL_0023: ldloca.s V_0 + IL_0025: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_002a: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f000000000(int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + uint64 V_1, + int32 V_2, + int32 V_3, + int32 V_4, + int32 V_5) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.1 + IL_0003: ldc.i4.1 + IL_0004: stloc.2 + IL_0005: br.s IL_002b + + IL_0007: ldloca.s V_0 + IL_0009: ldloc.2 + IL_000a: stloc.3 + IL_000b: ldloc.3 + IL_000c: ldarg.0 + IL_000d: add + IL_000e: stloc.s V_4 + IL_0010: ldloc.3 + IL_0011: ldarg.1 + IL_0012: add + IL_0013: stloc.s V_5 + IL_0015: ldloc.3 + IL_0016: ldloc.s V_4 + IL_0018: add + IL_0019: ldloc.s V_5 + IL_001b: add + IL_001c: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0021: nop + IL_0022: ldloc.2 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.2 + IL_0026: ldloc.1 + IL_0027: ldc.i4.1 + IL_0028: conv.i8 + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.1 + IL_002c: ldc.i4.s 10 + IL_002e: conv.i8 + IL_002f: blt.un.s IL_0007 + + IL_0031: ldloca.s V_0 + IL_0033: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0038: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f0000000000(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 g) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + uint64 V_1, + int32 V_2, + int32 V_3) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.1 + IL_0003: ldc.i4.1 + IL_0004: stloc.2 + IL_0005: br.s IL_002b + + IL_0007: ldloca.s V_0 + IL_0009: ldloc.2 + IL_000a: stloc.3 + IL_000b: ldarg.0 + IL_000c: ldnull + IL_000d: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0012: pop + IL_0013: ldarg.1 + IL_0014: ldnull + IL_0015: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001a: pop + IL_001b: ldloc.3 + IL_001c: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0021: nop + IL_0022: ldloc.2 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.2 + IL_0026: ldloc.1 + IL_0027: ldc.i4.1 + IL_0028: conv.i8 + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.1 + IL_002c: ldc.i4.s 10 + IL_002e: conv.i8 + IL_002f: blt.un.s IL_0007 + + IL_0031: ldloca.s V_0 + IL_0033: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0038: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f00000000000(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 g) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + class [runtime]System.IDisposable V_4) + IL_0000: nop + IL_0001: ldc.i4.1 + IL_0002: ldc.i4.1 + IL_0003: ldc.i4.s 10 + IL_0005: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000a: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_000f: stloc.1 + .try + { + IL_0010: br.s IL_0040 + + IL_0012: ldloc.1 + IL_0013: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0018: stloc.3 + IL_0019: ldloca.s V_0 + IL_001b: ldarg.0 + IL_001c: ldnull + IL_001d: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0022: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0027: nop + IL_0028: ldloca.s V_0 + IL_002a: ldarg.1 + IL_002b: ldnull + IL_002c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0031: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0036: nop + IL_0037: ldloca.s V_0 + IL_0039: ldloc.3 + IL_003a: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_003f: nop + IL_0040: ldloc.1 + IL_0041: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0046: brtrue.s IL_0012 + + IL_0048: ldnull + IL_0049: stloc.2 + IL_004a: leave.s IL_0061 + + } + finally + { + IL_004c: ldloc.1 + IL_004d: isinst [runtime]System.IDisposable + IL_0052: stloc.s V_4 + IL_0054: ldloc.s V_4 + IL_0056: brfalse.s IL_0060 + + IL_0058: ldloc.s V_4 + IL_005a: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_005f: endfinally + IL_0060: endfinally + } + IL_0061: ldloc.2 + IL_0062: pop + IL_0063: ldloca.s V_0 + IL_0065: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_006a: ret + } + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f1() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToArray.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToArray.fs index c552cb7dee1..1f55bc40d91 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToArray.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToArray.fs @@ -1,4 +1,15 @@ -let f1 (array: int array) = [|for x in array -> x|] +let f0 (array: int array) = [|for x in array do x|] +let f00 (array: int array) = [|for x in array do yield x|] +let f000 (array: int array) = [|for x in array do let x = x in yield x|] +let f0000 (array: int array) = [|for x in array do let x = x in x|] +let f00000 (array: int array) x y = [|for z in array do let foo = z + x in let bar = z + y in yield z + foo + bar|] +let f000000 (array: int array) x y = [|for z in array do let foo = z + x in let bar = z + y in z + foo + bar|] +let f0000000 (array: int array) f x y = [|for z in array do f (); let foo = z + x in let bar = z + y in z + foo + bar|] +let f00000000 (array: int array) f x y = [|for z in array do let foo = z + x in f (); let bar = z + y in z + foo + bar|] +let f000000000 (array: int array) f x y = [|for z in array do let foo = z + x in let bar = z + y in f (); z + foo + bar|] +let f0000000000 (array: int array) (f : unit -> int) x y = [|for z in array do let foo = z + x in let bar = z + y in f (); z + foo + bar|] + +let f1 (array: int array) = [|for x in array -> x|] let f2 f (array: int array) = [|for x in array -> f x|] let f3 f (array: int array) = [|for x in array -> f (); x|] let f4 f g (array: int array) = [|for x in array -> f (); g(); x|] @@ -10,3 +21,17 @@ let f8 f g (array: int array) = [|let y = f () in let z = g () in for x in array let f9 f g (array: int array) = [|let y = f () in g (); for x in array -> x + y|] let f10 f g (array: int array) = [|f (); g (); for x in array -> x|] let f11 f g (array: int array) = [|f (); let y = g () in for x in array -> x + y|] +let f12 (f: unit -> int array) y = [|for x in f () -> x + y|] + +// https://github.com/dotnet/fsharp/issues/17708 +// Don't read or rebind the loop variable when it is not in scope in the body. +let ``for _ in Array.groupBy id [||] do ...`` () = [|for _ in Array.groupBy id [||] do 0|] +let ``for _ | _ in Array.groupBy id [||] do ...`` () = [|for _ | _ in Array.groupBy id [||] do 0|] +let ``for _ & _ in Array.groupBy id [||] do ...`` () = [|for _ & _ in Array.groupBy id [||] do 0|] +let ``for _, _group in Array.groupBy id [||] do ...`` () = [|for _, _group in Array.groupBy id [||] do 0|] +let ``for _, group in Array.groupBy id [||] do ...`` () = [|for _, group in Array.groupBy id [||] do group.Length|] +let ``for 1 | 2 | _ in ...`` () = [|for 1 | 2 | _ in [||] do 0|] +let ``for Failure _ | _ in ...`` () = [|for Failure _ | _ in [||] do 0|] +let ``for true | false in ...`` () = [|for true | false in [||] do 0|] +let ``for true | _ in ...`` () = [|for true | _ in [||] do 0|] +let ``for _ | true in ...`` () = [|for _ | true in [||] do 0|] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToArray.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToArray.fs.il.bsl index b91b49aec7d..2e1eeb67e45 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToArray.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToArray.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { @@ -43,43 +43,769 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .method public static int32[] f1(int32[] 'array') cil managed + .class auto ansi serializable sealed nested assembly beforefieldinit 'for _ in Array-groupBy id -||- do ---@28' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/'for _ in Array-groupBy id -||- do ---@28' @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance object Invoke(object x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/'for _ in Array-groupBy id -||- do ---@28'::.ctor() + IL_0005: stsfld class assembly/'for _ in Array-groupBy id -||- do ---@28' assembly/'for _ in Array-groupBy id -||- do ---@28'::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'for _ | _ in Array-groupBy id -||- do ---@29' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/'for _ | _ in Array-groupBy id -||- do ---@29' @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance object Invoke(object x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/'for _ | _ in Array-groupBy id -||- do ---@29'::.ctor() + IL_0005: stsfld class assembly/'for _ | _ in Array-groupBy id -||- do ---@29' assembly/'for _ | _ in Array-groupBy id -||- do ---@29'::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'for _ - _ in Array-groupBy id -||- do ---@30' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/'for _ - _ in Array-groupBy id -||- do ---@30' @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance object Invoke(object x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/'for _ - _ in Array-groupBy id -||- do ---@30'::.ctor() + IL_0005: stsfld class assembly/'for _ - _ in Array-groupBy id -||- do ---@30' assembly/'for _ - _ in Array-groupBy id -||- do ---@30'::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'for _, _group in Array-groupBy id -||- do ---@31' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/'for _, _group in Array-groupBy id -||- do ---@31' @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance object Invoke(object x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/'for _, _group in Array-groupBy id -||- do ---@31'::.ctor() + IL_0005: stsfld class assembly/'for _, _group in Array-groupBy id -||- do ---@31' assembly/'for _, _group in Array-groupBy id -||- do ---@31'::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'for _, group in Array-groupBy id -||- do ---@32' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/'for _, group in Array-groupBy id -||- do ---@32' @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance object Invoke(object x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/'for _, group in Array-groupBy id -||- do ---@32'::.ctor() + IL_0005: stsfld class assembly/'for _, group in Array-groupBy id -||- do ---@32' assembly/'for _, group in Array-groupBy id -||- do ---@32'::@_instance + IL_000a: ret + } + + } + + .method public static int32[] f0(int32[] 'array') cil managed { .maxstack 6 .locals init (int32[] V_0, - int32 V_1, - int32 V_2) + int32[] V_1, + int32 V_2, + int32 V_3) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: ldlen + IL_0004: conv.i4 + IL_0005: newarr [runtime]System.Int32 + IL_000a: stloc.1 + IL_000b: ldc.i4.0 + IL_000c: stloc.2 + IL_000d: br.s IL_001b + + IL_000f: ldloc.1 + IL_0010: ldloc.2 + IL_0011: ldloc.0 + IL_0012: ldloc.2 + IL_0013: ldelem.i4 + IL_0014: stloc.3 + IL_0015: ldloc.3 + IL_0016: stelem.i4 + IL_0017: ldloc.2 + IL_0018: ldc.i4.1 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.2 + IL_001c: ldloc.1 + IL_001d: ldlen + IL_001e: conv.i4 + IL_001f: blt.s IL_000f + + IL_0021: ldloc.1 + IL_0022: ret + } + + .method public static int32[] f00(int32[] 'array') cil managed + { + + .maxstack 6 + .locals init (int32[] V_0, + int32[] V_1, + int32 V_2, + int32 V_3) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: ldlen + IL_0004: conv.i4 + IL_0005: newarr [runtime]System.Int32 + IL_000a: stloc.1 + IL_000b: ldc.i4.0 + IL_000c: stloc.2 + IL_000d: br.s IL_001b + + IL_000f: ldloc.1 + IL_0010: ldloc.2 + IL_0011: ldloc.0 + IL_0012: ldloc.2 + IL_0013: ldelem.i4 + IL_0014: stloc.3 + IL_0015: ldloc.3 + IL_0016: stelem.i4 + IL_0017: ldloc.2 + IL_0018: ldc.i4.1 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.2 + IL_001c: ldloc.1 + IL_001d: ldlen + IL_001e: conv.i4 + IL_001f: blt.s IL_000f + + IL_0021: ldloc.1 + IL_0022: ret + } + + .method public static int32[] f000(int32[] 'array') cil managed + { + + .maxstack 6 + .locals init (int32[] V_0, + int32[] V_1, + int32 V_2, + int32 V_3) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: ldlen + IL_0004: conv.i4 + IL_0005: newarr [runtime]System.Int32 + IL_000a: stloc.1 + IL_000b: ldc.i4.0 + IL_000c: stloc.2 + IL_000d: br.s IL_001c + + IL_000f: ldloc.1 + IL_0010: ldloc.2 + IL_0011: ldloc.0 + IL_0012: ldloc.2 + IL_0013: ldelem.i4 + IL_0014: stloc.3 + IL_0015: nop + IL_0016: ldloc.3 + IL_0017: stelem.i4 + IL_0018: ldloc.2 + IL_0019: ldc.i4.1 + IL_001a: add + IL_001b: stloc.2 + IL_001c: ldloc.2 + IL_001d: ldloc.1 + IL_001e: ldlen + IL_001f: conv.i4 + IL_0020: blt.s IL_000f + + IL_0022: ldloc.1 + IL_0023: ret + } + + .method public static int32[] f0000(int32[] 'array') cil managed + { + + .maxstack 6 + .locals init (int32[] V_0, + int32[] V_1, + int32 V_2, + int32 V_3) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: ldlen + IL_0004: conv.i4 + IL_0005: newarr [runtime]System.Int32 + IL_000a: stloc.1 + IL_000b: ldc.i4.0 + IL_000c: stloc.2 + IL_000d: br.s IL_001c + + IL_000f: ldloc.1 + IL_0010: ldloc.2 + IL_0011: ldloc.0 + IL_0012: ldloc.2 + IL_0013: ldelem.i4 + IL_0014: stloc.3 + IL_0015: nop + IL_0016: ldloc.3 + IL_0017: stelem.i4 + IL_0018: ldloc.2 + IL_0019: ldc.i4.1 + IL_001a: add + IL_001b: stloc.2 + IL_001c: ldloc.2 + IL_001d: ldloc.1 + IL_001e: ldlen + IL_001f: conv.i4 + IL_0020: blt.s IL_000f + + IL_0022: ldloc.1 + IL_0023: ret + } + + .method public static int32[] f00000(int32[] 'array', + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 6 + .locals init (int32[] V_0, + int32[] V_1, + int32 V_2, + int32 V_3, + int32 V_4, + int32 V_5) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: ldlen + IL_0004: conv.i4 + IL_0005: newarr [runtime]System.Int32 + IL_000a: stloc.1 + IL_000b: ldc.i4.0 + IL_000c: stloc.2 + IL_000d: br.s IL_002b + + IL_000f: ldloc.1 + IL_0010: ldloc.2 + IL_0011: ldloc.0 + IL_0012: ldloc.2 + IL_0013: ldelem.i4 + IL_0014: stloc.3 + IL_0015: ldloc.3 + IL_0016: ldarg.1 + IL_0017: add + IL_0018: stloc.s V_4 + IL_001a: ldloc.3 + IL_001b: ldarg.2 + IL_001c: add + IL_001d: stloc.s V_5 + IL_001f: ldloc.3 + IL_0020: ldloc.s V_4 + IL_0022: add + IL_0023: ldloc.s V_5 + IL_0025: add + IL_0026: stelem.i4 + IL_0027: ldloc.2 + IL_0028: ldc.i4.1 + IL_0029: add + IL_002a: stloc.2 + IL_002b: ldloc.2 + IL_002c: ldloc.1 + IL_002d: ldlen + IL_002e: conv.i4 + IL_002f: blt.s IL_000f + + IL_0031: ldloc.1 + IL_0032: ret + } + + .method public static int32[] f000000(int32[] 'array', + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 6 + .locals init (int32[] V_0, + int32[] V_1, + int32 V_2, + int32 V_3, + int32 V_4, + int32 V_5) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: ldlen + IL_0004: conv.i4 + IL_0005: newarr [runtime]System.Int32 + IL_000a: stloc.1 + IL_000b: ldc.i4.0 + IL_000c: stloc.2 + IL_000d: br.s IL_002b + + IL_000f: ldloc.1 + IL_0010: ldloc.2 + IL_0011: ldloc.0 + IL_0012: ldloc.2 + IL_0013: ldelem.i4 + IL_0014: stloc.3 + IL_0015: ldloc.3 + IL_0016: ldarg.1 + IL_0017: add + IL_0018: stloc.s V_4 + IL_001a: ldloc.3 + IL_001b: ldarg.2 + IL_001c: add + IL_001d: stloc.s V_5 + IL_001f: ldloc.3 + IL_0020: ldloc.s V_4 + IL_0022: add + IL_0023: ldloc.s V_5 + IL_0025: add + IL_0026: stelem.i4 + IL_0027: ldloc.2 + IL_0028: ldc.i4.1 + IL_0029: add + IL_002a: stloc.2 + IL_002b: ldloc.2 + IL_002c: ldloc.1 + IL_002d: ldlen + IL_002e: conv.i4 + IL_002f: blt.s IL_000f + + IL_0031: ldloc.1 + IL_0032: ret + } + + .method public static int32[] f0000000(int32[] 'array', + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 6 + .locals init (int32[] V_0, + int32[] V_1, + int32 V_2, + int32 V_3, + int32 V_4, + int32 V_5) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: ldlen + IL_0004: conv.i4 + IL_0005: newarr [runtime]System.Int32 + IL_000a: stloc.1 + IL_000b: ldc.i4.0 + IL_000c: stloc.2 + IL_000d: br.s IL_0033 + + IL_000f: ldloc.1 + IL_0010: ldloc.2 + IL_0011: ldloc.0 + IL_0012: ldloc.2 + IL_0013: ldelem.i4 + IL_0014: stloc.3 + IL_0015: ldarg.1 + IL_0016: ldnull + IL_0017: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001c: pop + IL_001d: ldloc.3 + IL_001e: ldarg.2 + IL_001f: add + IL_0020: stloc.s V_4 + IL_0022: ldloc.3 + IL_0023: ldarg.3 + IL_0024: add + IL_0025: stloc.s V_5 + IL_0027: ldloc.3 + IL_0028: ldloc.s V_4 + IL_002a: add + IL_002b: ldloc.s V_5 + IL_002d: add + IL_002e: stelem.i4 + IL_002f: ldloc.2 + IL_0030: ldc.i4.1 + IL_0031: add + IL_0032: stloc.2 + IL_0033: ldloc.2 + IL_0034: ldloc.1 + IL_0035: ldlen + IL_0036: conv.i4 + IL_0037: blt.s IL_000f + + IL_0039: ldloc.1 + IL_003a: ret + } + + .method public static int32[] f00000000(int32[] 'array', + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 6 + .locals init (int32[] V_0, + int32[] V_1, + int32 V_2, + int32 V_3, + int32 V_4, + int32 V_5) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: ldlen + IL_0004: conv.i4 + IL_0005: newarr [runtime]System.Int32 + IL_000a: stloc.1 + IL_000b: ldc.i4.0 + IL_000c: stloc.2 + IL_000d: br.s IL_0033 + + IL_000f: ldloc.1 + IL_0010: ldloc.2 + IL_0011: ldloc.0 + IL_0012: ldloc.2 + IL_0013: ldelem.i4 + IL_0014: stloc.3 + IL_0015: ldloc.3 + IL_0016: ldarg.2 + IL_0017: add + IL_0018: stloc.s V_4 + IL_001a: ldarg.1 + IL_001b: ldnull + IL_001c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0021: pop + IL_0022: ldloc.3 + IL_0023: ldarg.3 + IL_0024: add + IL_0025: stloc.s V_5 + IL_0027: ldloc.3 + IL_0028: ldloc.s V_4 + IL_002a: add + IL_002b: ldloc.s V_5 + IL_002d: add + IL_002e: stelem.i4 + IL_002f: ldloc.2 + IL_0030: ldc.i4.1 + IL_0031: add + IL_0032: stloc.2 + IL_0033: ldloc.2 + IL_0034: ldloc.1 + IL_0035: ldlen + IL_0036: conv.i4 + IL_0037: blt.s IL_000f + + IL_0039: ldloc.1 + IL_003a: ret + } + + .method public static int32[] f000000000(int32[] 'array', + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 6 + .locals init (int32[] V_0, + int32[] V_1, + int32 V_2, + int32 V_3, + int32 V_4, + int32 V_5) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: ldlen + IL_0004: conv.i4 + IL_0005: newarr [runtime]System.Int32 + IL_000a: stloc.1 + IL_000b: ldc.i4.0 + IL_000c: stloc.2 + IL_000d: br.s IL_0033 + + IL_000f: ldloc.1 + IL_0010: ldloc.2 + IL_0011: ldloc.0 + IL_0012: ldloc.2 + IL_0013: ldelem.i4 + IL_0014: stloc.3 + IL_0015: ldloc.3 + IL_0016: ldarg.2 + IL_0017: add + IL_0018: stloc.s V_4 + IL_001a: ldloc.3 + IL_001b: ldarg.3 + IL_001c: add + IL_001d: stloc.s V_5 + IL_001f: ldarg.1 + IL_0020: ldnull + IL_0021: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0026: pop + IL_0027: ldloc.3 + IL_0028: ldloc.s V_4 + IL_002a: add + IL_002b: ldloc.s V_5 + IL_002d: add + IL_002e: stelem.i4 + IL_002f: ldloc.2 + IL_0030: ldc.i4.1 + IL_0031: add + IL_0032: stloc.2 + IL_0033: ldloc.2 + IL_0034: ldloc.1 + IL_0035: ldlen + IL_0036: conv.i4 + IL_0037: blt.s IL_000f + + IL_0039: ldloc.1 + IL_003a: ret + } + + .method public static int32[] f0000000000(int32[] 'array', + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) IL_0000: nop IL_0001: ldarg.0 - IL_0002: ldlen - IL_0003: conv.i4 - IL_0004: newarr [runtime]System.Int32 - IL_0009: stloc.0 - IL_000a: ldc.i4.0 - IL_000b: stloc.1 - IL_000c: br.s IL_001a - - IL_000e: ldloc.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0039 + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.2 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldloc.3 + IL_0017: ldarg.3 + IL_0018: add + IL_0019: stloc.s V_5 + IL_001b: ldloca.s V_0 + IL_001d: ldarg.1 + IL_001e: ldnull + IL_001f: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0024: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0029: nop + IL_002a: ldloca.s V_0 + IL_002c: ldloc.3 + IL_002d: ldloc.s V_4 + IL_002f: add + IL_0030: ldloc.s V_5 + IL_0032: add + IL_0033: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0038: nop + IL_0039: ldloc.1 + IL_003a: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_003f: brtrue.s IL_000a + + IL_0041: ldnull + IL_0042: stloc.2 + IL_0043: leave.s IL_005a + + } + finally + { + IL_0045: ldloc.1 + IL_0046: isinst [runtime]System.IDisposable + IL_004b: stloc.s V_6 + IL_004d: ldloc.s V_6 + IL_004f: brfalse.s IL_0059 + + IL_0051: ldloc.s V_6 + IL_0053: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0058: endfinally + IL_0059: endfinally + } + IL_005a: ldloc.2 + IL_005b: pop + IL_005c: ldloca.s V_0 + IL_005e: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_0063: ret + } + + .method public static int32[] f1(int32[] 'array') cil managed + { + + .maxstack 6 + .locals init (int32[] V_0, + int32[] V_1, + int32 V_2, + int32 V_3) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: ldlen + IL_0004: conv.i4 + IL_0005: newarr [runtime]System.Int32 + IL_000a: stloc.1 + IL_000b: ldc.i4.0 + IL_000c: stloc.2 + IL_000d: br.s IL_001b + IL_000f: ldloc.1 - IL_0010: ldarg.0 - IL_0011: ldloc.1 - IL_0012: ldelem.i4 - IL_0013: stloc.2 - IL_0014: ldloc.2 - IL_0015: stelem.i4 - IL_0016: ldloc.1 - IL_0017: ldc.i4.1 - IL_0018: add - IL_0019: stloc.1 - IL_001a: ldloc.1 - IL_001b: ldloc.0 - IL_001c: ldlen - IL_001d: conv.i4 - IL_001e: blt.s IL_000e + IL_0010: ldloc.2 + IL_0011: ldloc.0 + IL_0012: ldloc.2 + IL_0013: ldelem.i4 + IL_0014: stloc.3 + IL_0015: ldloc.3 + IL_0016: stelem.i4 + IL_0017: ldloc.2 + IL_0018: ldc.i4.1 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.2 + IL_001c: ldloc.1 + IL_001d: ldlen + IL_001e: conv.i4 + IL_001f: blt.s IL_000f - IL_0020: ldloc.0 - IL_0021: ret + IL_0021: ldloc.1 + IL_0022: ret } .method public static !!a[] f2(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, @@ -88,41 +814,43 @@ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) .maxstack 6 - .locals init (!!a[] V_0, - int32 V_1, - int32 V_2) - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: ldlen - IL_0003: conv.i4 - IL_0004: newarr !!a - IL_0009: stloc.0 - IL_000a: ldc.i4.0 - IL_000b: stloc.1 - IL_000c: br.s IL_0024 - - IL_000e: ldloc.0 + .locals init (int32[] V_0, + !!a[] V_1, + int32 V_2, + int32 V_3) + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: ldlen + IL_0004: conv.i4 + IL_0005: newarr !!a + IL_000a: stloc.1 + IL_000b: ldc.i4.0 + IL_000c: stloc.2 + IL_000d: br.s IL_0025 + IL_000f: ldloc.1 - IL_0010: ldarg.1 - IL_0011: ldloc.1 - IL_0012: ldelem.i4 - IL_0013: stloc.2 - IL_0014: ldarg.0 - IL_0015: ldloc.2 - IL_0016: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_001b: stelem !!a - IL_0020: ldloc.1 - IL_0021: ldc.i4.1 - IL_0022: add - IL_0023: stloc.1 - IL_0024: ldloc.1 - IL_0025: ldloc.0 - IL_0026: ldlen - IL_0027: conv.i4 - IL_0028: blt.s IL_000e + IL_0010: ldloc.2 + IL_0011: ldloc.0 + IL_0012: ldloc.2 + IL_0013: ldelem.i4 + IL_0014: stloc.3 + IL_0015: ldarg.0 + IL_0016: ldloc.3 + IL_0017: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001c: stelem !!a + IL_0021: ldloc.2 + IL_0022: ldc.i4.1 + IL_0023: add + IL_0024: stloc.2 + IL_0025: ldloc.2 + IL_0026: ldloc.1 + IL_0027: ldlen + IL_0028: conv.i4 + IL_0029: blt.s IL_000f - IL_002a: ldloc.0 - IL_002b: ret + IL_002b: ldloc.1 + IL_002c: ret } .method public static int32[] f3(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, @@ -132,42 +860,44 @@ .maxstack 6 .locals init (int32[] V_0, - int32 V_1, - int32 V_2) - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: ldlen - IL_0003: conv.i4 - IL_0004: newarr [runtime]System.Int32 - IL_0009: stloc.0 - IL_000a: ldc.i4.0 - IL_000b: stloc.1 - IL_000c: br.s IL_0022 - - IL_000e: ldloc.0 + int32[] V_1, + int32 V_2, + int32 V_3) + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: ldlen + IL_0004: conv.i4 + IL_0005: newarr [runtime]System.Int32 + IL_000a: stloc.1 + IL_000b: ldc.i4.0 + IL_000c: stloc.2 + IL_000d: br.s IL_0023 + IL_000f: ldloc.1 - IL_0010: ldarg.1 - IL_0011: ldloc.1 - IL_0012: ldelem.i4 - IL_0013: stloc.2 - IL_0014: ldarg.0 - IL_0015: ldnull - IL_0016: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_001b: pop - IL_001c: ldloc.2 - IL_001d: stelem.i4 - IL_001e: ldloc.1 - IL_001f: ldc.i4.1 - IL_0020: add - IL_0021: stloc.1 - IL_0022: ldloc.1 - IL_0023: ldloc.0 - IL_0024: ldlen - IL_0025: conv.i4 - IL_0026: blt.s IL_000e + IL_0010: ldloc.2 + IL_0011: ldloc.0 + IL_0012: ldloc.2 + IL_0013: ldelem.i4 + IL_0014: stloc.3 + IL_0015: ldarg.0 + IL_0016: ldnull + IL_0017: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001c: pop + IL_001d: ldloc.3 + IL_001e: stelem.i4 + IL_001f: ldloc.2 + IL_0020: ldc.i4.1 + IL_0021: add + IL_0022: stloc.2 + IL_0023: ldloc.2 + IL_0024: ldloc.1 + IL_0025: ldlen + IL_0026: conv.i4 + IL_0027: blt.s IL_000f - IL_0028: ldloc.0 - IL_0029: ret + IL_0029: ldloc.1 + IL_002a: ret } .method public static int32[] f4(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, @@ -179,46 +909,48 @@ .maxstack 6 .locals init (int32[] V_0, - int32 V_1, - int32 V_2) - IL_0000: nop - IL_0001: ldarg.2 - IL_0002: ldlen - IL_0003: conv.i4 - IL_0004: newarr [runtime]System.Int32 - IL_0009: stloc.0 - IL_000a: ldc.i4.0 - IL_000b: stloc.1 - IL_000c: br.s IL_002a - - IL_000e: ldloc.0 + int32[] V_1, + int32 V_2, + int32 V_3) + IL_0000: ldarg.2 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: ldlen + IL_0004: conv.i4 + IL_0005: newarr [runtime]System.Int32 + IL_000a: stloc.1 + IL_000b: ldc.i4.0 + IL_000c: stloc.2 + IL_000d: br.s IL_002b + IL_000f: ldloc.1 - IL_0010: ldarg.2 - IL_0011: ldloc.1 - IL_0012: ldelem.i4 - IL_0013: stloc.2 - IL_0014: ldarg.0 - IL_0015: ldnull - IL_0016: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_001b: pop - IL_001c: ldarg.1 - IL_001d: ldnull - IL_001e: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0023: pop - IL_0024: ldloc.2 - IL_0025: stelem.i4 - IL_0026: ldloc.1 - IL_0027: ldc.i4.1 - IL_0028: add - IL_0029: stloc.1 - IL_002a: ldloc.1 - IL_002b: ldloc.0 - IL_002c: ldlen - IL_002d: conv.i4 - IL_002e: blt.s IL_000e + IL_0010: ldloc.2 + IL_0011: ldloc.0 + IL_0012: ldloc.2 + IL_0013: ldelem.i4 + IL_0014: stloc.3 + IL_0015: ldarg.0 + IL_0016: ldnull + IL_0017: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001c: pop + IL_001d: ldarg.1 + IL_001e: ldnull + IL_001f: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0024: pop + IL_0025: ldloc.3 + IL_0026: stelem.i4 + IL_0027: ldloc.2 + IL_0028: ldc.i4.1 + IL_0029: add + IL_002a: stloc.2 + IL_002b: ldloc.2 + IL_002c: ldloc.1 + IL_002d: ldlen + IL_002e: conv.i4 + IL_002f: blt.s IL_000f - IL_0030: ldloc.0 - IL_0031: ret + IL_0031: ldloc.1 + IL_0032: ret } .method public static int32[] f5(int32[] 'array') cil managed @@ -226,38 +958,40 @@ .maxstack 6 .locals init (int32[] V_0, - int32 V_1, - int32 V_2) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldlen - IL_0003: conv.i4 - IL_0004: newarr [runtime]System.Int32 - IL_0009: stloc.0 - IL_000a: ldc.i4.0 - IL_000b: stloc.1 - IL_000c: br.s IL_001a - - IL_000e: ldloc.0 + int32[] V_1, + int32 V_2, + int32 V_3) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: ldlen + IL_0004: conv.i4 + IL_0005: newarr [runtime]System.Int32 + IL_000a: stloc.1 + IL_000b: ldc.i4.0 + IL_000c: stloc.2 + IL_000d: br.s IL_001b + IL_000f: ldloc.1 - IL_0010: ldarg.0 - IL_0011: ldloc.1 - IL_0012: ldelem.i4 - IL_0013: stloc.2 - IL_0014: ldloc.2 - IL_0015: stelem.i4 - IL_0016: ldloc.1 - IL_0017: ldc.i4.1 - IL_0018: add - IL_0019: stloc.1 - IL_001a: ldloc.1 - IL_001b: ldloc.0 - IL_001c: ldlen - IL_001d: conv.i4 - IL_001e: blt.s IL_000e + IL_0010: ldloc.2 + IL_0011: ldloc.0 + IL_0012: ldloc.2 + IL_0013: ldelem.i4 + IL_0014: stloc.3 + IL_0015: ldloc.3 + IL_0016: stelem.i4 + IL_0017: ldloc.2 + IL_0018: ldc.i4.1 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.2 + IL_001c: ldloc.1 + IL_001d: ldlen + IL_001e: conv.i4 + IL_001f: blt.s IL_000f - IL_0020: ldloc.0 - IL_0021: ret + IL_0021: ldloc.1 + IL_0022: ret } .method public static int32[] f6(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, @@ -267,42 +1001,44 @@ .maxstack 6 .locals init (int32[] V_0, - int32 V_1, - int32 V_2) - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: ldlen - IL_0003: conv.i4 - IL_0004: newarr [runtime]System.Int32 - IL_0009: stloc.0 - IL_000a: ldc.i4.0 - IL_000b: stloc.1 - IL_000c: br.s IL_0022 - - IL_000e: ldloc.0 + int32[] V_1, + int32 V_2, + int32 V_3) + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: ldlen + IL_0004: conv.i4 + IL_0005: newarr [runtime]System.Int32 + IL_000a: stloc.1 + IL_000b: ldc.i4.0 + IL_000c: stloc.2 + IL_000d: br.s IL_0023 + IL_000f: ldloc.1 - IL_0010: ldarg.1 - IL_0011: ldloc.1 - IL_0012: ldelem.i4 - IL_0013: stloc.2 - IL_0014: ldarg.0 - IL_0015: ldnull - IL_0016: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_001b: pop - IL_001c: ldloc.2 - IL_001d: stelem.i4 - IL_001e: ldloc.1 - IL_001f: ldc.i4.1 - IL_0020: add - IL_0021: stloc.1 - IL_0022: ldloc.1 - IL_0023: ldloc.0 - IL_0024: ldlen - IL_0025: conv.i4 - IL_0026: blt.s IL_000e + IL_0010: ldloc.2 + IL_0011: ldloc.0 + IL_0012: ldloc.2 + IL_0013: ldelem.i4 + IL_0014: stloc.3 + IL_0015: ldarg.0 + IL_0016: ldnull + IL_0017: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001c: pop + IL_001d: ldloc.3 + IL_001e: stelem.i4 + IL_001f: ldloc.2 + IL_0020: ldc.i4.1 + IL_0021: add + IL_0022: stloc.2 + IL_0023: ldloc.2 + IL_0024: ldloc.1 + IL_0025: ldlen + IL_0026: conv.i4 + IL_0027: blt.s IL_000f - IL_0028: ldloc.0 - IL_0029: ret + IL_0029: ldloc.1 + IL_002a: ret } .method public static int32[] f7(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, @@ -314,46 +1050,48 @@ .maxstack 6 .locals init (int32[] V_0, - int32 V_1, - int32 V_2) - IL_0000: nop - IL_0001: ldarg.2 - IL_0002: ldlen - IL_0003: conv.i4 - IL_0004: newarr [runtime]System.Int32 - IL_0009: stloc.0 - IL_000a: ldc.i4.0 - IL_000b: stloc.1 - IL_000c: br.s IL_002a - - IL_000e: ldloc.0 + int32[] V_1, + int32 V_2, + int32 V_3) + IL_0000: ldarg.2 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: ldlen + IL_0004: conv.i4 + IL_0005: newarr [runtime]System.Int32 + IL_000a: stloc.1 + IL_000b: ldc.i4.0 + IL_000c: stloc.2 + IL_000d: br.s IL_002b + IL_000f: ldloc.1 - IL_0010: ldarg.2 - IL_0011: ldloc.1 - IL_0012: ldelem.i4 - IL_0013: stloc.2 - IL_0014: ldarg.0 - IL_0015: ldnull - IL_0016: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_001b: pop - IL_001c: ldarg.1 - IL_001d: ldnull - IL_001e: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0023: pop - IL_0024: ldloc.2 - IL_0025: stelem.i4 - IL_0026: ldloc.1 - IL_0027: ldc.i4.1 - IL_0028: add - IL_0029: stloc.1 - IL_002a: ldloc.1 - IL_002b: ldloc.0 - IL_002c: ldlen - IL_002d: conv.i4 - IL_002e: blt.s IL_000e + IL_0010: ldloc.2 + IL_0011: ldloc.0 + IL_0012: ldloc.2 + IL_0013: ldelem.i4 + IL_0014: stloc.3 + IL_0015: ldarg.0 + IL_0016: ldnull + IL_0017: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001c: pop + IL_001d: ldarg.1 + IL_001e: ldnull + IL_001f: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0024: pop + IL_0025: ldloc.3 + IL_0026: stelem.i4 + IL_0027: ldloc.2 + IL_0028: ldc.i4.1 + IL_0029: add + IL_002a: stloc.2 + IL_002b: ldloc.2 + IL_002c: ldloc.1 + IL_002d: ldlen + IL_002e: conv.i4 + IL_002f: blt.s IL_000f - IL_0030: ldloc.0 - IL_0031: ret + IL_0031: ldloc.1 + IL_0032: ret } .method public static int32[] f8(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, @@ -367,8 +1105,9 @@ .locals init (int32 V_0, int32 V_1, int32[] V_2, - int32 V_3, - int32 V_4) + int32[] V_3, + int32 V_4, + int32 V_5) IL_0000: nop IL_0001: ldarg.0 IL_0002: ldnull @@ -378,40 +1117,41 @@ IL_000a: ldnull IL_000b: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) IL_0010: stloc.1 - IL_0011: nop - IL_0012: ldarg.2 - IL_0013: ldlen - IL_0014: conv.i4 - IL_0015: newarr [runtime]System.Int32 - IL_001a: stloc.2 - IL_001b: ldc.i4.0 - IL_001c: stloc.3 - IL_001d: br.s IL_0031 + IL_0011: ldarg.2 + IL_0012: stloc.2 + IL_0013: ldloc.2 + IL_0014: ldlen + IL_0015: conv.i4 + IL_0016: newarr [runtime]System.Int32 + IL_001b: stloc.3 + IL_001c: ldc.i4.0 + IL_001d: stloc.s V_4 + IL_001f: br.s IL_0037 - IL_001f: ldloc.2 - IL_0020: ldloc.3 - IL_0021: ldarg.2 - IL_0022: ldloc.3 - IL_0023: ldelem.i4 - IL_0024: stloc.s V_4 - IL_0026: ldloc.s V_4 - IL_0028: ldloc.0 - IL_0029: add - IL_002a: ldloc.1 - IL_002b: add - IL_002c: stelem.i4 - IL_002d: ldloc.3 - IL_002e: ldc.i4.1 + IL_0021: ldloc.3 + IL_0022: ldloc.s V_4 + IL_0024: ldloc.2 + IL_0025: ldloc.s V_4 + IL_0027: ldelem.i4 + IL_0028: stloc.s V_5 + IL_002a: ldloc.s V_5 + IL_002c: ldloc.0 + IL_002d: add + IL_002e: ldloc.1 IL_002f: add - IL_0030: stloc.3 - IL_0031: ldloc.3 - IL_0032: ldloc.2 - IL_0033: ldlen - IL_0034: conv.i4 - IL_0035: blt.s IL_001f + IL_0030: stelem.i4 + IL_0031: ldloc.s V_4 + IL_0033: ldc.i4.1 + IL_0034: add + IL_0035: stloc.s V_4 + IL_0037: ldloc.s V_4 + IL_0039: ldloc.3 + IL_003a: ldlen + IL_003b: conv.i4 + IL_003c: blt.s IL_0021 - IL_0037: ldloc.2 - IL_0038: ret + IL_003e: ldloc.3 + IL_003f: ret } .method public static int32[] f9(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, @@ -424,8 +1164,9 @@ .maxstack 6 .locals init (int32 V_0, int32[] V_1, - int32 V_2, - int32 V_3) + int32[] V_2, + int32 V_3, + int32 V_4) IL_0000: nop IL_0001: ldarg.0 IL_0002: ldnull @@ -435,38 +1176,39 @@ IL_000a: ldnull IL_000b: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) IL_0010: pop - IL_0011: nop - IL_0012: ldarg.2 - IL_0013: ldlen - IL_0014: conv.i4 - IL_0015: newarr [runtime]System.Int32 - IL_001a: stloc.1 - IL_001b: ldc.i4.0 - IL_001c: stloc.2 - IL_001d: br.s IL_002d - - IL_001f: ldloc.1 + IL_0011: ldarg.2 + IL_0012: stloc.1 + IL_0013: ldloc.1 + IL_0014: ldlen + IL_0015: conv.i4 + IL_0016: newarr [runtime]System.Int32 + IL_001b: stloc.2 + IL_001c: ldc.i4.0 + IL_001d: stloc.3 + IL_001e: br.s IL_0030 + IL_0020: ldloc.2 - IL_0021: ldarg.2 - IL_0022: ldloc.2 - IL_0023: ldelem.i4 - IL_0024: stloc.3 - IL_0025: ldloc.3 - IL_0026: ldloc.0 - IL_0027: add - IL_0028: stelem.i4 - IL_0029: ldloc.2 - IL_002a: ldc.i4.1 - IL_002b: add - IL_002c: stloc.2 - IL_002d: ldloc.2 - IL_002e: ldloc.1 - IL_002f: ldlen - IL_0030: conv.i4 - IL_0031: blt.s IL_001f + IL_0021: ldloc.3 + IL_0022: ldloc.1 + IL_0023: ldloc.3 + IL_0024: ldelem.i4 + IL_0025: stloc.s V_4 + IL_0027: ldloc.s V_4 + IL_0029: ldloc.0 + IL_002a: add + IL_002b: stelem.i4 + IL_002c: ldloc.3 + IL_002d: ldc.i4.1 + IL_002e: add + IL_002f: stloc.3 + IL_0030: ldloc.3 + IL_0031: ldloc.2 + IL_0032: ldlen + IL_0033: conv.i4 + IL_0034: blt.s IL_0020 - IL_0033: ldloc.1 - IL_0034: ret + IL_0036: ldloc.2 + IL_0037: ret } .method public static int32[] f10(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, @@ -478,8 +1220,9 @@ .maxstack 6 .locals init (int32[] V_0, - int32 V_1, - int32 V_2) + int32[] V_1, + int32 V_2, + int32 V_3) IL_0000: nop IL_0001: ldarg.0 IL_0002: ldnull @@ -489,36 +1232,37 @@ IL_000a: ldnull IL_000b: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) IL_0010: pop - IL_0011: nop - IL_0012: ldarg.2 - IL_0013: ldlen - IL_0014: conv.i4 - IL_0015: newarr [runtime]System.Int32 - IL_001a: stloc.0 - IL_001b: ldc.i4.0 - IL_001c: stloc.1 - IL_001d: br.s IL_002b + IL_0011: ldarg.2 + IL_0012: stloc.0 + IL_0013: ldloc.0 + IL_0014: ldlen + IL_0015: conv.i4 + IL_0016: newarr [runtime]System.Int32 + IL_001b: stloc.1 + IL_001c: ldc.i4.0 + IL_001d: stloc.2 + IL_001e: br.s IL_002c - IL_001f: ldloc.0 IL_0020: ldloc.1 - IL_0021: ldarg.2 - IL_0022: ldloc.1 - IL_0023: ldelem.i4 - IL_0024: stloc.2 - IL_0025: ldloc.2 - IL_0026: stelem.i4 - IL_0027: ldloc.1 - IL_0028: ldc.i4.1 - IL_0029: add - IL_002a: stloc.1 - IL_002b: ldloc.1 - IL_002c: ldloc.0 - IL_002d: ldlen - IL_002e: conv.i4 - IL_002f: blt.s IL_001f + IL_0021: ldloc.2 + IL_0022: ldloc.0 + IL_0023: ldloc.2 + IL_0024: ldelem.i4 + IL_0025: stloc.3 + IL_0026: ldloc.3 + IL_0027: stelem.i4 + IL_0028: ldloc.2 + IL_0029: ldc.i4.1 + IL_002a: add + IL_002b: stloc.2 + IL_002c: ldloc.2 + IL_002d: ldloc.1 + IL_002e: ldlen + IL_002f: conv.i4 + IL_0030: blt.s IL_0020 - IL_0031: ldloc.0 - IL_0032: ret + IL_0032: ldloc.1 + IL_0033: ret } .method public static int32[] f11(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, @@ -531,8 +1275,9 @@ .maxstack 6 .locals init (int32 V_0, int32[] V_1, - int32 V_2, - int32 V_3) + int32[] V_2, + int32 V_3, + int32 V_4) IL_0000: nop IL_0001: ldarg.0 IL_0002: ldnull @@ -542,38 +1287,515 @@ IL_000a: ldnull IL_000b: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) IL_0010: stloc.0 - IL_0011: nop - IL_0012: ldarg.2 - IL_0013: ldlen - IL_0014: conv.i4 - IL_0015: newarr [runtime]System.Int32 - IL_001a: stloc.1 - IL_001b: ldc.i4.0 - IL_001c: stloc.2 - IL_001d: br.s IL_002d - - IL_001f: ldloc.1 + IL_0011: ldarg.2 + IL_0012: stloc.1 + IL_0013: ldloc.1 + IL_0014: ldlen + IL_0015: conv.i4 + IL_0016: newarr [runtime]System.Int32 + IL_001b: stloc.2 + IL_001c: ldc.i4.0 + IL_001d: stloc.3 + IL_001e: br.s IL_0030 + IL_0020: ldloc.2 - IL_0021: ldarg.2 - IL_0022: ldloc.2 - IL_0023: ldelem.i4 - IL_0024: stloc.3 - IL_0025: ldloc.3 - IL_0026: ldloc.0 - IL_0027: add - IL_0028: stelem.i4 - IL_0029: ldloc.2 - IL_002a: ldc.i4.1 - IL_002b: add - IL_002c: stloc.2 - IL_002d: ldloc.2 - IL_002e: ldloc.1 - IL_002f: ldlen - IL_0030: conv.i4 - IL_0031: blt.s IL_001f + IL_0021: ldloc.3 + IL_0022: ldloc.1 + IL_0023: ldloc.3 + IL_0024: ldelem.i4 + IL_0025: stloc.s V_4 + IL_0027: ldloc.s V_4 + IL_0029: ldloc.0 + IL_002a: add + IL_002b: stelem.i4 + IL_002c: ldloc.3 + IL_002d: ldc.i4.1 + IL_002e: add + IL_002f: stloc.3 + IL_0030: ldloc.3 + IL_0031: ldloc.2 + IL_0032: ldlen + IL_0033: conv.i4 + IL_0034: blt.s IL_0020 + + IL_0036: ldloc.2 + IL_0037: ret + } + + .method public static int32[] f12(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 6 + .locals init (int32[] V_0, + int32[] V_1, + int32 V_2, + int32 V_3) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldlen + IL_000a: conv.i4 + IL_000b: newarr [runtime]System.Int32 + IL_0010: stloc.1 + IL_0011: ldc.i4.0 + IL_0012: stloc.2 + IL_0013: br.s IL_0023 + + IL_0015: ldloc.1 + IL_0016: ldloc.2 + IL_0017: ldloc.0 + IL_0018: ldloc.2 + IL_0019: ldelem.i4 + IL_001a: stloc.3 + IL_001b: ldloc.3 + IL_001c: ldarg.1 + IL_001d: add + IL_001e: stelem.i4 + IL_001f: ldloc.2 + IL_0020: ldc.i4.1 + IL_0021: add + IL_0022: stloc.2 + IL_0023: ldloc.2 + IL_0024: ldloc.1 + IL_0025: ldlen + IL_0026: conv.i4 + IL_0027: blt.s IL_0015 + + IL_0029: ldloc.1 + IL_002a: ret + } + + .method public static int32[] 'for _ in Array.groupBy id [||] do ...'() cil managed + { + + .maxstack 5 + .locals init (class [runtime]System.Tuple`2[] V_0, + int32[] V_1, + int32 V_2) + IL_0000: ldsfld class assembly/'for _ in Array-groupBy id -||- do ---@28' assembly/'for _ in Array-groupBy id -||- do ---@28'::@_instance + IL_0005: call !!0[] [runtime]System.Array::Empty() + IL_000a: call class [runtime]System.Tuple`2[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::GroupBy(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + !!0[]) + IL_000f: stloc.0 + IL_0010: ldloc.0 + IL_0011: ldlen + IL_0012: conv.i4 + IL_0013: newarr [runtime]System.Int32 + IL_0018: stloc.1 + IL_0019: ldc.i4.0 + IL_001a: stloc.2 + IL_001b: br.s IL_0025 + + IL_001d: ldloc.1 + IL_001e: ldloc.2 + IL_001f: ldc.i4.0 + IL_0020: stelem.i4 + IL_0021: ldloc.2 + IL_0022: ldc.i4.1 + IL_0023: add + IL_0024: stloc.2 + IL_0025: ldloc.2 + IL_0026: ldloc.1 + IL_0027: ldlen + IL_0028: conv.i4 + IL_0029: blt.s IL_001d + + IL_002b: ldloc.1 + IL_002c: ret + } + + .method public static int32[] 'for _ | _ in Array.groupBy id [||] do ...'() cil managed + { + + .maxstack 5 + .locals init (class [runtime]System.Tuple`2[] V_0, + int32[] V_1, + int32 V_2) + IL_0000: ldsfld class assembly/'for _ | _ in Array-groupBy id -||- do ---@29' assembly/'for _ | _ in Array-groupBy id -||- do ---@29'::@_instance + IL_0005: call !!0[] [runtime]System.Array::Empty() + IL_000a: call class [runtime]System.Tuple`2[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::GroupBy(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + !!0[]) + IL_000f: stloc.0 + IL_0010: ldloc.0 + IL_0011: ldlen + IL_0012: conv.i4 + IL_0013: newarr [runtime]System.Int32 + IL_0018: stloc.1 + IL_0019: ldc.i4.0 + IL_001a: stloc.2 + IL_001b: br.s IL_0025 + + IL_001d: ldloc.1 + IL_001e: ldloc.2 + IL_001f: ldc.i4.0 + IL_0020: stelem.i4 + IL_0021: ldloc.2 + IL_0022: ldc.i4.1 + IL_0023: add + IL_0024: stloc.2 + IL_0025: ldloc.2 + IL_0026: ldloc.1 + IL_0027: ldlen + IL_0028: conv.i4 + IL_0029: blt.s IL_001d + + IL_002b: ldloc.1 + IL_002c: ret + } + + .method public static int32[] 'for _ & _ in Array.groupBy id [||] do ...'() cil managed + { + + .maxstack 5 + .locals init (class [runtime]System.Tuple`2[] V_0, + int32[] V_1, + int32 V_2) + IL_0000: ldsfld class assembly/'for _ - _ in Array-groupBy id -||- do ---@30' assembly/'for _ - _ in Array-groupBy id -||- do ---@30'::@_instance + IL_0005: call !!0[] [runtime]System.Array::Empty() + IL_000a: call class [runtime]System.Tuple`2[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::GroupBy(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + !!0[]) + IL_000f: stloc.0 + IL_0010: ldloc.0 + IL_0011: ldlen + IL_0012: conv.i4 + IL_0013: newarr [runtime]System.Int32 + IL_0018: stloc.1 + IL_0019: ldc.i4.0 + IL_001a: stloc.2 + IL_001b: br.s IL_0025 + + IL_001d: ldloc.1 + IL_001e: ldloc.2 + IL_001f: ldc.i4.0 + IL_0020: stelem.i4 + IL_0021: ldloc.2 + IL_0022: ldc.i4.1 + IL_0023: add + IL_0024: stloc.2 + IL_0025: ldloc.2 + IL_0026: ldloc.1 + IL_0027: ldlen + IL_0028: conv.i4 + IL_0029: blt.s IL_001d + + IL_002b: ldloc.1 + IL_002c: ret + } + + .method public static int32[] 'for _, _group in Array.groupBy id [||] do ...'() cil managed + { + + .maxstack 5 + .locals init (class [runtime]System.Tuple`2[] V_0, + int32[] V_1, + int32 V_2) + IL_0000: ldsfld class assembly/'for _, _group in Array-groupBy id -||- do ---@31' assembly/'for _, _group in Array-groupBy id -||- do ---@31'::@_instance + IL_0005: call !!0[] [runtime]System.Array::Empty() + IL_000a: call class [runtime]System.Tuple`2[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::GroupBy(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + !!0[]) + IL_000f: stloc.0 + IL_0010: ldloc.0 + IL_0011: ldlen + IL_0012: conv.i4 + IL_0013: newarr [runtime]System.Int32 + IL_0018: stloc.1 + IL_0019: ldc.i4.0 + IL_001a: stloc.2 + IL_001b: br.s IL_0025 + + IL_001d: ldloc.1 + IL_001e: ldloc.2 + IL_001f: ldc.i4.0 + IL_0020: stelem.i4 + IL_0021: ldloc.2 + IL_0022: ldc.i4.1 + IL_0023: add + IL_0024: stloc.2 + IL_0025: ldloc.2 + IL_0026: ldloc.1 + IL_0027: ldlen + IL_0028: conv.i4 + IL_0029: blt.s IL_001d + + IL_002b: ldloc.1 + IL_002c: ret + } + + .method public static int32[] 'for _, group in Array.groupBy id [||] do ...'() cil managed + { + + .maxstack 6 + .locals init (class [runtime]System.Tuple`2[] V_0, + int32[] V_1, + int32 V_2, + class [runtime]System.Tuple`2 V_3, + object[] V_4) + IL_0000: ldsfld class assembly/'for _, group in Array-groupBy id -||- do ---@32' assembly/'for _, group in Array-groupBy id -||- do ---@32'::@_instance + IL_0005: call !!0[] [runtime]System.Array::Empty() + IL_000a: call class [runtime]System.Tuple`2[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::GroupBy(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + !!0[]) + IL_000f: stloc.0 + IL_0010: ldloc.0 + IL_0011: ldlen + IL_0012: conv.i4 + IL_0013: newarr [runtime]System.Int32 + IL_0018: stloc.1 + IL_0019: ldc.i4.0 + IL_001a: stloc.2 + IL_001b: br.s IL_0038 + + IL_001d: ldloc.1 + IL_001e: ldloc.2 + IL_001f: ldloc.0 + IL_0020: ldloc.2 + IL_0021: ldelem class [runtime]System.Tuple`2 + IL_0026: stloc.3 + IL_0027: ldloc.3 + IL_0028: call instance !1 class [runtime]System.Tuple`2::get_Item2() + IL_002d: stloc.s V_4 + IL_002f: ldloc.s V_4 + IL_0031: ldlen + IL_0032: conv.i4 + IL_0033: stelem.i4 + IL_0034: ldloc.2 + IL_0035: ldc.i4.1 + IL_0036: add + IL_0037: stloc.2 + IL_0038: ldloc.2 + IL_0039: ldloc.1 + IL_003a: ldlen + IL_003b: conv.i4 + IL_003c: blt.s IL_001d + + IL_003e: ldloc.1 + IL_003f: ret + } + + .method public static int32[] 'for 1 | 2 | _ in ...'() cil managed + { + + .maxstack 6 + .locals init (int32[] V_0, + int32[] V_1, + int32 V_2, + int32 V_3) + IL_0000: call !!0[] [runtime]System.Array::Empty() + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldlen + IL_0008: conv.i4 + IL_0009: newarr [runtime]System.Int32 + IL_000e: stloc.1 + IL_000f: ldc.i4.0 + IL_0010: stloc.2 + IL_0011: br.s IL_0030 + + IL_0013: ldloc.1 + IL_0014: ldloc.2 + IL_0015: ldloc.0 + IL_0016: ldloc.2 + IL_0017: ldelem.i4 + IL_0018: stloc.3 + IL_0019: ldloc.3 + IL_001a: ldc.i4.1 + IL_001b: sub + IL_001c: switch ( + IL_0029, + IL_0029) + IL_0029: ldc.i4.0 + IL_002a: nop + IL_002b: stelem.i4 + IL_002c: ldloc.2 + IL_002d: ldc.i4.1 + IL_002e: add + IL_002f: stloc.2 + IL_0030: ldloc.2 + IL_0031: ldloc.1 + IL_0032: ldlen + IL_0033: conv.i4 + IL_0034: blt.s IL_0013 + + IL_0036: ldloc.1 + IL_0037: ret + } + + .method public static int32[] 'for Failure _ | _ in ...'() cil managed + { + + .maxstack 6 + .locals init (class [runtime]System.Exception[] V_0, + int32[] V_1, + int32 V_2, + class [runtime]System.Exception V_3, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_4) + IL_0000: call !!0[] [runtime]System.Array::Empty() + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldlen + IL_0008: conv.i4 + IL_0009: newarr [runtime]System.Int32 + IL_000e: stloc.1 + IL_000f: ldc.i4.0 + IL_0010: stloc.2 + IL_0011: br.s IL_0030 + + IL_0013: ldloc.1 + IL_0014: ldloc.2 + IL_0015: ldloc.0 + IL_0016: ldloc.2 + IL_0017: ldelem [runtime]System.Exception + IL_001c: stloc.3 + IL_001d: ldloc.3 + IL_001e: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::FailurePattern(class [runtime]System.Exception) + IL_0023: stloc.s V_4 + IL_0025: ldloc.s V_4 + IL_0027: brfalse.s IL_0029 + + IL_0029: ldc.i4.0 + IL_002a: nop + IL_002b: stelem.i4 + IL_002c: ldloc.2 + IL_002d: ldc.i4.1 + IL_002e: add + IL_002f: stloc.2 + IL_0030: ldloc.2 + IL_0031: ldloc.1 + IL_0032: ldlen + IL_0033: conv.i4 + IL_0034: blt.s IL_0013 + + IL_0036: ldloc.1 + IL_0037: ret + } + + .method public static int32[] 'for true | false in ...'() cil managed + { + + .maxstack 6 + .locals init (bool[] V_0, + int32[] V_1, + int32 V_2, + bool V_3) + IL_0000: call !!0[] [runtime]System.Array::Empty() + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldlen + IL_0008: conv.i4 + IL_0009: newarr [runtime]System.Int32 + IL_000e: stloc.1 + IL_000f: ldc.i4.0 + IL_0010: stloc.2 + IL_0011: br.s IL_0027 + + IL_0013: ldloc.1 + IL_0014: ldloc.2 + IL_0015: ldloc.0 + IL_0016: ldloc.2 + IL_0017: ldelem [runtime]System.Boolean + IL_001c: stloc.3 + IL_001d: ldloc.3 + IL_001e: brfalse.s IL_0020 + + IL_0020: ldc.i4.0 + IL_0021: nop + IL_0022: stelem.i4 + IL_0023: ldloc.2 + IL_0024: ldc.i4.1 + IL_0025: add + IL_0026: stloc.2 + IL_0027: ldloc.2 + IL_0028: ldloc.1 + IL_0029: ldlen + IL_002a: conv.i4 + IL_002b: blt.s IL_0013 + + IL_002d: ldloc.1 + IL_002e: ret + } + + .method public static int32[] 'for true | _ in ...'() cil managed + { + + .maxstack 6 + .locals init (bool[] V_0, + int32[] V_1, + int32 V_2, + bool V_3) + IL_0000: call !!0[] [runtime]System.Array::Empty() + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldlen + IL_0008: conv.i4 + IL_0009: newarr [runtime]System.Int32 + IL_000e: stloc.1 + IL_000f: ldc.i4.0 + IL_0010: stloc.2 + IL_0011: br.s IL_0027 + + IL_0013: ldloc.1 + IL_0014: ldloc.2 + IL_0015: ldloc.0 + IL_0016: ldloc.2 + IL_0017: ldelem [runtime]System.Boolean + IL_001c: stloc.3 + IL_001d: ldloc.3 + IL_001e: brfalse.s IL_0020 + + IL_0020: ldc.i4.0 + IL_0021: nop + IL_0022: stelem.i4 + IL_0023: ldloc.2 + IL_0024: ldc.i4.1 + IL_0025: add + IL_0026: stloc.2 + IL_0027: ldloc.2 + IL_0028: ldloc.1 + IL_0029: ldlen + IL_002a: conv.i4 + IL_002b: blt.s IL_0013 + + IL_002d: ldloc.1 + IL_002e: ret + } + + .method public static int32[] 'for _ | true in ...'() cil managed + { + + .maxstack 5 + .locals init (bool[] V_0, + int32[] V_1, + int32 V_2) + IL_0000: call !!0[] [runtime]System.Array::Empty() + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldlen + IL_0008: conv.i4 + IL_0009: newarr [runtime]System.Int32 + IL_000e: stloc.1 + IL_000f: ldc.i4.0 + IL_0010: stloc.2 + IL_0011: br.s IL_001b + + IL_0013: ldloc.1 + IL_0014: ldloc.2 + IL_0015: ldc.i4.0 + IL_0016: stelem.i4 + IL_0017: ldloc.2 + IL_0018: ldc.i4.1 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.2 + IL_001c: ldloc.1 + IL_001d: ldlen + IL_001e: conv.i4 + IL_001f: blt.s IL_0013 - IL_0033: ldloc.1 - IL_0034: ret + IL_0021: ldloc.1 + IL_0022: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToList.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToList.fs index fb12ad5c4de..d38f83502e8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToList.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToList.fs @@ -1,4 +1,15 @@ -let f1 (array: int array) = [for x in array -> x] +let f0 (array: int array) = [for x in array do x] +let f00 (array: int array) = [for x in array do yield x] +let f000 (array: int array) = [for x in array do let x = x in yield x] +let f0000 (array: int array) = [for x in array do let x = x in x] +let f00000 (array: int array) x y = [for z in array do let foo = z + x in let bar = z + y in yield z + foo + bar] +let f000000 (array: int array) x y = [for z in array do let foo = z + x in let bar = z + y in z + foo + bar] +let f0000000 (array: int array) f x y = [for z in array do f (); let foo = z + x in let bar = z + y in z + foo + bar] +let f00000000 (array: int array) f x y = [for z in array do let foo = z + x in f (); let bar = z + y in z + foo + bar] +let f000000000 (array: int array) f x y = [for z in array do let foo = z + x in let bar = z + y in f (); z + foo + bar] +let f0000000000 (array: int array) (f : unit -> int) x y = [for z in array do let foo = z + x in let bar = z + y in f (); z + foo + bar] + +let f1 (array: int array) = [for x in array -> x] let f2 f (array: int array) = [for x in array -> f x] let f3 f (array: int array) = [for x in array -> f (); x] let f4 f g (array: int array) = [for x in array -> f (); g(); x] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToList.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToList.fs.il.bsl index 9cc03990ad7..c649f2e871e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToList.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToList.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { @@ -43,6 +43,673 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f0(int32[] 'array') cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + class [runtime]System.IDisposable V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_001a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloca.s V_0 + IL_0013: ldloc.3 + IL_0014: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0019: nop + IL_001a: ldloc.1 + IL_001b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0020: brtrue.s IL_000a + + IL_0022: ldnull + IL_0023: stloc.2 + IL_0024: leave.s IL_003b + + } + finally + { + IL_0026: ldloc.1 + IL_0027: isinst [runtime]System.IDisposable + IL_002c: stloc.s V_4 + IL_002e: ldloc.s V_4 + IL_0030: brfalse.s IL_003a + + IL_0032: ldloc.s V_4 + IL_0034: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0039: endfinally + IL_003a: endfinally + } + IL_003b: ldloc.2 + IL_003c: pop + IL_003d: ldloca.s V_0 + IL_003f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0044: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f00(int32[] 'array') cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + class [runtime]System.IDisposable V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_001a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloca.s V_0 + IL_0013: ldloc.3 + IL_0014: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0019: nop + IL_001a: ldloc.1 + IL_001b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0020: brtrue.s IL_000a + + IL_0022: ldnull + IL_0023: stloc.2 + IL_0024: leave.s IL_003b + + } + finally + { + IL_0026: ldloc.1 + IL_0027: isinst [runtime]System.IDisposable + IL_002c: stloc.s V_4 + IL_002e: ldloc.s V_4 + IL_0030: brfalse.s IL_003a + + IL_0032: ldloc.s V_4 + IL_0034: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0039: endfinally + IL_003a: endfinally + } + IL_003b: ldloc.2 + IL_003c: pop + IL_003d: ldloca.s V_0 + IL_003f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0044: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f000(int32[] 'array') cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + class [runtime]System.IDisposable V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_001b + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: nop + IL_0012: ldloca.s V_0 + IL_0014: ldloc.3 + IL_0015: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_001a: nop + IL_001b: ldloc.1 + IL_001c: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0021: brtrue.s IL_000a + + IL_0023: ldnull + IL_0024: stloc.2 + IL_0025: leave.s IL_003c + + } + finally + { + IL_0027: ldloc.1 + IL_0028: isinst [runtime]System.IDisposable + IL_002d: stloc.s V_4 + IL_002f: ldloc.s V_4 + IL_0031: brfalse.s IL_003b + + IL_0033: ldloc.s V_4 + IL_0035: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_003a: endfinally + IL_003b: endfinally + } + IL_003c: ldloc.2 + IL_003d: pop + IL_003e: ldloca.s V_0 + IL_0040: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0045: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f0000(int32[] 'array') cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + class [runtime]System.IDisposable V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_001a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloca.s V_0 + IL_0013: ldloc.3 + IL_0014: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0019: nop + IL_001a: ldloc.1 + IL_001b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0020: brtrue.s IL_000a + + IL_0022: ldnull + IL_0023: stloc.2 + IL_0024: leave.s IL_003b + + } + finally + { + IL_0026: ldloc.1 + IL_0027: isinst [runtime]System.IDisposable + IL_002c: stloc.s V_4 + IL_002e: ldloc.s V_4 + IL_0030: brfalse.s IL_003a + + IL_0032: ldloc.s V_4 + IL_0034: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0039: endfinally + IL_003a: endfinally + } + IL_003b: ldloc.2 + IL_003c: pop + IL_003d: ldloca.s V_0 + IL_003f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0044: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f00000(int32[] 'array', + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_002a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.1 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldloc.3 + IL_0017: ldarg.2 + IL_0018: add + IL_0019: stloc.s V_5 + IL_001b: ldloca.s V_0 + IL_001d: ldloc.3 + IL_001e: ldloc.s V_4 + IL_0020: add + IL_0021: ldloc.s V_5 + IL_0023: add + IL_0024: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0029: nop + IL_002a: ldloc.1 + IL_002b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0030: brtrue.s IL_000a + + IL_0032: ldnull + IL_0033: stloc.2 + IL_0034: leave.s IL_004b + + } + finally + { + IL_0036: ldloc.1 + IL_0037: isinst [runtime]System.IDisposable + IL_003c: stloc.s V_6 + IL_003e: ldloc.s V_6 + IL_0040: brfalse.s IL_004a + + IL_0042: ldloc.s V_6 + IL_0044: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0049: endfinally + IL_004a: endfinally + } + IL_004b: ldloc.2 + IL_004c: pop + IL_004d: ldloca.s V_0 + IL_004f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0054: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f000000(int32[] 'array', + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_002a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.1 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldloc.3 + IL_0017: ldarg.2 + IL_0018: add + IL_0019: stloc.s V_5 + IL_001b: ldloca.s V_0 + IL_001d: ldloc.3 + IL_001e: ldloc.s V_4 + IL_0020: add + IL_0021: ldloc.s V_5 + IL_0023: add + IL_0024: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0029: nop + IL_002a: ldloc.1 + IL_002b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0030: brtrue.s IL_000a + + IL_0032: ldnull + IL_0033: stloc.2 + IL_0034: leave.s IL_004b + + } + finally + { + IL_0036: ldloc.1 + IL_0037: isinst [runtime]System.IDisposable + IL_003c: stloc.s V_6 + IL_003e: ldloc.s V_6 + IL_0040: brfalse.s IL_004a + + IL_0042: ldloc.s V_6 + IL_0044: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0049: endfinally + IL_004a: endfinally + } + IL_004b: ldloc.2 + IL_004c: pop + IL_004d: ldloca.s V_0 + IL_004f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0054: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f0000000(int32[] 'array', + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0032 + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldarg.1 + IL_0012: ldnull + IL_0013: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0018: pop + IL_0019: ldloc.3 + IL_001a: ldarg.2 + IL_001b: add + IL_001c: stloc.s V_4 + IL_001e: ldloc.3 + IL_001f: ldarg.3 + IL_0020: add + IL_0021: stloc.s V_5 + IL_0023: ldloca.s V_0 + IL_0025: ldloc.3 + IL_0026: ldloc.s V_4 + IL_0028: add + IL_0029: ldloc.s V_5 + IL_002b: add + IL_002c: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0031: nop + IL_0032: ldloc.1 + IL_0033: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0038: brtrue.s IL_000a + + IL_003a: ldnull + IL_003b: stloc.2 + IL_003c: leave.s IL_0053 + + } + finally + { + IL_003e: ldloc.1 + IL_003f: isinst [runtime]System.IDisposable + IL_0044: stloc.s V_6 + IL_0046: ldloc.s V_6 + IL_0048: brfalse.s IL_0052 + + IL_004a: ldloc.s V_6 + IL_004c: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0051: endfinally + IL_0052: endfinally + } + IL_0053: ldloc.2 + IL_0054: pop + IL_0055: ldloca.s V_0 + IL_0057: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_005c: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f00000000(int32[] 'array', + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0032 + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.2 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldarg.1 + IL_0017: ldnull + IL_0018: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001d: pop + IL_001e: ldloc.3 + IL_001f: ldarg.3 + IL_0020: add + IL_0021: stloc.s V_5 + IL_0023: ldloca.s V_0 + IL_0025: ldloc.3 + IL_0026: ldloc.s V_4 + IL_0028: add + IL_0029: ldloc.s V_5 + IL_002b: add + IL_002c: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0031: nop + IL_0032: ldloc.1 + IL_0033: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0038: brtrue.s IL_000a + + IL_003a: ldnull + IL_003b: stloc.2 + IL_003c: leave.s IL_0053 + + } + finally + { + IL_003e: ldloc.1 + IL_003f: isinst [runtime]System.IDisposable + IL_0044: stloc.s V_6 + IL_0046: ldloc.s V_6 + IL_0048: brfalse.s IL_0052 + + IL_004a: ldloc.s V_6 + IL_004c: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0051: endfinally + IL_0052: endfinally + } + IL_0053: ldloc.2 + IL_0054: pop + IL_0055: ldloca.s V_0 + IL_0057: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_005c: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f000000000(int32[] 'array', + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0032 + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.2 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldloc.3 + IL_0017: ldarg.3 + IL_0018: add + IL_0019: stloc.s V_5 + IL_001b: ldarg.1 + IL_001c: ldnull + IL_001d: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0022: pop + IL_0023: ldloca.s V_0 + IL_0025: ldloc.3 + IL_0026: ldloc.s V_4 + IL_0028: add + IL_0029: ldloc.s V_5 + IL_002b: add + IL_002c: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0031: nop + IL_0032: ldloc.1 + IL_0033: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0038: brtrue.s IL_000a + + IL_003a: ldnull + IL_003b: stloc.2 + IL_003c: leave.s IL_0053 + + } + finally + { + IL_003e: ldloc.1 + IL_003f: isinst [runtime]System.IDisposable + IL_0044: stloc.s V_6 + IL_0046: ldloc.s V_6 + IL_0048: brfalse.s IL_0052 + + IL_004a: ldloc.s V_6 + IL_004c: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0051: endfinally + IL_0052: endfinally + } + IL_0053: ldloc.2 + IL_0054: pop + IL_0055: ldloca.s V_0 + IL_0057: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_005c: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f0000000000(int32[] 'array', + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0039 + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.2 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldloc.3 + IL_0017: ldarg.3 + IL_0018: add + IL_0019: stloc.s V_5 + IL_001b: ldloca.s V_0 + IL_001d: ldarg.1 + IL_001e: ldnull + IL_001f: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0024: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0029: nop + IL_002a: ldloca.s V_0 + IL_002c: ldloc.3 + IL_002d: ldloc.s V_4 + IL_002f: add + IL_0030: ldloc.s V_5 + IL_0032: add + IL_0033: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0038: nop + IL_0039: ldloc.1 + IL_003a: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_003f: brtrue.s IL_000a + + IL_0041: ldnull + IL_0042: stloc.2 + IL_0043: leave.s IL_005a + + } + finally + { + IL_0045: ldloc.1 + IL_0046: isinst [runtime]System.IDisposable + IL_004b: stloc.s V_6 + IL_004d: ldloc.s V_6 + IL_004f: brfalse.s IL_0059 + + IL_0051: ldloc.s V_6 + IL_0053: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0058: endfinally + IL_0059: endfinally + } + IL_005a: ldloc.2 + IL_005b: pop + IL_005c: ldloca.s V_0 + IL_005e: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0063: ret + } + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f1(int32[] 'array') cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToArray.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToArray.fs index 62b7b9bc6c0..9a19aa234f8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToArray.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToArray.fs @@ -1,4 +1,15 @@ -let f1 (list: int list) = [|for x in list -> x|] +let f0 (list: int list) = [|for x in list do x|] +let f00 (list: int list) = [|for x in list do yield x|] +let f000 (list: int list) = [|for x in list do let x = x in yield x|] +let f0000 (list: int list) = [|for x in list do let x = x in x|] +let f00000 (list: int list) x y = [|for z in list do let foo = z + x in let bar = z + y in yield z + foo + bar|] +let f000000 (list: int list) x y = [|for z in list do let foo = z + x in let bar = z + y in z + foo + bar|] +let f0000000 (list: int list) f x y = [|for z in list do f (); let foo = z + x in let bar = z + y in z + foo + bar|] +let f00000000 (list: int list) f x y = [|for z in list do let foo = z + x in f (); let bar = z + y in z + foo + bar|] +let f000000000 (list: int list) f x y = [|for z in list do let foo = z + x in let bar = z + y in f (); z + foo + bar|] +let f0000000000 (list: int list) (f : unit -> int) x y = [|for z in list do let foo = z + x in let bar = z + y in f (); z + foo + bar|] + +let f1 (list: int list) = [|for x in list -> x|] let f2 f (list: int list) = [|for x in list -> f x|] let f3 f (list: int list) = [|for x in list -> f (); x|] let f4 f g (list: int list) = [|for x in list -> f (); g(); x|] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToArray.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToArray.fs.il.bsl index 34dd7e2af69..2c0d8191dfb 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToArray.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToArray.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { @@ -43,6 +43,667 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public static int32[] f0(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list) cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + class [runtime]System.IDisposable V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_001a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloca.s V_0 + IL_0013: ldloc.3 + IL_0014: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0019: nop + IL_001a: ldloc.1 + IL_001b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0020: brtrue.s IL_000a + + IL_0022: ldnull + IL_0023: stloc.2 + IL_0024: leave.s IL_003b + + } + finally + { + IL_0026: ldloc.1 + IL_0027: isinst [runtime]System.IDisposable + IL_002c: stloc.s V_4 + IL_002e: ldloc.s V_4 + IL_0030: brfalse.s IL_003a + + IL_0032: ldloc.s V_4 + IL_0034: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0039: endfinally + IL_003a: endfinally + } + IL_003b: ldloc.2 + IL_003c: pop + IL_003d: ldloca.s V_0 + IL_003f: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_0044: ret + } + + .method public static int32[] f00(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list) cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + class [runtime]System.IDisposable V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_001a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloca.s V_0 + IL_0013: ldloc.3 + IL_0014: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0019: nop + IL_001a: ldloc.1 + IL_001b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0020: brtrue.s IL_000a + + IL_0022: ldnull + IL_0023: stloc.2 + IL_0024: leave.s IL_003b + + } + finally + { + IL_0026: ldloc.1 + IL_0027: isinst [runtime]System.IDisposable + IL_002c: stloc.s V_4 + IL_002e: ldloc.s V_4 + IL_0030: brfalse.s IL_003a + + IL_0032: ldloc.s V_4 + IL_0034: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0039: endfinally + IL_003a: endfinally + } + IL_003b: ldloc.2 + IL_003c: pop + IL_003d: ldloca.s V_0 + IL_003f: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_0044: ret + } + + .method public static int32[] f000(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list) cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + class [runtime]System.IDisposable V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_001b + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: nop + IL_0012: ldloca.s V_0 + IL_0014: ldloc.3 + IL_0015: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_001a: nop + IL_001b: ldloc.1 + IL_001c: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0021: brtrue.s IL_000a + + IL_0023: ldnull + IL_0024: stloc.2 + IL_0025: leave.s IL_003c + + } + finally + { + IL_0027: ldloc.1 + IL_0028: isinst [runtime]System.IDisposable + IL_002d: stloc.s V_4 + IL_002f: ldloc.s V_4 + IL_0031: brfalse.s IL_003b + + IL_0033: ldloc.s V_4 + IL_0035: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_003a: endfinally + IL_003b: endfinally + } + IL_003c: ldloc.2 + IL_003d: pop + IL_003e: ldloca.s V_0 + IL_0040: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_0045: ret + } + + .method public static int32[] f0000(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list) cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + class [runtime]System.IDisposable V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_001a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloca.s V_0 + IL_0013: ldloc.3 + IL_0014: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0019: nop + IL_001a: ldloc.1 + IL_001b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0020: brtrue.s IL_000a + + IL_0022: ldnull + IL_0023: stloc.2 + IL_0024: leave.s IL_003b + + } + finally + { + IL_0026: ldloc.1 + IL_0027: isinst [runtime]System.IDisposable + IL_002c: stloc.s V_4 + IL_002e: ldloc.s V_4 + IL_0030: brfalse.s IL_003a + + IL_0032: ldloc.s V_4 + IL_0034: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0039: endfinally + IL_003a: endfinally + } + IL_003b: ldloc.2 + IL_003c: pop + IL_003d: ldloca.s V_0 + IL_003f: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_0044: ret + } + + .method public static int32[] f00000(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_002a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.1 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldloc.3 + IL_0017: ldarg.2 + IL_0018: add + IL_0019: stloc.s V_5 + IL_001b: ldloca.s V_0 + IL_001d: ldloc.3 + IL_001e: ldloc.s V_4 + IL_0020: add + IL_0021: ldloc.s V_5 + IL_0023: add + IL_0024: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0029: nop + IL_002a: ldloc.1 + IL_002b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0030: brtrue.s IL_000a + + IL_0032: ldnull + IL_0033: stloc.2 + IL_0034: leave.s IL_004b + + } + finally + { + IL_0036: ldloc.1 + IL_0037: isinst [runtime]System.IDisposable + IL_003c: stloc.s V_6 + IL_003e: ldloc.s V_6 + IL_0040: brfalse.s IL_004a + + IL_0042: ldloc.s V_6 + IL_0044: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0049: endfinally + IL_004a: endfinally + } + IL_004b: ldloc.2 + IL_004c: pop + IL_004d: ldloca.s V_0 + IL_004f: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_0054: ret + } + + .method public static int32[] f000000(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_002a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.1 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldloc.3 + IL_0017: ldarg.2 + IL_0018: add + IL_0019: stloc.s V_5 + IL_001b: ldloca.s V_0 + IL_001d: ldloc.3 + IL_001e: ldloc.s V_4 + IL_0020: add + IL_0021: ldloc.s V_5 + IL_0023: add + IL_0024: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0029: nop + IL_002a: ldloc.1 + IL_002b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0030: brtrue.s IL_000a + + IL_0032: ldnull + IL_0033: stloc.2 + IL_0034: leave.s IL_004b + + } + finally + { + IL_0036: ldloc.1 + IL_0037: isinst [runtime]System.IDisposable + IL_003c: stloc.s V_6 + IL_003e: ldloc.s V_6 + IL_0040: brfalse.s IL_004a + + IL_0042: ldloc.s V_6 + IL_0044: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0049: endfinally + IL_004a: endfinally + } + IL_004b: ldloc.2 + IL_004c: pop + IL_004d: ldloca.s V_0 + IL_004f: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_0054: ret + } + + .method public static int32[] f0000000(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0032 + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldarg.1 + IL_0012: ldnull + IL_0013: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0018: pop + IL_0019: ldloc.3 + IL_001a: ldarg.2 + IL_001b: add + IL_001c: stloc.s V_4 + IL_001e: ldloc.3 + IL_001f: ldarg.3 + IL_0020: add + IL_0021: stloc.s V_5 + IL_0023: ldloca.s V_0 + IL_0025: ldloc.3 + IL_0026: ldloc.s V_4 + IL_0028: add + IL_0029: ldloc.s V_5 + IL_002b: add + IL_002c: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0031: nop + IL_0032: ldloc.1 + IL_0033: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0038: brtrue.s IL_000a + + IL_003a: ldnull + IL_003b: stloc.2 + IL_003c: leave.s IL_0053 + + } + finally + { + IL_003e: ldloc.1 + IL_003f: isinst [runtime]System.IDisposable + IL_0044: stloc.s V_6 + IL_0046: ldloc.s V_6 + IL_0048: brfalse.s IL_0052 + + IL_004a: ldloc.s V_6 + IL_004c: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0051: endfinally + IL_0052: endfinally + } + IL_0053: ldloc.2 + IL_0054: pop + IL_0055: ldloca.s V_0 + IL_0057: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_005c: ret + } + + .method public static int32[] f00000000(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0032 + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.2 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldarg.1 + IL_0017: ldnull + IL_0018: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001d: pop + IL_001e: ldloc.3 + IL_001f: ldarg.3 + IL_0020: add + IL_0021: stloc.s V_5 + IL_0023: ldloca.s V_0 + IL_0025: ldloc.3 + IL_0026: ldloc.s V_4 + IL_0028: add + IL_0029: ldloc.s V_5 + IL_002b: add + IL_002c: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0031: nop + IL_0032: ldloc.1 + IL_0033: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0038: brtrue.s IL_000a + + IL_003a: ldnull + IL_003b: stloc.2 + IL_003c: leave.s IL_0053 + + } + finally + { + IL_003e: ldloc.1 + IL_003f: isinst [runtime]System.IDisposable + IL_0044: stloc.s V_6 + IL_0046: ldloc.s V_6 + IL_0048: brfalse.s IL_0052 + + IL_004a: ldloc.s V_6 + IL_004c: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0051: endfinally + IL_0052: endfinally + } + IL_0053: ldloc.2 + IL_0054: pop + IL_0055: ldloca.s V_0 + IL_0057: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_005c: ret + } + + .method public static int32[] f000000000(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0032 + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.2 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldloc.3 + IL_0017: ldarg.3 + IL_0018: add + IL_0019: stloc.s V_5 + IL_001b: ldarg.1 + IL_001c: ldnull + IL_001d: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0022: pop + IL_0023: ldloca.s V_0 + IL_0025: ldloc.3 + IL_0026: ldloc.s V_4 + IL_0028: add + IL_0029: ldloc.s V_5 + IL_002b: add + IL_002c: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0031: nop + IL_0032: ldloc.1 + IL_0033: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0038: brtrue.s IL_000a + + IL_003a: ldnull + IL_003b: stloc.2 + IL_003c: leave.s IL_0053 + + } + finally + { + IL_003e: ldloc.1 + IL_003f: isinst [runtime]System.IDisposable + IL_0044: stloc.s V_6 + IL_0046: ldloc.s V_6 + IL_0048: brfalse.s IL_0052 + + IL_004a: ldloc.s V_6 + IL_004c: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0051: endfinally + IL_0052: endfinally + } + IL_0053: ldloc.2 + IL_0054: pop + IL_0055: ldloca.s V_0 + IL_0057: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_005c: ret + } + + .method public static int32[] f0000000000(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0039 + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.2 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldloc.3 + IL_0017: ldarg.3 + IL_0018: add + IL_0019: stloc.s V_5 + IL_001b: ldloca.s V_0 + IL_001d: ldarg.1 + IL_001e: ldnull + IL_001f: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0024: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0029: nop + IL_002a: ldloca.s V_0 + IL_002c: ldloc.3 + IL_002d: ldloc.s V_4 + IL_002f: add + IL_0030: ldloc.s V_5 + IL_0032: add + IL_0033: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0038: nop + IL_0039: ldloc.1 + IL_003a: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_003f: brtrue.s IL_000a + + IL_0041: ldnull + IL_0042: stloc.2 + IL_0043: leave.s IL_005a + + } + finally + { + IL_0045: ldloc.1 + IL_0046: isinst [runtime]System.IDisposable + IL_004b: stloc.s V_6 + IL_004d: ldloc.s V_6 + IL_004f: brfalse.s IL_0059 + + IL_0051: ldloc.s V_6 + IL_0053: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0058: endfinally + IL_0059: endfinally + } + IL_005a: ldloc.2 + IL_005b: pop + IL_005c: ldloca.s V_0 + IL_005e: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_0063: ret + } + .method public static int32[] f1(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list) cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToList.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToList.fs index cfbb0fb567f..33be454f9c4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToList.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToList.fs @@ -1,4 +1,15 @@ -let f1 (list: int list) = [for x in list -> x] +let f0 (list: int list) = [for x in list do x] +let f00 (list: int list) = [for x in list do yield x] +let f000 (list: int list) = [for x in list do let x = x in yield x] +let f0000 (list: int list) = [for x in list do let x = x in x] +let f00000 (list: int list) x y = [for z in list do let foo = z + x in let bar = z + y in yield z + foo + bar] +let f000000 (list: int list) x y = [for z in list do let foo = z + x in let bar = z + y in z + foo + bar] +let f0000000 (list: int list) f x y = [for z in list do f (); let foo = z + x in let bar = z + y in z + foo + bar] +let f00000000 (list: int list) f x y = [for z in list do let foo = z + x in f (); let bar = z + y in z + foo + bar] +let f000000000 (list: int list) f x y = [for z in list do let foo = z + x in let bar = z + y in f (); z + foo + bar] +let f0000000000 (list: int list) (f : unit -> int) x y = [for z in list do let foo = z + x in let bar = z + y in f (); z + foo + bar] + +let f1 (list: int list) = [for x in list -> x] let f2 f (list: int list) = [for x in list -> f x] let f3 f (list: int list) = [for x in list -> f (); x] let f4 f g (list: int list) = [for x in list -> f (); g(); x] @@ -10,3 +21,17 @@ let f8 f g (list: int list) = [let y = f () in let z = g () in for x in list -> let f9 f g (list: int list) = [let y = f () in g (); for x in list -> x + y] let f10 f g (list: int list) = [f (); g (); for x in list -> x] let f11 f g (list: int list) = [f (); let y = g () in for x in list -> x + y] +let f12 (f: unit -> int list) y = [for x in f () -> x + y] + +// https://github.com/dotnet/fsharp/issues/17708 +// Don't read or rebind the loop variable when it is not in scope in the body. +let ``for _ in List.groupBy id [] do ...`` () = [for _ in List.groupBy id [] do 0] +let ``for _ | _ in List.groupBy id [] do ...`` () = [for _ | _ in List.groupBy id [] do 0] +let ``for _ & _ in List.groupBy id [] do ...`` () = [for _ & _ in List.groupBy id [] do 0] +let ``for _, _group in List.groupBy id [] do ...`` () = [for _, _group in List.groupBy id [] do 0] +let ``for _, group in List.groupBy id [] do ...`` () = [for _, group in List.groupBy id [] do group.Length] +let ``for 1 | 2 | _ in ...`` () = [for 1 | 2 | _ in [] do 0] +let ``for Failure _ | _ in ...`` () = [for Failure _ | _ in [] do 0] +let ``for true | false in ...`` () = [for true | false in [] do 0] +let ``for true | _ in ...`` () = [for true | _ in [] do 0] +let ``for _ | true in ...`` () = [for _ | true in [] do 0] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToList.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToList.fs.il.bsl index 81eaa9d474f..32f34802bd5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToList.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToList.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { @@ -43,6 +43,691 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit 'for _ in List-groupBy id -- do ---@28' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/'for _ in List-groupBy id -- do ---@28' @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance object Invoke(object x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/'for _ in List-groupBy id -- do ---@28'::.ctor() + IL_0005: stsfld class assembly/'for _ in List-groupBy id -- do ---@28' assembly/'for _ in List-groupBy id -- do ---@28'::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'for _ | _ in List-groupBy id -- do ---@29' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/'for _ | _ in List-groupBy id -- do ---@29' @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance object Invoke(object x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/'for _ | _ in List-groupBy id -- do ---@29'::.ctor() + IL_0005: stsfld class assembly/'for _ | _ in List-groupBy id -- do ---@29' assembly/'for _ | _ in List-groupBy id -- do ---@29'::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'for _ - _ in List-groupBy id -- do ---@30' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/'for _ - _ in List-groupBy id -- do ---@30' @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance object Invoke(object x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/'for _ - _ in List-groupBy id -- do ---@30'::.ctor() + IL_0005: stsfld class assembly/'for _ - _ in List-groupBy id -- do ---@30' assembly/'for _ - _ in List-groupBy id -- do ---@30'::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'for _, _group in List-groupBy id -- do ---@31' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/'for _, _group in List-groupBy id -- do ---@31' @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance object Invoke(object x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/'for _, _group in List-groupBy id -- do ---@31'::.ctor() + IL_0005: stsfld class assembly/'for _, _group in List-groupBy id -- do ---@31' assembly/'for _, _group in List-groupBy id -- do ---@31'::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'for _, group in List-groupBy id -- do ---@32' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/'for _, group in List-groupBy id -- do ---@32' @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance object Invoke(object x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/'for _, group in List-groupBy id -- do ---@32'::.ctor() + IL_0005: stsfld class assembly/'for _, group in List-groupBy id -- do ---@32' assembly/'for _, group in List-groupBy id -- do ---@32'::@_instance + IL_000a: ret + } + + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f0(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list) cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_2, + int32 V_3) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.1 + IL_0003: ldloc.1 + IL_0004: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0009: stloc.2 + IL_000a: br.s IL_0025 + + IL_000c: ldloc.1 + IL_000d: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0012: stloc.3 + IL_0013: ldloca.s V_0 + IL_0015: ldloc.3 + IL_0016: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_001b: nop + IL_001c: ldloc.2 + IL_001d: stloc.1 + IL_001e: ldloc.1 + IL_001f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0024: stloc.2 + IL_0025: ldloc.2 + IL_0026: brtrue.s IL_000c + + IL_0028: ldloca.s V_0 + IL_002a: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_002f: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f00(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list) cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_2, + int32 V_3) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.1 + IL_0003: ldloc.1 + IL_0004: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0009: stloc.2 + IL_000a: br.s IL_0025 + + IL_000c: ldloc.1 + IL_000d: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0012: stloc.3 + IL_0013: ldloca.s V_0 + IL_0015: ldloc.3 + IL_0016: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_001b: nop + IL_001c: ldloc.2 + IL_001d: stloc.1 + IL_001e: ldloc.1 + IL_001f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0024: stloc.2 + IL_0025: ldloc.2 + IL_0026: brtrue.s IL_000c + + IL_0028: ldloca.s V_0 + IL_002a: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_002f: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f000(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list) cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_2, + int32 V_3) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.1 + IL_0003: ldloc.1 + IL_0004: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0009: stloc.2 + IL_000a: br.s IL_0026 + + IL_000c: ldloc.1 + IL_000d: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0012: stloc.3 + IL_0013: ldloca.s V_0 + IL_0015: nop + IL_0016: ldloc.3 + IL_0017: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_001c: nop + IL_001d: ldloc.2 + IL_001e: stloc.1 + IL_001f: ldloc.1 + IL_0020: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0025: stloc.2 + IL_0026: ldloc.2 + IL_0027: brtrue.s IL_000c + + IL_0029: ldloca.s V_0 + IL_002b: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0030: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f0000(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list) cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_2, + int32 V_3) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.1 + IL_0003: ldloc.1 + IL_0004: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0009: stloc.2 + IL_000a: br.s IL_0026 + + IL_000c: ldloc.1 + IL_000d: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0012: stloc.3 + IL_0013: ldloca.s V_0 + IL_0015: nop + IL_0016: ldloc.3 + IL_0017: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_001c: nop + IL_001d: ldloc.2 + IL_001e: stloc.1 + IL_001f: ldloc.1 + IL_0020: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0025: stloc.2 + IL_0026: ldloc.2 + IL_0027: brtrue.s IL_000c + + IL_0029: ldloca.s V_0 + IL_002b: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0030: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f00000(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.1 + IL_0003: ldloc.1 + IL_0004: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0009: stloc.2 + IL_000a: br.s IL_0035 + + IL_000c: ldloc.1 + IL_000d: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0012: stloc.3 + IL_0013: ldloca.s V_0 + IL_0015: ldloc.3 + IL_0016: ldarg.1 + IL_0017: add + IL_0018: stloc.s V_4 + IL_001a: ldloc.3 + IL_001b: ldarg.2 + IL_001c: add + IL_001d: stloc.s V_5 + IL_001f: ldloc.3 + IL_0020: ldloc.s V_4 + IL_0022: add + IL_0023: ldloc.s V_5 + IL_0025: add + IL_0026: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_002b: nop + IL_002c: ldloc.2 + IL_002d: stloc.1 + IL_002e: ldloc.1 + IL_002f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0034: stloc.2 + IL_0035: ldloc.2 + IL_0036: brtrue.s IL_000c + + IL_0038: ldloca.s V_0 + IL_003a: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_003f: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f000000(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.1 + IL_0003: ldloc.1 + IL_0004: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0009: stloc.2 + IL_000a: br.s IL_0035 + + IL_000c: ldloc.1 + IL_000d: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0012: stloc.3 + IL_0013: ldloca.s V_0 + IL_0015: ldloc.3 + IL_0016: ldarg.1 + IL_0017: add + IL_0018: stloc.s V_4 + IL_001a: ldloc.3 + IL_001b: ldarg.2 + IL_001c: add + IL_001d: stloc.s V_5 + IL_001f: ldloc.3 + IL_0020: ldloc.s V_4 + IL_0022: add + IL_0023: ldloc.s V_5 + IL_0025: add + IL_0026: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_002b: nop + IL_002c: ldloc.2 + IL_002d: stloc.1 + IL_002e: ldloc.1 + IL_002f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0034: stloc.2 + IL_0035: ldloc.2 + IL_0036: brtrue.s IL_000c + + IL_0038: ldloca.s V_0 + IL_003a: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_003f: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f0000000(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.1 + IL_0003: ldloc.1 + IL_0004: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0009: stloc.2 + IL_000a: br.s IL_003d + + IL_000c: ldloc.1 + IL_000d: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0012: stloc.3 + IL_0013: ldloca.s V_0 + IL_0015: ldarg.1 + IL_0016: ldnull + IL_0017: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001c: pop + IL_001d: ldloc.3 + IL_001e: ldarg.2 + IL_001f: add + IL_0020: stloc.s V_4 + IL_0022: ldloc.3 + IL_0023: ldarg.3 + IL_0024: add + IL_0025: stloc.s V_5 + IL_0027: ldloc.3 + IL_0028: ldloc.s V_4 + IL_002a: add + IL_002b: ldloc.s V_5 + IL_002d: add + IL_002e: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0033: nop + IL_0034: ldloc.2 + IL_0035: stloc.1 + IL_0036: ldloc.1 + IL_0037: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_003c: stloc.2 + IL_003d: ldloc.2 + IL_003e: brtrue.s IL_000c + + IL_0040: ldloca.s V_0 + IL_0042: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0047: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f00000000(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.1 + IL_0003: ldloc.1 + IL_0004: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0009: stloc.2 + IL_000a: br.s IL_003d + + IL_000c: ldloc.1 + IL_000d: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0012: stloc.3 + IL_0013: ldloca.s V_0 + IL_0015: ldloc.3 + IL_0016: ldarg.2 + IL_0017: add + IL_0018: stloc.s V_4 + IL_001a: ldarg.1 + IL_001b: ldnull + IL_001c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0021: pop + IL_0022: ldloc.3 + IL_0023: ldarg.3 + IL_0024: add + IL_0025: stloc.s V_5 + IL_0027: ldloc.3 + IL_0028: ldloc.s V_4 + IL_002a: add + IL_002b: ldloc.s V_5 + IL_002d: add + IL_002e: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0033: nop + IL_0034: ldloc.2 + IL_0035: stloc.1 + IL_0036: ldloc.1 + IL_0037: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_003c: stloc.2 + IL_003d: ldloc.2 + IL_003e: brtrue.s IL_000c + + IL_0040: ldloca.s V_0 + IL_0042: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0047: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f000000000(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.1 + IL_0003: ldloc.1 + IL_0004: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0009: stloc.2 + IL_000a: br.s IL_003d + + IL_000c: ldloc.1 + IL_000d: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0012: stloc.3 + IL_0013: ldloca.s V_0 + IL_0015: ldloc.3 + IL_0016: ldarg.2 + IL_0017: add + IL_0018: stloc.s V_4 + IL_001a: ldloc.3 + IL_001b: ldarg.3 + IL_001c: add + IL_001d: stloc.s V_5 + IL_001f: ldarg.1 + IL_0020: ldnull + IL_0021: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0026: pop + IL_0027: ldloc.3 + IL_0028: ldloc.s V_4 + IL_002a: add + IL_002b: ldloc.s V_5 + IL_002d: add + IL_002e: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0033: nop + IL_0034: ldloc.2 + IL_0035: stloc.1 + IL_0036: ldloc.1 + IL_0037: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_003c: stloc.2 + IL_003d: ldloc.2 + IL_003e: brtrue.s IL_000c + + IL_0040: ldloca.s V_0 + IL_0042: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0047: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f0000000000(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0039 + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.2 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldloc.3 + IL_0017: ldarg.3 + IL_0018: add + IL_0019: stloc.s V_5 + IL_001b: ldloca.s V_0 + IL_001d: ldarg.1 + IL_001e: ldnull + IL_001f: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0024: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0029: nop + IL_002a: ldloca.s V_0 + IL_002c: ldloc.3 + IL_002d: ldloc.s V_4 + IL_002f: add + IL_0030: ldloc.s V_5 + IL_0032: add + IL_0033: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0038: nop + IL_0039: ldloc.1 + IL_003a: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_003f: brtrue.s IL_000a + + IL_0041: ldnull + IL_0042: stloc.2 + IL_0043: leave.s IL_005a + + } + finally + { + IL_0045: ldloc.1 + IL_0046: isinst [runtime]System.IDisposable + IL_004b: stloc.s V_6 + IL_004d: ldloc.s V_6 + IL_004f: brfalse.s IL_0059 + + IL_0051: ldloc.s V_6 + IL_0053: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0058: endfinally + IL_0059: endfinally + } + IL_005a: ldloc.2 + IL_005b: pop + IL_005c: ldloca.s V_0 + IL_005e: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0063: ret + } + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f1(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list) cil managed { @@ -79,9 +764,7 @@ IL_002f: ret } - .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - f2(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list) cil managed + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f2(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list) cil managed { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) @@ -120,9 +803,7 @@ IL_0035: ret } - .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - f3(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list) cil managed + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f3(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list) cil managed { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) @@ -248,9 +929,7 @@ IL_002f: ret } - .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - f6(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list) cil managed + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f6(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list) cil managed { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) @@ -552,6 +1231,450 @@ IL_0044: ret } + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f12(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_2, + int32 V_3) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldnull + IL_0003: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::Invoke(!0) + IL_0008: stloc.1 + IL_0009: ldloc.1 + IL_000a: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_000f: stloc.2 + IL_0010: br.s IL_002d + + IL_0012: ldloc.1 + IL_0013: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0018: stloc.3 + IL_0019: ldloca.s V_0 + IL_001b: ldloc.3 + IL_001c: ldarg.1 + IL_001d: add + IL_001e: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0023: nop + IL_0024: ldloc.2 + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_002c: stloc.2 + IL_002d: ldloc.2 + IL_002e: brtrue.s IL_0012 + + IL_0030: ldloca.s V_0 + IL_0032: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0037: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'for _ in List.groupBy id [] do ...'() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> V_2, + class [runtime]System.Tuple`2> V_3) + IL_0000: nop + IL_0001: ldsfld class assembly/'for _ in List-groupBy id -- do ---@28' assembly/'for _ in List-groupBy id -- do ---@28'::@_instance + IL_0006: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_000b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::GroupBy(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_0010: stloc.1 + IL_0011: ldloc.1 + IL_0012: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_TailOrNull() + IL_0017: stloc.2 + IL_0018: br.s IL_0033 + + IL_001a: ldloc.1 + IL_001b: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_HeadOrDefault() + IL_0020: stloc.3 + IL_0021: ldloca.s V_0 + IL_0023: ldc.i4.0 + IL_0024: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0029: nop + IL_002a: ldloc.2 + IL_002b: stloc.1 + IL_002c: ldloc.1 + IL_002d: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_TailOrNull() + IL_0032: stloc.2 + IL_0033: ldloc.2 + IL_0034: brtrue.s IL_001a + + IL_0036: ldloca.s V_0 + IL_0038: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_003d: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'for _ | _ in List.groupBy id [] do ...'() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> V_2, + class [runtime]System.Tuple`2> V_3) + IL_0000: nop + IL_0001: ldsfld class assembly/'for _ | _ in List-groupBy id -- do ---@29' assembly/'for _ | _ in List-groupBy id -- do ---@29'::@_instance + IL_0006: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_000b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::GroupBy(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_0010: stloc.1 + IL_0011: ldloc.1 + IL_0012: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_TailOrNull() + IL_0017: stloc.2 + IL_0018: br.s IL_0033 + + IL_001a: ldloc.1 + IL_001b: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_HeadOrDefault() + IL_0020: stloc.3 + IL_0021: ldloca.s V_0 + IL_0023: ldc.i4.0 + IL_0024: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0029: nop + IL_002a: ldloc.2 + IL_002b: stloc.1 + IL_002c: ldloc.1 + IL_002d: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_TailOrNull() + IL_0032: stloc.2 + IL_0033: ldloc.2 + IL_0034: brtrue.s IL_001a + + IL_0036: ldloca.s V_0 + IL_0038: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_003d: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'for _ & _ in List.groupBy id [] do ...'() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> V_2, + class [runtime]System.Tuple`2> V_3) + IL_0000: nop + IL_0001: ldsfld class assembly/'for _ - _ in List-groupBy id -- do ---@30' assembly/'for _ - _ in List-groupBy id -- do ---@30'::@_instance + IL_0006: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_000b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::GroupBy(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_0010: stloc.1 + IL_0011: ldloc.1 + IL_0012: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_TailOrNull() + IL_0017: stloc.2 + IL_0018: br.s IL_0033 + + IL_001a: ldloc.1 + IL_001b: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_HeadOrDefault() + IL_0020: stloc.3 + IL_0021: ldloca.s V_0 + IL_0023: ldc.i4.0 + IL_0024: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0029: nop + IL_002a: ldloc.2 + IL_002b: stloc.1 + IL_002c: ldloc.1 + IL_002d: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_TailOrNull() + IL_0032: stloc.2 + IL_0033: ldloc.2 + IL_0034: brtrue.s IL_001a + + IL_0036: ldloca.s V_0 + IL_0038: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_003d: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'for _, _group in List.groupBy id [] do ...'() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> V_2, + class [runtime]System.Tuple`2> V_3) + IL_0000: nop + IL_0001: ldsfld class assembly/'for _, _group in List-groupBy id -- do ---@31' assembly/'for _, _group in List-groupBy id -- do ---@31'::@_instance + IL_0006: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_000b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::GroupBy(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_0010: stloc.1 + IL_0011: ldloc.1 + IL_0012: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_TailOrNull() + IL_0017: stloc.2 + IL_0018: br.s IL_0033 + + IL_001a: ldloc.1 + IL_001b: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_HeadOrDefault() + IL_0020: stloc.3 + IL_0021: ldloca.s V_0 + IL_0023: ldc.i4.0 + IL_0024: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0029: nop + IL_002a: ldloc.2 + IL_002b: stloc.1 + IL_002c: ldloc.1 + IL_002d: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_TailOrNull() + IL_0032: stloc.2 + IL_0033: ldloc.2 + IL_0034: brtrue.s IL_001a + + IL_0036: ldloca.s V_0 + IL_0038: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_003d: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'for _, group in List.groupBy id [] do ...'() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> V_2, + class [runtime]System.Tuple`2> V_3, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_4) + IL_0000: nop + IL_0001: ldsfld class assembly/'for _, group in List-groupBy id -- do ---@32' assembly/'for _, group in List-groupBy id -- do ---@32'::@_instance + IL_0006: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_000b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::GroupBy(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_0010: stloc.1 + IL_0011: ldloc.1 + IL_0012: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_TailOrNull() + IL_0017: stloc.2 + IL_0018: br.s IL_0041 + + IL_001a: ldloc.1 + IL_001b: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_HeadOrDefault() + IL_0020: stloc.3 + IL_0021: ldloca.s V_0 + IL_0023: ldloc.3 + IL_0024: call instance !1 class [runtime]System.Tuple`2>::get_Item2() + IL_0029: stloc.s V_4 + IL_002b: ldloc.s V_4 + IL_002d: callvirt instance int32 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Length() + IL_0032: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0037: nop + IL_0038: ldloc.2 + IL_0039: stloc.1 + IL_003a: ldloc.1 + IL_003b: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_TailOrNull() + IL_0040: stloc.2 + IL_0041: ldloc.2 + IL_0042: brtrue.s IL_001a + + IL_0044: ldloca.s V_0 + IL_0046: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_004b: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'for 1 | 2 | _ in ...'() cil managed + { + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_2, + int32 V_3) + IL_0000: nop + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0006: stloc.1 + IL_0007: ldloc.1 + IL_0008: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_000d: stloc.2 + IL_000e: br.s IL_003a + + IL_0010: ldloc.1 + IL_0011: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0016: stloc.3 + IL_0017: ldloca.s V_0 + IL_0019: ldloc.3 + IL_001a: ldc.i4.1 + IL_001b: sub + IL_001c: switch ( + IL_0029, + IL_0029) + IL_0029: ldc.i4.0 + IL_002a: nop + IL_002b: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0030: nop + IL_0031: ldloc.2 + IL_0032: stloc.1 + IL_0033: ldloc.1 + IL_0034: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0039: stloc.2 + IL_003a: ldloc.2 + IL_003b: brtrue.s IL_0010 + + IL_003d: ldloca.s V_0 + IL_003f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0044: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'for Failure _ | _ in ...'() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_2, + class [runtime]System.Exception V_3, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_4) + IL_0000: nop + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0006: stloc.1 + IL_0007: ldloc.1 + IL_0008: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_000d: stloc.2 + IL_000e: br.s IL_0036 + + IL_0010: ldloc.1 + IL_0011: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0016: stloc.3 + IL_0017: ldloca.s V_0 + IL_0019: ldloc.3 + IL_001a: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::FailurePattern(class [runtime]System.Exception) + IL_001f: stloc.s V_4 + IL_0021: ldloc.s V_4 + IL_0023: brfalse.s IL_0025 + + IL_0025: ldc.i4.0 + IL_0026: nop + IL_0027: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_002c: nop + IL_002d: ldloc.2 + IL_002e: stloc.1 + IL_002f: ldloc.1 + IL_0030: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0035: stloc.2 + IL_0036: ldloc.2 + IL_0037: brtrue.s IL_0010 + + IL_0039: ldloca.s V_0 + IL_003b: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0040: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'for true | false in ...'() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_2, + bool V_3) + IL_0000: nop + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0006: stloc.1 + IL_0007: ldloc.1 + IL_0008: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_000d: stloc.2 + IL_000e: br.s IL_002d + + IL_0010: ldloc.1 + IL_0011: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0016: stloc.3 + IL_0017: ldloca.s V_0 + IL_0019: ldloc.3 + IL_001a: brfalse.s IL_001c + + IL_001c: ldc.i4.0 + IL_001d: nop + IL_001e: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0023: nop + IL_0024: ldloc.2 + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_002c: stloc.2 + IL_002d: ldloc.2 + IL_002e: brtrue.s IL_0010 + + IL_0030: ldloca.s V_0 + IL_0032: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0037: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'for true | _ in ...'() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_2, + bool V_3) + IL_0000: nop + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0006: stloc.1 + IL_0007: ldloc.1 + IL_0008: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_000d: stloc.2 + IL_000e: br.s IL_002d + + IL_0010: ldloc.1 + IL_0011: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0016: stloc.3 + IL_0017: ldloca.s V_0 + IL_0019: ldloc.3 + IL_001a: brfalse.s IL_001c + + IL_001c: ldc.i4.0 + IL_001d: nop + IL_001e: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0023: nop + IL_0024: ldloc.2 + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_002c: stloc.2 + IL_002d: ldloc.2 + IL_002e: brtrue.s IL_0010 + + IL_0030: ldloca.s V_0 + IL_0032: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0037: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'for _ | true in ...'() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_2, + bool V_3) + IL_0000: nop + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0006: stloc.1 + IL_0007: ldloc.1 + IL_0008: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_000d: stloc.2 + IL_000e: br.s IL_0029 + + IL_0010: ldloc.1 + IL_0011: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0016: stloc.3 + IL_0017: ldloca.s V_0 + IL_0019: ldc.i4.0 + IL_001a: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_001f: nop + IL_0020: ldloc.2 + IL_0021: stloc.1 + IL_0022: ldloc.1 + IL_0023: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0028: stloc.2 + IL_0029: ldloc.2 + IL_002a: brtrue.s IL_0010 + + IL_002c: ldloca.s V_0 + IL_002e: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0033: ret + } + } .class private abstract auto ansi sealed ''.$assembly diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInSeq_ToArray.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInSeq_ToArray.fs index f4a28b47626..2e1f8870f6e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInSeq_ToArray.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInSeq_ToArray.fs @@ -1,4 +1,15 @@ -let f1 (seq: int seq) = [|for x in seq -> x|] +let f0 (seq: int seq) = [|for x in seq do x|] +let f00 (seq: int seq) = [|for x in seq do yield x|] +let f000 (seq: int seq) = [|for x in seq do let x = x in yield x|] +let f0000 (seq: int seq) = [|for x in seq do let x = x in x|] +let f00000 (seq: int seq) x y = [|for z in seq do let foo = z + x in let bar = z + y in yield z + foo + bar|] +let f000000 (seq: int seq) x y = [|for z in seq do let foo = z + x in let bar = z + y in z + foo + bar|] +let f0000000 (seq: int seq) f x y = [|for z in seq do f (); let foo = z + x in let bar = z + y in z + foo + bar|] +let f00000000 (seq: int seq) f x y = [|for z in seq do let foo = z + x in f (); let bar = z + y in z + foo + bar|] +let f000000000 (seq: int seq) f x y = [|for z in seq do let foo = z + x in let bar = z + y in f (); z + foo + bar|] +let f0000000000 (seq: int seq) (f : unit -> int) x y = [|for z in seq do let foo = z + x in let bar = z + y in f (); z + foo + bar|] + +let f1 (seq: int seq) = [|for x in seq -> x|] let f2 f (seq: int seq) = [|for x in seq -> f x|] let f3 f (seq: int seq) = [|for x in seq -> f (); x|] let f4 f g (seq: int seq) = [|for x in seq -> f (); g(); x|] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInSeq_ToArray.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInSeq_ToArray.fs.il.bsl index 446a17b4fd9..6252744297b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInSeq_ToArray.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInSeq_ToArray.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { @@ -43,6 +43,667 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public static int32[] f0(class [runtime]System.Collections.Generic.IEnumerable`1 seq) cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + class [runtime]System.IDisposable V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_001a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloca.s V_0 + IL_0013: ldloc.3 + IL_0014: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0019: nop + IL_001a: ldloc.1 + IL_001b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0020: brtrue.s IL_000a + + IL_0022: ldnull + IL_0023: stloc.2 + IL_0024: leave.s IL_003b + + } + finally + { + IL_0026: ldloc.1 + IL_0027: isinst [runtime]System.IDisposable + IL_002c: stloc.s V_4 + IL_002e: ldloc.s V_4 + IL_0030: brfalse.s IL_003a + + IL_0032: ldloc.s V_4 + IL_0034: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0039: endfinally + IL_003a: endfinally + } + IL_003b: ldloc.2 + IL_003c: pop + IL_003d: ldloca.s V_0 + IL_003f: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_0044: ret + } + + .method public static int32[] f00(class [runtime]System.Collections.Generic.IEnumerable`1 seq) cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + class [runtime]System.IDisposable V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_001a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloca.s V_0 + IL_0013: ldloc.3 + IL_0014: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0019: nop + IL_001a: ldloc.1 + IL_001b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0020: brtrue.s IL_000a + + IL_0022: ldnull + IL_0023: stloc.2 + IL_0024: leave.s IL_003b + + } + finally + { + IL_0026: ldloc.1 + IL_0027: isinst [runtime]System.IDisposable + IL_002c: stloc.s V_4 + IL_002e: ldloc.s V_4 + IL_0030: brfalse.s IL_003a + + IL_0032: ldloc.s V_4 + IL_0034: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0039: endfinally + IL_003a: endfinally + } + IL_003b: ldloc.2 + IL_003c: pop + IL_003d: ldloca.s V_0 + IL_003f: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_0044: ret + } + + .method public static int32[] f000(class [runtime]System.Collections.Generic.IEnumerable`1 seq) cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + class [runtime]System.IDisposable V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_001b + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: nop + IL_0012: ldloca.s V_0 + IL_0014: ldloc.3 + IL_0015: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_001a: nop + IL_001b: ldloc.1 + IL_001c: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0021: brtrue.s IL_000a + + IL_0023: ldnull + IL_0024: stloc.2 + IL_0025: leave.s IL_003c + + } + finally + { + IL_0027: ldloc.1 + IL_0028: isinst [runtime]System.IDisposable + IL_002d: stloc.s V_4 + IL_002f: ldloc.s V_4 + IL_0031: brfalse.s IL_003b + + IL_0033: ldloc.s V_4 + IL_0035: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_003a: endfinally + IL_003b: endfinally + } + IL_003c: ldloc.2 + IL_003d: pop + IL_003e: ldloca.s V_0 + IL_0040: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_0045: ret + } + + .method public static int32[] f0000(class [runtime]System.Collections.Generic.IEnumerable`1 seq) cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + class [runtime]System.IDisposable V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_001a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloca.s V_0 + IL_0013: ldloc.3 + IL_0014: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0019: nop + IL_001a: ldloc.1 + IL_001b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0020: brtrue.s IL_000a + + IL_0022: ldnull + IL_0023: stloc.2 + IL_0024: leave.s IL_003b + + } + finally + { + IL_0026: ldloc.1 + IL_0027: isinst [runtime]System.IDisposable + IL_002c: stloc.s V_4 + IL_002e: ldloc.s V_4 + IL_0030: brfalse.s IL_003a + + IL_0032: ldloc.s V_4 + IL_0034: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0039: endfinally + IL_003a: endfinally + } + IL_003b: ldloc.2 + IL_003c: pop + IL_003d: ldloca.s V_0 + IL_003f: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_0044: ret + } + + .method public static int32[] f00000(class [runtime]System.Collections.Generic.IEnumerable`1 seq, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_002a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.1 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldloc.3 + IL_0017: ldarg.2 + IL_0018: add + IL_0019: stloc.s V_5 + IL_001b: ldloca.s V_0 + IL_001d: ldloc.3 + IL_001e: ldloc.s V_4 + IL_0020: add + IL_0021: ldloc.s V_5 + IL_0023: add + IL_0024: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0029: nop + IL_002a: ldloc.1 + IL_002b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0030: brtrue.s IL_000a + + IL_0032: ldnull + IL_0033: stloc.2 + IL_0034: leave.s IL_004b + + } + finally + { + IL_0036: ldloc.1 + IL_0037: isinst [runtime]System.IDisposable + IL_003c: stloc.s V_6 + IL_003e: ldloc.s V_6 + IL_0040: brfalse.s IL_004a + + IL_0042: ldloc.s V_6 + IL_0044: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0049: endfinally + IL_004a: endfinally + } + IL_004b: ldloc.2 + IL_004c: pop + IL_004d: ldloca.s V_0 + IL_004f: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_0054: ret + } + + .method public static int32[] f000000(class [runtime]System.Collections.Generic.IEnumerable`1 seq, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_002a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.1 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldloc.3 + IL_0017: ldarg.2 + IL_0018: add + IL_0019: stloc.s V_5 + IL_001b: ldloca.s V_0 + IL_001d: ldloc.3 + IL_001e: ldloc.s V_4 + IL_0020: add + IL_0021: ldloc.s V_5 + IL_0023: add + IL_0024: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0029: nop + IL_002a: ldloc.1 + IL_002b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0030: brtrue.s IL_000a + + IL_0032: ldnull + IL_0033: stloc.2 + IL_0034: leave.s IL_004b + + } + finally + { + IL_0036: ldloc.1 + IL_0037: isinst [runtime]System.IDisposable + IL_003c: stloc.s V_6 + IL_003e: ldloc.s V_6 + IL_0040: brfalse.s IL_004a + + IL_0042: ldloc.s V_6 + IL_0044: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0049: endfinally + IL_004a: endfinally + } + IL_004b: ldloc.2 + IL_004c: pop + IL_004d: ldloca.s V_0 + IL_004f: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_0054: ret + } + + .method public static int32[] f0000000(class [runtime]System.Collections.Generic.IEnumerable`1 seq, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0032 + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldarg.1 + IL_0012: ldnull + IL_0013: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0018: pop + IL_0019: ldloc.3 + IL_001a: ldarg.2 + IL_001b: add + IL_001c: stloc.s V_4 + IL_001e: ldloc.3 + IL_001f: ldarg.3 + IL_0020: add + IL_0021: stloc.s V_5 + IL_0023: ldloca.s V_0 + IL_0025: ldloc.3 + IL_0026: ldloc.s V_4 + IL_0028: add + IL_0029: ldloc.s V_5 + IL_002b: add + IL_002c: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0031: nop + IL_0032: ldloc.1 + IL_0033: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0038: brtrue.s IL_000a + + IL_003a: ldnull + IL_003b: stloc.2 + IL_003c: leave.s IL_0053 + + } + finally + { + IL_003e: ldloc.1 + IL_003f: isinst [runtime]System.IDisposable + IL_0044: stloc.s V_6 + IL_0046: ldloc.s V_6 + IL_0048: brfalse.s IL_0052 + + IL_004a: ldloc.s V_6 + IL_004c: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0051: endfinally + IL_0052: endfinally + } + IL_0053: ldloc.2 + IL_0054: pop + IL_0055: ldloca.s V_0 + IL_0057: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_005c: ret + } + + .method public static int32[] f00000000(class [runtime]System.Collections.Generic.IEnumerable`1 seq, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0032 + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.2 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldarg.1 + IL_0017: ldnull + IL_0018: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001d: pop + IL_001e: ldloc.3 + IL_001f: ldarg.3 + IL_0020: add + IL_0021: stloc.s V_5 + IL_0023: ldloca.s V_0 + IL_0025: ldloc.3 + IL_0026: ldloc.s V_4 + IL_0028: add + IL_0029: ldloc.s V_5 + IL_002b: add + IL_002c: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0031: nop + IL_0032: ldloc.1 + IL_0033: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0038: brtrue.s IL_000a + + IL_003a: ldnull + IL_003b: stloc.2 + IL_003c: leave.s IL_0053 + + } + finally + { + IL_003e: ldloc.1 + IL_003f: isinst [runtime]System.IDisposable + IL_0044: stloc.s V_6 + IL_0046: ldloc.s V_6 + IL_0048: brfalse.s IL_0052 + + IL_004a: ldloc.s V_6 + IL_004c: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0051: endfinally + IL_0052: endfinally + } + IL_0053: ldloc.2 + IL_0054: pop + IL_0055: ldloca.s V_0 + IL_0057: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_005c: ret + } + + .method public static int32[] f000000000(class [runtime]System.Collections.Generic.IEnumerable`1 seq, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0032 + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.2 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldloc.3 + IL_0017: ldarg.3 + IL_0018: add + IL_0019: stloc.s V_5 + IL_001b: ldarg.1 + IL_001c: ldnull + IL_001d: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0022: pop + IL_0023: ldloca.s V_0 + IL_0025: ldloc.3 + IL_0026: ldloc.s V_4 + IL_0028: add + IL_0029: ldloc.s V_5 + IL_002b: add + IL_002c: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0031: nop + IL_0032: ldloc.1 + IL_0033: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0038: brtrue.s IL_000a + + IL_003a: ldnull + IL_003b: stloc.2 + IL_003c: leave.s IL_0053 + + } + finally + { + IL_003e: ldloc.1 + IL_003f: isinst [runtime]System.IDisposable + IL_0044: stloc.s V_6 + IL_0046: ldloc.s V_6 + IL_0048: brfalse.s IL_0052 + + IL_004a: ldloc.s V_6 + IL_004c: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0051: endfinally + IL_0052: endfinally + } + IL_0053: ldloc.2 + IL_0054: pop + IL_0055: ldloca.s V_0 + IL_0057: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_005c: ret + } + + .method public static int32[] f0000000000(class [runtime]System.Collections.Generic.IEnumerable`1 seq, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0039 + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.2 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldloc.3 + IL_0017: ldarg.3 + IL_0018: add + IL_0019: stloc.s V_5 + IL_001b: ldloca.s V_0 + IL_001d: ldarg.1 + IL_001e: ldnull + IL_001f: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0024: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0029: nop + IL_002a: ldloca.s V_0 + IL_002c: ldloc.3 + IL_002d: ldloc.s V_4 + IL_002f: add + IL_0030: ldloc.s V_5 + IL_0032: add + IL_0033: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Add(!0) + IL_0038: nop + IL_0039: ldloc.1 + IL_003a: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_003f: brtrue.s IL_000a + + IL_0041: ldnull + IL_0042: stloc.2 + IL_0043: leave.s IL_005a + + } + finally + { + IL_0045: ldloc.1 + IL_0046: isinst [runtime]System.IDisposable + IL_004b: stloc.s V_6 + IL_004d: ldloc.s V_6 + IL_004f: brfalse.s IL_0059 + + IL_0051: ldloc.s V_6 + IL_0053: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0058: endfinally + IL_0059: endfinally + } + IL_005a: ldloc.2 + IL_005b: pop + IL_005c: ldloca.s V_0 + IL_005e: call instance !0[] valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ArrayCollector`1::Close() + IL_0063: ret + } + .method public static int32[] f1(class [runtime]System.Collections.Generic.IEnumerable`1 seq) cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInSeq_ToList.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInSeq_ToList.fs index 9c88ace26d3..8368f875244 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInSeq_ToList.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInSeq_ToList.fs @@ -1,4 +1,15 @@ -let f1 (seq: int seq) = [for x in seq -> x] +let f0 (seq: int seq) = [for x in seq do x] +let f00 (seq: int seq) = [for x in seq do yield x] +let f000 (seq: int seq) = [for x in seq do let x = x in yield x] +let f0000 (seq: int seq) = [for x in seq do let x = x in x] +let f00000 (seq: int seq) x y = [for z in seq do let foo = z + x in let bar = z + y in yield z + foo + bar] +let f000000 (seq: int seq) x y = [for z in seq do let foo = z + x in let bar = z + y in z + foo + bar] +let f0000000 (seq: int seq) f x y = [for z in seq do f (); let foo = z + x in let bar = z + y in z + foo + bar] +let f00000000 (seq: int seq) f x y = [for z in seq do let foo = z + x in f (); let bar = z + y in z + foo + bar] +let f000000000 (seq: int seq) f x y = [for z in seq do let foo = z + x in let bar = z + y in f (); z + foo + bar] +let f0000000000 (seq: int seq) (f : unit -> int) x y = [for z in seq do let foo = z + x in let bar = z + y in f (); z + foo + bar] + +let f1 (seq: int seq) = [for x in seq -> x] let f2 f (seq: int seq) = [for x in seq -> f x] let f3 f (seq: int seq) = [for x in seq -> f (); x] let f4 f g (seq: int seq) = [for x in seq -> f (); g(); x] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInSeq_ToList.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInSeq_ToList.fs.il.bsl index bf3e4bf6eab..8c563e0be23 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInSeq_ToList.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInSeq_ToList.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { @@ -43,6 +43,673 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f0(class [runtime]System.Collections.Generic.IEnumerable`1 seq) cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + class [runtime]System.IDisposable V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_001a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloca.s V_0 + IL_0013: ldloc.3 + IL_0014: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0019: nop + IL_001a: ldloc.1 + IL_001b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0020: brtrue.s IL_000a + + IL_0022: ldnull + IL_0023: stloc.2 + IL_0024: leave.s IL_003b + + } + finally + { + IL_0026: ldloc.1 + IL_0027: isinst [runtime]System.IDisposable + IL_002c: stloc.s V_4 + IL_002e: ldloc.s V_4 + IL_0030: brfalse.s IL_003a + + IL_0032: ldloc.s V_4 + IL_0034: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0039: endfinally + IL_003a: endfinally + } + IL_003b: ldloc.2 + IL_003c: pop + IL_003d: ldloca.s V_0 + IL_003f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0044: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f00(class [runtime]System.Collections.Generic.IEnumerable`1 seq) cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + class [runtime]System.IDisposable V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_001a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloca.s V_0 + IL_0013: ldloc.3 + IL_0014: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0019: nop + IL_001a: ldloc.1 + IL_001b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0020: brtrue.s IL_000a + + IL_0022: ldnull + IL_0023: stloc.2 + IL_0024: leave.s IL_003b + + } + finally + { + IL_0026: ldloc.1 + IL_0027: isinst [runtime]System.IDisposable + IL_002c: stloc.s V_4 + IL_002e: ldloc.s V_4 + IL_0030: brfalse.s IL_003a + + IL_0032: ldloc.s V_4 + IL_0034: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0039: endfinally + IL_003a: endfinally + } + IL_003b: ldloc.2 + IL_003c: pop + IL_003d: ldloca.s V_0 + IL_003f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0044: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f000(class [runtime]System.Collections.Generic.IEnumerable`1 seq) cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + class [runtime]System.IDisposable V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_001b + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: nop + IL_0012: ldloca.s V_0 + IL_0014: ldloc.3 + IL_0015: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_001a: nop + IL_001b: ldloc.1 + IL_001c: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0021: brtrue.s IL_000a + + IL_0023: ldnull + IL_0024: stloc.2 + IL_0025: leave.s IL_003c + + } + finally + { + IL_0027: ldloc.1 + IL_0028: isinst [runtime]System.IDisposable + IL_002d: stloc.s V_4 + IL_002f: ldloc.s V_4 + IL_0031: brfalse.s IL_003b + + IL_0033: ldloc.s V_4 + IL_0035: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_003a: endfinally + IL_003b: endfinally + } + IL_003c: ldloc.2 + IL_003d: pop + IL_003e: ldloca.s V_0 + IL_0040: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0045: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f0000(class [runtime]System.Collections.Generic.IEnumerable`1 seq) cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + class [runtime]System.IDisposable V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_001a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloca.s V_0 + IL_0013: ldloc.3 + IL_0014: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0019: nop + IL_001a: ldloc.1 + IL_001b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0020: brtrue.s IL_000a + + IL_0022: ldnull + IL_0023: stloc.2 + IL_0024: leave.s IL_003b + + } + finally + { + IL_0026: ldloc.1 + IL_0027: isinst [runtime]System.IDisposable + IL_002c: stloc.s V_4 + IL_002e: ldloc.s V_4 + IL_0030: brfalse.s IL_003a + + IL_0032: ldloc.s V_4 + IL_0034: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0039: endfinally + IL_003a: endfinally + } + IL_003b: ldloc.2 + IL_003c: pop + IL_003d: ldloca.s V_0 + IL_003f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0044: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f00000(class [runtime]System.Collections.Generic.IEnumerable`1 seq, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_002a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.1 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldloc.3 + IL_0017: ldarg.2 + IL_0018: add + IL_0019: stloc.s V_5 + IL_001b: ldloca.s V_0 + IL_001d: ldloc.3 + IL_001e: ldloc.s V_4 + IL_0020: add + IL_0021: ldloc.s V_5 + IL_0023: add + IL_0024: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0029: nop + IL_002a: ldloc.1 + IL_002b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0030: brtrue.s IL_000a + + IL_0032: ldnull + IL_0033: stloc.2 + IL_0034: leave.s IL_004b + + } + finally + { + IL_0036: ldloc.1 + IL_0037: isinst [runtime]System.IDisposable + IL_003c: stloc.s V_6 + IL_003e: ldloc.s V_6 + IL_0040: brfalse.s IL_004a + + IL_0042: ldloc.s V_6 + IL_0044: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0049: endfinally + IL_004a: endfinally + } + IL_004b: ldloc.2 + IL_004c: pop + IL_004d: ldloca.s V_0 + IL_004f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0054: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f000000(class [runtime]System.Collections.Generic.IEnumerable`1 seq, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_002a + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.1 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldloc.3 + IL_0017: ldarg.2 + IL_0018: add + IL_0019: stloc.s V_5 + IL_001b: ldloca.s V_0 + IL_001d: ldloc.3 + IL_001e: ldloc.s V_4 + IL_0020: add + IL_0021: ldloc.s V_5 + IL_0023: add + IL_0024: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0029: nop + IL_002a: ldloc.1 + IL_002b: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0030: brtrue.s IL_000a + + IL_0032: ldnull + IL_0033: stloc.2 + IL_0034: leave.s IL_004b + + } + finally + { + IL_0036: ldloc.1 + IL_0037: isinst [runtime]System.IDisposable + IL_003c: stloc.s V_6 + IL_003e: ldloc.s V_6 + IL_0040: brfalse.s IL_004a + + IL_0042: ldloc.s V_6 + IL_0044: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0049: endfinally + IL_004a: endfinally + } + IL_004b: ldloc.2 + IL_004c: pop + IL_004d: ldloca.s V_0 + IL_004f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0054: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f0000000(class [runtime]System.Collections.Generic.IEnumerable`1 seq, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0032 + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldarg.1 + IL_0012: ldnull + IL_0013: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0018: pop + IL_0019: ldloc.3 + IL_001a: ldarg.2 + IL_001b: add + IL_001c: stloc.s V_4 + IL_001e: ldloc.3 + IL_001f: ldarg.3 + IL_0020: add + IL_0021: stloc.s V_5 + IL_0023: ldloca.s V_0 + IL_0025: ldloc.3 + IL_0026: ldloc.s V_4 + IL_0028: add + IL_0029: ldloc.s V_5 + IL_002b: add + IL_002c: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0031: nop + IL_0032: ldloc.1 + IL_0033: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0038: brtrue.s IL_000a + + IL_003a: ldnull + IL_003b: stloc.2 + IL_003c: leave.s IL_0053 + + } + finally + { + IL_003e: ldloc.1 + IL_003f: isinst [runtime]System.IDisposable + IL_0044: stloc.s V_6 + IL_0046: ldloc.s V_6 + IL_0048: brfalse.s IL_0052 + + IL_004a: ldloc.s V_6 + IL_004c: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0051: endfinally + IL_0052: endfinally + } + IL_0053: ldloc.2 + IL_0054: pop + IL_0055: ldloca.s V_0 + IL_0057: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_005c: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f00000000(class [runtime]System.Collections.Generic.IEnumerable`1 seq, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0032 + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.2 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldarg.1 + IL_0017: ldnull + IL_0018: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001d: pop + IL_001e: ldloc.3 + IL_001f: ldarg.3 + IL_0020: add + IL_0021: stloc.s V_5 + IL_0023: ldloca.s V_0 + IL_0025: ldloc.3 + IL_0026: ldloc.s V_4 + IL_0028: add + IL_0029: ldloc.s V_5 + IL_002b: add + IL_002c: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0031: nop + IL_0032: ldloc.1 + IL_0033: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0038: brtrue.s IL_000a + + IL_003a: ldnull + IL_003b: stloc.2 + IL_003c: leave.s IL_0053 + + } + finally + { + IL_003e: ldloc.1 + IL_003f: isinst [runtime]System.IDisposable + IL_0044: stloc.s V_6 + IL_0046: ldloc.s V_6 + IL_0048: brfalse.s IL_0052 + + IL_004a: ldloc.s V_6 + IL_004c: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0051: endfinally + IL_0052: endfinally + } + IL_0053: ldloc.2 + IL_0054: pop + IL_0055: ldloca.s V_0 + IL_0057: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_005c: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f000000000(class [runtime]System.Collections.Generic.IEnumerable`1 seq, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0032 + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.2 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldloc.3 + IL_0017: ldarg.3 + IL_0018: add + IL_0019: stloc.s V_5 + IL_001b: ldarg.1 + IL_001c: ldnull + IL_001d: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0022: pop + IL_0023: ldloca.s V_0 + IL_0025: ldloc.3 + IL_0026: ldloc.s V_4 + IL_0028: add + IL_0029: ldloc.s V_5 + IL_002b: add + IL_002c: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0031: nop + IL_0032: ldloc.1 + IL_0033: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0038: brtrue.s IL_000a + + IL_003a: ldnull + IL_003b: stloc.2 + IL_003c: leave.s IL_0053 + + } + finally + { + IL_003e: ldloc.1 + IL_003f: isinst [runtime]System.IDisposable + IL_0044: stloc.s V_6 + IL_0046: ldloc.s V_6 + IL_0048: brfalse.s IL_0052 + + IL_004a: ldloc.s V_6 + IL_004c: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0051: endfinally + IL_0052: endfinally + } + IL_0053: ldloc.2 + IL_0054: pop + IL_0055: ldloca.s V_0 + IL_0057: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_005c: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f0000000000(class [runtime]System.Collections.Generic.IEnumerable`1 seq, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.Collections.Generic.IEnumerable`1 V_2, + int32 V_3, + int32 V_4, + int32 V_5, + class [runtime]System.IDisposable V_6) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0007: stloc.1 + .try + { + IL_0008: br.s IL_0039 + + IL_000a: ldloc.1 + IL_000b: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: ldarg.2 + IL_0013: add + IL_0014: stloc.s V_4 + IL_0016: ldloc.3 + IL_0017: ldarg.3 + IL_0018: add + IL_0019: stloc.s V_5 + IL_001b: ldloca.s V_0 + IL_001d: ldarg.1 + IL_001e: ldnull + IL_001f: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0024: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0029: nop + IL_002a: ldloca.s V_0 + IL_002c: ldloc.3 + IL_002d: ldloc.s V_4 + IL_002f: add + IL_0030: ldloc.s V_5 + IL_0032: add + IL_0033: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0038: nop + IL_0039: ldloc.1 + IL_003a: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_003f: brtrue.s IL_000a + + IL_0041: ldnull + IL_0042: stloc.2 + IL_0043: leave.s IL_005a + + } + finally + { + IL_0045: ldloc.1 + IL_0046: isinst [runtime]System.IDisposable + IL_004b: stloc.s V_6 + IL_004d: ldloc.s V_6 + IL_004f: brfalse.s IL_0059 + + IL_0051: ldloc.s V_6 + IL_0053: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0058: endfinally + IL_0059: endfinally + } + IL_005a: ldloc.2 + IL_005b: pop + IL_005c: ldloca.s V_0 + IL_005e: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0063: ret + } + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f1(class [runtime]System.Collections.Generic.IEnumerable`1 seq) cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeArrays.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeArrays.fs.il.bsl index fde4cd95840..4422a6a829f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeArrays.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeArrays.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeLists.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeLists.fs.il.bsl index 104102225b1..e92ceb62f4e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeLists.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeLists.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeArrays.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeArrays.fs.il.bsl index 9a616f71842..8c9eb90df0d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeArrays.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeArrays.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeLists.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeLists.fs.il.bsl index acf670b4144..5dad5d2c08a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeLists.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeLists.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_CSInterface.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_CSInterface.fs.il.bsl index 9e25e93e9fc..b0b9c48c529 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_CSInterface.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_CSInterface.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface.fs.il.bsl index d05a87f4cf1..f71c658a81b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth.fs.il.bsl index b5350dcf4e1..716f6af522e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_CSInterface.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_CSInterface.fs index b9652b34734..6048e758cfd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_CSInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_CSInterface.fs @@ -1,6 +1,6 @@ // #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not -// Single dimentional array +// Single dimensional array module Program let F<'T when 'T :> System.IDisposable>(x : 'T[]) = x.[0].Dispose() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_CSInterface.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_CSInterface.fs.il.bsl index f9e2727550f..7c86b70bf41 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_CSInterface.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_CSInterface.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface.fs index ddcecaceaab..e4c97b7f995 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface.fs @@ -1,6 +1,6 @@ // #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not -// Single dimentional array - use an F# interface (IEvent<'a> for example) +// Single dimensional array - use an F# interface (IEvent<'a> for example) module Program let F<'T when 'T :> IEvent>(x : 'T[]) = x.[0].Add(fun x -> ()) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface.fs.il.bsl index c08a12ec3bd..0a92594625c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface_NoExtMeth.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface_NoExtMeth.fs index 015ba793522..d04c864455f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface_NoExtMeth.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface_NoExtMeth.fs @@ -1,7 +1,7 @@ // #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not -// Single dimentional array - use an F# interface (IEvent<'a> for example) +// Single dimensional array - use an F# interface (IEvent<'a> for example) // Note: the 'AddHandler' is some non-extension method module Program let F<'T when 'T :> IEvent>(x : 'T[]) = x.[0].AddHandler(fun x _ -> ()) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface_NoExtMeth.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface_NoExtMeth.fs.il.bsl index 6aebbae558e..240d44ba48a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface_NoExtMeth.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_Array_FSInterface_NoExtMeth.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_CSInterface.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_CSInterface.fs index bdf6e8880cf..cd44055a502 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_CSInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_CSInterface.fs @@ -1,6 +1,6 @@ // #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not -// Multi-dimentional array +// Multi-dimensional array module Program let F<'T when 'T :> System.IDisposable>(x : 'T[,]) = x.[0,0].Dispose() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_CSInterface.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_CSInterface.fs.il.bsl index cf342c3e020..1cd540c243b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_CSInterface.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_CSInterface.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface.fs index 97947096935..8d6dd2ee8d1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface.fs @@ -1,6 +1,6 @@ // #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not -// Multi-dimentional array - use an F# interface (IEvent<'a> for example) +// Multi-dimensional array - use an F# interface (IEvent<'a> for example) module Program let F<'T when 'T :> IEvent>(x : 'T[,]) = x.[0,0].Add(fun x -> ()) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface.fs.il.bsl index 2dbed01e067..48fc792765a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.fs index 017f7530e56..077633dc7dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.fs @@ -1,7 +1,7 @@ // #Regression #NoMono #NoMT #CodeGen #EmittedIL // Regression test for FSHARP1.0:4237 // F# boxes structs when calling, say, Object.ToString() and interface methods. C# does not -// Multi-dimentional array - use an F# interface (IEvent<'a> for example) +// Multi-dimensional array - use an F# interface (IEvent<'a> for example) // Note: the 'AddHandler' is some non-extension method module Program let F<'T when 'T :> IEvent>(x : 'T[,]) = x.[0,0].AddHandler(fun x _ -> ()) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.fs.il.bsl index 3dc37ad89bf..c94b0195de0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_CSInterface.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_CSInterface.fs.il.bsl index 10304469499..fa02d2a28ad 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_CSInterface.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_CSInterface.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface.fs.il.bsl index e400ca31022..b5d98d95bd5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface_NoExtMeth.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface_NoExtMeth.fs.il.bsl index 66665dec2e9..69b07dca90a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface_NoExtMeth.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_NoArray_FSInterface_NoExtMeth.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ToString.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ToString.fs.il.bsl index 21e05e28169..c73d4f8e19b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ToString.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct_ToString.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnArray01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnArray01.fs.RealInternalSignatureOff.il.bsl index 9aa3224bb63..a0af1067d16 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnArray01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnArray01.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnArray01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnArray01.fs.RealInternalSignatureOn.il.bsl index 9aa3224bb63..a0af1067d16 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnArray01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnArray01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs.RealInternalSignatureOff.il.bsl index 7dad9856c8f..1464a253823 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs.RealInternalSignatureOff.il.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs.RealInternalSignatureOn.il.bsl index 7dad9856c8f..1464a253823 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs.RealInternalSignatureOn.il.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnString01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnString01.fs.RealInternalSignatureOff.il.bsl index 6b807671df2..0051f80eb41 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnString01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnString01.fs.RealInternalSignatureOff.il.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { @@ -518,7 +518,7 @@ IL_002c: ldloc.3 IL_002d: box [runtime]System.Char IL_0032: call string [runtime]System.String::Format(string, - object) + object) IL_0037: stloc.s V_4 IL_0039: ldstr "%O" IL_003e: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string>::.ctor(string) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnString01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnString01.fs.RealInternalSignatureOn.il.bsl index 6b807671df2..0051f80eb41 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnString01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnString01.fs.RealInternalSignatureOn.il.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { @@ -518,7 +518,7 @@ IL_002c: ldloc.3 IL_002d: box [runtime]System.Char IL_0032: call string [runtime]System.String::Format(string, - object) + object) IL_0037: stloc.s V_4 IL_0039: ldstr "%O" IL_003e: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string>::.ctor(string) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepByte.fs.RealInternalSignatureOff.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepByte.fs.RealInternalSignatureOff.opt.il.bsl index 681c6e38186..b75fcbec428 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepByte.fs.RealInternalSignatureOff.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepByte.fs.RealInternalSignatureOff.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepByte.fs.RealInternalSignatureOn.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepByte.fs.RealInternalSignatureOn.opt.il.bsl index 83c83d6eac2..ca6b4b16112 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepByte.fs.RealInternalSignatureOn.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepByte.fs.RealInternalSignatureOn.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepChar.fs.RealInternalSignatureOff.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepChar.fs.RealInternalSignatureOff.opt.il.bsl index bb440972d85..02fe37fcdc2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepChar.fs.RealInternalSignatureOff.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepChar.fs.RealInternalSignatureOff.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepChar.fs.RealInternalSignatureOn.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepChar.fs.RealInternalSignatureOn.opt.il.bsl index f383fcd5612..38f203110af 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepChar.fs.RealInternalSignatureOn.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepChar.fs.RealInternalSignatureOn.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt16.fs.RealInternalSignatureOff.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt16.fs.RealInternalSignatureOff.opt.il.bsl index 79646c5f401..a1034a8ae8d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt16.fs.RealInternalSignatureOff.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt16.fs.RealInternalSignatureOff.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt16.fs.RealInternalSignatureOn.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt16.fs.RealInternalSignatureOn.opt.il.bsl index b8f92098223..84e3fcf2417 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt16.fs.RealInternalSignatureOn.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt16.fs.RealInternalSignatureOn.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt32.fs.RealInternalSignatureOff.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt32.fs.RealInternalSignatureOff.opt.il.bsl index e511f90098b..cf72c332d47 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt32.fs.RealInternalSignatureOff.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt32.fs.RealInternalSignatureOff.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt32.fs.RealInternalSignatureOn.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt32.fs.RealInternalSignatureOn.opt.il.bsl index ae30a8e844f..22863756af9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt32.fs.RealInternalSignatureOn.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt32.fs.RealInternalSignatureOn.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt64.fs.RealInternalSignatureOff.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt64.fs.RealInternalSignatureOff.opt.il.bsl index 0f20def3e61..512ae6aca0d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt64.fs.RealInternalSignatureOff.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt64.fs.RealInternalSignatureOff.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt64.fs.RealInternalSignatureOn.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt64.fs.RealInternalSignatureOn.opt.il.bsl index 3c567634da6..75ca4baa45c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt64.fs.RealInternalSignatureOn.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepInt64.fs.RealInternalSignatureOn.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepIntPtr.fs.RealInternalSignatureOff.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepIntPtr.fs.RealInternalSignatureOff.opt.il.bsl index 330c21deb58..12044470181 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepIntPtr.fs.RealInternalSignatureOff.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepIntPtr.fs.RealInternalSignatureOff.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepIntPtr.fs.RealInternalSignatureOn.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepIntPtr.fs.RealInternalSignatureOn.opt.il.bsl index ebfc4b43fb1..927c976ab40 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepIntPtr.fs.RealInternalSignatureOn.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepIntPtr.fs.RealInternalSignatureOn.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepSByte.fs.RealInternalSignatureOff.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepSByte.fs.RealInternalSignatureOff.opt.il.bsl index f49d7ac9c52..ef180b2502d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepSByte.fs.RealInternalSignatureOff.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepSByte.fs.RealInternalSignatureOff.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepSByte.fs.RealInternalSignatureOn.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepSByte.fs.RealInternalSignatureOn.opt.il.bsl index 6ade092cfe6..f7da45cfac5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepSByte.fs.RealInternalSignatureOn.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepSByte.fs.RealInternalSignatureOn.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt16.fs.RealInternalSignatureOff.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt16.fs.RealInternalSignatureOff.opt.il.bsl index 2b059e5df41..db29b6cf169 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt16.fs.RealInternalSignatureOff.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt16.fs.RealInternalSignatureOff.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt16.fs.RealInternalSignatureOn.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt16.fs.RealInternalSignatureOn.opt.il.bsl index 0ef1855e8d8..5becac72ad5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt16.fs.RealInternalSignatureOn.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt16.fs.RealInternalSignatureOn.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt32.fs.RealInternalSignatureOff.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt32.fs.RealInternalSignatureOff.opt.il.bsl index 8bf808cab23..2d56ae5a111 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt32.fs.RealInternalSignatureOff.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt32.fs.RealInternalSignatureOff.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt32.fs.RealInternalSignatureOn.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt32.fs.RealInternalSignatureOn.opt.il.bsl index 80285c89dc2..d759648ba7d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt32.fs.RealInternalSignatureOn.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt32.fs.RealInternalSignatureOn.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt64.fs.RealInternalSignatureOff.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt64.fs.RealInternalSignatureOff.opt.il.bsl index 8076772e763..ae486e59125 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt64.fs.RealInternalSignatureOff.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt64.fs.RealInternalSignatureOff.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt64.fs.RealInternalSignatureOn.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt64.fs.RealInternalSignatureOn.opt.il.bsl index 96c418afb00..b8e1c430fe7 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt64.fs.RealInternalSignatureOn.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUInt64.fs.RealInternalSignatureOn.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUIntPtr.fs.RealInternalSignatureOff.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUIntPtr.fs.RealInternalSignatureOff.opt.il.bsl index 9af9230923b..69c979a647f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUIntPtr.fs.RealInternalSignatureOff.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUIntPtr.fs.RealInternalSignatureOff.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUIntPtr.fs.RealInternalSignatureOn.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUIntPtr.fs.RealInternalSignatureOn.opt.il.bsl index 394330583c9..f09f39d31e4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUIntPtr.fs.RealInternalSignatureOn.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStepUIntPtr.fs.RealInternalSignatureOn.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStep_UnitsOfMeasure.fs.RealInternalSignatureOff.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStep_UnitsOfMeasure.fs.RealInternalSignatureOff.opt.il.bsl index 456b6757b4f..82341acf6c0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStep_UnitsOfMeasure.fs.RealInternalSignatureOff.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStep_UnitsOfMeasure.fs.RealInternalSignatureOff.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStep_UnitsOfMeasure.fs.RealInternalSignatureOn.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStep_UnitsOfMeasure.fs.RealInternalSignatureOn.opt.il.bsl index cacb169018c..f29faf3c08d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStep_UnitsOfMeasure.fs.RealInternalSignatureOn.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachRangeStep_UnitsOfMeasure.fs.RealInternalSignatureOn.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop.fs index 9a732ba4a30..2f890a85222 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop.fs @@ -202,7 +202,6 @@ module ForLoop = [] let ``NonTrivialBranchingBindingInEnd03_fs_RealInternalSignatureOff_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOff |> verifyCompilation @@ -210,7 +209,6 @@ module ForLoop = [] let ``NonTrivialBranchingBindingInEnd03_fs_RealInternalSignatureOn_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOn |> verifyCompilation @@ -218,7 +216,6 @@ module ForLoop = [] let ``NonTrivialBranchingBindingInEnd03_fs_RealInternalSignatureOff_nonopt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOff |> verifyCompilation @@ -226,7 +223,6 @@ module ForLoop = [] let ``NonTrivialBranchingBindingInEnd03_fs_RealInternalSignatureOn_nonopt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOn |> verifyCompilation @@ -234,7 +230,6 @@ module ForLoop = [] let ``NonTrivialBranchingBindingInEnd04_fs_RealInternalSignatureOff_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOff |> verifyCompilation @@ -242,7 +237,6 @@ module ForLoop = [] let ``NonTrivialBranchingBindingInEnd04_fs_RealInternalSignatureOn_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOn |> verifyCompilation @@ -250,7 +244,6 @@ module ForLoop = [] let ``NonTrivialBranchingBindingInEnd04_fs_RealInternalSignatureOff_nonopt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOff |> verifyCompilation @@ -258,7 +251,6 @@ module ForLoop = [] let ``NonTrivialBranchingBindingInEnd04_fs_RealInternalSignatureOn_nonopt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOn |> verifyCompilation @@ -294,7 +286,6 @@ module ForLoop = [] let ``ForEachRangeStepSByte_fs_RealInternalSignatureOff_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOff |> verifyCompilation @@ -302,7 +293,6 @@ module ForLoop = [] let ``ForEachRangeStepSByte_fs_RealInternalSignatureOn_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOn |> verifyCompilation @@ -310,7 +300,6 @@ module ForLoop = [] let ``ForEachRangeStepByte_fs_RealInternalSignatureOff_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOff |> verifyCompilation @@ -318,7 +307,6 @@ module ForLoop = [] let ``ForEachRangeStepByte_fs_RealInternalSignatureOn_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOn |> verifyCompilation @@ -326,7 +314,6 @@ module ForLoop = [] let ``ForEachRangeStepChar_fs_RealInternalSignatureOff_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOff |> verifyCompilation @@ -334,7 +321,6 @@ module ForLoop = [] let ``ForEachRangeStepChar_fs_RealInternalSignatureOn_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOn |> verifyCompilation @@ -342,7 +328,6 @@ module ForLoop = [] let ``ForEachRangeStepInt16_fs_RealInternalSignatureOff_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOff |> verifyCompilation @@ -350,7 +335,6 @@ module ForLoop = [] let ``ForEachRangeStepInt16_fs_RealInternalSignatureOn_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOn |> verifyCompilation @@ -358,7 +342,6 @@ module ForLoop = [] let ``ForEachRangeStepUInt16_fs_RealInternalSignatureOff_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOff |> verifyCompilation @@ -366,7 +349,6 @@ module ForLoop = [] let ``ForEachRangeStepUInt16_fs_RealInternalSignatureOn_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOn |> verifyCompilation @@ -374,7 +356,6 @@ module ForLoop = [] let ``ForEachRangeStepInt32_fs_RealInternalSignatureOff_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOff |> verifyCompilation @@ -382,7 +363,6 @@ module ForLoop = [] let ``ForEachRangeStepInt32_fs_RealInternalSignatureOn_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOn |> verifyCompilation @@ -390,7 +370,6 @@ module ForLoop = [] let ``ForEachRangeStepUInt32_fs_RealInternalSignatureOff_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOff |> verifyCompilation @@ -398,7 +377,6 @@ module ForLoop = [] let ``ForEachRangeStepUInt32_fs_RealInternalSignatureOn_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOn |> verifyCompilation @@ -406,7 +384,6 @@ module ForLoop = [] let ``ForEachRangeStepInt64_fs_RealInternalSignatureOff_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOff |> verifyCompilation @@ -414,7 +391,6 @@ module ForLoop = [] let ``ForEachRangeStepInt64_fs_RealInternalSignatureOn_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOn |> verifyCompilation @@ -422,7 +398,6 @@ module ForLoop = [] let ``ForEachRangeStepUInt64_fs_RealInternalSignatureOff_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOff |> verifyCompilation @@ -430,7 +405,6 @@ module ForLoop = [] let ``ForEachRangeStepUInt64_fs_RealInternalSignatureOn_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOn |> verifyCompilation @@ -438,7 +412,6 @@ module ForLoop = [] let ``ForEachRangeStepIntPtr_fs_RealInternalSignatureOff_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOff |> verifyCompilation @@ -446,7 +419,6 @@ module ForLoop = [] let ``ForEachRangeStepIntPtr_fs_RealInternalSignatureOn_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOn |> verifyCompilation @@ -454,7 +426,6 @@ module ForLoop = [] let ``ForEachRangeStepUIntPtr_fs_RealInternalSignatureOff_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOff |> verifyCompilation @@ -462,7 +433,6 @@ module ForLoop = [] let ``ForEachRangeStepUIntPtr_fs_RealInternalSignatureOn_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOn |> verifyCompilation @@ -470,7 +440,6 @@ module ForLoop = [] let ``ForEachRangeStep_UnitsOfMeasure_fs_RealInternalSignatureOff_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOff |> verifyCompilation @@ -478,6 +447,5 @@ module ForLoop = [] let ``ForEachRangeStep_UnitsOfMeasure_fs_RealInternalSignatureOn_opt`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withRealInternalSignatureOn |> verifyCompilation diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoAllocationOfTuple01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoAllocationOfTuple01.fs.RealInternalSignatureOff.il.bsl index e43120841d9..6a5f1aabbdc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoAllocationOfTuple01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoAllocationOfTuple01.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoAllocationOfTuple01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoAllocationOfTuple01.fs.RealInternalSignatureOn.il.bsl index e43120841d9..6a5f1aabbdc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoAllocationOfTuple01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoAllocationOfTuple01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable01.fsx.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable01.fsx.RealInternalSignatureOff.il.bsl index 51a1fd29773..b7e3725bbda 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable01.fsx.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable01.fsx.RealInternalSignatureOff.il.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable01.fsx.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable01.fsx.RealInternalSignatureOn.il.bsl index 51a1fd29773..b7e3725bbda 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable01.fsx.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable01.fsx.RealInternalSignatureOn.il.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable02.fsx.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable02.fsx.RealInternalSignatureOff.il.bsl index 1e7f43d17e9..fb9f5d63c43 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable02.fsx.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable02.fsx.RealInternalSignatureOff.il.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable02.fsx.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable02.fsx.RealInternalSignatureOn.il.bsl index 1e7f43d17e9..fb9f5d63c43 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable02.fsx.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable02.fsx.RealInternalSignatureOn.il.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable03.fsx.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable03.fsx.RealInternalSignatureOff.il.bsl index e916dd0c946..2e9e4cb2509 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable03.fsx.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable03.fsx.RealInternalSignatureOff.il.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable03.fsx.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable03.fsx.RealInternalSignatureOn.il.bsl index e916dd0c946..2e9e4cb2509 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable03.fsx.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable03.fsx.RealInternalSignatureOn.il.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs.RealInternalSignatureOff.il.bsl index 24776ea3bce..7e035bf8d61 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs.RealInternalSignatureOff.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs.RealInternalSignatureOff.opt.il.bsl index 24776ea3bce..7e035bf8d61 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs.RealInternalSignatureOff.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs.RealInternalSignatureOff.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs.RealInternalSignatureOn.il.bsl index e8db92a48a8..fd8662b1ca5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs.RealInternalSignatureOn.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs.RealInternalSignatureOn.opt.il.bsl index e8db92a48a8..fd8662b1ca5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs.RealInternalSignatureOn.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd01.fs.RealInternalSignatureOn.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs.RealInternalSignatureOff.il.bsl index e3a8fe9afec..91f26499736 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs.RealInternalSignatureOff.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs.RealInternalSignatureOff.opt.il.bsl index e3a8fe9afec..91f26499736 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs.RealInternalSignatureOff.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs.RealInternalSignatureOff.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs.RealInternalSignatureOn.il.bsl index cfa46cc2c6d..f89292af139 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs.RealInternalSignatureOn.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs.RealInternalSignatureOn.opt.il.bsl index cfa46cc2c6d..f89292af139 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs.RealInternalSignatureOn.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd02.fs.RealInternalSignatureOn.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOff.il.bsl index f51b28f7d87..618ba09189f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOff.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOff.opt.il.bsl index f51b28f7d87..618ba09189f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOff.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOff.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOn.il.bsl index 5cab501f026..7838a9c7d69 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOn.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOn.opt.il.bsl index 5cab501f026..7838a9c7d69 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOn.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOn.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOff.il.bsl index df03b5ff533..cdb60cf3f61 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOff.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOff.opt.il.bsl index df03b5ff533..cdb60cf3f61 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOff.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOff.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOn.il.bsl index fd4946b43f2..33caf0bc8ca 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOn.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOn.opt.il.bsl index fd4946b43f2..33caf0bc8ca 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOn.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOn.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs.RealInternalSignatureOff.il.bsl index 46de1e41e75..5aca7747bda 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs.RealInternalSignatureOff.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs.RealInternalSignatureOff.opt.il.bsl index 46de1e41e75..5aca7747bda 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs.RealInternalSignatureOff.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs.RealInternalSignatureOff.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs.RealInternalSignatureOn.il.bsl index 89d1309f7bd..edd7456baca 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs.RealInternalSignatureOn.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs.RealInternalSignatureOn.opt.il.bsl index 89d1309f7bd..edd7456baca 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs.RealInternalSignatureOn.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd05.fs.RealInternalSignatureOn.opt.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength01.fs.RealInternalSignatureOff.il.bsl index 5152851ed95..1a3b630b6b2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength01.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength01.fs.RealInternalSignatureOn.il.bsl index 5152851ed95..1a3b630b6b2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength02.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength02.fs.RealInternalSignatureOff.il.bsl index e8c4e29f45d..2d7c1c580ba 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength02.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength02.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength02.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength02.fs.RealInternalSignatureOn.il.bsl index e8c4e29f45d..2d7c1c580ba 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength02.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ZeroToArrLength02.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter01.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter01.fs.il.bsl index 9cf19fe503d..be4a8b1d29f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter01.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter01.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter02.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter02.fs.il.bsl index a29c41f8c95..789fe9dce20 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter02.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter02.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter03.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter03.fs.il.bsl index 2f8d1ce09f2..61306b66972 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter03.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter03.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04_RealInternalSignatureOff.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04_RealInternalSignatureOff.fs.il.bsl index 2d319d672ea..c974e88009e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04_RealInternalSignatureOff.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04_RealInternalSignatureOff.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04_RealInternalSignatureOn.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04_RealInternalSignatureOn.fs.il.bsl index e5b5501f20d..1707b5b0d47 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04_RealInternalSignatureOn.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04_RealInternalSignatureOn.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GeneratedIterators.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GeneratedIterators.fs index 4d19bbec2f6..68899c67afe 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GeneratedIterators.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GeneratedIterators.fs @@ -10,7 +10,6 @@ module GeneratedIterators = compilation |> withOptions [ "--test:EmitFeeFeeAs100001" ] |> asExe - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> withNoOptimize |> withEmbeddedPdb |> withEmbedAllSource diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare01.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare01.fsx.il.bsl index b6b01d9c6d1..3913db84457 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare01.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare01.fsx.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare02.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare02.fsx.il.bsl index f9cb812887a..94f15024467 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare02.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare02.fsx.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare03.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare03.fsx.il.net472.bsl index 11264f44838..373685eab03 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare03.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare03.fsx.il.net472.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare03.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare03.fsx.il.netcore.bsl index 4176d1d07b3..913bf36adc0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare03.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare03.fsx.il.netcore.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare04.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare04.fsx.il.net472.bsl index bff2ea750e9..36458108dd1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare04.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare04.fsx.il.net472.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare04.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare04.fsx.il.netcore.bsl index 507a3763335..3f6edd9a68f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare04.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare04.fsx.il.netcore.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare05.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare05.fsx.il.net472.bsl index 94d2248f41d..b609406b99b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare05.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare05.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare05.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare05.fsx.il.netcore.bsl index 7bec8718abe..707be53aac1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare05.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare05.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare06.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare06.fsx.il.net472.bsl index cbc961228a9..93e582b122a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare06.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare06.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare06.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare06.fsx.il.netcore.bsl index 7a21dfe1de9..fc73dd8cb94 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare06.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare06.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare07.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare07.fsx.il.net472.bsl index 4b9776f8498..2288ebe1151 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare07.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare07.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare07.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare07.fsx.il.netcore.bsl index 4a39f6a8f74..3505525e863 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare07.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare07.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare08.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare08.fsx.il.bsl index 5ad3388f883..c830dd29b01 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare08.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare08.fsx.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare09.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare09.fsx.il.bsl index 261d118d9a9..58f582a2572 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare09.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare09.fsx.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare10.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare10.fsx.il.net472.bsl index 54f7673a0af..4f2bb265b9c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare10.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare10.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare10.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare10.fsx.il.netcore.bsl index 4fa9495ce46..090421dd788 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare10.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare10.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare11.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare11.fsx.il.bsl index 08ad81885b6..52c6e05a56c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare11.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare11.fsx.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/CrossAssembly.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/CrossAssembly.fs index 8e2cd0853c0..d3a9e06a113 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/CrossAssembly.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/CrossAssembly.fs @@ -7,87 +7,236 @@ open FSharp.Test.Compiler module GenericComparisonCrossAssembly = - [] - let ``fslib``() = + [] // RealSig + [] // Regular + [] + let ``fslib``(realsig) = FSharpWithFileName "Program.fs" """ ValueSome (1, 2) = ValueSome (2, 3) |> ignore""" + |> withRealInternalSignature realsig |> withOptimize |> compileExeAndRun |> shouldSucceed |> verifyIL [ """ - .method assembly specialname static void staticInitialization@() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.1 - IL_0001: ldc.i4.2 - IL_0002: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_0007: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1>::NewValueSome(!0) - IL_000c: stsfld valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1> Program::x@1 - IL_0011: ldc.i4.2 - IL_0012: ldc.i4.3 - IL_0013: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_0018: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1>::NewValueSome(!0) - IL_001d: stsfld valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1> Program::y@1 - IL_0022: ldsflda valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1> Program::x@1 - IL_0027: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1> Program::get_y@1() IL_002c: call class [runtime]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() IL_0031: call instance bool valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1>::Equals(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1, - class [runtime]System.Collections.IEqualityComparer) - IL_0036: stsfld bool Program::arg@1 - IL_003b: ret - } """ ] - [] - let ``Another assembly``() = - let module1 = + [] // RealSig + [] // Regular + [] + let ``Another Assembly - record with private fields`` (realsig) = + let library = FSharpWithFileName "Module1.fs" """ module Module1 - [] - type Struct(v: int, u: int) = - member _.V = v - member _.U = u """ +type Value = + private { value: uint32 } + + static member Zero = { value = 0u } + static member Create(value: int) = { value = uint value } """ + |> withRealInternalSignature realsig |> withOptimize |> asLibrary |> withName "module1" - let module2 = + let mainModule = FSharpWithFileName "Program.fs" - """ -Module1.Struct(1, 2) = Module1.Struct(2, 3) |> ignore""" + $""" +open Module1 +Value.Zero = Value.Create 0 |> ignore""" - module2 - |> withReferences [module1] + mainModule + |> withRealInternalSignature realsig + |> withReferences [ library ] + |> compileExeAndRun + |> shouldSucceed + + [] // Legacy, private WrapType, assembly visibility in IL + [] // RealSig, internal WrapType, assembly visibility in IL + [] // Legacy, public WrapType, public visibility in IL + [] // RealSig, private WrapType, public visibility in IL + [] // RealSig, internal WrapType, public visibility in IL + [] // RealSig, public WrapType, public visibility in IL + [] + let ``Generated typed Equals`` (realsig, typeScope, targetVisibility) = + let library = + FSharpWithFileName "Program.fs" + $""" +module Module1 = + + [] + type {typeScope} Struct(v: int, u: int) = + member _.V = v + member _.U = u""" + + library + |> asExe + |> withNoWarn 988 + |> withRealInternalSignature realsig |> withOptimize + |> compile + |> shouldSucceed + |> verifyIL [ + $""" + .method {targetVisibility} hidebysig instance bool Equals(valuetype Program/Module1/Struct obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed + {{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 Program/Module1/Struct::v + IL_0006: ldarga.s obj + IL_0008: ldfld int32 Program/Module1/Struct::v + IL_000d: bne.un.s IL_001f + + IL_000f: ldarg.0 + IL_0010: ldfld int32 Program/Module1/Struct::u + IL_0015: ldarga.s obj + IL_0017: ldfld int32 Program/Module1/Struct::u + IL_001c: ceq + IL_001e: ret + + IL_001f: ldc.i4.0 + IL_0020: ret + }} """ ] + + + [] // Legacy, private WrapType + [] // RealSig, internal WrapType + [] // Legacy, public WrapType + [] // RealSig, private WrapType + [] // RealSig, internal WrapType + [] // RealSig, public WrapType + [] + let ``Record with various scoped fields`` (realsig, fieldScope) = + + let mainModule = + FSharpWithFileName "Program.fs" + $$""" +module Module1 = + type Value = + {{fieldScope}} { value: uint32 } + + static member Zero = { value = 0u } + static member Create(value: int) = { value = uint value } + + Value.Zero = Value.Create 0 |> ignore + printfn "Hello, World" """ + + mainModule + |> withRealInternalSignature realsig |> compileExeAndRun |> shouldSucceed - |> verifyIL [ """ - .method assembly specialname static void staticInitialization@() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.1 - IL_0001: ldc.i4.2 - IL_0002: newobj instance void [module1]Module1/Struct::.ctor(int32, - int32) - IL_0007: stsfld valuetype [module1]Module1/Struct Program::x@1 - IL_000c: ldc.i4.2 - IL_000d: ldc.i4.3 - IL_000e: newobj instance void [module1]Module1/Struct::.ctor(int32, - int32) - IL_0013: stsfld valuetype [module1]Module1/Struct Program::y@1 - IL_0018: ldsflda valuetype [module1]Module1/Struct Program::x@1 - IL_001d: call valuetype [module1]Module1/Struct Program::get_y@1() - IL_0022: call class [runtime]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() - IL_0027: call instance bool [module1]Module1/Struct::Equals(valuetype [module1]Module1/Struct, - class [runtime]System.Collections.IEqualityComparer) - IL_002c: stsfld bool Program::arg@1 - IL_0031: ret - } -""" ] + |> verifyIL [ + """ + .method public hidebysig instance bool Equals(class Program/Module1/Value obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0017 + + IL_0003: ldarg.1 + IL_0004: brfalse.s IL_0015 + + IL_0006: ldarg.0 + IL_0007: ldfld uint32 Program/Module1/Value::value@ + IL_000c: ldarg.1 + IL_000d: ldfld uint32 Program/Module1/Value::value@ + IL_0012: ceq + IL_0014: ret + + IL_0015: ldc.i4.0 + IL_0016: ret + + IL_0017: ldarg.1 + IL_0018: ldnull + IL_0019: cgt.un + IL_001b: ldc.i4.0 + IL_001c: ceq + IL_001e: ret + } """ ] + + + [] // public module - Legacy, private WrapType, private visibility in IL + [] // public module - RealSig, internal WrapType, assembly visibility in IL + [] // public module - Legacy, public WrapType, public visibility in IL + [] // public module - RealSig, private WrapType, public visibility in IL + [] // public module - RealSig, internal WrapType, public visibility in IL + [] // public module - RealSig, public WrapType, public visibility in IL + [] // private module - Legacy, private WrapType, private visibility in IL + [] // private module - RealSig, internal WrapType, assembly visibility in IL + [] // private module - Legacy, public WrapType, assembly visibility in IL + [] // private module - RealSig, private WrapType, public visibility in IL + [] // private module - RealSig, internal WrapType, public visibility in IL + [] // private module - RealSig, public WrapType, public visibility in IL + [] + let ``scoped main and scoped type Equals`` (realsig, moduleScope, argScope, targetVisibility) = + let mainModule = + FSharpWithFileName "Program.fs" + $""" +module {moduleScope} IPartialEqualityComparer = + open System.Collections.Generic + + [] + type {argScope} WrapType<'T> = Wrap of 'T +""" + mainModule + |> asExe + |> withNoWarn 988 + |> withRealInternalSignature realsig + |> withOptimize + |> compile + |> shouldSucceed + |> verifyIL [ + $""" + .method {targetVisibility} hidebysig instance bool Equals(class Program/IPartialEqualityComparer/WrapType`1 obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed + {{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (class Program/IPartialEqualityComparer/WrapType`1 V_0, + class Program/IPartialEqualityComparer/WrapType`1 V_1, + !T V_2, + !T V_3) + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0027 + + IL_0003: ldarg.1 + IL_0004: brfalse.s IL_0025 + + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ldarg.0 + IL_0009: stloc.0 + IL_000a: ldarg.1 + IL_000b: stloc.1 + IL_000c: ldloc.0 + IL_000d: ldfld !0 class Program/IPartialEqualityComparer/WrapType`1::item + IL_0012: stloc.2 + IL_0013: ldloc.1 + IL_0014: ldfld !0 class Program/IPartialEqualityComparer/WrapType`1::item + IL_0019: stloc.3 + IL_001a: ldarg.2 + IL_001b: ldloc.2 + IL_001c: ldloc.3 + IL_001d: tail. + IL_001f: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityWithComparerIntrinsic(class [runtime]System.Collections.IEqualityComparer, + !!0, + !!0) + IL_0024: ret + + IL_0025: ldc.i4.0 + IL_0026: ret + + IL_0027: ldarg.1 + IL_0028: ldnull + IL_0029: cgt.un + IL_002b: ldc.i4.0 + IL_002c: ceq + IL_002e: ret + }} """ ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals01.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals01.fsx.il.bsl index 7c81ed42650..6c3f960abca 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals01.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals01.fsx.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals02.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals02.fsx.il.net472.bsl index fdf9efdbe03..bb5c001d726 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals02.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals02.fsx.il.net472.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals02.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals02.fsx.il.netcore.bsl index 4d808cc21b4..51ec1c8af56 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals02.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals02.fsx.il.netcore.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals03.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals03.fsx.il.net472.bsl index c400481e088..66d03ec92a2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals03.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals03.fsx.il.net472.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals03.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals03.fsx.il.netcore.bsl index f98e966d4d5..9f855d30123 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals03.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals03.fsx.il.netcore.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals04.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals04.fsx.il.net472.bsl index 714867efeec..f2b1f11fbb2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals04.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals04.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals04.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals04.fsx.il.netcore.bsl index 1709df973c0..e2ff9bad489 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals04.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals04.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals05.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals05.fsx.il.net472.bsl index 156762ff882..a39724e32f4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals05.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals05.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals05.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals05.fsx.il.netcore.bsl index 541cea12575..da6842c973d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals05.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals05.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals06.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals06.fsx.il.net472.bsl index ce1a61427bc..b2de9256d60 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals06.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals06.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals06.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals06.fsx.il.netcore.bsl index c99e852841e..389535ea7ea 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals06.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals06.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals07.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals07.fsx.il.bsl index 9e7afe0aa8c..2fe61137837 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals07.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals07.fsx.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals08.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals08.fsx.il.bsl index 02acab4575c..4b5d9fbae9c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals08.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals08.fsx.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals09.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals09.fsx.il.net472.bsl index f7d11d90f47..c12162b533a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals09.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals09.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals09.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals09.fsx.il.netcore.bsl index 9d131774ce5..1b90b618416 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals09.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals09.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals10.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals10.fsx.il.net472.bsl index dcc4056f339..ffc92edb6e3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals10.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals10.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals10.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals10.fsx.il.netcore.bsl index dcc4056f339..ffc92edb6e3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals10.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals10.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals11.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals11.fsx.il.net472.bsl index 45751887444..d69c5d52763 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals11.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals11.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals11.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals11.fsx.il.netcore.bsl index 8d1119b95e0..8746e1f030b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals11.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals11.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals12.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals12.fsx.il.net472.bsl index 0d5ee1ea01d..e1ce5e4142f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals12.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals12.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals12.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals12.fsx.il.netcore.bsl index efeb042ab2a..954fb2bf26f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals12.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals12.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals13.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals13.fsx.il.net472.bsl index 5a302fdd346..2599a099d66 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals13.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals13.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals13.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals13.fsx.il.netcore.bsl index 5a302fdd346..2599a099d66 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals13.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals13.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals14.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals14.fsx.il.net472.bsl index c41041fd222..89d8868be0b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals14.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals14.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals14.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals14.fsx.il.netcore.bsl index 3985dc4c3c0..6fb20c23f54 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals14.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals14.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals15.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals15.fsx.il.net472.bsl index b856c150e82..22b2128902d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals15.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals15.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals15.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals15.fsx.il.netcore.bsl index 6b2065dd75c..026f078e149 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals15.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals15.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.net472.bsl index be3fd3e5662..c9ea94af41c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { @@ -128,9 +128,7 @@ IL_000c: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [runtime]System.Collections.IComparer comp) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -235,9 +233,7 @@ IL_000b: ret } - .method assembly hidebysig instance bool - Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeStruct obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig instance bool Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeStruct obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -259,9 +255,7 @@ IL_0020: ret } - .method public hidebysig virtual final - instance bool Equals(object obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -285,9 +279,7 @@ IL_0019: ret } - .method public specialname rtspecialname - instance void .ctor(int32 v, - int32 u) cil managed + .method public specialname rtspecialname instance void .ctor(int32 v, int32 u) cil managed { .maxstack 8 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.netcore.bsl index be3fd3e5662..c9ea94af41c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { @@ -128,9 +128,7 @@ IL_000c: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [runtime]System.Collections.IComparer comp) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -235,9 +233,7 @@ IL_000b: ret } - .method assembly hidebysig instance bool - Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeStruct obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig instance bool Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeStruct obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -259,9 +255,7 @@ IL_0020: ret } - .method public hidebysig virtual final - instance bool Equals(object obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -285,9 +279,7 @@ IL_0019: ret } - .method public specialname rtspecialname - instance void .ctor(int32 v, - int32 u) cil managed + .method public specialname rtspecialname instance void .ctor(int32 v, int32 u) cil managed { .maxstack 8 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.net472.bsl index 1bfb13e46ab..103177fa29d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { @@ -67,9 +67,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly static valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion - NewSomeUnion(int32 item1, - int32 item2) cil managed + .method assembly static valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion NewSomeUnion(int32 item1, int32 item2) cil managed { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) @@ -222,9 +220,7 @@ IL_000c: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [runtime]System.Collections.IComparer comp) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -335,9 +331,7 @@ IL_000b: ret } - .method assembly hidebysig instance bool - Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig instance bool Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -361,9 +355,7 @@ IL_0022: ret } - .method public hidebysig virtual final - instance bool Equals(object obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.netcore.bsl index 4387b3cb60f..9ce8662fe2d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { @@ -67,9 +67,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly static valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion - NewSomeUnion(int32 item1, - int32 item2) cil managed + .method assembly static valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion NewSomeUnion(int32 item1, int32 item2) cil managed { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) @@ -222,9 +220,7 @@ IL_000c: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [runtime]System.Collections.IComparer comp) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -335,9 +331,7 @@ IL_000b: ret } - .method assembly hidebysig instance bool - Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig instance bool Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -361,9 +355,7 @@ IL_0022: ret } - .method public hidebysig virtual final - instance bool Equals(object obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.net472.bsl index 26f5a4f110f..764dc4b16ff 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { @@ -87,9 +87,7 @@ IL_0006: ret } - .method assembly specialname rtspecialname - instance void .ctor(int32 v, - int32 u) cil managed + .method assembly specialname rtspecialname instance void .ctor(int32 v, int32 u) cil managed { .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, class [runtime]System.Type) = ( 01 00 60 06 00 00 39 45 71 75 61 6C 73 31 38 2B @@ -191,9 +189,7 @@ IL_000c: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [runtime]System.Collections.IComparer comp) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -298,9 +294,7 @@ IL_000b: ret } - .method assembly hidebysig instance bool - Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeRecord obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig instance bool Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeRecord obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -322,9 +316,7 @@ IL_0020: ret } - .method public hidebysig virtual final - instance bool Equals(object obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -560,9 +552,7 @@ .field private class [runtime]System.Type Type@ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method public specialname rtspecialname - instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, - class [runtime]System.Type Type) cil managed + .method public specialname rtspecialname instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, class [runtime]System.Type Type) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.netcore.bsl index 1247f45339f..9685857b26f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { @@ -87,9 +87,7 @@ IL_0006: ret } - .method assembly specialname rtspecialname - instance void .ctor(int32 v, - int32 u) cil managed + .method assembly specialname rtspecialname instance void .ctor(int32 v, int32 u) cil managed { .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, class [runtime]System.Type) = ( 01 00 60 06 00 00 39 45 71 75 61 6C 73 31 38 2B @@ -191,9 +189,7 @@ IL_000c: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [runtime]System.Collections.IComparer comp) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -298,9 +294,7 @@ IL_000b: ret } - .method assembly hidebysig instance bool - Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeRecord obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig instance bool Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeRecord obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -322,9 +316,7 @@ IL_0020: ret } - .method public hidebysig virtual final - instance bool Equals(object obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals19.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals19.fsx.il.net472.bsl index c6b642fadb4..4e835e5a4ff 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals19.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals19.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals19.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals19.fsx.il.netcore.bsl index c6b642fadb4..4e835e5a4ff 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals19.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals19.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals20.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals20.fsx.il.net472.bsl index 90cdef2e560..2bd42667f2f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals20.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals20.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals20.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals20.fsx.il.netcore.bsl index b8cf1279638..a8cc642d0e6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals20.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals20.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals21.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals21.fsx.il.net472.bsl index f3e0d0a102c..8b1d3250251 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals21.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals21.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals21.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals21.fsx.il.netcore.bsl index 9a77fbca0db..1fe2b83c557 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals21.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals21.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/GenericComparison.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/GenericComparison.fs index 2fd53e46b56..2fc23ad345b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/GenericComparison.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/GenericComparison.fs @@ -62,14 +62,12 @@ module GenericComparison = [] let ``Compare08_fsx`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=Compare09.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Compare09.dll" # Compare09.fs [] let ``Compare09_fsx`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=Compare10.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Compare10.dll" # Compare10.fs - @@ -85,7 +83,6 @@ module GenericComparison = |> verifyCompilation - // SOURCE=Hash01.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Hash01.dll" # Hash01.fs - [] let ``Hash01_fsx`` compilation = @@ -144,14 +141,12 @@ module GenericComparison = [] let ``Hash10_fsx`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=Hash11.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Hash11.dll" # Hash11.fs [] let ``Hash11_fsx`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=Hash12.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Hash12.dll" # Hash12.fs - @@ -201,14 +196,12 @@ module GenericComparison = [] let ``Equals07_fsx`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=Equals08.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Equals08.dll" # Equals08.fs - [] let ``Equals08_fsx`` compilation = compilation - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=Equals09.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Equals09.dll" # Equals09.fs - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash01.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash01.fsx.il.bsl index 9664f691426..59c5e9e24b6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash01.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash01.fsx.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash02.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash02.fsx.il.bsl index ad955df8ad5..40ff6072605 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash02.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash02.fsx.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash03.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash03.fsx.il.net472.bsl index 08627cf007b..e68f01bf371 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash03.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash03.fsx.il.net472.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash03.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash03.fsx.il.netcore.bsl index 3ef5fe9c46e..b9022d6ab12 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash03.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash03.fsx.il.netcore.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash04.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash04.fsx.il.net472.bsl index 460da3dcead..27e044ea6e8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash04.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash04.fsx.il.net472.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash04.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash04.fsx.il.netcore.bsl index 80b371863ed..66e8a4f11b5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash04.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash04.fsx.il.netcore.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash05.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash05.fsx.il.net472.bsl index 9048754efb6..fbed648ba1e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash05.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash05.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash05.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash05.fsx.il.netcore.bsl index 48ddbd835a0..de3253d68d9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash05.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash05.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash06.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash06.fsx.il.net472.bsl index 7f34d3acc25..f6a93e6fd6d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash06.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash06.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash06.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash06.fsx.il.netcore.bsl index d418c4eb8b9..7b7a4aa26b8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash06.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash06.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash07.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash07.fsx.il.bsl index bffd3345d93..c8473521a13 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash07.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash07.fsx.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash08.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash08.fsx.il.net472.bsl index 35f4388456c..46adaeb4644 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash08.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash08.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash08.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash08.fsx.il.netcore.bsl index 69b5eb439e3..e78fc57672f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash08.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash08.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash09.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash09.fsx.il.net472.bsl index c528cc22265..ff6c96ff250 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash09.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash09.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash09.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash09.fsx.il.netcore.bsl index 87f99b0aadb..e65a2911b30 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash09.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash09.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash09.fsx.ilnetcore..bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash09.fsx.ilnetcore..bsl index de3fbebc919..a780eb870e1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash09.fsx.ilnetcore..bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash09.fsx.ilnetcore..bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash10.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash10.fsx.il.bsl index 0ad4e24c843..8481b972c36 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash10.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash10.fsx.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash11.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash11.fsx.il.bsl index 5e8ba8dc8f5..0a496ffefa6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash11.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash11.fsx.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash12.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash12.fsx.il.net472.bsl index 2261ab4a99b..cd9728b029c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash12.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash12.fsx.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash12.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash12.fsx.il.netcore.bsl index 22b90a91f66..500d3a52a64 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash12.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash12.fsx.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison01.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison01.fs.il.bsl index 37257148866..d2c9a372a20 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison01.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison01.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison02.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison02.fs.il.bsl index 9248e05e080..55cd60ce902 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison02.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison02.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison03.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison03.fs.il.bsl index d3b34e6c547..641b22834cc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison03.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison03.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison04.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison04.fs.il.bsl index 25282adbd22..1d8a9b4150f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison04.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison04.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison05.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison05.fs.il.bsl index 92788105ada..1f825794b07 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison05.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/InequalityComparison/InequalityComparison05.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOff.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOff.fs.il.net472.debug.bsl index 4290182d0b2..f4fb003898f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOff.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOff.fs.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOff.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOff.fs.il.net472.release.bsl index b27892bf2cc..dccb51d00c9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOff.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOff.fs.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOff.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOff.fs.il.netcore.debug.bsl index 63132d87f56..11e87693f4b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOff.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOff.fs.il.netcore.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOff.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOff.fs.il.netcore.release.bsl index 0aa8981d0d2..b5b5eadeba3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOff.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOff.fs.il.netcore.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.debug.bsl index 71cdaa19ccd..71ae86abc63 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.release.bsl index d4e0866201a..eee45015b20 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.netcore.debug.bsl index 0aeed02c185..8446cbbc13c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.netcore.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.netcore.release.bsl index 7fa8bb17c28..35068784455 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.netcore.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match02.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match02.fs.il.bsl index 65e35da9d3b..87c89f5f3fb 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match02.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match02.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.net472.bsl index c477b957959..383e66d0ce8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.netcore.bsl index cac209d4dee..7d53086cb75 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping.fs index 78c95d80d00..abdc6368d11 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping.fs @@ -35,7 +35,6 @@ module ListExpressionStepping = let ``ListExpressionStepping02_RealInternalSignatureOn_fs`` compilation = compilation |> withRealInternalSignatureOn - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=ListExpressionSteppingTest2.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ListExpressionSteppingTest2.exe" # ListExpressionSteppingTest2.fs - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping01.fs.RealInternalSignatureOff.il.bsl index 4fae3b4d201..54839fb81bc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping01.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping01.fs.RealInternalSignatureOn.il.bsl index 379732c096d..f8abc02f579 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.RealInternalSignatureOff.il.bsl index 4fdb1c34a07..ae059f40846 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.RealInternalSignatureOff.il.bsl @@ -16,16 +16,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -79,7 +69,7 @@ IL_0010: ldc.i4.1 IL_0011: add IL_0012: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) + !1) IL_0017: ret } @@ -126,7 +116,7 @@ IL_0010: ldc.i4.1 IL_0011: add IL_0012: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) + !1) IL_0017: ret } @@ -178,8 +168,8 @@ IL_0018: add IL_0019: ldloc.2 IL_001a: newobj instance void class [runtime]System.Tuple`3::.ctor(!0, - !1, - !2) + !1, + !2) IL_001f: ret } @@ -231,8 +221,8 @@ IL_0018: add IL_0019: ldloc.2 IL_001a: newobj instance void class [runtime]System.Tuple`3::.ctor(!0, - !1, - !2) + !1, + !2) IL_001f: ret } @@ -281,14 +271,23 @@ .locals init (class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_2, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_3, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_4, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_5, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_6, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_7, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_8, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_9, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_10) + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_3, + uint64 V_4, + int32 V_5, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_6, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_7, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_8, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_9, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_10, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_11, + uint64 V_12, + int32 V_13, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_14, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_15, + uint64 V_16, + int32 V_17, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_18, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_19) IL_0000: ldarg.0 IL_0001: ldarg.0 IL_0002: ldarg.0 @@ -301,80 +300,137 @@ class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) IL_0017: stloc.1 IL_0018: ldc.i4.0 - IL_0019: ldc.i4.1 - IL_001a: ldc.i4.2 - IL_001b: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0020: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0025: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_002a: stloc.2 - IL_002b: ldloc.1 - IL_002c: ldloc.2 - IL_002d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Zip(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0032: stloc.3 - IL_0033: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 stage #2 at line 18@18' class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 stage #2 at line 18@18'::@_instance - IL_0038: ldloc.3 - IL_0039: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_003e: stloc.s V_4 - IL_0040: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs1@19 class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs1@19::@_instance - IL_0045: ldloc.s V_4 - IL_0047: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_004c: stloc.0 - IL_004d: ldarg.0 - IL_004e: ldarg.0 - IL_004f: ldarg.0 - IL_0050: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() - IL_0055: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0019: conv.i8 + IL_001a: stloc.s V_4 + IL_001c: ldc.i4.0 + IL_001d: stloc.s V_5 + IL_001f: br.s IL_0038 + + IL_0021: ldloca.s V_3 + IL_0023: ldloc.s V_5 + IL_0025: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_002a: nop + IL_002b: ldloc.s V_5 + IL_002d: ldc.i4.1 + IL_002e: add + IL_002f: stloc.s V_5 + IL_0031: ldloc.s V_4 + IL_0033: ldc.i4.1 + IL_0034: conv.i8 + IL_0035: add + IL_0036: stloc.s V_4 + IL_0038: ldloc.s V_4 + IL_003a: ldc.i4.3 + IL_003b: conv.i8 + IL_003c: blt.un.s IL_0021 + + IL_003e: ldloca.s V_3 + IL_0040: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0045: stloc.2 + IL_0046: ldloc.1 + IL_0047: ldloc.2 + IL_0048: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Zip(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_004d: stloc.s V_6 + IL_004f: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 stage #2 at line 18@18' class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 stage #2 at line 18@18'::@_instance + IL_0054: ldloc.s V_6 + IL_0056: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_005b: stloc.s V_7 + IL_005d: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs1@19 class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs1@19::@_instance + IL_0062: ldloc.s V_7 + IL_0064: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_0069: stloc.0 + IL_006a: ldarg.0 + IL_006b: ldarg.0 + IL_006c: ldarg.0 + IL_006d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0072: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_005a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0077: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_005f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_007c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0064: stloc.s V_6 - IL_0066: ldc.i4.0 - IL_0067: ldc.i4.1 - IL_0068: ldc.i4.2 - IL_0069: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_006e: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0073: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0078: stloc.s V_7 - IL_007a: ldc.i4.0 - IL_007b: ldc.i4.1 - IL_007c: ldc.i4.2 - IL_007d: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0082: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0087: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_008c: stloc.s V_8 - IL_008e: ldloc.s V_6 - IL_0090: ldloc.s V_7 - IL_0092: ldloc.s V_8 - IL_0094: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Zip3(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0099: stloc.s V_9 - IL_009b: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 stage #2 at line 24@24' class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 stage #2 at line 24@24'::@_instance - IL_00a0: ldloc.s V_9 - IL_00a2: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`3>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_00a7: stloc.s V_10 - IL_00a9: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs2@25 class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs2@25::@_instance - IL_00ae: ldloc.s V_10 - IL_00b0: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`3>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_00b5: stloc.s V_5 - IL_00b7: ldloc.0 - IL_00b8: ldloc.s V_5 - IL_00ba: newobj instance void class [runtime]System.Tuple`2>,class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::.ctor(!0, - !1) - IL_00bf: ret + IL_0081: stloc.s V_9 + IL_0083: ldc.i4.0 + IL_0084: conv.i8 + IL_0085: stloc.s V_12 + IL_0087: ldc.i4.0 + IL_0088: stloc.s V_13 + IL_008a: br.s IL_00a3 + + IL_008c: ldloca.s V_11 + IL_008e: ldloc.s V_13 + IL_0090: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0095: nop + IL_0096: ldloc.s V_13 + IL_0098: ldc.i4.1 + IL_0099: add + IL_009a: stloc.s V_13 + IL_009c: ldloc.s V_12 + IL_009e: ldc.i4.1 + IL_009f: conv.i8 + IL_00a0: add + IL_00a1: stloc.s V_12 + IL_00a3: ldloc.s V_12 + IL_00a5: ldc.i4.3 + IL_00a6: conv.i8 + IL_00a7: blt.un.s IL_008c + + IL_00a9: ldloca.s V_11 + IL_00ab: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_00b0: stloc.s V_10 + IL_00b2: ldc.i4.0 + IL_00b3: conv.i8 + IL_00b4: stloc.s V_16 + IL_00b6: ldc.i4.0 + IL_00b7: stloc.s V_17 + IL_00b9: br.s IL_00d2 + + IL_00bb: ldloca.s V_15 + IL_00bd: ldloc.s V_17 + IL_00bf: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_00c4: nop + IL_00c5: ldloc.s V_17 + IL_00c7: ldc.i4.1 + IL_00c8: add + IL_00c9: stloc.s V_17 + IL_00cb: ldloc.s V_16 + IL_00cd: ldc.i4.1 + IL_00ce: conv.i8 + IL_00cf: add + IL_00d0: stloc.s V_16 + IL_00d2: ldloc.s V_16 + IL_00d4: ldc.i4.3 + IL_00d5: conv.i8 + IL_00d6: blt.un.s IL_00bb + + IL_00d8: ldloca.s V_15 + IL_00da: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_00df: stloc.s V_14 + IL_00e1: ldloc.s V_9 + IL_00e3: ldloc.s V_10 + IL_00e5: ldloc.s V_14 + IL_00e7: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Zip3(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_00ec: stloc.s V_18 + IL_00ee: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 stage #2 at line 24@24' class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 stage #2 at line 24@24'::@_instance + IL_00f3: ldloc.s V_18 + IL_00f5: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`3>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_00fa: stloc.s V_19 + IL_00fc: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs2@25 class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs2@25::@_instance + IL_0101: ldloc.s V_19 + IL_0103: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`3>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_0108: stloc.s V_8 + IL_010a: ldloc.0 + IL_010b: ldloc.s V_8 + IL_010d: newobj instance void class [runtime]System.Tuple`2>,class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::.ctor(!0, + !1) + IL_0112: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.RealInternalSignatureOn.il.bsl index 5e88a197fcd..b982f53ca15 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping03.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping03.fs.RealInternalSignatureOff.il.bsl index 712534fde58..70a5d9c8ef4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping03.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping03.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping03.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping03.fs.RealInternalSignatureOn.il.bsl index c1a7dfe6890..771b817e091 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping03.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping03.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping04.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping04.fs.RealInternalSignatureOff.il.bsl index 23091841754..dc563d5c16e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping04.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping04.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping04.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping04.fs.RealInternalSignatureOn.il.bsl index cc32818bad8..954b9f16d20 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping04.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping04.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping05.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping05.fs.RealInternalSignatureOff.il.bsl index aff1379ec92..3cb3123097e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping05.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping05.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping05.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping05.fs.RealInternalSignatureOn.il.bsl index 7ceba50a9c1..4fa59469073 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping05.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping05.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping06.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping06.fs.RealInternalSignatureOff.il.bsl index 430a8ed5636..4814da63aac 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping06.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping06.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping06.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping06.fs.RealInternalSignatureOn.il.bsl index c3bfc328598..f45fe74c5a0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping06.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping06.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.AggressiveInlining.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.AggressiveInlining.fs.il.bsl index fee9998cd82..9aaa95117d6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.AggressiveInlining.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.AggressiveInlining.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.ForwardRef.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.ForwardRef.fs.il.bsl index 120717ceffe..d0acbf0c50b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.ForwardRef.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.ForwardRef.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.InternalCall.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.InternalCall.fs.il.bsl index 33a070fd1ec..b1bba4e3609 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.InternalCall.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.InternalCall.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoInlining.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoInlining.fs.il.bsl index 4460a40a1fb..afeb0efc7da 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoInlining.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoInlining.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoOptimization.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoOptimization.fs.il.bsl index fc993a23ef0..4387c63b663 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoOptimization.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoOptimization.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.PreserveSig.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.PreserveSig.fs.il.bsl index ce0a7e8c5df..903a5ed6368 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.PreserveSig.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.PreserveSig.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.Synchronized.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.Synchronized.fs.il.bsl index 37889246acc..4011091ca71 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.Synchronized.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.Synchronized.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.Unmanaged.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.Unmanaged.fs.il.bsl index 37e61c07e0e..f022aef9b36 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.Unmanaged.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.Unmanaged.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.fs index a13fee6baaf..bc83b54da00 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.fs @@ -39,7 +39,7 @@ module MethodImplAttribute = compilation |> withLangVersion80 |> typecheck - |> withSingleDiagnostic (Warning 3151, Line 2, Col 1, Line 3, Col 38, "This member, function or value declaration may not be declared 'inline'") + |> withSingleDiagnostic (Warning 3151, Line 3, Col 12, Line 3, Col 19, "This member, function or value declaration may not be declared 'inline'") [] let ``NoInlining_fs with inline keyword => should not warn in F# 7 or older`` compilation = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AbstractClass.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AbstractClass.fs.RealInternalSignatureOff.il.bsl index 1cd7e85831a..e1b5805aeb1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AbstractClass.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AbstractClass.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AbstractClass.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AbstractClass.fs.RealInternalSignatureOn.il.bsl index ea37f2ffd74..7dd61075cd6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AbstractClass.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AbstractClass.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs.il.net472.bsl index 4a8946abbed..09ecb30cd8a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs.il.netcore.bsl index 9d2348f0763..c2b4e8854a0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ArgumentNamesInClosures01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ArgumentNamesInClosures01.fs.RealInternalSignatureOff.il.bsl index dc754e79d0c..26a04d7af5f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ArgumentNamesInClosures01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ArgumentNamesInClosures01.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ArgumentNamesInClosures01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ArgumentNamesInClosures01.fs.RealInternalSignatureOn.il.bsl index ff66db531a8..8fb94867c0c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ArgumentNamesInClosures01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ArgumentNamesInClosures01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOff.il.bsl index 045bd18ffe7..3502e1e886d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOff.il.bsl @@ -16,16 +16,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -103,7 +93,7 @@ IL_002d: ldc.i4.1 IL_002e: ldc.i4.1 IL_002f: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) + !1) IL_0034: stfld class [runtime]System.Tuple`2 assembly/seq1@9::current IL_0039: ldc.i4.1 IL_003a: ret @@ -115,7 +105,7 @@ IL_0043: ldc.i4.2 IL_0044: ldc.i4.2 IL_0045: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) + !1) IL_004a: stfld class [runtime]System.Tuple`2 assembly/seq1@9::current IL_004f: ldc.i4.1 IL_0050: ret @@ -397,269 +387,291 @@ int32[0...,0...,0...,0...] V_8, int32[] V_9, int32[] V_10, - int32 V_11, - class [runtime]System.Tuple`4 V_12, - class [runtime]System.Tuple`4 V_13, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_11, + uint64 V_12, + int32 V_13, int32 V_14, - class [runtime]System.Tuple`3 V_15, - class [runtime]System.Tuple`3 V_16, + class [runtime]System.Tuple`4 V_15, + class [runtime]System.Tuple`4 V_16, int32 V_17, - class [runtime]System.Tuple`4 V_18, - class [runtime]System.Tuple`4 V_19, - int32 V_20) - IL_0000: ldc.i4.1 - IL_0001: ldc.i4.1 - IL_0002: ldc.i4.s 10 - IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0009: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_000e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0013: dup - IL_0014: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$assembly::alist@5 - IL_0019: stloc.0 - IL_001a: ldc.i4.3 - IL_001b: newarr [runtime]System.Int32 - IL_0020: dup - IL_0021: ldc.i4.0 - IL_0022: ldc.i4.1 - IL_0023: stelem [runtime]System.Int32 - IL_0028: dup - IL_0029: ldc.i4.1 - IL_002a: ldc.i4.2 - IL_002b: stelem [runtime]System.Int32 - IL_0030: dup - IL_0031: ldc.i4.2 - IL_0032: ldc.i4.3 - IL_0033: stelem [runtime]System.Int32 - IL_0038: dup - IL_0039: stsfld int32[] ''.$assembly::array@6 - IL_003e: stloc.1 - IL_003f: ldc.i4.1 - IL_0040: ldc.i4.1 - IL_0041: ldc.i4.s 10 - IL_0043: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0048: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_004d: dup - IL_004e: stsfld class [runtime]System.Collections.Generic.IEnumerable`1 ''.$assembly::aseq@7 - IL_0053: stloc.2 - IL_0054: ldc.i4.1 - IL_0055: ldc.i4.1 - IL_0056: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_005b: ldc.i4.2 - IL_005c: ldc.i4.2 - IL_005d: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_0062: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>::get_Empty() - IL_0067: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>::Cons(!0, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_006c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>::Cons(!0, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0071: dup - IL_0072: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> ''.$assembly::list1@8 - IL_0077: stloc.3 - IL_0078: ldc.i4.0 - IL_0079: ldnull - IL_007a: newobj instance void assembly/seq1@9::.ctor(int32, + class [runtime]System.Tuple`3 V_18, + class [runtime]System.Tuple`3 V_19, + int32 V_20, + class [runtime]System.Tuple`4 V_21, + class [runtime]System.Tuple`4 V_22, + int32 V_23) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.s V_12 + IL_0004: ldc.i4.1 + IL_0005: stloc.s V_13 + IL_0007: br.s IL_0020 + + IL_0009: ldloca.s V_11 + IL_000b: ldloc.s V_13 + IL_000d: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0012: nop + IL_0013: ldloc.s V_13 + IL_0015: ldc.i4.1 + IL_0016: add + IL_0017: stloc.s V_13 + IL_0019: ldloc.s V_12 + IL_001b: ldc.i4.1 + IL_001c: conv.i8 + IL_001d: add + IL_001e: stloc.s V_12 + IL_0020: ldloc.s V_12 + IL_0022: ldc.i4.s 10 + IL_0024: conv.i8 + IL_0025: blt.un.s IL_0009 + + IL_0027: ldloca.s V_11 + IL_0029: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_002e: dup + IL_002f: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$assembly::alist@5 + IL_0034: stloc.0 + IL_0035: ldc.i4.3 + IL_0036: newarr [runtime]System.Int32 + IL_003b: dup + IL_003c: ldc.i4.0 + IL_003d: ldc.i4.1 + IL_003e: stelem [runtime]System.Int32 + IL_0043: dup + IL_0044: ldc.i4.1 + IL_0045: ldc.i4.2 + IL_0046: stelem [runtime]System.Int32 + IL_004b: dup + IL_004c: ldc.i4.2 + IL_004d: ldc.i4.3 + IL_004e: stelem [runtime]System.Int32 + IL_0053: dup + IL_0054: stsfld int32[] ''.$assembly::array@6 + IL_0059: stloc.1 + IL_005a: ldc.i4.1 + IL_005b: ldc.i4.1 + IL_005c: ldc.i4.s 10 + IL_005e: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_0063: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0068: dup + IL_0069: stsfld class [runtime]System.Collections.Generic.IEnumerable`1 ''.$assembly::aseq@7 + IL_006e: stloc.2 + IL_006f: ldc.i4.1 + IL_0070: ldc.i4.1 + IL_0071: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, + !1) + IL_0076: ldc.i4.2 + IL_0077: ldc.i4.2 + IL_0078: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, + !1) + IL_007d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>::get_Empty() + IL_0082: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>::Cons(!0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_0087: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>::Cons(!0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_008c: dup + IL_008d: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> ''.$assembly::list1@8 + IL_0092: stloc.3 + IL_0093: ldc.i4.0 + IL_0094: ldnull + IL_0095: newobj instance void assembly/seq1@9::.ctor(int32, class [runtime]System.Tuple`2) - IL_007f: dup - IL_0080: stsfld class [runtime]System.Collections.Generic.IEnumerable`1> ''.$assembly::seq1@9 - IL_0085: stloc.s V_4 - IL_0087: ldc.i4.2 - IL_0088: newarr class [runtime]System.Tuple`2 - IL_008d: dup - IL_008e: ldc.i4.0 - IL_008f: ldc.i4.1 - IL_0090: ldc.i4.1 - IL_0091: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_0096: stelem class [runtime]System.Tuple`2 - IL_009b: dup - IL_009c: ldc.i4.1 - IL_009d: ldc.i4.2 - IL_009e: ldc.i4.2 - IL_009f: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_00a4: stelem class [runtime]System.Tuple`2 - IL_00a9: dup - IL_00aa: stsfld class [runtime]System.Tuple`2[] ''.$assembly::array1@10 - IL_00af: stloc.s V_5 - IL_00b1: ldc.i4.2 - IL_00b2: ldc.i4.2 - IL_00b3: ldc.i4.0 - IL_00b4: call !!0[0...,0...] [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Create(int32, + IL_009a: dup + IL_009b: stsfld class [runtime]System.Collections.Generic.IEnumerable`1> ''.$assembly::seq1@9 + IL_00a0: stloc.s V_4 + IL_00a2: ldc.i4.2 + IL_00a3: newarr class [runtime]System.Tuple`2 + IL_00a8: dup + IL_00a9: ldc.i4.0 + IL_00aa: ldc.i4.1 + IL_00ab: ldc.i4.1 + IL_00ac: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, + !1) + IL_00b1: stelem class [runtime]System.Tuple`2 + IL_00b6: dup + IL_00b7: ldc.i4.1 + IL_00b8: ldc.i4.2 + IL_00b9: ldc.i4.2 + IL_00ba: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, + !1) + IL_00bf: stelem class [runtime]System.Tuple`2 + IL_00c4: dup + IL_00c5: stsfld class [runtime]System.Tuple`2[] ''.$assembly::array1@10 + IL_00ca: stloc.s V_5 + IL_00cc: ldc.i4.2 + IL_00cd: ldc.i4.2 + IL_00ce: ldc.i4.0 + IL_00cf: call !!0[0...,0...] [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Create(int32, int32, !!0) - IL_00b9: dup - IL_00ba: stsfld int32[0...,0...] ''.$assembly::a3@11 - IL_00bf: stloc.s V_6 - IL_00c1: ldc.i4.3 - IL_00c2: ldc.i4.3 - IL_00c3: ldc.i4.3 - IL_00c4: ldc.i4.0 - IL_00c5: call !!0[0...,0...,0...] [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Create(int32, + IL_00d4: dup + IL_00d5: stsfld int32[0...,0...] ''.$assembly::a3@11 + IL_00da: stloc.s V_6 + IL_00dc: ldc.i4.3 + IL_00dd: ldc.i4.3 + IL_00de: ldc.i4.3 + IL_00df: ldc.i4.0 + IL_00e0: call !!0[0...,0...,0...] [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Create(int32, int32, int32, !!0) - IL_00ca: dup - IL_00cb: stsfld int32[0...,0...,0...] ''.$assembly::array3D@12 - IL_00d0: stloc.s V_7 - IL_00d2: ldc.i4.4 - IL_00d3: ldc.i4.4 - IL_00d4: ldc.i4.4 - IL_00d5: ldc.i4.4 - IL_00d6: ldc.i4.0 - IL_00d7: call !!0[0...,0...,0...,0...] [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Create(int32, + IL_00e5: dup + IL_00e6: stsfld int32[0...,0...,0...] ''.$assembly::array3D@12 + IL_00eb: stloc.s V_7 + IL_00ed: ldc.i4.4 + IL_00ee: ldc.i4.4 + IL_00ef: ldc.i4.4 + IL_00f0: ldc.i4.4 + IL_00f1: ldc.i4.0 + IL_00f2: call !!0[0...,0...,0...,0...] [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Create(int32, int32, int32, int32, !!0) - IL_00dc: dup - IL_00dd: stsfld int32[0...,0...,0...,0...] ''.$assembly::array4D@13 - IL_00e2: stloc.s V_8 - IL_00e4: call int32[] assembly::get_array() - IL_00e9: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::OfArray(!!0[]) - IL_00ee: pop - IL_00ef: call class [runtime]System.Collections.Generic.IEnumerable`1 assembly::get_aseq() - IL_00f4: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::OfSeq(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_00f9: pop - IL_00fa: call class [runtime]System.Tuple`2[] assembly::get_array1() - IL_00ff: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::OfArray(class [runtime]System.Tuple`2[]) - IL_0104: pop - IL_0105: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> assembly::get_list1() - IL_010a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::OfList(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>) - IL_010f: pop - IL_0110: call class [runtime]System.Collections.Generic.IEnumerable`1> assembly::get_seq1() - IL_0115: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::OfSeq(class [runtime]System.Collections.Generic.IEnumerable`1>) - IL_011a: pop - IL_011b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_alist() - IL_0120: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::OfList(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0125: dup - IL_0126: stsfld int32[] ''.$assembly::a1@25 - IL_012b: stloc.s V_9 - IL_012d: call class [runtime]System.Collections.Generic.IEnumerable`1 assembly::get_aseq() - IL_0132: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::OfSeq(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0137: dup - IL_0138: stsfld int32[] ''.$assembly::a2@26 - IL_013d: stloc.s V_10 - IL_013f: call int32[] assembly::get_a1() - IL_0144: ldc.i4.0 - IL_0145: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Get(!!0[], + IL_00f7: dup + IL_00f8: stsfld int32[0...,0...,0...,0...] ''.$assembly::array4D@13 + IL_00fd: stloc.s V_8 + IL_00ff: call int32[] assembly::get_array() + IL_0104: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::OfArray(!!0[]) + IL_0109: pop + IL_010a: call class [runtime]System.Collections.Generic.IEnumerable`1 assembly::get_aseq() + IL_010f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::OfSeq(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0114: pop + IL_0115: call class [runtime]System.Tuple`2[] assembly::get_array1() + IL_011a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::OfArray(class [runtime]System.Tuple`2[]) + IL_011f: pop + IL_0120: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> assembly::get_list1() + IL_0125: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::OfList(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>) + IL_012a: pop + IL_012b: call class [runtime]System.Collections.Generic.IEnumerable`1> assembly::get_seq1() + IL_0130: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::OfSeq(class [runtime]System.Collections.Generic.IEnumerable`1>) + IL_0135: pop + IL_0136: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_alist() + IL_013b: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::OfList(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_0140: dup + IL_0141: stsfld int32[] ''.$assembly::a1@25 + IL_0146: stloc.s V_9 + IL_0148: call class [runtime]System.Collections.Generic.IEnumerable`1 assembly::get_aseq() + IL_014d: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::OfSeq(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0152: dup + IL_0153: stsfld int32[] ''.$assembly::a2@26 + IL_0158: stloc.s V_10 + IL_015a: call int32[] assembly::get_a1() + IL_015f: ldc.i4.0 + IL_0160: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Get(!!0[], int32) - IL_014a: stloc.s V_11 - IL_014c: call int32[] assembly::get_a2() - IL_0151: ldc.i4.0 - IL_0152: ldloc.s V_11 - IL_0154: call void [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Set(!!0[], + IL_0165: stloc.s V_14 + IL_0167: call int32[] assembly::get_a2() + IL_016c: ldc.i4.0 + IL_016d: ldloc.s V_14 + IL_016f: call void [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Set(!!0[], int32, !!0) - IL_0159: nop - IL_015a: call int32[0...,0...] assembly::get_a3() - IL_015f: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Length1(!!0[0...,0...]) - IL_0164: call int32[0...,0...] assembly::get_a3() - IL_0169: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Length2(!!0[0...,0...]) - IL_016e: call int32[0...,0...] assembly::get_a3() - IL_0173: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Base1(!!0[0...,0...]) - IL_0178: call int32[0...,0...] assembly::get_a3() - IL_017d: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Base2(!!0[0...,0...]) - IL_0182: newobj instance void class [runtime]System.Tuple`4::.ctor(!0, - !1, - !2, - !3) - IL_0187: stloc.s V_12 - IL_0189: ldloc.s V_12 - IL_018b: stloc.s V_13 - IL_018d: call int32[0...,0...] assembly::get_a3() - IL_0192: ldc.i4.0 - IL_0193: ldc.i4.0 - IL_0194: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Get(!!0[0...,0...], + IL_0174: nop + IL_0175: call int32[0...,0...] assembly::get_a3() + IL_017a: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Length1(!!0[0...,0...]) + IL_017f: call int32[0...,0...] assembly::get_a3() + IL_0184: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Length2(!!0[0...,0...]) + IL_0189: call int32[0...,0...] assembly::get_a3() + IL_018e: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Base1(!!0[0...,0...]) + IL_0193: call int32[0...,0...] assembly::get_a3() + IL_0198: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Base2(!!0[0...,0...]) + IL_019d: newobj instance void class [runtime]System.Tuple`4::.ctor(!0, + !1, + !2, + !3) + IL_01a2: stloc.s V_15 + IL_01a4: ldloc.s V_15 + IL_01a6: stloc.s V_16 + IL_01a8: call int32[0...,0...] assembly::get_a3() + IL_01ad: ldc.i4.0 + IL_01ae: ldc.i4.0 + IL_01af: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Get(!!0[0...,0...], int32, int32) - IL_0199: stloc.s V_14 - IL_019b: call int32[0...,0...] assembly::get_a3() - IL_01a0: ldc.i4.0 - IL_01a1: ldc.i4.0 - IL_01a2: ldloc.s V_14 - IL_01a4: call void [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Set(!!0[0...,0...], + IL_01b4: stloc.s V_17 + IL_01b6: call int32[0...,0...] assembly::get_a3() + IL_01bb: ldc.i4.0 + IL_01bc: ldc.i4.0 + IL_01bd: ldloc.s V_17 + IL_01bf: call void [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Set(!!0[0...,0...], int32, int32, !!0) - IL_01a9: nop - IL_01aa: call int32[0...,0...,0...] assembly::get_array3D() - IL_01af: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Length1(!!0[0...,0...,0...]) - IL_01b4: call int32[0...,0...,0...] assembly::get_array3D() - IL_01b9: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Length2(!!0[0...,0...,0...]) - IL_01be: call int32[0...,0...,0...] assembly::get_array3D() - IL_01c3: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Length3(!!0[0...,0...,0...]) - IL_01c8: newobj instance void class [runtime]System.Tuple`3::.ctor(!0, - !1, - !2) - IL_01cd: stloc.s V_15 - IL_01cf: ldloc.s V_15 - IL_01d1: stloc.s V_16 - IL_01d3: call int32[0...,0...,0...] assembly::get_array3D() - IL_01d8: ldc.i4.0 - IL_01d9: ldc.i4.0 - IL_01da: ldc.i4.0 - IL_01db: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Get(!!0[0...,0...,0...], + IL_01c4: nop + IL_01c5: call int32[0...,0...,0...] assembly::get_array3D() + IL_01ca: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Length1(!!0[0...,0...,0...]) + IL_01cf: call int32[0...,0...,0...] assembly::get_array3D() + IL_01d4: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Length2(!!0[0...,0...,0...]) + IL_01d9: call int32[0...,0...,0...] assembly::get_array3D() + IL_01de: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Length3(!!0[0...,0...,0...]) + IL_01e3: newobj instance void class [runtime]System.Tuple`3::.ctor(!0, + !1, + !2) + IL_01e8: stloc.s V_18 + IL_01ea: ldloc.s V_18 + IL_01ec: stloc.s V_19 + IL_01ee: call int32[0...,0...,0...] assembly::get_array3D() + IL_01f3: ldc.i4.0 + IL_01f4: ldc.i4.0 + IL_01f5: ldc.i4.0 + IL_01f6: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Get(!!0[0...,0...,0...], int32, int32, int32) - IL_01e0: stloc.s V_17 - IL_01e2: call int32[0...,0...,0...] assembly::get_array3D() - IL_01e7: ldc.i4.0 - IL_01e8: ldc.i4.0 - IL_01e9: ldc.i4.0 - IL_01ea: ldloc.s V_17 - IL_01ec: call void [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Set(!!0[0...,0...,0...], + IL_01fb: stloc.s V_20 + IL_01fd: call int32[0...,0...,0...] assembly::get_array3D() + IL_0202: ldc.i4.0 + IL_0203: ldc.i4.0 + IL_0204: ldc.i4.0 + IL_0205: ldloc.s V_20 + IL_0207: call void [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Set(!!0[0...,0...,0...], int32, int32, int32, !!0) - IL_01f1: nop - IL_01f2: call int32[0...,0...,0...,0...] assembly::get_array4D() - IL_01f7: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length1(!!0[0...,0...,0...,0...]) - IL_01fc: call int32[0...,0...,0...,0...] assembly::get_array4D() - IL_0201: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length2(!!0[0...,0...,0...,0...]) - IL_0206: call int32[0...,0...,0...,0...] assembly::get_array4D() - IL_020b: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length3(!!0[0...,0...,0...,0...]) - IL_0210: call int32[0...,0...,0...,0...] assembly::get_array4D() - IL_0215: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length4(!!0[0...,0...,0...,0...]) - IL_021a: newobj instance void class [runtime]System.Tuple`4::.ctor(!0, - !1, - !2, - !3) - IL_021f: stloc.s V_18 - IL_0221: ldloc.s V_18 - IL_0223: stloc.s V_19 - IL_0225: call int32[0...,0...,0...,0...] assembly::get_array4D() - IL_022a: ldc.i4.0 - IL_022b: ldc.i4.0 - IL_022c: ldc.i4.0 - IL_022d: ldc.i4.0 - IL_022e: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Get(!!0[0...,0...,0...,0...], + IL_020c: nop + IL_020d: call int32[0...,0...,0...,0...] assembly::get_array4D() + IL_0212: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length1(!!0[0...,0...,0...,0...]) + IL_0217: call int32[0...,0...,0...,0...] assembly::get_array4D() + IL_021c: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length2(!!0[0...,0...,0...,0...]) + IL_0221: call int32[0...,0...,0...,0...] assembly::get_array4D() + IL_0226: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length3(!!0[0...,0...,0...,0...]) + IL_022b: call int32[0...,0...,0...,0...] assembly::get_array4D() + IL_0230: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length4(!!0[0...,0...,0...,0...]) + IL_0235: newobj instance void class [runtime]System.Tuple`4::.ctor(!0, + !1, + !2, + !3) + IL_023a: stloc.s V_21 + IL_023c: ldloc.s V_21 + IL_023e: stloc.s V_22 + IL_0240: call int32[0...,0...,0...,0...] assembly::get_array4D() + IL_0245: ldc.i4.0 + IL_0246: ldc.i4.0 + IL_0247: ldc.i4.0 + IL_0248: ldc.i4.0 + IL_0249: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Get(!!0[0...,0...,0...,0...], int32, int32, int32, int32) - IL_0233: stloc.s V_20 - IL_0235: call int32[0...,0...,0...,0...] assembly::get_array4D() - IL_023a: ldc.i4.0 - IL_023b: ldc.i4.0 - IL_023c: ldc.i4.0 - IL_023d: ldc.i4.0 - IL_023e: ldloc.s V_20 - IL_0240: call void [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Set(!!0[0...,0...,0...,0...], + IL_024e: stloc.s V_23 + IL_0250: call int32[0...,0...,0...,0...] assembly::get_array4D() + IL_0255: ldc.i4.0 + IL_0256: ldc.i4.0 + IL_0257: ldc.i4.0 + IL_0258: ldc.i4.0 + IL_0259: ldloc.s V_23 + IL_025b: call void [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Set(!!0[0...,0...,0...,0...], int32, int32, int32, int32, !!0) - IL_0245: nop - IL_0246: ret + IL_0260: nop + IL_0261: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOn.il.bsl index b77d95c5722..35494e25b75 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CustomAttributeGenericParameter01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CustomAttributeGenericParameter01.fs.RealInternalSignatureOff.il.bsl index 16a86e09862..58d8608220e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CustomAttributeGenericParameter01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CustomAttributeGenericParameter01.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CustomAttributeGenericParameter01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CustomAttributeGenericParameter01.fs.RealInternalSignatureOn.il.bsl index 6c8fac9faa7..e18cfb53749 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CustomAttributeGenericParameter01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CustomAttributeGenericParameter01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs.RealInternalSignatureOff.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs.RealInternalSignatureOff.il.net472.bsl index 66c14f7cac0..3867512a775 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs.RealInternalSignatureOff.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs.RealInternalSignatureOff.il.net472.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs.RealInternalSignatureOff.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs.RealInternalSignatureOff.il.netcore.bsl index dacf9cdbaab..8c7c7c02409 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs.RealInternalSignatureOff.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs.RealInternalSignatureOff.il.netcore.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs.RealInternalSignatureOn.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs.RealInternalSignatureOn.il.net472.bsl index b4095924a48..31692bc9089 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs.RealInternalSignatureOn.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs.RealInternalSignatureOn.il.net472.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs.RealInternalSignatureOn.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs.RealInternalSignatureOn.il.netcore.bsl index 3af00969290..0703294788b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs.RealInternalSignatureOn.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Decimal01.fs.RealInternalSignatureOn.il.netcore.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.RealInternalSignatureOff.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.RealInternalSignatureOff.fs.il.bsl index 237cfc0ea3f..9458e53dcea 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.RealInternalSignatureOff.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.RealInternalSignatureOff.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.RealInternalSignatureOn.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.RealInternalSignatureOn.fs.il.bsl index 237cfc0ea3f..9458e53dcea 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.RealInternalSignatureOn.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.RealInternalSignatureOn.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs.RealInternalSignatureOff.il.bsl index 0ea905abd6f..9e2d2a1dd6a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs.RealInternalSignatureOn.il.bsl index f3df30fd7af..09a95ab954d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs.il.net472.debug.bsl index 0b1614c9561..350a4d6ba7b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs.il.net472.release.bsl index 1071ede0a81..3fd3c4cefba 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs.il.netcore.debug.bsl index a92160a832e..916c5ec6d10 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs.il.netcore.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs.il.netcore.release.bsl index 0a6385cd44b..ef594bc4ea1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EqualsOnUnions01.fs.il.netcore.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs index eb7c818f002..8d7d270e2c8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs @@ -1,5 +1,5 @@ // #Regression #NoMono #NoMT #CodeGen #EmittedIL -// Regressiont test for TFS#712639 +// Regression test for TFS#712639 // Incorrect span or overlapping debugging spans // The test will start failing once the bug is actually fixed for wi in [ 1 .. 3 ] do diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs.RealInternalSignatureOff.il.bsl index 7d0d3f2f625..cf3ef015691 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs.RealInternalSignatureOff.il.bsl @@ -16,16 +16,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -56,42 +46,64 @@ { .entrypoint - .maxstack 5 + .maxstack 4 .locals init (class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_0, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, - int32 V_2) - IL_0000: ldc.i4.1 - IL_0001: ldc.i4.1 - IL_0002: ldc.i4.3 - IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0008: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_000d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0012: stloc.0 - IL_0013: ldloc.0 - IL_0014: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_0019: stloc.1 - IL_001a: br.s IL_0042 - - IL_001c: ldloc.0 - IL_001d: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() - IL_0022: stloc.2 - IL_0023: ldstr "%A" - IL_0028: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string) - IL_002d: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_0032: ldloc.2 - IL_0033: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0038: pop - IL_0039: ldloc.1 - IL_003a: stloc.0 - IL_003b: ldloc.0 - IL_003c: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_0041: stloc.1 - IL_0042: ldloc.1 - IL_0043: brtrue.s IL_001c - - IL_0045: ret + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + int32 V_3, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_4, + int32 V_5) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.2 + IL_0003: ldc.i4.1 + IL_0004: stloc.3 + IL_0005: br.s IL_0019 + + IL_0007: ldloca.s V_1 + IL_0009: ldloc.3 + IL_000a: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_000f: nop + IL_0010: ldloc.3 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.3 + IL_0014: ldloc.2 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: stloc.2 + IL_0019: ldloc.2 + IL_001a: ldc.i4.3 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0007 + + IL_001e: ldloca.s V_1 + IL_0020: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0025: stloc.0 + IL_0026: ldloc.0 + IL_0027: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_002c: stloc.s V_4 + IL_002e: br.s IL_005a + + IL_0030: ldloc.0 + IL_0031: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0036: stloc.s V_5 + IL_0038: ldstr "%A" + IL_003d: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string) + IL_0042: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_0047: ldloc.s V_5 + IL_0049: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_004e: pop + IL_004f: ldloc.s V_4 + IL_0051: stloc.0 + IL_0052: ldloc.0 + IL_0053: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0058: stloc.s V_4 + IL_005a: ldloc.s V_4 + IL_005c: brtrue.s IL_0030 + + IL_005e: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs.RealInternalSignatureOn.il.bsl index 8fd7c519810..5914c20eb17 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop02.fs index 57cf7b7900d..04882e0ec2c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop02.fs @@ -1,5 +1,5 @@ // #Regression #NoMono #NoMT #CodeGen #EmittedIL -// Regressiont test for TFS#712639 +// Regression test for TFS#712639 // Incorrect span or overlapping debugging spans // The test will start failing once the bug is actually fixed for wi = 1 to 3 do diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop02.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop02.fs.RealInternalSignatureOff.il.bsl index f49650ef0ee..9eabae75fe8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop02.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop02.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop02.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop02.fs.RealInternalSignatureOn.il.bsl index 6297992ad5f..652e223cd59 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop02.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop02.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop03.fs.RealInternalSignatureOff.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop03.fs.RealInternalSignatureOff.il.net472.bsl index 35835161848..c2d8e84b8d7 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop03.fs.RealInternalSignatureOff.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop03.fs.RealInternalSignatureOff.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop03.fs.RealInternalSignatureOff.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop03.fs.RealInternalSignatureOff.il.netcore.bsl index ca21ccfd0c9..c23cb75c545 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop03.fs.RealInternalSignatureOff.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop03.fs.RealInternalSignatureOff.il.netcore.bsl @@ -8,7 +8,7 @@ .assembly extern System.Collections { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 + .ver 9:0:0:0 } .assembly assembly { @@ -21,16 +21,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -175,4 +165,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop03.fs.RealInternalSignatureOn.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop03.fs.RealInternalSignatureOn.il.net472.bsl index 89116dd2c87..771e4efe186 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop03.fs.RealInternalSignatureOn.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop03.fs.RealInternalSignatureOn.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop03.fs.RealInternalSignatureOn.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop03.fs.RealInternalSignatureOn.il.netcore.bsl index 9c2772ab7b5..0efd6c82922 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop03.fs.RealInternalSignatureOn.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop03.fs.RealInternalSignatureOn.il.netcore.bsl @@ -8,7 +8,7 @@ .assembly extern System.Collections { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 + .ver 9:0:0:0 } .assembly assembly { @@ -21,16 +21,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -191,4 +181,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs.RealInternalSignatureOff.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs.RealInternalSignatureOff.il.net472.bsl index 0fdb950f13c..7a6a0feb096 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs.RealInternalSignatureOff.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs.RealInternalSignatureOff.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs.RealInternalSignatureOff.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs.RealInternalSignatureOff.il.netcore.bsl index e95bc2fedaf..b8efd286255 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs.RealInternalSignatureOff.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs.RealInternalSignatureOff.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs.RealInternalSignatureOn.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs.RealInternalSignatureOn.il.net472.bsl index 4f6a69c7d78..8b09042819b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs.RealInternalSignatureOn.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs.RealInternalSignatureOn.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs.RealInternalSignatureOn.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs.RealInternalSignatureOn.il.netcore.bsl index e4c8f885539..7975a22570f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs.RealInternalSignatureOn.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GeneralizationOnUnions01.fs.RealInternalSignatureOn.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GenericTypeStaticField.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GenericTypeStaticField.fs.il.bsl index 4d92b08d231..010cf5d73b6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GenericTypeStaticField.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/GenericTypeStaticField.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/IfThenElse01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/IfThenElse01.fs.RealInternalSignatureOff.il.bsl index b2c1885cc93..7a3b11fe451 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/IfThenElse01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/IfThenElse01.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/IfThenElse01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/IfThenElse01.fs.RealInternalSignatureOn.il.bsl index b2c1885cc93..7a3b11fe451 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/IfThenElse01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/IfThenElse01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/IfThenElse01.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/IfThenElse01.fs.il.bsl index bb7789ea103..95d61b9dcd3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/IfThenElse01.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/IfThenElse01.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/LetIfThenElse01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/LetIfThenElse01.fs.RealInternalSignatureOff.il.bsl index 51d7e424843..937c540c9f6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/LetIfThenElse01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/LetIfThenElse01.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/LetIfThenElse01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/LetIfThenElse01.fs.RealInternalSignatureOn.il.bsl index 72bd28ab1d7..6b8cb468f13 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/LetIfThenElse01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/LetIfThenElse01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOff.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOff.il.net472.bsl index 69538d40cd0..804af13e153 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOff.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOff.il.net472.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOff.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOff.il.netcore.bsl index 41394fd6e02..a278784d859 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOff.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOff.il.netcore.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.il.net472.bsl index e67218a9cd4..52cf4b914c9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.il.net472.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.il.netcore.bsl index 8e0327d73c7..c05dc015459 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.il.netcore.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Marshal.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Marshal.fs.il.bsl index 47e564c2a9d..c5339e18645 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Marshal.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Marshal.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs.RealInternalSignatureOff.il.bsl index f1d5cdd13d8..80c502560e8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs.RealInternalSignatureOn.il.bsl index 8d512541da2..b769f61f249 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Misc.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Misc.fs index 3516864c122..5e8206137b1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Misc.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Misc.fs @@ -45,7 +45,6 @@ module Misc = let ``CodeGenRenamings01_RealInternalSignatureOn_fs`` compilation = compilation |> withRealInternalSignatureOn - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> asExe |> verifyCompilation @@ -117,7 +116,6 @@ module Misc = let ``ForLoop01_RealInternalSignatureOn_fs`` compilation = compilation |> withRealInternalSignatureOn - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> asExe |> verifyCompilation diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs.RealInternalSignatureOff.il.bsl index b66ece721b1..cfedbc8e969 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs.RealInternalSignatureOn.il.bsl index c2f8529b0e1..c0f9bb38aa9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs.il.net472.bsl index fc0add44acd..411983b6b6f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs.il.netcore.bsl index a75cf1b5171..b75df191b9e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs.il.netcore.bsl @@ -8,7 +8,7 @@ .assembly extern System.Collections { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 + .ver 9:0:0:0 } .assembly assembly { @@ -21,16 +21,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -99,3 +89,8 @@ } } + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NonEscapingArguments02.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NonEscapingArguments02.fs.il.bsl index 0dcc23a310f..9eef6da101c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NonEscapingArguments02.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NonEscapingArguments02.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/PreserveSig.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/PreserveSig.fs.il.bsl index 924991d18dd..49d2179e989 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/PreserveSig.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/PreserveSig.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Seq_for_all01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Seq_for_all01.fs.RealInternalSignatureOff.il.bsl index 1a0a6d79b96..c9456684406 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Seq_for_all01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Seq_for_all01.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Seq_for_all01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Seq_for_all01.fs.RealInternalSignatureOn.il.bsl index 298df4dbc92..92f7fa4d984 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Seq_for_all01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Seq_for_all01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs01.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs01.fs.il.debug.bsl index fe75351f38b..e94a1153110 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs01.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs01.fs.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs01.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs01.fs.il.release.bsl index 00d6a181fb9..9e83bd1c55b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs01.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs01.fs.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.debug.bsl index 352629674ed..4f92824cee0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.release.bsl index 345be150d73..ffbb421bf23 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.debug.bsl index 5dd9c8530fa..49a8bdd7d40 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.debug.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.release.bsl index dc612567d5c..9fbfe01a4d3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.release.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs.RealInternalSignatureOff.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs.RealInternalSignatureOff.il.debug.bsl index abca1d7af92..f4cadc54511 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs.RealInternalSignatureOff.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs.RealInternalSignatureOff.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs.RealInternalSignatureOff.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs.RealInternalSignatureOff.il.release.bsl index de9612430e9..ceb8cdcc966 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs.RealInternalSignatureOff.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs.RealInternalSignatureOff.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs.RealInternalSignatureOn.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs.RealInternalSignatureOn.il.debug.bsl index afcc9f2c432..d6cc7672f2a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs.RealInternalSignatureOn.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs.RealInternalSignatureOn.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs.RealInternalSignatureOn.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs.RealInternalSignatureOn.il.release.bsl index 54ecc2f3622..a337f3245e0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs.RealInternalSignatureOn.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/StructsAsArrayElements01.fs.RealInternalSignatureOn.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/TryWith_NoFilterBlocks01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/TryWith_NoFilterBlocks01.fs.RealInternalSignatureOff.il.bsl index e695b29f64a..fae41598e5d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/TryWith_NoFilterBlocks01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/TryWith_NoFilterBlocks01.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/TryWith_NoFilterBlocks01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/TryWith_NoFilterBlocks01.fs.RealInternalSignatureOn.il.bsl index 35a0349ec65..5439b839899 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/TryWith_NoFilterBlocks01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/TryWith_NoFilterBlocks01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/AnonRecords.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/AnonRecords.fs new file mode 100644 index 00000000000..0e1cbf437ca --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/AnonRecords.fs @@ -0,0 +1,16 @@ +module MyTestModule + +let justInt = 42 +let maybeString : string | null = null +let maybeListOfMaybeString : List<_> | null = [maybeString] + +let giveMeA () = + {| A = maybeString; B = maybeListOfMaybeString; C = justInt|} + +let giveMeB () = + {| A = justInt; B = justInt; C = justInt|} + +let giveMeC () = + {| A = maybeString; B = maybeString; C = maybeString|} + +let threeHappyStrings () : string array = [|giveMeA().ToString();giveMeB().ToString();giveMeC().ToString()|] \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/AnonRecords.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/AnonRecords.fs.il.net472.bsl new file mode 100644 index 00000000000..6390383dbd8 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/AnonRecords.fs.il.net472.bsl @@ -0,0 +1,900 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field static assembly class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 maybeListOfMaybeString@5 + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public specialname static int32 get_justInt() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.s 42 + IL_0002: ret + } + + .method public specialname static string get_maybeString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + } + + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_maybeListOfMaybeString() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 MyTestModule::maybeListOfMaybeString@5 + IL_0005: ret + } + + .method public static class '<>f__AnonymousType2430756162`3',int32> giveMeA() cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 04 00 00 00 01 02 02 02 00 00 ) + + .maxstack 8 + IL_0000: call string MyTestModule::get_maybeString() + IL_0005: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 MyTestModule::get_maybeListOfMaybeString() + IL_000a: call int32 MyTestModule::get_justInt() + IL_000f: newobj instance void class '<>f__AnonymousType2430756162`3',int32>::.ctor(!0, + !1, + !2) + IL_0014: ret + } + + .method public static class '<>f__AnonymousType2430756162`3' giveMeB() cil managed + { + + .maxstack 8 + IL_0000: call int32 MyTestModule::get_justInt() + IL_0005: call int32 MyTestModule::get_justInt() + IL_000a: call int32 MyTestModule::get_justInt() + IL_000f: newobj instance void class '<>f__AnonymousType2430756162`3'::.ctor(!0, + !1, + !2) + IL_0014: ret + } + + .method public static class '<>f__AnonymousType2430756162`3' giveMeC() cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 04 00 00 00 01 02 02 02 00 00 ) + + .maxstack 8 + IL_0000: call string MyTestModule::get_maybeString() + IL_0005: call string MyTestModule::get_maybeString() + IL_000a: call string MyTestModule::get_maybeString() + IL_000f: newobj instance void class '<>f__AnonymousType2430756162`3'::.ctor(!0, + !1, + !2) + IL_0014: ret + } + + .method public static string[] threeHappyStrings() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.3 + IL_0001: newarr [runtime]System.String + IL_0006: dup + IL_0007: ldc.i4.0 + IL_0008: call class '<>f__AnonymousType2430756162`3',int32> MyTestModule::giveMeA() + IL_000d: callvirt instance string [runtime]System.Object::ToString() + IL_0012: stelem [runtime]System.String + IL_0017: dup + IL_0018: ldc.i4.1 + IL_0019: call class '<>f__AnonymousType2430756162`3' MyTestModule::giveMeB() + IL_001e: callvirt instance string [runtime]System.Object::ToString() + IL_0023: stelem [runtime]System.String + IL_0028: dup + IL_0029: ldc.i4.2 + IL_002a: call class '<>f__AnonymousType2430756162`3' MyTestModule::giveMeC() + IL_002f: callvirt instance string [runtime]System.Object::ToString() + IL_0034: stelem [runtime]System.String + IL_0039: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$MyTestModule::init@ + IL_0006: ldsfld int32 ''.$MyTestModule::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call string MyTestModule::get_maybeString() + IL_0005: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_000a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_000f: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 MyTestModule::maybeListOfMaybeString@5 + IL_0014: ret + } + + .property int32 justInt() + { + .get int32 MyTestModule::get_justInt() + } + .property string maybeString() + { + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .get string MyTestModule::get_maybeString() + } + .property class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + maybeListOfMaybeString() + { + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 MyTestModule::get_maybeListOfMaybeString() + } +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void MyTestModule::staticInitialization@() + IL_0005: ret + } + +} + +.class public auto ansi serializable sealed beforefieldinit '<>f__AnonymousType2430756162`3'<'j__TPar','j__TPar','j__TPar'> + extends [runtime]System.Object + implements [runtime]System.Collections.IStructuralComparable, + [runtime]System.IComparable, + class [runtime]System.IComparable`1f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>>, + [runtime]System.Collections.IStructuralEquatable, + class [runtime]System.IEquatable`1f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>> +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 02 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field private !'j__TPar' A@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field private !'j__TPar' B@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field private !'j__TPar' C@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public specialname rtspecialname + instance void .ctor(!'j__TPar' A, + !'j__TPar' B, + !'j__TPar' C) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 1E 3C 3E 66 5F 5F 41 6E 6F 6E + 79 6D 6F 75 73 54 79 70 65 32 34 33 30 37 35 36 + 31 36 32 60 33 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_0014: ldarg.0 + IL_0015: ldarg.3 + IL_0016: stfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_001b: ret + } + + .method public hidebysig specialname instance !'j__TPar' get_A() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_0006: ret + } + + .method public hidebysig specialname instance !'j__TPar' get_B() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_0006: ret + } + + .method public hidebysig specialname instance !'j__TPar' get_C() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_0006: ret + } + + .method public strict virtual instance string ToString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>,string>,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToStringf__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>,string>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>,string>::Invoke(!0) + IL_0015: ret + } + + .method public hidebysig virtual final instance int32 CompareTo(class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (int32 V_0, + int32 V_1) + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0067 + + IL_0003: ldarg.1 + IL_0004: brfalse.s IL_0065 + + IL_0006: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_000b: ldarg.0 + IL_000c: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_0011: ldarg.1 + IL_0012: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_0017: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericComparisonWithComparerj__TPar'>(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_001c: stloc.0 + IL_001d: ldloc.0 + IL_001e: ldc.i4.0 + IL_001f: bge.s IL_0023 + + IL_0021: ldloc.0 + IL_0022: ret + + IL_0023: ldloc.0 + IL_0024: ldc.i4.0 + IL_0025: ble.s IL_0029 + + IL_0027: ldloc.0 + IL_0028: ret + + IL_0029: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_002e: ldarg.0 + IL_002f: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_0034: ldarg.1 + IL_0035: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_003a: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericComparisonWithComparerj__TPar'>(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_003f: stloc.1 + IL_0040: ldloc.1 + IL_0041: ldc.i4.0 + IL_0042: bge.s IL_0046 + + IL_0044: ldloc.1 + IL_0045: ret + + IL_0046: ldloc.1 + IL_0047: ldc.i4.0 + IL_0048: ble.s IL_004c + + IL_004a: ldloc.1 + IL_004b: ret + + IL_004c: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0051: ldarg.0 + IL_0052: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_0057: ldarg.1 + IL_0058: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_005d: tail. + IL_005f: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericComparisonWithComparerj__TPar'>(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_0064: ret + + IL_0065: ldc.i4.1 + IL_0066: ret + + IL_0067: ldarg.1 + IL_0068: brfalse.s IL_006c + + IL_006a: ldc.i4.m1 + IL_006b: ret + + IL_006c: ldc.i4.0 + IL_006d: ret + } + + .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: unbox.any class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> + IL_0007: tail. + IL_0009: callvirt instance int32 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::CompareTo(class '<>f__AnonymousType2430756162`3') + IL_000e: ret + } + + .method public hidebysig virtual final + instance int32 CompareTo(object obj, + class [runtime]System.Collections.IComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 5 + .locals init (class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> V_0, + class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> V_1, + int32 V_2, + int32 V_3) + IL_0000: ldarg.1 + IL_0001: unbox.any class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: stloc.1 + IL_0009: ldarg.0 + IL_000a: brfalse.s IL_0069 + + IL_000c: ldarg.1 + IL_000d: unbox.any class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> + IL_0012: brfalse.s IL_0067 + + IL_0014: ldarg.2 + IL_0015: ldarg.0 + IL_0016: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_001b: ldloc.1 + IL_001c: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_0021: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericComparisonWithComparerj__TPar'>(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_0026: stloc.2 + IL_0027: ldloc.2 + IL_0028: ldc.i4.0 + IL_0029: bge.s IL_002d + + IL_002b: ldloc.2 + IL_002c: ret + + IL_002d: ldloc.2 + IL_002e: ldc.i4.0 + IL_002f: ble.s IL_0033 + + IL_0031: ldloc.2 + IL_0032: ret + + IL_0033: ldarg.2 + IL_0034: ldarg.0 + IL_0035: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_003a: ldloc.1 + IL_003b: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_0040: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericComparisonWithComparerj__TPar'>(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_0045: stloc.3 + IL_0046: ldloc.3 + IL_0047: ldc.i4.0 + IL_0048: bge.s IL_004c + + IL_004a: ldloc.3 + IL_004b: ret + + IL_004c: ldloc.3 + IL_004d: ldc.i4.0 + IL_004e: ble.s IL_0052 + + IL_0050: ldloc.3 + IL_0051: ret + + IL_0052: ldarg.2 + IL_0053: ldarg.0 + IL_0054: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_0059: ldloc.1 + IL_005a: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_005f: tail. + IL_0061: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericComparisonWithComparerj__TPar'>(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_0066: ret + + IL_0067: ldc.i4.1 + IL_0068: ret + + IL_0069: ldarg.1 + IL_006a: unbox.any class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> + IL_006f: brfalse.s IL_0073 + + IL_0071: ldc.i4.m1 + IL_0072: ret + + IL_0073: ldc.i4.0 + IL_0074: ret + } + + .method public hidebysig virtual final instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 7 + .locals init (int32 V_0) + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0058 + + IL_0003: ldc.i4.0 + IL_0004: stloc.0 + IL_0005: ldc.i4 0x9e3779b9 + IL_000a: ldarg.1 + IL_000b: ldarg.0 + IL_000c: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_0011: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericHashWithComparerj__TPar'>(class [runtime]System.Collections.IEqualityComparer, + !!0) + IL_0016: ldloc.0 + IL_0017: ldc.i4.6 + IL_0018: shl + IL_0019: ldloc.0 + IL_001a: ldc.i4.2 + IL_001b: shr + IL_001c: add + IL_001d: add + IL_001e: add + IL_001f: stloc.0 + IL_0020: ldc.i4 0x9e3779b9 + IL_0025: ldarg.1 + IL_0026: ldarg.0 + IL_0027: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_002c: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericHashWithComparerj__TPar'>(class [runtime]System.Collections.IEqualityComparer, + !!0) + IL_0031: ldloc.0 + IL_0032: ldc.i4.6 + IL_0033: shl + IL_0034: ldloc.0 + IL_0035: ldc.i4.2 + IL_0036: shr + IL_0037: add + IL_0038: add + IL_0039: add + IL_003a: stloc.0 + IL_003b: ldc.i4 0x9e3779b9 + IL_0040: ldarg.1 + IL_0041: ldarg.0 + IL_0042: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_0047: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericHashWithComparerj__TPar'>(class [runtime]System.Collections.IEqualityComparer, + !!0) + IL_004c: ldloc.0 + IL_004d: ldc.i4.6 + IL_004e: shl + IL_004f: ldloc.0 + IL_0050: ldc.i4.2 + IL_0051: shr + IL_0052: add + IL_0053: add + IL_0054: add + IL_0055: stloc.0 + IL_0056: ldloc.0 + IL_0057: ret + + IL_0058: ldc.i4.0 + IL_0059: ret + } + + .method public hidebysig virtual final instance int32 GetHashCode() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call class [runtime]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: tail. + IL_0008: callvirt instance int32 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::GetHashCode(class [runtime]System.Collections.IEqualityComparer) + IL_000d: ret + } + + .method public hidebysig instance bool + Equals(class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> obj, + class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> V_0) + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_004b + + IL_0003: ldarg.1 + IL_0004: brfalse.s IL_0049 + + IL_0006: ldarg.1 + IL_0007: stloc.0 + IL_0008: ldarg.2 + IL_0009: ldarg.0 + IL_000a: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_000f: ldloc.0 + IL_0010: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_0015: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericEqualityWithComparerj__TPar'>(class [runtime]System.Collections.IEqualityComparer, + !!0, + !!0) + IL_001a: brfalse.s IL_0047 + + IL_001c: ldarg.2 + IL_001d: ldarg.0 + IL_001e: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_0023: ldloc.0 + IL_0024: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_0029: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericEqualityWithComparerj__TPar'>(class [runtime]System.Collections.IEqualityComparer, + !!0, + !!0) + IL_002e: brfalse.s IL_0045 + + IL_0030: ldarg.2 + IL_0031: ldarg.0 + IL_0032: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_0037: ldloc.0 + IL_0038: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_003d: tail. + IL_003f: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericEqualityWithComparerj__TPar'>(class [runtime]System.Collections.IEqualityComparer, + !!0, + !!0) + IL_0044: ret + + IL_0045: ldc.i4.0 + IL_0046: ret + + IL_0047: ldc.i4.0 + IL_0048: ret + + IL_0049: ldc.i4.0 + IL_004a: ret + + IL_004b: ldarg.1 + IL_004c: ldnull + IL_004d: cgt.un + IL_004f: ldc.i4.0 + IL_0050: ceq + IL_0052: ret + } + + .method public hidebysig virtual final + instance bool Equals(object obj, + class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 5 + .locals init (class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> V_0) + IL_0000: ldarg.1 + IL_0001: isinst class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0015 + + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: ldarg.2 + IL_000d: tail. + IL_000f: callvirt instance bool class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::Equals(class '<>f__AnonymousType2430756162`3', + class [runtime]System.Collections.IEqualityComparer) + IL_0014: ret + + IL_0015: ldc.i4.0 + IL_0016: ret + } + + .method public hidebysig virtual final instance bool Equals(class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0046 + + IL_0003: ldarg.1 + IL_0004: brfalse.s IL_0044 + + IL_0006: ldarg.0 + IL_0007: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_000c: ldarg.1 + IL_000d: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_0012: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericEqualityERj__TPar'>(!!0, + !!0) + IL_0017: brfalse.s IL_0042 + + IL_0019: ldarg.0 + IL_001a: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_001f: ldarg.1 + IL_0020: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_0025: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericEqualityERj__TPar'>(!!0, + !!0) + IL_002a: brfalse.s IL_0040 + + IL_002c: ldarg.0 + IL_002d: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_0032: ldarg.1 + IL_0033: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_0038: tail. + IL_003a: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericEqualityERj__TPar'>(!!0, + !!0) + IL_003f: ret + + IL_0040: ldc.i4.0 + IL_0041: ret + + IL_0042: ldc.i4.0 + IL_0043: ret + + IL_0044: ldc.i4.0 + IL_0045: ret + + IL_0046: ldarg.1 + IL_0047: ldnull + IL_0048: cgt.un + IL_004a: ldc.i4.0 + IL_004b: ceq + IL_004d: ret + } + + .method public hidebysig virtual final instance bool Equals(object obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 4 + .locals init (class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> V_0) + IL_0000: ldarg.1 + IL_0001: isinst class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0014 + + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: tail. + IL_000e: callvirt instance bool class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::Equals(class '<>f__AnonymousType2430756162`3') + IL_0013: ret + + IL_0014: ldc.i4.0 + IL_0015: ret + } + + .property instance !'j__TPar' A() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) + .get instance !'j__TPar' '<>f__AnonymousType2430756162`3'::get_A() + } + .property instance !'j__TPar' B() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 ) + .get instance !'j__TPar' '<>f__AnonymousType2430756162`3'::get_B() + } + .property instance !'j__TPar' C() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 02 00 00 00 00 00 ) + .get instance !'j__TPar' '<>f__AnonymousType2430756162`3'::get_C() + } +} + +.class private auto ansi serializable sealed System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes + extends [runtime]System.Enum +{ + .custom instance void [runtime]System.FlagsAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public specialname rtspecialname int32 value__ + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes All = int32(0xFFFFFFFF) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes None = int32(0x00000000) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicParameterlessConstructor = int32(0x00000001) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicConstructors = int32(0x00000003) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicConstructors = int32(0x00000004) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicMethods = int32(0x00000008) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicMethods = int32(0x00000010) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicFields = int32(0x00000020) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicFields = int32(0x00000040) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicNestedTypes = int32(0x00000080) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicNestedTypes = int32(0x00000100) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicProperties = int32(0x00000200) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicProperties = int32(0x00000400) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicEvents = int32(0x00000800) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicEvents = int32(0x00001000) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes Interfaces = int32(0x00002000) +} + +.class private auto ansi beforefieldinit System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field private valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field private class [runtime]System.Type Type@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname + instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, + class [runtime]System.Type Type) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ + IL_0014: ret + } + + .method public hidebysig specialname instance class [runtime]System.Type get_Type() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ + IL_0006: ret + } + + .method public hidebysig specialname instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes get_MemberType() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ + IL_0006: ret + } + + .property instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes + MemberType() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_MemberType() + } + .property instance class [runtime]System.Type + Type() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_Type() + } +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8[] NullableFlags + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 scalarByteValue) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldc.i4.1 + IL_0008: newarr [runtime]System.Byte + IL_000d: dup + IL_000e: ldc.i4.0 + IL_000f: ldarg.1 + IL_0010: stelem.i1 + IL_0011: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_0016: ret + } + + .method public specialname rtspecialname instance void .ctor(uint8[] NullableFlags) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_000d: ret + } + +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableContextAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8 Flag + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 Flag) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8 System.Runtime.CompilerServices.NullableContextAttribute::Flag + IL_000d: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/AnonRecords.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/AnonRecords.fs.il.netcore.bsl new file mode 100644 index 00000000000..67f941bd5bc --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/AnonRecords.fs.il.netcore.bsl @@ -0,0 +1,743 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field static assembly class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 maybeListOfMaybeString@5 + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public specialname static int32 get_justInt() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.s 42 + IL_0002: ret + } + + .method public specialname static string get_maybeString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + } + + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_maybeListOfMaybeString() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 MyTestModule::maybeListOfMaybeString@5 + IL_0005: ret + } + + .method public static class '<>f__AnonymousType2430756162`3',int32> giveMeA() cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 04 00 00 00 01 02 02 02 00 00 ) + + .maxstack 8 + IL_0000: call string MyTestModule::get_maybeString() + IL_0005: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 MyTestModule::get_maybeListOfMaybeString() + IL_000a: call int32 MyTestModule::get_justInt() + IL_000f: newobj instance void class '<>f__AnonymousType2430756162`3',int32>::.ctor(!0, + !1, + !2) + IL_0014: ret + } + + .method public static class '<>f__AnonymousType2430756162`3' giveMeB() cil managed + { + + .maxstack 8 + IL_0000: call int32 MyTestModule::get_justInt() + IL_0005: call int32 MyTestModule::get_justInt() + IL_000a: call int32 MyTestModule::get_justInt() + IL_000f: newobj instance void class '<>f__AnonymousType2430756162`3'::.ctor(!0, + !1, + !2) + IL_0014: ret + } + + .method public static class '<>f__AnonymousType2430756162`3' giveMeC() cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 04 00 00 00 01 02 02 02 00 00 ) + + .maxstack 8 + IL_0000: call string MyTestModule::get_maybeString() + IL_0005: call string MyTestModule::get_maybeString() + IL_000a: call string MyTestModule::get_maybeString() + IL_000f: newobj instance void class '<>f__AnonymousType2430756162`3'::.ctor(!0, + !1, + !2) + IL_0014: ret + } + + .method public static string[] threeHappyStrings() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.3 + IL_0001: newarr [runtime]System.String + IL_0006: dup + IL_0007: ldc.i4.0 + IL_0008: call class '<>f__AnonymousType2430756162`3',int32> MyTestModule::giveMeA() + IL_000d: callvirt instance string [runtime]System.Object::ToString() + IL_0012: stelem [runtime]System.String + IL_0017: dup + IL_0018: ldc.i4.1 + IL_0019: call class '<>f__AnonymousType2430756162`3' MyTestModule::giveMeB() + IL_001e: callvirt instance string [runtime]System.Object::ToString() + IL_0023: stelem [runtime]System.String + IL_0028: dup + IL_0029: ldc.i4.2 + IL_002a: call class '<>f__AnonymousType2430756162`3' MyTestModule::giveMeC() + IL_002f: callvirt instance string [runtime]System.Object::ToString() + IL_0034: stelem [runtime]System.String + IL_0039: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$MyTestModule::init@ + IL_0006: ldsfld int32 ''.$MyTestModule::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call string MyTestModule::get_maybeString() + IL_0005: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_000a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_000f: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 MyTestModule::maybeListOfMaybeString@5 + IL_0014: ret + } + + .property int32 justInt() + { + .get int32 MyTestModule::get_justInt() + } + .property string maybeString() + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .get string MyTestModule::get_maybeString() + } + .property class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + maybeListOfMaybeString() + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 MyTestModule::get_maybeListOfMaybeString() + } +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void MyTestModule::staticInitialization@() + IL_0005: ret + } + +} + +.class public auto ansi serializable sealed beforefieldinit '<>f__AnonymousType2430756162`3'<'j__TPar','j__TPar','j__TPar'> + extends [runtime]System.Object + implements [runtime]System.Collections.IStructuralComparable, + [runtime]System.IComparable, + class [runtime]System.IComparable`1f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>>, + [runtime]System.Collections.IStructuralEquatable, + class [runtime]System.IEquatable`1f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>> +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 02 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field private !'j__TPar' A@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field private !'j__TPar' B@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field private !'j__TPar' C@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public specialname rtspecialname + instance void .ctor(!'j__TPar' A, + !'j__TPar' B, + !'j__TPar' C) cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 1E 3C 3E 66 5F 5F 41 6E 6F 6E + 79 6D 6F 75 73 54 79 70 65 32 34 33 30 37 35 36 + 31 36 32 60 33 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_0014: ldarg.0 + IL_0015: ldarg.3 + IL_0016: stfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_001b: ret + } + + .method public hidebysig specialname instance !'j__TPar' get_A() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_0006: ret + } + + .method public hidebysig specialname instance !'j__TPar' get_B() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_0006: ret + } + + .method public hidebysig specialname instance !'j__TPar' get_C() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_0006: ret + } + + .method public strict virtual instance string ToString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>,string>,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToStringf__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>,string>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>,string>::Invoke(!0) + IL_0015: ret + } + + .method public hidebysig virtual final instance int32 CompareTo(class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (int32 V_0, + int32 V_1) + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0067 + + IL_0003: ldarg.1 + IL_0004: brfalse.s IL_0065 + + IL_0006: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_000b: ldarg.0 + IL_000c: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_0011: ldarg.1 + IL_0012: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_0017: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericComparisonWithComparerj__TPar'>(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_001c: stloc.0 + IL_001d: ldloc.0 + IL_001e: ldc.i4.0 + IL_001f: bge.s IL_0023 + + IL_0021: ldloc.0 + IL_0022: ret + + IL_0023: ldloc.0 + IL_0024: ldc.i4.0 + IL_0025: ble.s IL_0029 + + IL_0027: ldloc.0 + IL_0028: ret + + IL_0029: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_002e: ldarg.0 + IL_002f: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_0034: ldarg.1 + IL_0035: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_003a: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericComparisonWithComparerj__TPar'>(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_003f: stloc.1 + IL_0040: ldloc.1 + IL_0041: ldc.i4.0 + IL_0042: bge.s IL_0046 + + IL_0044: ldloc.1 + IL_0045: ret + + IL_0046: ldloc.1 + IL_0047: ldc.i4.0 + IL_0048: ble.s IL_004c + + IL_004a: ldloc.1 + IL_004b: ret + + IL_004c: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0051: ldarg.0 + IL_0052: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_0057: ldarg.1 + IL_0058: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_005d: tail. + IL_005f: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericComparisonWithComparerj__TPar'>(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_0064: ret + + IL_0065: ldc.i4.1 + IL_0066: ret + + IL_0067: ldarg.1 + IL_0068: brfalse.s IL_006c + + IL_006a: ldc.i4.m1 + IL_006b: ret + + IL_006c: ldc.i4.0 + IL_006d: ret + } + + .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: unbox.any class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> + IL_0007: tail. + IL_0009: callvirt instance int32 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::CompareTo(class '<>f__AnonymousType2430756162`3') + IL_000e: ret + } + + .method public hidebysig virtual final + instance int32 CompareTo(object obj, + class [runtime]System.Collections.IComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 5 + .locals init (class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> V_0, + class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> V_1, + int32 V_2, + int32 V_3) + IL_0000: ldarg.1 + IL_0001: unbox.any class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: stloc.1 + IL_0009: ldarg.0 + IL_000a: brfalse.s IL_0069 + + IL_000c: ldarg.1 + IL_000d: unbox.any class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> + IL_0012: brfalse.s IL_0067 + + IL_0014: ldarg.2 + IL_0015: ldarg.0 + IL_0016: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_001b: ldloc.1 + IL_001c: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_0021: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericComparisonWithComparerj__TPar'>(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_0026: stloc.2 + IL_0027: ldloc.2 + IL_0028: ldc.i4.0 + IL_0029: bge.s IL_002d + + IL_002b: ldloc.2 + IL_002c: ret + + IL_002d: ldloc.2 + IL_002e: ldc.i4.0 + IL_002f: ble.s IL_0033 + + IL_0031: ldloc.2 + IL_0032: ret + + IL_0033: ldarg.2 + IL_0034: ldarg.0 + IL_0035: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_003a: ldloc.1 + IL_003b: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_0040: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericComparisonWithComparerj__TPar'>(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_0045: stloc.3 + IL_0046: ldloc.3 + IL_0047: ldc.i4.0 + IL_0048: bge.s IL_004c + + IL_004a: ldloc.3 + IL_004b: ret + + IL_004c: ldloc.3 + IL_004d: ldc.i4.0 + IL_004e: ble.s IL_0052 + + IL_0050: ldloc.3 + IL_0051: ret + + IL_0052: ldarg.2 + IL_0053: ldarg.0 + IL_0054: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_0059: ldloc.1 + IL_005a: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_005f: tail. + IL_0061: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericComparisonWithComparerj__TPar'>(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_0066: ret + + IL_0067: ldc.i4.1 + IL_0068: ret + + IL_0069: ldarg.1 + IL_006a: unbox.any class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> + IL_006f: brfalse.s IL_0073 + + IL_0071: ldc.i4.m1 + IL_0072: ret + + IL_0073: ldc.i4.0 + IL_0074: ret + } + + .method public hidebysig virtual final instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 7 + .locals init (int32 V_0) + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0058 + + IL_0003: ldc.i4.0 + IL_0004: stloc.0 + IL_0005: ldc.i4 0x9e3779b9 + IL_000a: ldarg.1 + IL_000b: ldarg.0 + IL_000c: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_0011: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericHashWithComparerj__TPar'>(class [runtime]System.Collections.IEqualityComparer, + !!0) + IL_0016: ldloc.0 + IL_0017: ldc.i4.6 + IL_0018: shl + IL_0019: ldloc.0 + IL_001a: ldc.i4.2 + IL_001b: shr + IL_001c: add + IL_001d: add + IL_001e: add + IL_001f: stloc.0 + IL_0020: ldc.i4 0x9e3779b9 + IL_0025: ldarg.1 + IL_0026: ldarg.0 + IL_0027: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_002c: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericHashWithComparerj__TPar'>(class [runtime]System.Collections.IEqualityComparer, + !!0) + IL_0031: ldloc.0 + IL_0032: ldc.i4.6 + IL_0033: shl + IL_0034: ldloc.0 + IL_0035: ldc.i4.2 + IL_0036: shr + IL_0037: add + IL_0038: add + IL_0039: add + IL_003a: stloc.0 + IL_003b: ldc.i4 0x9e3779b9 + IL_0040: ldarg.1 + IL_0041: ldarg.0 + IL_0042: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_0047: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericHashWithComparerj__TPar'>(class [runtime]System.Collections.IEqualityComparer, + !!0) + IL_004c: ldloc.0 + IL_004d: ldc.i4.6 + IL_004e: shl + IL_004f: ldloc.0 + IL_0050: ldc.i4.2 + IL_0051: shr + IL_0052: add + IL_0053: add + IL_0054: add + IL_0055: stloc.0 + IL_0056: ldloc.0 + IL_0057: ret + + IL_0058: ldc.i4.0 + IL_0059: ret + } + + .method public hidebysig virtual final instance int32 GetHashCode() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call class [runtime]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: tail. + IL_0008: callvirt instance int32 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::GetHashCode(class [runtime]System.Collections.IEqualityComparer) + IL_000d: ret + } + + .method public hidebysig instance bool + Equals(class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> obj, + class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> V_0) + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_004b + + IL_0003: ldarg.1 + IL_0004: brfalse.s IL_0049 + + IL_0006: ldarg.1 + IL_0007: stloc.0 + IL_0008: ldarg.2 + IL_0009: ldarg.0 + IL_000a: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_000f: ldloc.0 + IL_0010: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_0015: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericEqualityWithComparerj__TPar'>(class [runtime]System.Collections.IEqualityComparer, + !!0, + !!0) + IL_001a: brfalse.s IL_0047 + + IL_001c: ldarg.2 + IL_001d: ldarg.0 + IL_001e: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_0023: ldloc.0 + IL_0024: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_0029: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericEqualityWithComparerj__TPar'>(class [runtime]System.Collections.IEqualityComparer, + !!0, + !!0) + IL_002e: brfalse.s IL_0045 + + IL_0030: ldarg.2 + IL_0031: ldarg.0 + IL_0032: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_0037: ldloc.0 + IL_0038: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_003d: tail. + IL_003f: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericEqualityWithComparerj__TPar'>(class [runtime]System.Collections.IEqualityComparer, + !!0, + !!0) + IL_0044: ret + + IL_0045: ldc.i4.0 + IL_0046: ret + + IL_0047: ldc.i4.0 + IL_0048: ret + + IL_0049: ldc.i4.0 + IL_004a: ret + + IL_004b: ldarg.1 + IL_004c: ldnull + IL_004d: cgt.un + IL_004f: ldc.i4.0 + IL_0050: ceq + IL_0052: ret + } + + .method public hidebysig virtual final + instance bool Equals(object obj, + class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 5 + .locals init (class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> V_0) + IL_0000: ldarg.1 + IL_0001: isinst class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0015 + + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: ldarg.2 + IL_000d: tail. + IL_000f: callvirt instance bool class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::Equals(class '<>f__AnonymousType2430756162`3', + class [runtime]System.Collections.IEqualityComparer) + IL_0014: ret + + IL_0015: ldc.i4.0 + IL_0016: ret + } + + .method public hidebysig virtual final instance bool Equals(class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0046 + + IL_0003: ldarg.1 + IL_0004: brfalse.s IL_0044 + + IL_0006: ldarg.0 + IL_0007: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_000c: ldarg.1 + IL_000d: ldfld !0 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::A@ + IL_0012: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericEqualityERj__TPar'>(!!0, + !!0) + IL_0017: brfalse.s IL_0042 + + IL_0019: ldarg.0 + IL_001a: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_001f: ldarg.1 + IL_0020: ldfld !1 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::B@ + IL_0025: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericEqualityERj__TPar'>(!!0, + !!0) + IL_002a: brfalse.s IL_0040 + + IL_002c: ldarg.0 + IL_002d: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_0032: ldarg.1 + IL_0033: ldfld !2 class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::C@ + IL_0038: tail. + IL_003a: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::GenericEqualityERj__TPar'>(!!0, + !!0) + IL_003f: ret + + IL_0040: ldc.i4.0 + IL_0041: ret + + IL_0042: ldc.i4.0 + IL_0043: ret + + IL_0044: ldc.i4.0 + IL_0045: ret + + IL_0046: ldarg.1 + IL_0047: ldnull + IL_0048: cgt.un + IL_004a: ldc.i4.0 + IL_004b: ceq + IL_004d: ret + } + + .method public hidebysig virtual final instance bool Equals(object obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 4 + .locals init (class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> V_0) + IL_0000: ldarg.1 + IL_0001: isinst class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0014 + + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: tail. + IL_000e: callvirt instance bool class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'>::Equals(class '<>f__AnonymousType2430756162`3') + IL_0013: ret + + IL_0014: ldc.i4.0 + IL_0015: ret + } + + .property instance !'j__TPar' A() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) + .get instance !'j__TPar' '<>f__AnonymousType2430756162`3'::get_A() + } + .property instance !'j__TPar' B() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 ) + .get instance !'j__TPar' '<>f__AnonymousType2430756162`3'::get_B() + } + .property instance !'j__TPar' C() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 02 00 00 00 00 00 ) + .get instance !'j__TPar' '<>f__AnonymousType2430756162`3'::get_C() + } +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CsharpConsumer.cs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CsharpConsumer.cs new file mode 100644 index 00000000000..98651ec292f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CsharpConsumer.cs @@ -0,0 +1,32 @@ +namespace CsharpNamespace +{ +#nullable enable + public static class CsharpClass + { + public static string MyApiWhichHatesNulls(string x) + { + return x.Length.ToString(); + } + + public static string JustUseAllOfItHere() + { + var thisShouldWarn = MyTestModule.nonNullableInputOutputFunc(null); + var thisIsPossiblyNullAndIsOk = MyTestModule.nullableStringInputOutputFunc(thisShouldWarn); + var thereforeThisShouldWarnAgain = MyTestModule.nonNullableInputOutputFunc(thisIsPossiblyNullAndIsOk); + + string? nullString = null; + + var myStructTuple = (nullString,nullString,1,2,3,4); + var thisShouldBeAWarningForSecondTypar = MyTestModule.genericValueTypeTest(myStructTuple); + var thisShouldNotSayAnything = MyTestModule.genericValueTypeTest(("I am not null",null,1,2,3,4)); + var thisShouldWarnFor2ndItem = MyTestModule.nonNullableInputOutputFunc(thisShouldNotSayAnything.Item2); + var thisIsOkBecauseItem1IsNotNullable = MyTestModule.nonNullableInputOutputFunc(thisShouldNotSayAnything.Item1); + + var refTuple = MyTestModule.genericRefTypeTest(nullString,nullString,1,2,3,4); + MyTestModule.genericRefTypeTest(refTuple.Item2,refTuple.Item2,1,2,3,4); + + + return MyTestModule.multiArgumentTest(null,null); + } + } +} \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CurriedFunctions.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CurriedFunctions.fs new file mode 100644 index 00000000000..4c876b042a8 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CurriedFunctions.fs @@ -0,0 +1,10 @@ +module MyTestModule + +type Maybe<'T when 'T: not struct> = 'T | null +type MaybeString = string | null + +let curried3Func (a:MaybeString) (b:string) (c:int) = (a,b,c) + +let partiallyApplied (propperString:string) = curried3Func propperString + +let secondOutOfTriple (a,b,c) d e : Maybe<_> = b \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CurriedFunctions.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CurriedFunctions.fs.il.net472.bsl new file mode 100644 index 00000000000..a3f867ad5a4 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CurriedFunctions.fs.il.net472.bsl @@ -0,0 +1,204 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit partiallyApplied@8 + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3> + { + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field public string propperString + .method assembly specialname rtspecialname instance void .ctor(string propperString) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld string MyTestModule/partiallyApplied@8::propperString + IL_000d: ret + } + + .method public strict virtual instance class [runtime]System.Tuple`3 + Invoke(string b, + int32 c) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string MyTestModule/partiallyApplied@8::propperString + IL_0006: ldarg.1 + IL_0007: ldarg.2 + IL_0008: newobj instance void class [runtime]System.Tuple`3::.ctor(!0, + !1, + !2) + IL_000d: ret + } + + } + + .method public static class [runtime]System.Tuple`3 + curried3Func(string a, + string b, + int32 c) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 01 02 01 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: newobj instance void class [runtime]System.Tuple`3::.ctor(!0, + !1, + !2) + IL_0008: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> partiallyApplied(string propperString) cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 06 00 00 00 01 01 01 01 02 01 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void MyTestModule/partiallyApplied@8::.ctor(string) + IL_0006: ret + } + + .method public static !!b secondOutOfTriple(!!a a, + !!b b, + !!c c, + !!d d, + !!e e) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 03 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + .param type a + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + .param type b + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param type c + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + .param type d + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + .param type e + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [2] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ret + } + +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8[] NullableFlags + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 scalarByteValue) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldc.i4.1 + IL_0008: newarr [runtime]System.Byte + IL_000d: dup + IL_000e: ldc.i4.0 + IL_000f: ldarg.1 + IL_0010: stelem.i1 + IL_0011: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_0016: ret + } + + .method public specialname rtspecialname instance void .ctor(uint8[] NullableFlags) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_000d: ret + } + +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableContextAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8 Flag + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 Flag) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8 System.Runtime.CompilerServices.NullableContextAttribute::Flag + IL_000d: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CurriedFunctions.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CurriedFunctions.fs.il.netcore.bsl new file mode 100644 index 00000000000..2603c253538 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CurriedFunctions.fs.il.netcore.bsl @@ -0,0 +1,138 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit partiallyApplied@8 + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3> + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field public string propperString + .method assembly specialname rtspecialname instance void .ctor(string propperString) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld string MyTestModule/partiallyApplied@8::propperString + IL_000d: ret + } + + .method public strict virtual instance class [runtime]System.Tuple`3 + Invoke(string b, + int32 c) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string MyTestModule/partiallyApplied@8::propperString + IL_0006: ldarg.1 + IL_0007: ldarg.2 + IL_0008: newobj instance void class [runtime]System.Tuple`3::.ctor(!0, + !1, + !2) + IL_000d: ret + } + + } + + .method public static class [runtime]System.Tuple`3 + curried3Func(string a, + string b, + int32 c) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 01 02 01 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: newobj instance void class [runtime]System.Tuple`3::.ctor(!0, + !1, + !2) + IL_0008: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> partiallyApplied(string propperString) cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 06 00 00 00 01 01 01 01 02 01 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void MyTestModule/partiallyApplied@8::.ctor(string) + IL_0006: ret + } + + .method public static !!b secondOutOfTriple(!!a a, + !!b b, + !!c c, + !!d d, + !!e e) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 03 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + .param type a + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + .param type b + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param type c + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + .param type d + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + .param type e + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [2] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ret + } + +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomPipe.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomPipe.fs new file mode 100644 index 00000000000..73fe562b29f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomPipe.fs @@ -0,0 +1,3 @@ +module MyTestModule + +let inline myCustomPipeFunc arg func = func arg \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomPipe.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomPipe.fs.il.net472.bsl new file mode 100644 index 00000000000..f057362bee0 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomPipe.fs.il.net472.bsl @@ -0,0 +1,123 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .method public static !!b myassemblyFunc(!!a arg, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 func) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + .param type a + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + .param type b + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: tail. + IL_0004: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0009: ret + } + +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8[] NullableFlags + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 scalarByteValue) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldc.i4.1 + IL_0008: newarr [runtime]System.Byte + IL_000d: dup + IL_000e: ldc.i4.0 + IL_000f: ldarg.1 + IL_0010: stelem.i1 + IL_0011: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_0016: ret + } + + .method public specialname rtspecialname instance void .ctor(uint8[] NullableFlags) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_000d: ret + } + +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableContextAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8 Flag + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 Flag) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8 System.Runtime.CompilerServices.NullableContextAttribute::Flag + IL_000d: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomPipe.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomPipe.fs.il.netcore.bsl new file mode 100644 index 00000000000..cb9e545989f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomPipe.fs.il.netcore.bsl @@ -0,0 +1,58 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .method public static !!b myassemblyFunc(!!a arg, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 func) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + .param type a + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + .param type b + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: tail. + IL_0004: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0009: ret + } + +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomType.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomType.fs new file mode 100644 index 00000000000..2e52933d1fe --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomType.fs @@ -0,0 +1,25 @@ +module rec MyTestModule + +type MaybeString = string | null +type MaybeMyCustomType = (MyCustomType | null) + +type MyCustomType (x: MaybeString, y: string) = + + static let mutable uglyGlobalMutableString : string = "" + static let mutable uglyGlobalMutableNullableString : MaybeString = null + static let mutable dict : Map = Map.empty + + member val Nullable = x + member val NonNullable = y + member val JustSomeInt = 42 + + static member GiveMeNull() : MaybeString = null + static member GiveMeString() : string = "" + + member this.UnitFunc() = () + member this.GetThis() = this + member this.GetThisOrNull() : MaybeMyCustomType = null + + member this.Item + with get (index) = dict.[index] + and set index value = dict <- dict.Add(index,value) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomType.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomType.fs.il.net472.bsl new file mode 100644 index 00000000000..1437ae540da --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomType.fs.il.net472.bsl @@ -0,0 +1,369 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class auto ansi serializable nested public Myassembly + extends [runtime]System.Object + { + .custom instance void [runtime]System.Reflection.DefaultMemberAttribute::.ctor(string) = ( 01 00 04 49 74 65 6D 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field static assembly string uglyGlobalMutableString + .field static assembly string uglyGlobalMutableNullableString + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .field static assembly class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 dict + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 01 02 02 00 00 ) + .field assembly string Nullable@ + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .field assembly string NonNullable@ + .field assembly int32 JustSomeInt@ + .field static assembly int32 init@6 + .method public specialname rtspecialname + instance void .ctor(string x, + string y) cil managed + { + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: stfld string MyTestModule/Myassembly::Nullable@ + IL_000f: ldarg.0 + IL_0010: ldarg.2 + IL_0011: stfld string MyTestModule/Myassembly::NonNullable@ + IL_0016: ldarg.0 + IL_0017: ldc.i4.s 42 + IL_0019: stfld int32 MyTestModule/Myassembly::JustSomeInt@ + IL_001e: ret + } + + .method public hidebysig specialname instance string get_Nullable() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string MyTestModule/Myassembly::Nullable@ + IL_0006: ret + } + + .method public hidebysig specialname instance string get_NonNullable() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string MyTestModule/Myassembly::NonNullable@ + IL_0006: ret + } + + .method public hidebysig specialname instance int32 get_JustSomeInt() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 MyTestModule/Myassembly::JustSomeInt@ + IL_0006: ret + } + + .method public static string GiveMeNull() cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + } + + .method public static string GiveMeString() cil managed + { + + .maxstack 8 + IL_0000: ldstr "" + IL_0005: ret + } + + .method public hidebysig instance void UnitFunc() cil managed + { + + .maxstack 8 + IL_0000: ret + } + + .method public hidebysig instance class MyTestModule/Myassembly GetThis() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public hidebysig instance class MyTestModule/Myassembly GetThisOrNull() cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + } + + .method public hidebysig specialname instance string get_Item(string index) cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: volatile. + IL_0002: ldsfld int32 MyTestModule/Myassembly::init@6 + IL_0007: ldc.i4.4 + IL_0008: bge.s IL_0011 + + IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() + IL_000f: br.s IL_0011 + + IL_0011: ldsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 MyTestModule/Myassembly::dict + IL_0016: ldarg.1 + IL_0017: tail. + IL_0019: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2::get_Item(!0) + IL_001e: ret + } + + .method public hidebysig specialname + instance void set_Item(string index, + string 'value') cil managed + { + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [2] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: volatile. + IL_0002: ldsfld int32 MyTestModule/Myassembly::init@6 + IL_0007: ldc.i4.4 + IL_0008: bge.s IL_0011 + + IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() + IL_000f: br.s IL_0011 + + IL_0011: volatile. + IL_0013: ldsfld int32 MyTestModule/Myassembly::init@6 + IL_0018: ldc.i4.4 + IL_0019: bge.s IL_0022 + + IL_001b: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() + IL_0020: br.s IL_0022 + + IL_0022: ldsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 MyTestModule/Myassembly::dict + IL_0027: ldarg.1 + IL_0028: ldarg.2 + IL_0029: callvirt instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2::Add(!0, + !1) + IL_002e: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 MyTestModule/Myassembly::dict + IL_0033: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$MyTestModule::init@ + IL_0006: ldsfld int32 ''.$MyTestModule::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldstr "" + IL_0005: stsfld string MyTestModule/Myassembly::uglyGlobalMutableString + IL_000a: ldc.i4.2 + IL_000b: volatile. + IL_000d: stsfld int32 MyTestModule/Myassembly::init@6 + IL_0012: ldnull + IL_0013: stsfld string MyTestModule/Myassembly::uglyGlobalMutableNullableString + IL_0018: ldc.i4.3 + IL_0019: volatile. + IL_001b: stsfld int32 MyTestModule/Myassembly::init@6 + IL_0020: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::Empty() + IL_0025: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 MyTestModule/Myassembly::dict + IL_002a: ldc.i4.4 + IL_002b: volatile. + IL_002d: stsfld int32 MyTestModule/Myassembly::init@6 + IL_0032: ret + } + + .property instance string Nullable() + { + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .get instance string MyTestModule/Myassembly::get_Nullable() + } + .property instance string NonNullable() + { + .get instance string MyTestModule/Myassembly::get_NonNullable() + } + .property instance int32 JustSomeInt() + { + .get instance int32 MyTestModule/Myassembly::get_JustSomeInt() + } + .property instance string Item(string) + { + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .set instance void MyTestModule/Myassembly::set_Item(string, + string) + .get instance string MyTestModule/Myassembly::get_Item(string) + } + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$MyTestModule::init@ + IL_0006: ldsfld int32 ''.$MyTestModule::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void MyTestModule/Myassembly::staticInitialization@() + IL_0005: ret + } + +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void MyTestModule::staticInitialization@() + IL_0005: ret + } + +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8[] NullableFlags + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 scalarByteValue) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldc.i4.1 + IL_0008: newarr [runtime]System.Byte + IL_000d: dup + IL_000e: ldc.i4.0 + IL_000f: ldarg.1 + IL_0010: stelem.i1 + IL_0011: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_0016: ret + } + + .method public specialname rtspecialname instance void .ctor(uint8[] NullableFlags) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_000d: ret + } + +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableContextAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8 Flag + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 Flag) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8 System.Runtime.CompilerServices.NullableContextAttribute::Flag + IL_000d: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomType.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomType.fs.il.netcore.bsl new file mode 100644 index 00000000000..d745d891234 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/CustomType.fs.il.netcore.bsl @@ -0,0 +1,303 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class auto ansi serializable nested public Myassembly + extends [runtime]System.Object + { + .custom instance void [runtime]System.Reflection.DefaultMemberAttribute::.ctor(string) = ( 01 00 04 49 74 65 6D 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field static assembly string uglyGlobalMutableString + .field static assembly string uglyGlobalMutableNullableString + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .field static assembly class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 dict + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 01 02 02 00 00 ) + .field assembly string Nullable@ + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .field assembly string NonNullable@ + .field assembly int32 JustSomeInt@ + .field static assembly int32 init@6 + .method public specialname rtspecialname + instance void .ctor(string x, + string y) cil managed + { + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: stfld string MyTestModule/Myassembly::Nullable@ + IL_000f: ldarg.0 + IL_0010: ldarg.2 + IL_0011: stfld string MyTestModule/Myassembly::NonNullable@ + IL_0016: ldarg.0 + IL_0017: ldc.i4.s 42 + IL_0019: stfld int32 MyTestModule/Myassembly::JustSomeInt@ + IL_001e: ret + } + + .method public hidebysig specialname instance string get_Nullable() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string MyTestModule/Myassembly::Nullable@ + IL_0006: ret + } + + .method public hidebysig specialname instance string get_NonNullable() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string MyTestModule/Myassembly::NonNullable@ + IL_0006: ret + } + + .method public hidebysig specialname instance int32 get_JustSomeInt() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 MyTestModule/Myassembly::JustSomeInt@ + IL_0006: ret + } + + .method public static string GiveMeNull() cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + } + + .method public static string GiveMeString() cil managed + { + + .maxstack 8 + IL_0000: ldstr "" + IL_0005: ret + } + + .method public hidebysig instance void UnitFunc() cil managed + { + + .maxstack 8 + IL_0000: ret + } + + .method public hidebysig instance class MyTestModule/Myassembly GetThis() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public hidebysig instance class MyTestModule/Myassembly GetThisOrNull() cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + } + + .method public hidebysig specialname instance string get_Item(string index) cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: volatile. + IL_0002: ldsfld int32 MyTestModule/Myassembly::init@6 + IL_0007: ldc.i4.4 + IL_0008: bge.s IL_0011 + + IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() + IL_000f: br.s IL_0011 + + IL_0011: ldsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 MyTestModule/Myassembly::dict + IL_0016: ldarg.1 + IL_0017: tail. + IL_0019: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2::get_Item(!0) + IL_001e: ret + } + + .method public hidebysig specialname + instance void set_Item(string index, + string 'value') cil managed + { + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [2] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: volatile. + IL_0002: ldsfld int32 MyTestModule/Myassembly::init@6 + IL_0007: ldc.i4.4 + IL_0008: bge.s IL_0011 + + IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() + IL_000f: br.s IL_0011 + + IL_0011: volatile. + IL_0013: ldsfld int32 MyTestModule/Myassembly::init@6 + IL_0018: ldc.i4.4 + IL_0019: bge.s IL_0022 + + IL_001b: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() + IL_0020: br.s IL_0022 + + IL_0022: ldsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 MyTestModule/Myassembly::dict + IL_0027: ldarg.1 + IL_0028: ldarg.2 + IL_0029: callvirt instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2::Add(!0, + !1) + IL_002e: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 MyTestModule/Myassembly::dict + IL_0033: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$MyTestModule::init@ + IL_0006: ldsfld int32 ''.$MyTestModule::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldstr "" + IL_0005: stsfld string MyTestModule/Myassembly::uglyGlobalMutableString + IL_000a: ldc.i4.2 + IL_000b: volatile. + IL_000d: stsfld int32 MyTestModule/Myassembly::init@6 + IL_0012: ldnull + IL_0013: stsfld string MyTestModule/Myassembly::uglyGlobalMutableNullableString + IL_0018: ldc.i4.3 + IL_0019: volatile. + IL_001b: stsfld int32 MyTestModule/Myassembly::init@6 + IL_0020: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::Empty() + IL_0025: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 MyTestModule/Myassembly::dict + IL_002a: ldc.i4.4 + IL_002b: volatile. + IL_002d: stsfld int32 MyTestModule/Myassembly::init@6 + IL_0032: ret + } + + .property instance string Nullable() + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .get instance string MyTestModule/Myassembly::get_Nullable() + } + .property instance string NonNullable() + { + .get instance string MyTestModule/Myassembly::get_NonNullable() + } + .property instance int32 JustSomeInt() + { + .get instance int32 MyTestModule/Myassembly::get_JustSomeInt() + } + .property instance string Item(string) + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .set instance void MyTestModule/Myassembly::set_Item(string, + string) + .get instance string MyTestModule/Myassembly::get_Item(string) + } + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$MyTestModule::init@ + IL_0006: ldsfld int32 ''.$MyTestModule::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void MyTestModule/Myassembly::staticInitialization@() + IL_0005: ret + } + +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void MyTestModule::staticInitialization@() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericStructDu.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericStructDu.fs new file mode 100644 index 00000000000..cf72987cafb --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericStructDu.fs @@ -0,0 +1,11 @@ +module TestModule + +[] +type MyStructOption<'T when 'T: not null> = + | MyStructNone + | MyStructSome of nestedGenericField : list> * notNullField2 : string * canBeNullField : (string | null) * notNullField1 : 'T + +let mapStructContents f myOpt = + match myOpt with + | MyStructNone -> MyStructNone + | MyStructSome(ngf,s,ns,x) -> MyStructSome (ngf,s,ns,f x) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericStructDu.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericStructDu.fs.il.net472.bsl new file mode 100644 index 00000000000..8d49ce9610c --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericStructDu.fs.il.net472.bsl @@ -0,0 +1,626 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed TestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class sequential autochar serializable sealed nested public beforefieldinit MyStructOption`1 + extends [runtime]System.ValueType + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoEqualityAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoComparisonAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param type T + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class abstract auto ansi sealed nested public Tags + extends [runtime]System.Object + { + .param type T + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field public static literal int32 MyStructNone = int32(0x00000000) + .field public static literal int32 MyStructSome = int32(0x00000001) + } + + .field assembly class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> _nestedGenericField + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field assembly string _notNullField2 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field assembly string _canBeNullField + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field assembly !T _notNullField1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field assembly int32 _tag + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static valuetype TestModule/MyStructOption`1 get_MyStructNone() cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: newobj instance void valuetype TestModule/MyStructOption`1::.ctor(int32) + IL_0006: ret + } + + .method public hidebysig instance bool get_IsMyStructNone() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance int32 valuetype TestModule/MyStructOption`1::get_Tag() + IL_0006: ldc.i4.0 + IL_0007: ceq + IL_0009: ret + } + + .method public static valuetype TestModule/MyStructOption`1 + NewMyStructSome(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> _nestedGenericField, + string _notNullField2, + string _canBeNullField, + !T _notNullField1) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 01 00 00 00 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 01 01 02 00 00 ) + .param [3] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 5 + .locals init (valuetype TestModule/MyStructOption`1 V_0) + IL_0000: ldloca.s V_0 + IL_0002: initobj valuetype TestModule/MyStructOption`1 + IL_0008: ldloca.s V_0 + IL_000a: ldc.i4.1 + IL_000b: stfld int32 valuetype TestModule/MyStructOption`1::_tag + IL_0010: ldloca.s V_0 + IL_0012: ldarg.0 + IL_0013: stfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> valuetype TestModule/MyStructOption`1::_nestedGenericField + IL_0018: ldloca.s V_0 + IL_001a: ldarg.1 + IL_001b: stfld string valuetype TestModule/MyStructOption`1::_notNullField2 + IL_0020: ldloca.s V_0 + IL_0022: ldarg.2 + IL_0023: stfld string valuetype TestModule/MyStructOption`1::_canBeNullField + IL_0028: ldloca.s V_0 + IL_002a: ldarg.3 + IL_002b: stfld !0 valuetype TestModule/MyStructOption`1::_notNullField1 + IL_0030: ldloc.0 + IL_0031: ret + } + + .method public hidebysig instance bool get_IsMyStructSome() cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::.ctor(bool, + string[]) = ( 01 00 01 04 00 00 00 0D 6E 6F 74 4E 75 6C 6C 46 + 69 65 6C 64 32 0D 6E 6F 74 4E 75 6C 6C 46 69 65 + 6C 64 31 0E 5F 6E 6F 74 4E 75 6C 6C 46 69 65 6C + 64 32 0E 5F 6E 6F 74 4E 75 6C 6C 46 69 65 6C 64 + 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance int32 valuetype TestModule/MyStructOption`1::get_Tag() + IL_0006: ldc.i4.1 + IL_0007: ceq + IL_0009: ret + } + + .method assembly specialname rtspecialname instance void .ctor(int32 _tag) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 1B 54 65 73 74 4D 6F 64 75 6C + 65 2B 4D 79 53 74 72 75 63 74 4F 70 74 69 6F 6E + 60 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stfld int32 valuetype TestModule/MyStructOption`1::_tag + IL_0007: ret + } + + .method public hidebysig instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> get_nestedGenericField() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 02 01 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> valuetype TestModule/MyStructOption`1::_nestedGenericField + IL_0006: ret + } + + .method public hidebysig instance string get_notNullField2() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string valuetype TestModule/MyStructOption`1::_notNullField2 + IL_0006: ret + } + + .method public hidebysig instance string get_canBeNullField() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string valuetype TestModule/MyStructOption`1::_canBeNullField + IL_0006: ret + } + + .method public hidebysig instance !T get_notNullField1() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !0 valuetype TestModule/MyStructOption`1::_notNullField1 + IL_0006: ret + } + + .method public hidebysig instance int32 get_Tag() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 valuetype TestModule/MyStructOption`1::_tag + IL_0006: ret + } + + .method assembly hidebysig specialname instance object __DebugDisplay() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+0.8A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,string>,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString,string>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: ldobj valuetype TestModule/MyStructOption`1 + IL_0015: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,string>::Invoke(!0) + IL_001a: ret + } + + .method public strict virtual instance string ToString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,string>,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,valuetype TestModule/MyStructOption`1>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString,string>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: ldobj valuetype TestModule/MyStructOption`1 + IL_0015: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,string>::Invoke(!0) + IL_001a: ret + } + + .property instance int32 Tag() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance int32 TestModule/MyStructOption`1::get_Tag() + } + .property valuetype TestModule/MyStructOption`1 + MyStructNone() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get valuetype TestModule/MyStructOption`1 TestModule/MyStructOption`1::get_MyStructNone() + } + .property instance bool IsMyStructNone() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool TestModule/MyStructOption`1::get_IsMyStructNone() + } + .property instance bool IsMyStructSome() + { + .custom instance void System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::.ctor(bool, + string[]) = ( 01 00 01 04 00 00 00 0D 6E 6F 74 4E 75 6C 6C 46 + 69 65 6C 64 32 0D 6E 6F 74 4E 75 6C 6C 46 69 65 + 6C 64 31 0E 5F 6E 6F 74 4E 75 6C 6C 46 69 65 6C + 64 32 0E 5F 6E 6F 74 4E 75 6C 6C 46 69 65 6C 64 + 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool TestModule/MyStructOption`1::get_IsMyStructSome() + } + .property instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> + nestedGenericField() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 02 01 02 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> TestModule/MyStructOption`1::get_nestedGenericField() + } + .property instance string notNullField2() + { + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance string TestModule/MyStructOption`1::get_notNullField2() + } + .property instance string canBeNullField() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 02 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance string TestModule/MyStructOption`1::get_canBeNullField() + } + .property instance !T notNullField1() + { + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 03 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance !T TestModule/MyStructOption`1::get_notNullField1() + } + } + + .method public static valuetype TestModule/MyStructOption`1 + mapStructContents(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + valuetype TestModule/MyStructOption`1 myOpt) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + .param type a + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param type b + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 00 01 00 00 ) + .param [2] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 00 01 00 00 ) + + .maxstack 7 + .locals init (valuetype TestModule/MyStructOption`1 V_0, + !!a V_1, + string V_2, + string V_3, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_4) + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: ldloca.s V_0 + IL_0004: call instance int32 valuetype TestModule/MyStructOption`1::get_Tag() + IL_0009: ldc.i4.1 + IL_000a: bne.un.s IL_000e + + IL_000c: br.s IL_0014 + + IL_000e: call valuetype TestModule/MyStructOption`1 valuetype TestModule/MyStructOption`1::get_MyStructNone() + IL_0013: ret + + IL_0014: ldloca.s V_0 + IL_0016: ldfld !0 valuetype TestModule/MyStructOption`1::_notNullField1 + IL_001b: stloc.1 + IL_001c: ldloca.s V_0 + IL_001e: ldfld string valuetype TestModule/MyStructOption`1::_notNullField2 + IL_0023: stloc.2 + IL_0024: ldloca.s V_0 + IL_0026: ldfld string valuetype TestModule/MyStructOption`1::_canBeNullField + IL_002b: stloc.3 + IL_002c: ldloca.s V_0 + IL_002e: ldfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> valuetype TestModule/MyStructOption`1::_nestedGenericField + IL_0033: stloc.s V_4 + IL_0035: ldloc.s V_4 + IL_0037: ldloc.2 + IL_0038: ldloc.3 + IL_0039: ldarg.0 + IL_003a: ldloc.1 + IL_003b: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0040: call valuetype TestModule/MyStructOption`1 valuetype TestModule/MyStructOption`1::NewMyStructSome(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>, + string, + string, + !0) + IL_0045: ret + } + +} + +.class private abstract auto ansi sealed ''.$TestModule + extends [runtime]System.Object +{ +} + +.class private auto ansi serializable sealed System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes + extends [runtime]System.Enum +{ + .custom instance void [runtime]System.FlagsAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public specialname rtspecialname int32 value__ + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes All = int32(0xFFFFFFFF) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes None = int32(0x00000000) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicParameterlessConstructor = int32(0x00000001) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicConstructors = int32(0x00000003) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicConstructors = int32(0x00000004) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicMethods = int32(0x00000008) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicMethods = int32(0x00000010) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicFields = int32(0x00000020) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicFields = int32(0x00000040) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicNestedTypes = int32(0x00000080) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicNestedTypes = int32(0x00000100) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicProperties = int32(0x00000200) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicProperties = int32(0x00000400) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicEvents = int32(0x00000800) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicEvents = int32(0x00001000) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes Interfaces = int32(0x00002000) +} + +.class private auto ansi beforefieldinit System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field private valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field private class [runtime]System.Type Type@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname + instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, + class [runtime]System.Type Type) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ + IL_0014: ret + } + + .method public hidebysig specialname instance class [runtime]System.Type get_Type() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ + IL_0006: ret + } + + .method public hidebysig specialname instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes get_MemberType() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ + IL_0006: ret + } + + .property instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes + MemberType() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_MemberType() + } + .property instance class [runtime]System.Type + Type() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_Type() + } +} + +.class private auto ansi beforefieldinit System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field private bool ReturnValue@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field private string[] Members@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname + instance void .ctor(bool ReturnValue, + string[] Members) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld bool System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::ReturnValue@ + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld string[] System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::Members@ + IL_0014: ret + } + + .method public hidebysig specialname instance string[] get_Members() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string[] System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::Members@ + IL_0006: ret + } + + .method public hidebysig specialname instance bool get_ReturnValue() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld bool System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::ReturnValue@ + IL_0006: ret + } + + .property instance bool ReturnValue() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance bool System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::get_ReturnValue() + } + .property instance string[] Members() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance string[] System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::get_Members() + } +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8[] NullableFlags + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 scalarByteValue) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldc.i4.1 + IL_0008: newarr [runtime]System.Byte + IL_000d: dup + IL_000e: ldc.i4.0 + IL_000f: ldarg.1 + IL_0010: stelem.i1 + IL_0011: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_0016: ret + } + + .method public specialname rtspecialname instance void .ctor(uint8[] NullableFlags) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_000d: ret + } + +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableContextAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8 Flag + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 Flag) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8 System.Runtime.CompilerServices.NullableContextAttribute::Flag + IL_000d: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericStructDu.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericStructDu.fs.il.netcore.bsl new file mode 100644 index 00000000000..a919c4eb012 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericStructDu.fs.il.netcore.bsl @@ -0,0 +1,403 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed TestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class sequential autochar serializable sealed nested public beforefieldinit MyStructOption`1 + extends [runtime]System.ValueType + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoEqualityAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoComparisonAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param type T + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class abstract auto ansi sealed nested public Tags + extends [runtime]System.Object + { + .param type T + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field public static literal int32 MyStructNone = int32(0x00000000) + .field public static literal int32 MyStructSome = int32(0x00000001) + } + + .field assembly class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> _nestedGenericField + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field assembly string _notNullField2 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field assembly string _canBeNullField + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field assembly !T _notNullField1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field assembly int32 _tag + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static valuetype TestModule/MyStructOption`1 get_MyStructNone() cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: newobj instance void valuetype TestModule/MyStructOption`1::.ctor(int32) + IL_0006: ret + } + + .method public hidebysig instance bool get_IsMyStructNone() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance int32 valuetype TestModule/MyStructOption`1::get_Tag() + IL_0006: ldc.i4.0 + IL_0007: ceq + IL_0009: ret + } + + .method public static valuetype TestModule/MyStructOption`1 + NewMyStructSome(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> _nestedGenericField, + string _notNullField2, + string _canBeNullField, + !T _notNullField1) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 01 00 00 00 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 01 01 02 00 00 ) + .param [3] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 5 + .locals init (valuetype TestModule/MyStructOption`1 V_0) + IL_0000: ldloca.s V_0 + IL_0002: initobj valuetype TestModule/MyStructOption`1 + IL_0008: ldloca.s V_0 + IL_000a: ldc.i4.1 + IL_000b: stfld int32 valuetype TestModule/MyStructOption`1::_tag + IL_0010: ldloca.s V_0 + IL_0012: ldarg.0 + IL_0013: stfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> valuetype TestModule/MyStructOption`1::_nestedGenericField + IL_0018: ldloca.s V_0 + IL_001a: ldarg.1 + IL_001b: stfld string valuetype TestModule/MyStructOption`1::_notNullField2 + IL_0020: ldloca.s V_0 + IL_0022: ldarg.2 + IL_0023: stfld string valuetype TestModule/MyStructOption`1::_canBeNullField + IL_0028: ldloca.s V_0 + IL_002a: ldarg.3 + IL_002b: stfld !0 valuetype TestModule/MyStructOption`1::_notNullField1 + IL_0030: ldloc.0 + IL_0031: ret + } + + .method public hidebysig instance bool get_IsMyStructSome() cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::.ctor(bool, + string[]) = ( 01 00 01 04 00 00 00 0D 6E 6F 74 4E 75 6C 6C 46 + 69 65 6C 64 32 0D 6E 6F 74 4E 75 6C 6C 46 69 65 + 6C 64 31 0E 5F 6E 6F 74 4E 75 6C 6C 46 69 65 6C + 64 32 0E 5F 6E 6F 74 4E 75 6C 6C 46 69 65 6C 64 + 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance int32 valuetype TestModule/MyStructOption`1::get_Tag() + IL_0006: ldc.i4.1 + IL_0007: ceq + IL_0009: ret + } + + .method assembly specialname rtspecialname instance void .ctor(int32 _tag) cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 1B 54 65 73 74 4D 6F 64 75 6C + 65 2B 4D 79 53 74 72 75 63 74 4F 70 74 69 6F 6E + 60 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stfld int32 valuetype TestModule/MyStructOption`1::_tag + IL_0007: ret + } + + .method public hidebysig instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> get_nestedGenericField() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 02 01 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> valuetype TestModule/MyStructOption`1::_nestedGenericField + IL_0006: ret + } + + .method public hidebysig instance string get_notNullField2() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string valuetype TestModule/MyStructOption`1::_notNullField2 + IL_0006: ret + } + + .method public hidebysig instance string get_canBeNullField() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string valuetype TestModule/MyStructOption`1::_canBeNullField + IL_0006: ret + } + + .method public hidebysig instance !T get_notNullField1() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !0 valuetype TestModule/MyStructOption`1::_notNullField1 + IL_0006: ret + } + + .method public hidebysig instance int32 get_Tag() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 valuetype TestModule/MyStructOption`1::_tag + IL_0006: ret + } + + .method assembly hidebysig specialname instance object __DebugDisplay() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+0.8A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,string>,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString,string>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: ldobj valuetype TestModule/MyStructOption`1 + IL_0015: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,string>::Invoke(!0) + IL_001a: ret + } + + .method public strict virtual instance string ToString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,string>,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,valuetype TestModule/MyStructOption`1>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString,string>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: ldobj valuetype TestModule/MyStructOption`1 + IL_0015: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,string>::Invoke(!0) + IL_001a: ret + } + + .property instance int32 Tag() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance int32 TestModule/MyStructOption`1::get_Tag() + } + .property valuetype TestModule/MyStructOption`1 + MyStructNone() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get valuetype TestModule/MyStructOption`1 TestModule/MyStructOption`1::get_MyStructNone() + } + .property instance bool IsMyStructNone() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool TestModule/MyStructOption`1::get_IsMyStructNone() + } + .property instance bool IsMyStructSome() + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::.ctor(bool, + string[]) = ( 01 00 01 04 00 00 00 0D 6E 6F 74 4E 75 6C 6C 46 + 69 65 6C 64 32 0D 6E 6F 74 4E 75 6C 6C 46 69 65 + 6C 64 31 0E 5F 6E 6F 74 4E 75 6C 6C 46 69 65 6C + 64 32 0E 5F 6E 6F 74 4E 75 6C 6C 46 69 65 6C 64 + 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool TestModule/MyStructOption`1::get_IsMyStructSome() + } + .property instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> + nestedGenericField() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 02 01 02 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> TestModule/MyStructOption`1::get_nestedGenericField() + } + .property instance string notNullField2() + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance string TestModule/MyStructOption`1::get_notNullField2() + } + .property instance string canBeNullField() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 02 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance string TestModule/MyStructOption`1::get_canBeNullField() + } + .property instance !T notNullField1() + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 03 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance !T TestModule/MyStructOption`1::get_notNullField1() + } + } + + .method public static valuetype TestModule/MyStructOption`1 + mapStructContents(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + valuetype TestModule/MyStructOption`1 myOpt) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + .param type a + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param type b + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 00 01 00 00 ) + .param [2] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 00 01 00 00 ) + + .maxstack 7 + .locals init (valuetype TestModule/MyStructOption`1 V_0, + !!a V_1, + string V_2, + string V_3, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_4) + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: ldloca.s V_0 + IL_0004: call instance int32 valuetype TestModule/MyStructOption`1::get_Tag() + IL_0009: ldc.i4.1 + IL_000a: bne.un.s IL_000e + + IL_000c: br.s IL_0014 + + IL_000e: call valuetype TestModule/MyStructOption`1 valuetype TestModule/MyStructOption`1::get_MyStructNone() + IL_0013: ret + + IL_0014: ldloca.s V_0 + IL_0016: ldfld !0 valuetype TestModule/MyStructOption`1::_notNullField1 + IL_001b: stloc.1 + IL_001c: ldloca.s V_0 + IL_001e: ldfld string valuetype TestModule/MyStructOption`1::_notNullField2 + IL_0023: stloc.2 + IL_0024: ldloca.s V_0 + IL_0026: ldfld string valuetype TestModule/MyStructOption`1::_canBeNullField + IL_002b: stloc.3 + IL_002c: ldloca.s V_0 + IL_002e: ldfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> valuetype TestModule/MyStructOption`1::_nestedGenericField + IL_0033: stloc.s V_4 + IL_0035: ldloc.s V_4 + IL_0037: ldloc.2 + IL_0038: ldloc.3 + IL_0039: ldarg.0 + IL_003a: ldloc.1 + IL_003b: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0040: call valuetype TestModule/MyStructOption`1 valuetype TestModule/MyStructOption`1::NewMyStructSome(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>, + string, + string, + !0) + IL_0045: ret + } + +} + +.class private abstract auto ansi sealed ''.$TestModule + extends [runtime]System.Object +{ +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelBindings.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelBindings.fs new file mode 100644 index 00000000000..f3cb30cd05d --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelBindings.fs @@ -0,0 +1,8 @@ +module MyTestModule +[] +let nullableLiteral : string | null = "" +let notNullStringField : string = "" +let nullableStringField : string | null = null +let mutable nullableMutableStringField : string | null = null +let nullableInt : System.Nullable = System.Nullable() +let regularInt = 42 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelBindings.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelBindings.fs.il.net472.bsl new file mode 100644 index 00000000000..da49015055d --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelBindings.fs.il.net472.bsl @@ -0,0 +1,229 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field public static literal string nullableLiteral = "" + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.LiteralAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly string nullableMutableStringField@6 + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public specialname static string get_notNullStringField() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "" + IL_0005: ret + } + + .method public specialname static string get_nullableStringField() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + } + + .method public specialname static string get_nullableMutableStringField() cil managed + { + + .maxstack 8 + IL_0000: ldsfld string MyTestModule::nullableMutableStringField@6 + IL_0005: ret + } + + .method public specialname static void set_nullableMutableStringField(string 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld string MyTestModule::nullableMutableStringField@6 + IL_0006: ret + } + + .method public specialname static valuetype [runtime]System.Nullable`1 get_nullableInt() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 3 + .locals init (valuetype [runtime]System.Nullable`1 V_0) + IL_0000: ldloc.0 + IL_0001: ret + } + + .method public specialname static int32 get_regularInt() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.s 42 + IL_0002: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$MyTestModule::init@ + IL_0006: ldsfld int32 ''.$MyTestModule::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldnull + IL_0001: stsfld string MyTestModule::nullableMutableStringField@6 + IL_0006: ret + } + + .property string notNullStringField() + { + .get string MyTestModule::get_notNullStringField() + } + .property string nullableStringField() + { + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .get string MyTestModule::get_nullableStringField() + } + .property string nullableMutableStringField() + { + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void MyTestModule::set_nullableMutableStringField(string) + .get string MyTestModule::get_nullableMutableStringField() + } + .property valuetype [runtime]System.Nullable`1 + nullableInt() + { + .get valuetype [runtime]System.Nullable`1 MyTestModule::get_nullableInt() + } + .property int32 regularInt() + { + .get int32 MyTestModule::get_regularInt() + } +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void MyTestModule::staticInitialization@() + IL_0005: ret + } + +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8[] NullableFlags + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 scalarByteValue) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldc.i4.1 + IL_0008: newarr [runtime]System.Byte + IL_000d: dup + IL_000e: ldc.i4.0 + IL_000f: ldarg.1 + IL_0010: stelem.i1 + IL_0011: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_0016: ret + } + + .method public specialname rtspecialname instance void .ctor(uint8[] NullableFlags) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_000d: ret + } + +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableContextAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8 Flag + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 Flag) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8 System.Runtime.CompilerServices.NullableContextAttribute::Flag + IL_000d: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelBindings.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelBindings.fs.il.netcore.bsl new file mode 100644 index 00000000000..37235222996 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelBindings.fs.il.netcore.bsl @@ -0,0 +1,163 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field public static literal string nullableLiteral = "" + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.LiteralAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly string nullableMutableStringField@6 + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public specialname static string get_notNullStringField() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "" + IL_0005: ret + } + + .method public specialname static string get_nullableStringField() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + } + + .method public specialname static string get_nullableMutableStringField() cil managed + { + + .maxstack 8 + IL_0000: ldsfld string MyTestModule::nullableMutableStringField@6 + IL_0005: ret + } + + .method public specialname static void set_nullableMutableStringField(string 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld string MyTestModule::nullableMutableStringField@6 + IL_0006: ret + } + + .method public specialname static valuetype [runtime]System.Nullable`1 get_nullableInt() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 3 + .locals init (valuetype [runtime]System.Nullable`1 V_0) + IL_0000: ldloc.0 + IL_0001: ret + } + + .method public specialname static int32 get_regularInt() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.s 42 + IL_0002: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$MyTestModule::init@ + IL_0006: ldsfld int32 ''.$MyTestModule::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldnull + IL_0001: stsfld string MyTestModule::nullableMutableStringField@6 + IL_0006: ret + } + + .property string notNullStringField() + { + .get string MyTestModule::get_notNullStringField() + } + .property string nullableStringField() + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .get string MyTestModule::get_nullableStringField() + } + .property string nullableMutableStringField() + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void MyTestModule::set_nullableMutableStringField(string) + .get string MyTestModule::get_nullableMutableStringField() + } + .property valuetype [runtime]System.Nullable`1 + nullableInt() + { + .get valuetype [runtime]System.Nullable`1 MyTestModule::get_nullableInt() + } + .property int32 regularInt() + { + .get int32 MyTestModule::get_regularInt() + } +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void MyTestModule::staticInitialization@() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelFunctions.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelFunctions.fs new file mode 100644 index 00000000000..5b7efae9b87 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelFunctions.fs @@ -0,0 +1,10 @@ +module MyTestModule + +let nonNullableInputOutputFunc (x:string) = x +let nullableStringInputOutputFunc (x: string | null) = x +let nonNullableIntFunc (x:int) = x +let nullableIntFunc (x:System.Nullable) = x +let genericValueTypeTest (x: struct(string * (string|null) * int * int * int * int)) = x +let genericRefTypeTest (x: string * (string|null) * int * int * int * int) = x +let nestedGenericsTest (x: list | null> | null) = x +let multiArgumentTest (x:string) (y:string | null) = 42 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelFunctions.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelFunctions.fs.il.net472.bsl new file mode 100644 index 00000000000..0461633d8bd --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelFunctions.fs.il.net472.bsl @@ -0,0 +1,216 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .method public static string nonNullableInputOutputFunc(string x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static string nullableStringInputOutputFunc(string x) cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static int32 nonNullableIntFunc(int32 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static valuetype [runtime]System.Nullable`1 + nullableIntFunc(valuetype [runtime]System.Nullable`1 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static valuetype [runtime]System.ValueTuple`6 + genericValueTypeTest(valuetype [runtime]System.ValueTuple`6 x) cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 00 01 02 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 00 01 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static class [runtime]System.Tuple`6 + genericRefTypeTest(string x_0, + string x_1, + int32 x_2, + int32 x_3, + int32 x_4, + int32 x_5) cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 01 01 02 00 00 ) + .param [2] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + .locals init (class [runtime]System.Tuple`6 V_0) + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: ldarg.3 + IL_0004: ldarg.s x_4 + IL_0006: ldarg.s x_5 + IL_0008: newobj instance void class [runtime]System.Tuple`6::.ctor(!0, + !1, + !2, + !3, + !4, + !5) + IL_000d: stloc.0 + IL_000e: ldloc.0 + IL_000f: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> + nestedGenericsTest(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> x) cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static int32 multiArgumentTest(string x, + string y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + .param [2] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.s 42 + IL_0002: ret + } + +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8[] NullableFlags + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname + instance void .ctor(uint8 scalarByteValue) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldc.i4.1 + IL_0008: newarr [runtime]System.Byte + IL_000d: dup + IL_000e: ldc.i4.0 + IL_000f: ldarg.1 + IL_0010: stelem.i1 + IL_0011: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_0016: ret + } + + .method public specialname rtspecialname + instance void .ctor(uint8[] NullableFlags) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_000d: ret + } + +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableContextAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8 Flag + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname + instance void .ctor(uint8 Flag) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8 System.Runtime.CompilerServices.NullableContextAttribute::Flag + IL_000d: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelFunctions.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelFunctions.fs.il.netcore.bsl new file mode 100644 index 00000000000..f195a888f6a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelFunctions.fs.il.netcore.bsl @@ -0,0 +1,144 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .method public static string nonNullableInputOutputFunc(string x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static string nullableStringInputOutputFunc(string x) cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static int32 nonNullableIntFunc(int32 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static valuetype [runtime]System.Nullable`1 nullableIntFunc(valuetype [runtime]System.Nullable`1 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static valuetype [runtime]System.ValueTuple`6 genericValueTypeTest(valuetype [runtime]System.ValueTuple`6 x) cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 00 01 02 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 00 01 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static class [runtime]System.Tuple`6 + genericRefTypeTest(string x_0, + string x_1, + int32 x_2, + int32 x_3, + int32 x_4, + int32 x_5) cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 01 01 02 00 00 ) + .param [2] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + .locals init (class [runtime]System.Tuple`6 V_0) + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: ldarg.3 + IL_0004: ldarg.s x_4 + IL_0006: ldarg.s x_5 + IL_0008: newobj instance void class [runtime]System.Tuple`6::.ctor(!0, + !1, + !2, + !3, + !4, + !5) + IL_000d: stloc.0 + IL_000e: ldloc.0 + IL_000f: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> nestedGenericsTest(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> x) cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static int32 multiArgumentTest(string x, + string y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + .param [2] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.s 42 + IL_0002: ret + } + +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelFunctionsOpt.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelFunctionsOpt.fs new file mode 100644 index 00000000000..5b7efae9b87 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelFunctionsOpt.fs @@ -0,0 +1,10 @@ +module MyTestModule + +let nonNullableInputOutputFunc (x:string) = x +let nullableStringInputOutputFunc (x: string | null) = x +let nonNullableIntFunc (x:int) = x +let nullableIntFunc (x:System.Nullable) = x +let genericValueTypeTest (x: struct(string * (string|null) * int * int * int * int)) = x +let genericRefTypeTest (x: string * (string|null) * int * int * int * int) = x +let nestedGenericsTest (x: list | null> | null) = x +let multiArgumentTest (x:string) (y:string | null) = 42 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelFunctionsOpt.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelFunctionsOpt.fs.il.net472.bsl new file mode 100644 index 00000000000..f4d927102b4 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelFunctionsOpt.fs.il.net472.bsl @@ -0,0 +1,213 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .method public static string nonNullableInputOutputFunc(string x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static string nullableStringInputOutputFunc(string x) cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static int32 nonNullableIntFunc(int32 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static valuetype [runtime]System.Nullable`1 + nullableIntFunc(valuetype [runtime]System.Nullable`1 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static valuetype [runtime]System.ValueTuple`6 + genericValueTypeTest(valuetype [runtime]System.ValueTuple`6 x) cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 00 01 02 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 00 01 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static class [runtime]System.Tuple`6 + genericRefTypeTest(string x_0, + string x_1, + int32 x_2, + int32 x_3, + int32 x_4, + int32 x_5) cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 01 01 02 00 00 ) + .param [2] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: ldarg.3 + IL_0004: ldarg.s x_4 + IL_0006: ldarg.s x_5 + IL_0008: newobj instance void class [runtime]System.Tuple`6::.ctor(!0, + !1, + !2, + !3, + !4, + !5) + IL_000d: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> + nestedGenericsTest(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> x) cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static int32 multiArgumentTest(string x, + string y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + .param [2] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.s 42 + IL_0002: ret + } + +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8[] NullableFlags + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname + instance void .ctor(uint8 scalarByteValue) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldc.i4.1 + IL_0008: newarr [runtime]System.Byte + IL_000d: dup + IL_000e: ldc.i4.0 + IL_000f: ldarg.1 + IL_0010: stelem.i1 + IL_0011: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_0016: ret + } + + .method public specialname rtspecialname + instance void .ctor(uint8[] NullableFlags) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_000d: ret + } + +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableContextAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8 Flag + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname + instance void .ctor(uint8 Flag) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8 System.Runtime.CompilerServices.NullableContextAttribute::Flag + IL_000d: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelFunctionsOpt.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelFunctionsOpt.fs.il.netcore.bsl new file mode 100644 index 00000000000..0e88288efbf --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ModuleLevelFunctionsOpt.fs.il.netcore.bsl @@ -0,0 +1,141 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .method public static string nonNullableInputOutputFunc(string x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static string nullableStringInputOutputFunc(string x) cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static int32 nonNullableIntFunc(int32 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static valuetype [runtime]System.Nullable`1 nullableIntFunc(valuetype [runtime]System.Nullable`1 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static valuetype [runtime]System.ValueTuple`6 genericValueTypeTest(valuetype [runtime]System.ValueTuple`6 x) cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 00 01 02 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 00 01 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static class [runtime]System.Tuple`6 + genericRefTypeTest(string x_0, + string x_1, + int32 x_2, + int32 x_3, + int32 x_4, + int32 x_5) cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 01 01 02 00 00 ) + .param [2] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: ldarg.3 + IL_0004: ldarg.s x_4 + IL_0006: ldarg.s x_5 + IL_0008: newobj instance void class [runtime]System.Tuple`6::.ctor(!0, + !1, + !2, + !3, + !4, + !5) + IL_000d: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> nestedGenericsTest(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> x) cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ret + } + + .method public static int32 multiArgumentTest(string x, + string y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + .param [2] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.s 42 + IL_0002: ret + } + +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullAsTrueValue.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullAsTrueValue.fs new file mode 100644 index 00000000000..043675e4bcc --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullAsTrueValue.fs @@ -0,0 +1,23 @@ +module TestModule + +[] +[] +type MyNullableOption<'T when 'T:null> = + | MyNone + | MySome of value:'T + +let mapPossiblyNullable f myOpt = + match myOpt with + | MyNone -> MyNone + | MySome x -> MySome (f x) + +[] +[] +type MyOptionWhichCannotHaveNullInTheInside<'T when 'T:not null> = + | MyNotNullNone + | MyNotNullSome of value:'T + +let mapNotNullableContents f myOpt = + match myOpt with + | MyNotNullNone -> MyNotNullNone + | MyNotNullSome x -> MyNotNullSome (f x) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullAsTrueValue.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullAsTrueValue.fs.il.net472.bsl new file mode 100644 index 00000000000..92b5d69456e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullAsTrueValue.fs.il.net472.bsl @@ -0,0 +1,664 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed TestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class auto autochar serializable sealed nested public beforefieldinit MyNullableOption`1 + extends [runtime]System.Object + { + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationRepresentationAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilationRepresentationFlags) = ( 01 00 08 00 00 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoEqualityAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoComparisonAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param type T + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .class abstract auto ansi sealed nested public Tags + extends [runtime]System.Object + { + .param type T + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .field public static literal int32 MyNone = int32(0x00000000) + .field public static literal int32 MySome = int32(0x00000001) + } + + .field assembly initonly !T _value + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 E0 07 00 00 1D 54 65 73 74 4D 6F 64 75 6C + 65 2B 4D 79 4E 75 6C 6C 61 62 6C 65 4F 70 74 69 + 6F 6E 60 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ret + } + + .method public static class TestModule/MyNullableOption`1 get_MyNone() cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 02 00 00 00 ) + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + } + + .method public static class TestModule/MyNullableOption`1 NewMySome(!T _value) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 01 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void class TestModule/MyNullableOption`1::.ctor(!0) + IL_0006: ret + } + + .method assembly specialname rtspecialname instance void .ctor(!T _value) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 1D 54 65 73 74 4D 6F 64 75 6C + 65 2B 4D 79 4E 75 6C 6C 61 62 6C 65 4F 70 74 69 + 6F 6E 60 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld !0 class TestModule/MyNullableOption`1::_value + IL_000d: ret + } + + .method public hidebysig instance !T get_value() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !0 class TestModule/MyNullableOption`1::_value + IL_0006: ret + } + + .method public static int32 GetTag(class TestModule/MyNullableOption`1 A_0) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0006 + + IL_0003: ldc.i4.1 + IL_0004: br.s IL_0007 + + IL_0006: ldc.i4.0 + IL_0007: ret + } + + .method assembly hidebysig specialname instance object __DebugDisplay() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+0.8A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,string>,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString,string>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,string>::Invoke(!0) + IL_0015: ret + } + + .method public strict virtual instance string ToString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,string>,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class TestModule/MyNullableOption`1>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString,string>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,string>::Invoke(!0) + IL_0015: ret + } + + .method public specialname static bool get_IsMyNone(class TestModule/MyNullableOption`1 A_0) cil managed + { + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: ceq + IL_0004: ret + } + + .method public specialname static bool get_IsMySome(class TestModule/MyNullableOption`1 A_0) cil managed + { + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: ret + } + + .property class TestModule/MyNullableOption`1 + MyNone() + { + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 02 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get class TestModule/MyNullableOption`1 TestModule/MyNullableOption`1::get_MyNone() + } + .property instance !T 'value'() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance !T TestModule/MyNullableOption`1::get_value() + } + .property bool IsMyNone() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .get bool TestModule/MyNullableOption`1::get_IsMyNone(class TestModule/MyNullableOption`1) + } + .property bool IsMySome() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .get bool TestModule/MyNullableOption`1::get_IsMySome(class TestModule/MyNullableOption`1) + } + } + + .class auto autochar serializable sealed nested public beforefieldinit MyOptionWhichCannotHaveNullInTheInside`1 + extends [runtime]System.Object + { + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationRepresentationAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilationRepresentationFlags) = ( 01 00 08 00 00 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoEqualityAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoComparisonAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param type T + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class abstract auto ansi sealed nested public Tags + extends [runtime]System.Object + { + .param type T + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field public static literal int32 MyNotNullNone = int32(0x00000000) + .field public static literal int32 MyNotNullSome = int32(0x00000001) + } + + .field assembly initonly !T _value + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 E0 07 00 00 33 54 65 73 74 4D 6F 64 75 6C + 65 2B 4D 79 4F 70 74 69 6F 6E 57 68 69 63 68 43 + 61 6E 6E 6F 74 48 61 76 65 4E 75 6C 6C 49 6E 54 + 68 65 49 6E 73 69 64 65 60 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ret + } + + .method public static class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 get_MyNotNullNone() cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 02 00 00 00 ) + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + } + + .method public static class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 NewMyNotNullSome(!T _value) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 01 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void class TestModule/MyOptionWhichCannotHaveNullInTheInside`1::.ctor(!0) + IL_0006: ret + } + + .method assembly specialname rtspecialname instance void .ctor(!T _value) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 33 54 65 73 74 4D 6F 64 75 6C + 65 2B 4D 79 4F 70 74 69 6F 6E 57 68 69 63 68 43 + 61 6E 6E 6F 74 48 61 76 65 4E 75 6C 6C 49 6E 54 + 68 65 49 6E 73 69 64 65 60 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld !0 class TestModule/MyOptionWhichCannotHaveNullInTheInside`1::_value + IL_000d: ret + } + + .method public hidebysig instance !T get_value() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !0 class TestModule/MyOptionWhichCannotHaveNullInTheInside`1::_value + IL_0006: ret + } + + .method public static int32 GetTag(class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 A_0) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0006 + + IL_0003: ldc.i4.1 + IL_0004: br.s IL_0007 + + IL_0006: ldc.i4.0 + IL_0007: ret + } + + .method assembly hidebysig specialname instance object __DebugDisplay() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+0.8A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,string>,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString,string>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,string>::Invoke(!0) + IL_0015: ret + } + + .method public strict virtual instance string ToString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,string>,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class TestModule/MyOptionWhichCannotHaveNullInTheInside`1>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString,string>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,string>::Invoke(!0) + IL_0015: ret + } + + .method public specialname static bool get_IsMyNotNullNone(class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 A_0) cil managed + { + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: ceq + IL_0004: ret + } + + .method public specialname static bool get_IsMyNotNullSome(class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 A_0) cil managed + { + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: ret + } + + .property class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 + MyNotNullNone() + { + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 02 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 TestModule/MyOptionWhichCannotHaveNullInTheInside`1::get_MyNotNullNone() + } + .property instance !T 'value'() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance !T TestModule/MyOptionWhichCannotHaveNullInTheInside`1::get_value() + } + .property bool IsMyNotNullNone() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .get bool TestModule/MyOptionWhichCannotHaveNullInTheInside`1::get_IsMyNotNullNone(class TestModule/MyOptionWhichCannotHaveNullInTheInside`1) + } + .property bool IsMyNotNullSome() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .get bool TestModule/MyOptionWhichCannotHaveNullInTheInside`1::get_IsMyNotNullSome(class TestModule/MyOptionWhichCannotHaveNullInTheInside`1) + } + } + + .method public static class TestModule/MyNullableOption`1 + mapPossiblyNullable(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + class TestModule/MyNullableOption`1 myOpt) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + .param type a + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param type b + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 02 01 00 00 ) + .param [2] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 02 01 00 00 ) + + .maxstack 4 + .locals init (class TestModule/MyNullableOption`1 V_0, + class TestModule/MyNullableOption`1 V_1, + !!a V_2) + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: brfalse.s IL_0007 + + IL_0005: br.s IL_0009 + + IL_0007: ldnull + IL_0008: ret + + IL_0009: ldloc.0 + IL_000a: stloc.1 + IL_000b: ldloc.1 + IL_000c: ldfld !0 class TestModule/MyNullableOption`1::_value + IL_0011: stloc.2 + IL_0012: ldarg.0 + IL_0013: ldloc.2 + IL_0014: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0019: call class TestModule/MyNullableOption`1 class TestModule/MyNullableOption`1::NewMySome(!0) + IL_001e: ret + } + + .method public static class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 + mapNotNullableContents(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 myOpt) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + .param type a + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param type b + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 02 01 00 00 ) + .param [2] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 02 01 00 00 ) + + .maxstack 4 + .locals init (class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 V_0, + class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 V_1, + !!a V_2) + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: brfalse.s IL_0007 + + IL_0005: br.s IL_0009 + + IL_0007: ldnull + IL_0008: ret + + IL_0009: ldloc.0 + IL_000a: stloc.1 + IL_000b: ldloc.1 + IL_000c: ldfld !0 class TestModule/MyOptionWhichCannotHaveNullInTheInside`1::_value + IL_0011: stloc.2 + IL_0012: ldarg.0 + IL_0013: ldloc.2 + IL_0014: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0019: call class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 class TestModule/MyOptionWhichCannotHaveNullInTheInside`1::NewMyNotNullSome(!0) + IL_001e: ret + } + +} + +.class private abstract auto ansi sealed ''.$TestModule + extends [runtime]System.Object +{ +} + +.class private auto ansi serializable sealed System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes + extends [runtime]System.Enum +{ + .custom instance void [runtime]System.FlagsAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public specialname rtspecialname int32 value__ + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes All = int32(0xFFFFFFFF) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes None = int32(0x00000000) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicParameterlessConstructor = int32(0x00000001) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicConstructors = int32(0x00000003) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicConstructors = int32(0x00000004) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicMethods = int32(0x00000008) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicMethods = int32(0x00000010) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicFields = int32(0x00000020) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicFields = int32(0x00000040) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicNestedTypes = int32(0x00000080) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicNestedTypes = int32(0x00000100) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicProperties = int32(0x00000200) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicProperties = int32(0x00000400) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicEvents = int32(0x00000800) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicEvents = int32(0x00001000) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes Interfaces = int32(0x00002000) +} + +.class private auto ansi beforefieldinit System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field private valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field private class [runtime]System.Type Type@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname + instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, + class [runtime]System.Type Type) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ + IL_0014: ret + } + + .method public hidebysig specialname instance class [runtime]System.Type get_Type() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ + IL_0006: ret + } + + .method public hidebysig specialname instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes get_MemberType() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ + IL_0006: ret + } + + .property instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes + MemberType() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_MemberType() + } + .property instance class [runtime]System.Type + Type() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_Type() + } +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8[] NullableFlags + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 scalarByteValue) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldc.i4.1 + IL_0008: newarr [runtime]System.Byte + IL_000d: dup + IL_000e: ldc.i4.0 + IL_000f: ldarg.1 + IL_0010: stelem.i1 + IL_0011: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_0016: ret + } + + .method public specialname rtspecialname instance void .ctor(uint8[] NullableFlags) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_000d: ret + } + +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableContextAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8 Flag + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 Flag) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8 System.Runtime.CompilerServices.NullableContextAttribute::Flag + IL_000d: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullAsTrueValue.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullAsTrueValue.fs.il.netcore.bsl new file mode 100644 index 00000000000..b0b12a23494 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullAsTrueValue.fs.il.netcore.bsl @@ -0,0 +1,507 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed TestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class auto autochar serializable sealed nested public beforefieldinit MyNullableOption`1 + extends [runtime]System.Object + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationRepresentationAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilationRepresentationFlags) = ( 01 00 08 00 00 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoEqualityAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoComparisonAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param type T + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .class abstract auto ansi sealed nested public Tags + extends [runtime]System.Object + { + .param type T + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .field public static literal int32 MyNone = int32(0x00000000) + .field public static literal int32 MySome = int32(0x00000001) + } + + .field assembly initonly !T _value + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 E0 07 00 00 1D 54 65 73 74 4D 6F 64 75 6C + 65 2B 4D 79 4E 75 6C 6C 61 62 6C 65 4F 70 74 69 + 6F 6E 60 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ret + } + + .method public static class TestModule/MyNullableOption`1 get_MyNone() cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 02 00 00 00 ) + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + } + + .method public static class TestModule/MyNullableOption`1 NewMySome(!T _value) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 01 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void class TestModule/MyNullableOption`1::.ctor(!0) + IL_0006: ret + } + + .method assembly specialname rtspecialname instance void .ctor(!T _value) cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 1D 54 65 73 74 4D 6F 64 75 6C + 65 2B 4D 79 4E 75 6C 6C 61 62 6C 65 4F 70 74 69 + 6F 6E 60 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld !0 class TestModule/MyNullableOption`1::_value + IL_000d: ret + } + + .method public hidebysig instance !T get_value() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !0 class TestModule/MyNullableOption`1::_value + IL_0006: ret + } + + .method public static int32 GetTag(class TestModule/MyNullableOption`1 A_0) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0006 + + IL_0003: ldc.i4.1 + IL_0004: br.s IL_0007 + + IL_0006: ldc.i4.0 + IL_0007: ret + } + + .method assembly hidebysig specialname instance object __DebugDisplay() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+0.8A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,string>,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString,string>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,string>::Invoke(!0) + IL_0015: ret + } + + .method public strict virtual instance string ToString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,string>,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class TestModule/MyNullableOption`1>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString,string>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,string>::Invoke(!0) + IL_0015: ret + } + + .method public specialname static bool get_IsMyNone(class TestModule/MyNullableOption`1 A_0) cil managed + { + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: ceq + IL_0004: ret + } + + .method public specialname static bool get_IsMySome(class TestModule/MyNullableOption`1 A_0) cil managed + { + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: ret + } + + .property class TestModule/MyNullableOption`1 + MyNone() + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 02 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get class TestModule/MyNullableOption`1 TestModule/MyNullableOption`1::get_MyNone() + } + .property instance !T 'value'() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance !T TestModule/MyNullableOption`1::get_value() + } + .property bool IsMyNone() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .get bool TestModule/MyNullableOption`1::get_IsMyNone(class TestModule/MyNullableOption`1) + } + .property bool IsMySome() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .get bool TestModule/MyNullableOption`1::get_IsMySome(class TestModule/MyNullableOption`1) + } + } + + .class auto autochar serializable sealed nested public beforefieldinit MyOptionWhichCannotHaveNullInTheInside`1 + extends [runtime]System.Object + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationRepresentationAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilationRepresentationFlags) = ( 01 00 08 00 00 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoEqualityAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoComparisonAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param type T + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class abstract auto ansi sealed nested public Tags + extends [runtime]System.Object + { + .param type T + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field public static literal int32 MyNotNullNone = int32(0x00000000) + .field public static literal int32 MyNotNullSome = int32(0x00000001) + } + + .field assembly initonly !T _value + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 E0 07 00 00 33 54 65 73 74 4D 6F 64 75 6C + 65 2B 4D 79 4F 70 74 69 6F 6E 57 68 69 63 68 43 + 61 6E 6E 6F 74 48 61 76 65 4E 75 6C 6C 49 6E 54 + 68 65 49 6E 73 69 64 65 60 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ret + } + + .method public static class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 get_MyNotNullNone() cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 02 00 00 00 ) + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + } + + .method public static class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 NewMyNotNullSome(!T _value) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 01 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void class TestModule/MyOptionWhichCannotHaveNullInTheInside`1::.ctor(!0) + IL_0006: ret + } + + .method assembly specialname rtspecialname instance void .ctor(!T _value) cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 33 54 65 73 74 4D 6F 64 75 6C + 65 2B 4D 79 4F 70 74 69 6F 6E 57 68 69 63 68 43 + 61 6E 6E 6F 74 48 61 76 65 4E 75 6C 6C 49 6E 54 + 68 65 49 6E 73 69 64 65 60 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld !0 class TestModule/MyOptionWhichCannotHaveNullInTheInside`1::_value + IL_000d: ret + } + + .method public hidebysig instance !T get_value() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !0 class TestModule/MyOptionWhichCannotHaveNullInTheInside`1::_value + IL_0006: ret + } + + .method public static int32 GetTag(class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 A_0) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0006 + + IL_0003: ldc.i4.1 + IL_0004: br.s IL_0007 + + IL_0006: ldc.i4.0 + IL_0007: ret + } + + .method assembly hidebysig specialname instance object __DebugDisplay() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+0.8A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,string>,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString,string>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,string>::Invoke(!0) + IL_0015: ret + } + + .method public strict virtual instance string ToString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,string>,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class TestModule/MyOptionWhichCannotHaveNullInTheInside`1>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString,string>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,string>::Invoke(!0) + IL_0015: ret + } + + .method public specialname static bool get_IsMyNotNullNone(class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 A_0) cil managed + { + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: ceq + IL_0004: ret + } + + .method public specialname static bool get_IsMyNotNullSome(class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 A_0) cil managed + { + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: ret + } + + .property class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 + MyNotNullNone() + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 02 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 TestModule/MyOptionWhichCannotHaveNullInTheInside`1::get_MyNotNullNone() + } + .property instance !T 'value'() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance !T TestModule/MyOptionWhichCannotHaveNullInTheInside`1::get_value() + } + .property bool IsMyNotNullNone() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .get bool TestModule/MyOptionWhichCannotHaveNullInTheInside`1::get_IsMyNotNullNone(class TestModule/MyOptionWhichCannotHaveNullInTheInside`1) + } + .property bool IsMyNotNullSome() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .get bool TestModule/MyOptionWhichCannotHaveNullInTheInside`1::get_IsMyNotNullSome(class TestModule/MyOptionWhichCannotHaveNullInTheInside`1) + } + } + + .method public static class TestModule/MyNullableOption`1 + mapPossiblyNullable(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + class TestModule/MyNullableOption`1 myOpt) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + .param type a + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param type b + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 02 01 00 00 ) + .param [2] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 02 01 00 00 ) + + .maxstack 4 + .locals init (class TestModule/MyNullableOption`1 V_0, + class TestModule/MyNullableOption`1 V_1, + !!a V_2) + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: brfalse.s IL_0007 + + IL_0005: br.s IL_0009 + + IL_0007: ldnull + IL_0008: ret + + IL_0009: ldloc.0 + IL_000a: stloc.1 + IL_000b: ldloc.1 + IL_000c: ldfld !0 class TestModule/MyNullableOption`1::_value + IL_0011: stloc.2 + IL_0012: ldarg.0 + IL_0013: ldloc.2 + IL_0014: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0019: call class TestModule/MyNullableOption`1 class TestModule/MyNullableOption`1::NewMySome(!0) + IL_001e: ret + } + + .method public static class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 + mapNotNullableContents(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 myOpt) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + .param type a + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param type b + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 02 01 00 00 ) + .param [2] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 02 01 00 00 ) + + .maxstack 4 + .locals init (class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 V_0, + class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 V_1, + !!a V_2) + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: brfalse.s IL_0007 + + IL_0005: br.s IL_0009 + + IL_0007: ldnull + IL_0008: ret + + IL_0009: ldloc.0 + IL_000a: stloc.1 + IL_000b: ldloc.1 + IL_000c: ldfld !0 class TestModule/MyOptionWhichCannotHaveNullInTheInside`1::_value + IL_0011: stloc.2 + IL_0012: ldarg.0 + IL_0013: ldloc.2 + IL_0014: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0019: call class TestModule/MyOptionWhichCannotHaveNullInTheInside`1 class TestModule/MyOptionWhichCannotHaveNullInTheInside`1::NewMyNotNullSome(!0) + IL_001e: ret + } + +} + +.class private abstract auto ansi sealed ''.$TestModule + extends [runtime]System.Object +{ +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullableInheritance.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullableInheritance.fs new file mode 100644 index 00000000000..19fd926e2fe --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullableInheritance.fs @@ -0,0 +1,24 @@ +module MyTestModule + +open System +open System.Collections.Generic + + +type DerivedWhichAllowsNull() = + inherit ResizeArray() + member x.FirstItem = x[0] + +type DerivedWithoutNull() = + inherit ResizeArray() + member x.FirstItem = x[0] + +type ICanGetAnything<'T> = + abstract member Get : unit -> 'T + +type MyClassImplementingTheSameInterface() = + interface ICanGetAnything with + member x.Get() = null + interface ICanGetAnything>> with + member x.Get() = new ResizeArray<_>() + interface ICanGetAnything | null> with + member x.Get() = null \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullableInheritance.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullableInheritance.fs.il.net472.bsl new file mode 100644 index 00000000000..fbb63d7ff9e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullableInheritance.fs.il.net472.bsl @@ -0,0 +1,275 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public DerivedWhichAllowsNull + extends class [runtime]System.Collections.Generic.List`1 + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 01 02 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .method public specialname rtspecialname + instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void class [runtime]System.Collections.Generic.List`1::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + .method public hidebysig specialname + instance string get_FirstItem() cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + + .maxstack 4 + .locals init (class MyTestModule/DerivedWhichAllowsNull V_0) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldarg.0 + IL_0003: ldc.i4.0 + IL_0004: tail. + IL_0006: callvirt instance !0 class [runtime]System.Collections.Generic.List`1::get_Item(int32) + IL_000b: ret + } + + .property instance string FirstItem() + { + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + .get instance string MyTestModule/DerivedWhichAllowsNull::get_FirstItem() + } + } + + .class auto ansi serializable nested public DerivedWithoutNull + extends class [runtime]System.Collections.Generic.List`1 + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .method public specialname rtspecialname + instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void class [runtime]System.Collections.Generic.List`1::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + .method public hidebysig specialname + instance string get_FirstItem() cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + + .maxstack 4 + .locals init (class MyTestModule/DerivedWithoutNull V_0) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldarg.0 + IL_0003: ldc.i4.0 + IL_0004: tail. + IL_0006: callvirt instance !0 class [runtime]System.Collections.Generic.List`1::get_Item(int32) + IL_000b: ret + } + + .property instance string FirstItem() + { + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + .get instance string MyTestModule/DerivedWithoutNull::get_FirstItem() + } + } + + .class interface abstract auto ansi serializable nested public beforefieldinit ICanGetAnything`1 + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param type T + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + .method public hidebysig abstract virtual + instance !T Get() cil managed + { + } + + } + + .class auto ansi serializable nested public MyClassImplementingTheSameInterface + extends [runtime]System.Object + implements class MyTestModule/ICanGetAnything`1>, + class MyTestModule/ICanGetAnything`1>>, + class MyTestModule/ICanGetAnything`1 + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .interfaceimpl type class MyTestModule/ICanGetAnything`1> + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 01 02 02 00 00 ) + .interfaceimpl type class MyTestModule/ICanGetAnything`1 + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 01 02 00 00 ) + .method public specialname rtspecialname + instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + .method private hidebysig newslot virtual + instance string 'MyTestModule.ICanGetAnything.Get'() cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .override method instance !0 class MyTestModule/ICanGetAnything`1::Get() + + .maxstack 3 + .locals init (class MyTestModule/MyClassImplementingTheSameInterface V_0) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldnull + IL_0003: ret + } + + .method private hidebysig newslot virtual + instance class [runtime]System.Collections.Generic.List`1> + 'MyTestModule.ICanGetAnything>>.Get'() cil managed + { + .override method instance !0 class MyTestModule/ICanGetAnything`1>>::Get() + + .maxstack 3 + .locals init (class MyTestModule/MyClassImplementingTheSameInterface V_0) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: newobj instance void class [runtime]System.Collections.Generic.List`1>::.ctor() + IL_0007: ret + } + + .method private hidebysig newslot virtual + instance class [runtime]System.Collections.Generic.List`1 + 'MyTestModule.ICanGetAnything>.Get'() cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .override method instance !0 class MyTestModule/ICanGetAnything`1>::Get() + + .maxstack 3 + .locals init (class MyTestModule/MyClassImplementingTheSameInterface V_0) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldnull + IL_0003: ret + } + + } + +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8[] NullableFlags + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname + instance void .ctor(uint8 scalarByteValue) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldc.i4.1 + IL_0008: newarr [runtime]System.Byte + IL_000d: dup + IL_000e: ldc.i4.0 + IL_000f: ldarg.1 + IL_0010: stelem.i1 + IL_0011: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_0016: ret + } + + .method public specialname rtspecialname + instance void .ctor(uint8[] NullableFlags) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_000d: ret + } + +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableContextAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8 Flag + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname + instance void .ctor(uint8 Flag) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8 System.Runtime.CompilerServices.NullableContextAttribute::Flag + IL_000d: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullableInheritance.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullableInheritance.fs.il.netcore.bsl new file mode 100644 index 00000000000..149d422691a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullableInheritance.fs.il.netcore.bsl @@ -0,0 +1,201 @@ + + + + + +.assembly extern runtime { } +.assembly extern System.Collections +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 9:0:0:0 +} +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public DerivedWhichAllowsNull + extends class [System.Collections]System.Collections.Generic.List`1 + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 01 02 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .method public specialname rtspecialname instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void class [System.Collections]System.Collections.Generic.List`1::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + .method public hidebysig specialname instance string get_FirstItem() cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 4 + .locals init (class MyTestModule/DerivedWhichAllowsNull V_0) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldarg.0 + IL_0003: ldc.i4.0 + IL_0004: tail. + IL_0006: callvirt instance !0 class [System.Collections]System.Collections.Generic.List`1::get_Item(int32) + IL_000b: ret + } + + .property instance string FirstItem() + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .get instance string MyTestModule/DerivedWhichAllowsNull::get_FirstItem() + } + } + + .class auto ansi serializable nested public DerivedWithoutNull + extends class [System.Collections]System.Collections.Generic.List`1 + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .method public specialname rtspecialname instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void class [System.Collections]System.Collections.Generic.List`1::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + .method public hidebysig specialname instance string get_FirstItem() cil managed + { + + .maxstack 4 + .locals init (class MyTestModule/DerivedWithoutNull V_0) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldarg.0 + IL_0003: ldc.i4.0 + IL_0004: tail. + IL_0006: callvirt instance !0 class [System.Collections]System.Collections.Generic.List`1::get_Item(int32) + IL_000b: ret + } + + .property instance string FirstItem() + { + .get instance string MyTestModule/DerivedWithoutNull::get_FirstItem() + } + } + + .class interface abstract auto ansi serializable nested public beforefieldinit ICanGetAnything`1 + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param type T + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + .method public hidebysig abstract virtual instance !T Get() cil managed + { + } + + } + + .class auto ansi serializable nested public MyClassImplementingTheSameInterface + extends [runtime]System.Object + implements class MyTestModule/ICanGetAnything`1>, + class MyTestModule/ICanGetAnything`1>>, + class MyTestModule/ICanGetAnything`1 + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .interfaceimpl type class MyTestModule/ICanGetAnything`1> + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 01 02 02 00 00 ) + .interfaceimpl type class MyTestModule/ICanGetAnything`1 + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 01 02 00 00 ) + .method public specialname rtspecialname instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + .method private hidebysig newslot virtual instance string 'MyTestModule.ICanGetAnything.Get'() cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .override method instance !0 class MyTestModule/ICanGetAnything`1::Get() + + .maxstack 3 + .locals init (class MyTestModule/MyClassImplementingTheSameInterface V_0) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldnull + IL_0003: ret + } + + .method private hidebysig newslot virtual + instance class [System.Collections]System.Collections.Generic.List`1> + 'MyTestModule.ICanGetAnything>>.Get'() cil managed + { + .override method instance !0 class MyTestModule/ICanGetAnything`1>>::Get() + + .maxstack 3 + .locals init (class MyTestModule/MyClassImplementingTheSameInterface V_0) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: newobj instance void class [System.Collections]System.Collections.Generic.List`1>::.ctor() + IL_0007: ret + } + + .method private hidebysig newslot virtual + instance class [System.Collections]System.Collections.Generic.List`1 + 'MyTestModule.ICanGetAnything>.Get'() cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .override method instance !0 class MyTestModule/ICanGetAnything`1>::Get() + + .maxstack 3 + .locals init (class MyTestModule/MyClassImplementingTheSameInterface V_0) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldnull + IL_0003: ret + } + + } + +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullnessMetadata.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullnessMetadata.fs new file mode 100644 index 00000000000..3476cf07b2e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullnessMetadata.fs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +module EmittedIL.NullnessMetadata + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +type Optimize = Optimize | DoNotOptimize + +let verifyCompilation (o:Optimize) compilation = + compilation + |> withOptions ["--checknulls"] + |> (match o with | Optimize -> withOptimize | DoNotOptimize -> withNoOptimize) + |> withNoDebug + |> withNoInterfaceData + |> withNoOptimizationData + |> asLibrary + |> verifyILBaseline + +[] +let ``Nullable attr for module bindings`` compilation = + compilation + |> verifyCompilation DoNotOptimize + +[] +let ``Nullable attr for module functions`` compilation = + compilation + |> verifyCompilation DoNotOptimize + +[] +let ``Nullable attr for module functions optimize`` compilation = + compilation + |> verifyCompilation Optimize + +[] +let ``Nullable attr for curriedFunc optimize`` compilation = + compilation + |> verifyCompilation Optimize + +[] +let ``Nullable attr for anon records`` compilation = + compilation + |> verifyCompilation DoNotOptimize + +[] +let ``Nullable attr for records`` compilation = + compilation + |> verifyCompilation DoNotOptimize + +[] +let ``Nullable attr for ref DUs`` compilation = + compilation + |> verifyCompilation DoNotOptimize + +[] +let ``Nullable attr for struct DUs`` compilation = + compilation + |> verifyCompilation DoNotOptimize + +[] +let ``Nullable attr for custom type`` compilation = + compilation + |> verifyCompilation DoNotOptimize + +[] +let ``Nullable attr for Option clones`` compilation = + compilation + |> verifyCompilation DoNotOptimize + +[] +let ``Generic struct DU`` compilation = + compilation + |> verifyCompilation DoNotOptimize + +[] +let ``Nullable inheritance`` compilation = + compilation + |> verifyCompilation DoNotOptimize + +[] +let ``Custom pipe`` compilation = + compilation + |> verifyCompilation DoNotOptimize + +[] +let ``SupportsNull`` compilation = + compilation + |> withNoWarn 52 + |> verifyCompilation DoNotOptimize + + +module Interop = + open System.IO + + let fsharpLibCreator = + FSharp + >> asLibrary + >> withName "MyFSharpLib" + >> withOptions ["--checknulls"] + + let csharpLibCompile fsLibReference = + CSharp + >> withReferences [fsLibReference] + >> withCSharpLanguageVersion CSharpLanguageVersion.Preview + >> asLibrary + >> withName "CsharpAppConsumingNullness" + >> compile + + let FsharpFromFile filename = + Path.Combine(__SOURCE_DIRECTORY__, filename) + |> File.ReadAllText + |> fsharpLibCreator + + [] + let ``Csharp understands option like type using UseNullAsTrueValue`` () = + let csharpCode = """ +using System; +using static TestModule; +using static Microsoft.FSharp.Core.FuncConvert; +#nullable enable +public class C { + // MyNullableOption has [] applied on it + public void M(MyNullableOption customOption) { + + Console.WriteLine(customOption.ToString()); // should not warn + + var thisIsNone = MyNullableOption.MyNone; + Console.WriteLine(thisIsNone.ToString()); // !! should warn !! + + var mapped = mapPossiblyNullable(ToFSharpFunc(x => x.ToString()), customOption); // should not warn, because null will not be passed + var mapped2 = mapPossiblyNullable(ToFSharpFunc(x => x + ".."), thisIsNone); // should NOT warn for passing in none, this is allowed + + if(thisIsNone != null) + Console.WriteLine(thisIsNone.ToString()); // should NOT warn + + if(customOption != null) + Console.WriteLine(customOption.ToString()); // should NOT warn + + Console.WriteLine(MyOptionWhichCannotHaveNullInTheInside.NewMyNotNullSome("").ToString()); // should NOT warn + + } +}""" + csharpCode + |> csharpLibCompile (FsharpFromFile "NullAsTrueValue.fs") + |> withDiagnostics [ Warning 8602, Line 12, Col 27, Line 12, Col 37, "Dereference of a possibly null reference."] + + [] + let ``Csharp understands Fsharp-produced struct unions via IsXXX flow analysis`` () = + let csharpCode = """ +#nullable enable +public class C { + public void M() { + var data = MyTestModule.MyStructDU.A; + if(data.IsA){ + string thisMustWarn = data.nonNullableString; + string? thisIsOk = data.nonNullableString; + string? thisIsAlsoOk = data.nullableString; + System.Console.Write(thisMustWarn + thisIsOk + thisIsAlsoOk); + } else if(data.IsB){ + string thisMustBeOK = data.nonNullableString; + System.Console.Write(thisMustBeOK.Length); + } else if (data.IsC){ + string evenThoughItIsC_ThisMustStillFailBecauseFieldIsNullable = data.nullableString; + System.Console.Write(evenThoughItIsC_ThisMustStillFailBecauseFieldIsNullable.Length); + } + + var thisCreationIsBad = MyTestModule.MyStructDU.NewB(null); + var thisCreationIsFine = MyTestModule.MyStructDU.NewC(null); + + System.Console.Write(thisCreationIsBad.ToString() + thisCreationIsFine.ToString() ); + } +}""" + csharpCode + |> csharpLibCompile (FsharpFromFile "StructDU.fs") + |> withDiagnostics [ + Warning 8600, Line 6, Col 35, Line 6, Col 57, "Converting null literal or possible null value to non-nullable type." + Warning 8600, Line 14, Col 78, Line 14, Col 97, "Converting null literal or possible null value to non-nullable type." + Warning 8602, Line 15, Col 34, Line 15, Col 89, "Dereference of a possibly null reference." + Warning 8625, Line 18, Col 62, Line 18, Col 66, "Cannot convert null literal to non-nullable reference type."] + + [] + let ``Csharp code understands Fsharp-produced generics`` () = + let fsharpcode = """ +module MyFSharpLib +let stringTupleInOut(x:struct(string * string|null)) = x """ + let fsLib = fsharpLibCreator fsharpcode + let csharpCode = """ +#nullable enable +public class C { + public void M() { + string? nullString = null; + MyFSharpLib.stringTupleInOut(("a good string here",nullString)); + } +}""" + csharpCode + |> csharpLibCompile fsLib + |> withDiagnostics [] + + [] + let ``Csharp code can work with annotated FSharp module`` () = + Path.Combine(__SOURCE_DIRECTORY__,"CsharpConsumer.cs") + |> File.ReadAllText + |> csharpLibCompile (FsharpFromFile "ModuleLevelFunctions.fs") + |> shouldFail + |> withDiagnostics [ + Error 29, Line 28, Col 20, Line 28, Col 61, "Cannot implicitly convert type 'int' to 'string'" + Warning 8625, Line 12, Col 74, Line 12, Col 78, "Cannot convert null literal to non-nullable reference type." + Warning 8604, Line 14, Col 88, Line 14, Col 113, "Possible null reference argument for parameter 'x' in 'string MyTestModule.nonNullableInputOutputFunc(string x)'." + Warning 8620, Line 19, Col 88, Line 19, Col 101, "Argument of type '(string?, string?, int, int, int, int)' cannot be used for parameter 'x' of type '(string, string?, int, int, int, int)' in '(string, string?, int, int, int, int) MyTestModule.genericValueTypeTest((string, string?, int, int, int, int) x)' due to differences in the nullability of reference types." + Warning 8604, Line 21, Col 84, Line 21, Col 114, "Possible null reference argument for parameter 'x' in 'string MyTestModule.nonNullableInputOutputFunc(string x)'." + Warning 8604, Line 24, Col 60, Line 24, Col 70, "Possible null reference argument for parameter 'x_0' in 'Tuple MyTestModule.genericRefTypeTest(string x_0, string? x_1, int x_2, int x_3, int x_4, int x_5)'." + Warning 8604, Line 25, Col 45, Line 25, Col 59, "Possible null reference argument for parameter 'x_0' in 'Tuple MyTestModule.genericRefTypeTest(string x_0, string? x_1, int x_2, int x_3, int x_4, int x_5)'." + Warning 8625, Line 28, Col 51, Line 28, Col 55, "Cannot convert null literal to non-nullable reference type."] \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/Records.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/Records.fs new file mode 100644 index 00000000000..0fff3c6c6e0 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/Records.fs @@ -0,0 +1,27 @@ +module MyTestModule + +let maybeString : string | null = null + +[] +type MyRecord<'X,'Y,'Z when 'Y:null and 'Z:not null> = + { + JustInt : int + NullInt : System.Nullable + JustString : string + NullableString : string | null + GenericNormalField : 'X + GenericNullableField : 'Y + GenericNotNullField : 'Z } + +let createAnInstance () = + { + JustInt = 42 + NullInt = System.Nullable.op_Implicit(42) + JustString = "" + NullableString = null + GenericNormalField = 42 + GenericNullableField = maybeString + GenericNotNullField = ""} + + +let stringOfInst() : string = createAnInstance().ToString() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/Records.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/Records.fs.il.net472.bsl new file mode 100644 index 00000000000..d4c152a8ce3 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/Records.fs.il.net472.bsl @@ -0,0 +1,459 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class auto ansi serializable sealed nested public beforefieldinit MyRecord`3 + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoComparisonAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoEqualityAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 02 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param type X + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + .param type Y + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param type Z + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field assembly int32 JustInt@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field assembly valuetype [runtime]System.Nullable`1 NullInt@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field assembly string JustString@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field assembly string NullableString@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .field assembly !X GenericNormalField@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field assembly !Y GenericNullableField@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field assembly !Z GenericNotNullField@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public hidebysig specialname instance int32 get_JustInt() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 class MyTestModule/MyRecord`3::JustInt@ + IL_0006: ret + } + + .method public hidebysig specialname + instance valuetype [runtime]System.Nullable`1 + get_NullInt() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld valuetype [runtime]System.Nullable`1 class MyTestModule/MyRecord`3::NullInt@ + IL_0006: ret + } + + .method public hidebysig specialname instance string get_JustString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string class MyTestModule/MyRecord`3::JustString@ + IL_0006: ret + } + + .method public hidebysig specialname instance string get_NullableString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string class MyTestModule/MyRecord`3::NullableString@ + IL_0006: ret + } + + .method public hidebysig specialname instance !X get_GenericNormalField() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !0 class MyTestModule/MyRecord`3::GenericNormalField@ + IL_0006: ret + } + + .method public hidebysig specialname instance !Y get_GenericNullableField() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !1 class MyTestModule/MyRecord`3::GenericNullableField@ + IL_0006: ret + } + + .method public hidebysig specialname instance !Z get_GenericNotNullField() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !2 class MyTestModule/MyRecord`3::GenericNotNullField@ + IL_0006: ret + } + + .method public specialname rtspecialname + instance void .ctor(int32 justInt, + valuetype [runtime]System.Nullable`1 nullInt, + string justString, + string nullableString, + !X genericNormalField, + !Y genericNullableField, + !Z genericNotNullField) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 17 4D 79 54 65 73 74 4D 6F 64 + 75 6C 65 2B 4D 79 52 65 63 6F 72 64 60 33 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 class MyTestModule/MyRecord`3::JustInt@ + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld valuetype [runtime]System.Nullable`1 class MyTestModule/MyRecord`3::NullInt@ + IL_0014: ldarg.0 + IL_0015: ldarg.3 + IL_0016: stfld string class MyTestModule/MyRecord`3::JustString@ + IL_001b: ldarg.0 + IL_001c: ldarg.s nullableString + IL_001e: stfld string class MyTestModule/MyRecord`3::NullableString@ + IL_0023: ldarg.0 + IL_0024: ldarg.s genericNormalField + IL_0026: stfld !0 class MyTestModule/MyRecord`3::GenericNormalField@ + IL_002b: ldarg.0 + IL_002c: ldarg.s genericNullableField + IL_002e: stfld !1 class MyTestModule/MyRecord`3::GenericNullableField@ + IL_0033: ldarg.0 + IL_0034: ldarg.s genericNotNullField + IL_0036: stfld !2 class MyTestModule/MyRecord`3::GenericNotNullField@ + IL_003b: ret + } + + .method public strict virtual instance string ToString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,string>,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class MyTestModule/MyRecord`3>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString,string>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,string>::Invoke(!0) + IL_0015: ret + } + + .property instance int32 JustInt() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) + .get instance int32 MyTestModule/MyRecord`3::get_JustInt() + } + .property instance valuetype [runtime]System.Nullable`1 + NullInt() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 ) + .get instance valuetype [runtime]System.Nullable`1 MyTestModule/MyRecord`3::get_NullInt() + } + .property instance string JustString() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 02 00 00 00 00 00 ) + .get instance string MyTestModule/MyRecord`3::get_JustString() + } + .property instance string NullableString() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 03 00 00 00 00 00 ) + .get instance string MyTestModule/MyRecord`3::get_NullableString() + } + .property instance !X GenericNormalField() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 04 00 00 00 00 00 ) + .get instance !X MyTestModule/MyRecord`3::get_GenericNormalField() + } + .property instance !Y GenericNullableField() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 05 00 00 00 00 00 ) + .get instance !Y MyTestModule/MyRecord`3::get_GenericNullableField() + } + .property instance !Z GenericNotNullField() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 06 00 00 00 00 00 ) + .get instance !Z MyTestModule/MyRecord`3::get_GenericNotNullField() + } + } + + .method public specialname static string get_maybeString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + } + + .method public static class MyTestModule/MyRecord`3 createAnInstance() cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 01 02 01 00 00 ) + + .maxstack 9 + IL_0000: ldc.i4.s 42 + IL_0002: ldc.i4.s 42 + IL_0004: call valuetype [runtime]System.Nullable`1 valuetype [runtime]System.Nullable`1::op_Implicit(!0) + IL_0009: ldstr "" + IL_000e: ldnull + IL_000f: ldc.i4.s 42 + IL_0011: call string MyTestModule::get_maybeString() + IL_0016: ldstr "" + IL_001b: newobj instance void class MyTestModule/MyRecord`3::.ctor(int32, + valuetype [runtime]System.Nullable`1, + string, + string, + !0, + !1, + !2) + IL_0020: ret + } + + .method public static string stringOfInst() cil managed + { + + .maxstack 8 + IL_0000: call class MyTestModule/MyRecord`3 MyTestModule::createAnInstance() + IL_0005: tail. + IL_0007: callvirt instance string [runtime]System.Object::ToString() + IL_000c: ret + } + + .property string maybeString() + { + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .get string MyTestModule::get_maybeString() + } +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ +} + +.class private auto ansi serializable sealed System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes + extends [runtime]System.Enum +{ + .custom instance void [runtime]System.FlagsAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public specialname rtspecialname int32 value__ + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes All = int32(0xFFFFFFFF) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes None = int32(0x00000000) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicParameterlessConstructor = int32(0x00000001) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicConstructors = int32(0x00000003) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicConstructors = int32(0x00000004) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicMethods = int32(0x00000008) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicMethods = int32(0x00000010) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicFields = int32(0x00000020) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicFields = int32(0x00000040) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicNestedTypes = int32(0x00000080) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicNestedTypes = int32(0x00000100) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicProperties = int32(0x00000200) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicProperties = int32(0x00000400) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicEvents = int32(0x00000800) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicEvents = int32(0x00001000) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes Interfaces = int32(0x00002000) +} + +.class private auto ansi beforefieldinit System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field private valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field private class [runtime]System.Type Type@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname + instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, + class [runtime]System.Type Type) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ + IL_0014: ret + } + + .method public hidebysig specialname instance class [runtime]System.Type get_Type() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ + IL_0006: ret + } + + .method public hidebysig specialname instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes get_MemberType() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ + IL_0006: ret + } + + .property instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes + MemberType() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_MemberType() + } + .property instance class [runtime]System.Type + Type() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_Type() + } +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8[] NullableFlags + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 scalarByteValue) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldc.i4.1 + IL_0008: newarr [runtime]System.Byte + IL_000d: dup + IL_000e: ldc.i4.0 + IL_000f: ldarg.1 + IL_0010: stelem.i1 + IL_0011: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_0016: ret + } + + .method public specialname rtspecialname instance void .ctor(uint8[] NullableFlags) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_000d: ret + } + +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableContextAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8 Flag + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 Flag) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8 System.Runtime.CompilerServices.NullableContextAttribute::Flag + IL_000d: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/Records.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/Records.fs.il.netcore.bsl new file mode 100644 index 00000000000..5edf4dc0c5a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/Records.fs.il.netcore.bsl @@ -0,0 +1,302 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class auto ansi serializable sealed nested public beforefieldinit MyRecord`3 + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoComparisonAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoEqualityAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 02 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param type X + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + .param type Y + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param type Z + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .field assembly int32 JustInt@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field assembly valuetype [runtime]System.Nullable`1 NullInt@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field assembly string JustString@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field assembly string NullableString@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .field assembly !X GenericNormalField@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field assembly !Y GenericNullableField@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field assembly !Z GenericNotNullField@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public hidebysig specialname instance int32 get_JustInt() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 class MyTestModule/MyRecord`3::JustInt@ + IL_0006: ret + } + + .method public hidebysig specialname + instance valuetype [runtime]System.Nullable`1 + get_NullInt() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld valuetype [runtime]System.Nullable`1 class MyTestModule/MyRecord`3::NullInt@ + IL_0006: ret + } + + .method public hidebysig specialname instance string get_JustString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string class MyTestModule/MyRecord`3::JustString@ + IL_0006: ret + } + + .method public hidebysig specialname instance string get_NullableString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string class MyTestModule/MyRecord`3::NullableString@ + IL_0006: ret + } + + .method public hidebysig specialname instance !X get_GenericNormalField() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !0 class MyTestModule/MyRecord`3::GenericNormalField@ + IL_0006: ret + } + + .method public hidebysig specialname instance !Y get_GenericNullableField() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !1 class MyTestModule/MyRecord`3::GenericNullableField@ + IL_0006: ret + } + + .method public hidebysig specialname instance !Z get_GenericNotNullField() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !2 class MyTestModule/MyRecord`3::GenericNotNullField@ + IL_0006: ret + } + + .method public specialname rtspecialname + instance void .ctor(int32 justInt, + valuetype [runtime]System.Nullable`1 nullInt, + string justString, + string nullableString, + !X genericNormalField, + !Y genericNullableField, + !Z genericNotNullField) cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 17 4D 79 54 65 73 74 4D 6F 64 + 75 6C 65 2B 4D 79 52 65 63 6F 72 64 60 33 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 class MyTestModule/MyRecord`3::JustInt@ + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld valuetype [runtime]System.Nullable`1 class MyTestModule/MyRecord`3::NullInt@ + IL_0014: ldarg.0 + IL_0015: ldarg.3 + IL_0016: stfld string class MyTestModule/MyRecord`3::JustString@ + IL_001b: ldarg.0 + IL_001c: ldarg.s nullableString + IL_001e: stfld string class MyTestModule/MyRecord`3::NullableString@ + IL_0023: ldarg.0 + IL_0024: ldarg.s genericNormalField + IL_0026: stfld !0 class MyTestModule/MyRecord`3::GenericNormalField@ + IL_002b: ldarg.0 + IL_002c: ldarg.s genericNullableField + IL_002e: stfld !1 class MyTestModule/MyRecord`3::GenericNullableField@ + IL_0033: ldarg.0 + IL_0034: ldarg.s genericNotNullField + IL_0036: stfld !2 class MyTestModule/MyRecord`3::GenericNotNullField@ + IL_003b: ret + } + + .method public strict virtual instance string ToString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,string>,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class MyTestModule/MyRecord`3>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString,string>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,string>::Invoke(!0) + IL_0015: ret + } + + .property instance int32 JustInt() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) + .get instance int32 MyTestModule/MyRecord`3::get_JustInt() + } + .property instance valuetype [runtime]System.Nullable`1 + NullInt() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 ) + .get instance valuetype [runtime]System.Nullable`1 MyTestModule/MyRecord`3::get_NullInt() + } + .property instance string JustString() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 02 00 00 00 00 00 ) + .get instance string MyTestModule/MyRecord`3::get_JustString() + } + .property instance string NullableString() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 03 00 00 00 00 00 ) + .get instance string MyTestModule/MyRecord`3::get_NullableString() + } + .property instance !X GenericNormalField() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 04 00 00 00 00 00 ) + .get instance !X MyTestModule/MyRecord`3::get_GenericNormalField() + } + .property instance !Y GenericNullableField() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 05 00 00 00 00 00 ) + .get instance !Y MyTestModule/MyRecord`3::get_GenericNullableField() + } + .property instance !Z GenericNotNullField() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 06 00 00 00 00 00 ) + .get instance !Z MyTestModule/MyRecord`3::get_GenericNotNullField() + } + } + + .method public specialname static string get_maybeString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + } + + .method public static class MyTestModule/MyRecord`3 createAnInstance() cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 03 00 00 00 01 02 01 00 00 ) + + .maxstack 9 + IL_0000: ldc.i4.s 42 + IL_0002: ldc.i4.s 42 + IL_0004: call valuetype [runtime]System.Nullable`1 valuetype [runtime]System.Nullable`1::op_Implicit(!0) + IL_0009: ldstr "" + IL_000e: ldnull + IL_000f: ldc.i4.s 42 + IL_0011: call string MyTestModule::get_maybeString() + IL_0016: ldstr "" + IL_001b: newobj instance void class MyTestModule/MyRecord`3::.ctor(int32, + valuetype [runtime]System.Nullable`1, + string, + string, + !0, + !1, + !2) + IL_0020: ret + } + + .method public static string stringOfInst() cil managed + { + + .maxstack 8 + IL_0000: call class MyTestModule/MyRecord`3 MyTestModule::createAnInstance() + IL_0005: tail. + IL_0007: callvirt instance string [runtime]System.Object::ToString() + IL_000c: ret + } + + .property string maybeString() + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .get string MyTestModule::get_maybeString() + } +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ReferenceDU.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ReferenceDU.fs new file mode 100644 index 00000000000..95ed41ea247 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ReferenceDU.fs @@ -0,0 +1,20 @@ +module MyTestModule + +[] +type MyDu = + | JustLabel + | JustInt of int + | MaybeString of (string | null) + +let giveMeLabel () = JustLabel + +let giveMeLabelsText() : string = giveMeLabel().ToString() + +let createMaybeString (innerValue:string|null) = MaybeString innerValue + +let processNullableDu (x : (MyDu | null)) : string | null = + match x with + | null -> null + | JustLabel -> null + | JustInt x -> string x + | MaybeString x -> x \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ReferenceDU.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ReferenceDU.fs.il.net472.bsl new file mode 100644 index 00000000000..58897d97d51 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ReferenceDU.fs.il.net472.bsl @@ -0,0 +1,757 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern netstandard +{ + .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) + .ver 2:1:0:0 +} +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class abstract auto autochar serializable nested public beforefieldinit MyDu + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoComparisonAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoEqualityAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class abstract auto ansi sealed nested public Tags + extends [runtime]System.Object + { + .field public static literal int32 JustLabel = int32(0x00000000) + .field public static literal int32 JustInt = int32(0x00000001) + .field public static literal int32 MaybeString = int32(0x00000002) + } + + .class auto ansi serializable nested assembly beforefieldinit specialname _JustLabel + extends MyTestModule/MyDu + { + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerTypeProxyAttribute::.ctor(class [runtime]System.Type) = ( 01 00 2B 4D 79 54 65 73 74 4D 6F 64 75 6C 65 2B + 4D 79 44 75 2B 5F 4A 75 73 74 4C 61 62 65 6C 40 + 44 65 62 75 67 54 79 70 65 50 72 6F 78 79 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 11 4D 79 54 65 73 74 4D 6F 64 + 75 6C 65 2B 4D 79 44 75 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void MyTestModule/MyDu::.ctor() + IL_0006: ret + } + + } + + .class auto ansi serializable nested public beforefieldinit specialname JustInt + extends MyTestModule/MyDu + { + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerTypeProxyAttribute::.ctor(class [runtime]System.Type) = ( 01 00 28 4D 79 54 65 73 74 4D 6F 64 75 6C 65 2B + 4D 79 44 75 2B 4A 75 73 74 49 6E 74 40 44 65 62 + 75 67 54 79 70 65 50 72 6F 78 79 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .field assembly initonly int32 item + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(int32 item) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 11 4D 79 54 65 73 74 4D 6F 64 + 75 6C 65 2B 4D 79 44 75 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void MyTestModule/MyDu::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 MyTestModule/MyDu/JustInt::item + IL_000d: ret + } + + .method public hidebysig instance int32 get_Item() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 MyTestModule/MyDu/JustInt::item + IL_0006: ret + } + + .property instance int32 Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance int32 MyTestModule/MyDu/JustInt::get_Item() + } + } + + .class auto ansi serializable nested public beforefieldinit specialname MaybeString + extends MyTestModule/MyDu + { + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerTypeProxyAttribute::.ctor(class [runtime]System.Type) = ( 01 00 2C 4D 79 54 65 73 74 4D 6F 64 75 6C 65 2B + 4D 79 44 75 2B 4D 61 79 62 65 53 74 72 69 6E 67 + 40 44 65 62 75 67 54 79 70 65 50 72 6F 78 79 00 + 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .field assembly initonly string item + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(string item) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 11 4D 79 54 65 73 74 4D 6F 64 + 75 6C 65 2B 4D 79 44 75 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void MyTestModule/MyDu::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld string MyTestModule/MyDu/MaybeString::item + IL_000d: ret + } + + .method public hidebysig instance string get_Item() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string MyTestModule/MyDu/MaybeString::item + IL_0006: ret + } + + .property instance string Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 02 00 00 00 00 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance string MyTestModule/MyDu/MaybeString::get_Item() + } + } + + .class auto ansi nested assembly beforefieldinit specialname _JustLabel@DebugTypeProxy + extends [runtime]System.Object + { + .field assembly class MyTestModule/MyDu/_JustLabel _obj + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(class MyTestModule/MyDu/_JustLabel obj) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 11 4D 79 54 65 73 74 4D 6F 64 + 75 6C 65 2B 4D 79 44 75 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class MyTestModule/MyDu/_JustLabel MyTestModule/MyDu/_JustLabel@DebugTypeProxy::_obj + IL_000d: ret + } + + } + + .class auto ansi nested assembly beforefieldinit specialname JustInt@DebugTypeProxy + extends [runtime]System.Object + { + .field assembly class MyTestModule/MyDu/JustInt _obj + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(class MyTestModule/MyDu/JustInt obj) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 11 4D 79 54 65 73 74 4D 6F 64 + 75 6C 65 2B 4D 79 44 75 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class MyTestModule/MyDu/JustInt MyTestModule/MyDu/JustInt@DebugTypeProxy::_obj + IL_000d: ret + } + + .method public hidebysig instance int32 get_Item() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class MyTestModule/MyDu/JustInt MyTestModule/MyDu/JustInt@DebugTypeProxy::_obj + IL_0006: ldfld int32 MyTestModule/MyDu/JustInt::item + IL_000b: ret + } + + .property instance int32 Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance int32 MyTestModule/MyDu/JustInt@DebugTypeProxy::get_Item() + } + } + + .class auto ansi nested assembly beforefieldinit specialname MaybeString@DebugTypeProxy + extends [runtime]System.Object + { + .field assembly class MyTestModule/MyDu/MaybeString _obj + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(class MyTestModule/MyDu/MaybeString obj) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 11 4D 79 54 65 73 74 4D 6F 64 + 75 6C 65 2B 4D 79 44 75 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class MyTestModule/MyDu/MaybeString MyTestModule/MyDu/MaybeString@DebugTypeProxy::_obj + IL_000d: ret + } + + .method public hidebysig instance string get_Item() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class MyTestModule/MyDu/MaybeString MyTestModule/MyDu/MaybeString@DebugTypeProxy::_obj + IL_0006: ldfld string MyTestModule/MyDu/MaybeString::item + IL_000b: ret + } + + .property instance string Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 02 00 00 00 00 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance string MyTestModule/MyDu/MaybeString@DebugTypeProxy::get_Item() + } + } + + .field static assembly initonly class MyTestModule/MyDu _unique_JustLabel + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: newobj instance void MyTestModule/MyDu/_JustLabel::.ctor() + IL_0005: stsfld class MyTestModule/MyDu MyTestModule/MyDu::_unique_JustLabel + IL_000a: ret + } + + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 E0 07 00 00 11 4D 79 54 65 73 74 4D 6F 64 + 75 6C 65 2B 4D 79 44 75 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ret + } + + .method public static class MyTestModule/MyDu get_JustLabel() cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldsfld class MyTestModule/MyDu MyTestModule/MyDu::_unique_JustLabel + IL_0005: ret + } + + .method public hidebysig instance bool get_IsJustLabel() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: isinst MyTestModule/MyDu/_JustLabel + IL_0006: ldnull + IL_0007: cgt.un + IL_0009: ret + } + + .method public static class MyTestModule/MyDu NewJustInt(int32 item) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 01 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void MyTestModule/MyDu/JustInt::.ctor(int32) + IL_0006: ret + } + + .method public hidebysig instance bool get_IsJustInt() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: isinst MyTestModule/MyDu/JustInt + IL_0006: ldnull + IL_0007: cgt.un + IL_0009: ret + } + + .method public static class MyTestModule/MyDu NewMaybeString(string item) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 02 00 00 00 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void MyTestModule/MyDu/MaybeString::.ctor(string) + IL_0006: ret + } + + .method public hidebysig instance bool get_IsMaybeString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: isinst MyTestModule/MyDu/MaybeString + IL_0006: ldnull + IL_0007: cgt.un + IL_0009: ret + } + + .method public hidebysig instance int32 get_Tag() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: isinst MyTestModule/MyDu/MaybeString + IL_0006: brfalse.s IL_000b + + IL_0008: ldc.i4.2 + IL_0009: br.s IL_0017 + + IL_000b: ldarg.0 + IL_000c: isinst MyTestModule/MyDu/JustInt + IL_0011: brfalse.s IL_0016 + + IL_0013: ldc.i4.1 + IL_0014: br.s IL_0017 + + IL_0016: ldc.i4.0 + IL_0017: ret + } + + .method assembly hidebysig specialname instance object __DebugDisplay() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+0.8A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } + + .method public strict virtual instance string ToString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class MyTestModule/MyDu>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } + + .property instance int32 Tag() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance int32 MyTestModule/MyDu::get_Tag() + } + .property class MyTestModule/MyDu JustLabel() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get class MyTestModule/MyDu MyTestModule/MyDu::get_JustLabel() + } + .property instance bool IsJustLabel() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool MyTestModule/MyDu::get_IsJustLabel() + } + .property instance bool IsJustInt() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool MyTestModule/MyDu::get_IsJustInt() + } + .property instance bool IsMaybeString() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool MyTestModule/MyDu::get_IsMaybeString() + } + } + + .method public static class MyTestModule/MyDu giveMeLabel() cil managed + { + + .maxstack 8 + IL_0000: call class MyTestModule/MyDu MyTestModule/MyDu::get_JustLabel() + IL_0005: ret + } + + .method public static string giveMeLabelsText() cil managed + { + + .maxstack 8 + IL_0000: call class MyTestModule/MyDu MyTestModule::giveMeLabel() + IL_0005: tail. + IL_0007: callvirt instance string [runtime]System.Object::ToString() + IL_000c: ret + } + + .method public static class MyTestModule/MyDu createMaybeString(string innerValue) cil managed + { + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call class MyTestModule/MyDu MyTestModule/MyDu::NewMaybeString(string) + IL_0006: ret + } + + .method public static string processNullableDu(class MyTestModule/MyDu x) cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 5 + .locals init (class MyTestModule/MyDu V_0, + class MyTestModule/MyDu V_1, + class MyTestModule/MyDu/JustInt V_2, + int32 V_3, + int32 V_4, + class MyTestModule/MyDu/MaybeString V_5, + string V_6) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: brfalse.s IL_0019 + + IL_0005: ldloc.0 + IL_0006: stloc.1 + IL_0007: ldloc.1 + IL_0008: isinst MyTestModule/MyDu/JustInt + IL_000d: brtrue.s IL_001d + + IL_000f: ldloc.1 + IL_0010: isinst MyTestModule/MyDu/MaybeString + IL_0015: brtrue.s IL_0048 + + IL_0017: br.s IL_001b + + IL_0019: ldnull + IL_001a: ret + + IL_001b: ldnull + IL_001c: ret + + IL_001d: ldloc.0 + IL_001e: castclass MyTestModule/MyDu/JustInt + IL_0023: stloc.2 + IL_0024: ldloc.2 + IL_0025: ldfld int32 MyTestModule/MyDu/JustInt::item + IL_002a: stloc.3 + IL_002b: ldloc.3 + IL_002c: stloc.s V_4 + IL_002e: ldloc.s V_4 + IL_0030: box [runtime]System.Int32 + IL_0035: unbox.any [runtime]System.IFormattable + IL_003a: ldnull + IL_003b: call class [netstandard]System.Globalization.CultureInfo [netstandard]System.Globalization.CultureInfo::get_InvariantCulture() + IL_0040: tail. + IL_0042: callvirt instance string [netstandard]System.IFormattable::ToString(string, + class [netstandard]System.IFormatProvider) + IL_0047: ret + + IL_0048: ldloc.0 + IL_0049: castclass MyTestModule/MyDu/MaybeString + IL_004e: stloc.s V_5 + IL_0050: ldloc.s V_5 + IL_0052: ldfld string MyTestModule/MyDu/MaybeString::item + IL_0057: stloc.s V_6 + IL_0059: ldloc.s V_6 + IL_005b: ret + } + +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ +} + +.class private auto ansi serializable sealed System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes + extends [runtime]System.Enum +{ + .custom instance void [runtime]System.FlagsAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public specialname rtspecialname int32 value__ + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes All = int32(0xFFFFFFFF) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes None = int32(0x00000000) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicParameterlessConstructor = int32(0x00000001) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicConstructors = int32(0x00000003) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicConstructors = int32(0x00000004) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicMethods = int32(0x00000008) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicMethods = int32(0x00000010) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicFields = int32(0x00000020) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicFields = int32(0x00000040) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicNestedTypes = int32(0x00000080) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicNestedTypes = int32(0x00000100) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicProperties = int32(0x00000200) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicProperties = int32(0x00000400) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicEvents = int32(0x00000800) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicEvents = int32(0x00001000) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes Interfaces = int32(0x00002000) +} + +.class private auto ansi beforefieldinit System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field private valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field private class [runtime]System.Type Type@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname + instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, + class [runtime]System.Type Type) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ + IL_0014: ret + } + + .method public hidebysig specialname instance class [runtime]System.Type get_Type() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ + IL_0006: ret + } + + .method public hidebysig specialname instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes get_MemberType() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ + IL_0006: ret + } + + .property instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes + MemberType() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_MemberType() + } + .property instance class [runtime]System.Type + Type() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_Type() + } +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8[] NullableFlags + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 scalarByteValue) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldc.i4.1 + IL_0008: newarr [runtime]System.Byte + IL_000d: dup + IL_000e: ldc.i4.0 + IL_000f: ldarg.1 + IL_0010: stelem.i1 + IL_0011: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_0016: ret + } + + .method public specialname rtspecialname instance void .ctor(uint8[] NullableFlags) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_000d: ret + } + +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableContextAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8 Flag + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 Flag) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8 System.Runtime.CompilerServices.NullableContextAttribute::Flag + IL_000d: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ReferenceDU.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ReferenceDU.fs.il.netcore.bsl new file mode 100644 index 00000000000..0e99fd80dc1 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ReferenceDU.fs.il.netcore.bsl @@ -0,0 +1,600 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern netstandard +{ + .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) + .ver 2:1:0:0 +} +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class abstract auto autochar serializable nested public beforefieldinit MyDu + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoComparisonAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoEqualityAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class abstract auto ansi sealed nested public Tags + extends [runtime]System.Object + { + .field public static literal int32 JustLabel = int32(0x00000000) + .field public static literal int32 JustInt = int32(0x00000001) + .field public static literal int32 MaybeString = int32(0x00000002) + } + + .class auto ansi serializable nested assembly beforefieldinit specialname _JustLabel + extends MyTestModule/MyDu + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerTypeProxyAttribute::.ctor(class [runtime]System.Type) = ( 01 00 2B 4D 79 54 65 73 74 4D 6F 64 75 6C 65 2B + 4D 79 44 75 2B 5F 4A 75 73 74 4C 61 62 65 6C 40 + 44 65 62 75 67 54 79 70 65 50 72 6F 78 79 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 11 4D 79 54 65 73 74 4D 6F 64 + 75 6C 65 2B 4D 79 44 75 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void MyTestModule/MyDu::.ctor() + IL_0006: ret + } + + } + + .class auto ansi serializable nested public beforefieldinit specialname JustInt + extends MyTestModule/MyDu + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerTypeProxyAttribute::.ctor(class [runtime]System.Type) = ( 01 00 28 4D 79 54 65 73 74 4D 6F 64 75 6C 65 2B + 4D 79 44 75 2B 4A 75 73 74 49 6E 74 40 44 65 62 + 75 67 54 79 70 65 50 72 6F 78 79 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .field assembly initonly int32 item + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(int32 item) cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 11 4D 79 54 65 73 74 4D 6F 64 + 75 6C 65 2B 4D 79 44 75 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void MyTestModule/MyDu::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 MyTestModule/MyDu/JustInt::item + IL_000d: ret + } + + .method public hidebysig instance int32 get_Item() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 MyTestModule/MyDu/JustInt::item + IL_0006: ret + } + + .property instance int32 Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance int32 MyTestModule/MyDu/JustInt::get_Item() + } + } + + .class auto ansi serializable nested public beforefieldinit specialname MaybeString + extends MyTestModule/MyDu + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerTypeProxyAttribute::.ctor(class [runtime]System.Type) = ( 01 00 2C 4D 79 54 65 73 74 4D 6F 64 75 6C 65 2B + 4D 79 44 75 2B 4D 61 79 62 65 53 74 72 69 6E 67 + 40 44 65 62 75 67 54 79 70 65 50 72 6F 78 79 00 + 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .field assembly initonly string item + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(string item) cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 11 4D 79 54 65 73 74 4D 6F 64 + 75 6C 65 2B 4D 79 44 75 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void MyTestModule/MyDu::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld string MyTestModule/MyDu/MaybeString::item + IL_000d: ret + } + + .method public hidebysig instance string get_Item() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string MyTestModule/MyDu/MaybeString::item + IL_0006: ret + } + + .property instance string Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 02 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance string MyTestModule/MyDu/MaybeString::get_Item() + } + } + + .class auto ansi nested assembly beforefieldinit specialname _JustLabel@DebugTypeProxy + extends [runtime]System.Object + { + .field assembly class MyTestModule/MyDu/_JustLabel _obj + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(class MyTestModule/MyDu/_JustLabel obj) cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 11 4D 79 54 65 73 74 4D 6F 64 + 75 6C 65 2B 4D 79 44 75 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class MyTestModule/MyDu/_JustLabel MyTestModule/MyDu/_JustLabel@DebugTypeProxy::_obj + IL_000d: ret + } + + } + + .class auto ansi nested assembly beforefieldinit specialname JustInt@DebugTypeProxy + extends [runtime]System.Object + { + .field assembly class MyTestModule/MyDu/JustInt _obj + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(class MyTestModule/MyDu/JustInt obj) cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 11 4D 79 54 65 73 74 4D 6F 64 + 75 6C 65 2B 4D 79 44 75 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class MyTestModule/MyDu/JustInt MyTestModule/MyDu/JustInt@DebugTypeProxy::_obj + IL_000d: ret + } + + .method public hidebysig instance int32 get_Item() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class MyTestModule/MyDu/JustInt MyTestModule/MyDu/JustInt@DebugTypeProxy::_obj + IL_0006: ldfld int32 MyTestModule/MyDu/JustInt::item + IL_000b: ret + } + + .property instance int32 Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance int32 MyTestModule/MyDu/JustInt@DebugTypeProxy::get_Item() + } + } + + .class auto ansi nested assembly beforefieldinit specialname MaybeString@DebugTypeProxy + extends [runtime]System.Object + { + .field assembly class MyTestModule/MyDu/MaybeString _obj + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(class MyTestModule/MyDu/MaybeString obj) cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 11 4D 79 54 65 73 74 4D 6F 64 + 75 6C 65 2B 4D 79 44 75 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class MyTestModule/MyDu/MaybeString MyTestModule/MyDu/MaybeString@DebugTypeProxy::_obj + IL_000d: ret + } + + .method public hidebysig instance string get_Item() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class MyTestModule/MyDu/MaybeString MyTestModule/MyDu/MaybeString@DebugTypeProxy::_obj + IL_0006: ldfld string MyTestModule/MyDu/MaybeString::item + IL_000b: ret + } + + .property instance string Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 02 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance string MyTestModule/MyDu/MaybeString@DebugTypeProxy::get_Item() + } + } + + .field static assembly initonly class MyTestModule/MyDu _unique_JustLabel + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: newobj instance void MyTestModule/MyDu/_JustLabel::.ctor() + IL_0005: stsfld class MyTestModule/MyDu MyTestModule/MyDu::_unique_JustLabel + IL_000a: ret + } + + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 E0 07 00 00 11 4D 79 54 65 73 74 4D 6F 64 + 75 6C 65 2B 4D 79 44 75 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ret + } + + .method public static class MyTestModule/MyDu get_JustLabel() cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldsfld class MyTestModule/MyDu MyTestModule/MyDu::_unique_JustLabel + IL_0005: ret + } + + .method public hidebysig instance bool get_IsJustLabel() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: isinst MyTestModule/MyDu/_JustLabel + IL_0006: ldnull + IL_0007: cgt.un + IL_0009: ret + } + + .method public static class MyTestModule/MyDu NewJustInt(int32 item) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 01 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void MyTestModule/MyDu/JustInt::.ctor(int32) + IL_0006: ret + } + + .method public hidebysig instance bool get_IsJustInt() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: isinst MyTestModule/MyDu/JustInt + IL_0006: ldnull + IL_0007: cgt.un + IL_0009: ret + } + + .method public static class MyTestModule/MyDu NewMaybeString(string item) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 02 00 00 00 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void MyTestModule/MyDu/MaybeString::.ctor(string) + IL_0006: ret + } + + .method public hidebysig instance bool get_IsMaybeString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: isinst MyTestModule/MyDu/MaybeString + IL_0006: ldnull + IL_0007: cgt.un + IL_0009: ret + } + + .method public hidebysig instance int32 get_Tag() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: isinst MyTestModule/MyDu/MaybeString + IL_0006: brfalse.s IL_000b + + IL_0008: ldc.i4.2 + IL_0009: br.s IL_0017 + + IL_000b: ldarg.0 + IL_000c: isinst MyTestModule/MyDu/JustInt + IL_0011: brfalse.s IL_0016 + + IL_0013: ldc.i4.1 + IL_0014: br.s IL_0017 + + IL_0016: ldc.i4.0 + IL_0017: ret + } + + .method assembly hidebysig specialname instance object __DebugDisplay() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+0.8A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } + + .method public strict virtual instance string ToString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class MyTestModule/MyDu>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } + + .property instance int32 Tag() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance int32 MyTestModule/MyDu::get_Tag() + } + .property class MyTestModule/MyDu JustLabel() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get class MyTestModule/MyDu MyTestModule/MyDu::get_JustLabel() + } + .property instance bool IsJustLabel() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool MyTestModule/MyDu::get_IsJustLabel() + } + .property instance bool IsJustInt() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool MyTestModule/MyDu::get_IsJustInt() + } + .property instance bool IsMaybeString() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool MyTestModule/MyDu::get_IsMaybeString() + } + } + + .method public static class MyTestModule/MyDu giveMeLabel() cil managed + { + + .maxstack 8 + IL_0000: call class MyTestModule/MyDu MyTestModule/MyDu::get_JustLabel() + IL_0005: ret + } + + .method public static string giveMeLabelsText() cil managed + { + + .maxstack 8 + IL_0000: call class MyTestModule/MyDu MyTestModule::giveMeLabel() + IL_0005: tail. + IL_0007: callvirt instance string [runtime]System.Object::ToString() + IL_000c: ret + } + + .method public static class MyTestModule/MyDu createMaybeString(string innerValue) cil managed + { + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call class MyTestModule/MyDu MyTestModule/MyDu::NewMaybeString(string) + IL_0006: ret + } + + .method public static string processNullableDu(class MyTestModule/MyDu x) cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 5 + .locals init (class MyTestModule/MyDu V_0, + class MyTestModule/MyDu V_1, + class MyTestModule/MyDu/JustInt V_2, + int32 V_3, + int32 V_4, + class MyTestModule/MyDu/MaybeString V_5, + string V_6) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: brfalse.s IL_0019 + + IL_0005: ldloc.0 + IL_0006: stloc.1 + IL_0007: ldloc.1 + IL_0008: isinst MyTestModule/MyDu/JustInt + IL_000d: brtrue.s IL_001d + + IL_000f: ldloc.1 + IL_0010: isinst MyTestModule/MyDu/MaybeString + IL_0015: brtrue.s IL_0048 + + IL_0017: br.s IL_001b + + IL_0019: ldnull + IL_001a: ret + + IL_001b: ldnull + IL_001c: ret + + IL_001d: ldloc.0 + IL_001e: castclass MyTestModule/MyDu/JustInt + IL_0023: stloc.2 + IL_0024: ldloc.2 + IL_0025: ldfld int32 MyTestModule/MyDu/JustInt::item + IL_002a: stloc.3 + IL_002b: ldloc.3 + IL_002c: stloc.s V_4 + IL_002e: ldloc.s V_4 + IL_0030: box [runtime]System.Int32 + IL_0035: unbox.any [runtime]System.IFormattable + IL_003a: ldnull + IL_003b: call class [netstandard]System.Globalization.CultureInfo [netstandard]System.Globalization.CultureInfo::get_InvariantCulture() + IL_0040: tail. + IL_0042: callvirt instance string [netstandard]System.IFormattable::ToString(string, + class [netstandard]System.IFormatProvider) + IL_0047: ret + + IL_0048: ldloc.0 + IL_0049: castclass MyTestModule/MyDu/MaybeString + IL_004e: stloc.s V_5 + IL_0050: ldloc.s V_5 + IL_0052: ldfld string MyTestModule/MyDu/MaybeString::item + IL_0057: stloc.s V_6 + IL_0059: ldloc.s V_6 + IL_005b: ret + } + +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/StructDU.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/StructDU.fs new file mode 100644 index 00000000000..2dee671e426 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/StructDU.fs @@ -0,0 +1,21 @@ +module MyTestModule + +[] +[] +type MyStructDU = + | A + | B of nonNullableString:string // Tricky as the field WILL be null for tags other than B + | C of nullableString:(string | null) // The field behind this is always nullable + + with override this.ToString() = + match this with + | A -> "A" + | B _ -> "B" + | C _ -> "C" + +let printMyDu(x:MyStructDU) : string = x.ToString() + +let getVal x = + match x with + | C text -> text + | _ -> failwith "fail" \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/StructDU.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/StructDU.fs.il.net472.bsl new file mode 100644 index 00000000000..244fc114746 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/StructDU.fs.il.net472.bsl @@ -0,0 +1,574 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class sequential autochar serializable sealed nested public beforefieldinit Myassembly + extends [runtime]System.ValueType + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoComparisonAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoEqualityAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class abstract auto ansi sealed nested public Tags + extends [runtime]System.Object + { + .field public static literal int32 A = int32(0x00000000) + .field public static literal int32 B = int32(0x00000001) + .field public static literal int32 C = int32(0x00000002) + } + + .field assembly string _nonNullableString + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field assembly string _nullableString + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field assembly int32 _tag + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static valuetype MyTestModule/Myassembly get_A() cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: newobj instance void MyTestModule/Myassembly::.ctor(int32) + IL_0006: ret + } + + .method public hidebysig instance bool get_IsA() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance int32 MyTestModule/Myassembly::get_Tag() + IL_0006: ldc.i4.0 + IL_0007: ceq + IL_0009: ret + } + + .method public static valuetype MyTestModule/Myassembly NewB(string _nonNullableString) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 01 00 00 00 00 00 ) + + .maxstack 2 + .locals init (valuetype MyTestModule/Myassembly V_0) + IL_0000: ldloca.s V_0 + IL_0002: initobj MyTestModule/Myassembly + IL_0008: ldloca.s V_0 + IL_000a: ldc.i4.1 + IL_000b: stfld int32 MyTestModule/Myassembly::_tag + IL_0010: ldloca.s V_0 + IL_0012: ldarg.0 + IL_0013: stfld string MyTestModule/Myassembly::_nonNullableString + IL_0018: ldloc.0 + IL_0019: ret + } + + .method public hidebysig instance bool get_IsB() cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::.ctor(bool, + string[]) = ( 01 00 01 02 00 00 00 11 6E 6F 6E 4E 75 6C 6C 61 + 62 6C 65 53 74 72 69 6E 67 12 5F 6E 6F 6E 4E 75 + 6C 6C 61 62 6C 65 53 74 72 69 6E 67 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance int32 MyTestModule/Myassembly::get_Tag() + IL_0006: ldc.i4.1 + IL_0007: ceq + IL_0009: ret + } + + .method public static valuetype MyTestModule/Myassembly NewC(string _nullableString) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 02 00 00 00 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 2 + .locals init (valuetype MyTestModule/Myassembly V_0) + IL_0000: ldloca.s V_0 + IL_0002: initobj MyTestModule/Myassembly + IL_0008: ldloca.s V_0 + IL_000a: ldc.i4.2 + IL_000b: stfld int32 MyTestModule/Myassembly::_tag + IL_0010: ldloca.s V_0 + IL_0012: ldarg.0 + IL_0013: stfld string MyTestModule/Myassembly::_nullableString + IL_0018: ldloc.0 + IL_0019: ret + } + + .method public hidebysig instance bool get_IsC() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance int32 MyTestModule/Myassembly::get_Tag() + IL_0006: ldc.i4.2 + IL_0007: ceq + IL_0009: ret + } + + .method assembly specialname rtspecialname instance void .ctor(int32 _tag) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 17 4D 79 54 65 73 74 4D 6F 64 + 75 6C 65 2B 4D 79 53 74 72 75 63 74 44 55 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stfld int32 MyTestModule/Myassembly::_tag + IL_0007: ret + } + + .method public hidebysig instance string get_nonNullableString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string MyTestModule/Myassembly::_nonNullableString + IL_0006: ret + } + + .method public hidebysig instance string get_nullableString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string MyTestModule/Myassembly::_nullableString + IL_0006: ret + } + + .method public hidebysig instance int32 get_Tag() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 MyTestModule/Myassembly::_tag + IL_0006: ret + } + + .method assembly hidebysig specialname instance object __DebugDisplay() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+0.8A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: ldobj MyTestModule/Myassembly + IL_0015: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001a: ret + } + + .method public hidebysig virtual instance string ToString() cil managed + { + + .maxstack 3 + .locals init (valuetype MyTestModule/Myassembly V_0) + IL_0000: ldarg.0 + IL_0001: ldobj MyTestModule/Myassembly + IL_0006: stloc.0 + IL_0007: ldarg.0 + IL_0008: call instance int32 MyTestModule/Myassembly::get_Tag() + IL_000d: switch ( + IL_001e, + IL_0024, + IL_002a) + IL_001e: ldstr "A" + IL_0023: ret + + IL_0024: ldstr "B" + IL_0029: ret + + IL_002a: ldstr "C" + IL_002f: ret + } + + .property instance int32 Tag() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance int32 MyTestModule/Myassembly::get_Tag() + } + .property valuetype MyTestModule/Myassembly + A() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get valuetype MyTestModule/Myassembly MyTestModule/Myassembly::get_A() + } + .property instance bool IsA() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool MyTestModule/Myassembly::get_IsA() + } + .property instance bool IsB() + { + .custom instance void System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::.ctor(bool, + string[]) = ( 01 00 01 02 00 00 00 11 6E 6F 6E 4E 75 6C 6C 61 + 62 6C 65 53 74 72 69 6E 67 12 5F 6E 6F 6E 4E 75 + 6C 6C 61 62 6C 65 53 74 72 69 6E 67 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool MyTestModule/Myassembly::get_IsB() + } + .property instance bool IsC() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool MyTestModule/Myassembly::get_IsC() + } + .property instance string nonNullableString() + { + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance string MyTestModule/Myassembly::get_nonNullableString() + } + .property instance string nullableString() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 02 00 00 00 00 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance string MyTestModule/Myassembly::get_nullableString() + } + } + + .method public static string printMyDu(valuetype MyTestModule/Myassembly x) cil managed + { + + .maxstack 8 + IL_0000: ldarga.s x + IL_0002: callvirt instance string MyTestModule/Myassembly::ToString() + IL_0007: ret + } + + .method public static string getVal(valuetype MyTestModule/Myassembly x) cil managed + { + .param [0] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 3 + .locals init (valuetype MyTestModule/Myassembly V_0, + string V_1, + string V_2) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloca.s V_0 + IL_0004: call instance int32 MyTestModule/Myassembly::get_Tag() + IL_0009: ldc.i4.2 + IL_000a: bne.un.s IL_0016 + + IL_000c: ldloca.s V_0 + IL_000e: ldfld string MyTestModule/Myassembly::_nullableString + IL_0013: stloc.1 + IL_0014: ldloc.1 + IL_0015: ret + + IL_0016: ldstr "fail" + IL_001b: stloc.2 + IL_001c: ldloc.2 + IL_001d: call class [runtime]System.Exception [FSharp.Core]Microsoft.FSharp.Core.Operators::Failure(string) + IL_0022: throw + } + +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ +} + +.class private auto ansi serializable sealed System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes + extends [runtime]System.Enum +{ + .custom instance void [runtime]System.FlagsAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public specialname rtspecialname int32 value__ + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes All = int32(0xFFFFFFFF) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes None = int32(0x00000000) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicParameterlessConstructor = int32(0x00000001) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicConstructors = int32(0x00000003) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicConstructors = int32(0x00000004) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicMethods = int32(0x00000008) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicMethods = int32(0x00000010) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicFields = int32(0x00000020) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicFields = int32(0x00000040) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicNestedTypes = int32(0x00000080) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicNestedTypes = int32(0x00000100) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicProperties = int32(0x00000200) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicProperties = int32(0x00000400) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicEvents = int32(0x00000800) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicEvents = int32(0x00001000) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes Interfaces = int32(0x00002000) +} + +.class private auto ansi beforefieldinit System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field private valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field private class [runtime]System.Type Type@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, class [runtime]System.Type Type) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ + IL_0014: ret + } + + .method public hidebysig specialname instance class [runtime]System.Type get_Type() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ + IL_0006: ret + } + + .method public hidebysig specialname instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes get_MemberType() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ + IL_0006: ret + } + + .property instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes + MemberType() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_MemberType() + } + .property instance class [runtime]System.Type + Type() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_Type() + } +} + +.class private auto ansi beforefieldinit System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field private bool ReturnValue@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field private string[] Members@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(bool ReturnValue, string[] Members) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld bool System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::ReturnValue@ + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld string[] System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::Members@ + IL_0014: ret + } + + .method public hidebysig specialname instance string[] get_Members() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string[] System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::Members@ + IL_0006: ret + } + + .method public hidebysig specialname instance bool get_ReturnValue() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld bool System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::ReturnValue@ + IL_0006: ret + } + + .property instance bool ReturnValue() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance bool System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::get_ReturnValue() + } + .property instance string[] Members() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance string[] System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::get_Members() + } +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8[] NullableFlags + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 scalarByteValue) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldc.i4.1 + IL_0008: newarr [runtime]System.Byte + IL_000d: dup + IL_000e: ldc.i4.0 + IL_000f: ldarg.1 + IL_0010: stelem.i1 + IL_0011: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_0016: ret + } + + .method public specialname rtspecialname instance void .ctor(uint8[] NullableFlags) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_000d: ret + } + +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableContextAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8 Flag + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 Flag) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8 System.Runtime.CompilerServices.NullableContextAttribute::Flag + IL_000d: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/StructDU.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/StructDU.fs.il.netcore.bsl new file mode 100644 index 00000000000..8ca2c18433e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/StructDU.fs.il.netcore.bsl @@ -0,0 +1,356 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class sequential autochar serializable sealed nested public beforefieldinit Myassembly + extends [runtime]System.ValueType + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoComparisonAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoEqualityAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .class abstract auto ansi sealed nested public Tags + extends [runtime]System.Object + { + .field public static literal int32 A = int32(0x00000000) + .field public static literal int32 B = int32(0x00000001) + .field public static literal int32 C = int32(0x00000002) + } + + .field assembly string _nonNullableString + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field assembly string _nullableString + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field assembly int32 _tag + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static valuetype MyTestModule/Myassembly get_A() cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: newobj instance void MyTestModule/Myassembly::.ctor(int32) + IL_0006: ret + } + + .method public hidebysig instance bool get_IsA() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance int32 MyTestModule/Myassembly::get_Tag() + IL_0006: ldc.i4.0 + IL_0007: ceq + IL_0009: ret + } + + .method public static valuetype MyTestModule/Myassembly NewB(string _nonNullableString) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 01 00 00 00 00 00 ) + + .maxstack 2 + .locals init (valuetype MyTestModule/Myassembly V_0) + IL_0000: ldloca.s V_0 + IL_0002: initobj MyTestModule/Myassembly + IL_0008: ldloca.s V_0 + IL_000a: ldc.i4.1 + IL_000b: stfld int32 MyTestModule/Myassembly::_tag + IL_0010: ldloca.s V_0 + IL_0012: ldarg.0 + IL_0013: stfld string MyTestModule/Myassembly::_nonNullableString + IL_0018: ldloc.0 + IL_0019: ret + } + + .method public hidebysig instance bool get_IsB() cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::.ctor(bool, + string[]) = ( 01 00 01 02 00 00 00 11 6E 6F 6E 4E 75 6C 6C 61 + 62 6C 65 53 74 72 69 6E 67 12 5F 6E 6F 6E 4E 75 + 6C 6C 61 62 6C 65 53 74 72 69 6E 67 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance int32 MyTestModule/Myassembly::get_Tag() + IL_0006: ldc.i4.1 + IL_0007: ceq + IL_0009: ret + } + + .method public static valuetype MyTestModule/Myassembly NewC(string _nullableString) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 02 00 00 00 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 2 + .locals init (valuetype MyTestModule/Myassembly V_0) + IL_0000: ldloca.s V_0 + IL_0002: initobj MyTestModule/Myassembly + IL_0008: ldloca.s V_0 + IL_000a: ldc.i4.2 + IL_000b: stfld int32 MyTestModule/Myassembly::_tag + IL_0010: ldloca.s V_0 + IL_0012: ldarg.0 + IL_0013: stfld string MyTestModule/Myassembly::_nullableString + IL_0018: ldloc.0 + IL_0019: ret + } + + .method public hidebysig instance bool get_IsC() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance int32 MyTestModule/Myassembly::get_Tag() + IL_0006: ldc.i4.2 + IL_0007: ceq + IL_0009: ret + } + + .method assembly specialname rtspecialname instance void .ctor(int32 _tag) cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 17 4D 79 54 65 73 74 4D 6F 64 + 75 6C 65 2B 4D 79 53 74 72 75 63 74 44 55 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stfld int32 MyTestModule/Myassembly::_tag + IL_0007: ret + } + + .method public hidebysig instance string get_nonNullableString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string MyTestModule/Myassembly::_nonNullableString + IL_0006: ret + } + + .method public hidebysig instance string get_nullableString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string MyTestModule/Myassembly::_nullableString + IL_0006: ret + } + + .method public hidebysig instance int32 get_Tag() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 MyTestModule/Myassembly::_tag + IL_0006: ret + } + + .method assembly hidebysig specialname instance object __DebugDisplay() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+0.8A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: ldobj MyTestModule/Myassembly + IL_0015: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001a: ret + } + + .method public hidebysig virtual instance string ToString() cil managed + { + + .maxstack 3 + .locals init (valuetype MyTestModule/Myassembly V_0) + IL_0000: ldarg.0 + IL_0001: ldobj MyTestModule/Myassembly + IL_0006: stloc.0 + IL_0007: ldarg.0 + IL_0008: call instance int32 MyTestModule/Myassembly::get_Tag() + IL_000d: switch ( + IL_001e, + IL_0024, + IL_002a) + IL_001e: ldstr "A" + IL_0023: ret + + IL_0024: ldstr "B" + IL_0029: ret + + IL_002a: ldstr "C" + IL_002f: ret + } + + .property instance int32 Tag() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance int32 MyTestModule/Myassembly::get_Tag() + } + .property valuetype MyTestModule/Myassembly + A() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get valuetype MyTestModule/Myassembly MyTestModule/Myassembly::get_A() + } + .property instance bool IsA() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool MyTestModule/Myassembly::get_IsA() + } + .property instance bool IsB() + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute::.ctor(bool, + string[]) = ( 01 00 01 02 00 00 00 11 6E 6F 6E 4E 75 6C 6C 61 + 62 6C 65 53 74 72 69 6E 67 12 5F 6E 6F 6E 4E 75 + 6C 6C 61 62 6C 65 53 74 72 69 6E 67 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool MyTestModule/Myassembly::get_IsB() + } + .property instance bool IsC() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool MyTestModule/Myassembly::get_IsC() + } + .property instance string nonNullableString() + { + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance string MyTestModule/Myassembly::get_nonNullableString() + } + .property instance string nullableString() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 02 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance string MyTestModule/Myassembly::get_nullableString() + } + } + + .method public static string printMyDu(valuetype MyTestModule/Myassembly x) cil managed + { + + .maxstack 8 + IL_0000: ldarga.s x + IL_0002: callvirt instance string MyTestModule/Myassembly::ToString() + IL_0007: ret + } + + .method public static string getVal(valuetype MyTestModule/Myassembly x) cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 3 + .locals init (valuetype MyTestModule/Myassembly V_0, + string V_1, + string V_2) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloca.s V_0 + IL_0004: call instance int32 MyTestModule/Myassembly::get_Tag() + IL_0009: ldc.i4.2 + IL_000a: bne.un.s IL_0016 + + IL_000c: ldloca.s V_0 + IL_000e: ldfld string MyTestModule/Myassembly::_nullableString + IL_0013: stloc.1 + IL_0014: ldloc.1 + IL_0015: ret + + IL_0016: ldstr "fail" + IL_001b: stloc.2 + IL_001c: ldloc.2 + IL_001d: call class [runtime]System.Exception [FSharp.Core]Microsoft.FSharp.Core.Operators::Failure(string) + IL_0022: throw + } + +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/SupportsNull.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/SupportsNull.fs new file mode 100644 index 00000000000..0e2484fa142 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/SupportsNull.fs @@ -0,0 +1,43 @@ +module MyTestModule + +let iCanProduceNullSometimes (arg:'a) : 'a = + let mutable cache = null + + if (System.DateTime.Now.Hour = 7) then + cache <- arg + + if (System.DateTime.Now.Hour = 7) then + null + else + arg + +let iPatternMatchOnArg arg = + match arg with + | null -> "null" + | _ -> "not null" + +let iAcceptNullPartiallyInferredFromUnderscore(arg: _ | null) = 0 + +let iAcceptNullPartiallyInferredFromNamedTypar(arg: 'a | null) = 0 + +let iAcceptNullWithNullAnnotation(arg: 'a | null when 'a: not struct) = + if isNull arg then + 1 + else + 0 + +let iAcceptNullExplicitAnnotation(arg: 'T when 'T:null) = + if isNull arg then + 1 + else + 0 + + +let fullyInferredTestCase arg1 arg2 = + System.Console.Write(iAcceptNullPartiallyInferredFromUnderscore arg1) + let maybeNull = iCanProduceNullSometimes arg2 + maybeNull + +let structShouldBeAllowedHere arg = + let boxed : obj | null = box arg + iAcceptNullPartiallyInferredFromUnderscore boxed \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/SupportsNull.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/SupportsNull.fs.il.net472.bsl new file mode 100644 index 00000000000..e3f57f3276f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/SupportsNull.fs.il.net472.bsl @@ -0,0 +1,276 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .method public static !!a iCanProduceNullSometimes(!!a arg) cil managed + { + .param type a + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 4 + .locals init (!!a V_0, + valuetype [runtime]System.DateTime V_1, + valuetype [runtime]System.DateTime V_2, + !!a V_3) + IL_0000: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() + IL_0005: stloc.1 + IL_0006: ldloca.s V_1 + IL_0008: call instance int32 [runtime]System.DateTime::get_Hour() + IL_000d: ldc.i4.7 + IL_000e: bne.un.s IL_0014 + + IL_0010: ldarg.0 + IL_0011: stloc.0 + IL_0012: br.s IL_0014 + + IL_0014: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() + IL_0019: stloc.2 + IL_001a: ldloca.s V_2 + IL_001c: call instance int32 [runtime]System.DateTime::get_Hour() + IL_0021: ldc.i4.7 + IL_0022: bne.un.s IL_0026 + + IL_0024: ldloc.3 + IL_0025: ret + + IL_0026: ldarg.0 + IL_0027: ret + } + + .method public static string iPatternMatchOnArg(!!a arg) cil managed + { + .param type a + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: box !!a + IL_0006: brfalse.s IL_000a + + IL_0008: br.s IL_0010 + + IL_000a: ldstr "null" + IL_000f: ret + + IL_0010: ldstr "not null" + IL_0015: ret + } + + .method public static int32 iAcceptNullPartiallyInferredFromUnderscore(!!a arg) cil managed + { + .param type a + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: ret + } + + .method public static int32 iAcceptNullPartiallyInferredFromNamedTypar(!!a arg) cil managed + { + .param type a + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: ret + } + + .method public static int32 iAcceptNullWithNullAnnotation(!!a arg) cil managed + { + .param type a + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 3 + .locals init (!!a V_0) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: box !!a + IL_0008: brtrue.s IL_000d + + IL_000a: ldc.i4.1 + IL_000b: br.s IL_000e + + IL_000d: ldc.i4.0 + IL_000e: brfalse.s IL_0012 + + IL_0010: ldc.i4.1 + IL_0011: ret + + IL_0012: ldc.i4.0 + IL_0013: ret + } + + .method public static int32 iAcceptNullExplicitAnnotation(!!T arg) cil managed + { + .param type T + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 3 + .locals init (!!T V_0) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: box !!T + IL_0008: brtrue.s IL_000d + + IL_000a: ldc.i4.1 + IL_000b: br.s IL_000e + + IL_000d: ldc.i4.0 + IL_000e: brfalse.s IL_0012 + + IL_0010: ldc.i4.1 + IL_0011: ret + + IL_0012: ldc.i4.0 + IL_0013: ret + } + + .method public static !!b fullyInferredTestCase(!!a arg1, + !!b arg2) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + .param type a + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param type b + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 3 + .locals init (!!b V_0) + IL_0000: ldarg.0 + IL_0001: call int32 MyTestModule::iAcceptNullPartiallyInferredFromUnderscore(!!0) + IL_0006: call void [runtime]System.Console::Write(int32) + IL_000b: ldarg.1 + IL_000c: call !!0 MyTestModule::iCanProduceNullSometimes(!!0) + IL_0011: stloc.0 + IL_0012: ldloc.0 + IL_0013: ret + } + + .method public static int32 structShouldBeAllowedHere(!!a arg) cil managed + { + .param type a + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + + .maxstack 3 + .locals init (object V_0) + IL_0000: ldarg.0 + IL_0001: box !!a + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: call int32 MyTestModule::iAcceptNullPartiallyInferredFromUnderscore(!!0) + IL_000d: ret + } + +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8[] NullableFlags + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 scalarByteValue) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldc.i4.1 + IL_0008: newarr [runtime]System.Byte + IL_000d: dup + IL_000e: ldc.i4.0 + IL_000f: ldarg.1 + IL_0010: stelem.i1 + IL_0011: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_0016: ret + } + + .method public specialname rtspecialname instance void .ctor(uint8[] NullableFlags) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_000d: ret + } + +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableContextAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8 Flag + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 Flag) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8 System.Runtime.CompilerServices.NullableContextAttribute::Flag + IL_000d: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/SupportsNull.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/SupportsNull.fs.il.netcore.bsl new file mode 100644 index 00000000000..ed78f2b7684 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/SupportsNull.fs.il.netcore.bsl @@ -0,0 +1,211 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern runtime { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyTestModule + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .method public static !!a iCanProduceNullSometimes(!!a arg) cil managed + { + .param type a + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 4 + .locals init (!!a V_0, + valuetype [runtime]System.DateTime V_1, + valuetype [runtime]System.DateTime V_2, + !!a V_3) + IL_0000: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() + IL_0005: stloc.1 + IL_0006: ldloca.s V_1 + IL_0008: call instance int32 [runtime]System.DateTime::get_Hour() + IL_000d: ldc.i4.7 + IL_000e: bne.un.s IL_0014 + + IL_0010: ldarg.0 + IL_0011: stloc.0 + IL_0012: br.s IL_0014 + + IL_0014: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() + IL_0019: stloc.2 + IL_001a: ldloca.s V_2 + IL_001c: call instance int32 [runtime]System.DateTime::get_Hour() + IL_0021: ldc.i4.7 + IL_0022: bne.un.s IL_0026 + + IL_0024: ldloc.3 + IL_0025: ret + + IL_0026: ldarg.0 + IL_0027: ret + } + + .method public static string iPatternMatchOnArg(!!a arg) cil managed + { + .param type a + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: box !!a + IL_0006: brfalse.s IL_000a + + IL_0008: br.s IL_0010 + + IL_000a: ldstr "null" + IL_000f: ret + + IL_0010: ldstr "not null" + IL_0015: ret + } + + .method public static int32 iAcceptNullPartiallyInferredFromUnderscore(!!a arg) cil managed + { + .param type a + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: ret + } + + .method public static int32 iAcceptNullPartiallyInferredFromNamedTypar(!!a arg) cil managed + { + .param type a + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: ret + } + + .method public static int32 iAcceptNullWithNullAnnotation(!!a arg) cil managed + { + .param type a + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 3 + .locals init (!!a V_0) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: box !!a + IL_0008: brtrue.s IL_000d + + IL_000a: ldc.i4.1 + IL_000b: br.s IL_000e + + IL_000d: ldc.i4.0 + IL_000e: brfalse.s IL_0012 + + IL_0010: ldc.i4.1 + IL_0011: ret + + IL_0012: ldc.i4.0 + IL_0013: ret + } + + .method public static int32 iAcceptNullExplicitAnnotation(!!T arg) cil managed + { + .param type T + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 3 + .locals init (!!T V_0) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: box !!T + IL_0008: brtrue.s IL_000d + + IL_000a: ldc.i4.1 + IL_000b: br.s IL_000e + + IL_000d: ldc.i4.0 + IL_000e: brfalse.s IL_0012 + + IL_0010: ldc.i4.1 + IL_0011: ret + + IL_0012: ldc.i4.0 + IL_0013: ret + } + + .method public static !!b fullyInferredTestCase(!!a arg1, + !!b arg2) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + .param type a + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param type b + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 3 + .locals init (!!b V_0) + IL_0000: ldarg.0 + IL_0001: call int32 MyTestModule::iAcceptNullPartiallyInferredFromUnderscore(!!0) + IL_0006: call void [runtime]System.Console::Write(int32) + IL_000b: ldarg.1 + IL_000c: call !!0 MyTestModule::iCanProduceNullSometimes(!!0) + IL_0011: stloc.0 + IL_0012: ldloc.0 + IL_0013: ret + } + + .method public static int32 structShouldBeAllowedHere(!!a arg) cil managed + { + .param type a + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 00 00 00 ) + + .maxstack 3 + .locals init (object V_0) + IL_0000: ldarg.0 + IL_0001: box !!a + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: call int32 MyTestModule::iAcceptNullPartiallyInferredFromUnderscore(!!0) + IL_000d: ret + } + +} + +.class private abstract auto ansi sealed ''.$MyTestModule + extends [runtime]System.Object +{ +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOff.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOff.il.net472.debug.bsl index ad60c90964b..d58a675c775 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOff.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOff.il.net472.debug.bsl @@ -31,12 +31,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOff.il.net472.release.bsl index cabcf6afee4..223d3b32830 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -31,12 +31,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOff.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOff.il.netcore.debug.bsl index f12aee407f6..75f5bf429b6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOff.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOff.il.netcore.debug.bsl @@ -31,12 +31,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOff.il.netcore.release.bsl index 314f6a56f78..08b0f2b838a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -12,7 +12,7 @@ .assembly extern System.Linq { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 + .ver 9:0:0:0 } .assembly extern netstandard { @@ -30,16 +30,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -94,8 +84,7 @@ IL_001b: ret } - .method public strict virtual instance int32 - GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed + .method public strict virtual instance int32 GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed { .maxstack 6 @@ -171,8 +160,7 @@ IL_0093: ret } - .method public strict virtual instance void - Close() cil managed + .method public strict virtual instance void Close() cil managed { .maxstack 6 @@ -253,8 +241,7 @@ IL_007b: ret } - .method public strict virtual instance bool - get_CheckClose() cil managed + .method public strict virtual instance bool get_CheckClose() cil managed { .maxstack 8 @@ -290,8 +277,7 @@ IL_002f: ret } - .method public strict virtual instance int32 - get_LastGenerated() cil managed + .method public strict virtual instance int32 get_LastGenerated() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -302,8 +288,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 - GetFreshEnumerator() cil managed + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 GetFreshEnumerator() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -357,8 +342,7 @@ IL_001b: ret } - .method public strict virtual instance int32 - GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed + .method public strict virtual instance int32 GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed { .maxstack 6 @@ -434,8 +418,7 @@ IL_0093: ret } - .method public strict virtual instance void - Close() cil managed + .method public strict virtual instance void Close() cil managed { .maxstack 6 @@ -516,8 +499,7 @@ IL_007b: ret } - .method public strict virtual instance bool - get_CheckClose() cil managed + .method public strict virtual instance bool get_CheckClose() cil managed { .maxstack 8 @@ -553,8 +535,7 @@ IL_002f: ret } - .method public strict virtual instance int32 - get_LastGenerated() cil managed + .method public strict virtual instance int32 get_LastGenerated() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -565,8 +546,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 - GetFreshEnumerator() cil managed + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 GetFreshEnumerator() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -587,8 +567,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'numSum@22-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -599,8 +578,7 @@ IL_0006: ret } - .method public strict virtual instance int32 - Invoke(int32 n) cil managed + .method public strict virtual instance int32 Invoke(int32 n) cil managed { .maxstack 8 @@ -608,8 +586,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -657,8 +634,7 @@ IL_001b: ret } - .method public strict virtual instance int32 - GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed + .method public strict virtual instance int32 GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed { .maxstack 6 @@ -734,8 +710,7 @@ IL_0093: ret } - .method public strict virtual instance void - Close() cil managed + .method public strict virtual instance void Close() cil managed { .maxstack 6 @@ -816,8 +791,7 @@ IL_007b: ret } - .method public strict virtual instance bool - get_CheckClose() cil managed + .method public strict virtual instance bool get_CheckClose() cil managed { .maxstack 8 @@ -853,8 +827,7 @@ IL_002f: ret } - .method public strict virtual instance string - get_LastGenerated() cil managed + .method public strict virtual instance string get_LastGenerated() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -865,8 +838,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 - GetFreshEnumerator() cil managed + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 GetFreshEnumerator() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -887,8 +859,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'totalChars@31-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -899,8 +870,7 @@ IL_0006: ret } - .method public strict virtual instance int32 - Invoke(string w) cil managed + .method public strict virtual instance int32 Invoke(string w) cil managed { .maxstack 8 @@ -909,8 +879,7 @@ IL_0006: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -928,8 +897,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -943,8 +911,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 - Invoke(class [Utils]Utils/Product _arg1) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { .maxstack 6 @@ -965,8 +932,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #2 input at line 38@40-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -977,8 +943,7 @@ IL_0006: ret } - .method public strict virtual instance class [Utils]Utils/Product - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -986,8 +951,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -1002,8 +966,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #2 input at line 38@40-2' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1014,8 +977,7 @@ IL_0006: ret } - .method public strict virtual instance string - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -1025,8 +987,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -1079,8 +1040,7 @@ IL_0023: ret } - .method public strict virtual instance int32 - GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed + .method public strict virtual instance int32 GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed { .maxstack 6 @@ -1157,8 +1117,7 @@ IL_0094: ret } - .method public strict virtual instance void - Close() cil managed + .method public strict virtual instance void Close() cil managed { .maxstack 6 @@ -1239,8 +1198,7 @@ IL_007b: ret } - .method public strict virtual instance bool - get_CheckClose() cil managed + .method public strict virtual instance bool get_CheckClose() cil managed { .maxstack 8 @@ -1276,8 +1234,7 @@ IL_002f: ret } - .method public strict virtual instance class [Utils]Utils/Product - get_LastGenerated() cil managed + .method public strict virtual instance class [Utils]Utils/Product get_LastGenerated() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1288,8 +1245,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 - GetFreshEnumerator() cil managed + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 GetFreshEnumerator() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1313,8 +1269,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'sum@43-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1325,8 +1280,7 @@ IL_0006: ret } - .method public strict virtual instance int32 - Invoke(class [Utils]Utils/Product x) cil managed + .method public strict virtual instance int32 Invoke(class [Utils]Utils/Product x) cil managed { .maxstack 8 @@ -1336,8 +1290,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -1355,8 +1308,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1370,8 +1322,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,int32>,object> - Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,int32>,object> Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed { .maxstack 8 @@ -1464,8 +1415,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>,class [runtime]System.Tuple`2> { .field static assembly initonly class assembly/'Pipe #2 input at line 38@45-4' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1476,8 +1426,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2 - Invoke(class [runtime]System.Tuple`2,int32> tupledArg) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2 Invoke(class [runtime]System.Tuple`2,int32> tupledArg) cil managed { .maxstack 6 @@ -1497,8 +1446,7 @@ IL_001a: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -1546,8 +1494,7 @@ IL_001b: ret } - .method public strict virtual instance int32 - GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed + .method public strict virtual instance int32 GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed { .maxstack 6 @@ -1623,8 +1570,7 @@ IL_0093: ret } - .method public strict virtual instance void - Close() cil managed + .method public strict virtual instance void Close() cil managed { .maxstack 6 @@ -1705,8 +1651,7 @@ IL_007b: ret } - .method public strict virtual instance bool - get_CheckClose() cil managed + .method public strict virtual instance bool get_CheckClose() cil managed { .maxstack 8 @@ -1742,8 +1687,7 @@ IL_002f: ret } - .method public strict virtual instance int32 - get_LastGenerated() cil managed + .method public strict virtual instance int32 get_LastGenerated() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1754,8 +1698,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 - GetFreshEnumerator() cil managed + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 GetFreshEnumerator() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1776,8 +1719,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'minNum@49-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1788,8 +1730,7 @@ IL_0006: ret } - .method public strict virtual instance int32 - Invoke(int32 n) cil managed + .method public strict virtual instance int32 Invoke(int32 n) cil managed { .maxstack 8 @@ -1797,8 +1738,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -1846,8 +1786,7 @@ IL_001b: ret } - .method public strict virtual instance int32 - GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed + .method public strict virtual instance int32 GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed { .maxstack 6 @@ -1923,8 +1862,7 @@ IL_0093: ret } - .method public strict virtual instance void - Close() cil managed + .method public strict virtual instance void Close() cil managed { .maxstack 6 @@ -2005,8 +1943,7 @@ IL_007b: ret } - .method public strict virtual instance bool - get_CheckClose() cil managed + .method public strict virtual instance bool get_CheckClose() cil managed { .maxstack 8 @@ -2042,8 +1979,7 @@ IL_002f: ret } - .method public strict virtual instance string - get_LastGenerated() cil managed + .method public strict virtual instance string get_LastGenerated() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -2054,8 +1990,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 - GetFreshEnumerator() cil managed + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 GetFreshEnumerator() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -2076,8 +2011,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'shortestWord@52-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -2088,8 +2022,7 @@ IL_0006: ret } - .method public strict virtual instance int32 - Invoke(string w) cil managed + .method public strict virtual instance int32 Invoke(string w) cil managed { .maxstack 8 @@ -2098,8 +2031,7 @@ IL_0006: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -2117,8 +2049,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -2132,8 +2063,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 - Invoke(class [Utils]Utils/Product _arg1) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { .maxstack 6 @@ -2154,8 +2084,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #3 input at line 56@58-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -2166,8 +2095,7 @@ IL_0006: ret } - .method public strict virtual instance class [Utils]Utils/Product - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -2175,8 +2103,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -2191,8 +2118,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #3 input at line 56@58-2' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -2203,8 +2129,7 @@ IL_0006: ret } - .method public strict virtual instance string - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -2214,8 +2139,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -2268,8 +2192,7 @@ IL_0023: ret } - .method public strict virtual instance int32 - GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed + .method public strict virtual instance int32 GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed { .maxstack 6 @@ -2346,8 +2269,7 @@ IL_0094: ret } - .method public strict virtual instance void - Close() cil managed + .method public strict virtual instance void Close() cil managed { .maxstack 6 @@ -2428,8 +2350,7 @@ IL_007b: ret } - .method public strict virtual instance bool - get_CheckClose() cil managed + .method public strict virtual instance bool get_CheckClose() cil managed { .maxstack 8 @@ -2465,8 +2386,7 @@ IL_002f: ret } - .method public strict virtual instance class [Utils]Utils/Product - get_LastGenerated() cil managed + .method public strict virtual instance class [Utils]Utils/Product get_LastGenerated() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -2477,8 +2397,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 - GetFreshEnumerator() cil managed + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 GetFreshEnumerator() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -2502,8 +2421,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'min@59-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -2514,8 +2432,7 @@ IL_0006: ret } - .method public strict virtual instance valuetype [runtime]System.Decimal - Invoke(class [Utils]Utils/Product x) cil managed + .method public strict virtual instance valuetype [runtime]System.Decimal Invoke(class [Utils]Utils/Product x) cil managed { .maxstack 8 @@ -2525,8 +2442,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -2544,8 +2460,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -2559,8 +2474,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [runtime]System.Decimal>,object> - Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [runtime]System.Decimal>,object> Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed { .maxstack 9 @@ -2599,8 +2513,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,valuetype [runtime]System.Decimal>,class [runtime]System.Tuple`2> { .field static assembly initonly class assembly/'Pipe #3 input at line 56@60-4' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -2611,8 +2524,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2 - Invoke(class [runtime]System.Tuple`2,valuetype [runtime]System.Decimal> tupledArg) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2 Invoke(class [runtime]System.Tuple`2,valuetype [runtime]System.Decimal> tupledArg) cil managed { .maxstack 6 @@ -2632,8 +2544,7 @@ IL_001a: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -2651,8 +2562,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -2666,8 +2576,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 - Invoke(class [Utils]Utils/Product _arg1) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { .maxstack 6 @@ -2688,8 +2597,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #4 input at line 65@67-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -2700,8 +2608,7 @@ IL_0006: ret } - .method public strict virtual instance class [Utils]Utils/Product - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -2709,8 +2616,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -2725,8 +2631,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #4 input at line 65@67-2' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -2737,8 +2642,7 @@ IL_0006: ret } - .method public strict virtual instance string - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -2748,8 +2652,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -2764,8 +2667,7 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) - .method assembly static valuetype [runtime]System.Decimal - Invoke(class [Utils]Utils/Product p) cil managed + .method assembly static valuetype [runtime]System.Decimal Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -2819,8 +2721,7 @@ IL_0023: ret } - .method public strict virtual instance int32 - GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed + .method public strict virtual instance int32 GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed { .maxstack 6 @@ -2897,8 +2798,7 @@ IL_0094: ret } - .method public strict virtual instance void - Close() cil managed + .method public strict virtual instance void Close() cil managed { .maxstack 6 @@ -2979,8 +2879,7 @@ IL_007b: ret } - .method public strict virtual instance bool - get_CheckClose() cil managed + .method public strict virtual instance bool get_CheckClose() cil managed { .maxstack 8 @@ -3016,8 +2915,7 @@ IL_002f: ret } - .method public strict virtual instance class [Utils]Utils/Product - get_LastGenerated() cil managed + .method public strict virtual instance class [Utils]Utils/Product get_LastGenerated() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -3028,8 +2926,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 - GetFreshEnumerator() cil managed + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 GetFreshEnumerator() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -3053,8 +2950,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field public valuetype [runtime]System.Decimal min - .method assembly specialname rtspecialname - instance void .ctor(valuetype [runtime]System.Decimal min) cil managed + .method assembly specialname rtspecialname instance void .ctor(valuetype [runtime]System.Decimal min) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -3068,8 +2964,7 @@ IL_000d: ret } - .method public strict virtual instance bool - Invoke(class [Utils]Utils/Product x) cil managed + .method public strict virtual instance bool Invoke(class [Utils]Utils/Product x) cil managed { .maxstack 8 @@ -3091,8 +2986,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -3106,8 +3000,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [runtime]System.Decimal,class [runtime]System.Collections.Generic.IEnumerable`1>,object> - Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [runtime]System.Decimal,class [runtime]System.Collections.Generic.IEnumerable`1>,object> Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed { .maxstack 9 @@ -3162,8 +3055,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,valuetype [runtime]System.Decimal,class [runtime]System.Collections.Generic.IEnumerable`1>,class [runtime]System.Tuple`2>> { .field static assembly initonly class assembly/'Pipe #4 input at line 65@70-4' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -3174,8 +3066,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2> - Invoke(class [runtime]System.Tuple`3,valuetype [runtime]System.Decimal,class [runtime]System.Collections.Generic.IEnumerable`1> tupledArg) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2> Invoke(class [runtime]System.Tuple`3,valuetype [runtime]System.Decimal,class [runtime]System.Collections.Generic.IEnumerable`1> tupledArg) cil managed { .maxstack 6 @@ -3199,8 +3090,7 @@ IL_0021: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -3248,8 +3138,7 @@ IL_001b: ret } - .method public strict virtual instance int32 - GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed + .method public strict virtual instance int32 GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed { .maxstack 6 @@ -3325,8 +3214,7 @@ IL_0093: ret } - .method public strict virtual instance void - Close() cil managed + .method public strict virtual instance void Close() cil managed { .maxstack 6 @@ -3407,8 +3295,7 @@ IL_007b: ret } - .method public strict virtual instance bool - get_CheckClose() cil managed + .method public strict virtual instance bool get_CheckClose() cil managed { .maxstack 8 @@ -3444,8 +3331,7 @@ IL_002f: ret } - .method public strict virtual instance int32 - get_LastGenerated() cil managed + .method public strict virtual instance int32 get_LastGenerated() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -3456,8 +3342,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 - GetFreshEnumerator() cil managed + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 GetFreshEnumerator() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -3478,8 +3363,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'maxNum@74-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -3490,8 +3374,7 @@ IL_0006: ret } - .method public strict virtual instance int32 - Invoke(int32 n) cil managed + .method public strict virtual instance int32 Invoke(int32 n) cil managed { .maxstack 8 @@ -3499,8 +3382,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -3548,8 +3430,7 @@ IL_001b: ret } - .method public strict virtual instance int32 - GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed + .method public strict virtual instance int32 GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed { .maxstack 6 @@ -3625,8 +3506,7 @@ IL_0093: ret } - .method public strict virtual instance void - Close() cil managed + .method public strict virtual instance void Close() cil managed { .maxstack 6 @@ -3707,8 +3587,7 @@ IL_007b: ret } - .method public strict virtual instance bool - get_CheckClose() cil managed + .method public strict virtual instance bool get_CheckClose() cil managed { .maxstack 8 @@ -3744,8 +3623,7 @@ IL_002f: ret } - .method public strict virtual instance string - get_LastGenerated() cil managed + .method public strict virtual instance string get_LastGenerated() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -3756,8 +3634,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 - GetFreshEnumerator() cil managed + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 GetFreshEnumerator() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -3778,8 +3655,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'longestLength@77-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -3790,8 +3666,7 @@ IL_0006: ret } - .method public strict virtual instance int32 - Invoke(string w) cil managed + .method public strict virtual instance int32 Invoke(string w) cil managed { .maxstack 8 @@ -3800,8 +3675,7 @@ IL_0006: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -3819,8 +3693,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -3834,8 +3707,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 - Invoke(class [Utils]Utils/Product _arg1) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { .maxstack 6 @@ -3856,8 +3728,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #5 input at line 81@83-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -3868,8 +3739,7 @@ IL_0006: ret } - .method public strict virtual instance class [Utils]Utils/Product - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -3877,8 +3747,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -3893,8 +3762,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #5 input at line 81@83-2' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -3905,8 +3773,7 @@ IL_0006: ret } - .method public strict virtual instance string - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -3916,8 +3783,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -3970,8 +3836,7 @@ IL_0023: ret } - .method public strict virtual instance int32 - GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed + .method public strict virtual instance int32 GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed { .maxstack 6 @@ -4048,8 +3913,7 @@ IL_0094: ret } - .method public strict virtual instance void - Close() cil managed + .method public strict virtual instance void Close() cil managed { .maxstack 6 @@ -4130,8 +3994,7 @@ IL_007b: ret } - .method public strict virtual instance bool - get_CheckClose() cil managed + .method public strict virtual instance bool get_CheckClose() cil managed { .maxstack 8 @@ -4167,8 +4030,7 @@ IL_002f: ret } - .method public strict virtual instance class [Utils]Utils/Product - get_LastGenerated() cil managed + .method public strict virtual instance class [Utils]Utils/Product get_LastGenerated() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -4179,8 +4041,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 - GetFreshEnumerator() cil managed + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 GetFreshEnumerator() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -4204,8 +4065,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'mostExpensivePrice@84-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -4216,8 +4076,7 @@ IL_0006: ret } - .method public strict virtual instance valuetype [runtime]System.Decimal - Invoke(class [Utils]Utils/Product x) cil managed + .method public strict virtual instance valuetype [runtime]System.Decimal Invoke(class [Utils]Utils/Product x) cil managed { .maxstack 8 @@ -4227,8 +4086,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -4246,8 +4104,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -4261,8 +4118,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [runtime]System.Decimal>,object> - Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [runtime]System.Decimal>,object> Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed { .maxstack 9 @@ -4301,8 +4157,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,valuetype [runtime]System.Decimal>,class [runtime]System.Tuple`2> { .field static assembly initonly class assembly/'Pipe #5 input at line 81@85-4' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -4313,8 +4168,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2 - Invoke(class [runtime]System.Tuple`2,valuetype [runtime]System.Decimal> tupledArg) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2 Invoke(class [runtime]System.Tuple`2,valuetype [runtime]System.Decimal> tupledArg) cil managed { .maxstack 6 @@ -4334,8 +4188,7 @@ IL_001a: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -4353,8 +4206,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -4368,8 +4220,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 - Invoke(class [Utils]Utils/Product _arg1) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { .maxstack 6 @@ -4390,8 +4241,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #6 input at line 90@92-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -4402,8 +4252,7 @@ IL_0006: ret } - .method public strict virtual instance class [Utils]Utils/Product - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -4411,8 +4260,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -4427,8 +4275,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #6 input at line 90@92-2' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -4439,8 +4286,7 @@ IL_0006: ret } - .method public strict virtual instance string - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -4450,8 +4296,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -4504,8 +4349,7 @@ IL_0023: ret } - .method public strict virtual instance int32 - GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed + .method public strict virtual instance int32 GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed { .maxstack 6 @@ -4582,8 +4426,7 @@ IL_0094: ret } - .method public strict virtual instance void - Close() cil managed + .method public strict virtual instance void Close() cil managed { .maxstack 6 @@ -4664,8 +4507,7 @@ IL_007b: ret } - .method public strict virtual instance bool - get_CheckClose() cil managed + .method public strict virtual instance bool get_CheckClose() cil managed { .maxstack 8 @@ -4701,8 +4543,7 @@ IL_002f: ret } - .method public strict virtual instance class [Utils]Utils/Product - get_LastGenerated() cil managed + .method public strict virtual instance class [Utils]Utils/Product get_LastGenerated() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -4713,8 +4554,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 - GetFreshEnumerator() cil managed + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 GetFreshEnumerator() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -4738,8 +4578,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'maxPrice@93-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -4750,8 +4589,7 @@ IL_0006: ret } - .method public strict virtual instance valuetype [runtime]System.Decimal - Invoke(class [Utils]Utils/Product x) cil managed + .method public strict virtual instance valuetype [runtime]System.Decimal Invoke(class [Utils]Utils/Product x) cil managed { .maxstack 8 @@ -4761,8 +4599,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -4815,8 +4652,7 @@ IL_0023: ret } - .method public strict virtual instance int32 - GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed + .method public strict virtual instance int32 GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed { .maxstack 6 @@ -4893,8 +4729,7 @@ IL_0094: ret } - .method public strict virtual instance void - Close() cil managed + .method public strict virtual instance void Close() cil managed { .maxstack 6 @@ -4975,8 +4810,7 @@ IL_007b: ret } - .method public strict virtual instance bool - get_CheckClose() cil managed + .method public strict virtual instance bool get_CheckClose() cil managed { .maxstack 8 @@ -5012,8 +4846,7 @@ IL_002f: ret } - .method public strict virtual instance class [Utils]Utils/Product - get_LastGenerated() cil managed + .method public strict virtual instance class [Utils]Utils/Product get_LastGenerated() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -5024,8 +4857,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 - GetFreshEnumerator() cil managed + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 GetFreshEnumerator() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -5049,8 +4881,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field public valuetype [runtime]System.Decimal maxPrice - .method assembly specialname rtspecialname - instance void .ctor(valuetype [runtime]System.Decimal maxPrice) cil managed + .method assembly specialname rtspecialname instance void .ctor(valuetype [runtime]System.Decimal maxPrice) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -5064,8 +4895,7 @@ IL_000d: ret } - .method public strict virtual instance bool - Invoke(class [Utils]Utils/Product x) cil managed + .method public strict virtual instance bool Invoke(class [Utils]Utils/Product x) cil managed { .maxstack 8 @@ -5087,8 +4917,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -5102,8 +4931,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [runtime]System.Decimal,class [runtime]System.Collections.Generic.IEnumerable`1>,object> - Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [runtime]System.Decimal,class [runtime]System.Collections.Generic.IEnumerable`1>,object> Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed { .maxstack 9 @@ -5164,8 +4992,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,valuetype [runtime]System.Decimal,class [runtime]System.Collections.Generic.IEnumerable`1>,class [runtime]System.Tuple`2>> { .field static assembly initonly class assembly/'Pipe #6 input at line 90@95-4' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -5176,8 +5003,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2> - Invoke(class [runtime]System.Tuple`3,valuetype [runtime]System.Decimal,class [runtime]System.Collections.Generic.IEnumerable`1> tupledArg) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2> Invoke(class [runtime]System.Tuple`3,valuetype [runtime]System.Decimal,class [runtime]System.Collections.Generic.IEnumerable`1> tupledArg) cil managed { .maxstack 6 @@ -5201,8 +5027,7 @@ IL_0021: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -5250,8 +5075,7 @@ IL_001b: ret } - .method public strict virtual instance int32 - GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed + .method public strict virtual instance int32 GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed { .maxstack 6 @@ -5327,8 +5151,7 @@ IL_009b: ret } - .method public strict virtual instance void - Close() cil managed + .method public strict virtual instance void Close() cil managed { .maxstack 6 @@ -5409,8 +5232,7 @@ IL_0083: ret } - .method public strict virtual instance bool - get_CheckClose() cil managed + .method public strict virtual instance bool get_CheckClose() cil managed { .maxstack 8 @@ -5446,8 +5268,7 @@ IL_002f: ret } - .method public strict virtual instance float64 - get_LastGenerated() cil managed + .method public strict virtual instance float64 get_LastGenerated() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -5458,8 +5279,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 - GetFreshEnumerator() cil managed + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 GetFreshEnumerator() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -5480,8 +5300,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'averageNum@100-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -5492,8 +5311,7 @@ IL_0006: ret } - .method public strict virtual instance float64 - Invoke(float64 n) cil managed + .method public strict virtual instance float64 Invoke(float64 n) cil managed { .maxstack 8 @@ -5501,8 +5319,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -5520,8 +5337,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -5535,8 +5351,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,object> - Invoke(string _arg1) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,object> Invoke(string _arg1) cil managed { .maxstack 7 @@ -5568,8 +5383,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,float64> { .field static assembly initonly class assembly/'averageLength@107-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -5580,8 +5394,7 @@ IL_0006: ret } - .method public strict virtual instance float64 - Invoke(class [runtime]System.Tuple`2 tupledArg) cil managed + .method public strict virtual instance float64 Invoke(class [runtime]System.Tuple`2 tupledArg) cil managed { .maxstack 5 @@ -5597,8 +5410,7 @@ IL_000f: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -5616,8 +5428,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -5631,8 +5442,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 - Invoke(class [Utils]Utils/Product _arg1) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { .maxstack 6 @@ -5653,8 +5463,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #7 input at line 112@114-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -5665,8 +5474,7 @@ IL_0006: ret } - .method public strict virtual instance class [Utils]Utils/Product - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -5674,8 +5482,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -5690,8 +5497,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #7 input at line 112@114-2' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -5702,8 +5508,7 @@ IL_0006: ret } - .method public strict virtual instance string - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -5713,8 +5518,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -5767,8 +5571,7 @@ IL_0023: ret } - .method public strict virtual instance int32 - GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed + .method public strict virtual instance int32 GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed { .maxstack 6 @@ -5845,8 +5648,7 @@ IL_0094: ret } - .method public strict virtual instance void - Close() cil managed + .method public strict virtual instance void Close() cil managed { .maxstack 6 @@ -5927,8 +5729,7 @@ IL_007b: ret } - .method public strict virtual instance bool - get_CheckClose() cil managed + .method public strict virtual instance bool get_CheckClose() cil managed { .maxstack 8 @@ -5964,8 +5765,7 @@ IL_002f: ret } - .method public strict virtual instance class [Utils]Utils/Product - get_LastGenerated() cil managed + .method public strict virtual instance class [Utils]Utils/Product get_LastGenerated() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -5976,8 +5776,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 - GetFreshEnumerator() cil managed + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 GetFreshEnumerator() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -6001,8 +5800,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'averagePrice@115-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -6013,8 +5811,7 @@ IL_0006: ret } - .method public strict virtual instance valuetype [runtime]System.Decimal - Invoke(class [Utils]Utils/Product x) cil managed + .method public strict virtual instance valuetype [runtime]System.Decimal Invoke(class [Utils]Utils/Product x) cil managed { .maxstack 8 @@ -6024,8 +5821,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -6043,8 +5839,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -6058,8 +5853,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [runtime]System.Decimal>,object> - Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [runtime]System.Decimal>,object> Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed { .maxstack 9 @@ -6196,8 +5990,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,valuetype [runtime]System.Decimal>,class [runtime]System.Tuple`2> { .field static assembly initonly class assembly/'Pipe #7 input at line 112@116-4' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -6208,8 +6001,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2 - Invoke(class [runtime]System.Tuple`2,valuetype [runtime]System.Decimal> tupledArg) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2 Invoke(class [runtime]System.Tuple`2,valuetype [runtime]System.Decimal> tupledArg) cil managed { .maxstack 6 @@ -6229,8 +6021,7 @@ IL_001a: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -6241,8 +6032,7 @@ } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_factorsOf300() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_factorsOf300() cil managed { .maxstack 8 @@ -6250,8 +6040,7 @@ IL_0005: ret } - .method public specialname static int32 - get_uniqueFactors() cil managed + .method public specialname static int32 get_uniqueFactors() cil managed { .maxstack 8 @@ -6259,8 +6048,7 @@ IL_0005: ret } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_numbers() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_numbers() cil managed { .maxstack 8 @@ -6268,8 +6056,7 @@ IL_0005: ret } - .method public specialname static int32 - get_numSum() cil managed + .method public specialname static int32 get_numSum() cil managed { .maxstack 8 @@ -6277,8 +6064,7 @@ IL_0005: ret } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_words() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_words() cil managed { .maxstack 8 @@ -6286,8 +6072,7 @@ IL_0005: ret } - .method public specialname static int32 - get_totalChars() cil managed + .method public specialname static int32 get_totalChars() cil managed { .maxstack 8 @@ -6295,8 +6080,7 @@ IL_0005: ret } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_products() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_products() cil managed { .maxstack 8 @@ -6304,8 +6088,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Tuple`2[] - get_categories() cil managed + .method public specialname static class [runtime]System.Tuple`2[] get_categories() cil managed { .maxstack 8 @@ -6313,8 +6096,7 @@ IL_0005: ret } - .method public specialname static int32 - get_minNum() cil managed + .method public specialname static int32 get_minNum() cil managed { .maxstack 8 @@ -6322,8 +6104,7 @@ IL_0005: ret } - .method public specialname static int32 - get_shortestWord() cil managed + .method public specialname static int32 get_shortestWord() cil managed { .maxstack 8 @@ -6331,8 +6112,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Tuple`2[] - get_categories2() cil managed + .method public specialname static class [runtime]System.Tuple`2[] get_categories2() cil managed { .maxstack 8 @@ -6340,8 +6120,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Tuple`2>[] - get_categories3() cil managed + .method public specialname static class [runtime]System.Tuple`2>[] get_categories3() cil managed { .maxstack 8 @@ -6349,8 +6128,7 @@ IL_0005: ret } - .method public specialname static int32 - get_maxNum() cil managed + .method public specialname static int32 get_maxNum() cil managed { .maxstack 8 @@ -6358,8 +6136,7 @@ IL_0005: ret } - .method public specialname static int32 - get_longestLength() cil managed + .method public specialname static int32 get_longestLength() cil managed { .maxstack 8 @@ -6367,8 +6144,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Tuple`2[] - get_categories4() cil managed + .method public specialname static class [runtime]System.Tuple`2[] get_categories4() cil managed { .maxstack 8 @@ -6376,8 +6152,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Tuple`2>[] - get_categories5() cil managed + .method public specialname static class [runtime]System.Tuple`2>[] get_categories5() cil managed { .maxstack 8 @@ -6385,8 +6160,7 @@ IL_0005: ret } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_numbers2() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_numbers2() cil managed { .maxstack 8 @@ -6394,8 +6168,7 @@ IL_0005: ret } - .method public specialname static float64 - get_averageNum() cil managed + .method public specialname static float64 get_averageNum() cil managed { .maxstack 8 @@ -6403,8 +6176,7 @@ IL_0005: ret } - .method public specialname static float64 - get_averageLength() cil managed + .method public specialname static float64 get_averageLength() cil managed { .maxstack 8 @@ -6412,8 +6184,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Tuple`2[] - get_categories6() cil managed + .method public specialname static class [runtime]System.Tuple`2[] get_categories6() cil managed { .maxstack 8 @@ -7333,3 +7104,8 @@ } } + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOn.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOn.il.net472.debug.bsl index 9f2155759bf..0cd7a6a45ff 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOn.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOn.il.net472.debug.bsl @@ -31,12 +31,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOn.il.net472.release.bsl index 2d1d0cb1403..37c5193e657 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -31,12 +31,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOn.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOn.il.netcore.debug.bsl index 151902f9f56..a4134ce4065 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOn.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOn.il.netcore.debug.bsl @@ -31,12 +31,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOn.il.netcore.release.bsl index 925e78803dd..c95100f8800 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -12,7 +12,7 @@ .assembly extern System.Linq { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 + .ver 9:0:0:0 } .assembly extern netstandard { @@ -30,16 +30,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -7078,4 +7068,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOff.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOff.il.net472.debug.bsl index 2f4d0544a99..f90e667bcf0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOff.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOff.il.net472.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOff.il.net472.release.bsl index 2f4d0544a99..f90e667bcf0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOff.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOff.il.netcore.debug.bsl index 26f5a9df9f0..0d530d49191 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOff.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOff.il.netcore.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOff.il.netcore.release.bsl index 26f5a9df9f0..0d530d49191 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOn.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOn.il.net472.debug.bsl index c649190faa6..d789792c024 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOn.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOn.il.net472.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOn.il.net472.release.bsl index c649190faa6..d789792c024 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOn.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOn.il.netcore.debug.bsl index fee4817e146..560102af961 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOn.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOn.il.netcore.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOn.il.netcore.release.bsl index fee4817e146..560102af961 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOff.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOff.il.net472.debug.bsl index af1ef1ed36b..872886221c5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOff.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOff.il.net472.debug.bsl @@ -31,12 +31,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOff.il.net472.release.bsl index af1ef1ed36b..872886221c5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -31,12 +31,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOff.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOff.il.netcore.debug.bsl index 2d27fb5b024..6737e607228 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOff.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOff.il.netcore.debug.bsl @@ -31,12 +31,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOff.il.netcore.release.bsl index 2d27fb5b024..2fc810b6d8c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -8,7 +8,7 @@ .assembly extern System.Linq { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 + .ver 9:0:0:0 } .assembly extern Utils { @@ -30,16 +30,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -64,8 +54,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -79,8 +68,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 - Invoke(int32 _arg1) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(int32 _arg1) cil managed { .maxstack 6 @@ -101,8 +89,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #1 input at line 13@15-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -113,8 +100,7 @@ IL_0006: ret } - .method public strict virtual instance int32 - Invoke(int32 n) cil managed + .method public strict virtual instance int32 Invoke(int32 n) cil managed { .maxstack 8 @@ -122,8 +108,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -138,8 +123,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #1 input at line 13@15-2' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -150,8 +134,7 @@ IL_0006: ret } - .method public strict virtual instance int32 - Invoke(int32 n) cil managed + .method public strict virtual instance int32 Invoke(int32 n) cil managed { .maxstack 8 @@ -161,8 +144,7 @@ IL_0003: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -180,8 +162,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -195,8 +176,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,object> - Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,object> Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed { .maxstack 6 @@ -217,8 +197,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [runtime]System.Tuple`2> { .field static assembly initonly class assembly/'Pipe #1 input at line 13@16-4' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -229,8 +208,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2 - Invoke(class [System.Linq]System.Linq.IGrouping`2 g) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2 Invoke(class [System.Linq]System.Linq.IGrouping`2 g) cil managed { .maxstack 8 @@ -243,8 +221,7 @@ IL_0011: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -262,8 +239,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -277,8 +253,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 - Invoke(string _arg1) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(string _arg1) cil managed { .maxstack 6 @@ -299,8 +274,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #2 input at line 23@25-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -311,8 +285,7 @@ IL_0006: ret } - .method public strict virtual instance string - Invoke(string w) cil managed + .method public strict virtual instance string Invoke(string w) cil managed { .maxstack 8 @@ -320,8 +293,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -336,8 +308,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #2 input at line 23@25-2' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -348,8 +319,7 @@ IL_0006: ret } - .method public strict virtual instance char - Invoke(string w) cil managed + .method public strict virtual instance char Invoke(string w) cil managed { .maxstack 8 @@ -359,8 +329,7 @@ IL_0007: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -378,8 +347,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -393,8 +361,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,object> - Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,object> Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed { .maxstack 6 @@ -415,8 +382,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [runtime]System.Tuple`2> { .field static assembly initonly class assembly/'Pipe #2 input at line 23@26-4' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -427,8 +393,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2 - Invoke(class [System.Linq]System.Linq.IGrouping`2 g) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2 Invoke(class [System.Linq]System.Linq.IGrouping`2 g) cil managed { .maxstack 8 @@ -441,8 +406,7 @@ IL_0011: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -460,8 +424,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -475,8 +438,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 - Invoke(class [Utils]Utils/Product _arg1) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { .maxstack 6 @@ -497,8 +459,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #3 input at line 33@35-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -509,8 +470,7 @@ IL_0006: ret } - .method public strict virtual instance class [Utils]Utils/Product - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -518,8 +478,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -534,8 +493,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #3 input at line 33@35-2' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -546,8 +504,7 @@ IL_0006: ret } - .method public strict virtual instance string - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -557,8 +514,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -576,8 +532,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -591,8 +546,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,object> - Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,object> Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed { .maxstack 6 @@ -613,8 +567,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [runtime]System.Tuple`2> { .field static assembly initonly class assembly/'Pipe #3 input at line 33@36-4' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -625,8 +578,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2 - Invoke(class [System.Linq]System.Linq.IGrouping`2 g) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2 Invoke(class [System.Linq]System.Linq.IGrouping`2 g) cil managed { .maxstack 8 @@ -639,8 +591,7 @@ IL_0011: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -658,8 +609,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -673,8 +623,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 - Invoke(class [Utils]Utils/Order _arg2) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Order _arg2) cil managed { .maxstack 6 @@ -695,8 +644,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'yearGroups@48-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -707,8 +655,7 @@ IL_0006: ret } - .method public strict virtual instance class [Utils]Utils/Order - Invoke(class [Utils]Utils/Order o) cil managed + .method public strict virtual instance class [Utils]Utils/Order Invoke(class [Utils]Utils/Order o) cil managed { .maxstack 8 @@ -716,8 +663,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -732,8 +678,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'yearGroups@48-2' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -744,8 +689,7 @@ IL_0006: ret } - .method public strict virtual instance int32 - Invoke(class [Utils]Utils/Order o) cil managed + .method public strict virtual instance int32 Invoke(class [Utils]Utils/Order o) cil managed { .maxstack 5 @@ -758,8 +702,7 @@ IL_000e: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -777,8 +720,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -792,8 +734,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 - Invoke(class [Utils]Utils/Order _arg4) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Order _arg4) cil managed { .maxstack 6 @@ -814,8 +755,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'monthGroups@52-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -826,8 +766,7 @@ IL_0006: ret } - .method public strict virtual instance class [Utils]Utils/Order - Invoke(class [Utils]Utils/Order o) cil managed + .method public strict virtual instance class [Utils]Utils/Order Invoke(class [Utils]Utils/Order o) cil managed { .maxstack 8 @@ -835,8 +774,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -851,8 +789,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'monthGroups@52-2' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -863,8 +800,7 @@ IL_0006: ret } - .method public strict virtual instance int32 - Invoke(class [Utils]Utils/Order o) cil managed + .method public strict virtual instance int32 Invoke(class [Utils]Utils/Order o) cil managed { .maxstack 5 @@ -877,8 +813,7 @@ IL_000e: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -896,8 +831,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -911,8 +845,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,object> - Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg5) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,object> Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg5) cil managed { .maxstack 6 @@ -933,8 +866,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [runtime]System.Tuple`2> { .field static assembly initonly class assembly/'monthGroups@53-4' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -945,8 +877,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2 - Invoke(class [System.Linq]System.Linq.IGrouping`2 mg) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2 Invoke(class [System.Linq]System.Linq.IGrouping`2 mg) cil managed { .maxstack 8 @@ -959,8 +890,7 @@ IL_0011: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -978,8 +908,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -993,8 +922,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [runtime]System.Collections.Generic.IEnumerable`1>>,object> - Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg3) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [runtime]System.Collections.Generic.IEnumerable`1>>,object> Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg3) cil managed { .maxstack 10 @@ -1047,8 +975,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [runtime]System.Collections.Generic.IEnumerable`1>>,class [runtime]System.Tuple`2[]>> { .field static assembly initonly class assembly/'yearGroups@55-4' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1059,8 +986,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2[]> - Invoke(class [runtime]System.Tuple`2,class [runtime]System.Collections.Generic.IEnumerable`1>> tupledArg) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2[]> Invoke(class [runtime]System.Tuple`2,class [runtime]System.Collections.Generic.IEnumerable`1>> tupledArg) cil managed { .maxstack 6 @@ -1081,8 +1007,7 @@ IL_001f: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -1100,8 +1025,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1115,8 +1039,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2[]>>>,object> - Invoke(class [Utils]Utils/Customer _arg1) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2[]>>>,object> Invoke(class [Utils]Utils/Customer _arg1) cil managed { .maxstack 10 @@ -1170,8 +1093,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2[]>>>,class [runtime]System.Tuple`2[]>[]>> { .field static assembly initonly class assembly/'Pipe #4 input at line 43@57-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1182,8 +1104,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2[]>[]> - Invoke(class [runtime]System.Tuple`2[]>>> tupledArg) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2[]>[]> Invoke(class [runtime]System.Tuple`2[]>>> tupledArg) cil managed { .maxstack 6 @@ -1204,8 +1125,7 @@ IL_001f: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -1216,8 +1136,7 @@ } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_digits() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_digits() cil managed { .maxstack 8 @@ -1225,8 +1144,7 @@ IL_0005: ret } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_numbers() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_numbers() cil managed { .maxstack 8 @@ -1234,8 +1152,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Tuple`2[] - get_numberGroups() cil managed + .method public specialname static class [runtime]System.Tuple`2[] get_numberGroups() cil managed { .maxstack 8 @@ -1243,8 +1160,7 @@ IL_0005: ret } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_words() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_words() cil managed { .maxstack 8 @@ -1252,8 +1168,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Tuple`2[] - get_wordGroups() cil managed + .method public specialname static class [runtime]System.Tuple`2[] get_wordGroups() cil managed { .maxstack 8 @@ -1261,8 +1176,7 @@ IL_0005: ret } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_products() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_products() cil managed { .maxstack 8 @@ -1270,8 +1184,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Tuple`2[] - get_orderGroups() cil managed + .method public specialname static class [runtime]System.Tuple`2[] get_orderGroups() cil managed { .maxstack 8 @@ -1279,8 +1192,7 @@ IL_0005: ret } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_customers() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_customers() cil managed { .maxstack 8 @@ -1288,8 +1200,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Tuple`2[]>[]>[] - get_customerOrderGroups() cil managed + .method public specialname static class [runtime]System.Tuple`2[]>[]>[] get_customerOrderGroups() cil managed { .maxstack 8 @@ -1619,3 +1530,8 @@ } } + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOn.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOn.il.net472.debug.bsl index 3ac4071a8d2..7bb1503dbf8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOn.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOn.il.net472.debug.bsl @@ -31,12 +31,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOn.il.net472.release.bsl index 3ac4071a8d2..7bb1503dbf8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -31,12 +31,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOn.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOn.il.netcore.debug.bsl index f1572eba9b3..02666957568 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOn.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOn.il.netcore.debug.bsl @@ -31,12 +31,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOn.il.netcore.release.bsl index f1572eba9b3..78906fb60e6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Grouping01.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -8,7 +8,7 @@ .assembly extern System.Linq { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 + .ver 9:0:0:0 } .assembly extern Utils { @@ -30,16 +30,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -1537,4 +1527,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOff.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOff.il.net472.debug.bsl index 34b87ed620a..d09e6800c4c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOff.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOff.il.net472.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOff.il.net472.release.bsl index 34b87ed620a..d09e6800c4c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOff.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOff.il.netcore.debug.bsl index f711da357ed..5d07e05e19f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOff.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOff.il.netcore.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOff.il.netcore.release.bsl index f711da357ed..276b73ab79c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -12,7 +12,7 @@ .assembly extern System.Linq { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 + .ver 9:0:0:0 } .assembly assembly { @@ -25,16 +25,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -56,8 +46,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #1 input at line 12@14' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -68,8 +57,7 @@ IL_0006: ret } - .method public strict virtual instance string - Invoke(string c) cil managed + .method public strict virtual instance string Invoke(string c) cil managed { .maxstack 8 @@ -77,8 +65,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -93,8 +80,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #1 input at line 12@14-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -105,8 +91,7 @@ IL_0006: ret } - .method public strict virtual instance string - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -116,8 +101,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -132,8 +116,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3> { .field static assembly initonly class assembly/'Pipe #1 input at line 12@14-2' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -157,8 +140,7 @@ IL_0007: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -176,8 +158,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -191,8 +172,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,object> - Invoke(class [runtime]System.Tuple`2 _arg1) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,object> Invoke(class [runtime]System.Tuple`2 _arg1) cil managed { .maxstack 7 @@ -224,8 +204,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [runtime]System.Tuple`2> { .field static assembly initonly class assembly/'Pipe #1 input at line 12@15-4' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -236,8 +215,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2 - Invoke(class [runtime]System.Tuple`2 tupledArg) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2 Invoke(class [runtime]System.Tuple`2 tupledArg) cil managed { .maxstack 6 @@ -257,8 +235,7 @@ IL_001a: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -273,8 +250,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #2 input at line 20@22' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -285,8 +261,7 @@ IL_0006: ret } - .method public strict virtual instance string - Invoke(string c) cil managed + .method public strict virtual instance string Invoke(string c) cil managed { .maxstack 8 @@ -294,8 +269,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -310,8 +284,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #2 input at line 20@22-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -322,8 +295,7 @@ IL_0006: ret } - .method public strict virtual instance string - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -333,8 +305,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -349,8 +320,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3,class [runtime]System.Tuple`2>> { .field static assembly initonly class assembly/'Pipe #2 input at line 20@22-2' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -374,8 +344,7 @@ IL_0007: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -393,8 +362,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -408,8 +376,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2>,object> - Invoke(class [runtime]System.Tuple`2> _arg1) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2>,object> Invoke(class [runtime]System.Tuple`2> _arg1) cil managed { .maxstack 7 @@ -441,8 +408,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>,class [runtime]System.Tuple`2>> { .field static assembly initonly class assembly/'Pipe #2 input at line 20@23-4' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -453,8 +419,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2> - Invoke(class [runtime]System.Tuple`2> tupledArg) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2> Invoke(class [runtime]System.Tuple`2> tupledArg) cil managed { .maxstack 6 @@ -473,8 +438,7 @@ IL_0015: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -489,8 +453,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #3 input at line 28@30' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -501,8 +464,7 @@ IL_0006: ret } - .method public strict virtual instance string - Invoke(string c) cil managed + .method public strict virtual instance string Invoke(string c) cil managed { .maxstack 8 @@ -510,8 +472,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -526,8 +487,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #3 input at line 28@30-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -538,8 +498,7 @@ IL_0006: ret } - .method public strict virtual instance string - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -549,8 +508,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -565,8 +523,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3,class [runtime]System.Tuple`2>> { .field static assembly initonly class assembly/'Pipe #3 input at line 28@30-2' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -590,8 +547,7 @@ IL_0007: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -634,8 +590,7 @@ IL_001b: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [Utils]Utils/Product>,object> - Invoke(class [Utils]Utils/Product _arg2) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [Utils]Utils/Product>,object> Invoke(class [Utils]Utils/Product _arg2) cil managed { .maxstack 8 @@ -666,8 +621,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -681,8 +635,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [Utils]Utils/Product>,class [runtime]System.Collections.IEnumerable> - Invoke(class [runtime]System.Tuple`2> _arg1) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [Utils]Utils/Product>,class [runtime]System.Collections.IEnumerable> Invoke(class [runtime]System.Tuple`2> _arg1) cil managed { .maxstack 9 @@ -722,8 +675,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [Utils]Utils/Product>,class [runtime]System.Tuple`2> { .field static assembly initonly class assembly/'Pipe #3 input at line 28@32-5' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -734,8 +686,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2 - Invoke(class [runtime]System.Tuple`3,class [Utils]Utils/Product> tupledArg) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2 Invoke(class [runtime]System.Tuple`3,class [Utils]Utils/Product> tupledArg) cil managed { .maxstack 6 @@ -759,8 +710,7 @@ IL_0021: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -775,8 +725,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #4 input at line 37@39' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -787,8 +736,7 @@ IL_0006: ret } - .method public strict virtual instance string - Invoke(string c) cil managed + .method public strict virtual instance string Invoke(string c) cil managed { .maxstack 8 @@ -796,8 +744,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -812,8 +759,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #4 input at line 37@39-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -824,8 +770,7 @@ IL_0006: ret } - .method public strict virtual instance string - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -835,8 +780,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -851,8 +795,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3,class [runtime]System.Tuple`2>> { .field static assembly initonly class assembly/'Pipe #4 input at line 37@39-2' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -876,8 +819,7 @@ IL_0007: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -920,8 +862,7 @@ IL_001b: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [Utils]Utils/Product,string>,object> - Invoke(class [Utils]Utils/Product _arg2) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [Utils]Utils/Product,string>,object> Invoke(class [Utils]Utils/Product _arg2) cil managed { .maxstack 9 @@ -971,8 +912,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -986,8 +926,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [Utils]Utils/Product,string>,class [runtime]System.Collections.IEnumerable> - Invoke(class [runtime]System.Tuple`2> _arg1) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [Utils]Utils/Product,string>,class [runtime]System.Collections.IEnumerable> Invoke(class [runtime]System.Tuple`2> _arg1) cil managed { .maxstack 9 @@ -1028,8 +967,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [Utils]Utils/Product,string>,class [runtime]System.Tuple`2> { .field static assembly initonly class assembly/'Pipe #4 input at line 37@42-5' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1040,8 +978,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2 - Invoke(class [runtime]System.Tuple`4,class [Utils]Utils/Product,string> tupledArg) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2 Invoke(class [runtime]System.Tuple`4,class [Utils]Utils/Product,string> tupledArg) cil managed { .maxstack 6 @@ -1068,8 +1005,7 @@ IL_0023: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -1080,8 +1016,7 @@ } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_categories() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_categories() cil managed { .maxstack 8 @@ -1089,8 +1024,7 @@ IL_0005: ret } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_products() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_products() cil managed { .maxstack 8 @@ -1098,8 +1032,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Tuple`2[] - get_q() cil managed + .method public specialname static class [runtime]System.Tuple`2[] get_q() cil managed { .maxstack 8 @@ -1107,8 +1040,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Tuple`2>[] - get_q2() cil managed + .method public specialname static class [runtime]System.Tuple`2>[] get_q2() cil managed { .maxstack 8 @@ -1116,8 +1048,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Tuple`2[] - get_q3() cil managed + .method public specialname static class [runtime]System.Tuple`2[] get_q3() cil managed { .maxstack 8 @@ -1125,8 +1056,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Tuple`2[] - get_q4() cil managed + .method public specialname static class [runtime]System.Tuple`2[] get_q4() cil managed { .maxstack 8 @@ -1369,3 +1299,8 @@ } } + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOn.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOn.il.net472.debug.bsl index 2851858eb06..d096c5fa9d4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOn.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOn.il.net472.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOn.il.net472.release.bsl index 2851858eb06..d096c5fa9d4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOn.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOn.il.netcore.debug.bsl index 88c309312cf..4716dad9de9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOn.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOn.il.netcore.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOn.il.netcore.release.bsl index 88c309312cf..8015e5128b2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Joins01.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -12,7 +12,7 @@ .assembly extern System.Linq { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 + .ver 9:0:0:0 } .assembly assembly { @@ -25,16 +25,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -1315,4 +1305,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOff.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOff.il.net472.debug.bsl index d89f58056fd..f982c309ad8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOff.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOff.il.net472.debug.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOff.il.net472.release.bsl index d89f58056fd..f982c309ad8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOff.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOff.il.netcore.debug.bsl index 3422fd1f727..a9ba941c5d3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOff.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOff.il.netcore.debug.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOff.il.netcore.release.bsl index 3422fd1f727..a9ba941c5d3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOn.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOn.il.net472.debug.bsl index 747c16cfd99..eb24b331202 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOn.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOn.il.net472.debug.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOn.il.net472.release.bsl index 747c16cfd99..eb24b331202 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOn.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOn.il.netcore.debug.bsl index b3476f7d00d..5233316d3d6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOn.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOn.il.netcore.debug.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOn.il.netcore.release.bsl index b3476f7d00d..5233316d3d6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Ordering01.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -21,12 +21,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOff.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOff.il.net472.debug.bsl index 1953556cebe..af213bf3c62 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOff.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOff.il.net472.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOff.il.net472.release.bsl index 1953556cebe..af213bf3c62 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOff.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOff.il.netcore.debug.bsl index 1df5e14cf83..991459ba7bc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOff.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOff.il.netcore.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOff.il.netcore.release.bsl index 1df5e14cf83..991459ba7bc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOn.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOn.il.net472.debug.bsl index afbad574fbe..bd60640c8c8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOn.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOn.il.net472.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOn.il.net472.release.bsl index afbad574fbe..bd60640c8c8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOn.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOn.il.netcore.debug.bsl index 5e10bfe4ec9..e77426daa7b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOn.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOn.il.netcore.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOn.il.netcore.release.bsl index 5e10bfe4ec9..e77426daa7b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOff.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOff.il.net472.debug.bsl index 8fbb3f275dc..a93858256e9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOff.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOff.il.net472.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOff.il.net472.release.bsl index 8fbb3f275dc..a93858256e9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOff.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOff.il.netcore.debug.bsl index 7da83cc1d73..bd9a09fdbb5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOff.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOff.il.netcore.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOff.il.netcore.release.bsl index 7da83cc1d73..ab9027dc788 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -12,7 +12,7 @@ .assembly extern System.Linq { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 + .ver 9:0:0:0 } .assembly assembly { @@ -25,16 +25,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -89,8 +79,7 @@ IL_001b: ret } - .method public strict virtual instance int32 - GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed + .method public strict virtual instance int32 GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed { .maxstack 6 @@ -166,8 +155,7 @@ IL_0093: ret } - .method public strict virtual instance void - Close() cil managed + .method public strict virtual instance void Close() cil managed { .maxstack 6 @@ -248,8 +236,7 @@ IL_007b: ret } - .method public strict virtual instance bool - get_CheckClose() cil managed + .method public strict virtual instance bool get_CheckClose() cil managed { .maxstack 8 @@ -285,8 +272,7 @@ IL_002f: ret } - .method public strict virtual instance string - get_LastGenerated() cil managed + .method public strict virtual instance string get_LastGenerated() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -297,8 +283,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 - GetFreshEnumerator() cil managed + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 GetFreshEnumerator() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -319,8 +304,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'iAfterE@13-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -331,8 +315,7 @@ IL_0006: ret } - .method public strict virtual instance bool - Invoke(string w) cil managed + .method public strict virtual instance bool Invoke(string w) cil managed { .maxstack 8 @@ -342,8 +325,7 @@ IL_000b: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -361,8 +343,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -376,8 +357,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 - Invoke(class [Utils]Utils/Product _arg1) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { .maxstack 6 @@ -398,8 +378,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #1 input at line 20@22-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -410,8 +389,7 @@ IL_0006: ret } - .method public strict virtual instance class [Utils]Utils/Product - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -419,8 +397,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -435,8 +412,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #1 input at line 20@22-2' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -447,8 +423,7 @@ IL_0006: ret } - .method public strict virtual instance string - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -458,8 +433,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -477,8 +451,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -492,8 +465,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,object> - Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,object> Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed { .maxstack 6 @@ -531,8 +503,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> { .field static assembly initonly class assembly/'Pipe #1 input at line 20@23-4' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -543,8 +514,7 @@ IL_0006: ret } - .method public strict virtual instance bool - Invoke(class [System.Linq]System.Linq.IGrouping`2 g) cil managed + .method public strict virtual instance bool Invoke(class [System.Linq]System.Linq.IGrouping`2 g) cil managed { .maxstack 8 @@ -558,8 +528,7 @@ IL_0012: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -574,8 +543,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [runtime]System.Tuple`2>> { .field static assembly initonly class assembly/'Pipe #1 input at line 20@24-6' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -586,8 +554,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2> - Invoke(class [System.Linq]System.Linq.IGrouping`2 g) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2> Invoke(class [System.Linq]System.Linq.IGrouping`2 g) cil managed { .maxstack 8 @@ -599,8 +566,7 @@ IL_000c: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -648,8 +614,7 @@ IL_001b: ret } - .method public strict virtual instance int32 - GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed + .method public strict virtual instance int32 GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1& next) cil managed { .maxstack 6 @@ -725,8 +690,7 @@ IL_0093: ret } - .method public strict virtual instance void - Close() cil managed + .method public strict virtual instance void Close() cil managed { .maxstack 6 @@ -807,8 +771,7 @@ IL_007b: ret } - .method public strict virtual instance bool - get_CheckClose() cil managed + .method public strict virtual instance bool get_CheckClose() cil managed { .maxstack 8 @@ -844,8 +807,7 @@ IL_002f: ret } - .method public strict virtual instance int32 - get_LastGenerated() cil managed + .method public strict virtual instance int32 get_LastGenerated() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -856,8 +818,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 - GetFreshEnumerator() cil managed + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1 GetFreshEnumerator() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -878,8 +839,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'onlyOdd@33-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -890,8 +850,7 @@ IL_0006: ret } - .method public strict virtual instance bool - Invoke(int32 n) cil managed + .method public strict virtual instance bool Invoke(int32 n) cil managed { .maxstack 8 @@ -903,8 +862,7 @@ IL_0006: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -922,8 +880,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -937,8 +894,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 - Invoke(class [Utils]Utils/Product _arg1) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { .maxstack 6 @@ -959,8 +915,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #2 input at line 38@40-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -971,8 +926,7 @@ IL_0006: ret } - .method public strict virtual instance class [Utils]Utils/Product - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -980,8 +934,7 @@ IL_0001: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -996,8 +949,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/'Pipe #2 input at line 38@40-2' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1008,8 +960,7 @@ IL_0006: ret } - .method public strict virtual instance string - Invoke(class [Utils]Utils/Product p) cil managed + .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { .maxstack 8 @@ -1019,8 +970,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -1038,8 +988,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1053,8 +1002,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,object> - Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,object> Invoke(class [System.Linq]System.Linq.IGrouping`2 _arg2) cil managed { .maxstack 6 @@ -1092,8 +1040,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> { .field static assembly initonly class assembly/'Pipe #2 input at line 38@41-4' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1104,8 +1051,7 @@ IL_0006: ret } - .method public strict virtual instance bool - Invoke(class [System.Linq]System.Linq.IGrouping`2 g) cil managed + .method public strict virtual instance bool Invoke(class [System.Linq]System.Linq.IGrouping`2 g) cil managed { .maxstack 8 @@ -1119,8 +1065,7 @@ IL_0012: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -1135,8 +1080,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [runtime]System.Tuple`2>> { .field static assembly initonly class assembly/'Pipe #2 input at line 38@42-6' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1147,8 +1091,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2> - Invoke(class [System.Linq]System.Linq.IGrouping`2 g) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2> Invoke(class [System.Linq]System.Linq.IGrouping`2 g) cil managed { .maxstack 8 @@ -1160,8 +1103,7 @@ IL_000c: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -1172,8 +1114,7 @@ } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_words() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_words() cil managed { .maxstack 8 @@ -1181,8 +1122,7 @@ IL_0005: ret } - .method public specialname static bool - get_iAfterE() cil managed + .method public specialname static bool get_iAfterE() cil managed { .maxstack 8 @@ -1190,8 +1130,7 @@ IL_0005: ret } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_products() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_products() cil managed { .maxstack 8 @@ -1199,8 +1138,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Tuple`2>[] - get_productGroups() cil managed + .method public specialname static class [runtime]System.Tuple`2>[] get_productGroups() cil managed { .maxstack 8 @@ -1208,8 +1146,7 @@ IL_0005: ret } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_numbers() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_numbers() cil managed { .maxstack 8 @@ -1217,8 +1154,7 @@ IL_0005: ret } - .method public specialname static bool - get_onlyOdd() cil managed + .method public specialname static bool get_onlyOdd() cil managed { .maxstack 8 @@ -1226,8 +1162,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Tuple`2>[] - get_productGroups2() cil managed + .method public specialname static class [runtime]System.Tuple`2>[] get_productGroups2() cil managed { .maxstack 8 @@ -1463,3 +1398,8 @@ } } + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOn.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOn.il.net472.debug.bsl index 0b529d2bb16..31ace18df56 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOn.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOn.il.net472.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOn.il.net472.release.bsl index 0b529d2bb16..31ace18df56 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOn.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOn.il.netcore.debug.bsl index 0762597cbf5..9b14c6fae09 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOn.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOn.il.netcore.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOn.il.netcore.release.bsl index 0762597cbf5..b2deea5a996 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -12,7 +12,7 @@ .assembly extern System.Linq { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 + .ver 9:0:0:0 } .assembly assembly { @@ -25,16 +25,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -1411,4 +1401,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOff.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOff.il.net472.debug.bsl index 93793e1a41e..eb8c609233d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOff.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOff.il.net472.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOff.il.net472.release.bsl index 7970541d28b..8a1f7e53459 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOff.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOff.il.netcore.debug.bsl index f98f9bb3ec1..00848869c47 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOff.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOff.il.netcore.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOff.il.netcore.release.bsl index a3258e172d0..2782f5fbaee 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -25,16 +25,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -3857,4 +3847,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOn.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOn.il.net472.debug.bsl index ff7beae840f..5f2973a26fd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOn.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOn.il.net472.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOn.il.net472.release.bsl index d48a90e8545..350875b918a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOn.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOn.il.netcore.debug.bsl index 874c6413397..9b747bc26e6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOn.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOn.il.netcore.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOn.il.netcore.release.bsl index bf163f0f1e2..3fb0dc68a84 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Select01.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -25,16 +25,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -3813,4 +3803,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs index 9e72df16616..f734befa3fc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs @@ -1,5 +1,5 @@ // #Conformance #DataExpressions #Query -// Set Opeartors LINQ101 samples converted to query +// Set Operators LINQ101 samples converted to query open System open System.Collections.Generic diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOff.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOff.il.net472.debug.bsl index c6657e65304..40cbbe5c421 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOff.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOff.il.net472.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOff.il.net472.release.bsl index c6657e65304..40cbbe5c421 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOff.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOff.il.netcore.debug.bsl index 4e0fe4ac001..60b2431eea4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOff.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOff.il.netcore.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOff.il.netcore.release.bsl index 4e0fe4ac001..60b2431eea4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOn.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOn.il.net472.debug.bsl index 4fc8a2245fd..86390feef17 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOn.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOn.il.net472.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOn.il.net472.release.bsl index 4fc8a2245fd..86390feef17 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOn.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOn.il.netcore.debug.bsl index 303f6f4ed2f..2e444ed4233 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOn.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOn.il.netcore.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOn.il.netcore.release.bsl index 303f6f4ed2f..2e444ed4233 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOff.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOff.il.net472.debug.bsl index 9a56cf78c9c..31583ecf11a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOff.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOff.il.net472.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOff.il.net472.release.bsl index 9a56cf78c9c..31583ecf11a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOff.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOff.il.netcore.debug.bsl index 6dc75b43f07..241d74ad838 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOff.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOff.il.netcore.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOff.il.netcore.release.bsl index 6dc75b43f07..241d74ad838 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOn.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOn.il.net472.debug.bsl index 7cdc7a9d4e7..11aefdf4bdf 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOn.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOn.il.net472.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOn.il.net472.release.bsl index 7cdc7a9d4e7..11aefdf4bdf 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOn.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOn.il.netcore.debug.bsl index f0e638e9a04..30aff79dca9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOn.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOn.il.netcore.debug.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOn.il.netcore.release.bsl index f0e638e9a04..30aff79dca9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Linq101Where01.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -26,12 +26,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Utils.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Utils.fs index cf652bfdc87..b8fba331561 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Utils.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/QueryExpressionStepping/Utils.fs @@ -222,6 +222,6 @@ let getCustomerList() = let total = o.Element(xname "total") |> decimal select (Order(order, orderDate, total)) } |> Seq.toArray - let c = Customer(get "id", get "name", get "address", get "city", get "region", get "postcalcode", get "country", get "phone", get "fax", orders) + let c = Customer(get "id", get "name", get "address", get "city", get "region", get "postalcode", get "country", get "phone", get "fax", orders) select c } |> Seq.toList \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeInitialization.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeInitialization.fs index 19165b3fe8c..fe209b3e50e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeInitialization.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeInitialization.fs @@ -33,7 +33,6 @@ module MyModule = printfn "Hello from main method" 0 """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -60,7 +59,6 @@ type MySecondType = printfn "Hello from implicit main method" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -92,7 +90,6 @@ module MyModule = printfn "Hello from main method" 0 """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> withStdOutContainsAllInOrder [ @@ -132,7 +129,6 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -171,7 +167,6 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -210,7 +205,6 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -248,7 +242,6 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -286,7 +279,6 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -325,7 +317,6 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> withStdOutContainsAllInOrder [ @@ -370,7 +361,6 @@ type FSharpSource with module doit = printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -408,7 +398,6 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -449,7 +438,6 @@ let message = FSharpSourceFromFile.SetIt ("Here is something") printfn $"{message}" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -487,7 +475,6 @@ type MyClass = printfn "%A" (MyClass.result()) """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> withNoOptimize |> compileExeAndRun @@ -854,7 +841,6 @@ namespace Microsoft.FSharp.Core.CompilerServices loop () """ |> asExe - |> withLangVersionPreview |> withRealInternalSignature realSig |> withOptimize |> compileAndRun diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibility.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibility.fs index acd800eb0a6..cb0e4d3168e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibility.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibility.fs @@ -25,7 +25,6 @@ type public TypeThree private () = class end type public TypeFour () = class end """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -73,7 +72,6 @@ type private TypeThree private () = class end type private TypeFour () = class end """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -161,7 +159,6 @@ type public TestType () = member _.DefaultMethod() = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -251,7 +248,6 @@ type public TestType () = member _.DefaultMethod() = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -341,7 +337,6 @@ type public TestType () = member val DefaultProperty = 0 with get, set """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -567,7 +562,6 @@ type public TestType () = member val DefaultProperty = 0 with get, set """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -801,7 +795,6 @@ type public TestType () = member _.MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -1243,7 +1236,6 @@ type private TestType () = member _.MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -1677,7 +1669,6 @@ type public TestType () = static member DefaultMethod() = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -1767,7 +1758,6 @@ type public TestType () = static member DefaultMethod() = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -1856,7 +1846,6 @@ type public TestType () = static member val private PrivateProperty = 0 with get, set static member val DefaultProperty = 0 with get, set""" |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -2193,7 +2182,6 @@ type private TestType () = static member val private PrivateProperty = 0 with get, set static member val DefaultProperty = 0 with get, set""" |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -2427,7 +2415,6 @@ type public TestType () = static member MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -2869,7 +2856,6 @@ type private TestType () = static member MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityModuleRoot.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityModuleRoot.fs index 318a5f3a7cb..763bbc9c33e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityModuleRoot.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityModuleRoot.fs @@ -25,7 +25,6 @@ type public TypeThree private () = class end type public TypeFour () = class end """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -93,7 +92,6 @@ type private TypeTwo internal () = class end type private TypeThree private () = class end type private TypeFour () = class end""" |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -257,7 +255,6 @@ type public TestType () = member _.DefaultMethod() = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -289,7 +286,6 @@ type public TestType () = member _.DefaultMethod() = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -322,7 +318,6 @@ type public TestType () = member val DefaultProperty = 0 with get, set """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -363,7 +358,6 @@ type public TestType () = member val DefaultProperty = 0 with get, set """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -412,7 +406,6 @@ type public TestType () = member _.MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -493,7 +486,6 @@ type private TestType () = member _.MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -566,7 +558,6 @@ type public TestType () = static member DefaultMethod() = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -599,7 +590,6 @@ type private TestType () = static member DefaultMethod() = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -631,7 +621,6 @@ type public TestType () = static member val private PrivateProperty = 0 with get, set static member val DefaultProperty = 0 with get, set""" |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -670,7 +659,6 @@ type private TestType () = static member val private PrivateProperty = 0 with get, set static member val DefaultProperty = 0 with get, set""" |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -718,7 +706,6 @@ type public TestType () = static member MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -799,7 +786,6 @@ type private TestType () = static member MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -873,7 +859,6 @@ module internal SR = SR.getLazyThing () """ |> asExe - |> withLangVersionPreview |> withOptimize |> withRealInternalSignature realSig |> compileExeAndRun diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityModuleRootWithFsi.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityModuleRootWithFsi.fs index 4d7d55c1e8e..8dc1184ea3a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityModuleRootWithFsi.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityModuleRootWithFsi.fs @@ -33,7 +33,6 @@ type TypeFour () = class end type HiddenType () = class end """)) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -252,7 +251,6 @@ type TypeFour () = class end type HiddenType () = class end """)) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -461,7 +459,6 @@ type TestType () = member _.DefaultMethod() = () member _.HiddenMethod() = ()""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -503,7 +500,6 @@ type TestType () = member _.DefaultMethod() = () member _.HiddenMethod() = ()""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -547,7 +543,6 @@ type TestType () = member val PrivateProperty = 0 with get, set member val DefaultProperty = 0 with get, set""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -600,7 +595,6 @@ type TestType () = member val DefaultProperty = 0 with get, set member val HiddenProperty = 0 with get, set""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -680,7 +674,6 @@ type public TestType () = member _.MixedPropertyEleven with get() = 0 and set (_:int) = () member _.MixedPropertyTwelve with get() = 0 and set (_:int) = ()""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -788,7 +781,6 @@ type public TestType () = member _.MixedPropertyEleven with get() = 0 and set (_:int) = () member _.MixedPropertyTwelve with get() = 0 and set (_:int) = ()""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -903,7 +895,6 @@ type public TestType () = static member DefaultMethod() = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -948,7 +939,6 @@ type TestType () = static member val DefaultProperty = 0 with get, set static member val HiddenProperty = 0 with get, set""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -1004,7 +994,6 @@ type TestType () = static member val PrivateProperty = 0 with get, set static member val DefaultProperty = 0 with get, set""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -1081,7 +1070,6 @@ type public TestType () = static member MixedPropertyEleven with internal get() = 0 and set (_:int) = () static member MixedPropertyTwelve with private get() = 0 and set (_:int) = ()""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -1191,7 +1179,6 @@ type private TestType () = static member MixedPropertyEleven with internal get() = 0 and set (_:int) = () static member MixedPropertyTwelve with private get() = 0 and set (_:int) = ()""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityNamespaceRoot.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityNamespaceRoot.fs index c12fe0c6829..695d6cd8ba2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityNamespaceRoot.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityNamespaceRoot.fs @@ -25,7 +25,6 @@ type public TypeThree private () = class end type public TypeFour () = class end """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -191,7 +190,6 @@ type private TypeThree private () = class end type private TypeFour () = class end """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -285,7 +283,6 @@ type public TestType () = member _.DefaultMethod() = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -317,7 +314,6 @@ type private TestType () = member _.DefaultMethod() = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -350,7 +346,6 @@ type public TestType () = member val DefaultProperty = 0 with get, set """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -391,7 +386,6 @@ type public TestType () = member val DefaultProperty = 0 with get, set """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -440,7 +434,6 @@ type public TestType () = member _.MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -523,7 +516,6 @@ type private TestType () = member _.MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -595,7 +587,6 @@ type public TestType () = static member DefaultMethod() = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -627,7 +618,6 @@ type public TestType () = static member DefaultMethod() = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -659,7 +649,6 @@ type public TestType () = static member val private PrivateProperty = 0 with get, set static member val DefaultProperty = 0 with get, set""" |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -699,7 +688,6 @@ type private TestType () = static member val private PrivateProperty = 0 with get, set static member val DefaultProperty = 0 with get, set""" |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -748,7 +736,6 @@ type public TestType () = static member MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -829,7 +816,6 @@ type private TestType () = static member MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityNamespaceRootWithFsi.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityNamespaceRootWithFsi.fs index 6f3b58e6f66..39e9658c226 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityNamespaceRootWithFsi.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityNamespaceRootWithFsi.fs @@ -33,7 +33,6 @@ type TypeFour () = class end type HiddenType () = class end """)) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -243,7 +242,6 @@ type TypeFour () = class end type HiddenType () = class end """)) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -362,7 +360,6 @@ type TestType () = member _.DefaultMethod() = () member _.HiddenMethod() = ()""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -405,7 +402,6 @@ type TestType () = member _.DefaultMethod() = () member _.HiddenMethod() = ()""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -452,7 +448,6 @@ type TestType () = member val DefaultProperty = 0 with get, set member val HiddenProperty = 0 with get, set""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -509,7 +504,6 @@ type TestType () = member val DefaultProperty = 0 with get, set member val HiddenProperty = 0 with get, set""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -589,7 +583,6 @@ type public TestType () = member _.MixedPropertyEleven with get() = 0 and set (_:int) = () member _.MixedPropertyTwelve with get() = 0 and set (_:int) = ()""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -699,7 +692,6 @@ type public TestType () = member _.MixedPropertyEleven with get() = 0 and set (_:int) = () member _.MixedPropertyTwelve with get() = 0 and set (_:int) = ()""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -779,7 +771,6 @@ type TestType () = static member DefaultMethod() = () static member HiddenMethod() = ()""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -814,7 +805,6 @@ type public TestType () = static member DefaultMethod() = () """ |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -859,7 +849,6 @@ type TestType () = static member val DefaultProperty = 0 with get, set static member val HiddenProperty = 0 with get, set""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -916,7 +905,6 @@ type TestType () = static member val DefaultProperty = 0 with get, set static member val HiddenProperty = 0 with get, set""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -997,7 +985,6 @@ type public TestType () = static member MixedPropertyEleven with internal get() = 0 and set (_:int) = () static member MixedPropertyTwelve with private get() = 0 and set (_:int) = ()""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -1107,7 +1094,6 @@ type private TestType () = static member MixedPropertyEleven with internal get() = 0 and set (_:int) = () static member MixedPropertyTwelve with private get() = 0 and set (_:int) = ()""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -1186,7 +1172,6 @@ type TestType () = static member DefaultMethod() = () static member HiddenMethod() = ()""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ @@ -1231,7 +1216,6 @@ type TestType () = static member DefaultMethod() = () static member HiddenMethod() = ()""")) |> asLibrary - |> withLangVersionPreview |> withRealInternalSignature realSig |> compile |> withILContains [ diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ModuleInitialization.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ModuleInitialization.fs index 8666aaad2ac..00c1c1394cc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ModuleInitialization.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ModuleInitialization.fs @@ -334,7 +334,6 @@ type MyType = static let x1 = 1100 + System.Random().Next(0) static let _ = printfn "Hello, World from MyLibrary.MyType" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -367,7 +366,6 @@ type MyType = printfn $"{{C.P2}}" if C.P2 <> 6 then failwith $"Invalid result: C.P2 <> 6 - actual: {{C.P2}}" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> withOptions [ "--nowarn:3370"; "--debug+"; "--optimize-" ] |> compileExeAndRun @@ -399,7 +397,6 @@ module {recursive} MyModule = printfn "Hello from main method" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -449,7 +446,6 @@ module {{recursive}} MyModule = printfn "Hello from main method" 0 """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -507,7 +503,6 @@ module rec MyModule = 0 """ |> withFlavor release - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -543,7 +538,6 @@ module internal PrintfImpl printfn $"FormatParser.prefix: {FormatParser().GetStepsForCapturedFormat()}" printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -579,7 +573,6 @@ module doit = createFromFile("Hello") |> ignore printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -603,7 +596,6 @@ module private TestReferences = module doSomething = printfn $"{TestReferences.NetStandard20.Files.netStandard.Value}" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -638,7 +630,6 @@ module Test6 let public getInt (data:Data): int = HelperModule.handle data.Thing """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> asLibrary |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/RealInternalSignature.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/RealInternalSignature.fs index b0b12e502d0..2f03e5de0e3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/RealInternalSignature.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/RealInternalSignature.fs @@ -334,7 +334,6 @@ type MyType = static let x1 = 1100 + System.Random().Next(0) static let _ = printfn "Hello, World from MyLibrary.MyType" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -365,7 +364,6 @@ module MyModule = printfn "Hello from main method" 0 """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -396,7 +394,6 @@ module MyModule = printfn "Hello from main method" 0 """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -428,7 +425,6 @@ module MyModule = printfn "Hello from main method" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -463,7 +459,6 @@ module MyModule = printfn "Hello from main method" 0 """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -495,7 +490,6 @@ module internal PrintfImpl printfn $"FormatParser.prefix: {FormatParser().GetStepsForCapturedFormat()}" printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -535,7 +529,6 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -574,7 +567,6 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -613,7 +605,6 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -651,7 +642,6 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -689,7 +679,6 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -728,7 +717,6 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -1042,7 +1030,6 @@ type FSharpSource with module doit = printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -1080,7 +1067,6 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -1115,7 +1101,6 @@ module doit = createFromFile("Hello") |> ignore printfn "Main program" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -1159,7 +1144,6 @@ let makeOne() = FSharpSourceFromFile.MakeOne() printfn $"{makeOne().FilePath}" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -1183,7 +1167,6 @@ module private TestReferences = module doSomething = printfn $"{TestReferences.NetStandard20.Files.netStandard.Value}" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -1212,7 +1195,6 @@ module private outer_private = module doSomething = printfn "Hello, World!" """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -1248,8 +1230,60 @@ module Test6 let public getInt (data:Data): int = HelperModule.handle data.Thing """ - |> withLangVersionPreview |> withRealInternalSignature realSig |> asLibrary |> compile |> shouldSucceed + + [] + let ``Calling protected static base member from `static do` does not raise MethodAccessException when --realsig+`` () = + FSharp """ +#nowarn "44" // using Uri.EscapeString just because it's protected static + +type C(str : string) = + inherit System.Uri(str) + + static do + System.Uri.EscapeString("http://www.myserver.com") |> ignore + printfn "Hello, World" + +module M = + [] + let main args = + let res = C("http://www.myserver.com") + 0 + """ + |> withLangVersionPreview + |> withRealInternalSignature true + |> asLibrary + |> compile + |> compileExeAndRun + |> shouldSucceed + |> withStdOutContainsAllInOrder [ + "Hello, World" + ] + + [] + let ``Calling protected static base member from `static do` raises MethodAccessException with --realsig-`` () = + FSharp """ +#nowarn "44" // using Uri.EscapeString just because it's protected static + +type C(str : string) = + inherit System.Uri(str) + + static do + System.Uri.EscapeString("http://www.myserver.com") |> ignore + printfn "Hello, World" + +module M = + [] + let main args = + let res = C("http://www.myserver.com") + 0 + """ + |> withLangVersionPreview + |> withRealInternalSignature false + |> asLibrary + |> compile + |> compileExeAndRun + |> shouldFail \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionStepping.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionStepping.fs index 10346caac2a..01a3c5d6fc4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionStepping.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionStepping.fs @@ -101,12 +101,12 @@ module SeqExpressionStepping = |> withRealInternalSignatureOff |> verifyCompilation +#if NETCOREAPP // SOURCE=SeqExpressionSteppingTest07.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd SeqExpressionSteppingTest7.exe" # SeqExpressionSteppingTest7.fs - [] let ``SeqExpressionSteppingTest07_RealInternalSignatureOn_fs`` compilation = compilation |> withRealInternalSignatureOn - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=SeqExpressionSteppingTest07.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd SeqExpressionSteppingTest7.exe" # SeqExpressionSteppingTest7.fs - @@ -114,5 +114,5 @@ module SeqExpressionStepping = let ``SeqExpressionSteppingTest07_RealInternalSignatureOff_fs`` compilation = compilation |> withRealInternalSignatureOff - |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation +#endif \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest01.fs.RealInternalSignatureOff.il.bsl index 36ec2d96a52..aa9d8f6b28b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest01.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest01.fs.RealInternalSignatureOn.il.bsl index 3b2c45a9149..d90f88246bc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest02.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest02.fs.RealInternalSignatureOff.il.bsl index 4400ae53886..e0dbc87787d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest02.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest02.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest02.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest02.fs.RealInternalSignatureOn.il.bsl index c667f5ac064..a95aef22f7f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest02.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest02.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest03.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest03.fs.RealInternalSignatureOff.il.bsl index 61bdc63be2d..760daabc6ef 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest03.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest03.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest03.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest03.fs.RealInternalSignatureOn.il.bsl index bd1abfe67c0..995d0770777 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest03.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest03.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest04.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest04.fs.RealInternalSignatureOff.il.bsl index 7a56bcf3e94..87cdddbc615 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest04.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest04.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest04.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest04.fs.RealInternalSignatureOn.il.bsl index a56865f2de9..3942c10104b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest04.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest04.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest05.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest05.fs.RealInternalSignatureOff.il.bsl index dcf9a44b123..c9c71515526 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest05.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest05.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest05.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest05.fs.RealInternalSignatureOn.il.bsl index fca2f21dd75..0bc58b2d8f8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest05.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest05.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest06.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest06.fs.RealInternalSignatureOff.il.bsl index e7288a13fd6..3835b9fa0d5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest06.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest06.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest06.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest06.fs.RealInternalSignatureOn.il.bsl index 343d2d040f7..5170c5d889c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest06.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest06.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs index 8a4d7cc8e15..2c178dd00b0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs @@ -6,11 +6,11 @@ let f () = [ if (r <- r + 1; true) then yield! failwith "" ] printfn "res = %A" (try f () with Failure _ -> [r]) -let testSimpleForEachSeqLoopWithOneStatement inp = +let testSimpleForEachSeqLoopWithOneStatement (inp: int seq) = for x in inp do System.Console.WriteLine("{0}", x) -let testSimpleForEachSeqLoopWithTwoStatements inp = +let testSimpleForEachSeqLoopWithTwoStatements (inp: int seq) = for x in inp do System.Console.WriteLine("{0}", x) System.Console.WriteLine("{0}", x) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.net472.debug.bsl index 0b0542bcd06..0fd66bf54cf 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.net472.release.bsl index 0b0542bcd06..0fd66bf54cf 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.netcore.debug.bsl index 885135c69e6..ad76bc50512 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.netcore.debug.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.netcore.release.bsl index 885135c69e6..ef8c6021f6b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -17,16 +17,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -101,102 +91,105 @@ IL_003c: ret } - .method public static void testSimpleForEachSeqLoopWithOneStatement(class [runtime]System.Collections.Generic.IEnumerable`1 inp) cil managed + .method public static void testSimpleForEachSeqLoopWithOneStatement(class [runtime]System.Collections.Generic.IEnumerable`1 inp) cil managed { .maxstack 4 - .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, - class [runtime]System.Collections.Generic.IEnumerator`1 V_1, - object[] V_2, + .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + int32 V_2, class [runtime]System.IDisposable V_3) IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 - IL_0003: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0003: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() IL_0008: stloc.1 .try { - IL_0009: br.s IL_001d + IL_0009: br.s IL_0022 IL_000b: ldloc.1 - IL_000c: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_000c: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() IL_0011: stloc.2 IL_0012: ldstr "{0}" IL_0017: ldloc.2 - IL_0018: call void [runtime]System.Console::WriteLine(string, - object[]) - IL_001d: ldloc.1 - IL_001e: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() - IL_0023: brtrue.s IL_000b + IL_0018: box [runtime]System.Int32 + IL_001d: call void [runtime]System.Console::WriteLine(string, + object) + IL_0022: ldloc.1 + IL_0023: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0028: brtrue.s IL_000b - IL_0025: leave.s IL_0039 + IL_002a: leave.s IL_003e } finally { - IL_0027: ldloc.1 - IL_0028: isinst [runtime]System.IDisposable - IL_002d: stloc.3 - IL_002e: ldloc.3 - IL_002f: brfalse.s IL_0038 - - IL_0031: ldloc.3 - IL_0032: callvirt instance void [runtime]System.IDisposable::Dispose() - IL_0037: endfinally - IL_0038: endfinally + IL_002c: ldloc.1 + IL_002d: isinst [runtime]System.IDisposable + IL_0032: stloc.3 + IL_0033: ldloc.3 + IL_0034: brfalse.s IL_003d + + IL_0036: ldloc.3 + IL_0037: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_003c: endfinally + IL_003d: endfinally } - IL_0039: ret + IL_003e: ret } - .method public static void testSimpleForEachSeqLoopWithTwoStatements(class [runtime]System.Collections.Generic.IEnumerable`1 inp) cil managed + .method public static void testSimpleForEachSeqLoopWithTwoStatements(class [runtime]System.Collections.Generic.IEnumerable`1 inp) cil managed { .maxstack 4 - .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, - class [runtime]System.Collections.Generic.IEnumerator`1 V_1, - object[] V_2, + .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + int32 V_2, class [runtime]System.IDisposable V_3) IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 - IL_0003: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0003: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() IL_0008: stloc.1 .try { - IL_0009: br.s IL_0028 + IL_0009: br.s IL_0032 IL_000b: ldloc.1 - IL_000c: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_000c: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() IL_0011: stloc.2 IL_0012: ldstr "{0}" IL_0017: ldloc.2 - IL_0018: call void [runtime]System.Console::WriteLine(string, - object[]) - IL_001d: ldstr "{0}" - IL_0022: ldloc.2 - IL_0023: call void [runtime]System.Console::WriteLine(string, - object[]) - IL_0028: ldloc.1 - IL_0029: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() - IL_002e: brtrue.s IL_000b - - IL_0030: leave.s IL_0044 + IL_0018: box [runtime]System.Int32 + IL_001d: call void [runtime]System.Console::WriteLine(string, + object) + IL_0022: ldstr "{0}" + IL_0027: ldloc.2 + IL_0028: box [runtime]System.Int32 + IL_002d: call void [runtime]System.Console::WriteLine(string, + object) + IL_0032: ldloc.1 + IL_0033: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0038: brtrue.s IL_000b + + IL_003a: leave.s IL_004e } finally { - IL_0032: ldloc.1 - IL_0033: isinst [runtime]System.IDisposable - IL_0038: stloc.3 - IL_0039: ldloc.3 - IL_003a: brfalse.s IL_0043 - - IL_003c: ldloc.3 - IL_003d: callvirt instance void [runtime]System.IDisposable::Dispose() - IL_0042: endfinally - IL_0043: endfinally + IL_003c: ldloc.1 + IL_003d: isinst [runtime]System.IDisposable + IL_0042: stloc.3 + IL_0043: ldloc.3 + IL_0044: brfalse.s IL_004d + + IL_0046: ldloc.3 + IL_0047: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_004c: endfinally + IL_004d: endfinally } - IL_0044: ret + IL_004e: ret } .method public static void testSimpleForEachArrayLoopWithOneStatement(int32[] inp) cil managed @@ -797,4 +790,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.net472.debug.bsl index 0022e910a22..d262ec04953 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.net472.release.bsl index 0022e910a22..d262ec04953 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.netcore.debug.bsl index 64016951d4d..231c7817638 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.netcore.debug.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.netcore.release.bsl index 64016951d4d..8ed4541528d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -17,16 +17,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -103,102 +93,105 @@ IL_003c: ret } - .method public static void testSimpleForEachSeqLoopWithOneStatement(class [runtime]System.Collections.Generic.IEnumerable`1 inp) cil managed + .method public static void testSimpleForEachSeqLoopWithOneStatement(class [runtime]System.Collections.Generic.IEnumerable`1 inp) cil managed { .maxstack 4 - .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, - class [runtime]System.Collections.Generic.IEnumerator`1 V_1, - object[] V_2, + .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + int32 V_2, class [runtime]System.IDisposable V_3) IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 - IL_0003: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0003: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() IL_0008: stloc.1 .try { - IL_0009: br.s IL_001d + IL_0009: br.s IL_0022 IL_000b: ldloc.1 - IL_000c: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_000c: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() IL_0011: stloc.2 IL_0012: ldstr "{0}" IL_0017: ldloc.2 - IL_0018: call void [runtime]System.Console::WriteLine(string, - object[]) - IL_001d: ldloc.1 - IL_001e: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() - IL_0023: brtrue.s IL_000b + IL_0018: box [runtime]System.Int32 + IL_001d: call void [runtime]System.Console::WriteLine(string, + object) + IL_0022: ldloc.1 + IL_0023: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0028: brtrue.s IL_000b - IL_0025: leave.s IL_0039 + IL_002a: leave.s IL_003e } finally { - IL_0027: ldloc.1 - IL_0028: isinst [runtime]System.IDisposable - IL_002d: stloc.3 - IL_002e: ldloc.3 - IL_002f: brfalse.s IL_0038 - - IL_0031: ldloc.3 - IL_0032: callvirt instance void [runtime]System.IDisposable::Dispose() - IL_0037: endfinally - IL_0038: endfinally + IL_002c: ldloc.1 + IL_002d: isinst [runtime]System.IDisposable + IL_0032: stloc.3 + IL_0033: ldloc.3 + IL_0034: brfalse.s IL_003d + + IL_0036: ldloc.3 + IL_0037: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_003c: endfinally + IL_003d: endfinally } - IL_0039: ret + IL_003e: ret } - .method public static void testSimpleForEachSeqLoopWithTwoStatements(class [runtime]System.Collections.Generic.IEnumerable`1 inp) cil managed + .method public static void testSimpleForEachSeqLoopWithTwoStatements(class [runtime]System.Collections.Generic.IEnumerable`1 inp) cil managed { .maxstack 4 - .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, - class [runtime]System.Collections.Generic.IEnumerator`1 V_1, - object[] V_2, + .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + int32 V_2, class [runtime]System.IDisposable V_3) IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 - IL_0003: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0003: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() IL_0008: stloc.1 .try { - IL_0009: br.s IL_0028 + IL_0009: br.s IL_0032 IL_000b: ldloc.1 - IL_000c: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_000c: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() IL_0011: stloc.2 IL_0012: ldstr "{0}" IL_0017: ldloc.2 - IL_0018: call void [runtime]System.Console::WriteLine(string, - object[]) - IL_001d: ldstr "{0}" - IL_0022: ldloc.2 - IL_0023: call void [runtime]System.Console::WriteLine(string, - object[]) - IL_0028: ldloc.1 - IL_0029: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() - IL_002e: brtrue.s IL_000b - - IL_0030: leave.s IL_0044 + IL_0018: box [runtime]System.Int32 + IL_001d: call void [runtime]System.Console::WriteLine(string, + object) + IL_0022: ldstr "{0}" + IL_0027: ldloc.2 + IL_0028: box [runtime]System.Int32 + IL_002d: call void [runtime]System.Console::WriteLine(string, + object) + IL_0032: ldloc.1 + IL_0033: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0038: brtrue.s IL_000b + + IL_003a: leave.s IL_004e } finally { - IL_0032: ldloc.1 - IL_0033: isinst [runtime]System.IDisposable - IL_0038: stloc.3 - IL_0039: ldloc.3 - IL_003a: brfalse.s IL_0043 - - IL_003c: ldloc.3 - IL_003d: callvirt instance void [runtime]System.IDisposable::Dispose() - IL_0042: endfinally - IL_0043: endfinally + IL_003c: ldloc.1 + IL_003d: isinst [runtime]System.IDisposable + IL_0042: stloc.3 + IL_0043: ldloc.3 + IL_0044: brfalse.s IL_004d + + IL_0046: ldloc.3 + IL_0047: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_004c: endfinally + IL_004d: endfinally } - IL_0044: ret + IL_004e: ret } .method public static void testSimpleForEachArrayLoopWithOneStatement(int32[] inp) cil managed @@ -816,4 +809,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls01.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls01.fs.il.bsl index a57639cccf3..be85d82d286 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls01.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls01.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls02.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls02.fs.il.bsl index b7d52969c32..f9f806854dd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls02.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionTailCalls/SeqExpressionTailCalls02.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.debug.bsl index 159f7e2c450..f5f04fcb40b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.release.bsl index 780d56a5895..0b5ef0b234d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.debug.bsl index 9957f4217a5..a624fee0548 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl index bbc1bf0b3eb..ea95334d07b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.debug.bsl index 9e648689434..8bcae45c3b1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.release.bsl index 858f37651d4..5347d3988b5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.debug.bsl index 9404a1c69e8..8f30173d50c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl index c14fc627c7e..ea5b17e94c6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOff.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOff.il.net472.debug.bsl index f050c79ecd1..e6351cdeaa5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOff.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOff.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOff.il.net472.release.bsl index 16c7d7f10fd..df7f733a37d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOff.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOff.il.netcore.debug.bsl index 8d461cd2267..9472600867c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOff.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOff.il.netcore.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOff.il.netcore.release.bsl index dcdd02e7cb5..be5c1201b0e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOn.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOn.il.net472.debug.bsl index 646c1a4b962..e450def59e8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOn.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOn.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOn.il.net472.release.bsl index 8562e74afca..c3f0bec3919 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOn.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOn.il.netcore.debug.bsl index cdc87d07134..3c134f1c5a3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOn.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOn.il.netcore.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOn.il.netcore.release.bsl index 73438f4703a..ad760610cf5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule60.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.debug.bsl index b80313a9d48..53fbbd75170 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.release.bsl index 1a6d76fe566..89341a52b71 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.debug.bsl index abb4380636f..4ec3cddaa0f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl index 260a3e3b2b7..d6aa45e95c6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.debug.bsl index 9ebef9ba065..4155f4c8544 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.release.bsl index 805140d7920..6a2be5092bd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.debug.bsl index cc1c279a5d1..f4a29a64323 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl index 780a3194964..fd2a5d7a64b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOff.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOff.il.net472.debug.bsl index e82fbe637eb..9379fe34635 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOff.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOff.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOff.il.net472.release.bsl index 9185d1390a4..b460d189ccb 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOff.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOff.il.netcore.debug.bsl index 8631986f992..e15f1b11ea2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOff.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOff.il.netcore.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOff.il.netcore.release.bsl index 89cceafa9eb..fa0f108ba8b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOn.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOn.il.net472.debug.bsl index cc1c8fd2ee3..f956c9bf54b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOn.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOn.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOn.il.net472.release.bsl index a6fc399ca9a..e7100b3fecc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOn.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOn.il.netcore.debug.bsl index 96bd1d8d074..13910edf7cd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOn.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOn.il.netcore.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOn.il.netcore.release.bsl index 76db58211b5..bbfa8356656 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace60.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/LetBinding01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/LetBinding01.fs.RealInternalSignatureOff.il.bsl index 9cb8c02b684..4012f9953c7 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/LetBinding01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/LetBinding01.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/LetBinding01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/LetBinding01.fs.RealInternalSignatureOn.il.bsl index 5168ea5996e..c797288cf63 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/LetBinding01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/LetBinding01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Class01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Class01.fs.RealInternalSignatureOff.il.bsl index ca32e90a5c8..1b4647ebbcd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Class01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Class01.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Class01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Class01.fs.RealInternalSignatureOn.il.bsl index 0e57f39883d..fe26dc25be0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Class01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Class01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Module01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Module01.fs.RealInternalSignatureOff.il.bsl index 0bc91408516..847d8811569 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Module01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Module01.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Module01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Module01.fs.RealInternalSignatureOn.il.bsl index 870e8d0ba3d..c1cd33016df 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Module01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Module01.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOff.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOff.il.net472.debug.bsl index 84f5ee8cabc..21da5bf4e36 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOff.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOff.il.net472.debug.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOff.il.net472.release.bsl index 69f1f751870..72f0b5a628c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOff.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOff.il.netcore.debug.bsl index e796428b44a..11702812493 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOff.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOff.il.netcore.debug.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOff.il.netcore.release.bsl index 3e8ccc7efff..a4dd6705662 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOn.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOn.il.net472.debug.bsl index 554948cacf4..41998f6453e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOn.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOn.il.net472.debug.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOn.il.net472.release.bsl index 0e8d5587869..dae50007ab5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOn.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOn.il.netcore.debug.bsl index cdd468d2996..6a030062a54 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOn.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOn.il.netcore.debug.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOn.il.netcore.release.bsl index ab9182b9e71..ff0008f0544 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StaticInit/StaticInit_Struct01.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs.il.net472.debug.bsl index 8f02ce689c0..188fb410799 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs.il.net472.release.bsl index 8f02ce689c0..188fb410799 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs.il.netcore.debug.bsl index 2909178c115..cbd3ec12ec3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs.il.netcore.debug.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs.il.netcore.release.bsl index 2909178c115..cbd3ec12ec3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch01.fs.il.netcore.release.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs.il.net472.debug.bsl index e2a610308ba..9aa5c84591a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs.il.net472.release.bsl index e2a610308ba..9aa5c84591a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs.il.netcore.debug.bsl index 9524fa1ac49..f77a59b3dc4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs.il.netcore.debug.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs.il.netcore.release.bsl index 9524fa1ac49..f77a59b3dc4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch02.fs.il.netcore.release.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs.il.net472.debug.bsl index fdc5179c045..60864c9890f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs.il.net472.release.bsl index fdc5179c045..60864c9890f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs.il.netcore.debug.bsl index dfd5473e947..12dc5fbcbcc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs.il.netcore.debug.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs.il.netcore.release.bsl index dfd5473e947..12dc5fbcbcc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch03.fs.il.netcore.release.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs.il.net472.debug.bsl index 113137caaac..c25cd685a77 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs.il.net472.release.bsl index 113137caaac..c25cd685a77 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs.il.netcore.debug.bsl index f76ac71c89e..9d5dff25f57 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs.il.netcore.debug.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs.il.netcore.release.bsl index f76ac71c89e..9d5dff25f57 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch04.fs.il.netcore.release.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs.il.net472.debug.bsl index d87e2b9d1d3..cf4596795dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs.il.net472.release.bsl index d87e2b9d1d3..cf4596795dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs.il.netcore.debug.bsl index 1eff94ac8e0..e4aa7ccd2a6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs.il.netcore.debug.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs.il.netcore.release.bsl index 1eff94ac8e0..e4aa7ccd2a6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch05.fs.il.netcore.release.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs.il.net472.debug.bsl index d3655908f72..ecca9f45bf7 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs.il.net472.release.bsl index d3655908f72..ecca9f45bf7 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs.il.netcore.debug.bsl index 8b372ef39f1..d1252e23f91 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs.il.netcore.debug.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs.il.netcore.release.bsl index 6a5e70088ad..a692a8e5a6e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch06.fs.il.netcore.release.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs.il.net472.debug.bsl index 10c83501a14..9bd4d0ae249 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs.il.net472.release.bsl index 10c83501a14..9bd4d0ae249 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs.il.netcore.debug.bsl index d4084c0176f..25d98ac7423 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs.il.netcore.debug.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs.il.netcore.release.bsl index 12cac9d1c5b..9c124e3e23c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch07.fs.il.netcore.release.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch08.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch08.fs.il.bsl index 5c06a2958eb..db81da7bbc0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch08.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch08.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch09.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch09.fs.il.bsl index 3af12521001..ca1580136f7 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch09.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch09.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StringFormatAndInterpolation.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StringFormatAndInterpolation.fs index 3038460f577..38729fc70be 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StringFormatAndInterpolation.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StringFormatAndInterpolation.fs @@ -41,7 +41,6 @@ module StringFormatAndInterpolation let f (s: string) = $"ab{{s}}" """ - |> withLangVersionPreview |> compile |> shouldSucceed |> verifyIL [""" @@ -60,7 +59,6 @@ module StringFormatAndInterpolation let c = "c" let str = $"ab{{c}}d" """ - |> withLangVersionPreview |> compile |> shouldSucceed |> verifyIL [""" @@ -79,7 +77,6 @@ module StringFormatAndInterpolation let str () = {str} """ - |> withLangVersionPreview |> compile |> shouldSucceed |> verifyIL [""" @@ -91,4 +88,46 @@ IL_0014: call string [runtime]System.String::Concat(string, string, string, string) -IL_0019: ret"""] \ No newline at end of file +IL_0019: ret"""] + + [] + let ``Interpolated string with concat converts to span implicitly`` () = + let compilation = + FSharp $""" + module InterpolatedStringByefLikes + type Foo() = + + let sb = System.Text.StringBuilder() + + member _.Bar(s: System.ReadOnlySpan) = sb.Append(s) |> ignore + + let [] main _ = + let foo = Foo() + let foos = "foo" + foo.Bar($"{{foos}} is bar") + 0 + """ + + compilation |> compile |> shouldSucceed |> ignore + + compilation |> asExe |> compileAndRun |> shouldSucceed |> ignore + + compilation |> compile |> shouldSucceed |> verifyIL [""" +.locals init (class InterpolatedStringByefLikes/Foo V_0, + valuetype [runtime]System.ReadOnlySpan`1 V_1, + class [runtime]System.Text.StringBuilder V_2) +IL_0000: newobj instance void InterpolatedStringByefLikes/Foo::.ctor() +IL_0005: stloc.0 +IL_0006: ldstr "foo" +IL_000b: ldstr " is bar" +IL_0010: call string [runtime]System.String::Concat(string, + string) +IL_0015: call valuetype [runtime]System.ReadOnlySpan`1 [runtime]System.String::op_Implicit(string) +IL_001a: stloc.1 +IL_001b: ldloc.0 +IL_001c: ldfld class [runtime]System.Text.StringBuilder InterpolatedStringByefLikes/Foo::sb +IL_0021: ldloc.1 +IL_0022: callvirt instance class [runtime]System.Text.StringBuilder [runtime]System.Text.StringBuilder::Append(valuetype [runtime]System.ReadOnlySpan`1) +IL_0027: stloc.2 +IL_0028: ldc.i4.0 +IL_0029: ret"""] \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/CodeGenHelper.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/CodeGenHelper.fs index 400c02596f5..0c493f05c99 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/CodeGenHelper.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/CodeGenHelper.fs @@ -111,12 +111,12 @@ let notContainMember membName (ty : Type) = | null | [| |] -> () | _ -> failwithf "Error: Type %s does contain member %s" ty.Name membName -/// Has airity (number of arguments and types) +/// Has arity (number of arguments and types) let takeParams (args : Type list) (methInfo : MethodInfo) = let parameters = methInfo.GetParameters() if parameters.Length <> List.length args then failwithf - "Error: Method [%s] doesn't have expected airity. Method takes %d params, but expected %d" + "Error: Method [%s] doesn't have expected arity. Method takes %d params, but expected %d" methInfo.Name parameters.Length (List.length args) @@ -161,13 +161,13 @@ let useEventHandler eventHandlerType (eventInfo : EventInfo) = () /// Verify the object contains a custom attribute with the given name. E.g. "ObsoleteAttribute" -let haveAttribute attrName thingey = +let haveAttribute attrName thingy = let containsAttrWithName attrList = attrList |> Array.filter (fun att -> att.GetType().Name = attrName) |> Array.length > 0 let containsAttribute = - match box thingey with + match box thingy with | :? Type as ty -> ty.GetCustomAttributes(false) |> containsAttrWithName @@ -180,13 +180,13 @@ let haveAttribute attrName thingey = | :? EventInfo as ei -> ei.GetCustomAttributes(false) |> containsAttrWithName - | _ -> failwith "Error: Unsuported primitive type, unable to get custom attributes." + | _ -> failwith "Error: Unsupported primitive type, unable to get custom attributes." if not containsAttribute then failwithf "Error: Unable to locate attribute %s." attrName else () -/// Asserts a propety's return value +/// Asserts a property's return value let haveType ty (propInfo : PropertyInfo) = if propInfo.PropertyType <> ty then failwithf @@ -196,13 +196,13 @@ let haveType ty (propInfo : PropertyInfo) = () /// Verify the object does not contain any custom attributes. -let doesn'tHaveAttribute attrName thingey = +let doesn'tHaveAttribute attrName thingy = let doesn'tContainsAttrWithName attrList = attrList |> Array.filter (fun att -> att.GetType().Name = attrName) |> Array.length = 0 let containsAttribute = - match box thingey with + match box thingy with | :? Type as ty -> ty.GetCustomAttributes(false) |> doesn'tContainsAttrWithName @@ -215,7 +215,7 @@ let doesn'tHaveAttribute attrName thingey = | :? EventInfo as ei -> ei.GetCustomAttributes(false) |> doesn'tContainsAttrWithName - | _ -> failwith "Error: Unsuported primitive type, unable to get custom attributes." + | _ -> failwith "Error: Unsupported primitive type, unable to get custom attributes." if containsAttribute then failwithf "Error: Able to locate attribute %s, didn't expect to find." attrName else diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Events01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Events01.fs index 43d65356b8f..6f6080dcf15 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Events01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/Events01.fs @@ -13,13 +13,13 @@ namespace Test let channelChanged = new Event() let triggerChanelChanged channelNumber = channelChanged.Trigger(this, channelNumber) - // When TV constrcuted, fire chanel changed event. + // When TV constructed, fire channel changed event. do triggerChanelChanged(3) // Static event static let defaultChannelChanged = new Event() - // Setting the chanel will fire our event. + // Setting the channel will fire our event. member this.SetChanel (x : int) = triggerChanelChanged(x) // By adding the [] on a property of type IEvent<_> diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles_1.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles_1.fs.il.debug.bsl index 7dc6e9f4669..b43d7b05af3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles_1.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles_1.fs.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles_1.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles_1.fs.il.release.bsl index a3a5a7a3f40..904fec314fe 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles_1.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles_1.fs.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles_2.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles_2.fs.il.debug.bsl index 406289eb99c..3f2161634eb 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles_2.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles_2.fs.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles_2.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles_2.fs.il.release.bsl index cf1a77a5d39..ef7f734e3c3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles_2.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles_2.fs.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature01.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature01.fs index ecf714999d0..bde783887b1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature01.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature01.fs @@ -1,7 +1,7 @@ // #Regression #NoMT #CodeGen #Interop // Regression test for FSHARP1.0:4040 // "Signature files do not prevent compiler-generated public constructors from leaking out of discriminated unions" -// Note that the corresponsing .fsi file is missing the "| C of int" part of the DU +// Note that the corresponding .fsi file is missing the "| C of int" part of the DU #light namespace N diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature02.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature02.fs index 92daf21dfd1..eb9ab3f83b3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature02.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnionTypeWithSignature02.fs @@ -1,7 +1,7 @@ // #Regression #NoMT #CodeGen #Interop // Regression test for FSHARP1.0:4040 // "Signature files do not prevent compiler-generated public constructors from leaking out of discriminated unions" -// Note that the corresponsing .fsi file is NOT missing the "| C of int" part of the DU +// Note that the corresponding .fsi file is NOT missing the "| C of int" part of the DU module N type T = | C of int diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnitsOfMeasure03.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnitsOfMeasure03.fs index d307e7664c4..494e8a9a109 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnitsOfMeasure03.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/UnitsOfMeasure03.fs @@ -2,7 +2,7 @@ #light // Verify types which are generic WRT a unit of measure are exposed as -// standard .NET types (no funny buisness!) +// standard .NET types (no funny business!) namespace Test diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction01.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction01.fs.il.bsl index dfeed8a4c5c..552582d9eb6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction01.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction01.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction02.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction02.fs.il.bsl index 354f6e3c9ee..bf862d34890 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction02.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction02.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03.fs.il.net472.bsl index 051cf1d3402..dd6e6ab1b40 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03.fs.il.netcore.bsl index 051cf1d3402..dd6e6ab1b40 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03.fs.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03b.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03b.fs.il.bsl index d9698fe4c0a..6b0f2cd2642 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03b.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03b.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03c.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03c.fs.il.net472.bsl index 18273231059..0eeedf099d9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03c.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03c.fs.il.net472.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03c.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03c.fs.il.netcore.bsl index 7af10bf2e1e..bad4d474c98 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03c.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction03c.fs.il.netcore.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction04.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction04.fs.il.bsl index 7ae6643ba87..6b23f145de1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction04.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction04.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction05.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction05.fs.il.bsl index e716f264c81..2eb2f910b1d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction05.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction05.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction06.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction06.fs.il.bsl index b354b4896ef..50b0eb21ac2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction06.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction06.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction07.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction07.fs.il.bsl index d72904a097d..fef5a43d7f3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction07.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction07.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction08.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction08.fs.il.bsl index b80ed839da4..edc8c415691 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction08.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction08.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09.fs.il.bsl index 54f6d1f209a..365499f9908 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b.fs.il.bsl index 5a1a4974e55..d8e01b0c5c9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b1.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b1.fs.il.bsl index 5a1a4974e55..d8e01b0c5c9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b1.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b1.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b2.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b2.fs.il.bsl index 5a1a4974e55..d8e01b0c5c9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b2.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b2.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b3.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b3.fs.il.bsl index 5a1a4974e55..d8e01b0c5c9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b3.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b3.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b4_RealInternalSignatureOff.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b4_RealInternalSignatureOff.fs.il.bsl index e373a0d2fd7..9f7484aa1f8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b4_RealInternalSignatureOff.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b4_RealInternalSignatureOff.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b4_RealInternalSignatureOn.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b4_RealInternalSignatureOn.fs.il.bsl index c7cc5bdf8c7..56d60188bec 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b4_RealInternalSignatureOn.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction09b4_RealInternalSignatureOn.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction10.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction10.fs.il.bsl index 61cfd675de2..fe1541a43cb 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction10.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction10.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction11.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction11.fs.il.bsl index f866d6f9a0d..1a238cb8a86 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction11.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction11.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction12.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction12.fs.il.bsl index 678535c2fdd..00fa0bbb755 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction12.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction12.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction13.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction13.fs.il.bsl index 4f79a9924bf..c57bdfc70e3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction13.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction13.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction14.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction14.fs.il.bsl index cbb738eaee1..53d5c7bea83 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction14.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction14.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction15.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction15.fs.il.bsl index bbf55903771..cc02b97518f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction15.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction15.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs.il.net472.debug.bsl index ccd51773d86..23648ff4039 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs.il.net472.release.bsl index 2146b8d8ad8..5b839c54a31 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs.il.netcore.debug.bsl index 480d54bced1..32456c54432 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs.il.netcore.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs.il.netcore.release.bsl index d23ae91a650..cc686bf790e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction16.fs.il.netcore.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.net472.debug.bsl index 3b81f926bc9..7ac3e544a40 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.net472.release.bsl index de4b4ee9fc1..0ac93212d8e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.netcore.debug.bsl index 17656ef061f..a65cea31c60 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.netcore.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.netcore.release.bsl index 00ac158dd15..f73cfafb59f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction17.fs.il.netcore.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction18.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction18.fs.il.net472.bsl index fac7baff5fa..d9d01988146 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction18.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction18.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction18.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction18.fs.il.netcore.bsl index 36859bc0255..5ae41fb6039 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction18.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction18.fs.il.netcore.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction19.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction19.fs.il.bsl index 3afbe7aacae..026ef770b34 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction19.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction19.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction20.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction20.fs.il.bsl index c60d6ae59d0..f926ac566bb 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction20.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction20.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs.il.net472.debug.bsl index af28cbe94ec..f625cff222d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs.il.net472.release.bsl index f771fa470cc..0888fad4182 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs.il.netcore.debug.bsl index 0a5363e368a..115c16b843d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs.il.netcore.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs.il.netcore.release.bsl index 2dd7ced02b5..3bd40439b89 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction21.fs.il.netcore.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22_RealInternalSignatureOff.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22_RealInternalSignatureOff.fs.il.net472.bsl index dd1502c431a..b2910df4262 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22_RealInternalSignatureOff.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22_RealInternalSignatureOff.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22_RealInternalSignatureOff.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22_RealInternalSignatureOff.fs.il.netcore.bsl index 0d653675c47..4be84f3b9b0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22_RealInternalSignatureOff.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22_RealInternalSignatureOff.fs.il.netcore.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22_RealInternalSignatureOn.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22_RealInternalSignatureOn.fs.il.net472.bsl index c6a7bd32400..fa1b026f0ce 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22_RealInternalSignatureOn.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22_RealInternalSignatureOn.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22_RealInternalSignatureOn.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22_RealInternalSignatureOn.fs.il.netcore.bsl index cda3dec5378..df7927a467b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22_RealInternalSignatureOn.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22_RealInternalSignatureOn.fs.il.netcore.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b_RealInternalSignatureOff.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b_RealInternalSignatureOff.fs.il.net472.bsl index dd1502c431a..b2910df4262 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b_RealInternalSignatureOff.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b_RealInternalSignatureOff.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b_RealInternalSignatureOff.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b_RealInternalSignatureOff.fs.il.netcore.bsl index 0d653675c47..4be84f3b9b0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b_RealInternalSignatureOff.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b_RealInternalSignatureOff.fs.il.netcore.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b_RealInternalSignatureOn.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b_RealInternalSignatureOn.fs.il.net472.bsl index c6a7bd32400..fa1b026f0ce 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b_RealInternalSignatureOn.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b_RealInternalSignatureOn.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b_RealInternalSignatureOn.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b_RealInternalSignatureOn.fs.il.netcore.bsl index cda3dec5378..df7927a467b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b_RealInternalSignatureOn.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22b_RealInternalSignatureOn.fs.il.netcore.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c_RealInternalSignatureOff.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c_RealInternalSignatureOff.fs.il.net472.bsl index dd1502c431a..b2910df4262 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c_RealInternalSignatureOff.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c_RealInternalSignatureOff.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c_RealInternalSignatureOff.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c_RealInternalSignatureOff.fs.il.netcore.bsl index 0d653675c47..4be84f3b9b0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c_RealInternalSignatureOff.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c_RealInternalSignatureOff.fs.il.netcore.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c_RealInternalSignatureOn.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c_RealInternalSignatureOn.fs.il.net472.bsl index c6a7bd32400..fa1b026f0ce 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c_RealInternalSignatureOn.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c_RealInternalSignatureOn.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c_RealInternalSignatureOn.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c_RealInternalSignatureOn.fs.il.netcore.bsl index cda3dec5378..df7927a467b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c_RealInternalSignatureOn.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22c_RealInternalSignatureOn.fs.il.netcore.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d_RealInternalSignatureOff.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d_RealInternalSignatureOff.fs.il.net472.bsl index dd1502c431a..b2910df4262 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d_RealInternalSignatureOff.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d_RealInternalSignatureOff.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d_RealInternalSignatureOff.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d_RealInternalSignatureOff.fs.il.netcore.bsl index 0d653675c47..4be84f3b9b0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d_RealInternalSignatureOff.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d_RealInternalSignatureOff.fs.il.netcore.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d_RealInternalSignatureOn.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d_RealInternalSignatureOn.fs.il.net472.bsl index c6a7bd32400..fa1b026f0ce 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d_RealInternalSignatureOn.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d_RealInternalSignatureOn.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d_RealInternalSignatureOn.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d_RealInternalSignatureOn.fs.il.netcore.bsl index cda3dec5378..df7927a467b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d_RealInternalSignatureOn.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22d_RealInternalSignatureOn.fs.il.netcore.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e_RealInternalSignatureOff.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e_RealInternalSignatureOff.fs.il.net472.bsl index 7f4920da53b..f8c01645b6c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e_RealInternalSignatureOff.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e_RealInternalSignatureOff.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e_RealInternalSignatureOff.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e_RealInternalSignatureOff.fs.il.netcore.bsl index 86bb3d47aab..b3c737c5df4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e_RealInternalSignatureOff.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e_RealInternalSignatureOff.fs.il.netcore.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e_RealInternalSignatureOn.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e_RealInternalSignatureOn.fs.il.net472.bsl index 8570fbc7b34..b3fb90a5c79 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e_RealInternalSignatureOn.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e_RealInternalSignatureOn.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e_RealInternalSignatureOn.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e_RealInternalSignatureOn.fs.il.netcore.bsl index f9537f15400..965581a344c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e_RealInternalSignatureOn.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22e_RealInternalSignatureOn.fs.il.netcore.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOff.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOff.fs.il.net472.bsl index 9e984a05340..464ddb746fa 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOff.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOff.fs.il.net472.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOff.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOff.fs.il.netcore.bsl index 21305bb0d17..ef0c2030d4a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOff.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOff.fs.il.netcore.bsl @@ -23,12 +23,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOn.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOn.fs.il.bsl index f12cd199eda..d40d4a5eaec 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOn.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOn.fs.il.bsl @@ -23,12 +23,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOn.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOn.fs.il.net472.bsl index 9fd9de44081..ce4c7364035 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOn.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOn.fs.il.net472.bsl @@ -22,12 +22,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOn.fs.il.netcore .bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOn.fs.il.netcore .bsl index 21305bb0d17..ef0c2030d4a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOn.fs.il.netcore .bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22f_RealInternalSignatureOn.fs.il.netcore .bsl @@ -23,12 +23,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g_RealInternalSignatureOff.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g_RealInternalSignatureOff.fs.il.net472.bsl index daaa7237034..b5d6157072c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g_RealInternalSignatureOff.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g_RealInternalSignatureOff.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g_RealInternalSignatureOff.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g_RealInternalSignatureOff.fs.il.netcore.bsl index d0344ac4e5b..be3321156ef 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g_RealInternalSignatureOff.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g_RealInternalSignatureOff.fs.il.netcore.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g_RealInternalSignatureOn.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g_RealInternalSignatureOn.fs.il.net472.bsl index a3b4e309f53..10bc3020434 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g_RealInternalSignatureOn.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g_RealInternalSignatureOn.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g_RealInternalSignatureOn.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g_RealInternalSignatureOn.fs.il.netcore.bsl index 986cc4ca1ce..034610cf4a5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g_RealInternalSignatureOn.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22g_RealInternalSignatureOn.fs.il.netcore.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOff.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOff.fs.il.net472.bsl index c8c4283bcf3..43e2de4d4aa 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOff.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOff.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOff.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOff.fs.il.netcore.bsl index 090680b761b..1bc97bec0a1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOff.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOff.fs.il.netcore.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOn.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOn.fs.il.bsl index 090680b761b..1bc97bec0a1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOn.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOn.fs.il.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOn.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOn.fs.il.net472.bsl index c8c4283bcf3..43e2de4d4aa 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOn.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOn.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOn.fs.il.netcore .bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOn.fs.il.netcore .bsl index 090680b761b..1bc97bec0a1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOn.fs.il.netcore .bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction22h_RealInternalSignatureOn.fs.il.netcore .bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs.il.net472.bsl index 56028d8bfa8..3f4c324d6dd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs.il.netcore.bsl index fdf0e4f7d8d..9f1ef581c16 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs.il.netcore.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.net472.debug.bsl index dd2dbdc0d1c..d7f985f6888 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.net472.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.net472.release.bsl index 26e89ee1cb4..2e425f74278 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.net472.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.netcore.debug.bsl index 9ac0210240f..8de09a8c9d9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.netcore.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.netcore.release.bsl index b4fe4bf6b35..896ab224ac8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction24.fs.il.netcore.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043_RealInternalSignatureOff.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043_RealInternalSignatureOff.fs.il.debug.bsl index 179b6da5425..f6fd1e69d10 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043_RealInternalSignatureOff.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043_RealInternalSignatureOff.fs.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043_RealInternalSignatureOff.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043_RealInternalSignatureOff.fs.il.release.bsl index 179b6da5425..f6fd1e69d10 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043_RealInternalSignatureOff.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043_RealInternalSignatureOff.fs.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043_RealInternalSignatureOn.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043_RealInternalSignatureOn.fs.il.debug.bsl index 0862fa8c6f5..ffb2898dcf8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043_RealInternalSignatureOn.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043_RealInternalSignatureOn.fs.il.debug.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043_RealInternalSignatureOn.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043_RealInternalSignatureOn.fs.il.release.bsl index 0862fa8c6f5..ffb2898dcf8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043_RealInternalSignatureOn.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043_RealInternalSignatureOn.fs.il.release.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/ActivePatternRecoverableException.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/ActivePatternRecoverableException.fs new file mode 100644 index 00000000000..5d0c9febad7 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/ActivePatternRecoverableException.fs @@ -0,0 +1,16 @@ +module ActivePatternTestCase + +open System + +[] +let (|RecoverableException|_|) (exn: Exception) = + match exn with + | :? OperationCanceledException -> ValueNone + | _ -> + ValueSome exn + +let addWithActivePattern (a:int) (b:int) = + try + a / b + with + | RecoverableException e -> a + b \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/ActivePatternRecoverableException.fs.generateFilterBlocks.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/ActivePatternRecoverableException.fs.generateFilterBlocks.il.bsl new file mode 100644 index 00000000000..170695eb40f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/ActivePatternRecoverableException.fs.generateFilterBlocks.il.bsl @@ -0,0 +1,146 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed ActivePatternTestCase + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public specialname static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1 '|RecoverableException|_|'(class [runtime]System.Exception exn) cil managed + { + .param [0] + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 3 + .locals init (class [runtime]System.Exception V_0, + class [runtime]System.OperationCanceledException V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: isinst [runtime]System.OperationCanceledException + IL_0008: stloc.1 + IL_0009: ldloc.1 + IL_000a: brfalse.s IL_0012 + + IL_000c: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1::get_ValueNone() + IL_0011: ret + + IL_0012: ldarg.0 + IL_0013: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1::NewValueSome(!0) + IL_0018: ret + } + + .method public static int32 addWithActivePattern(int32 a, + int32 b) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (int32 V_0, + class [runtime]System.Exception V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1 V_2, + class [runtime]System.Exception V_3, + class [runtime]System.Exception V_4, + valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1 V_5, + class [runtime]System.Exception V_6) + .try + { + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: div + IL_0003: stloc.0 + IL_0004: leave.s IL_005f + + } + filter + { + IL_0006: castclass [runtime]System.Exception + IL_000b: stloc.1 + IL_000c: ldloc.1 + IL_000d: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1 ActivePatternTestCase::'|RecoverableException|_|'(class [runtime]System.Exception) + IL_0012: stloc.2 + IL_0013: ldloca.s V_2 + IL_0015: call instance int32 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1::get_Tag() + IL_001a: ldc.i4.1 + IL_001b: bne.un.s IL_0028 + + IL_001d: ldloca.s V_2 + IL_001f: call instance !0 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1::get_Item() + IL_0024: stloc.3 + IL_0025: ldc.i4.1 + IL_0026: br.s IL_0029 + + IL_0028: ldc.i4.0 + IL_0029: endfilter + } + { + IL_002b: castclass [runtime]System.Exception + IL_0030: stloc.s V_4 + IL_0032: ldloc.s V_4 + IL_0034: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1 ActivePatternTestCase::'|RecoverableException|_|'(class [runtime]System.Exception) + IL_0039: stloc.s V_5 + IL_003b: ldloca.s V_5 + IL_003d: call instance int32 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1::get_Tag() + IL_0042: ldc.i4.1 + IL_0043: bne.un.s IL_0054 + + IL_0045: ldloca.s V_5 + IL_0047: call instance !0 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1::get_Item() + IL_004c: stloc.s V_6 + IL_004e: ldarg.0 + IL_004f: ldarg.1 + IL_0050: add + IL_0051: stloc.0 + IL_0052: leave.s IL_005f + + IL_0054: rethrow + IL_0056: ldnull + IL_0057: unbox.any [runtime]System.Int32 + IL_005c: stloc.0 + IL_005d: leave.s IL_005f + + } + IL_005f: ldloc.0 + IL_0060: ret + } + +} + +.class private abstract auto ansi sealed ''.$ActivePatternTestCase + extends [runtime]System.Object +{ + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/ActivePatternRecoverableException.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/ActivePatternRecoverableException.fs.il.bsl new file mode 100644 index 00000000000..3dd52e246c0 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/ActivePatternRecoverableException.fs.il.bsl @@ -0,0 +1,123 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed ActivePatternTestCase + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public specialname static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1 '|RecoverableException|_|'(class [runtime]System.Exception exn) cil managed + { + .param [0] + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 3 + .locals init (class [runtime]System.Exception V_0, + class [runtime]System.OperationCanceledException V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: isinst [runtime]System.OperationCanceledException + IL_0008: stloc.1 + IL_0009: ldloc.1 + IL_000a: brfalse.s IL_0012 + + IL_000c: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1::get_ValueNone() + IL_0011: ret + + IL_0012: ldarg.0 + IL_0013: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1::NewValueSome(!0) + IL_0018: ret + } + + .method public static int32 addWithActivePattern(int32 a, + int32 b) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (int32 V_0, + class [runtime]System.Exception V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1 V_2, + class [runtime]System.Exception V_3) + .try + { + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: div + IL_0003: stloc.0 + IL_0004: leave.s IL_0036 + + } + catch [runtime]System.Object + { + IL_0006: castclass [runtime]System.Exception + IL_000b: stloc.1 + IL_000c: ldloc.1 + IL_000d: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1 ActivePatternTestCase::'|RecoverableException|_|'(class [runtime]System.Exception) + IL_0012: stloc.2 + IL_0013: ldloca.s V_2 + IL_0015: call instance int32 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1::get_Tag() + IL_001a: ldc.i4.1 + IL_001b: bne.un.s IL_002b + + IL_001d: ldloca.s V_2 + IL_001f: call instance !0 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpValueOption`1::get_Item() + IL_0024: stloc.3 + IL_0025: ldarg.0 + IL_0026: ldarg.1 + IL_0027: add + IL_0028: stloc.0 + IL_0029: leave.s IL_0036 + + IL_002b: rethrow + IL_002d: ldnull + IL_002e: unbox.any [runtime]System.Int32 + IL_0033: stloc.0 + IL_0034: leave.s IL_0036 + + } + IL_0036: ldloc.0 + IL_0037: ret + } + +} + +.class private abstract auto ansi sealed ''.$ActivePatternTestCase + extends [runtime]System.Object +{ + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/StackOverflowRepro.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/StackOverflowRepro.fs new file mode 100644 index 00000000000..310a6615aba --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/StackOverflowRepro.fs @@ -0,0 +1,34 @@ +module StackOverflowRepro +open System + +[] +let (|RecoverableException|_|) (exn: Exception) = + match exn with + | :? OperationCanceledException -> ValueNone + | _ -> + ValueSome exn + +let rec viaActivePattern (a:int) = + try + if a = 0 + then + raise (OperationCanceledException()) + else + viaActivePattern (a - 1) + with + | RecoverableException e -> + let x = struct(a,a,a,a) + let y = struct(x,a,x) + y.GetHashCode() + e.GetHashCode() + + + +[] +let main (args:string[]) = + let iterations = 4096 + try + viaActivePattern iterations + with + | ex -> + printf "%s" (ex.GetType().ToString()) + 0 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/TryCatch.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/TryCatch.fs new file mode 100644 index 00000000000..9a43d34d429 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/TryCatch.fs @@ -0,0 +1,74 @@ +module EmittedIL.TryCatch + +open System.IO +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + + +let setupCompilation compilation = + compilation + |> withOptions [ "--test:EmitFeeFeeAs100001" ] + |> withNoWarn 75 //The command-line option '--generate-filter-blocks' has been deprecated + |> withNoWarn 52 //The value has been copied to ensure the original is not mutated + |> asExe + |> withNoOptimize + |> withNoInterfaceData + |> withNoOptimizationData + |> withNoDebug + |> ignoreWarnings + +let verifyCompilation compilation = + setupCompilation compilation + |> verifyILBaseline + +[] +let ``TryCatch with active pattern`` compilation = + compilation + |> verifyCompilation + +[] +let ``TryCatch with active pattern and filter blocks switch`` compilation = + compilation + |> withOptions ["--generate-filter-blocks"] + |> verifyCompilation + +[] +let ``TryCatch with explicit guard`` compilation = + compilation + |> verifyCompilation + +[] +let ``TryCatch with explicit guard and filter blocks switch`` compilation = + compilation + |> withOptions ["--generate-filter-blocks"] + |> verifyCompilation + + +[] +let ``Stackoverflow reproduction`` compilation = + let compilationResult = + compilation + |> setupCompilation + // I cannot just `compileAndRun` this in process now, because it will crash entire test host. + |> compile + match compilationResult with + | CompilationResult.Success ({OutputPath = Some dllFile} as s) -> + let fsharpCoreFile = typeof>.Assembly.Location + File.Copy(fsharpCoreFile, Path.Combine(Path.GetDirectoryName(dllFile), Path.GetFileName(fsharpCoreFile)), true) + let exitCode, _stdout, _stderr = CompilerAssert.ExecuteAndReturnResult (dllFile, isFsx=false, deps = s.Dependencies, newProcess=true) + + Assert.NotEqual(0,exitCode) + + | _ -> failwith (sprintf "%A" compilationResult) + +[] +let ``Stackoverflow prevention`` compilation = + compilation + |> setupCompilation + |> withOptions ["--generate-filter-blocks"] + |> compileAndRun + |> shouldSucceed + |> verifyOutput "System.OperationCanceledException" + + \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/TryWithExplicitGuard.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/TryWithExplicitGuard.fs new file mode 100644 index 00000000000..24c975312bc --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/TryWithExplicitGuard.fs @@ -0,0 +1,9 @@ +module ExplicitGuardCase + +open System + +let addWithExplicitGuardInWithClause (a:int) (b:int) = + try + a / b + with + | anyOther when anyOther.GetType() <> typeof -> a + b \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/TryWithExplicitGuard.fs.generateFilterBlocks.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/TryWithExplicitGuard.fs.generateFilterBlocks.il.bsl new file mode 100644 index 00000000000..9b04438a731 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/TryWithExplicitGuard.fs.generateFilterBlocks.il.bsl @@ -0,0 +1,145 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern netstandard +{ + .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) + .ver 2:1:0:0 +} +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed ExplicitGuardCase + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public static int32 addWithExplicitGuardInWithClause(int32 a, + int32 b) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (int32 V_0, + class [runtime]System.Exception V_1, + class [runtime]System.Exception V_2, + class [runtime]System.Type V_3, + class [runtime]System.Type V_4, + class [runtime]System.Exception V_5, + class [runtime]System.Exception V_6, + class [runtime]System.Exception V_7, + class [runtime]System.Type V_8, + class [runtime]System.Type V_9, + class [runtime]System.Exception V_10) + .try + { + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: div + IL_0003: stloc.0 + IL_0004: leave IL_007d + + } + filter + { + IL_0009: castclass [runtime]System.Exception + IL_000e: stloc.1 + IL_000f: ldloc.1 + IL_0010: stloc.2 + IL_0011: ldloc.2 + IL_0012: callvirt instance class [runtime]System.Type [runtime]System.Exception::GetType() + IL_0017: stloc.3 + IL_0018: ldtoken [runtime]System.OperationCanceledException + IL_001d: call class [netstandard]System.Type [netstandard]System.Type::GetTypeFromHandle(valuetype [netstandard]System.RuntimeTypeHandle) + IL_0022: stloc.s V_4 + IL_0024: ldloc.3 + IL_0025: ldloc.s V_4 + IL_0027: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityIntrinsic(!!0, + !!0) + IL_002c: ldc.i4.0 + IL_002d: ceq + IL_002f: brfalse.s IL_0037 + + IL_0031: ldloc.1 + IL_0032: stloc.s V_5 + IL_0034: ldc.i4.1 + IL_0035: br.s IL_0038 + + IL_0037: ldc.i4.0 + IL_0038: endfilter + } + { + IL_003a: castclass [runtime]System.Exception + IL_003f: stloc.s V_6 + IL_0041: ldloc.s V_6 + IL_0043: stloc.s V_7 + IL_0045: ldloc.s V_7 + IL_0047: callvirt instance class [runtime]System.Type [runtime]System.Exception::GetType() + IL_004c: stloc.s V_8 + IL_004e: ldtoken [runtime]System.OperationCanceledException + IL_0053: call class [netstandard]System.Type [netstandard]System.Type::GetTypeFromHandle(valuetype [netstandard]System.RuntimeTypeHandle) + IL_0058: stloc.s V_9 + IL_005a: ldloc.s V_8 + IL_005c: ldloc.s V_9 + IL_005e: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityIntrinsic(!!0, + !!0) + IL_0063: ldc.i4.0 + IL_0064: ceq + IL_0066: brfalse.s IL_0072 + + IL_0068: ldloc.s V_6 + IL_006a: stloc.s V_10 + IL_006c: ldarg.0 + IL_006d: ldarg.1 + IL_006e: add + IL_006f: stloc.0 + IL_0070: leave.s IL_007d + + IL_0072: rethrow + IL_0074: ldnull + IL_0075: unbox.any [runtime]System.Int32 + IL_007a: stloc.0 + IL_007b: leave.s IL_007d + + } + IL_007d: ldloc.0 + IL_007e: ret + } + +} + +.class private abstract auto ansi sealed ''.$ExplicitGuardCase + extends [runtime]System.Object +{ + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/TryWithExplicitGuard.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/TryWithExplicitGuard.fs.il.bsl new file mode 100644 index 00000000000..7aff9be8c6a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TryCatch/TryWithExplicitGuard.fs.il.bsl @@ -0,0 +1,113 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern netstandard +{ + .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) + .ver 2:1:0:0 +} +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed ExplicitGuardCase + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public static int32 addWithExplicitGuardInWithClause(int32 a, + int32 b) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (int32 V_0, + class [runtime]System.Exception V_1, + class [runtime]System.Exception V_2, + class [runtime]System.Type V_3, + class [runtime]System.Type V_4, + class [runtime]System.Exception V_5) + .try + { + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: div + IL_0003: stloc.0 + IL_0004: leave.s IL_0042 + + } + catch [runtime]System.Object + { + IL_0006: castclass [runtime]System.Exception + IL_000b: stloc.1 + IL_000c: ldloc.1 + IL_000d: stloc.2 + IL_000e: ldloc.2 + IL_000f: callvirt instance class [runtime]System.Type [runtime]System.Exception::GetType() + IL_0014: stloc.3 + IL_0015: ldtoken [runtime]System.OperationCanceledException + IL_001a: call class [netstandard]System.Type [netstandard]System.Type::GetTypeFromHandle(valuetype [netstandard]System.RuntimeTypeHandle) + IL_001f: stloc.s V_4 + IL_0021: ldloc.3 + IL_0022: ldloc.s V_4 + IL_0024: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityIntrinsic(!!0, + !!0) + IL_0029: ldc.i4.0 + IL_002a: ceq + IL_002c: brfalse.s IL_0037 + + IL_002e: ldloc.1 + IL_002f: stloc.s V_5 + IL_0031: ldarg.0 + IL_0032: ldarg.1 + IL_0033: add + IL_0034: stloc.0 + IL_0035: leave.s IL_0042 + + IL_0037: rethrow + IL_0039: ldnull + IL_003a: unbox.any [runtime]System.Int32 + IL_003f: stloc.0 + IL_0040: leave.s IL_0042 + + } + IL_0042: ldloc.0 + IL_0043: ret + } + +} + +.class private abstract auto ansi sealed ''.$ExplicitGuardCase + extends [runtime]System.Object +{ + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TupleElimination.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TupleElimination.fs index 5c77f15f552..f01f31797de 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TupleElimination.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TupleElimination.fs @@ -7,6 +7,12 @@ open FSharp.Test.Compiler module ``TupleElimination`` = + + let compile cu = + cu + |> withCheckNulls + |> compile + [] let ``Sequence expressions with potential side effects do not prevent tuple elimination``() = FSharp """ @@ -90,12 +96,12 @@ public static Tuple v() valuetype [runtime]System.DateTime V_1, int32 V_2) IL_0000: ldstr "" - IL_0005: callvirt instance string [runtime]System.Object::ToString() + IL_0005: callvirt instance string [runtime]System.String::ToString() IL_000a: stloc.0 IL_000b: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() IL_0010: stloc.1 IL_0011: ldstr "3" - IL_0016: callvirt instance string [runtime]System.Object::ToString() + IL_0016: callvirt instance string [runtime]System.String::ToString() IL_001b: stloc.0 IL_001c: call int32 TupleElimination::f() IL_0021: stloc.2 @@ -133,12 +139,12 @@ public static int w() int32 V_2, class [runtime]System.Tuple`2 V_3) IL_0000: ldstr "" - IL_0005: callvirt instance string [runtime]System.Object::ToString() + IL_0005: callvirt instance string [runtime]System.String::ToString() IL_000a: stloc.0 IL_000b: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() IL_0010: stloc.1 IL_0011: ldstr "3" - IL_0016: callvirt instance string [runtime]System.Object::ToString() + IL_0016: callvirt instance string [runtime]System.String::ToString() IL_001b: stloc.0 IL_001c: call int32 TupleElimination::f() IL_0021: stloc.2 @@ -179,12 +185,12 @@ public static int x() valuetype [runtime]System.DateTime V_1, int32 V_2) IL_0000: ldstr "" - IL_0005: callvirt instance string [runtime]System.Object::ToString() + IL_0005: callvirt instance string [runtime]System.String::ToString() IL_000a: stloc.0 IL_000b: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() IL_0010: stloc.1 IL_0011: ldstr "3" - IL_0016: callvirt instance string [runtime]System.Object::ToString() + IL_0016: callvirt instance string [runtime]System.String::ToString() IL_001b: stloc.0 IL_001c: call int32 TupleElimination::f() IL_0021: stloc.2 @@ -347,12 +353,12 @@ public static int z() int32 V_3, int32 V_4) IL_0000: ldstr "" - IL_0005: callvirt instance string [runtime]System.Object::ToString() + IL_0005: callvirt instance string [runtime]System.String::ToString() IL_000a: stloc.1 IL_000b: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() IL_0010: stloc.2 IL_0011: ldstr "3" - IL_0016: callvirt instance string [runtime]System.Object::ToString() + IL_0016: callvirt instance string [runtime]System.String::ToString() IL_001b: stloc.1 IL_001c: ldc.i4.2 IL_001d: call int32 TupleElimination::f() @@ -574,7 +580,7 @@ public static int y() IL_000b: brfalse.s IL_0027 IL_000d: ldstr "" - IL_0012: callvirt instance string [runtime]System.Object::ToString() + IL_0012: callvirt instance string [runtime]System.String::ToString() IL_0017: stloc.3 IL_0018: ldc.i4.1 IL_0019: stloc.0 @@ -621,7 +627,7 @@ public static int y() IL_005a: br.s IL_0095 IL_005c: ldstr "" - IL_0061: callvirt instance string [runtime]System.Object::ToString() + IL_0061: callvirt instance string [runtime]System.String::ToString() IL_0066: stloc.3 IL_0067: ldc.i4.6 IL_0068: stloc.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.il.net472.bsl index d770a4062e1..1db5018d510 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.il.netcore.bsl index 3a392760e0c..845bf348e8d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.il.netcore.bsl @@ -8,7 +8,7 @@ .assembly extern System.Collections { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 + .ver 9:0:0:0 } .assembly assembly { @@ -21,16 +21,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -52,8 +42,7 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) - .method public specialname rtspecialname - instance void .ctor() cil managed + .method public specialname rtspecialname instance void .ctor() cil managed { .maxstack 8 @@ -70,8 +59,7 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) - .method public specialname rtspecialname - instance void .ctor() cil managed + .method public specialname rtspecialname instance void .ctor() cil managed { .maxstack 8 @@ -193,8 +181,7 @@ } - .method public static class [System.Collections]System.Collections.Generic.List`1 - test() cil managed + .method public static class [System.Collections]System.Collections.Generic.List`1 test() cil managed { .maxstack 4 @@ -295,8 +282,7 @@ IL_007c: ret } - .method public static class [System.Collections]System.Collections.Generic.List`1 - test2() cil managed + .method public static class [System.Collections]System.Collections.Generic.List`1 test2() cil managed { .maxstack 4 @@ -398,8 +384,7 @@ IL_0085: ret } - .method public static class [System.Collections]System.Collections.Generic.List`1 - test3() cil managed + .method public static class [System.Collections]System.Collections.Generic.List`1 test3() cil managed { .maxstack 4 @@ -501,8 +486,7 @@ IL_0085: ret } - .method public static class [System.Collections]System.Collections.Generic.List`1 - test4() cil managed + .method public static class [System.Collections]System.Collections.Generic.List`1 test4() cil managed { .maxstack 4 @@ -619,3 +603,8 @@ } } + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.il.bsl index a12fad746cd..7433327ae66 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple02.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple02.fs.RealInternalSignatureOff.il.bsl index fe636d27a61..de6f7e0e3f2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple02.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple02.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple02.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple02.fs.RealInternalSignatureOn.il.bsl index e7bdf60e87e..0306a15c6e4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple02.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple02.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple03.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple03.fs.RealInternalSignatureOff.il.bsl index 9a7611c6827..dc6e6ceef95 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple03.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple03.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple03.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple03.fs.RealInternalSignatureOn.il.bsl index 7bdcae4a84d..0ad423277c7 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple03.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple03.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple04.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple04.fs.RealInternalSignatureOff.il.bsl index 8b9214cb821..f57b65802ae 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple04.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple04.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple04.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple04.fs.RealInternalSignatureOn.il.bsl index 671936095f5..93f1ebd204c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple04.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple04.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple05.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple05.fs.RealInternalSignatureOff.il.bsl index a44f0a90b44..2dc0208be6b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple05.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple05.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple05.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple05.fs.RealInternalSignatureOn.il.bsl index 5a0849a78f9..52c31f6ef25 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple05.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple05.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple06.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple06.fs.RealInternalSignatureOff.il.bsl index aa6257c90e9..5d53d53b6dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple06.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple06.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple06.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple06.fs.RealInternalSignatureOn.il.bsl index e38d6e0191d..121a095fb13 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple06.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple06.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple07.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple07.fs.RealInternalSignatureOff.il.bsl index 9e613dee26c..ed0e05fc5f5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple07.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple07.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple07.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple07.fs.RealInternalSignatureOn.il.bsl index 52c6b120eee..be50bf32f0d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple07.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple07.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple08.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple08.fs.RealInternalSignatureOff.il.bsl index 08630f0e735..4063eed9fd2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple08.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple08.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple08.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple08.fs.RealInternalSignatureOn.il.bsl index b49b131d3d7..abb1ff5f7b5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple08.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple08.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleElimination.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleElimination.fs.il.net472.bsl index 232c542e085..64bd16e51fa 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleElimination.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleElimination.fs.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleElimination.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleElimination.fs.il.netcore.bsl index e78d74b07c4..f5931c2d000 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleElimination.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleElimination.fs.il.netcore.bsl @@ -8,7 +8,7 @@ .assembly extern System.Collections { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 + .ver 9:0:0:0 } .assembly assembly { @@ -21,16 +21,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.exe @@ -52,8 +42,7 @@ extends [FSharp.Core]Microsoft.FSharp.Core.FSharpTypeFunc { .field static assembly initonly class assembly/p@5 @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -66,8 +55,7 @@ IL_0006: ret } - .method public strict virtual instance object - Specialize() cil managed + .method public strict virtual instance object Specialize() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -79,8 +67,7 @@ IL_000b: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -100,8 +87,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class assembly/p@5 self0@) cil managed + .method assembly specialname rtspecialname instance void .ctor(class assembly/p@5 self0@) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -115,8 +101,7 @@ IL_000d: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.Unit - Invoke(!a v) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.Unit Invoke(!a v) cil managed { .maxstack 7 @@ -242,3 +227,8 @@ extends [runtime]System.Object { } + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleMonster.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleMonster.fs.RealInternalSignatureOff.il.bsl index f273edd3460..616e67301a7 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleMonster.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleMonster.fs.RealInternalSignatureOff.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleMonster.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleMonster.fs.RealInternalSignatureOn.il.bsl index 6bea3250fef..ad430525001 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleMonster.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/TupleMonster.fs.RealInternalSignatureOn.il.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuples.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuples.fs index e72af2b7caf..fc7aa7b8a4e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuples.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuples.fs @@ -114,7 +114,7 @@ module Tuples = |> withRealInternalSignatureOff |> verifyCompilation - // SOURCE=OptionalArg01.fs SCFLAGS="-g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd OptionalArg01.exe" # OptionalArg01.fs - test optimizatons + // SOURCE=OptionalArg01.fs SCFLAGS="-g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd OptionalArg01.exe" # OptionalArg01.fs - test optimizations [] let ``OptionalArg01_fs`` compilation = compilation diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/ValueTupleAliasConstructor.fs.RealInternalSignatureOff.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/ValueTupleAliasConstructor.fs.RealInternalSignatureOff.il.net472.bsl index 3bb7400fae1..29c78f33d95 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/ValueTupleAliasConstructor.fs.RealInternalSignatureOff.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/ValueTupleAliasConstructor.fs.RealInternalSignatureOff.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/ValueTupleAliasConstructor.fs.RealInternalSignatureOff.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/ValueTupleAliasConstructor.fs.RealInternalSignatureOff.il.netcore.bsl index e68f4dc0113..588406b439c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/ValueTupleAliasConstructor.fs.RealInternalSignatureOff.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/ValueTupleAliasConstructor.fs.RealInternalSignatureOff.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/ValueTupleAliasConstructor.fs.RealInternalSignatureOn.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/ValueTupleAliasConstructor.fs.RealInternalSignatureOn.il.net472.bsl index 45dfb455378..23ddd021e61 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/ValueTupleAliasConstructor.fs.RealInternalSignatureOn.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/ValueTupleAliasConstructor.fs.RealInternalSignatureOn.il.net472.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/ValueTupleAliasConstructor.fs.RealInternalSignatureOn.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/ValueTupleAliasConstructor.fs.RealInternalSignatureOn.il.netcore.bsl index e9fe8f2e458..ebf33ef9cee 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/ValueTupleAliasConstructor.fs.RealInternalSignatureOn.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/ValueTupleAliasConstructor.fs.RealInternalSignatureOn.il.netcore.bsl @@ -17,12 +17,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOff.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOff.fs.il.net472.debug.bsl index e99df0be6b9..9e27b34c290 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOff.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOff.fs.il.net472.debug.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOff.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOff.fs.il.net472.release.bsl index e99df0be6b9..9e27b34c290 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOff.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOff.fs.il.net472.release.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOff.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOff.fs.il.netcore.debug.bsl index 4a3db2bbbcb..cccb0f3431a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOff.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOff.fs.il.netcore.debug.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOff.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOff.fs.il.netcore.release.bsl index 4a3db2bbbcb..cccb0f3431a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOff.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOff.fs.il.netcore.release.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOn.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOn.fs.il.net472.debug.bsl index e845b923b38..80ec0a5a81b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOn.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOn.fs.il.net472.debug.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOn.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOn.fs.il.net472.release.bsl index e845b923b38..80ec0a5a81b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOn.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOn.fs.il.net472.release.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOn.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOn.fs.il.netcore.debug.bsl index 71cfc585372..9de0631aca0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOn.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOn.fs.il.netcore.debug.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOn.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOn.fs.il.netcore.release.bsl index 71cfc585372..9de0631aca0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOn.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/operators/decimal_comparison_RealInternalSignatureOn.fs.il.netcore.release.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ActivePatternArgCountMismatchTest.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ActivePatternArgCountMismatchTest.fs index e2a988ec0c3..8c2133721d2 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ActivePatternArgCountMismatchTest.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ActivePatternArgCountMismatchTest.fs @@ -18,7 +18,6 @@ module TooFew = let (|P|) (expr2 : int) (expr1 : int) = P match 1 with P -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -31,7 +30,6 @@ match 1 with P -> () let (|P|_|) (expr2 : int) (expr1 : int) = if expr1 = expr2 then Some P else None match 1 with P -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -44,7 +42,6 @@ match 1 with P -> () let (|P|_|) (expr2 : int) (expr1 : int) = if expr1 = expr2 then ValueSome P else ValueNone match 1 with P -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -57,7 +54,6 @@ match 1 with P -> () let (|P|Q|) (expr2 : int) (expr1 : int) = if expr1 = expr2 then P else Q match 1 with P -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -70,7 +66,6 @@ match 1 with P -> () let (|P|_|) (expr2 : int) (expr1 : int) = expr1 = expr2 match 1 with P -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -83,7 +78,6 @@ match 1 with P -> () let (|P|) expr2 expr1 = P (expr1 + expr2) match 1 with P -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -96,7 +90,6 @@ match 1 with P -> () let (|P|_|) expr2 expr1 = if expr1 = expr2 then Some (P (expr1 + expr2)) else None match 1 with P -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -108,7 +101,6 @@ match 1 with P -> () let (|P|_|) expr2 expr1 = if expr1 = expr2 then Some (P (expr1 + expr2)) else None match 1 with P pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -121,7 +113,6 @@ let (|P|_|) expr2 expr1 = if expr1 = expr2 then Some (P (expr1 + expr2)) else No let expr2 = 2 match 1 with P expr2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -134,7 +125,6 @@ match 1 with P expr2 -> () let (|P|_|) expr2 expr1 = if expr1 = expr2 then ValueSome (P (expr1 + expr2)) else ValueNone match 1 with P -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -146,7 +136,6 @@ match 1 with P -> () let (|P|_|) expr2 expr1 = if expr1 = expr2 then ValueSome (P (expr1 + expr2)) else ValueNone match 1 with P pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -159,7 +148,6 @@ let (|P|_|) expr2 expr1 = if expr1 = expr2 then ValueSome (P (expr1 + expr2)) el let expr2 = 2 match 1 with P expr2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -172,7 +160,6 @@ match 1 with P expr2 -> () let (|P|Q|) expr2 expr1 = if expr1 = expr2 then P (expr1 + expr2) else Q match 1 with P -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -184,7 +171,6 @@ match 1 with P -> () let (|P|Q|) expr2 expr1 = if expr1 = expr2 then P (expr1 + expr2) else Q match 1 with P pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -197,7 +183,6 @@ let (|P|Q|) expr2 expr1 = if expr1 = expr2 then P (expr1 + expr2) else Q let expr2 = 2 match 1 with P expr2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -211,7 +196,6 @@ module Enough = let (|P|) expr1 = P match 1 with P -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -223,7 +207,6 @@ match 1 with P -> () let (|P|) expr1 = P match 1 with P pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -234,7 +217,6 @@ match 1 with P pat -> () let (|P|) expr1 = P match 1 with P () -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -246,7 +228,6 @@ match 1 with P () -> () let (|P|_|) expr1 = if expr1 = 1 then Some P else None match 1 with P -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -258,7 +239,6 @@ match 1 with P -> () let (|P|_|) expr1 = if expr1 = 1 then Some P else None match 1 with P pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -269,7 +249,6 @@ match 1 with P pat -> () let (|P|_|) expr1 = if expr1 = 1 then Some P else None match 1 with P () -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -281,7 +260,6 @@ match 1 with P () -> () let (|P|_|) expr1 = if expr1 = 1 then ValueSome P else ValueNone match 1 with P -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -293,7 +271,6 @@ match 1 with P -> () let (|P|_|) expr1 = if expr1 = 1 then ValueSome P else ValueNone match 1 with P pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -304,7 +281,6 @@ match 1 with P pat -> () let (|P|_|) expr1 = if expr1 = 1 then ValueSome P else ValueNone match 1 with P () -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -316,7 +292,6 @@ match 1 with P () -> () let (|P|Q|) expr1 = if expr1 = 1 then P else Q match 1 with P -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -328,7 +303,6 @@ match 1 with P -> () let (|P|Q|) expr1 = if expr1 = 1 then P else Q match 1 with P pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -339,7 +313,6 @@ match 1 with P pat -> () let (|P|Q|) expr1 = if expr1 = 1 then P else Q match 1 with P () -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -351,7 +324,6 @@ match 1 with P () -> () let (|P|_|) expr1 = expr1 = 1 match 1 with P -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -363,7 +335,6 @@ match 1 with P -> () let (|P|) (expr1 : int) = P expr1 match 1 with P pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -375,7 +346,6 @@ match 1 with P pat -> () let (|P|_|) (expr1 : int) = if expr1 = 1 then Some (P expr1) else None match 1 with P pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -387,7 +357,6 @@ match 1 with P pat -> () let (|P|_|) (expr1 : int) = if expr1 = 1 then ValueSome (P expr1) else ValueNone match 1 with P pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -399,7 +368,6 @@ match 1 with P pat -> () let (|P|Q|) (expr1 : int) = if expr1 = 1 then P expr1 else Q match 1 with P pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -412,7 +380,6 @@ let (|P|) (expr2 : int) (expr1 : int) = P let expr2 = 2 match 1 with P expr2 () -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -425,7 +392,6 @@ let (|P|) (expr2 : int) (expr1 : int) = P let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -439,7 +405,6 @@ let expr2 = 2 let expr3 = 3 match 1 with P expr2 expr3 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -451,7 +416,6 @@ match 1 with P expr2 expr3 -> () let (|P|) (expr2 : int) (expr1 : int) = P match 1 with P pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -464,7 +428,6 @@ let (|P|) (expr2 : int) (expr1 : int) = P let expr2 = 2 match 1 with P expr2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -477,7 +440,6 @@ let (|P|_|) (expr2 : int) (expr1 : int) = if expr1 = expr2 then Some P else None let expr2 = 2 match 1 with P expr2 () -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -490,7 +452,6 @@ let (|P|_|) (expr2 : int) (expr1 : int) = if expr1 = expr2 then Some P else None let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -504,7 +465,6 @@ let expr2 = 2 let expr3 = 3 match 1 with P expr2 expr3 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -515,7 +475,6 @@ match 1 with P expr2 expr3 -> () let (|P|_|) (expr2 : int) (expr1 : int) = if expr1 = expr2 then Some P else None match 1 with P pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -528,7 +487,6 @@ let (|P|_|) (expr2 : int) (expr1 : int) = if expr1 = expr2 then Some P else None let expr2 = 2 match 1 with P expr2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -541,7 +499,6 @@ let (|P|_|) (expr2 : int) (expr1 : int) = if expr1 = expr2 then ValueSome P else let expr2 = 2 match 1 with P expr2 () -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -554,7 +511,6 @@ let (|P|_|) (expr2 : int) (expr1 : int) = if expr1 = expr2 then ValueSome P else let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -568,7 +524,6 @@ let expr2 = 2 let expr3 = 3 match 1 with P expr2 expr3 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -579,7 +534,6 @@ match 1 with P expr2 expr3 -> () let (|P|_|) (expr2 : int) (expr1 : int) = if expr1 = expr2 then ValueSome P else ValueNone match 1 with P pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -605,7 +559,6 @@ let (|P|Q|) (expr2 : int) (expr1 : int) = if expr1 = expr2 then P else Q let expr2 = 2 match 1 with P expr2 () -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -618,7 +571,6 @@ let (|P|Q|) (expr2 : int) (expr1 : int) = if expr1 = expr2 then P else Q let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -632,7 +584,6 @@ let expr2 = 2 let expr3 = 3 match 1 with P expr2 expr3 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -644,7 +595,6 @@ match 1 with P expr2 expr3 -> () let (|P|Q|) (expr2 : int) (expr1 : int) = if expr1 = expr2 then P else Q match 1 with P pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -660,7 +610,6 @@ let (|P|Q|) (expr2 : int) (expr1 : int) = if expr1 = expr2 then P else Q let expr2 = 2 match 1 with P expr2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -674,7 +623,6 @@ let (|P|_|) (expr2 : int) (expr1 : int) = expr1 = expr2 let expr2 = 2 match 1 with P expr2 () -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -687,7 +635,6 @@ let (|P|_|) (expr2 : int) (expr1 : int) = expr1 = expr2 let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -701,7 +648,6 @@ let expr2 = 2 let expr3 = 3 match 1 with P expr2 expr3 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -713,7 +659,6 @@ match 1 with P expr2 expr3 -> () let (|P|_|) (expr2 : int) (expr1 : int) = expr1 = expr2 match 1 with P pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -726,7 +671,6 @@ let (|P|_|) (expr2 : int) (expr1 : int) = expr1 = expr2 let expr2 = 2 match 1 with P expr2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -740,7 +684,6 @@ let (|P|) expr2 expr1 = P (expr1 + expr2) let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -754,7 +697,6 @@ let expr2 = 2 let expr3 = 2 match 1 with P expr2 expr3 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -766,7 +708,6 @@ match 1 with P expr2 expr3 -> () let (|P|) expr2 expr1 = P (expr1 + expr2) match 1 with P pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -779,7 +720,6 @@ let (|P|) expr2 expr1 = P (expr1 + expr2) let expr2 = 2 match 1 with P expr2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -793,7 +733,6 @@ let (|P|_|) expr2 expr1 = if expr1 = expr2 then Some (P (expr1 + expr2)) else No let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -807,7 +746,6 @@ let expr2 = 2 let expr3 = 2 match 1 with P expr2 expr3 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -819,7 +757,6 @@ let (|P|_|) expr2 expr1 = if expr1 = expr2 then Some (P (expr1 + expr2)) else No let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -833,7 +770,6 @@ let (|P|_|) expr2 expr1 = if expr1 = expr2 then ValueSome (P (expr1 + expr2)) el let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -847,7 +783,6 @@ let expr2 = 2 let expr3 = 2 match 1 with P expr2 expr3 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -859,7 +794,6 @@ let (|P|_|) expr2 expr1 = if expr1 = expr2 then ValueSome (P (expr1 + expr2)) el let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldSucceed @@ -872,7 +806,6 @@ let (|P|Q|) expr2 expr1 = if expr1 = expr2 then P (expr1 + expr2) else Q let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -886,7 +819,6 @@ let expr2 = 2 let expr3 = 2 match 1 with P expr2 expr3 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -899,7 +831,6 @@ let (|P|Q|) expr2 expr1 = if expr1 = expr2 then P (expr1 + expr2) else Q let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -914,7 +845,6 @@ let (|P|) (expr1 : int) = P let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -927,7 +857,6 @@ let (|P|) (expr1 : int) = P let expr2 = 2 match 1 with P expr2 () -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -940,7 +869,6 @@ let (|P|) (expr1 : int) = P let expr2 = 2 match 1 with P () expr2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -954,7 +882,6 @@ let (|P|_|) (expr1 : int) = if expr1 = 1 then Some P else None let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -967,7 +894,6 @@ let (|P|_|) (expr1 : int) = if expr1 = 1 then Some P else None let expr2 = 2 match 1 with P expr2 () -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -980,7 +906,6 @@ let (|P|_|) (expr1 : int) = if expr1 = 1 then Some P else None let expr2 = 2 match 1 with P () expr2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -994,7 +919,6 @@ let (|P|_|) (expr1 : int) = if expr1 = 1 then ValueSome P else ValueNone let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1007,7 +931,6 @@ let (|P|_|) (expr1 : int) = if expr1 = 1 then ValueSome P else ValueNone let expr2 = 2 match 1 with P expr2 () -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1020,7 +943,6 @@ let (|P|_|) (expr1 : int) = if expr1 = 1 then ValueSome P else ValueNone let expr2 = 2 match 1 with P () expr2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1034,7 +956,6 @@ let (|P|Q|) (expr1 : int) = if expr1 = 1 then P else Q let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1047,7 +968,6 @@ let (|P|Q|) (expr1 : int) = if expr1 = 1 then P else Q let expr2 = 2 match 1 with P expr2 () -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1060,7 +980,6 @@ let (|P|Q|) (expr1 : int) = if expr1 = 1 then P else Q let expr2 = 2 match 1 with P () expr2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1073,7 +992,6 @@ match 1 with P () expr2 -> () let (|P|_|) expr1 = expr1 = 1 match 1 with P pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1087,7 +1005,6 @@ let (|P|) (expr1 : int) = P expr1 let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1100,7 +1017,6 @@ let (|P|) (expr1 : int) = P expr1 let expr2 = 2 match 1 with P expr2 () -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1114,7 +1030,6 @@ let (|P|_|) (expr1 : int) = if expr1 = 1 then Some (P expr1) else None let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1127,7 +1042,6 @@ let (|P|_|) (expr1 : int) = if expr1 = 1 then Some (P expr1) else None let expr2 = 2 match 1 with P expr2 () -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1141,7 +1055,6 @@ let (|P|_|) (expr1 : int) = if expr1 = 1 then ValueSome (P expr1) else ValueNone let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1154,7 +1067,6 @@ let (|P|_|) (expr1 : int) = if expr1 = 1 then ValueSome (P expr1) else ValueNone let expr2 = 2 match 1 with P expr2 () -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1168,7 +1080,6 @@ let (|P|Q|) (expr1 : int) = if expr1 = 1 then P expr1 else Q let expr2 = 2 match 1 with P expr2 pat -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1181,7 +1092,6 @@ let (|P|Q|) (expr1 : int) = if expr1 = 1 then P expr1 else Q let expr2 = 2 match 1 with P expr2 () -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1195,7 +1105,6 @@ let (|P|) (expr2 : int) (expr1 : int) = P let expr2 = 2 match 1 with P expr2 pat1 pat2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1209,7 +1118,6 @@ let (|P|_|) (expr2 : int) (expr1 : int) = if expr1 = expr2 then Some P else None let expr2 = 2 match 1 with P expr2 pat1 pat2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1223,7 +1131,6 @@ let (|P|_|) (expr2 : int) (expr1 : int) = if expr1 = expr2 then ValueSome P else let expr2 = 2 match 1 with P expr2 pat1 pat2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1237,7 +1144,6 @@ let (|P|Q|) (expr2 : int) (expr1 : int) = if expr1 = expr2 then P else Q let expr2 = 2 match 1 with P expr2 pat1 pat2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1251,7 +1157,6 @@ let (|P|) expr2 expr1 = P (expr1 + expr2) let expr2 = 2 match 1 with P expr2 pat1 pat2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1265,7 +1170,6 @@ let (|P|_|) expr2 expr1 = if expr1 = expr2 then Some (P (expr1 + expr2)) else No let expr2 = 2 match 1 with P expr2 pat1 pat2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1279,7 +1183,6 @@ let (|P|_|) expr2 expr1 = if expr1 = expr2 then ValueSome (P (expr1 + expr2)) el let expr2 = 2 match 1 with P expr2 pat1 pat2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail @@ -1293,7 +1196,6 @@ let (|P|Q|) expr2 expr1 = if expr1 = expr2 then P (expr1 + expr2) else Q let expr2 = 2 match 1 with P expr2 pat1 pat2 -> () """ - |> withLangVersionPreview |> withNoWarn IncompletePatternMatches |> typecheck |> shouldFail diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs index cc5c341f4e6..489beba45c9 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs @@ -105,8 +105,8 @@ module InnerNonRecursiveModule = [] let ``Type in non-recursive namespace nested in a bigger recursive namespace shows warning``() = FSharp """ -namespace rec OuuterRec -namespace OuuterRec.InnerNonRec +namespace rec OuterRec +namespace OuterRec.InnerNonRec type MyCustomType<'T> = | Data of string interface System.IDisposable @@ -122,9 +122,9 @@ namespace OuuterRec.InnerNonRec [] - let ``Type in non-rec ns show give a warning when augmented externally even when the same file has a recursive (but different) ns``() = + let ``Type in non-rec ns should give a warning when augmented externally even when the same file has a recursive (but different) ns``() = FSharp """ -namespace rec OuuterRec +namespace rec OuterRec module Stuff = let x = 5 namespace TotallyDifferentNs.InnerNonRec diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InvalidLiteralTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InvalidLiteralTests.fs index 61381dfbebd..024269afe27 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InvalidLiteralTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InvalidLiteralTests.fs @@ -15,4 +15,4 @@ let [] (A x) = 1 """ |> typecheck |> shouldFail - |> withSingleDiagnostic (Error 3396, Line 3, Col 5, Line 3, Col 22, "A [] declaration cannot use an active pattern for its identifier") + |> withSingleDiagnostic (Error 3396, Line 3, Col 17, Line 3, Col 22, "A [] declaration cannot use an active pattern for its identifier") diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/Repro1548.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/Repro1548.fs index 8a8e9dad7d1..eaaf32e7bfe 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/Repro1548.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/Repro1548.fs @@ -4,8 +4,6 @@ namespace ErrorMessages open Xunit open FSharp.Test.Compiler -open FSharp.Test.Utilities -open NUnit.Framework open FSharp.Compiler.Diagnostics open FSharp.Test diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/SuggestionsTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/SuggestionsTests.fs index 76bf2d3e88c..0657c6f4ec4 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/SuggestionsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/SuggestionsTests.fs @@ -77,7 +77,7 @@ let x = N.MyUnion.``My Case2`` |> typecheck |> shouldFail |> withSingleDiagnostic (Error 39, Line 9, Col 19, Line 9,Col 31, - ("The type 'MyUnion' does not define the field, constructor or member 'My Case2'. Maybe you want one of the following:" + Environment.NewLine + " Case2" + Environment.NewLine + " ``My Case1``")) + ("The type 'MyUnion' does not define the field, constructor or member 'My Case2'. Maybe you want one of the following:" + Environment.NewLine + " Case2" + Environment.NewLine + " ``My Case1``" + Environment.NewLine + " IsMy Case1")) [] @@ -129,12 +129,12 @@ module Collections = let f () = printfn "%s" "Hello" -open Collectons +open Collections_ """ |> typecheck |> shouldFail - |> withSingleDiagnostic (Error 39, Line 6, Col 6, Line 6, Col 16, - ("The namespace or module 'Collectons' is not defined. Maybe you want one of the following:" + Environment.NewLine + " Collections")) + |> withSingleDiagnostic (Error 39, Line 6, Col 6, Line 6, Col 18, + ("The namespace or module 'Collections_' is not defined. Maybe you want one of the following:" + Environment.NewLine + " Collections")) [] let ``Suggest Namespaces`` () = @@ -224,7 +224,7 @@ let u = MyUnion.AntherCase |> typecheck |> shouldFail |> withSingleDiagnostic (Error 39, Line 6, Col 17, Line 6, Col 27, - ("The type 'MyUnion' does not define the field, constructor or member 'AntherCase'. Maybe you want one of the following:" + Environment.NewLine + " AnotherCase")) + ("The type 'MyUnion' does not define the field, constructor or member 'AntherCase'. Maybe you want one of the following:" + Environment.NewLine + " AnotherCase" + Environment.NewLine + " IsAnotherCase")) [] let ``Suggest Union Type for RequireQualifiedAccess Unions`` () = diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs index e1208481308..4eb2d3b2a14 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs @@ -1722,3 +1722,22 @@ module M = |> withLangVersion80 |> compile |> shouldSucceed + + [] + let ``Don't warn for tail rec call returning unit`` () = + """ +namespace N + +module M = + + [] + let rec go (args: string list) = + match args with + | [] -> () + | "--" :: _ -> () + | arg :: args -> go args + """ + |> FSharp + |> withLangVersion80 + |> compile + |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeEqualsMissingTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeEqualsMissingTests.fs index 13d596019de..e0eb2e11b74 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeEqualsMissingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeEqualsMissingTests.fs @@ -6,16 +6,16 @@ open Xunit open FSharp.Test open FSharp.Compiler.Diagnostics +// Disabled this test, see https://github.com/dotnet/fsharp/commit/98dc1b09fa1ff15176998dc2d28c5b5c8d0f80b1#r43542750 +//module ``Type definition missing equals`` = -module ``Type definition missing equals`` = - - [] - let ``Missing equals in DU``() = - CompilerAssert.TypeCheckSingleError - """ -type X | A | B - """ - FSharpDiagnosticSeverity.Error - 10 - (2, 8, 2, 9) - "Unexpected symbol '|' in type definition. Expected '=' or other token." +// [] +// let ``Missing equals in DU``() = +// CompilerAssert.TypeCheckSingleError +// """ +// type X | A | B +// """ +// FSharpDiagnosticSeverity.Error +// 10 +// (2, 8, 2, 9) +// "Unexpected symbol '|' in type definition. Expected '=' or other token." diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs index 06dc7d44671..34263b3f7bc 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs @@ -351,3 +351,22 @@ let f4 = (Error 1, Line 28, Col 9, Line 28, Col 12, "This expression was expected to have type\n 'int64' \nbut here has type\n 'float' ") ] + [] + let ``Error when tuples have differing lengths and we do not know the types.``() = + Fsx """ +let foo items = + for (a,b,c) in items do + printfn "%A" (a, c) + +[] +let main args = + foo ({1..10} |> Seq.pairwise) + 0 + """ + |> asExe + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 1, Line 8, Col 21, Line 8, Col 33, "The tuples have differing lengths of 3 and 2") + ] + diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnitGenericAbstactType.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnitGenericAbstractType.fs similarity index 89% rename from tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnitGenericAbstactType.fs rename to tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnitGenericAbstractType.fs index dab7f865a7d..d39c3d6affe 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnitGenericAbstactType.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnitGenericAbstractType.fs @@ -9,7 +9,7 @@ open FSharp.Test.Compiler module ``Unit generic abstract Type`` = [] - let ``Unit can not be used as return type of abstract method paramete on return type``() = + let ``Unit cannot be used as return type of abstract method parameter on return type``() = FSharp """ type EDF<'S> = abstract member Apply : int -> 'S diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 419776657f5..f7e63b79621 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -31,6 +31,9 @@ FsUnit.fs + + + @@ -56,6 +59,7 @@ + @@ -79,7 +83,7 @@ - + @@ -89,6 +93,9 @@ + + + @@ -175,9 +182,11 @@ + + + - @@ -194,10 +203,9 @@ - - + @@ -235,6 +243,10 @@ + + + + @@ -245,6 +257,8 @@ + + diff --git a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/CommonWorkflows.fs b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/CommonWorkflows.fs index 6912abca332..4b0163a9f4b 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/CommonWorkflows.fs +++ b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/CommonWorkflows.fs @@ -165,7 +165,7 @@ let GetAllUsesOfAllSymbols() = traceProvider.ForceFlush() |> ignore traceProvider.Dispose() - if result.Length <> 79 then failwith $"Expected 79 symbolUses, got {result.Length}:\n%A{result}" + if result.Length <> 79 then failwith $"Expected 81 symbolUses, got {result.Length}:\n%A{result}" [] let ``We don't lose subsequent diagnostics when there's error in one file`` () = diff --git a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs index b12edf8cb6d..727fac9b052 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs +++ b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs @@ -7,16 +7,16 @@ open FSharp.Test.ProjectGeneration.Helpers #nowarn "57" -type Occurence = Definition | InType | Use +type Occurrence = Definition | InType | Use -let deriveOccurence (su:FSharpSymbolUse) = +let deriveOccurrence (su:FSharpSymbolUse) = if su.IsFromDefinition then Definition elif su.IsFromType then InType elif su.IsFromUse then Use - else failwith $"Unexpected type of occurence (for this test), symbolUse = {su}" + else failwith $"Unexpected type of occurrence (for this test), symbolUse = {su}" /// https://github.com/dotnet/fsharp/issues/13199 let reproSourceCode = """ @@ -40,9 +40,9 @@ let ``Finding usage of type via GetUsesOfSymbolInFile should also find it's cons let references = typeCheckResult.GetUsesOfSymbolInFile(symbolUse.Symbol) |> Array.sortBy (fun su -> su.Range.StartLine) - |> Array.map (fun su -> su.Range.StartLine, su.Range.StartColumn, su.Range.EndColumn, deriveOccurence su) + |> Array.map (fun su -> su.Range.StartLine, su.Range.StartColumn, su.Range.EndColumn, deriveOccurrence su) - Assert.Equal<(int*int*int*Occurence)>( + Assert.Equal<(int*int*int*Occurrence)>( [| 7,5,11,Definition 8,25,31,InType 10,8,14,Use diff --git a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs index cb3f9cece44..0395a421895 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs +++ b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs @@ -470,12 +470,11 @@ let ``Multi-project`` signatureFiles = type ProjectAction = Get | Modify of (SyntheticProject -> SyntheticProject) -type ProjectModificaiton = Update of int | Add | Remove +type ProjectModification = Update of int | Add | Remove type ProjectRequest = ProjectAction * AsyncReplyChannel type FuzzingEvent = StartedChecking | FinishedChecking of bool | AbortedChecking of string | ModifiedImplFile | ModifiedSigFile -[] type SignatureFiles = Yes = 1 | No = 2 | Some = 3 let fuzzingTest seed (project: SyntheticProject) = task { @@ -753,7 +752,7 @@ let ``File moving test`` signatureFiles = [] [] -let ``What happens if bootrstapInfoStatic needs to be recomputed`` _ = +let ``What happens if bootstrapInfoStatic needs to be recomputed`` _ = let giraffeProject = SyntheticProject.CreateFromRealProject giraffeSignaturesDir let giraffeProject = { giraffeProject with OtherOptions = "--nowarn:FS3520"::giraffeProject.OtherOptions } diff --git a/tests/FSharp.Compiler.ComponentTests/Interop/ByrefTests.fs b/tests/FSharp.Compiler.ComponentTests/Interop/ByrefTests.fs index dca7589c903..e5a278a4a85 100644 --- a/tests/FSharp.Compiler.ComponentTests/Interop/ByrefTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Interop/ByrefTests.fs @@ -53,4 +53,169 @@ module ``Byref interop verification tests`` = """ |> asExe |> compileAndRun - |> shouldSucceed \ No newline at end of file + |> shouldSucceed + + [] + let ``Ref structs in generics - can declare`` () = + FSharp """module Foo +open System +let x(a:Action>) = a.Invoke(ReadOnlySpan([||])) + """ + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + + [] + let ``Ref structs in generics - can return as inner`` () = + + FSharp """module Foo +open System +let x() = + let a:(Action>) = Unchecked.defaultof<_> + a + """ + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + + [] + let ``Ref structs in generics - can use in object expressions`` () = + FSharp """module Foo +open System + +let main _args = + let comparer = + { new System.IComparable> + with member x.CompareTo(o) = 42 } + comparer.CompareTo(ReadOnlySpan([||])) + """ + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + + [] + let ``Ref structs in generics - can use in foreach`` () = + FSharp """module Foo +open System + +let processSeq (input:seq>) = + for ros in input do + printfn "%i" (ros.Length) + """ + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + + [] + let ``Ref structs in generics - IL and runtime test`` () = + FSharp """module Foo +open System +open System.Collections.Generic + +let myDict = ["x",1;"xyz",2] |> dict |> Dictionary + +let checkIfPresent (input:ReadOnlySpan) = + let altLookup = myDict.GetAlternateLookup>() + let present = altLookup.ContainsKey(input) + for c in input do + printf "%c" c + printfn ": %A" present + +[] +let main _args = + checkIfPresent(ReadOnlySpan([||])) + checkIfPresent("x".AsSpan()) + checkIfPresent(ReadOnlySpan([|'x';'y';'z'|])) + 0 + """ + |> asExe + |> withLangVersionPreview + |> compileAndRun + |> shouldSucceed + |> verifyOutputContains [|": false";"x: true";"xyz: true"|] + |> verifyIL + ["callvirt instance valuetype [System.Collections]System.Collections.Generic.Dictionary`2/AlternateLookup`1 class [System.Collections]System.Collections.Generic.Dictionary`2::GetAlternateLookup>()"] + + [] + let ``Ref structs in generics - GetAlternateLookup`` () = + FSharp """module Foo +open System +open System.Collections.Generic + +let main _args = + let myDict = ["x",1;"y",2] |> dict |> Dictionary + let altLookup = myDict.GetAlternateLookup>() + altLookup.ContainsKey(ReadOnlySpan([|'x'|])) + """ + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + + [] + [ Async.RunSynchronously")>] + [] + let ``Ref structs in generics - builders`` (build:string) (getter:string) = + + FSharp $$$"""module Foo +open System + +let getAction() = + {{{build}}} { + let x = new Action>(fun ros -> printfn "%i" ros.Length) + return x + } + +let getBuilderResult() = + {{{build}}} { + let! myAction = getAction() + myAction.Invoke(ReadOnlySpan([|1|])) + return myAction + } + +[] +let main _args = + let myTask = getBuilderResult(){{{getter}}} + printfn "%O" myTask + 0 + """ + |> asExe + |> withLangVersionPreview + |> compileAndRun + |> shouldSucceed + |> verifyOutputContains [|"1";"System.Action`1[System.ReadOnlySpan`1[System.Int32]]"|] + |> verifyIL + [ if build = "task" then + "valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1>>>" + else "[FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1>>>" ] + + [] + let ``Ref structs in generics - negative tests`` () = + FSharp """module Foo +open System +open System.Collections.Generic + +[] +type MyRecordFullOfWrongStuff<'T> = + { Value : Span<'T> + MyMap : list> + MyDict: Dictionary> + Nested: Span> } + +let processRecord (recd:MyRecordFullOfWrongStuff>>) = + recd.MyDict.["x"] + + """ + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics + [ Error 412, Line 7, Col 7, Line 7, Col 12, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL." + Error 437, Line 6, Col 6, Line 6, Col 30, "A type would store a byref typed value. This is not permitted by Common IL." + Error 412, Line 8, Col 7, Line 8, Col 12, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL." + Error 412, Line 9, Col 7, Line 9, Col 13, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL." + Error 412, Line 10, Col 7, Line 10, Col 13, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL." + Error 3300, Line 12, Col 20, Line 12, Col 24, "The parameter 'recd' has an invalid type 'MyRecordFullOfWrongStuff>>'. This is not permitted by the rules of Common IL." + Error 412, Line 13, Col 5, Line 13, Col 22, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL." + Error 412, Line 13, Col 5, Line 13, Col 16, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL." + Error 412, Line 13, Col 5, Line 13, Col 9, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL."] + diff --git a/tests/FSharp.Compiler.ComponentTests/Interop/DeeplyNestedCSharpClasses.fs b/tests/FSharp.Compiler.ComponentTests/Interop/DeeplyNestedCSharpClasses.fs index ad09280c78b..cbc02c49727 100644 --- a/tests/FSharp.Compiler.ComponentTests/Interop/DeeplyNestedCSharpClasses.fs +++ b/tests/FSharp.Compiler.ComponentTests/Interop/DeeplyNestedCSharpClasses.fs @@ -33,7 +33,7 @@ namespace MyNamespace let fsharpSource = """ -let loss2 = MyNamespace.OoterClass.InnerClass.MoreInnerClass.somefunction() //Note the miss-typed functionname we expect a good error message +let loss2 = MyNamespace.OoterClass.InnerClass.MoreInnerClass.somefunction() //Note the mistyped functionname we expect a good error message """ FSharp fsharpSource |> asExe @@ -47,21 +47,21 @@ let loss2 = MyNamespace.OoterClass.InnerClass.MoreInnerClass.somefunction() // let fsharpSource = """ -let loss2 = MyNamespace.OuterClass.InerClass.MoreInnerClass.somefunction() //Note the miss-typed InnerClass name we expect a good error message +let loss2 = MyNamespace.OuterClass.InnerClass_.MoreInnerClass.somefunction() //Note the mistyped InnerClass name we expect a good error message """ FSharp fsharpSource |> asExe |> withReferences [cslib] |> compile |> shouldFail - |> withSingleDiagnostic (Error 39, Line 2, Col 36, Line 2, Col 45, "The type 'OuterClass' does not define the field, constructor or member 'InerClass'.") + |> withSingleDiagnostic (Error 39, Line 2, Col 36, Line 2, Col 47, "The type 'OuterClass' does not define the field, constructor or member 'InnerClass_'.") [] let ``Missing type nested type moreinnerclass generates good message and range`` () = let fsharpSource = """ -let loss2 = MyNamespace.OuterClass.InnerClass.MoareInnerClass.somefunction() //Note the miss-typed MoreInnerClass we expect a good error message +let loss2 = MyNamespace.OuterClass.InnerClass.MoareInnerClass.somefunction() //Note the mistyped MoreInnerClass we expect a good error message """ FSharp fsharpSource |> asExe @@ -75,12 +75,12 @@ let loss2 = MyNamespace.OuterClass.InnerClass.MoareInnerClass.somefunction() / let fsharpSource = """ -let loss2 = MyNamespace.OuterClass.InnerClass.MoreInnerClass.somefunctoion() //Note the miss-typed somefunction we expect a good error message +let loss2 = MyNamespace.OuterClass.InnerClass.MoreInnerClass.somefunction_() //Note the mistyped somefunction we expect a good error message """ FSharp fsharpSource |> asExe |> withReferences [cslib] |> compile |> shouldFail - |> withSingleDiagnostic ((Error 39, Line 2, Col 62, Line 2, Col 75, """The type 'MoreInnerClass' does not define the field, constructor or member 'somefunctoion'. Maybe you want one of the following: + |> withSingleDiagnostic ((Error 39, Line 2, Col 62, Line 2, Col 75, """The type 'MoreInnerClass' does not define the field, constructor or member 'somefunction_'. Maybe you want one of the following: somefunction""")) diff --git a/tests/FSharp.Compiler.ComponentTests/Interop/ParamArray.fs b/tests/FSharp.Compiler.ComponentTests/Interop/ParamArray.fs new file mode 100644 index 00000000000..3864857d969 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Interop/ParamArray.fs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Interop + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +module ParamArray = + + [] + let ``C# 13 params enhancements`` () = + let csharp = + CSharp """ +using System; +using System.Collections.Generic; + +namespace CSharpAssembly; + +public class CS13ParamArray +{ + public static void WriteNames(params string[] names) + => Console.WriteLine("First: " + string.Join(" + ", names)); + + public static void WriteNames(params List names) + => Console.WriteLine("Second: " + string.Join(" + ", names)); + + public static void WriteNames(params IEnumerable names) + => Console.WriteLine("Third: " + string.Join(" + ", names)); +}""" + |> withCSharpLanguageVersionPreview + + FSharp """ +open System.Collections.Generic; +open CSharpAssembly + +CS13ParamArray.WriteNames("Petr", "Jana") +CS13ParamArray.WriteNames(List["Petr"; "Jana"]) +CS13ParamArray.WriteNames(["Petr"; "Jana"]) +""" + |> withReferences [csharp] + |> compileExeAndRun + |> shouldSucceed + |> withStdOutContainsAllInOrder [ + "First: Petr + Jana" + "Second: Petr + Jana" + "Third: Petr + Jana" + ] + + [] + let ``C# 13 params enhancements - ReadOnlySpan`` () = + let csharp = + CSharp """ +using System; + +namespace CSharpAssembly; + +public class CS13ParamArray +{ + public static void WriteNames(params ReadOnlySpan names) + => Console.WriteLine(string.Join(" + ", names)); +}""" + |> withCSharpLanguageVersionPreview + + FSharp """ +open System +open CSharpAssembly + +CS13ParamArray.WriteNames(ReadOnlySpan([|"Petr"; "Jana"|])) +""" + |> withReferences [csharp] + |> compileExeAndRun + |> shouldSucceed + |> withStdOutContainsAllInOrder [ "Petr + Jana" ] + + [] + let ``C# 13 params enhancements - error when no matching overload is available`` () = + let csharp = + CSharp """ +using System; +using System.Collections.Generic; + +namespace CSharpAssembly; + +public class CS13ParamArray +{ + public static void WriteNames(params List names) + => Console.WriteLine("Second: " + string.Join(" + ", names)); + + public static void WriteNames(params IEnumerable names) + => Console.WriteLine("Third: " + string.Join(" + ", names)); +}""" + |> withCSharpLanguageVersionPreview + + FSharp """ +open CSharpAssembly + +CS13ParamArray.WriteNames("Petr", "Jana") +""" + |> withReferences [csharp] + |> asExe + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 503, Line 4, Col 1, Line 4, Col 42, + "A member or object constructor 'WriteNames' taking 2 arguments is not accessible from this code location. All accessible versions of method 'WriteNames' take 1 arguments.") + ] \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Interop/ParamArrayMigrated.fs b/tests/FSharp.Compiler.ComponentTests/Interop/ParamArrayMigrated.fs new file mode 100644 index 00000000000..0906682d6d6 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Interop/ParamArrayMigrated.fs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Interop + +open Xunit +open FSharp.Test.Compiler + +module ParamArrayMigrated = + + let csharp = + CSharp """ +using System; + +namespace CSharpAssembly +{ + [AttributeUsage(AttributeTargets.All)] + public class AttributeWithParamArray : Attribute + { + public object[] Parameters; + + public AttributeWithParamArray(params object[] x) + { + + Parameters = x; + } + } + + public class CSParamArray + { + public static int Method(params int[] allArgs) + { + int total = 0; + foreach (int i in allArgs) + total += i; + + return total; + } + + public static int Method(params T[] args) + { + return args.Length; + } + } +}""" + + [] + let ``Valid params call`` () = + FSharp """ +open System +open CSharpAssembly + +// Apply the attribute +[ obj) |])>] +type Foo() = + [ obj); ("bar" :> obj) |])>] + override this.ToString() = "Stuff" + +let callCSGenericMethod (a: 't[]) = CSParamArray.Method(a) + +[] +do + let getTestAttribute (t : Type) = + let tyAttributes = t.GetCustomAttributes(false) + let attrib = tyAttributes |> Array.find (fun attrib -> match attrib with :? AttributeWithParamArray -> true | _ -> false) + (attrib :?> AttributeWithParamArray) + + let tyFoo = typeof + let testAtt = getTestAttribute tyFoo + if testAtt.Parameters <> [| (0 :> obj) |] then + failwith "Attribute parameters not as expected" + + let directCallWorks = + CSParamArray.Method(9, 8, 7) + CSParamArray.Method(1, 2) + CSParamArray.Method() = (9 + 8 + 7) + (1 + 2) + if not directCallWorks then + failwith "Calling C# param array method gave unexpected result" + + let callParamArray (x : int array) = CSParamArray.Method(x) + let asArrayCallWorks = (callParamArray [| 9; 8; 7 |]) = (9 + 8 + 7) + if not asArrayCallWorks then + failwith "Calling C# param array method, passing args as an array, gave unexpected result" + + if callCSGenericMethod [|"1";"2";"3"|] <> 3 then + failwith "Calling C# generic param array method gave unexpected result" + + if CSParamArray.Method("1", "2", "3") <> CSParamArray.Method([|"1"; "2"; "3"|]) then + failwith "Calling C# generic param array in normal and expanded method gave unexpected result" +""" + |> withReferences [csharp] + |> compileExeAndRun + |> shouldSucceed + + [] + let ``Invalid params call`` () = + FSharp """ +open CSharpAssembly + +[] +type Foo() = + override this.ToString() = "Stuff" +""" + |> withReferences [csharp] + |> asExe + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 13, Line 4, Col 29, Line 4, Col 37, + "The static coercion from type\n int \nto \n 'a \n involves an indeterminate type based on information prior to this program point. Static coercions are not allowed on some types. Further type annotations are needed.") + (Error 267, Line 4, Col 29, Line 4, Col 37, + "This is not a valid constant expression or custom attribute value") + ] diff --git a/tests/FSharp.Compiler.ComponentTests/Interop/RequiredAndInitOnlyProperties.fs b/tests/FSharp.Compiler.ComponentTests/Interop/RequiredAndInitOnlyProperties.fs index e0c8b08e188..520dfd7c49a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Interop/RequiredAndInitOnlyProperties.fs +++ b/tests/FSharp.Compiler.ComponentTests/Interop/RequiredAndInitOnlyProperties.fs @@ -313,7 +313,7 @@ let main _ = |> compile |> shouldFail |> withDiagnostics [ - Error 3545, Line 8, Col 16, Line 8, Col 22, "The following required properties have to be initalized:" + Environment.NewLine + " property RAIO.GetSet: int with get, set" + Environment.NewLine + " property RAIO.GetInit: int with get, set" + Error 3545, Line 8, Col 16, Line 8, Col 22, "The following required properties have to be initialized:" + Environment.NewLine + " property RAIO.GetSet: int with get, set" + Environment.NewLine + " property RAIO.GetInit: int with get, set" ] [] @@ -340,7 +340,7 @@ let main _ = |> compile |> shouldFail |> withDiagnostics [ - Error 3545, Line 8, Col 16, Line 8, Col 30, "The following required properties have to be initalized:" + Environment.NewLine + " property RAIO.GetInit: int with get, set" + Error 3545, Line 8, Col 16, Line 8, Col 30, "The following required properties have to be initialized:" + Environment.NewLine + " property RAIO.GetInit: int with get, set" ] [] @@ -427,7 +427,7 @@ let main _ = |> withReferences [csharpLib] |> compile |> shouldFail - |> withSingleDiagnostic (Error 3545, Line 7, Col 21, Line 7, Col 30, "The following required properties have to be initalized:" + Environment.NewLine + " property RAIO.GetSet: int with get, set" + Environment.NewLine + " property RAIO.GetInit: int with get, set") + |> withSingleDiagnostic (Error 3545, Line 7, Col 21, Line 7, Col 30, "The following required properties have to be initialized:" + Environment.NewLine + " property RAIO.GetSet: int with get, set" + Environment.NewLine + " property RAIO.GetInit: int with get, set") [] let ``F# should produce a warning if RequiredMemberAttribute is specified`` () = diff --git a/tests/FSharp.Compiler.ComponentTests/Interop/SimpleInteropTests.fs b/tests/FSharp.Compiler.ComponentTests/Interop/SimpleInteropTests.fs index 037e33f1c8c..6499cbf9259 100644 --- a/tests/FSharp.Compiler.ComponentTests/Interop/SimpleInteropTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Interop/SimpleInteropTests.fs @@ -38,7 +38,7 @@ let a = AMaker.makeA() FSharp """ namespace Interop.FS type Bicycle(manufacturer: string) = - member this.Manufactirer = manufacturer + member this.Manufacturer = manufacturer """ |> withName "FSLib" let app = @@ -59,7 +59,7 @@ public class BicycleShop { FSharp """ namespace Interop.FS type Bicycle(manufacturer: string) = - member this.Manufactirer = manufacturer + member this.Manufacturer = manufacturer """ |> withName "FSLib" let app = diff --git a/tests/FSharp.Compiler.ComponentTests/Language/BooleanReturningAndReturnTypeDirectedPartialActivePatternTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/BooleanReturningAndReturnTypeDirectedPartialActivePatternTests.fs index c8ba6fba856..6562e347bbd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/BooleanReturningAndReturnTypeDirectedPartialActivePatternTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/BooleanReturningAndReturnTypeDirectedPartialActivePatternTests.fs @@ -30,7 +30,6 @@ let ``Single case active pattern returning bool should success`` () = let (|IsA|) x = x = "A" let (IsA r) = "A" """ - |> withLangVersionPreview |> typecheck |> shouldSucceed @@ -54,7 +53,6 @@ match "x" with | EqualTo "x" -> () | _ -> fail "with argument" """ - |> withLangVersionPreview |> runCode |> shouldSucceed @@ -69,12 +67,12 @@ let (|OddVOption|_|) x = if x % 2 = 1 then ValueSome() else ValueNone |> typecheck |> shouldFail |> withDiagnostics [ - (Error 3350, Line 1, Col 5, Line 1, Col 20, "Feature 'Boolean-returning and return-type-directed partial active patterns' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") - (Error 3350, Line 2, Col 5, Line 2, Col 23, "Feature 'Boolean-returning and return-type-directed partial active patterns' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.") + (Error 3350, Line 1, Col 6, Line 1, Col 17, "Feature 'Boolean-returning and return-type-directed partial active patterns' is not available in F# 8.0. Please use language version 9.0 or greater.") + (Error 3350, Line 2, Col 6, Line 2, Col 20, "Feature 'Boolean-returning and return-type-directed partial active patterns' is not available in F# 8.0. Please use language version 9.0 or greater.") ] [] -let ``Can not receive result from bool active pattern`` () = +let ``Cannot receive result from bool active pattern`` () = FSharp """#nowarn "20" let (|IsA|_|) x = x = "A" @@ -90,7 +88,6 @@ match "A" with | IsA "to match return value" -> "Matched" | _ -> "not Matched" """ - |> withLangVersionPreview |> typecheck |> shouldFail |> withDiagnostics [ diff --git a/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs index 21c1c0de20f..d5c6a5a0a63 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs @@ -135,3 +135,115 @@ let _pythags = seqbuilder {{ |> FSharp |> typecheck |> shouldSucceed + + [] + let ``A CE returned from type member succeeds``() = + FSharp """ +module ComputationExpressionTests +type Builder () = + member _.Bind(x, f) = f x + member _.Return(x) = x + +type A = + static member Prop = Builder () + +let x = A.Prop { return 0 } + """ + |> compile + |> shouldSucceed + |> ignore + + [] + let ``use! may not be combined with and!`` () = + Fsx """ +module Result = + let zip x1 x2 = + match x1,x2 with + | Ok x1res, Ok x2res -> Ok (x1res, x2res) + | Error e, _ -> Error e + | _, Error e -> Error e + +type ResultBuilder() = + member _.MergeSources(t1: Result<'T,'U>, t2: Result<'T1,'U>) = Result.zip t1 t2 + member _.BindReturn(x: Result<'T,'U>, f) = Result.map f x + +let result = ResultBuilder() + +let run r2 r3 = + result { + use! b = r2 + and! c = r3 + return b - c + } + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3345, Line 18, Col 9, Line 18, Col 13, "use! may not be combined with and!") + ] + + [] + let ``multiple use! may not be combined with and!`` () = + Fsx """ +module Result = + let zip x1 x2 = + match x1,x2 with + | Ok x1res, Ok x2res -> Ok (x1res, x2res) + | Error e, _ -> Error e + | _, Error e -> Error e + +type ResultBuilder() = + member _.MergeSources(t1: Result<'T,'U>, t2: Result<'T1,'U>) = Result.zip t1 t2 + member _.BindReturn(x: Result<'T,'U>, f) = Result.map f x + +let result = ResultBuilder() + +let run r2 r3 = + result { + use! b = r2 + and! c = r3 + use! d = r2 + return b - c + } + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3345, Line 18, Col 9, Line 18, Col 13, "use! may not be combined with and!") + ] + + [] + let ``multiple use! may not be combined with multiple and!`` () = + Fsx """ +module Result = + let zip x1 x2 = + match x1,x2 with + | Ok x1res, Ok x2res -> Ok (x1res, x2res) + | Error e, _ -> Error e + | _, Error e -> Error e + +type ResultBuilder() = + member _.MergeSources(t1: Result<'T,'U>, t2: Result<'T1,'U>) = Result.zip t1 t2 + member _.BindReturn(x: Result<'T,'U>, f) = Result.map f x + member _.BindReturn(x: Result<'T,'U>, f) = Result.map f x + member _.Bind(x: Result<'T,'U>, f) = Result.bind f x + +let result = ResultBuilder() + +let run r2 r3 = + result { + let! c = r3 + and! c = r3 + use! b = r2 + and! c = r3 + return b - c + } + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3345, Line 22, Col 9, Line 22, Col 13, "use! may not be combined with and!") + ] \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/CopyAndUpdateTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/CopyAndUpdateTests.fs index 118fb0fb81f..1e29223eed4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/CopyAndUpdateTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/CopyAndUpdateTests.fs @@ -7,9 +7,9 @@ open StructuredResultsAsserts [] let ``Cannot update the same field twice in nested copy-and-update``() = FSharp """ -type NestdRecTy = { B: string } +type NestedRecTy = { B: string } -type RecTy = { D: NestdRecTy; E: string option } +type RecTy = { D: NestedRecTy; E: string option } let t2 x = { x with D.B = "a"; D.B = "b" } """ @@ -23,13 +23,12 @@ let t2 x = { x with D.B = "a"; D.B = "b" } [] let ``Cannot update the same field appears multiple times in nested copy-and-update``() = FSharp """ -type NestdRecTy = { B: string } +type NestedRecTy = { B: string } -type RecTy = { D: NestdRecTy; E: string option } +type RecTy = { D: NestedRecTy; E: string option } let t2 x = { x with D.B = "a"; D.B = "b"; D.B = "c" } """ - |> withLangVersionPreview |> typecheck |> shouldFail |> withDiagnostics [ @@ -40,13 +39,12 @@ let t2 x = { x with D.B = "a"; D.B = "b"; D.B = "c" } [] let ``Cannot update the same field appears multiple times in nested copy-and-update 2``() = FSharp """ -type NestdRecTy = { B: string; C: string } +type NestedRecTy = { B: string; C: string } -type RecTy = { D: NestdRecTy; E: string option } +type RecTy = { D: NestedRecTy; E: string option } let t2 x = { x with D.B = "a"; D.C = ""; D.B = "c" ; D.C = "d" } """ - |> withLangVersionPreview |> typecheck |> shouldFail |> withDiagnostics [ @@ -57,9 +55,9 @@ let t2 x = { x with D.B = "a"; D.C = ""; D.B = "c" ; D.C = "d" } [] let ``Cannot use nested copy-and-update in lang version70``() = FSharp """ -type NestdRecTy = { B: string } +type NestedRecTy = { B: string } -type RecTy = { D: NestdRecTy; E: string option } +type RecTy = { D: NestedRecTy; E: string option } let t2 x = { x with D.B = "a" } """ @@ -77,9 +75,9 @@ module CopyAndUpdateTests type AnotherNestedRecTy = { A: int } -type NestdRecTy = { B: AnotherNestedRecTy; C: string } +type NestedRecTy = { B: AnotherNestedRecTy; C: string } -type RecTy = { D: NestdRecTy; E: string option } +type RecTy = { D: NestedRecTy; E: string option } let t2 x = { x with D.B.A = 1; D.C = "ads" } """ @@ -92,7 +90,7 @@ let t2 x = { x with D.B.A = 1; D.C = "ads" } (* public static CopyAndUpdateTests.RecTy t2(CopyAndUpdateTests.RecTy x) { - return new CopyAndUpdateTests.RecTy(new CopyAndUpdateTests.NestdRecTy(new CopyAndUpdateTests.AnotherNestedRecTy(1), "ads"), x.E@); + return new CopyAndUpdateTests.RecTy(new CopyAndUpdateTests.NestedRecTy(new CopyAndUpdateTests.AnotherNestedRecTy(1), "ads"), x.E@); } *) """ @@ -104,11 +102,11 @@ let t2 x = { x with D.B.A = 1; D.C = "ads" } IL_0000: ldc.i4.1 IL_0001: newobj instance void CopyAndUpdateTests/AnotherNestedRecTy::.ctor(int32) IL_0006: ldstr "ads" - IL_000b: newobj instance void CopyAndUpdateTests/NestdRecTy::.ctor(class CopyAndUpdateTests/AnotherNestedRecTy, + IL_000b: newobj instance void CopyAndUpdateTests/NestedRecTy::.ctor(class CopyAndUpdateTests/AnotherNestedRecTy, string) IL_0010: ldarg.0 IL_0011: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 CopyAndUpdateTests/RecTy::E@ - IL_0016: newobj instance void CopyAndUpdateTests/RecTy::.ctor(class CopyAndUpdateTests/NestdRecTy, + IL_0016: newobj instance void CopyAndUpdateTests/RecTy::.ctor(class CopyAndUpdateTests/NestedRecTy, class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1) IL_001b: ret } @@ -122,9 +120,9 @@ module CopyAndUpdateTests type AnotherNestedRecTy = { A: int } -type NestdRecTy = { B: string; C: AnotherNestedRecTy } +type NestedRecTy = { B: string; C: AnotherNestedRecTy } -type RecTy = { D: NestdRecTy; E: string option; F: int } +type RecTy = { D: NestedRecTy; E: string option; F: int } let t1 = { D = { B = "t1"; C = { A = 1 } }; E = None; F = 42 } @@ -172,9 +170,9 @@ module CopyAndUpdateTests type AnotherNestedRecTy = { A: int } -type NestdRecTy<'b> = { B: 'b; C: AnotherNestedRecTy } +type NestedRecTy<'b> = { B: 'b; C: AnotherNestedRecTy } -type RecTy<'b, 'e> = { D: NestdRecTy<'b>; E: 'e option; F: int } +type RecTy<'b, 'e> = { D: NestedRecTy<'b>; E: 'e option; F: int } let t1 = { D = { B = "t1"; C = { A = 1 } }; E = Option.None; F = 42 } @@ -202,10 +200,10 @@ module CopyAndUpdateTests [] type AnotherNestedRecTy = { A: int } -type NestdRecTy = { B: string; C: AnotherNestedRecTy; G: int; H: int } +type NestedRecTy = { B: string; C: AnotherNestedRecTy; G: int; H: int } [] -type RecTy = { D: NestdRecTy; E: string option; F: int } +type RecTy = { D: NestedRecTy; E: string option; F: int } let t1 = { D = { B = "t1"; C = { A = 1 }; G = 0; H = 0 }; E = None; F = 42 } @@ -313,9 +311,9 @@ module CopyAndUpdateTests type AnotherNestedRecTy = { A: int } -type NestdRecTy<'b> = { B: 'b; C: AnotherNestedRecTy } +type NestedRecTy<'b> = { B: 'b; C: AnotherNestedRecTy } -type RecTy<'b, 'e> = { D: NestdRecTy<'b>; E: 'e option; F: int } +type RecTy<'b, 'e> = { D: NestedRecTy<'b>; E: 'e option; F: int } let t1 = { D = { B = "t1"; C = { A = 1 } }; E = Option.None; F = 42 } @@ -400,29 +398,29 @@ let ``Nested copy-and-update does not compile when referencing invalid fields``( FSharp """ module CopyAndUpdateTests -type NestdRecTy = { B: string; G: {| a: int |} } +type NestedRecTy = { B: string; G: {| a: int |} } -type RecTy = { D: NestdRecTy; E: string option } +type RecTy = { D: NestedRecTy; E: string option } let t1 x = { x with D.B.A = "a" } let t2 x = { x with D.C = "a" } let t3 x = { x with D.G.b = "a" } let t4 x = { x with C.D = "a" } -let t5 (x: {| a: int; b: NestdRecTy |}) = {| x with b.C = "a" |} -let t6 (x: {| a: int; b: NestdRecTy |}) = {| x with b.G.b = "a" |} -let t7 (x: {| a: int; b: NestdRecTy |}) = {| x with c.D = "a" |} +let t5 (x: {| a: int; b: NestedRecTy |}) = {| x with b.C = "a" |} +let t6 (x: {| a: int; b: NestedRecTy |}) = {| x with b.G.b = "a" |} +let t7 (x: {| a: int; b: NestedRecTy |}) = {| x with c.D = "a" |} """ |> withLangVersion80 |> typecheck |> shouldFail |> withDiagnostics [ (Error 39, Line 8, Col 25, Line 8, Col 26, "The record label 'A' is not defined.") - (Error 1129, Line 9, Col 23, Line 9, Col 24, "The record type 'NestdRecTy' does not contain a label 'C'.") + (Error 1129, Line 9, Col 23, Line 9, Col 24, "The record type 'NestedRecTy' does not contain a label 'C'.") (Error 1129, Line 10, Col 25, Line 10, Col 26, "The record type '{| a: int |}' does not contain a label 'b'.") (Error 39, Line 11, Col 21, Line 11, Col 22, "The namespace or module 'C' is not defined.") - (Error 1129, Line 12, Col 55, Line 12, Col 56, "The record type 'NestdRecTy' does not contain a label 'C'.") - (Error 1129, Line 13, Col 57, Line 13, Col 58, "The record type '{| a: int |}' does not contain a label 'b'.") - (Error 1129, Line 14, Col 53, Line 14, Col 54, "The record type '{| a: int; b: NestdRecTy |}' does not contain a label 'c'.") + (Error 1129, Line 12, Col 56, Line 12, Col 57, "The record type 'NestedRecTy' does not contain a label 'C'.") + (Error 1129, Line 13, Col 58, Line 13, Col 59, "The record type '{| a: int |}' does not contain a label 'b'.") + (Error 1129, Line 14, Col 54, Line 14, Col 55, "The record type '{| a: int; b: NestedRecTy |}' does not contain a label 'c'.") ] [] @@ -481,4 +479,4 @@ if actual <> expected then """ |> withLangVersion80 |> compileExeAndRun - |> verifyOutput "once" \ No newline at end of file + |> verifyOutput "once" diff --git a/tests/FSharp.Compiler.ComponentTests/Language/DiscriminatedUnionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/DiscriminatedUnionTests.fs index 6d2d0d24c28..fe2963643f3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/DiscriminatedUnionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/DiscriminatedUnionTests.fs @@ -15,7 +15,6 @@ let foo = Foo.Foo "hi" if not foo.IsFoo then failwith "Should be Foo" if foo.IsBar then failwith "Should not be Bar" """ - |> withLangVersionPreview |> compileExeAndRun |> shouldSucceed @@ -27,7 +26,6 @@ let foo = Foo.Bar "hi" if not foo.IsBar then failwith "Should be Bar" """ - |> withLangVersionPreview |> typecheck |> shouldFail |> withDiagnostics [Error 39, Line 4, Col 12, Line 4, Col 17, "The type 'Foo' does not define the field, constructor or member 'IsBar'. Maybe you want one of the following: @@ -45,7 +43,6 @@ let inline test<'a when 'a: (member IsA: bool)> (v: 'a) = X.A "a" |> test """ - |> withLangVersionPreview |> compileExeAndRun |> shouldSucceed @@ -61,10 +58,10 @@ let foo = X.a 1 if not foo.Isa then failwith "Should be a" if foo.IsA then failwith "Should not be A" """ - |> withLangVersionPreview |> compileExeAndRun |> shouldSucceed + [] let ``Is* discriminated union properties with backticks are visible, proper values are returned`` () = Fsx """ @@ -77,7 +74,6 @@ let marsbar = ``Mars Bar`` if marsbar.IsFoo then failwith "Should not be Foo" if not marsbar.``IsMars Bar`` then failwith "Should be ``Mars Bar``" """ - |> withLangVersionPreview |> compileExeAndRun |> shouldSucceed @@ -99,7 +95,6 @@ type Foo = | Foo of string | Bar """ - |> withLangVersionPreview |> compileExeAndRun |> shouldSucceed @@ -128,7 +123,6 @@ module Main = if isBar then failwith "Should not be Bar" 0 """ - |> withLangVersionPreview |> compileExeAndRun |> shouldSucceed @@ -140,12 +134,12 @@ type Foo = | Foo of string | Bar let foo = Foo.Foo "hi" let isFoo = foo.IsFoo """ - |> withLangVersionPreview |> typecheck |> shouldFail |> withErrorMessage "The type 'Foo' does not define the field, constructor or member 'IsFoo'. Maybe you want one of the following: Foo" + [] let ``Is* discriminated union properties are unavailable on union case with lang version 8`` () = Fsx """ @@ -175,7 +169,6 @@ type PrimaryAssembly = let x = (PrimaryAssembly.Mscorlib).IsMscorlib """ - |> withLangVersionPreview |> compileExeAndRun |> shouldSucceed @@ -192,6 +185,5 @@ let giveMeZ () = Z if giveMeZ().IsX then failwith "Should not be X" """ - |> withLangVersionPreview |> compileExeAndRun |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs index 3d2333ec9a4..ab135a31be0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs @@ -47,7 +47,7 @@ let lambdaWhichAlwaysReturnsThree = _.3""" |> withErrorCodes [3584] [] -let ``Bug - bigger paranthesized expressions are not part of this feature`` () = +let ``Bug - bigger parenthesized expressions are not part of this feature`` () = Fsx """ let neverEndingLambda = _.(while true do ())""" |> withLangVersion80 @@ -77,7 +77,7 @@ let ``Bug - all of these should be an error`` (code:string) = |> withErrorCodes [3584] [] -let ``Underscore Dot ToString With Space Before Paranthesis - NonAtomic`` () = +let ``Underscore Dot ToString With Space Before Parenthesis - NonAtomic`` () = Fsx """ let x = "a" |> _.ToString () """ |> withLangVersion80 @@ -89,7 +89,7 @@ let x = "a" |> _.ToString () """ 'string -> 'a' but given a 'unit -> string' -The type 'string' does not match the type 'unit'""" ] +The type 'unit' does not match the type 'string'""" ] [] let ``Underscore Dot Curried Function With Arguments - NonAtomic`` () = @@ -147,7 +147,7 @@ let ``DotLambda does NOT generalize automatically to a member based SRTP`` () = |> withDiagnostics [(Error 72, Line 1, Col 28, Line 1, Col 47, "Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.")] [] -let ``DotLambda does allow member based SRTP if labelled explicitely`` () = +let ``DotLambda does allow member based SRTP if labelled explicitly`` () = Fsx "let inline myFunc<'a when 'a:(member WhatANiceProperty: int)> (x: 'a) = x |> _.WhatANiceProperty " |> withLangVersion80 |> typecheck @@ -249,7 +249,7 @@ let ``Regression 16318 typeof dotlambda should fail`` () = |> withDiagnostics [Error 72, Line 1, Col 10, Line 1, Col 18, "Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved."] [] -let ``Nested anonymous unary function shorthands fails because of ambigous discard`` () = +let ``Nested anonymous unary function shorthands fails because of ambiguous discard`` () = FSharp """ module One let a : string = {| Inner = (fun x -> x.ToString()) |} |> _.Inner([5] |> _.[0]) @@ -322,8 +322,8 @@ let onlyIdC (ids: MyId list) = ids |> List.choose _.IdC |> typecheck |> shouldFail |> withDiagnostics [ - (Error 23, Line 7, Col 17, Line 7, Col 20, "The member 'IdA' can not be defined because the name 'IdA' clashes with the union case 'IdA' in this type or module"); + (Error 23, Line 7, Col 17, Line 7, Col 20, "The member 'IdA' cannot be defined because the name 'IdA' clashes with the union case 'IdA' in this type or module"); (Error 812, Line 22, Col 51, Line 22, Col 56, "The syntax 'expr.id' may only be used with record labels, properties and fields"); - (Error 23, Line 17, Col 17, Line 17, Col 20, "The member 'IdC' can not be defined because the name 'IdC' clashes with the union case 'IdC' in this type or module"); + (Error 23, Line 17, Col 17, Line 17, Col 20, "The member 'IdC' cannot be defined because the name 'IdC' clashes with the union case 'IdC' in this type or module"); (Error 812, Line 24, Col 51, Line 24, Col 56, "The syntax 'expr.id' may only be used with record labels, properties and fields") ] \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/FixedBindings.fs b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/FixedBindings.fs index a99df0176e9..fbf2f609529 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/FixedBindings.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/FixedBindings.fs @@ -229,7 +229,7 @@ The type 'char' does not match the type 'byte'""") [] [] - let ``Pin int inref parmeter`` langVersion = + let ``Pin int inref parameter`` langVersion = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinIntInrefParameter.fs") |> withLangVersion langVersion |> ignoreWarnings @@ -243,7 +243,7 @@ The type 'char' does not match the type 'byte'""") [] [] - let ``Pin int outref parmeter`` langVersion = + let ``Pin int outref parameter`` langVersion = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinIntOutrefParameter.fs") |> withLangVersion langVersion |> ignoreWarnings @@ -469,7 +469,7 @@ module ExtendedFixedBindings = [] [] - let ``Pin int inref parmeter`` langVersion = + let ``Pin int inref parameter`` langVersion = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinIntInrefParameter.fs") |> withLangVersion langVersion |> ignoreWarnings @@ -482,7 +482,7 @@ module ExtendedFixedBindings = [] [] - let ``Pin int outref parmeter`` langVersion = + let ``Pin int outref parameter`` langVersion = FsFromPath (__SOURCE_DIRECTORY__ ++ "PinIntOutrefParameter.fs") |> withLangVersion langVersion |> ignoreWarnings diff --git a/tests/FSharp.Compiler.ComponentTests/Language/IndexerSetterParamArray.fs b/tests/FSharp.Compiler.ComponentTests/Language/IndexerSetterParamArray.fs index 071eb5f00f9..3aee7b76de3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/IndexerSetterParamArray.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/IndexerSetterParamArray.fs @@ -42,7 +42,7 @@ let v4 = t[1, 0] printfn $"v4 = {v4}" if v4 <> "set([|1; 0|], 7); get([|1; 0|])" then failwith "not right value D" -// Inference defaults to the array in absense of other information +// Inference defaults to the array in absence of other information let f idxs = t[ idxs ] <- "7" @@ -104,7 +104,7 @@ let v4 = t[2, 1, 0] printfn $"v4 = {v4}" if v4 <> "set(2, [|1; 0|], 7); get(2, [|1; 0|])" then failwith "not right value D" -// Inference defaults to the array in absense of other information +// Inference defaults to the array in absence of other information let f idxs = t[ 1, idxs ] <- "7" @@ -155,7 +155,7 @@ let v4 = t[1, 0] printfn $"v4 = {v4}" if v4 <> "set([|1; 0|], 7); get([|1; 0|])" then failwith "not right value D" -// Inference defaults to the array in absense of other information +// Inference defaults to the array in absence of other information let f idxs = t[ idxs ] <- "7" diff --git a/tests/FSharp.Compiler.ComponentTests/Language/InterpolatedStringsTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/InterpolatedStringsTests.fs index 856c5d46d3c..b4e2cc8eab9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/InterpolatedStringsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/InterpolatedStringsTests.fs @@ -140,7 +140,6 @@ type Foo () = let x = {strToPrint} printfn "%%s" x """ - |> withLangVersionPreview |> compileExeAndRun |> shouldSucceed |> withStdOutContains "abcde" @@ -151,7 +150,6 @@ printfn "%%s" x let x = {strToPrint} printfn "%%s" x """ - |> withLangVersionPreview |> compileExeAndRun |> shouldSucceed |> withStdOutContains """a @@ -170,7 +168,6 @@ let x = {formattableStr} : System.FormattableString assert(x.ArgumentCount = {argCount}) printfn "%%s" (System.Globalization.CultureInfo "en-US" |> x.ToString) """ - |> withLangVersionPreview |> compileExeAndRun |> shouldSucceed |> withStdOutContains "abcde" \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs new file mode 100644 index 00000000000..5a4f3dedf10 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs @@ -0,0 +1,263 @@ +module Language.NullableCSharpImport + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +let withStrictNullness cu = + cu + |> withCheckNulls + |> withWarnOn 3261 + |> withOptions ["--warnaserror+"] + +let typeCheckWithStrictNullness cu = + cu + |> withStrictNullness + |> typecheck + + +[] +let ``Passing null to IlGenerator BeginCatchBlock is fine`` () = + FSharp """module MyLibrary +open System.Reflection.Emit +open System + +let mutable logRefEmitCalls = true + +type ILGenerator with + member ilG.BeginCatchBlockAndLog (ty: Type | null) = + if logRefEmitCalls then + printfn "ilg%d.BeginCatchBlock(%A)" (abs <| hash ilG) ty + + ilG.BeginCatchBlock ty + +let doSomethingAboutIt (ilg:ILGenerator) = + ilg.BeginCatchBlockAndLog(null) +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Consuming C# generic API which allows struct and yet uses question mark on the typar`` () = + FSharp """module MyLibrary +let ec = + { new System.Collections.Generic.IEqualityComparer with + member this.Equals(x, y) = (x+0) = (y+0) + member this.GetHashCode(obj) = obj * 2} +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``TypeBuilder CreateTypeInfo with an upcast`` () = + FSharp """module MyLibrary +open System +open System.Reflection.Emit + +let createType (typB:TypeBuilder) : Type= + typB.CreateTypeInfo() :> Type +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``CurrentDomain ProcessExit add to event`` () = + FSharp """module MyLibrary +open System + +do System.AppDomain.CurrentDomain.ProcessExit |> Event.add (fun args -> failwith $"{args.GetHashCode()}") +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Consuming C# extension methods which allow nullable this`` () = + FSharp """module MyLibrary + +open System + +let asMemoryOnNonNull : Memory = + let bytes = [|0uy..11uy|] + let memory = bytes.AsMemory() + memory + +let asMemoryOnNull : Memory = + let bytes : (byte[]) | null = null + let memory = bytes.AsMemory() + memory +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Consuming LinkedList First and Last should warn about nullness`` () = + FSharp """module MyLibrary + +let ll = new System.Collections.Generic.LinkedList() +let x:System.Collections.Generic.LinkedListNode = ll.Last +let y:System.Collections.Generic.LinkedListNode = ll.First +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics + [ Error 3261, Line 4, Col 59, Line 4, Col 66, "Nullness warning: The types 'System.Collections.Generic.LinkedListNode' and 'System.Collections.Generic.LinkedListNode | null' do not have compatible nullability." + Error 3261, Line 4, Col 59, Line 4, Col 66, "Nullness warning: The types 'System.Collections.Generic.LinkedListNode' and 'System.Collections.Generic.LinkedListNode | null' do not have equivalent nullability." + Error 3261, Line 5, Col 59, Line 5, Col 67, "Nullness warning: The types 'System.Collections.Generic.LinkedListNode' and 'System.Collections.Generic.LinkedListNode | null' do not have compatible nullability." + Error 3261, Line 5, Col 59, Line 5, Col 67, "Nullness warning: The types 'System.Collections.Generic.LinkedListNode' and 'System.Collections.Generic.LinkedListNode | null' do not have equivalent nullability."] + +[] +let ``Nullable directory info show warn on prop access`` () = + FSharp """module MyLibrary +open System.IO +open System + +let d : DirectoryInfo | null = null +let s : string = d.Name // should warn here!! +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics [Error 3261, Line 6, Col 18, Line 6, Col 24, "Nullness warning: The types 'DirectoryInfo' and 'DirectoryInfo | null' do not have compatible nullability."] + +[] +let ``Consumption of netstandard2 BCL api which is not annotated`` () = + FSharp """module MyLibrary +open System.Reflection + +[] +type PublicKey = + | PublicKey of byte[] + | PublicKeyToken of byte[] + +let FromAssemblyName (aname: AssemblyName) = + match aname.GetPublicKey() with + | Null + | NonNull [||] -> + match aname.GetPublicKeyToken() with + | Null + | NonNull [||] -> None + | NonNull bytes -> Some(PublicKeyToken bytes) + | NonNull bytes -> Some(PublicKey bytes)""" + |> asLibrary + |> asNetStandard20 + |> typeCheckWithStrictNullness + |> shouldSucceed + + +[] +let ``Consumption of nullable C# - no generics, just strings in methods and fields`` () = + let csharpLib = + CSharp """ + #nullable enable + namespace Nullables { + public class NullableClass { + // Fields with nullable type + public static string NotNullField; + // Fields with non-nullable type + public static string? MaybeNullField; + // Methods which return nullable string + public static string? ReturnsNullableStringNoParams() { return null; } + public static string? ReturnsNullableString1NullableParam(string? _) { return null; } + public static string? ReturnsNullableString1NonNullableParam(string _) { return null; } + public static string? ReturnsNullableString2NullableParams(string? _, string? __) { return null; } + public static string? ReturnsNullableString2NonNullableParams(string _, string __) { return null; } + public static string? ReturnsNullableString1Nullable1NonNullableParam(string? _, string __) { return null; } + + // Methods which return non-nullable string + public static string ReturnsNonNullableStringNoParams() { return ""; } + public static string ReturnsNonNullableString1NullableParam(string? _) { return ""; } + public static string ReturnsNonNullableString1NonNullableParam(string _) { return ""; } + public static string ReturnsNonNullableString2NullableParams(string? _, string? __) { return ""; } + public static string ReturnsNonNullableString2NonNullableParams(string _, string __) { return ""; } + public static string ReturnsNonNullableString1Nullable1NonNullableParam(string? _, string __) { return ""; } + } + }""" |> withName "csNullableLib" + + FSharp """ + module FSNullable + open Nullables + + let nullablestrNoParams : string = NullableClass.ReturnsNullableStringNoParams() // Error here, line 5 + let nonNullableStrNoParams : string | null = NullableClass.ReturnsNonNullableStringNoParams() + let nullablestrNoParamsCorrectlyAnnotated : string | null = NullableClass.ReturnsNullableStringNoParams() + let nonNullableStrNoParamsCorrectlyAnnotated : string = NullableClass.ReturnsNonNullableStringNoParams() + let notNullField : string = NullableClass.NotNullField + let maybeNullField : string | null = NullableClass.MaybeNullField + let maybeNullField2 : string | null = NullableClass.NotNullField + + + let notNullField2 : string = NullableClass.MaybeNullField // Error here, line 14 + NullableClass.MaybeNullField <- null + NullableClass.NotNullField <- null // Error here, line 16 + + let notNullArg : string = "hello" + let maybeNullArg : string | null = "there" + + let nullableParamOk1 = NullableClass.ReturnsNullableString1NullableParam(notNullArg) + let nullableParamOk2 = NullableClass.ReturnsNullableString1NullableParam(maybeNullArg) + + let nonNullParamCallPass = NullableClass.ReturnsNullableString1NonNullableParam(notNullArg) + let nonNullParamCallFail = NullableClass.ReturnsNullableString1NonNullableParam(maybeNullArg) // Error here, 25 + + let mixedParams1 = NullableClass.ReturnsNullableString1Nullable1NonNullableParam(notNullArg,notNullArg) + let mixedParams2 = NullableClass.ReturnsNullableString1Nullable1NonNullableParam(maybeNullArg,maybeNullArg) // Error here, 28 + let mixedParams3 = NullableClass.ReturnsNullableString1Nullable1NonNullableParam(maybeNullArg,notNullArg) + let mixedParams4 = NullableClass.ReturnsNullableString1Nullable1NonNullableParam(notNullArg,maybeNullArg) // Error here, 30 + + + """ + |> asLibrary + |> withReferences [csharpLib] + |> withStrictNullness + |> compile + |> shouldFail + |> withDiagnostics [ + Error 3261, Line 5, Col 40, Line 5, Col 85, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." + Error 3261, Line 5, Col 40, Line 5, Col 85, "Nullness warning: The types 'string' and 'string | null' do not have equivalent nullability." + Error 3261, Line 14, Col 34, Line 14, Col 62, "Nullness warning: The types 'string' and 'string | null' do not have equivalent nullability." + Error 3261, Line 16, Col 35, Line 16, Col 39, "Nullness warning: The type 'string' does not support 'null'." + Error 3261, Line 25, Col 85, Line 25, Col 97, "Nullness warning: The types 'string' and 'string | null' do not have equivalent nullability." + Error 3261, Line 28, Col 99, Line 28, Col 111, "Nullness warning: The types 'string' and 'string | null' do not have equivalent nullability." + Error 3261, Line 30, Col 97, Line 30, Col 109, "Nullness warning: The types 'string' and 'string | null' do not have equivalent nullability."] + + +[] +let ``Regression 17701 - Nullable value type with nested generics`` () = + let csharpLib = + CSharp """ +using System; +using System.Collections.Immutable; +#nullable enable +namespace Nullables; +public class NullableClass { + public static ImmutableArray? nullableImmArrayOfStrings; + public static ImmutableArray? nullableImmArrayOfNotNullStrings; +}""" |> withName "csNullableLib" + |> withCSharpLanguageVersionPreview + + FSharp """module FSNullable +open Nullables + +let nullablestrNoParams = NullableClass.nullableImmArrayOfStrings +let toOption = NullableClass.nullableImmArrayOfStrings |> Option.ofNullable +let firstString = (toOption.Value |> Seq.head) +let lengthOfIt = firstString.Length + +let theOtherOne = NullableClass.nullableImmArrayOfNotNullStrings + """ + |> asLibrary + |> withReferences [csharpLib] + |> withStrictNullness + |> withLangVersionPreview + |> compile + |> shouldFail + |> withDiagnostics + [Error 3261, Line 7, Col 18, Line 7, Col 36, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability."] + + diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableLibraryConstructsTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableLibraryConstructsTests.fs new file mode 100644 index 00000000000..e9542620f7a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableLibraryConstructsTests.fs @@ -0,0 +1,58 @@ +module Language.NullableLibraryConstructs + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +let typeCheckWithStrictNullness cu = + cu + |> withCheckNulls + |> withWarnOn 3261 + |> withOptions ["--warnaserror+"] + |> typecheck + +[] +let ``Can unsafely forgive null using Unchecked nonNull function`` () = + FSharp """module MyLibrary + +let readAllLines (reader:System.IO.StreamReader) : seq = + seq { + while not reader.EndOfStream do + reader.ReadLine() |> Unchecked.nonNull + } +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Can unsafely forgive null using Unchecked NonNullQuick active pattern`` () = + FSharp """module MyLibrary + +let readAllLines (reader:System.IO.StreamReader) : seq = + seq { + while not reader.EndOfStream do + match reader.ReadLine() with + | Unchecked.NonNullQuick line -> yield line + } +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Can concat two maybe null strings`` () = + FSharp """module MyLibrary + +let addStrings (x:string | null) (y:string) : string = + + let s2 = x + x + let s3 = y + y + let s4 = y + x + let s4string : string = s4 + + s4 +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs new file mode 100644 index 00000000000..de6d1c888ca --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs @@ -0,0 +1,1035 @@ +module Language.NullableReferenceTypes + +open Xunit +open FSharp.Test.Compiler + +let withNullnessOptions cu = + cu + |> withCheckNulls + |> withWarnOn 3261 + |> withWarnOn 3262 + |> withNoWarn 52 //The value has been copied to ensure the original.. + |> withNoWarn 60 // Override implementations in augmentations are now deprecated... + |> withOptions ["--warnaserror+"] + +let typeCheckWithStrictNullness cu = + cu + |> withNullnessOptions + |> typecheck + +[] +let ``Does not duplicate warnings`` () = + FSharp """ +module MyLib +let getLength (x: string | null) = x.Length + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics [Error 3261, Line 3, Col 36, Line 3, Col 44, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability."] + + +[] +let ``Cannot pass possibly null value to a strict function``() = + FSharp """ +module MyLib +let strictFunc(x:string) = () +let nonStrictFunc(x:string | null) = strictFunc(x) + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics [ + Error 3261, Line 4, Col 49, Line 4, Col 50, "Nullness warning: The types 'string' and 'string | null' do not have equivalent nullability."] + +[] +[] +[] +[] +[ fileExists")>] +[ fileExists")>] +[] +[] +[ System.IO.File.Exists")>] +[ System.IO.File.Exists")>] +[] +let ``Calling a nullAllowing API can still infer a withoutNull type``(functionCall) = + FSharp $""" +module MyLib + +let myStrictFunc(x: string) = x.GetHashCode() +let fileExists (path:string|null) = true + +let myStringReturningFunc (path) = + let ex = {functionCall} + myStrictFunc(path) + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +//[] +// TODO Tomas - as of now, this does not bring the desired result +let ``Type inference with underscore or null`` () = + FSharp $""" +module MyLib + +let myFunc (path: _ | null) = + System.IO.File.Exists(path) + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Type inference SystemIOFileExists`` () = + FSharp $""" +module MyLib + +let test() = + let maybeString : string | null = null + System.IO.File.Exists(maybeString) + +let myFunc path : string = + let exists = path |> System.IO.File.Exists + path + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Type inference fsharp func`` () = + FSharp $"""module MyLib + +let fileExists (path:string|null) = true +let myStringReturningFunc (pathArg) : string = + let ex = pathArg |> fileExists + pathArg + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + + +// P1: inline or not +// P2: type annotation for function argument +// P3: type annotation for cache +let MutableBindingAnnotationCombinations = + [| + for functionInlineFlag in ["" + "inline"] do + for xArg in ["" + ":'T" + ":'T|null" + ": _" + ": _|null" + ": string|null" + ": string"] do + // No annotation or _ must work all the time + for cacheArg in ["" + ": _"] do + yield [|functionInlineFlag :> obj; xArg :> obj; cacheArg :> obj|] + + // If we have a named type, the same one must work for cache binding as well + if xArg.Contains("'T") || xArg.Contains("string|null") then + yield [|functionInlineFlag :> obj; xArg :> obj; xArg :> obj|] + + // If we have a type WithNull, using _|null should infer the exact same type + if xArg.Contains("|null") || xArg.Contains("string") then + yield [|functionInlineFlag :> obj; xArg :> obj; ":_|null" :> obj|] + + if xArg = ":'T" then + for guard in [" when 'T:null" + " when 'T:null and 'T:not struct"] do + yield [|functionInlineFlag :> obj; (xArg + guard) :> obj; "" :> obj|] + + if xArg = ":'T|null" then + for guard in [" when 'T:not struct" + " when 'T:not null" + " when 'T:not struct and 'T:not null"] do + yield [|functionInlineFlag :> obj; (xArg + guard) :> obj; "" :> obj|] + |] + +[] +[] +let ``Mutable binding with a null literal`` inln xArg cache = + FSharp $"""module MyLib + +let %s{inln} f (x %s{xArg}) = + let mutable cache %s{cache} = null + cache <- x + + match cache with + | null -> failwith "It was null" + | c -> c + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Mutable string binding initially assigned to null should not need type annotation``() = + FSharp """ +module MyLib + + +let name = "abc" +let mutable cache = null +cache <- name + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Mutable string binding assigned to null and matched against null``() = + FSharp """ +module MyLib + +let whatEver() = + let mutable x = null + x <- "abc" + x + + +(* This is a comment +let name = "abc" +let mutable cache = null +cache <- name + +match cache with +| null -> () +| c -> ()*) + + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Mutable cache binding initially assigned to null should not need type annotation``() = + FSharp """ +module MyLib +open System.Collections.Concurrent +open System + +let mkCacheInt32 () = + let mutable topLevelCache = null + + fun f (idx: int32) -> + let cache = + match topLevelCache with + | null -> + let v = ConcurrentDictionary(Environment.ProcessorCount, 11) + topLevelCache <- v + v + | v -> v + + match cache.TryGetValue idx with + | true, res -> res + | _ -> + let res = f idx + cache[idx] <- res + res + + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Can infer underscore or null``() = + FSharp """ +module MyLib +let iAcceptNullPartiallyInferred(arg: _ | null) = 42 +let iHaveMissingContraint(arg: 'a | null) = 42 + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Invalid usages of WithNull syntax``() = + FSharp """ +module MyLib +let f1(x: option | null) = () +let f2(x: int | null) = () +let f3(x: ('a*'b) | null) = () +let f4(x: option<'a> | null) = () +let f5(x: ('a | null) when 'a:struct) = () +let f6(x: 'a | null when 'a:null) = () + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics + [ Error 3261, Line 3, Col 11, Line 3, Col 32, "Nullness warning: The type 'string option' uses 'null' as a representation value but a non-null type is expected." + Error 3260, Line 4, Col 11, Line 4, Col 21, "The type 'int' does not support a nullness qualification." + Error 43, Line 4, Col 11, Line 4, Col 21, "A generic construct requires that the type 'int' have reference semantics, but it does not, i.e. it is a struct" + Error 3260, Line 5, Col 11, Line 5, Col 25, "The type '('a * 'b)' does not support a nullness qualification." + Error 3261, Line 6, Col 11, Line 6, Col 28, "Nullness warning: The type ''a option' uses 'null' as a representation value but a non-null type is expected." + Error 43, Line 7, Col 28, Line 7, Col 37, "The constraints 'struct' and 'not struct' are inconsistent" + Error 43, Line 8, Col 26, Line 8, Col 33, "The constraints 'null' and 'not null' are inconsistent"] + +[] +let ``Boolean literal to string is not nullable`` () = + FSharp """module MyLibrary +let onlyWantNotNullString(x:string) = () + +let processBool () : string = + onlyWantNotNullString (true.ToString()) + onlyWantNotNullString (false.ToString()) + + true.ToString() +""" + |> asLibrary + |> withNoWarn 52 // The value has been copied to ensure the original is not mutated... + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Boolean to string is not nullable`` () = + FSharp """module MyLibrary +let onlyWantNotNullString(x:string) = () + +let processBool (b:bool) : string = + let asString = b.ToString() + asString +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let duWithExtensionProvidedToString = """A | B +module Functions = + let printMyType (x:MyCustomType) : string = "xxx" +type MyCustomType with + override x.ToString() : string = Functions.printMyType x + """ + +[] +let duWithExtensionProvidedNullableToString = """A | B + +type MyCustomType with + override x.ToString() = null + """ + +let toStringCodeSnippet myTypeDef = + FSharp $"""module MyLibrary + +type MyCustomType = {myTypeDef} + +let onlyWantNotNullString(x:string) = () + +let processBool (x:MyCustomType) = + onlyWantNotNullString(x.ToString()) +""" + |> asLibrary + |> typeCheckWithStrictNullness + +[] +[] +[] +[] +[ string """)>] +[] +[] +[] +[] +[] +[] +let ``Generated ToString() methods are not nullable`` (myTypeDef) = + toStringCodeSnippet myTypeDef + |> shouldSucceed + +[] +[] +[] +let ``ToString override warns if it returns nullable`` (myTypeDef) = + toStringCodeSnippet myTypeDef + |> shouldFail + |> withDiagnosticMessage "With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function." + +[] +let ``Printing a nullable string should pass`` () = + FSharp """module MyLibrary +let maybeNull : string | null = null +let nonNullString = "abc" +let printedValueNotNull = sprintf "This is not null: %s" nonNullString +let printedValueNull = sprintf "This is null: %s" maybeNull +let interpolated = $"This is fine %s{maybeNull}" +let interpolatedAnnotatedNotNull = $"This is fine %s{nonNullString}" +let interpolatedAnnotatedNullable = $"This is not null %s{maybeNull}" +let interpolateNullLiteral = $"This is not null %s{null}" +let sprintfnNullLiteral = sprintf "This is null: %s" null +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + + +[] +let ``Printing a nullable object should pass`` () = + FSharp """module MyLibrary +let maybeNull : string | null = null +let maybeUri : System.Uri | null = null +let okString = "abc" +let printViaO = sprintf "This is null: %O and this is null %O and this is not null %O" maybeNull maybeUri okString +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + + +[] +let ``Printing a nullable array via percent A should pass`` () = + FSharp """module MyLibrary +let maybeArray : ((string array) | null) = null +let arrayOfMaybes : ((string | null) array ) = [|null|] +let printViaA = sprintf "This is null: %A and this has null inside %A" maybeArray arrayOfMaybes +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Type inference with sprintfn`` () = + FSharp """module MyLibrary +let needsString(x:string) = () + +let myTopFunction inferredVal = + printfn "This is it %s" inferredVal // There was a regression inferring this to be (string | null) + needsString inferredVal +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``WhatIf the format itself is null`` () = + FSharp """module MyLibrary +[] +let thisCannotBeAFormat : string | null = null +[] +let maybeLiteral : string | null = "abc" +[] +let maybeLiteralWithHole : string | null = "Look at me %s" +[] +let notNullLiteral : string = "abc" +let doStuff() = + printfn notNullLiteral + printfn maybeLiteral + printfn maybeLiteralWithHole thisCannotBeAFormat +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Match null on two strings`` () = + FSharp """module MyLibrary +let len2r (str1: string | null) (str2: string | null) = + match str1, str2 with + | null, _ -> -1 + | _, null -> -1 + | s1, s2 -> s1.Length + s2.Length +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +[] +[] +[] +[] +[] +[] +let ``Eliminate nullness after matching`` (tp) = + FSharp $"""module MyLibrary + +let myFunction (input : string | null) : string = + match input with + | {tp} -> "" + | nonNullString -> nonNullString +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +[] +[] +let ``Eliminate tupled nullness after matching`` (tp) = + FSharp $"""module MyLibrary + +let myFunction (input1 : string | null) (input2 : string | null): (string*string) = + match input1,input2 with + | {tp} -> "","" + | nns1,nns2 -> nns1,nns2 +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + + +[] +[] +[] +[] +[] +[] +[] +let ``Should NOT eliminate tupled nullness after matching`` (tp) = + FSharp $"""module MyLibrary + +let myFunction (input1 : string | null) (input2 : string | null): (string*string) = + match input1,input2 with + | %s{tp} -> "","" + | nns1,nns2 -> nns1,nns2 +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withErrorCode 3261 + +[] +let ``Eliminate aliased nullness after matching`` () = + FSharp $"""module MyLibrary + +type Maybe<'T when 'T:not struct> = 'T | null + +let myFunction (input : string Maybe) : string = + match input with + | null -> "" + | nonNullString -> nonNullString +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``WithNull used on anon type`` () = + FSharp """module MyLibrary + +let maybeAnon : _ | null = {|Hello="there"|} +let maybeAnon2 : {|Hello:string|} | null = null +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics + [ Error 3260, Line 4, Col 18, Line 4, Col 41, "The type '{| Hello: string |}' does not support a nullness qualification." + Error 43, Line 4, Col 44, Line 4, Col 48, "The type '{| Hello: string |}' does not have 'null' as a proper value"] + + +[] +let ``WithNull on a DU`` () = + FSharp """module MyLibrary + +type MyDu = A | B + + +let strictFunc(arg: 'x when 'x : not null) = + printfn "%A" arg + arg + +let looseFunc(arg: _ | null) = arg + +strictFunc(A) |> ignore +looseFunc(A) |> ignore + +let maybeDu : _ | null = MyDu.A +let maybeDu2 : _ | null = null + +strictFunc(maybeDu) |> ignore +strictFunc(maybeDu2) |> ignore + +looseFunc(maybeDu2) |> ignore +looseFunc(maybeDu2) |> ignore + +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics [ + Error 3261, Line 18, Col 12, Line 18, Col 19, "Nullness warning: The type 'MyDu | null' supports 'null' but a non-null type is expected." + Error 3261, Line 19, Col 12, Line 19, Col 20, "Nullness warning: The type ''a | null' supports 'null' but a non-null type is expected."] + +[] +let ``Strict func handling of obj type`` () = + FSharp """module MyLibrary +let strictFunc(arg: 'x when 'x : not null) = printfn "%s" (arg.ToString()) + +strictFunc("hi") |> ignore +strictFunc({|Anon=5|}) |> ignore +strictFunc(null:obj) |> ignore +strictFunc(null:(obj|null)) |> ignore +strictFunc(null:(string|null)) |> ignore + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics + [ Error 3261, Line 6, Col 12, Line 6, Col 16, "Nullness warning: The type 'obj' does not support 'null'." + Error 3261, Line 7, Col 12, Line 7, Col 27, "Nullness warning: The type 'obj | null' supports 'null' but a non-null type is expected." + Error 3261, Line 8, Col 12, Line 8, Col 30, "Nullness warning: The type 'string | null' supports 'null' but a non-null type is expected."] + + + +[] +let ``Strict func null literal`` () = + FSharp """module MyLibrary +let strictFunc(arg: 'x when 'x : not null) = printfn "%s" (arg.ToString()) + +strictFunc(null) |> ignore """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics + [ Error 43, Line 4, Col 12, Line 4, Col 16, "The constraints 'null' and 'not null' are inconsistent"] + +[] +let ``Strict func null literal2`` () = + FSharp """module MyLibrary +let strictFunc(arg: 'x when 'x : not null) = printfn "%s" (arg.ToString()) + +strictFunc(null) |> ignore +strictFunc({|Anon=5|}) |> ignore +strictFunc("hi") |> ignore """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics + [ Error 43, Line 4, Col 12, Line 4, Col 16, "The constraints 'null' and 'not null' are inconsistent"] + +[] +let ``Supports null in generic code`` () = + FSharp """module MyLibrary +let myGenericFunction p = + match p with + | null -> () + | p -> printfn "%s" (p.ToString()) + +[] +type X(p:int) = + member _.P = p + +let myValOfX : X = null + +myGenericFunction "HiThere" +myGenericFunction ("HiThere":string | null) +myGenericFunction (System.DateTime.Now) +myGenericFunction 123 +myGenericFunction myValOfX + +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics + [Error 3261, Line 13, Col 19, Line 13, Col 28, "Nullness warning: The type 'string' does not support 'null'." + Error 193, Line 15, Col 20, Line 15, Col 39, "The type 'System.DateTime' does not have 'null' as a proper value" + Error 1, Line 16, Col 19, Line 16, Col 22, "The type 'int' does not have 'null' as a proper value"] + +[] +let ``Null assignment in generic code`` () = + FSharp """module MyLibrary +let myNullReturningFunction p = + let mutable x = p + x <- null + x + +[] +type X(p:int) = + member _.P = p + +type Y (p:int) = + member _.P = p + +let myValOfX : X = null +let myValOfY : Y = Unchecked.defaultof + +myNullReturningFunction "HiThere" |> ignore +myNullReturningFunction ("HiThere":string | null) |> ignore +myNullReturningFunction (System.DateTime.Now) |> ignore +myNullReturningFunction {|Anon=42|} |> ignore +myNullReturningFunction (1,2,3) |> ignore +myNullReturningFunction myValOfX |> ignore +myNullReturningFunction myValOfY |> ignore + +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics + [Error 3261, Line 17, Col 25, Line 17, Col 34, "Nullness warning: The type 'string' does not support 'null'." + Error 193, Line 19, Col 26, Line 19, Col 45, "The type 'System.DateTime' does not have 'null' as a proper value" + Error 1, Line 20, Col 25, Line 20, Col 36, "The type '{| Anon: 'a |}' does not have 'null' as a proper value" + Error 1, Line 21, Col 26, Line 21, Col 31, "The type '('a * 'b * 'c)' does not have 'null' as a proper value" + Error 1, Line 23, Col 25, Line 23, Col 33, "The type 'Y' does not have 'null' as a proper value"] + + +[] +let ``Match null with int`` () = + FSharp """module MyLibrary +let test = + match null with + | null -> true + | 42 -> false + +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics + [Error 1, Line 5, Col 7, Line 5, Col 9, "The type 'int' does not have 'null' as a proper value. See also test.fs(3,10)-(3,14)." + Error 25, Line 3, Col 11, Line 3, Col 15, "Incomplete pattern matches on this expression."] + + +[] +let ``Nullness support for F# types`` () = + FSharp """module MyLibrary +type MyDu = A | B +type MyRecord = {X:int;Y:string} + +let strictFunc(arg: 'x when 'x : not null) = + printfn "%A" arg + arg + +let looseFunc(arg: _ | null) = arg + +strictFunc(A) |> ignore +strictFunc({X=1;Y="a"}) |> ignore +strictFunc({|ZZ=15;YZ="a"|}) |> ignore +strictFunc((1,2,3)) |> ignore + +looseFunc(A) |> ignore +looseFunc({X=1;Y="a"}) |> ignore +looseFunc({|ZZ=15;YZ="a"|}) |> ignore +looseFunc((1,2,3)) |> ignore + +strictFunc(null) |> ignore +looseFunc(null) |> ignore + +let maybeDu : _ | null = MyDu.A +let maybeRecd : MyRecord | null = {X=1;Y="a"} +let maybeAnon : _ | null = {|Hello="there"|} +let maybeTuple : (int*int) | null = null + +strictFunc(maybeDu) |> ignore +strictFunc(maybeRecd) |> ignore +strictFunc(maybeAnon) |> ignore +strictFunc(maybeTuple) |> ignore + +looseFunc(maybeDu) |> ignore +looseFunc(maybeRecd) |> ignore +looseFunc(maybeAnon) |> ignore +looseFunc(maybeTuple) |> ignore + +type Maybe<'T> = 'T | null +let maybeTuple2 : Maybe = null +strictFunc(maybeTuple2) |> ignore +looseFunc(maybeTuple2) |> ignore +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics + [ Error 43, Line 21, Col 12, Line 21, Col 16, "The constraints 'null' and 'not null' are inconsistent" + Error 3260, Line 27, Col 18, Line 27, Col 34, "The type '(int * int)' does not support a nullness qualification." + Error 43, Line 27, Col 37, Line 27, Col 41, "The type '(int * int)' does not have 'null' as a proper value" + Error 3261, Line 29, Col 12, Line 29, Col 19, "Nullness warning: The type 'MyDu | null' supports 'null' but a non-null type is expected." + Error 3261, Line 30, Col 12, Line 30, Col 21, "Nullness warning: The type 'MyRecord | null' supports 'null' but a non-null type is expected." + Error 43, Line 40, Col 36, Line 40, Col 40, "The type 'Maybe' does not have 'null' as a proper value"] + +[] +let ``Static member on Record with null arg`` () = + FSharp """module MyLibrary + +type MyRecord = {X:string;Y:int} + with static member Create(x:string) = {X=x;Y = 42} + +let thisWorks = MyRecord.Create("xx") +let thisShouldWarn = MyRecord.Create(null) +let maybeNull : string | null = "abc" +let thisShouldAlsoWarn = MyRecord.Create(maybeNull) +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics + [Error 3261, Line 7, Col 38, Line 7, Col 42, "Nullness warning: The type 'string' does not support 'null'." + Error 3261, Line 9, Col 42, Line 9, Col 51, "Nullness warning: The types 'string' and 'string | null' do not have equivalent nullability."] + + +[] +let ``Option ofObj should remove nullness when used in a function`` () = + FSharp """module MyLibrary +let processOpt2 (s: string | null) : string option = Option.ofObj s""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Option ofObj should remove nullness when piping`` () = + FSharp """module MyLibrary +let processOpt (s: string | null) : string option = + let stringOpt = Option.ofObj s + stringOpt +let processOpt3 (s: string | null) : string option = s |> Option.ofObj +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Option ofObj called in a useless way raises warning`` () = + FSharp """module MyLibrary + +let processOpt1 (s: string) = Option.ofObj s +let processOpt2 (s: string) : option = + Option.ofObj s +let processOpt3 (s: string) : string option = + let sOpt = Option.ofObj s + sOpt +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics + [ Error 3262, Line 3, Col 44, Line 3, Col 45, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value." + Error 3262, Line 5, Col 18, Line 5, Col 19, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value." + Error 3262, Line 7, Col 29, Line 7, Col 30, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value."] + + +[] +let ``Option ofObj called on a string literal`` () = + FSharp """module MyLibrary +let whatIsThis = Option.ofObj "abc123" +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withErrorCodes [3262] + +[] +let ``Option ofObj for PathGetDirectoryName`` () = + FSharp """module MyLibrary +open System.IO + +let dirName = Path.GetDirectoryName "" +let whatIsThis1 = Option.ofObj dirName +let whatIsThis2 = Option.ofObj ( Path.GetDirectoryName "" ) +let whatIsThis3 = Option.ofObj ("" |> Path.GetDirectoryName ) // Warnings were happening at this line only +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Option ofObj with fully annotated nullsupportive func`` () = + FSharp """module MyLibrary + +let nullSupportiveFunc (x: string | null) : string | null = x +let maybePath : string | null = null +let whatIsThis3 = Option.ofObj (maybePath |> nullSupportiveFunc) +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Option ofObj with calling id inside`` () = + FSharp """module MyLibrary + +let maybePath : string | null = null +let whatIsThis5 = Option.ofObj (id maybePath) +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Useless null pattern match`` () = + FSharp """module MyLibrary + +let clearlyNotNull = "42" +let mappedVal = + match clearlyNotNull with + | null -> 42 + | _ -> 43 +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics [Error 3261, Line 6, Col 7, Line 6, Col 11, "Nullness warning: The type 'string' does not support 'null'."] + +[] +let ``Useless usage of nonNull utility from fscore`` () = + FSharp """module MyLibrary + +let clearlyNotNull = "42" +let mappedVal = nonNull clearlyNotNull +let maybeNull : string | null = null +let mappedMaybe = nonNull maybeNull +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics [Error 3262, Line 4, Col 25, Line 4, Col 39, "Value known to be without null passed to a function meant for nullables: You can remove this `nonNull` assertion."] + +[] +let ``Regression: Useless usage in nested calls`` () = + FSharp """module MyLibrary +open System.IO + +let meTry = Option.ofObj (Path.GetDirectoryName "") +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + + +[] +let ``Useless usage of null active patterns from fscore`` () = + FSharp """module MyLibrary + +let clearlyNotNull = "42" +let mapped1 = + match clearlyNotNull with + | NonNullQuick safe -> safe + +let mapped2 = + match clearlyNotNull with + |Null -> 0 + |NonNull _ -> 1 +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics + [ Error 3262, Line 6, Col 7, Line 6, Col 24, "Value known to be without null passed to a function meant for nullables: You can remove this |NonNullQuick| pattern usage." + Error 3262, Line 10, Col 6, Line 10, Col 10, "Value known to be without null passed to a function meant for nullables: You can remove this |Null|NonNull| pattern usage." + Error 3262, Line 11, Col 6, Line 11, Col 15, "Value known to be without null passed to a function meant for nullables: You can remove this |Null|NonNull| pattern usage."] + +[] +let ``Obj can be passed to not null constrained methods`` () = + FSharp """module MyLibrary + +let objVal:(obj | null) = box 42 + + +let mappableFunc = + match objVal with + |Null -> 42 + |NonNull o -> o.GetHashCode() +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Importing and processing contravariant interfaces`` () = + + FSharp """module MyLibrary + +open System +open System.Collections.Concurrent +open System.Collections.Generic + + +let cmp1 : IEqualityComparer = StringComparer.Ordinal +let cmp2 : IEqualityComparer = StringComparer.Ordinal +let stringHash = cmp2.GetHashCode("abc") +let nullHash = cmp2.GetHashCode(null) +let nullEquals = cmp2.Equals("abc", null) + +let dict = ConcurrentDictionary (StringComparer.Ordinal) +dict["ok"] <- 42 + +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + + +[] +let ``Notnull constraint and inline annotated value`` () = + FSharp """module MyLibrary +open System + +let f3 (x: 'T when 'T : not null) = 1 + +let v3 = f3 (null: obj) +let v4 = f3 (null: String | null) +let v5 = f3 (Some 1) + +let w3 = (null: obj) |> f3 +let w4 = (null: String | null) |> f3 + +let v3WithNull = f3 (null: obj | null) +""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> withDiagnostics + [ Error 3261, Line 6, Col 14, Line 6, Col 18, "Nullness warning: The type 'obj' does not support 'null'." + Error 3261, Line 7, Col 14, Line 7, Col 33, "Nullness warning: The type 'String | null' supports 'null' but a non-null type is expected." + Error 3261, Line 8, Col 14, Line 8, Col 20, "Nullness warning: The type ''a option' uses 'null' as a representation value but a non-null type is expected." + Error 3261, Line 10, Col 11, Line 10, Col 15, "Nullness warning: The type 'obj' does not support 'null'." + Error 3261, Line 11, Col 35, Line 11, Col 37, "Nullness warning: The type 'String | null' supports 'null' but a non-null type is expected." + Error 3261, Line 13, Col 22, Line 13, Col 38, "Nullness warning: The type 'obj | null' supports 'null' but a non-null type is expected."] + + +[] +let ``Option type detected as null for NullabilityInfoContext`` () = + + Fsx """ + +open System +open System.Reflection + +type MyClass(StringOrNull: string | null, StringOption: string option, ObjNull: objnull, ObjOrNull: obj | null) = + member val StringOrNull = StringOrNull + member val StringOption = StringOption + member val ObjNull = ObjNull + member val ObjOrNull = ObjOrNull + +let classType = typeof +let ctor = classType.GetConstructors() |> Seq.exactlyOne +let paramInfos = ctor.GetParameters() + + +let nrtContext = NullabilityInfoContext() +for paramInfo in paramInfos do + let nrtInfo = nrtContext.Create(paramInfo) + let readState = nrtInfo.ReadState + let writeState = nrtInfo.WriteState + printfn $"{paramInfo.Name} => {readState} / {writeState}" """ + |> withNullnessOptions + |> compile + |> run + |> verifyOutputContains [|"StringOption => Nullable / Nullable"|] + +[] +let ``Option type has WithNull annotation in IL`` () = + FSharp """ +module Test + +let myOption () : option = None """ + |> withNullnessOptions + |> compile + // The option<> itself is nullable (2), the string inside is not (1) + |> verifyIL [" + .method public static class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 myOption() cil managed + { + .param [0] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8[]) = ( 01 00 02 00 00 00 02 01 00 00 ) + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + }"] \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs new file mode 100644 index 00000000000..e6398675a01 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs @@ -0,0 +1,125 @@ +module Language.NullableRegressions + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +let withVersionAndCheckNulls (version,checknulls) cu = + cu + |> withLangVersion version + |> withWarnOn 3261 + |> withOptions ["--warnaserror+"] + |> if checknulls then withCheckNulls else id + + +[] +[] +[] +[] +let ``Micro compilation`` langVersion checknulls = + + FsFromPath (__SOURCE_DIRECTORY__ ++ "micro.fsi") + |> withAdditionalSourceFile (SourceFromPath (__SOURCE_DIRECTORY__ ++ "micro.fs")) + |> withLangVersion langVersion + |> fun x -> + if checknulls then + x |> withCheckNulls |> withDefines ["CHECKNULLS"] + else x + |> compile + |> shouldSucceed + +[] +let ``Existing positive v8 disabled`` compilation = + compilation + |> withVersionAndCheckNulls ("8.0",false) + |> verifyBaseline + +[] +let ``Existing positive vPreview disabled`` compilation = + compilation + |> withVersionAndCheckNulls ("preview",false) + |> verifyBaseline + +[] +let ``Existing positive vPreview enabled`` compilation = + compilation + |> withVersionAndCheckNulls ("preview",true) + |> verifyBaseline + +[] +let ``Existing negative v8 disabled`` compilation = + compilation + |> withVersionAndCheckNulls ("8.0",false) + |> verifyBaseline + +[] +let ``Existing negative vPreview disabled`` compilation = + compilation + |> withVersionAndCheckNulls ("preview",false) + |> verifyBaseline + +[] +let ``Existing negative vPreview enabled`` compilation = + compilation + |> withVersionAndCheckNulls ("preview",true) + |> verifyBaseline + +[] +let ``Library functions nullness disabled`` compilation = + compilation + |> withVersionAndCheckNulls ("preview",false) + |> verifyBaseline + +[] +let ``Library functions nullness enabled`` compilation = + compilation + |> withVersionAndCheckNulls ("preview",true) + |> verifyBaseline + +[] +let ``With new nullness syntax nullness disabled`` compilation = + compilation + |> withVersionAndCheckNulls ("preview",false) + |> verifyBaseline + +[] +let ``DefaultValueBug when checknulls is disabled`` compilation = + compilation + |> withVersionAndCheckNulls ("preview",false) + |> verifyBaseline + +[] +let ``With new nullness syntax nullness enabled`` compilation = + compilation + |> withVersionAndCheckNulls ("preview",true) + |> verifyBaseline + + + +[] +[] +[] +[] +[] +[] +[] +let ``DefaultValue regression`` (version,checknulls,fullCompile) = + FSharp $""" +module MyLib + +[] +type C7 = + [] + val mutable Whoops : (int -> int) {if version="preview" then " | null" else ""} // no warnings in checknulls+ + """ + |> asLibrary + |> withVersionAndCheckNulls (version,checknulls) + |> (if fullCompile then compile else typecheck) + |> fun x -> + if checknulls then + x |> shouldSucceed + else + x + |> shouldFail + |> withDiagnostics + [(Error 444, Line 7, Col 17, Line 7, Col 23, "The type of a field using the 'DefaultValue' attribute must admit default initialization, i.e. have 'null' as a proper value or be a struct type whose fields all admit default initialization. You can use 'DefaultValue(false)' to disable this check")] diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-negative.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-negative.fs new file mode 100644 index 00000000000..2f46eb0370e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-negative.fs @@ -0,0 +1,52 @@ +module ExistingNegative + +open System +open System.Diagnostics +open System.Runtime.CompilerServices + +module NullConstraintTests = + type C<'T when 'T : null>() = class end + + let f1 (y : C< (int * int) >) = y // This gave an error in F# 4.5 and we expect it to continue to give an error + + let f2 (y : C) = y // This gave an error in F# 4.5 and we expect it to continue to give an error + + let f3 (y : C int>) = y // This gave an error in F# 4.5 and we expect it to continue to give an error + +module DefaultValueTests = + + module StructExamples = + [] + type C1 = + [] + val mutable Whoops : String // expect an error if checknulls is on + + [] + type C4a = + [] + val mutable Whoops : int list // This gave an error in F# 4.5 and we expect it to continue to give an error + + [] + type C5 = + [] + val mutable Whoops : int * int // This gave an error in F# 4.5 and we expect it to continue to give an error + + [] + type C6 = + [] + val mutable Whoops : int -> int // This gave an error in F# 4.5 and we expect it to continue to give an error + + module ClassExamples = + + type C4a = + [] + val mutable Whoops : int list // Should have given an error in F# 4.5 but didn't. Expect a corrective error if checknulls is on + + type C5 = + [] + val mutable Whoops : int * int // Should have given an error in F# 4.5 but didn't. Expect a corrective error if checknulls is on + + type C6 = + [] + val mutable Whoops : int -> int // Should have given an error in F# 4.5 but didn't. Expect a corrective error if checknulls is on + diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-negative.fs.checknulls_on.err.bsl b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-negative.fs.checknulls_on.err.bsl new file mode 100644 index 00000000000..eaffe804e94 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-negative.fs.checknulls_on.err.bsl @@ -0,0 +1,3 @@ +existing-negative.fs (10,17)-(10,33) typecheck error The type '(int * int)' does not have 'null' as a proper value +existing-negative.fs (12,17)-(12,28) typecheck error The type 'int list' does not have 'null' as a proper value +existing-negative.fs (14,17)-(14,30) typecheck error The type '(int -> int)' does not have 'null' as a proper value \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-negative.fs.nullness_disabled.err.bsl b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-negative.fs.nullness_disabled.err.bsl new file mode 100644 index 00000000000..eaffe804e94 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-negative.fs.nullness_disabled.err.bsl @@ -0,0 +1,3 @@ +existing-negative.fs (10,17)-(10,33) typecheck error The type '(int * int)' does not have 'null' as a proper value +existing-negative.fs (12,17)-(12,28) typecheck error The type 'int list' does not have 'null' as a proper value +existing-negative.fs (14,17)-(14,30) typecheck error The type '(int -> int)' does not have 'null' as a proper value \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-positive.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-positive.fs new file mode 100644 index 00000000000..727a1a8b69d --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-positive.fs @@ -0,0 +1,69 @@ +module ExistingPositive +open System +open System.Diagnostics +open System.Runtime.CompilerServices + +module Extractions0a = + + let x = null + let result = (x = "") //The type 'string' does not support 'null'. + +module Extractions0b = + + let x = null + let f (x: 'T, y: 'T) = () + let result = f (x, "") //The type 'string' does not support 'null'. + +module Extractions0d = + + let x = null + let f<'T when 'T : null> (x: 'T, y: 'T) = () + let result = f (x, "") //The type 'string' does not support 'null'. + +module Basics = + let x1 : String = null // expect a warning when checknulls is on + let x4 : String = "" + +module Basics2 = + let f1 () = null + let f8 () : String = null // expect a warning when checknulls is on + +type C(s: String) = + member __.Value = s + +module InteropBasics = + let s0 = String.Concat("a","b") + let s1 : String = String.Concat("a","c") + let test1() = String.Concat("a","d") + let test2(s1:String, s2: String) = String.Concat(s1,s2) + let test3() = String( [| 'a' |] ) + let test4() = System.AppDomain.CurrentDomain + let test5 : System.AppDomain = System.AppDomain.CurrentDomain + +System.Console.WriteLine("a") +System.Console.WriteLine("a", (null: obj[])) // expect a warning when checknulls is on + +let f0 line = + let add (s:String) = () + match line with + | null | "" -> () //The type 'string' does not support 'null'. + | _ -> add line + +module NullConstraintTests = + type C<'T when 'T : null>() = class end + + let f3 (y : C) = y // expect a warning when checknulls is on + +module DefaultValueTests = + + module StructExamples = + + [] + type C2 = + [] + val mutable Whoops : String // expect no warning or error under any configuration + + module ClassExamples = + type C2 = + [] + val mutable Whoops : String // expect no warning or error under any configuration diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-positive.fs.checknulls_on.err.bsl b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-positive.fs.checknulls_on.err.bsl new file mode 100644 index 00000000000..82848eae396 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-positive.fs.checknulls_on.err.bsl @@ -0,0 +1,8 @@ +existing-positive.fs (9,23)-(9,25) typecheck error Nullness warning: The type 'string' does not support 'null'. +existing-positive.fs (15,24)-(15,26) typecheck error Nullness warning: The type 'string' does not support 'null'. +existing-positive.fs (21,24)-(21,26) typecheck error Nullness warning: The type 'string' does not support 'null'. +existing-positive.fs (24,23)-(24,27) typecheck error Nullness warning: The type 'String' does not support 'null'. +existing-positive.fs (29,26)-(29,30) typecheck error Nullness warning: The type 'String' does not support 'null'. +existing-positive.fs (44,32)-(44,36) typecheck error Nullness warning: The type 'obj array' does not support 'null'. +existing-positive.fs (49,14)-(49,16) typecheck error Nullness warning: The type 'string' does not support 'null'. +existing-positive.fs (55,17)-(55,26) typecheck error Nullness warning: The type 'String' does not support 'null'. \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-positive.fs.nullness_disabled.err.bsl b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/existing-positive.fs.nullness_disabled.err.bsl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/library-functions.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/library-functions.fs new file mode 100644 index 00000000000..03dc226b725 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/library-functions.fs @@ -0,0 +1,41 @@ +module LibraryFunctions + +open System + +let x4 : string = "plain string" +let x5 = nonNull ("": string | null) // Should not give a Nullness warning +let x6 = nonNull "" // **Expected to give a Nullness warning +let x7 = nonNull "" +let _x7 : String = x7 +let x8 = nonNull Array.empty +let x9 = nonNull [| "" |] +let x10 = nonNullV (Nullable(3)) +let x11 = try nonNullV (Nullable()) with :? System.NullReferenceException -> 10 +let x12 = nullV +let x13 = nullV +let x14 = withNullV 6L +let x15 : String | null = withNull x4 // This should not warn (is OK if typar is passed, this is wrong) +let x15a : String | null = withNull "" // This should not warn (is OK if typar is passed, this is wrong) +let x15b : String | null = withNull x4 +let x15c : String | null = withNull x4 // **Expected to give a Nullness warning +let x16 : Nullable = withNullV 3 + +let y0 = isNull null // Should not give a Nullness warning (obj) +let y1 = isNull (null: obj | null) // Should not give a Nullness warning +let y1b = isNull (null: String | null) // Should not give a Nullness warning +let y2 = isNull "" // **Expected to give a Nullness warning - type instantiation of a nullable type is non-nullable String +let y9 = isNull "" // **Expected to give a Nullness warning - type instantiation of a nullable type is non-nullable String +let y10 = isNull "" // Should not give a Nullness warning. +// Not yet allowed +//let f7 () : 'T | null when 'T : struct = null +let f7b () : Nullable<'T> = nullV + +let f0b (line:string | null) = + let add (s:String) = () + match line with + | null -> () + | _ -> add (line) // warning expected + +let add (s:String) = () +let f0c line = + add (nonNull "") \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/library-functions.fs.checknulls_on.err.bsl b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/library-functions.fs.checknulls_on.err.bsl new file mode 100644 index 00000000000..a74b139264c --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/library-functions.fs.checknulls_on.err.bsl @@ -0,0 +1,13 @@ +library-functions.fs (6,27)-(6,29) typecheck error Value known to be without null passed to a function meant for nullables: You can remove this `nonNull` assertion. +library-functions.fs (7,10)-(7,17) typecheck error Nullness warning: The type 'String | null' supports 'null' but a non-null type is expected. +library-functions.fs (7,33)-(7,35) typecheck error Value known to be without null passed to a function meant for nullables: You can remove this `nonNull` assertion. +library-functions.fs (8,18)-(8,20) typecheck error Value known to be without null passed to a function meant for nullables: You can remove this `nonNull` assertion. +library-functions.fs (10,28)-(10,39) typecheck error Value known to be without null passed to a function meant for nullables: You can remove this `nonNull` assertion. +library-functions.fs (11,18)-(11,26) typecheck error Value known to be without null passed to a function meant for nullables: You can remove this `nonNull` assertion. +library-functions.fs (17,27)-(17,38) typecheck error Nullness warning: The types 'String' and 'String | null' do not have equivalent nullability. +library-functions.fs (18,28)-(18,39) typecheck error Nullness warning: The types 'String' and 'String | null' do not have equivalent nullability. +library-functions.fs (20,28)-(20,36) typecheck error Nullness warning: The type 'String | null' supports 'null' but a non-null type is expected. +library-functions.fs (26,17)-(26,19) typecheck error Nullness warning: The type 'string' does not support 'null'. +library-functions.fs (27,10)-(27,16) typecheck error Nullness warning: The type 'String' does not support 'null'. +library-functions.fs (37,17)-(37,21) typecheck error Nullness warning: The types 'String' and 'string | null' do not have equivalent nullability. +library-functions.fs (41,26)-(41,28) typecheck error Value known to be without null passed to a function meant for nullables: You can remove this `nonNull` assertion. \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/library-functions.fs.nullness_disabled.err.bsl b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/library-functions.fs.nullness_disabled.err.bsl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/micro.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/micro.fs new file mode 100644 index 00000000000..a0027c2d0a9 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/micro.fs @@ -0,0 +1,13 @@ + +module M + +let isNotNull (value: 'T) = + match value with + | null -> false + | _ -> true + +#if CHECKNULLS +let s: System.String | null = null +#else +let s: System.String = null +#endif \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/micro.fsi b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/micro.fsi new file mode 100644 index 00000000000..25271ae6d7e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/micro.fsi @@ -0,0 +1,3 @@ + +module M +val isNotNull: value: 'T -> bool when 'T : null \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/positive-defaultValue-bug.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/positive-defaultValue-bug.fs new file mode 100644 index 00000000000..f4b7c1b03d2 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/positive-defaultValue-bug.fs @@ -0,0 +1,13 @@ +module EnabledPositive +open System + +module NotNullConstraint = + let f3 (x: 'T when 'T : not null) = 1 + let v5 = f3 (Some 1) // Expect to give a warning + //let w5 = (Some 1) |> f3 // Expect to give a warning + + +[] +type C4b = + [] + val mutable Whoops : FSharp.Collections.List | null // expect no warning \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/positive-defaultValue-bug.fs.nullness_disabled.err.bsl b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/positive-defaultValue-bug.fs.nullness_disabled.err.bsl new file mode 100644 index 00000000000..22970adc345 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/positive-defaultValue-bug.fs.nullness_disabled.err.bsl @@ -0,0 +1,2 @@ +positive-defaultValue-bug.fs (6,18)-(6,24) typecheck error Nullness warning: The type ''a option' uses 'null' as a representation value but a non-null type is expected. +positive-defaultValue-bug.fs (13,17)-(13,23) typecheck error The type of a field using the 'DefaultValue' attribute must admit default initialization, i.e. have 'null' as a proper value or be a struct type whose fields all admit default initialization. You can use 'DefaultValue(false)' to disable this check \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs new file mode 100644 index 00000000000..2757ab30aea --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs @@ -0,0 +1,237 @@ +module EnabledPositive +open System +module Basics = + let x2 : String | null = null // expect no warning in any configuration + let x3 : String | null = "a" // expect no warning in any configuration + +module NotNullConstraint = + let f3 (x: 'T when 'T : not null) = 1 + let v1 = f3 1 + let v2 = f3 "a" + let v3 = f3 (null: obj) // Expect no warning in any configuration - warnings about 'obj' and nulls are suppressed + let v4 = f3 (null: String | null) // Expect to give a warning + let v5 = f3 (Some 1) // Expect to give a warning + + let w1 = 1 |> f3 + let w2 = "a" |> f3 + let w3 = (null: obj) |> f3 // Expect no warning in any configuration - warnings about 'obj' and nulls are suppressed + let w4 = (null: String | null) |> f3 // Expect to give a warning + let w5 = (Some 1) |> f3 // Expect to give a warning + +module MemberBasics = + type C() = + member x.P = 1 + member x.M() = 2 + + let c : C | null = C() + let v1 = c.P // Expected to give a warning + let v2 = c.M() // Expected to give a warning + let f1 = c.M // Expected to give a warning + + +module Basics2 = + let f1 () = null + + let f2 () : String | null = null + + let f3 () : 'T | null = null + + let f4 () : 'T | null when 'T : not struct = null + + let f5 () : 'T when 'T : not struct and 'T : null = null + + let f8 () : String = null // Expected to give a Nullness warning + + +type C(s: String) = + member __.Value = s + + +// This give a warning since 'T is not known to be reference type non-null +let f<'T when 'T: not null and 'T: not struct > (x: 'T | null, y: 'T | null) = () + +module Extractions0c = + + let x = null + let f<'T when 'T : not null and 'T: not struct> (x: 'T | null, y: 'T | null) = () + let s : String = "" + let result = f (x, s) // expect no warning in any configuration + +module Extractions0e = + + let x = null + let f<'T when 'T : not null and 'T: not struct> (x: 'T | null, y: 'T | null) = () + let result = f (x, "") // expect no warning in any configuration + +module Extractions1 = + + let mutable x : _ | null = null + x <- "" // expect no warning + +//let f<'T when 'T : not struct> (x: 'T | null) = 1 +module InteropBasics = + let s0 = String.Concat("a","b") + let s1 : String = String.Concat("a","c") + let test1() = String.Concat("a","d") + let test2(s1:String, s2: String) = String.Concat(s1,s2) + let test3() = String( [| 'a' |] ) + let test4() = System.AppDomain.CurrentDomain + let test5 : System.AppDomain = System.AppDomain.CurrentDomain + +type KonsoleWithNulls = + static member WriteLine(s: String | null) = Console.WriteLine(s) + static member WriteLine(fmt: String, arg1: String | null) = Console.WriteLine(fmt, arg1) + static member WriteLine(fmt: String, [] args: (obj | null)[] | null) = Console.WriteLine(fmt, args) + static member WriteLineC(s: C | null) = Console.WriteLine(s.Value) + static member WriteLineC(fmt: C | null, arg1: C | null) = Console.WriteLine(fmt.Value, arg1.Value) + +module KonsoleWithNullsModule = + let WriteLine(s: String | null) = Console.WriteLine(s) + let WriteLine2(fmt: String, arg1: String | null) = Console.WriteLine(fmt, arg1) + let WriteLineC(s: C | null) = Console.WriteLine(s.Value) + let WriteLineC2(fmt: C | null, arg1: C | null) = Console.WriteLine(fmt.Value, arg1.Value) + +module KonsoleWithNullsModule2 = + let WriteLine (x : string | null) = KonsoleWithNullsModule.WriteLine x + let WriteLine2 (fmt: string, arg1: string | null) = KonsoleWithNullsModule.WriteLine2(fmt, arg1) + let WriteLineC(s: _ | null) = KonsoleWithNullsModule.WriteLineC(s) + let WriteLineC2(fmt: _ , arg1: _ | null) = KonsoleWithNullsModule.WriteLineC2(fmt, arg1) + +type KonsoleNoNulls = + static member WriteLine(s: String) = Console.WriteLine(s) + static member WriteLine(fmt: String, arg1: String | null) = Console.WriteLine(fmt, arg1) + static member WriteLine(fmt: String, [] args: obj[]) = Console.WriteLine(fmt, args) + static member WriteLineC(s: C) = Console.WriteLine(s.Value) + static member WriteLineC(fmt: C, arg1: C) = Console.WriteLine(fmt.Value, arg1.Value) + +module KonsoleNoNullsModule = + let WriteLine(s: String) = Console.WriteLine(s) + let WriteLine2(fmt: String, arg1: String) = Console.WriteLine(fmt, arg1) + let WriteLineC(s: C) = Console.WriteLine(s.Value) + let WriteLineC2(fmt: C, arg1: C) = Console.WriteLine(fmt.Value, arg1.Value) + +module KonsoleNoNullsModule2 = + let WriteLine x = KonsoleNoNullsModule.WriteLine x + let WriteLine2 (fmt, arg1) = KonsoleNoNullsModule.WriteLine2(fmt, arg1) + let WriteLineC(s) = KonsoleNoNullsModule.WriteLineC(s) + let WriteLineC2(fmt, arg1) = KonsoleNoNullsModule.WriteLineC2(fmt, arg1) + +System.Console.WriteLine("a") +System.Console.WriteLine("a", (null: obj[])) // Expected to give a Nullness warning + +KonsoleWithNulls.WriteLine("Hello world") +KonsoleWithNulls.WriteLine(null) // WRONG: gives an incorrect Nullness warning for String | null and String | null +KonsoleWithNulls.WriteLine("Hello","world") +KonsoleWithNulls.WriteLine("Hello","world","there") // // WRONG: gives an incorrect Nullness warning for String | null and String | null + +KonsoleNoNulls.WriteLine("Hello world") +try + KonsoleNoNulls.WriteLine(null) // Expected to give a Nullness warning +with :? System.ArgumentNullException -> () +KonsoleNoNulls.WriteLine("Hello","world") +//KonsoleNoNulls.WriteLine("Hello",null) // CHECK ME +try + KonsoleNoNulls.WriteLine(null, "World") // Expected to give a Nullness warning +with :? System.ArgumentNullException -> () + +KonsoleWithNullsModule.WriteLine("Hello world") +try + KonsoleWithNullsModule.WriteLine(null) +with :? System.ArgumentNullException -> () +KonsoleWithNullsModule.WriteLine2("Hello","world") +KonsoleWithNullsModule.WriteLine2("Hello",null) +try + KonsoleWithNullsModule.WriteLine2(null,"world") +with :? System.ArgumentNullException -> () + +KonsoleWithNullsModule2.WriteLine("Hello world") +try + KonsoleWithNullsModule2.WriteLine(null) +with :? System.ArgumentNullException -> () +KonsoleWithNullsModule2.WriteLine2("Hello","world") +KonsoleWithNullsModule2.WriteLine2("Hello",null) +try + KonsoleWithNullsModule2.WriteLine2(null,"world") +with :? System.ArgumentNullException -> () + +KonsoleNoNullsModule.WriteLine("Hello world") +try + KonsoleNoNullsModule.WriteLine(null) // Expected to give a Nullness warning +with :? System.ArgumentNullException -> () +KonsoleNoNullsModule.WriteLine2("Hello","world") +KonsoleNoNullsModule.WriteLine2("Hello",null) // Expected to give a Nullness warning +try + KonsoleNoNullsModule.WriteLine2(null,"world") // Expected to give a Nullness warning +with :? System.ArgumentNullException -> () + +//------------------------------------- + +// Param array cases + +KonsoleNoNulls.WriteLine("Hello","world","there") +KonsoleWithNulls.WriteLine("Hello","world",null) // Expected to give a Nullness warning +KonsoleNoNulls.WriteLine("Hello","world",null) // Expected to give a Nullness warning +System.Console.WriteLine("a", (null: obj[] | null)) +System.Console.WriteLine("a", (null: (obj | null)[] | null)) + +//------- +// random stuff + +let f0 line = + let add (s:String) = () + match line with + | null | "" -> () + | _ -> add line // Expected to give a nullness warning + +module NullConstraintTests = + type C<'T when 'T : null>() = class end + + let f3 (y : C) = y // Expect a Nullness warning + + let f4 (y : C) = y // No warning expected + + let f5 (y : C | null>) = y // No warning expected + + let f6 (y : C | null>) = y // No warning expected, lexing/parsing should succeed + +module DefaultValueTests = + + + module StructExamples = + [] + type C2 = + [] + val mutable Whoops : String // expect no warning + + [] + type C3 = + [] + val mutable Whoops : String | null // expect no warning + + [] + type C4b = + [] + val mutable Whoops : FSharp.Collections.List | null // expect no warning + + [] + type C7 = + [] + val mutable Whoops : (int -> int) | null // expect no warning + + module ClassExamples = + + type C2 = + [] + val mutable Whoops : String // expect no warning + + type C3 = + [] + val mutable Whoops : String | null // expect no warning + + type C4b = + [] + val mutable Whoops : int FSharp.Collections.List | null // expect no warning + + type C7 = + [] + val mutable Whoops : (int -> int) | null // expect no warning diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs.checknulls_on.err.bsl b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs.checknulls_on.err.bsl new file mode 100644 index 00000000000..5154ce43e79 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs.checknulls_on.err.bsl @@ -0,0 +1,35 @@ +using-nullness-syntax-positive.fs (11,18)-(11,22) typecheck error Nullness warning: The type 'obj' does not support 'null'. +using-nullness-syntax-positive.fs (12,18)-(12,37) typecheck error Nullness warning: The type 'String | null' supports 'null' but a non-null type is expected. +using-nullness-syntax-positive.fs (13,18)-(13,24) typecheck error Nullness warning: The type ''a option' uses 'null' as a representation value but a non-null type is expected. +using-nullness-syntax-positive.fs (17,15)-(17,19) typecheck error Nullness warning: The type 'obj' does not support 'null'. +using-nullness-syntax-positive.fs (18,39)-(18,41) typecheck error Nullness warning: The type 'String | null' supports 'null' but a non-null type is expected. +using-nullness-syntax-positive.fs (19,26)-(19,28) typecheck error Nullness warning: The type 'int option' uses 'null' as a representation value but a non-null type is expected. +using-nullness-syntax-positive.fs (27,14)-(27,17) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (27,14)-(27,17) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (28,14)-(28,19) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (28,14)-(28,19) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (29,14)-(29,17) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (29,14)-(29,17) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (43,26)-(43,30) typecheck error Nullness warning: The type 'String' does not support 'null'. +using-nullness-syntax-positive.fs (85,63)-(85,70) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (85,63)-(85,70) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (86,81)-(86,90) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (86,81)-(86,90) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (86,92)-(86,102) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (86,92)-(86,102) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (91,53)-(91,60) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (91,53)-(91,60) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (92,72)-(92,81) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (92,72)-(92,81) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (92,83)-(92,93) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (92,83)-(92,93) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (120,32)-(120,36) typecheck error Nullness warning: The type 'obj array' does not support 'null'. +using-nullness-syntax-positive.fs (129,4)-(129,34) typecheck error Nullness warning: The type 'String' does not support 'null'. +using-nullness-syntax-positive.fs (134,5)-(134,44) typecheck error Nullness warning: The type 'String' does not support 'null'. +using-nullness-syntax-positive.fs (144,39)-(144,43) typecheck error Nullness warning: The type 'String' does not support 'null'. +using-nullness-syntax-positive.fs (154,40)-(154,44) typecheck error Nullness warning: The type 'string' does not support 'null'. +using-nullness-syntax-positive.fs (159,36)-(159,40) typecheck error Nullness warning: The type 'String' does not support 'null'. +using-nullness-syntax-positive.fs (162,41)-(162,45) typecheck error Nullness warning: The type 'String' does not support 'null'. +using-nullness-syntax-positive.fs (164,37)-(164,41) typecheck error Nullness warning: The type 'String' does not support 'null'. +using-nullness-syntax-positive.fs (183,14)-(183,16) typecheck error Nullness warning: The type 'string' does not support 'null'. +using-nullness-syntax-positive.fs (189,17)-(189,26) typecheck error Nullness warning: The type 'String' does not support 'null'. \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs.nullness_disabled.err.bsl b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs.nullness_disabled.err.bsl new file mode 100644 index 00000000000..cd596951cfe --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs.nullness_disabled.err.bsl @@ -0,0 +1,4 @@ +using-nullness-syntax-positive.fs (13,18)-(13,24) typecheck error Nullness warning: The type ''a option' uses 'null' as a representation value but a non-null type is expected. +using-nullness-syntax-positive.fs (19,26)-(19,28) typecheck error Nullness warning: The type 'int option' uses 'null' as a representation value but a non-null type is expected. +using-nullness-syntax-positive.fs (214,25)-(214,31) typecheck error The type of a field using the 'DefaultValue' attribute must admit default initialization, i.e. have 'null' as a proper value or be a struct type whose fields all admit default initialization. You can use 'DefaultValue(false)' to disable this check +using-nullness-syntax-positive.fs (219,25)-(219,31) typecheck error The type of a field using the 'DefaultValue' attribute must admit default initialization, i.e. have 'null' as a proper value or be a struct type whose fields all admit default initialization. You can use 'DefaultValue(false)' to disable this check \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs index f31371a9653..002bef2f41b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs @@ -7,7 +7,7 @@ open FSharp.Test.Compiler module ObsoleteAttributeCheckingTests = [] - let ``Obsolete attribute is not taken into account when used on on a member and and instantiate the type`` () = + let ``Obsolete attribute is not taken into account when used on on a member and instantiate the type`` () = Fsx """ open System @@ -468,7 +468,7 @@ type ButtonExtensions = ] [] - let ``Obsolete attribute is taken into account when used on an module and set property via module using an extension method`` () = + let ``Obsolete attribute is taken into account when used on a module and set property via module using an extension method`` () = Fsx """ open System open System.Runtime.CompilerServices @@ -495,7 +495,7 @@ type ButtonExtensions = ] [] - let ``Obsolete attribute is taken into account when used on an module and function and set property via module using an extesnion method`` () = + let ``Obsolete attribute is taken into account when used on a module and function and set property via module using an extension method`` () = Fsx """ open System open System.Runtime.CompilerServices @@ -523,7 +523,7 @@ type ButtonExtensions = ] [] - let ``Obsolete attribute is taken into account when used on an moudle function and set property via module using an extesnion method`` () = + let ``Obsolete attribute is taken into account when used on a module function and set property via module using an extension method`` () = Fsx """ open System open System.Runtime.CompilerServices diff --git a/tests/FSharp.Compiler.ComponentTests/Language/XmlComments.fs b/tests/FSharp.Compiler.ComponentTests/Language/XmlComments.fs index 941c4f27a9e..eed0e37e4db 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/XmlComments.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/XmlComments.fs @@ -210,7 +210,7 @@ module M = Fsx""" type Thing = Inner of s: string /// A function with an extracted inner value - /// The innver value to unwrap + /// The inner value to unwrap let doer ((Inner s) as inner) = ignore s; ignore inner """ |> withXmlCommentChecking diff --git a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FsharpSuiteMigrated.fs b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FsharpSuiteMigrated.fs index 868136e3205..2490e301e05 100644 --- a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FsharpSuiteMigrated.fs +++ b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FsharpSuiteMigrated.fs @@ -80,6 +80,7 @@ module TestFrameworkAdapter = | LangVersion.V60 -> "6.0",bonusArgs | LangVersion.V70 -> "7.0",bonusArgs | LangVersion.V80 -> "8.0",bonusArgs + | LangVersion.V90 -> "9.0",bonusArgs | LangVersion.Preview -> "preview",bonusArgs | LangVersion.Latest -> "latest", bonusArgs | LangVersion.SupportsMl -> "5.0", "--mlcompatibility" :: bonusArgs diff --git a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedCoreTests.fs b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedCoreTests.fs index e92ef88592c..2d9c6657901 100644 --- a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedCoreTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedCoreTests.fs @@ -78,11 +78,11 @@ let ``auto-widen-minimal``() = [] let ``auto-widen-version-preview-warns-on``() = - singleVersionedNegTestAux "core/auto-widen/preview" ["--warnon:3388";"--warnon:3389";"--warnon:3395";"--warnaserror+";"--define:NEGATIVE"] LangVersion.Preview "test" + singleVersionedNegTestAux "core/auto-widen/preview" ["--warnon:3388";"--warnon:3389";"--warnon:3395";"--warnaserror+";"--define:NEGATIVE"] LangVersion.V80 "test" [] let ``auto-widen-version-preview-default-warns``() = - singleVersionedNegTestAux "core/auto-widen/preview-default-warns" ["--warnaserror+";"--define:NEGATIVE"] LangVersion.Preview "test" + singleVersionedNegTestAux "core/auto-widen/preview-default-warns" ["--warnaserror+";"--define:NEGATIVE"] LangVersion.V80 "test" [] let ``comprehensions-FSC_DEBUG`` () = singleTestBuildAndRun "core/comprehensions" FSC_DEBUG @@ -401,7 +401,7 @@ let ``controlChamenos-FSI`` () = [] let ``controlMailbox-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/controlMailbox" FSC_OPTIMIZED -[] +[] let ``controlMailbox-FSI`` () = singleTestBuildAndRun "core/controlMailbox" FSI [] diff --git a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedOverloadTests.fs b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedOverloadTests.fs index 0b3e8f8e6c8..dcb9615a809 100644 --- a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedOverloadTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedOverloadTests.fs @@ -15,7 +15,7 @@ module ``fsharpqa migrated tests`` = let [] ``Conformance\Inference (E_TwoDifferentTypeVariables01rec_fs)`` () = singleNegTest ( "conformance/inference") "E_TwoDifferentTypeVariables01rec" let [] ``Conformance\Inference (E_TwoDifferentTypeVariablesGen00rec_fs)`` () = singleNegTest ( "conformance/inference") "E_TwoDifferentTypeVariablesGen00rec" let [] ``Conformance\Inference (E_TwoEqualTypeVariables02_fs)`` () = singleNegTest ( "conformance/inference") "E_TwoEqualTypeVariables02" - let [] ``Conformance\Inference (E_TwoEqualYypeVariables02rec_fs)`` () = singleNegTest ( "conformance/inference") "E_TwoEqualYypeVariables02rec" + let [] ``Conformance\Inference (E_TwoEqualTypeVariables02rec_fs)`` () = singleNegTest ( "conformance/inference") "E_TwoEqualTypeVariables02rec" let [] ``Conformance\Inference (E_LeftToRightOverloadResolution01_fs)`` () = singleNegTest ( "conformance/inference") "E_LeftToRightOverloadResolution01" let [] ``Conformance\WellFormedness (E_Clashing_Values_in_AbstractClass01_fs)`` () = singleNegTest ( "conformance/wellformedness") "E_Clashing_Values_in_AbstractClass01" let [] ``Conformance\WellFormedness (E_Clashing_Values_in_AbstractClass03_fs)`` () = singleNegTest ( "conformance/wellformedness") "E_Clashing_Values_in_AbstractClass03" diff --git a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/XmlDoc.fs b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/XmlDoc.fs index 6a1927ffd84..806c2ac8354 100644 --- a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/XmlDoc.fs +++ b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/XmlDoc.fs @@ -30,7 +30,7 @@ let xmlFileContents signature = $""" [] [] let ``Can extract XML docs from a file for a signature`` signature = - let xmlFileName = tryCreateTemporaryFileName () + ".xml" + let xmlFileName = getTemporaryFileName () + ".xml" try File.WriteAllText(xmlFileName, xmlFileContents signature) diff --git a/tests/FSharp.Compiler.ComponentTests/OCamlCompat/MultiArgumentGenericType.fs b/tests/FSharp.Compiler.ComponentTests/OCamlCompat/MultiArgumentGenericType.fs index a632b981da4..c734f251b8a 100644 --- a/tests/FSharp.Compiler.ComponentTests/OCamlCompat/MultiArgumentGenericType.fs +++ b/tests/FSharp.Compiler.ComponentTests/OCamlCompat/MultiArgumentGenericType.fs @@ -1,7 +1,7 @@ // #Regression #OCaml -// Regressin Test for FSharp1.0:2098 - OCaml-compat warning for generics written like this: (string, int)Dictionary +// Regression Test for FSharp1.0:2098 - OCaml-compat warning for generics written like this: (string, int)Dictionary //Unexpected identifier in expression$ open System.Collections.Generic diff --git a/tests/FSharp.Compiler.ComponentTests/OCamlCompat/W-NoParensInLet01.fs b/tests/FSharp.Compiler.ComponentTests/OCamlCompat/W-NoParensInLet01.fs index 9e454014d45..a366d074817 100644 --- a/tests/FSharp.Compiler.ComponentTests/OCamlCompat/W-NoParensInLet01.fs +++ b/tests/FSharp.Compiler.ComponentTests/OCamlCompat/W-NoParensInLet01.fs @@ -2,7 +2,7 @@ #light // FSB 1117, Bindings that look like function definitions are interpreted as pattern matches without warning. Add a warning for this case to allow for later language design change here. -//This construct is for compatibility with OCaml + type t = F of int * int diff --git a/tests/FSharp.Compiler.ComponentTests/Operators.fs b/tests/FSharp.Compiler.ComponentTests/Operators.fs index d80e1480145..0eee1ec6adb 100644 --- a/tests/FSharp.Compiler.ComponentTests/Operators.fs +++ b/tests/FSharp.Compiler.ComponentTests/Operators.fs @@ -7,7 +7,7 @@ open FSharp.Test.Compiler module Operators = [] - let ``Validate that non generic (fast) code is emmitted for comparison involving decimals`` compilation = + let ``Validate that non generic (fast) code is emitted for comparison involving decimals`` compilation = compilation |> ignoreWarnings |> verifyBaseline diff --git a/tests/FSharp.Compiler.ComponentTests/Scripting/Interactive.fs b/tests/FSharp.Compiler.ComponentTests/Scripting/Interactive.fs index 58f90304853..4fab401b9c6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Scripting/Interactive.fs +++ b/tests/FSharp.Compiler.ComponentTests/Scripting/Interactive.fs @@ -3,9 +3,9 @@ namespace Scripting open Xunit + open System open FSharp.Test.Compiler -open FSharp.Compiler.Interactive.Shell open FSharp.Test.ScriptHelpers module ``Interactive tests`` = @@ -89,3 +89,38 @@ module ``External FSI tests`` = |> runFsi |> shouldSucceed + +module MultiEmit = + + [] + [] + [] + let ``FSharp record in script`` (useMultiEmit) = + + let args : string array = [| if useMultiEmit then "--multiemit+" else "--multiemit-"|] + use session = new FSharpScript(additionalArgs=args) + + let scriptIt submission = + + let result, errors = session.Eval(submission) + Assert.Empty(errors) + match result with + | Ok _ -> () + | _ -> Assert.True(false, $"Failed in line: {submission}") + + [| + """type R = { x: int }""" + """let a = { x = 7 } """ + """if a.x <> 7 then failwith $"1: Failed {a.x} <> 7" """ + """if a.x <> 7 then failwith $"2: Failed {a.x} <> 7" """ + """if a.x <> 7 then failwith $"3: Failed {a.x} <> 7" """ + """if a.x <> 7 then failwith $"4: Failed {a.x} <> 7" """ + """let b = { x = 9 }""" + """if a.x <> 7 then failwith $"5: Failed {a.x} <> 7" """ + """if b.x <> 9 then failwith $"6: Failed {b.x} <> 9" """ + """let A = {| v = 7.2 |}""" + """if A.v <> 7.2 then failwith $"7: Failed {A.v} <> 7.2" """ + """let B = {| v = 9.3 |}""" + """if A.v <> 7.2 then failwith $"8: Failed {A.v} <> 7.2" """ + """if B.v <> 9.3 then failwith $"9: Failed {A.v} <> 9.3" """ + |] |> Seq.iter(fun item -> item |> scriptIt) diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/access.fsx b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/access.fsx index 5051e238db5..a8c3798a685 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/access.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/access.fsx @@ -53,7 +53,7 @@ type MyClassStaticMembers = static member SMDefault() = 12 [] -type MyClassPropertiyGetters = +type MyClassPropertyGetters = member internal x.InstInternal = 12 member private x.InstPrivate = 12 member public x.InstPublic = 12 diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/array.fsx b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/array.fsx index 77307d835e5..8c55d727f92 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/array.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/array.fsx @@ -1092,7 +1092,7 @@ module manyIndexes = let CompileIndexerTest = let test = Test () - // No problems with method having vaiable number of parameters + // No problems with method having variable number of parameters let u1 = test.Foo(null, null, null, null) let u2 = test.Foo(null, null, null, null, null) let u3 = test.Foo(null, null, null, null, null, null, null, null, null) diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/hash_constraint_seq.fsx b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/hash_constraint_seq.fsx index 60bdb225ade..3dea5d71f8d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/hash_constraint_seq.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/hash_constraint_seq.fsx @@ -3,5 +3,5 @@ module Foo open System open System.Threading.Tasks -let mapWithAdditionalDependenies +let mapWithAdditionalDependencies (mapping: 'a -> 'b * #seq<#IDisposable>) = 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/innerpoly.fsx b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/innerpoly.fsx index 140c584ed79..d30645bf0b2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/innerpoly.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/innerpoly.fsx @@ -208,7 +208,7 @@ module Bug1126BenjaminTeuber = begin printf "%i" value done let CallPrintAll (values : int seq) = - printfn "Caling Sum" ; + printfn "Calling Sum" ; values |> PrintAll in printfn "Done" ; let MyFun () = diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/libtest.fsx b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/libtest.fsx index 49a199b5ff3..23c2125ab51 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/libtest.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/libtest.fsx @@ -141,7 +141,7 @@ let getObjectHashCode (x:'a) = (box x).GetHashCode() let (===) (x:'a) (y:'a) = (box x).Equals(box y) let _ = stdout.WriteLine "90erw9" -let _ = if true && true then stdout.WriteLine "YES" else reportFailure "intial test" +let _ = if true && true then stdout.WriteLine "YES" else reportFailure "initial test" let _ = if true && false then reportFailure "basic test 1" else stdout.WriteLine "YES" let _ = if false && true then reportFailure "basic test 2" else stdout.WriteLine "YES" let _ = if false && false then reportFailure "basic test 3" else stdout.WriteLine "YES" @@ -1207,10 +1207,10 @@ let _ = printString "tuple object equality null test (b25): "; if (1,2,3,4,5,C) let _ = printString "ref equality test (b25): "; if ref 1 = ref 1 then stdout.WriteLine "YES" else reportFailure "basic test Q" let _ = printString "ref equality test (b25): "; if ref 1 <> ref 2 then stdout.WriteLine "YES" else reportFailure "basic test Q" -let _ = printString "compaure nativeint test (b25): "; if compare [0n] [1n] = -(compare [1n] [0n]) then stdout.WriteLine "YES" else reportFailure "basic test Q" -let _ = printString "compaure nativeint test (b25): "; if compare [0un] [1un] = -(compare [1un] [0un]) then stdout.WriteLine "YES" else reportFailure "basic test Q" -let _ = printString "compaure nativeint test (b25): "; if compare [0un] [0un] = 0 then stdout.WriteLine "YES" else reportFailure "basic test Q" -let _ = printString "compaure nativeint test (b25): "; if compare [0n] [0n] = 0 then stdout.WriteLine "YES" else reportFailure "basic test Q" +let _ = printString "compare nativeint test (b25): "; if compare [0n] [1n] = -(compare [1n] [0n]) then stdout.WriteLine "YES" else reportFailure "basic test Q" +let _ = printString "compare nativeint test (b25): "; if compare [0un] [1un] = -(compare [1un] [0un]) then stdout.WriteLine "YES" else reportFailure "basic test Q" +let _ = printString "compare nativeint test (b25): "; if compare [0un] [0un] = 0 then stdout.WriteLine "YES" else reportFailure "basic test Q" +let _ = printString "compare nativeint test (b25): "; if compare [0n] [0n] = 0 then stdout.WriteLine "YES" else reportFailure "basic test Q" (*--------------------------------------------------------------------------- @@ -1491,7 +1491,7 @@ module Pow = test "cnod90kmhvreE" (try pown 0M exp; false with :? System.DivideByZeroException -> true); ); - // check powerrs of -1 + // check powers of -1 test "cnod90kmr" (pown -1.0f exp = (if exp % 2 = 0 then 1.0f else -1.0f)); test "cnod90kms" (pown -1.0 exp = (if exp % 2 = 0 then 1.0 else -1.0)); test "cnod90kmt" (pown -1.0M exp = (if exp % 2 = 0 then 1.0M else -1.0M)); @@ -2511,221 +2511,221 @@ module SeqTestsOnEnumerableEnforcingDisposalAtEnd = begin // This one gave a stack overflow when we weren't tail-calling on 64-bit do check "Seq.filter-length" ({ 1 .. 1000000 } |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.filter (fun n -> n <> 1) |> Seq.length) 999999 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.filter-length" ({ 1 .. 1000000 } |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.filter (fun n -> n = 1) |> Seq.length) 1 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.filter-length" ({ 1 .. 1000000 } |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.filter (fun n -> n % 2 = 0) |> Seq.length) 500000 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.empty-length" (Seq.length (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd Seq.empty)) 0 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.length-of-array" (Seq.length (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [| 1;2;3 |])) 3 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.head-of-array" (Seq.head (countEnumeratorsAndCheckedDisposedAtMostOnce [| 1;2;3 |])) 1 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.take-0-of-array" (Seq.take 0 (countEnumeratorsAndCheckedDisposedAtMostOnce [| 1;2;3 |]) |> Seq.toList) [] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.take-1-of-array" (Seq.take 1 (countEnumeratorsAndCheckedDisposedAtMostOnce [| 1;2;3 |]) |> Seq.toList) [1] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.take-3-of-array" (Seq.take 3 (countEnumeratorsAndCheckedDisposedAtMostOnce [| 1;2;3 |]) |> Seq.toList) [1;2;3] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.nonempty-true" (Seq.isEmpty (countEnumeratorsAndCheckedDisposedAtMostOnce [| 1;2;3 |])) false - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.nonempty-false" (Seq.isEmpty (countEnumeratorsAndCheckedDisposedAtMostOnce [| |])) true - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.fold" (Seq.fold (+) 0 (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [| 1;2;3 |]) ) 6 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.unfold" (Seq.unfold (fun _ -> None) 1 |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray) [| |] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.unfold" (Seq.unfold (fun x -> if x = 1 then Some("a",2) else None) 1 |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray) [| "a" |] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.exists" (Seq.exists ((=) "a") (countEnumeratorsAndCheckedDisposedAtMostOnce [| |])) false - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.exists" (Seq.exists ((=) "a") (countEnumeratorsAndCheckedDisposedAtMostOnce [| "a" |])) true - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.exists" (Seq.exists ((=) "a") (countEnumeratorsAndCheckedDisposedAtMostOnce [| "1"; "a" |])) true - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.exists" (Seq.forall ((=) "a") (countEnumeratorsAndCheckedDisposedAtMostOnce [| |])) true - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.exists" (Seq.forall ((=) "a") (countEnumeratorsAndCheckedDisposedAtMostOnce [| "a" |])) true - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.exists" (Seq.forall ((=) "a") (countEnumeratorsAndCheckedDisposedAtMostOnce [| "1"; "a" |])) false - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.map on finite" ([| "a" |] |> Seq.map (fun x -> x.Length) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray) [| 1 |] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.filter on finite" ([| "a";"ab";"a" |] |> Seq.filter (fun x -> x.Length = 1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray) [| "a";"a" |] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.choose on finite" ([| "a";"ab";"a" |] |> Seq.choose (fun x -> if x.Length = 1 then Some(x^"a") else None) |> Seq.toArray) [| "aa";"aa" |] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.pick on finite (succeeding)" ([| "a";"ab";"a" |] |> countEnumeratorsAndCheckedDisposedAtMostOnce |> Seq.pick (fun x -> if x.Length = 1 then Some(x^"a") else None)) "aa" - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.tryPick on finite (succeeding)" ([| "a";"ab";"a" |] |> countEnumeratorsAndCheckedDisposedAtMostOnce |> Seq.tryPick (fun x -> if x.Length = 1 then Some(x^"a") else None)) (Some "aa") - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.tryPick on finite (failing)" ([| "a";"ab";"a" |] |> countEnumeratorsAndCheckedDisposedAtMostOnce |> Seq.tryPick (fun x -> if x.Length = 6 then Some(x^"a") else None)) None - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.find on finite (succeeding)" ([| "a";"ab";"a" |] |> countEnumeratorsAndCheckedDisposedAtMostOnce |> Seq.find (fun x -> x.Length = 1)) "a" - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.find on finite (failing)" (try Some ([| "a";"ab";"a" |] |> countEnumeratorsAndCheckedDisposedAtMostOnce |> Seq.find (fun x -> x.Length = 6)) with :? System.Collections.Generic.KeyNotFoundException -> None) None - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.map_with_type (string up to obj,finite)" ([| "a" |] |> Seq.cast |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray) [| ("a" :> obj) |] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.map_with_type (obj down to string, finite)" ([| ("a" :> obj) |] |> Seq.cast |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray) [| "a" |] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.append, finite, finite" (Seq.append [| "a" |] [| "b" |] |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray) [| "a"; "b" |] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.concat, finite" (Seq.concat [| [| "a" |]; [| |]; [| "b";"c" |] |] |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toList) [ "a";"b";"c" ] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.init_infinite, then take" (Seq.take 2 (countEnumeratorsAndCheckedDisposedAtMostOnce (Seq.initInfinite (fun i -> i+1))) |> Seq.toList) [ 1;2 ] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.to_array, empty" (Seq.init 0 (fun i -> i+1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray) [| |] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.to_array, small" (Seq.init 1 (fun i -> i+1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray) [| 1 |] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.to_array, large" (Seq.init 100000 (fun i -> i+1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray |> Array.length) 100000 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.to_array, very large" (Seq.init 1000000 (fun i -> i+1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray |> Array.length) 1000000 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.to_list, empty" (Seq.init 0 (fun i -> i+1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toList) [ ] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.to_list, small" (Seq.init 1 (fun i -> i+1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toList) [ 1 ] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.to_list, large" (Seq.init 100000 (fun i -> i+1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toList |> List.length) 100000 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.to_list, large" (Seq.init 1000000 (fun i -> i+1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toList |> List.length) 1000000 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "IEnumerableTest.to_list, large" (Seq.init 1000000 (fun i -> i+1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> List.ofSeq |> List.length) 1000000 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "List.unzip, large" (Seq.init 1000000 (fun i -> (i,i+1)) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> List.ofSeq |> List.unzip |> fst |> List.length) 1000000 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 let dup x = x,x let uncurry f (x,y) = f x y do check "List.zip, large" (Seq.init 1000000 (fun i -> (i,i+1)) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> List.ofSeq |> dup |> uncurry List.zip |> List.length) 1000000 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 (* // Currently disabled, since IStructuralEquatable.Equals will cause this to stack overflow around 140000 elements do check "List.sort, large" ((Seq.init 140000 (fun i -> 139999 - i) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> List.ofSeq |> List.sort) = (Seq.init 140000 (fun i -> i) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> List.ofSeq |> List.sort)) true - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 *) do check "Seq.singleton" (Seq.singleton 42 |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.length) 1 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.singleton" (Seq.singleton 42 |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toList) [42] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.truncate" (Seq.truncate 20 (countEnumeratorsAndCheckedDisposedAtMostOnce [1..100]) |> Seq.toList) [1..20] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.truncate" (Seq.truncate 1 (countEnumeratorsAndCheckedDisposedAtMostOnce [1..100]) |> Seq.toList) [1] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.truncate" (Seq.truncate 0 (countEnumeratorsAndCheckedDisposedAtMostOnce [1..100]) |> Seq.toList) [] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.scan" (Seq.scan (+) 0 (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [|1..5|]) |> Seq.toArray) [|0; 1; 3; 6; 10; 15|] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 //do check "Seq.scan1" (Seq.scan1 (+) (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [|1..5|]) |> Seq.toArray) [|3; 6; 10; 15|] - //do check "" numActiveEnumerators 0 + //do check "" numActiveEnumerators 0 do check "Seq.exists2" (Seq.exists2 (=) (countEnumeratorsAndCheckedDisposedAtMostOnce [|1; 2; 3; 4; 5; 6|]) (countEnumeratorsAndCheckedDisposedAtMostOnce [|2; 3; 4; 5; 6; 6|])) true - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.exists2" (Seq.exists2 (=) (countEnumeratorsAndCheckedDisposedAtMostOnce [|1; 2; 3; 4; 5; 6|]) (countEnumeratorsAndCheckedDisposedAtMostOnce [|2; 3; 4; 5; 6; 7|])) false - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.forall2" (Seq.forall2 (=) (countEnumeratorsAndCheckedDisposedAtMostOnce [|1..10|]) (countEnumeratorsAndCheckedDisposedAtMostOnce [|1..10|])) true - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.forall2" (Seq.forall2 (=) (countEnumeratorsAndCheckedDisposedAtMostOnce [|1;2;3;4;5|]) (countEnumeratorsAndCheckedDisposedAtMostOnce [|1;2;3;0;5|])) false - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.tryFind" ([|1..100|] |> countEnumeratorsAndCheckedDisposedAtMostOnce |> Seq.tryFind (fun x -> x > 50)) (Some 51) - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.tryFind" ([|1..100|] |> countEnumeratorsAndCheckedDisposedAtMostOnce |> Seq.tryFind (fun x -> x > 180)) None - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.compareWith" (Seq.compareWith compare (countEnumeratorsAndCheckedDisposedAtMostOnce [1;2]) (countEnumeratorsAndCheckedDisposedAtMostOnce [2;1])) -1 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.compareWith" (Seq.compareWith compare (countEnumeratorsAndCheckedDisposedAtMostOnce [2;1]) (countEnumeratorsAndCheckedDisposedAtMostOnce [1;2])) 1 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.compareWith" (Seq.compareWith compare (countEnumeratorsAndCheckedDisposedAtMostOnce [1;2]) (countEnumeratorsAndCheckedDisposedAtMostOnce [1;2])) 0 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.compareWith" (Seq.compareWith compare (countEnumeratorsAndCheckedDisposedAtMostOnce []) (countEnumeratorsAndCheckedDisposedAtMostOnce [1;2])) -1 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.collect" (Seq.collect (fun i -> [i*10 .. i*10+9]) (countEnumeratorsAndCheckedDisposedAtMostOnce [0..9]) |> Seq.toList) [0..99] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 let c = ref -1 do Seq.iter2 (fun x y -> incr c; test "Seq.iter2" (c.Value = x && c.Value = y)) (countEnumeratorsAndCheckedDisposedAtMostOnce [0..10]) (countEnumeratorsAndCheckedDisposedAtMostOnce [0..10]) do check "Seq.iter2" c.Value 10 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.zip" (Seq.zip [1..10] (countEnumeratorsAndCheckedDisposedAtMostOnce [2..11]) |> Seq.toList) [for i in 1..10 -> i, i+1] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.zip3" (Seq.zip3 (countEnumeratorsAndCheckedDisposedAtMostOnce [1..10]) (countEnumeratorsAndCheckedDisposedAtMostOnce [2..11]) (countEnumeratorsAndCheckedDisposedAtMostOnce [3..12]) |> Seq.toList) [for i in 1..10 -> i, i+1, i+2] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do c.Value <- -1 do Seq.iteri (fun n x -> incr c; test "Seq.iter2" (c.Value = n && c.Value+1 = x)) (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [1..11]) - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.iter2" c.Value 10 do check "Seq.pairwise" (Seq.pairwise (countEnumeratorsAndCheckedDisposedAtMostOnce [1..20]) |> Seq.toList) [for i in 1 .. 19 -> i, i+1] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.windowed 1" (Seq.windowed 1 (countEnumeratorsAndCheckedDisposedAtMostOnce [1..20]) |> Seq.toList) [for i in 1 .. 20 -> [|i|]] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.windowed 2" (Seq.windowed 2 (countEnumeratorsAndCheckedDisposedAtMostOnce [1..20]) |> Seq.toList) [for i in 1 .. 19 -> [|i; i+1|]] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.windowed 3" (Seq.windowed 3 (countEnumeratorsAndCheckedDisposedAtMostOnce [1..20]) |> Seq.toList) [for i in 1 .. 18 -> [|i; i+1; i+2|]] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.windowed 4" (Seq.windowed 4 (countEnumeratorsAndCheckedDisposedAtMostOnce [1..20]) |> Seq.toList) [for i in 1 .. 17 -> [|i; i+1; i+2; i+3|]] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 let group = Seq.groupBy (fun x -> x % 5) (countEnumeratorsAndCheckedDisposedAtMostOnce [1..100]) do for n, s in group do check "Seq.groupBy" (Seq.forall (fun x -> x % 5 = n) s) true; - check "" numActiveEnumerators 0 + check "" numActiveEnumerators 0 done let sorted = Seq.sortBy abs (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [2; 4; 3; -5; 2; -4; -8; 0; 5; 2]) do check "Seq.sortBy" (Seq.pairwise sorted |> Seq.forall (fun (x, y) -> abs x <= abs y)) true - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 let counts = Seq.countBy id (countEnumeratorsAndCheckedDisposedAtMostOnce [for i in 1..10 do yield! [10..-1..i] done ]) do check "Seq.countBy" (counts |> Seq.toList) [for i in 10..-1..1 -> i, i] - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.sum" (Seq.sum (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [1..100])) (100*101/2) - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.sumBy" (Seq.sumBy float [1..100]) (100.*101./2.) - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.average" (Seq.average (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [1.; 2.; 3.])) 2. - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.averageBy" (Seq.averageBy float (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [0..100])) 50. - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.min" (Seq.min (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [1; 4; 2; 5; 8; 4; 0; 3])) 0 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.max" (Seq.max (countEnumeratorsAndCheckedDisposedAtMostOnce [1; 4; 2; 5; 8; 4; 0; 3])) 8 - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 #if !NETCOREAPP // strings don't have enumerators in portable do check "Seq.minBy" (Seq.minBy int (countEnumeratorsAndCheckedDisposedAtMostOnce "this is a test")) ' ' - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 do check "Seq.maxBy" (Seq.maxBy int (countEnumeratorsAndCheckedDisposedAtMostOnce "this is a test")) 't' - do check "" numActiveEnumerators 0 + do check "" numActiveEnumerators 0 #endif end @@ -3582,7 +3582,7 @@ end !* check optimizations *--------------------------------------------------------------------------- *) -module Optimiations = begin +module Optimizations = begin let _ = check "opt.oi20c77u" (1 + 1) (2) let _ = check "opt.oi20c77i" (-1 + 1) (0) @@ -5173,7 +5173,7 @@ end !* BUG 1561: (-star-star-) opens a comment but does not close it and other XML Doc issues. *--------------------------------------------------------------------------- *) -(* QA note: how to test for XML doc? Programatically? *) +(* QA note: how to test for XML doc? Programmatically? *) module Check1561 = begin (** Should be XML Doc *) let itemA = () @@ -5220,12 +5220,12 @@ module Repro2247 = begin let r = MyLazy<_>() in (* Keep this binding, required for repro *) r (* Warning: Fragile repro *) - (* With optimisations off, code failed to verify *) + (* With optimizations off, code failed to verify *) end (*--------------------------------------------------------------------------- -!* BUG 1190, 3569: record and list patterns do not permit trailing seperator +!* BUG 1190, 3569: record and list patterns do not permit trailing separator *--------------------------------------------------------------------------- *) module Repro_1190 = begin @@ -5559,7 +5559,7 @@ module TripleQuoteStrings = ""world""" "Hello \r\n\"\"world" #endif #endif - // cehcek there is no escaping... + // check there is no escaping... check "ckjenew-0ecwe5" """Hello \"world""" "Hello \\\"world" check "ckjenew-0ecwe6" """Hello \\"world""" "Hello \\\\\"world" check "ckjenew-0ecwe7" """Hello \nworld""" "Hello \\nworld" diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/member-contrains-type-extension.fsx b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/member-constrains-type-extension.fsx similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/member-contrains-type-extension.fsx rename to tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/member-constrains-type-extension.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/members_basics.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/members_basics.fs index 5107dd919d4..0c067192b26 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/members_basics.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/members_basics.fs @@ -1284,7 +1284,7 @@ type DontPressThisButtonAttribute = end // BUG: -type [] button = Buttpon +type [] button = Button let [] button () = 1 //--------------------------------------------------------------------- @@ -2152,7 +2152,7 @@ let fails = ff.Invoke() -module RecursiveClassCefinitions = begin +module RecursiveClassDefinitions = begin type t1 = class @@ -2221,7 +2221,7 @@ module RecursiveAbstractClassDefinitions = begin default t1.M2() = t1.M1(t1.t2) default t1.M3(t2:t2) = // Note we can use object expressions within the recursive - // definition of the type itself. This requries real care - the + // definition of the type itself. This requires real care - the // exact set of abstract members that still need implementing // must have been determined correctly before any expressions are // analyzed. diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/mix_curried_tupled.fsx b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/mix_curried_tupled.fsx index 2302cbc5057..012619b3611 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/mix_curried_tupled.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/mix_curried_tupled.fsx @@ -65,7 +65,7 @@ type AlternativeMeh() = : obj = null -let somethingTupledReturingSomethingTupled +let somethingTupledReturningSomethingTupled ( a: int, b: int, diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/property_access_modifiers.fsx b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/property_access_modifiers.fsx new file mode 100644 index 00000000000..3da3294648b --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/property_access_modifiers.fsx @@ -0,0 +1,49 @@ +type A() = + static member StaticProperty1 with get() = 0 and set (_: int) = () + static member StaticProperty_public2 with public get() = 0 and set (_: int) = () + static member StaticProperty_public3 with get() = 0 and public set (_: int) = () + static member StaticProperty_public4 with public get() = 0 and public set (_: int) = () + static member StaticProperty_internal2 with internal get() = 0 and set (_: int) = () + static member StaticProperty_internal3 with get() = 0 and internal set (_: int) = () + static member StaticProperty_internal4 with internal get() = 0 and internal set (_: int) = () + static member StaticProperty_private2 with private get() = 0 and set (_: int) = () + static member StaticProperty_private3 with internal get() = 0 and private set (_: int) = () + static member StaticProperty_private4 with private get() = 0 and private set (_: int) = () + + member _.InstanceProperty1 with get() = 0 and set (_: int) = () + member _.InstanceProperty_public2 with public get() = 0 and set (_: int) = () + member _.InstanceProperty_public3 with get() = 0 and public set (_: int) = () + member _.InstanceProperty_public4 with public get() = 0 and public set (_: int) = () + member _.InstanceProperty_internal2 with internal get() = 0 and set (_: int) = () + member _.InstanceProperty_internal3 with get() = 0 and internal set (_: int) = () + member _.InstanceProperty_internal4 with internal get() = 0 and internal set (_: int) = () + member _.InstanceProperty_private2 with private get() = 0 and set (_: int) = () + member _.InstanceProperty_private3 with internal get() = 0 and private set (_: int) = () + member _.InstanceProperty_private4 with private get() = 0 and private set (_: int) = () + + static member StaticIndexer1 with get (_: int) = 0 and set (_: int) (_: int) = () + static member StaticIndexer_public2 with public get (_: int) = 0 and set (_: int) (_: int) = () + static member StaticIndexer_public3 with get (_: int) = 0 and public set (_: int) (_: int) = () + static member StaticIndexer_public4 with public get (_: int) = 0 and public set (_: int) (_: int) = () + static member StaticIndexer_internal2 with internal get (_: int) = 0 and set (_: int) (_: int) = () + static member StaticIndexer_internal3 with get (_: int) = 0 and internal set (_: int) (_: int) = () + static member StaticIndexer_internal4 with internal get (_: int) = 0 and internal set (_: int) (_: int) = () + static member StaticIndexer_private2 with private get (_: int) = 0 and set (_: int) (_: int) = () + static member StaticIndexer_private3 with internal get (_: int) = 0 and private set (_: int) (_: int) = () + static member StaticIndexer_private4 with private get (_: int) = 0 and private set (_: int) (_: int) = () + + member _.InstanceIndexer1 with get (_: int) = 0 and set (_: int) (_: int) = () + member _.InstanceIndexer_public2 with public get (_: int) = 0 and set (_: int) (_: int) = () + member _.InstanceIndexer_public3 with get (_: int) = 0 and public set (_: int) (_: int) = () + member _.InstanceIndexer_public4 with public get (_: int) = 0 and public set (_: int) (_: int) = () + member _.InstanceIndexer_internal2 with internal get (_: int) = 0 and set (_: int) (_: int) = () + member _.InstanceIndexer_internal3 with get (_: int) = 0 and internal set (_: int) (_: int) = () + member _.InstanceIndexer_internal4 with internal get (_: int) = 0 and internal set (_: int) (_: int) = () + member _.InstanceIndexer_private2 with private get (_: int) = 0 and set (_: int) (_: int) = () + member _.InstanceIndexer_private3 with internal get (_: int) = 0 and private set (_: int) (_: int) = () + member _.InstanceIndexer_private4 with private get (_: int) = 0 and private set (_: int) (_: int) = () + + abstract member AbstractProperty: int with get, set + default this.AbstractProperty with get () = 0 and set (_: int) = () + abstract member AbstractIndexer: int -> int with get, set + default this.AbstractIndexer with get (_: int) = 0 and set (_: int) (_: int) = () diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TypeTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/TypeTests.fs index e3be13782fd..1494c465af9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TypeTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TypeTests.fs @@ -263,3 +263,50 @@ type Foo = member Bar: a: int -> int with get member Bar: a: int -> int with set""" + +[] +let ``get_Is* method has IsUnionCaseTester = true`` () = + FSharp """ +module Lib + +type Foo = + | Bar of int + | Baz of string + member this.IsP + with get () = 42 + +let bar = Bar 5 + +let f = bar.get_IsBar +""" + |> withLangVersionPreview + |> typecheckResults + |> fun results -> + let isBarSymbolUse = results.GetSymbolUseAtLocation(12, 21, "let f = bar.get_IsBar", [ "get_IsBar" ]).Value + match isBarSymbolUse.Symbol with + | :? FSharpMemberOrFunctionOrValue as mfv -> + Assert.True(mfv.IsUnionCaseTester, "IsUnionCaseTester returned true") + Assert.True(mfv.IsMethod, "IsMethod returned true") + Assert.False(mfv.IsProperty, "IsProptery returned true") + Assert.True(mfv.IsPropertyGetterMethod, "IsPropertyGetterMethod returned false") + | _ -> failwith "Expected FSharpMemberOrFunctionOrValue" + +[] +let ``IsUnionCaseTester does not throw for non-method non-property`` () = + FSharp """ +module Lib + +type Foo() = + member _.Bar x = x + +let foo = Foo() +""" + |> withLangVersionPreview + |> typecheckResults + |> fun results -> + let isBarSymbolUse = results.GetSymbolUseAtLocation(7, 13, "let foo = Foo()", [ "Foo" ]).Value + match isBarSymbolUse.Symbol with + | :? FSharpMemberOrFunctionOrValue as mfv -> + Assert.False(mfv.IsUnionCaseTester, "IsUnionCaseTester returned true") + Assert.True(mfv.IsConstructor) + | _ -> failwith "Expected FSharpMemberOrFunctionOrValue" \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/CompilationTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/CompilationTests.fs index 829810f3eea..4142b10565f 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/CompilationTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/CompilationTests.fs @@ -2,7 +2,7 @@ open FSharp.Test open FSharp.Test.Compiler -open NUnit.Framework +open Xunit; open Scenarios [] @@ -28,8 +28,7 @@ let compileAValidScenario (scenario: Scenario) (method: Method) = let cUnit = let files = scenario.Files - |> Array.map (fun (f: FileInScenario) -> SourceCodeFileKind.Create(f.FileWithAST.File, f.Content)) - |> Array.toList + |> List.map (fun (f: FileInScenario) -> SourceCodeFileKind.Create(f.FileName, f.Content)) match files with | [] -> failwith "empty files" @@ -44,12 +43,14 @@ let compileAValidScenario (scenario: Scenario) (method: Method) = |> shouldSucceed |> ignore -let scenarios = codebases +let scenarios = scenarios |> List.map (fun c -> [| box c |]) -[] -let ``Compile a valid scenario using graph-based type-checking`` (scenario: Scenario) = +[] +[] +let ``Compile a valid scenario using graph-based type-checking`` (scenario) = compileAValidScenario scenario Method.Graph -[] -let ``Compile a valid scenario using sequential type-checking`` (scenario: Scenario) = +[] +[] +let ``Compile a valid scenario using sequential type-checking`` (scenario) = compileAValidScenario scenario Method.Sequential diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/DependencyResolutionTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/DependencyResolutionTests.fs index 13032b88548..36a246d6ced 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/DependencyResolutionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/DependencyResolutionTests.fs @@ -5,15 +5,17 @@ open NUnit.Framework open FSharp.Compiler.GraphChecking open Scenarios -let scenarios = codebases - [] let ``Supported scenario`` (scenario: Scenario) = - let files = scenario.Files |> Array.map (fun f -> TestFileWithAST.Map f.FileWithAST) + let files = + scenario.Files + |> List.map (fun f -> + {Idx = f.Index; FileName = f.FileName; ParsedInput = parseSourceCode(f.FileName, f.Content)}) + |> List.toArray let filePairs = FilePairMap(files) let graph, _trie = DependencyResolution.mkGraph filePairs files for file in scenario.Files do let expectedDeps = file.ExpectedDependencies - let actualDeps = set graph.[file.FileWithAST.Idx] - Assert.AreEqual(expectedDeps, actualDeps, $"Dependencies don't match for {System.IO.Path.GetFileName file.FileWithAST.File}") + let actualDeps = set graph.[file.Index] + Assert.AreEqual(expectedDeps, actualDeps, $"Dependencies don't match for {System.IO.Path.GetFileName file.FileName}") diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/GraphProcessingTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/GraphProcessingTests.fs index 3e5483b0a7f..f8a4c8d2d23 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/GraphProcessingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/GraphProcessingTests.fs @@ -10,7 +10,7 @@ let ``When processing a node throws an exception, an exception is raised with th let work (_processor : int -> ProcessedNode) (_node : NodeInfo) : string = failwith "Work exception" let exn = - Assert.Throws( + Assert.Throws( fun () -> processGraph graph diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/QueryTrieTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/QueryTrieTests.fs index e6fd44a3505..613d77a29ee 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/QueryTrieTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/QueryTrieTests.fs @@ -36,7 +36,7 @@ let private nestedModule name content = let private prefIdent (lid: string) = let parts = lid.Split(".") - Array.take (parts.Length - 1) parts |> List.ofArray |> PrefixedIdentifier + Array.take (parts.Length - 1) parts |> List.ofArray |> FileContentEntry.PrefixedIdentifier // Some hardcoded files that reflect the file content of the first files in the Fantomas.Core project. // See https://github.com/fsprojects/fantomas/tree/0938a3daabec80a22d2e17f82aba38456bb793df/src/Fantomas.Core @@ -758,7 +758,7 @@ let private fantomasCoreTrie: TrieNode = } [] -let ``Query non existing node in trie`` () = +let ``Query nonexistent node in trie`` () = let result = queryTrie fantomasCoreTrie [ "System"; "System"; "Runtime"; "CompilerServices" ] diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/Scenarios.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/Scenarios.fs index 6bd170a9dbf..5126282048c 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/Scenarios.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/Scenarios.fs @@ -2,41 +2,36 @@ open TestUtils +type FileInScenario = + { + Index: int + FileName: string + ExpectedDependencies: Set + Content: string + } + type Scenario = { Name: string - Files: FileInScenario array + Files: FileInScenario list } override x.ToString() = x.Name -and FileInScenario = - { - FileWithAST: TestFileWithAST - ExpectedDependencies: Set - Content: string - } - let private scenario name files = - let files = files |> List.toArray |> Array.mapi (fun idx f -> f idx) + let files = files |> List.mapi (fun idx f -> f idx) { Name = name; Files = files } let private sourceFile fileName content (dependencies: Set) = fun idx -> - let fileWithAST = - { - Idx = idx - AST = parseSourceCode (fileName, content) - File = fileName - } - { - FileWithAST = fileWithAST + Index = idx + FileName = fileName ExpectedDependencies = dependencies Content = content } -let internal codebases = +let internal scenarios = [ scenario "Link via full open statement" @@ -256,7 +251,7 @@ module Y.C // This open statement does not do anything. // It can safely be removed, but because of its presence we need to link it to something that exposes the namespace X. -// We try and pick the file with the lowest index +// We try and pick the file with the lowest index open X let c = 0 @@ -572,7 +567,7 @@ type Bar() = static member Foo () : unit = failwith "" -let Foo () : unit = +let Foo () : unit = Bar.Foo () """ (set [| 0 |]) @@ -792,7 +787,7 @@ open My.Great.Namespace type Foo = class end """ (set [| 0 |]) - + sourceFile "Program" """ @@ -897,7 +892,7 @@ do """ (set [| 0 |]) ] - + scenario "parentheses around module name in nameof expression" [ @@ -1022,4 +1017,72 @@ module Program = """ (set [| 0 |]) ] + scenario + "fully qualified type in tuple constructor pattern" + [ + sourceFile + "A.fs" + """ +namespace MyRootNamespace.A + +type Foo() = class end +""" + Set.empty + sourceFile + "B.fs" + """ +namespace MyRootNamespace.A.B + +type Bar(foo: MyRootNamespace.A.Foo, s: string) = class end +""" + (set [| 0 |]) + ] + scenario + "Library with using global namespace" + [ + sourceFile + "Library.fs" + """ +namespace Lib +module File1 = + let mutable discState = System.DateTime.Now + +module File2 = + [] + type DiscState(rep : int) = + member this.Rep = rep + + let mutable discState = DiscState(0) + """ + Set.empty + sourceFile + "App.fs" + """ +module X +let v = global.Lib.File1.discState.Second +let v2 = global.Lib.File2.discState.Rep + """ + (set [| 0 |]) + ] + scenario + "Library with using global namespace as module alias" + [ + sourceFile + "Library.fs" + """ +namespace Z + +module N = + let mutable discState = System.DateTime.Now + """ + Set.empty + sourceFile + "App.fs" + """ +module X + +module Y = global.Z.N + """ + (set [| 0 |]) + ] ] \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/PropertyShadowingTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/PropertyShadowingTests.fs index f74a6c951b7..c7cbece80e8 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/PropertyShadowingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/PropertyShadowingTests.fs @@ -24,7 +24,6 @@ module PropertyShadowingTests = compilation |> asFsx |> withNoDebug - |> withOptions ["--langversion:preview"] |> withRealInternalSignatureOff |> verifyBaselines |> compileAndRun @@ -47,7 +46,6 @@ module PropertyShadowingTests = compilation |> asFsx |> withNoDebug - |> withOptions ["--langversion:preview"] |> withRealInternalSignatureOn |> verifyBaselines |> compileAndRun @@ -91,7 +89,6 @@ module PropertyShadowingTests = compilation |> asFsx |> withNoDebug - |> withOptions ["--langversion:preview"] |> verifyBaselines |> compile |> shouldFail diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/SeqTypeCheckTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/SeqTypeCheckTests.fs index a0b78d83d1c..093b9ad3dbf 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/SeqTypeCheckTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/SeqTypeCheckTests.fs @@ -4,7 +4,7 @@ open Xunit open FSharp.Test.Compiler [] -let ``Seq expr with impicit yield type checks correctly when two identical record types are present`` () = +let ``Seq expr with implicit yield type checks correctly when two identical record types are present`` () = FSharp """ module SeqInference diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.il.bsl index 684fa3ce5e7..ba9920aed2c 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.il.bsl @@ -23,12 +23,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.il.net472.bsl index 3b62d843887..0b5a70c1354 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.il.net472.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.il.netcore.bsl index 684fa3ce5e7..ba9920aed2c 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.il.netcore.bsl @@ -23,12 +23,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.realInternalSignatureOff.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.realInternalSignatureOff.il.net472.bsl index 9a1fec0d897..f12788bef84 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.realInternalSignatureOff.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.realInternalSignatureOff.il.net472.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.realInternalSignatureOff.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.realInternalSignatureOff.il.netcore.bsl index 4504a6f2f5f..738dbe91401 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.realInternalSignatureOff.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.realInternalSignatureOff.il.netcore.bsl @@ -8,12 +8,12 @@ .assembly extern System.Collections { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 + .ver 9:0:0:0 } .assembly extern System.Linq { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 + .ver 9:0:0:0 } .assembly assembly { @@ -22,16 +22,6 @@ int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.dll @@ -114,4 +104,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.realInternalSignatureOn.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.realInternalSignatureOn.il.net472.bsl index 53e00c11f9c..316974e9a8d 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.realInternalSignatureOn.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.realInternalSignatureOn.il.net472.bsl @@ -18,12 +18,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.realInternalSignatureOn.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.realInternalSignatureOn.il.netcore.bsl index 93f09f050af..43a507d345d 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.realInternalSignatureOn.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/LinqCount.fsx.realInternalSignatureOn.il.netcore.bsl @@ -8,12 +8,12 @@ .assembly extern System.Collections { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 + .ver 9:0:0:0 } .assembly extern System.Linq { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 + .ver 9:0:0:0 } .assembly assembly { @@ -22,16 +22,6 @@ int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - } .module assembly.dll @@ -133,4 +123,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowStaticProperty.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowStaticProperty.fsx.il.bsl index ee9e1d3b8a2..e1aeb56493e 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowStaticProperty.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowStaticProperty.fsx.il.bsl @@ -13,12 +13,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowStaticProperty.fsx.realInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowStaticProperty.fsx.realInternalSignatureOff.il.bsl index cd96ae8b94e..ce7460b05d1 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowStaticProperty.fsx.realInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowStaticProperty.fsx.realInternalSignatureOff.il.bsl @@ -13,12 +13,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowStaticProperty.fsx.realInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowStaticProperty.fsx.realInternalSignatureOn.il.bsl index 4b50483a50b..c29813f3509 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowStaticProperty.fsx.realInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowStaticProperty.fsx.realInternalSignatureOn.il.bsl @@ -13,12 +13,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithExtensionMethod.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithExtensionMethod.fsx.il.bsl index 66c098c1490..aa9089128c3 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithExtensionMethod.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithExtensionMethod.fsx.il.bsl @@ -13,12 +13,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithExtensionMethod.fsx.realInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithExtensionMethod.fsx.realInternalSignatureOff.il.bsl index e19df3fd009..7bb420bd8b6 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithExtensionMethod.fsx.realInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithExtensionMethod.fsx.realInternalSignatureOff.il.bsl @@ -13,12 +13,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithExtensionMethod.fsx.realInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithExtensionMethod.fsx.realInternalSignatureOn.il.bsl index 93ac1ea9b3e..f90308b7c57 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithExtensionMethod.fsx.realInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithExtensionMethod.fsx.realInternalSignatureOn.il.bsl @@ -13,12 +13,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.il.bsl index a0e89588014..e96af9ece71 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.il.bsl @@ -13,12 +13,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.realInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.realInternalSignatureOff.il.bsl index a0e89588014..e96af9ece71 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.realInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.realInternalSignatureOff.il.bsl @@ -13,12 +13,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.realInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.realInternalSignatureOn.il.bsl index c6f995e96f1..50c58d1a2b2 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.realInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.realInternalSignatureOn.il.bsl @@ -13,12 +13,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithTypeExtension.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithTypeExtension.fsx.il.bsl index b9883181ec6..4baf9344ebf 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithTypeExtension.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithTypeExtension.fsx.il.bsl @@ -13,12 +13,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithTypeExtension.fsx.realInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithTypeExtension.fsx.realInternalSignatureOff.il.bsl index 8707d390da5..2fa391c3858 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithTypeExtension.fsx.realInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithTypeExtension.fsx.realInternalSignatureOff.il.bsl @@ -13,12 +13,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithTypeExtension.fsx.realInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithTypeExtension.fsx.realInternalSignatureOn.il.bsl index dbcbebee176..531dddf3cfc 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithTypeExtension.fsx.realInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithTypeExtension.fsx.realInternalSignatureOn.il.bsl @@ -13,12 +13,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowingAndStillOkWithChainedCalls.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowingAndStillOkWithChainedCalls.fsx.il.bsl index b7969f50320..c9699acb080 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowingAndStillOkWithChainedCalls.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowingAndStillOkWithChainedCalls.fsx.il.bsl @@ -13,12 +13,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowingAndStillOkWithChainedCalls.fsx.realInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowingAndStillOkWithChainedCalls.fsx.realInternalSignatureOff.il.bsl index 6d38176836d..3c37dfa962d 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowingAndStillOkWithChainedCalls.fsx.realInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowingAndStillOkWithChainedCalls.fsx.realInternalSignatureOff.il.bsl @@ -13,12 +13,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowingAndStillOkWithChainedCalls.fsx.realInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowingAndStillOkWithChainedCalls.fsx.realInternalSignatureOn.il.bsl index c696c9e43d0..a129d2263dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowingAndStillOkWithChainedCalls.fsx.realInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowingAndStillOkWithChainedCalls.fsx.realInternalSignatureOn.il.bsl @@ -13,12 +13,12 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 } -.mresource public FSharpSignatureData.assembly +.mresource public FSharpSignatureCompressedData.assembly { } -.mresource public FSharpOptimizationData.assembly +.mresource public FSharpOptimizationCompressedData.assembly { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/TypeExtensions/PropertyShadowingTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/TypeExtensions/PropertyShadowingTests.fs index eefb9cf7a98..d577d038670 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/TypeExtensions/PropertyShadowingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/TypeExtensions/PropertyShadowingTests.fs @@ -17,10 +17,9 @@ let [] folder = __SOURCE_DIRECTORY__ + "/Shadowing" "ShadowWithLastOpenedTypeExtensions.fsx" |] )>] -let PropertyHidding compilation = +let PropertyHiding compilation = compilation |> asFsx - |> withOptions ["--langversion:preview"] |> verifyBaselines |> compileAndRun |> shouldSucceed @@ -60,7 +59,6 @@ let ``PropertyHiding v7.0`` compilation = let ``PropertyHiding fails`` compilation = compilation |> asFsx - |> withOptions ["--langversion:preview"] |> verifyBaselines |> compile |> shouldFail diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals009.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals009.fs index 21a52fa7b09..250bf5ef477 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals009.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/NumericLiterals/E_enumNegativeLiterals009.fs @@ -3,8 +3,8 @@ // Enum type definitions do not support negative literals // Negative literal with no space // As per FSHARP1.0:3714, enums can't be based on floats (pos/neg) -//Literal enumerations must have type int, uint, int16, uint16, int64, uint64, byte, sbyte or char -//Literal enumerations must have type int, uint, int16, uint16, int64, uint64, byte, sbyte or char + + #light type EnumDouble = | A1 = -1.2 // err diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/BindingsWithValues01.fsx b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/BindingsWithValues01.fsx index 655a9f0524d..17833e3436f 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/BindingsWithValues01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/BindingsWithValues01.fsx @@ -34,7 +34,7 @@ let B = "Hello" // reference type - val B: str let c' = { Name = "F#" } // record - val c': RecT = { Name = "F#" } -let _d = Office // disc unioin - val _d: Bldg = Office +let _d = Office // disc union - val _d: Bldg = Office let e = {1..2..100} // sequence - val e: seq = let F'F = [3..-1..1] // list - val F'F: int list = [3; 2; 1] diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/CustomExceptions02.fsx b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/CustomExceptions02.fsx index c3a2d77b8d1..05d18263962 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/CustomExceptions02.fsx +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/Printing/CustomExceptions02.fsx @@ -1,7 +1,7 @@ // #Regression #NoMT #Printing #light -// Test for FSharp1.0:4086 - accessiblity not printed for exceptions +// Test for FSharp1.0:4086 - accessibility not printed for exceptions //exception internal A of int //exception private B of string //exception C of System\.DateTime diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Parsing/GreaterBarRBrack01.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Parsing/GreaterBarRBrack01.fs index d87b1f3d459..5076c1e243c 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Parsing/GreaterBarRBrack01.fs +++ b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Parsing/GreaterBarRBrack01.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #UnitsOfMeasure // Regression test for FSHARP1.0:2791 -// Make sure we can parse arrays of dimensioned numbers without needing a a space between > and |] +// Make sure we can parse arrays of dimensioned numbers without needing a space between > and |] // #light diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/CompletionTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/CompletionTests.fs index 01dd539eab7..56ce63c84fd 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/CompletionTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/CompletionTests.fs @@ -100,7 +100,7 @@ type CompletionTests() = Assert.Equal(0, matchingCompletions.Length) // Strange names like ``+`` and ``-`` are just normal text and not operators - // and are present in competion lists + // and are present in completion lists let matchingCompletions = completions |> Array.filter (fun d -> d.NameInList = "-") Assert.Equal(1, matchingCompletions.Length) Assert.Equal("``-``", matchingCompletions.[0].NameInCode) @@ -139,7 +139,7 @@ type CompletionTests() = Assert.Equal(0, matchingCompletions.Length) // Strange names like ``+`` and ``-`` are just normal text and not operators - // and are present in competion lists + // and are present in completion lists let matchingCompletions = completions |> Array.filter (fun d -> d.NameInList = "-") Assert.Equal(1, matchingCompletions.Length) Assert.Equal("``-``", matchingCompletions.[0].NameInCode) diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs index 19c3009b17a..8a1bb95b2d2 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs @@ -89,7 +89,7 @@ type DependencyManagerInteractiveTests() = Assert.Equal(1, result.SourceFiles |> Seq.length) Assert.Equal(2, result.Roots |> Seq.length) - let result = dp.Resolve(idm, ".fsx", [|"r", "FSharp.Data,3.3.3"|], reportError, "net8.0") + let result = dp.Resolve(idm, ".fsx", [|"r", "FSharp.Data,3.3.3"|], reportError, "net9.0") Assert.Equal(true, result.Success) Assert.Equal(1, result.Resolutions |> Seq.length) Assert.Equal(1, result.SourceFiles |> Seq.length) @@ -111,7 +111,7 @@ type DependencyManagerInteractiveTests() = let idm = dp.TryFindDependencyManagerByKey(Seq.empty, "", reportError, "nuget") - let result = dp.Resolve(idm, ".fsx", [|"r", "Microsoft.Data.Sqlite, 3.1.8"|], reportError, "net8.0") + let result = dp.Resolve(idm, ".fsx", [|"r", "Microsoft.Data.Sqlite, 3.1.8"|], reportError, "net9.0") Assert.Equal(true, result.Success) Assert.True((result.Resolutions |> Seq.length) > 1) Assert.Equal(1, result.SourceFiles |> Seq.length) @@ -141,7 +141,7 @@ type DependencyManagerInteractiveTests() = Assert.Equal(0, result.SourceFiles |> Seq.length) Assert.Equal(0, result.Roots |> Seq.length) - let result = dp.Resolve(idm, ".fsx", [|"r", "System.Collections.Immutable.DoesNotExist"|], reportError, "net8.0") + let result = dp.Resolve(idm, ".fsx", [|"r", "System.Collections.Immutable.DoesNotExist"|], reportError, "net9.0") Assert.Equal(false, result.Success) Assert.Equal(0, result.Resolutions |> Seq.length) Assert.Equal(0, result.SourceFiles |> Seq.length) @@ -174,7 +174,7 @@ type DependencyManagerInteractiveTests() = Assert.True((result1.Roots |> Seq.head).EndsWith("/fsharp.data/3.3.3/")) Assert.True((result1.Roots |> Seq.last).EndsWith("/microsoft.netframework.referenceassemblies/1.0.0/")) - let result2 = dp1.Resolve(idm1, ".fsx", [|"r", "FSharp.Data,3.3.3"|], reportError, "net8.0") + let result2 = dp1.Resolve(idm1, ".fsx", [|"r", "FSharp.Data,3.3.3"|], reportError, "net9.0") Assert.Equal(true, result2.Success) Assert.Equal(1, result2.Resolutions |> Seq.length) let expected2 = "/netstandard2.0/" @@ -195,7 +195,7 @@ type DependencyManagerInteractiveTests() = Assert.Equal(1, result3.SourceFiles |> Seq.length) Assert.True((result3.Roots |> Seq.head).EndsWith("/system.json/4.6.0/")) - let result4 = dp2.Resolve(idm2, ".fsx", [|"r", "System.Json, Version=4.6.0"|], reportError, "net8.0") + let result4 = dp2.Resolve(idm2, ".fsx", [|"r", "System.Json, Version=4.6.0"|], reportError, "net9.0") Assert.Equal(true, result4.Success) Assert.Equal(1, result4.Resolutions |> Seq.length) let expected4 = "/netstandard2.0/" @@ -231,7 +231,7 @@ type DependencyManagerInteractiveTests() = // Netstandard gets fewer dependencies than desktop, because desktop framework doesn't contain assemblies like System.Memory // Those assemblies must be delivered by nuget for desktop apps - let result2 = dp1.Resolve(idm1, ".fsx", [|"r", "Microsoft.Extensions.Configuration.Abstractions, 3.1.1"|], reportError, "net8.0") + let result2 = dp1.Resolve(idm1, ".fsx", [|"r", "Microsoft.Extensions.Configuration.Abstractions, 3.1.1"|], reportError, "net9.0") Assert.Equal(true, result2.Success) Assert.Equal(2, result2.Resolutions |> Seq.length) let expected = "/netcoreapp3.1/" @@ -264,6 +264,10 @@ TorchSharp.Tensor.LongTensor.From([| 0L .. 100L |]).Device [] member _.``Use Dependency Manager to restore packages with native dependencies, build and run script that depends on the results``() = + // Skip test on arm64, because there is not an arm64 native library + if RuntimeInformation.ProcessArchitecture = Architecture.Arm64 then + () + else let packagemanagerlines = [| "r", "Microsoft.ML,version=1.4.0-preview" "r", "Microsoft.ML.AutoML,version=0.16.0-preview" @@ -288,7 +292,7 @@ TorchSharp.Tensor.LongTensor.From([| 0L .. 100L |]).Device let result = use dp = new DependencyProvider(AssemblyResolutionProbe(assemblyProbingPaths), NativeResolutionProbe(nativeProbingRoots), false) let idm = dp.TryFindDependencyManagerByKey(Seq.empty, "", reportError, "nuget") - dp.Resolve(idm, ".fsx", packagemanagerlines, reportError, "net8.0") + dp.Resolve(idm, ".fsx", packagemanagerlines, reportError, "net9.0") Assert.True(result.Success, "resolve failed") @@ -360,6 +364,10 @@ printfn ""%A"" result [] member _.``Use NativeResolver to resolve native dlls.``() = + // Skip test on arm64, because there is not an arm64 native library + if RuntimeInformation.ProcessArchitecture = Architecture.Arm64 then + () + else let packagemanagerlines = [| "r", "Microsoft.ML,version=1.4.0-preview" "r", "Microsoft.ML.AutoML,version=0.16.0-preview" @@ -384,14 +392,14 @@ printfn ""%A"" result let result = use dp = new DependencyProvider(NativeResolutionProbe(nativeProbingRoots), false) let idm = dp.TryFindDependencyManagerByKey(Seq.empty, "", reportError, "nuget") - dp.Resolve(idm, ".fsx", packagemanagerlines, reportError, "net8.0") + dp.Resolve(idm, ".fsx", packagemanagerlines, reportError, "net9.0") Assert.True(result.Success, "resolve failed") resolverPackageRoots <- result.Roots resolverReferences <- result.Resolutions - use _nativeDepencyResolver = new NativeDllResolveHandler(NativeResolutionProbe(nativeProbingRoots)) + use _nativeDependencyResolver = new NativeDllResolveHandler(NativeResolutionProbe(nativeProbingRoots)) // Build and execute script let referenceText = @@ -442,6 +450,10 @@ printfn ""%A"" result [] member _.``Use AssemblyResolver to resolve assemblies``() = + // Skip test on arm64, because there is not an arm64 native library + if RuntimeInformation.ProcessArchitecture = Architecture.Arm64 then + () + else let packagemanagerlines = [| "r", "Microsoft.ML,version=1.4.0-preview" "r", "Microsoft.ML.AutoML,version=0.16.0-preview" @@ -465,7 +477,7 @@ printfn ""%A"" result let result = use dp = new DependencyProvider(NativeResolutionProbe(nativeProbingRoots), false) let idm = dp.TryFindDependencyManagerByKey(Seq.empty, "", reportError, "nuget") - dp.Resolve(idm, ".fsx", packagemanagerlines, reportError, "net8.0") + dp.Resolve(idm, ".fsx", packagemanagerlines, reportError, "net9.0") Assert.True(result.Success, "resolve failed") @@ -522,9 +534,9 @@ x |> Seq.iter(fun r -> let result = use dp = new DependencyProvider(NativeResolutionProbe(nativeProbingRoots), false) let idm = dp.TryFindDependencyManagerByKey(Seq.empty, "", reportError, "nuget") - dp.Resolve(idm, ".fsx", packagemanagerlines, reportError, "net8.0") + dp.Resolve(idm, ".fsx", packagemanagerlines, reportError, "net9.0") - // Expected: error FS3217: PackageManager can not reference the System Package 'FSharp.Core' + // Expected: error FS3217: PackageManager cannot reference the System Package 'FSharp.Core' Assert.False(result.Success, "resolve succeeded but should have failed") [] @@ -548,7 +560,7 @@ x |> Seq.iter(fun r -> let result = use dp = new DependencyProvider(NativeResolutionProbe(nativeProbingRoots), false) let idm = dp.TryFindDependencyManagerByKey(Seq.empty, "", reportError, "nuget") - dp.Resolve(idm, ".csx", packagemanagerlines, reportError, "net8.0") + dp.Resolve(idm, ".csx", packagemanagerlines, reportError, "net9.0") Assert.True(result.Success, "resolve failed but should have succeeded") @@ -572,7 +584,7 @@ x |> Seq.iter(fun r -> do use dp = new DependencyProvider(NativeResolutionProbe(nativeProbingRoots), false) - // Invoking a non-existent dll via pinvoke cause a probe. which should invoke the call back + // Invoking a nonexistent dll via pinvoke cause a probe. which should invoke the call back try Native.NoneSuch() |> ignore with _ -> () Assert.True (found, "Failed to invoke the nativeProbingRoots callback") @@ -591,7 +603,7 @@ x |> Seq.iter(fun r -> Assert.Equal(1, result.SourceFiles |> Seq.length) Assert.Equal(2, result.Roots |> Seq.length) - let result = dp.Resolve(idm, ".fsx", [|"r", "FSharp.Data,3.3.3"|], reportError, "net8.0") + let result = dp.Resolve(idm, ".fsx", [|"r", "FSharp.Data,3.3.3"|], reportError, "net9.0") Assert.Equal(true, result.Success) Assert.Equal(1, result.Resolutions |> Seq.length) Assert.Equal(1, result.SourceFiles |> Seq.length) @@ -616,11 +628,11 @@ x |> Seq.iter(fun r -> do use dp = new DependencyProvider(AssemblyResolutionProbe(assemblyProbingPaths), NativeResolutionProbe(nativeProbingRoots), false) - // Invoking a non-existent dll via pinvoke cause a probe. which should invoke the call back + // Invoking a nonexistent dll via pinvoke cause a probe. which should invoke the call back try Native.NoneSuch() |> ignore with _ -> () Assert.True (nativeFound, "Failed to invoke the nativeProbingRoots callback") - // Invoking a non-existent assembly causes a probe. which should invoke the call back + // Invoking a nonexistent assembly causes a probe. which should invoke the call back try Assembly.Load("NoneSuchAssembly") |> ignore with _ -> () Assert.True (assemblyFound, "Failed to invoke the AssemblyResolve handler") @@ -647,7 +659,7 @@ x |> Seq.iter(fun r -> do use dp = new AssemblyResolveHandler(AssemblyResolutionProbe(assemblyProbingPaths)) - // Invoking a non-existent assembly causes a probe. which should invoke the call back + // Invoking a nonexistent assembly causes a probe. which should invoke the call back try Assembly.Load("NoneSuchAssembly") |> ignore with _ -> () Assert.True (assemblyFound, "Failed to invoke the AssemblyResolve handler") @@ -698,7 +710,7 @@ x |> Seq.iter(fun r -> let mutable currentPath:string = null use dp = new DependencyProvider(NativeResolutionProbe(nativeProbingRoots), false) let idm = dp.TryFindDependencyManagerByKey(Seq.empty, "", reportError, "nuget") - let result = dp.Resolve(idm, ".fsx", [|"r", "Microsoft.Data.Sqlite,3.1.7"|], reportError, "net8.0") + let result = dp.Resolve(idm, ".fsx", [|"r", "Microsoft.Data.Sqlite,3.1.7"|], reportError, "net9.0") Assert.Equal(true, result.Success) currentPath <- appendSemiColon (Environment.GetEnvironmentVariable("PATH")) finalPath <- appendSemiColon (Environment.GetEnvironmentVariable("PATH")) @@ -824,7 +836,7 @@ x |> Seq.iter(fun r -> ResolvingErrorReport (report) let idm = dp.TryFindDependencyManagerByKey(Seq.empty, "", reportError, "nuget") - let result = dp.Resolve(idm, ".fsx", [|"r", "FSharp.Data,3.3.3"|], reportError, "net8.0", timeout=0) // Fail in 0 milliseconds + let result = dp.Resolve(idm, ".fsx", [|"r", "FSharp.Data,3.3.3"|], reportError, "net9.0", timeout=0) // Fail in 0 milliseconds Assert.Equal(false, result.Success) Assert.Equal(foundCorrectError, true) Assert.Equal(foundWrongError, false) @@ -847,7 +859,7 @@ x |> Seq.iter(fun r -> ResolvingErrorReport (report) let idm = dp.TryFindDependencyManagerByKey(Seq.empty, "", reportError, "nuget") - let result = dp.Resolve(idm, ".fsx", [|"r", "FSharp.Data,3.3.3"; "r", "timeout=0"|], reportError, "net8.0", null, "", "", "", -1) // Wait forever + let result = dp.Resolve(idm, ".fsx", [|"r", "FSharp.Data,3.3.3"; "r", "timeout=0"|], reportError, "net9.0", null, "", "", "", -1) // Wait forever Assert.Equal(false, result.Success) Assert.Equal(foundCorrectError, true) Assert.Equal(foundWrongError, false) @@ -870,7 +882,7 @@ x |> Seq.iter(fun r -> ResolvingErrorReport (report) let idm = dp.TryFindDependencyManagerByKey(Seq.empty, "", reportError, "nuget") - let result = dp.Resolve(idm, ".fsx", [|"r", "FSharp.Data,3.3.3"; "r", "timeout=none"|], reportError, "net8.0", null, "", "", "", -1) // Wait forever + let result = dp.Resolve(idm, ".fsx", [|"r", "FSharp.Data,3.3.3"; "r", "timeout=none"|], reportError, "net9.0", null, "", "", "", -1) // Wait forever Assert.Equal(true, result.Success) Assert.Equal(foundCorrectError, false) Assert.Equal(foundWrongError, false) @@ -896,7 +908,7 @@ x |> Seq.iter(fun r -> let idm = dp.TryFindDependencyManagerByKey(Seq.empty, "", reportError, "nuget") // Resolve and cache the results won't time out - let result = dp.Resolve(idm, ".fsx", [|"r", "FSharp.Data,3.3.3"; "r", "timeout=10000"|], reportError, "net8.0", null, "", "", "", -1) // Wait forever + let result = dp.Resolve(idm, ".fsx", [|"r", "FSharp.Data,3.3.3"; "r", "timeout=10000"|], reportError, "net9.0", null, "", "", "", -1) // Wait forever // Clear the results foundCorrectError <- false @@ -905,7 +917,7 @@ x |> Seq.iter(fun r -> // Now clear the cache --- this will ensure that resolving produces a timeout error. If we read from the cache the test will fail dp.ClearResultsCache(Seq.empty, "", reportError) - let result = dp.Resolve(idm, ".fsx", [|"r", "FSharp.Data,3.3.3"; "r", "timeout=0"|], reportError, "net8.0", null, "", "", "", -1) // Wait forever + let result = dp.Resolve(idm, ".fsx", [|"r", "FSharp.Data,3.3.3"; "r", "timeout=0"|], reportError, "net9.0", null, "", "", "", -1) // Wait forever Assert.Equal(false, result.Success) Assert.Equal(foundCorrectError, true) Assert.Equal(foundWrongError, false) diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs index 78a535c39b9..50c354da629 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs @@ -247,6 +247,10 @@ System.Configuration.ConfigurationManager.AppSettings.Item "Environment" <- "LOC #if NETSTANDARD [] member _.``ML - use assembly with native dependencies``() = + // Skip test on arm64, because there is not an arm64 native library + if RuntimeInformation.ProcessArchitecture = Architecture.Arm64 then + () + else let code = @" #r ""nuget:Microsoft.ML,version=1.4.0-preview"" #r ""nuget:Microsoft.ML.AutoML,version=0.16.0-preview"" @@ -285,7 +289,7 @@ let details = result.RunDetails printfn ""%A"" result 123 " - use script = new FSharpScript(additionalArgs=[|"/langversion:preview"|]) + use script = new FSharpScript(additionalArgs=[| |]) let opt = script.Eval(code) |> getValue let value = opt.Value Assert.Equal(123, value.ReflectionValue :?> int32) @@ -293,7 +297,7 @@ printfn ""%A"" result [] member _.``Eval script with package manager invalid key``() = - use script = new FSharpScript(additionalArgs=[|"/langversion:preview"|]) + use script = new FSharpScript(additionalArgs=[| |]) let result, _errors = script.Eval(@"#r ""nugt:FSharp.Data""") match result with | Ok(_) -> Assert.False(true, "expected a failure") @@ -302,7 +306,7 @@ printfn ""%A"" result [] member _.``Eval script with invalid PackageName should fail immediately``() = use output = new RedirectConsoleOutput() - use script = new FSharpScript(additionalArgs=[|"/langversion:preview"|]) + use script = new FSharpScript(additionalArgs=[| |]) let mutable found = 0 let outp = System.Collections.Generic.List() output.OutputProduced.Add( @@ -318,7 +322,7 @@ printfn ""%A"" result [] member _.``Eval script with invalid PackageName should fail immediately and resolve one time only``() = use output = new RedirectConsoleOutput() - use script = new FSharpScript(additionalArgs=[|"/langversion:preview"|]) + use script = new FSharpScript(additionalArgs=[| |]) let mutable foundResolve = 0 output.OutputProduced.Add (fun line -> if line.Contains("error NU1101:") then foundResolve <- foundResolve + 1) let result, errors = @@ -343,7 +347,7 @@ let inputValues = [| 12.0; 10.0; 17.0; 5.0 |] let tInput = new DenseTensor(inputValues.AsMemory(), new ReadOnlySpan([|4|])) tInput.Length """ - use script = new FSharpScript(additionalArgs=[|"/langversion:preview"|]) + use script = new FSharpScript(additionalArgs=[| |]) let opt = script.Eval(code) |> getValue let value = opt.Value Assert.Equal(4L, downcast value.ReflectionValue) @@ -354,7 +358,7 @@ tInput.Length #r "nuget:System.Device.Gpio, 1.0.0" typeof.Assembly.Location """ - use script = new FSharpScript(additionalArgs=[|"/langversion:preview"|]) + use script = new FSharpScript(additionalArgs=[| |]) let opt = script.Eval(code) |> getValue let value = opt.Value @@ -386,7 +390,7 @@ else printfn ""Current process: %d"" (Imports.getpid()) 123 " - use script = new FSharpScript(additionalArgs=[|"/langversion:preview"|]) + use script = new FSharpScript(additionalArgs=[| |]) let opt = script.Eval(code) |> getValue let value = opt.Value Assert.Equal(123, value.ReflectionValue :?> int32) @@ -478,7 +482,7 @@ let test p str = false test pfloat "1.234" """ - use script = new FSharpScript(additionalArgs=[|"/langversion:preview"|]) + use script = new FSharpScript(additionalArgs=[| |]) let opt = script.Eval(code) |> getValue let value = opt.Value Assert.True(true = downcast value.ReflectionValue) diff --git a/tests/FSharp.Compiler.Service.Tests/AssemblyContentProviderTests.fs b/tests/FSharp.Compiler.Service.Tests/AssemblyContentProviderTests.fs index f20ec76253b..cb4521b7af4 100644 --- a/tests/FSharp.Compiler.Service.Tests/AssemblyContentProviderTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/AssemblyContentProviderTests.fs @@ -63,7 +63,7 @@ let private getSymbolMap (getSymbolProperty: AssemblySymbol -> 'a) (source: stri |> List.map (fun s -> getCleanedFullName s, getSymbolProperty s) |> Map.ofList -[] +[] let ``implicitly added Module suffix is removed``() = """ type MyType = { F: int } @@ -76,7 +76,7 @@ module MyType = "Test.MyType" "Test.MyType.func123"] -[] +[] let ``Module suffix added by an explicitly applied ModuleSuffix attribute is removed``() = """ [] @@ -87,7 +87,7 @@ module MyType = "Test.MyType" "Test.MyType.func123" ] -[] +[] let ``Property getters and setters are removed``() = """ type MyType() = @@ -97,7 +97,7 @@ let ``Property getters and setters are removed``() = "Test.MyType" "Test.MyType.MyProperty" ] -[] +[] let ``TopRequireQualifiedAccessParent property should be valid``() = let source = """ module M1 = @@ -144,7 +144,7 @@ let ``TopRequireQualifiedAccessParent property should be valid``() = assertAreEqual (expectedResult, actual) -[] +[] let ``Check Unresolved Symbols``() = let source = """ namespace ``1 2 3`` @@ -202,6 +202,7 @@ module Test = "1 2 3.Test.M1.A.B", "open ``1 2 3`` - Test.M1.A.B"; "1 2 3.Test.M1.A.C", "open ``1 2 3`` - Test.M1.A.C"; "1 2 3.Test.M1.A.op_PlusPlus", "open ``1 2 3`` - Test.M1.A.op_PlusPlus"; + "1 2 3.Test.M1.(|Is1|_|)", "open ``1 2 3`` - Test.M1.``(|Is1|_|)``" "1 2 3.Test.M1.B", "open ``1 2 3`` - Test.M1.B"; "1 2 3.Test.M1.E", "open ``1 2 3`` - Test.M1.E"; "1 2 3.Test.M1.F", "open ``1 2 3`` - Test.M1.F"; diff --git a/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs b/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs index 506b593b203..16b0ff7b878 100644 --- a/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs @@ -23,7 +23,7 @@ module BuildGraphTests = }), WeakReference(o) [] - let ``Intialization of graph node should not have a computed value``() = + let ``Initialization of graph node should not have a computed value``() = let node = GraphNode(async { return 1 }) Assert.shouldBeTrue(node.TryPeekValue().IsNone) Assert.shouldBeFalse(node.HasValue) @@ -524,9 +524,9 @@ module BuildGraphTests = } |> Async.RunImmediate - // Synchronus code will affect current context: + // Synchronous code will affect current context: - // This is synchrouous, caller's context is affected + // This is synchronous, caller's context is affected async { SetThreadDiagnosticsLoggerNoUnwind DiscardErrorsLogger do! Async.SwitchToNewThread() diff --git a/tests/FSharp.Compiler.Service.Tests/CSharpProjectAnalysis.fs b/tests/FSharp.Compiler.Service.Tests/CSharpProjectAnalysis.fs index 9fdc2a08048..a2f4c122591 100644 --- a/tests/FSharp.Compiler.Service.Tests/CSharpProjectAnalysis.fs +++ b/tests/FSharp.Compiler.Service.Tests/CSharpProjectAnalysis.fs @@ -12,7 +12,7 @@ open TestFramework let internal getProjectReferences (content: string, dllFiles, libDirs, otherFlags) = let otherFlags = defaultArg otherFlags [] let libDirs = defaultArg libDirs [] - let base1 = tryCreateTemporaryFileName () + let base1 = getTemporaryFileName () let dllName = Path.ChangeExtension(base1, ".dll") let fileName1 = Path.ChangeExtension(base1, ".fs") let projFileName = Path.ChangeExtension(base1, ".fsproj") @@ -106,7 +106,7 @@ let _ = CSharpOuterClass.InnerClass.StaticMember() [] -let ``Test that symbols of csharp inner classes/enums are reported from dervied generic class`` () = +let ``Test that symbols of csharp inner classes/enums are reported from derived generic class`` () = let csharpAssembly = PathRelativeToTestAssembly "CSharp_Analysis.dll" let content = """ module NestedEnumClass diff --git a/tests/FSharp.Compiler.Service.Tests/Common.fs b/tests/FSharp.Compiler.Service.Tests/Common.fs index 68e5c68598a..df51f666ccd 100644 --- a/tests/FSharp.Compiler.Service.Tests/Common.fs +++ b/tests/FSharp.Compiler.Service.Tests/Common.fs @@ -5,10 +5,10 @@ open System open System.Diagnostics open System.IO open System.Collections.Generic +open System.Threading open System.Threading.Tasks open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.IO -open FSharp.Compiler.Diagnostics open FSharp.Compiler.Symbols open FSharp.Compiler.Syntax open FSharp.Compiler.Text @@ -34,7 +34,7 @@ type Async with let checker = FSharpChecker.Create(useTransparentCompiler=FSharp.Compiler.CompilerConfig.FSharpExperimentalFeaturesEnabledAutomatically) type TempFile(ext, contents: string) = - let tmpFile = Path.ChangeExtension(tryCreateTemporaryFileName (), ext) + let tmpFile = Path.ChangeExtension(getTemporaryFileName (), ext) do FileSystem.OpenFileForWriteShim(tmpFile).Write(contents) interface IDisposable with @@ -130,8 +130,8 @@ let mkProjectCommandLineArgsForScript (dllName, fileNames) = #endif let mkTestFileAndOptions source additionalArgs = - let fileName = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let project = tryCreateTemporaryFileName () + let fileName = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let project = getTemporaryFileName () let dllName = Path.ChangeExtension(project, ".dll") let projFileName = Path.ChangeExtension(project, ".fsproj") let fileSource1 = "module M" @@ -473,3 +473,63 @@ let assertRange Assert.Equal(Position.mkPos expectedStartLine expectedStartColumn, actualRange.Start) Assert.Equal(Position.mkPos expectedEndLine expectedEndColumn, actualRange.End) +[] +module TempDirUtils = + let getTempPath dir = + Path.Combine(Path.GetTempPath(), dir) + + /// Returns the file name part of a temp file name created with tryCreateTemporaryFileName () + /// and an added process id and thread id to ensure uniqueness between threads. + let getTempFileName() = + let tempFileName = getTemporaryFileName () + try + let tempFile, tempExt = Path.GetFileNameWithoutExtension tempFileName, Path.GetExtension tempFileName + let procId, threadId = Process.GetCurrentProcess().Id, Thread.CurrentThread.ManagedThreadId + String.concat "" [tempFile; "_"; string procId; "_"; string threadId; tempExt] // ext includes dot + finally + try + FileSystem.FileDeleteShim tempFileName + with _ -> () + + /// Given just a file name, returns it with changed extension located in %TEMP%\ExprTests + let getTempFilePathChangeExt dir tmp ext = + Path.Combine(getTempPath dir, Path.ChangeExtension(tmp, ext)) + + /// If it doesn't exists, create a folder 'ExprTests' in local user's %TEMP% folder + let createTempDir dirName = + let tempPath = getTempPath dirName + do + if Directory.Exists tempPath then () + else Directory.CreateDirectory tempPath |> ignore + + /// Clean up after a test is run. If you need to inspect the create *.fs files, change this function to do nothing, or just break here. + let cleanupTempFiles dirName files = + { new IDisposable with + member _.Dispose() = + for fileName in files do + try + // cleanup: only the source file is written to the temp dir. + FileSystem.FileDeleteShim fileName + with _ -> () + + try + // remove the dir when empty + let tempPath = getTempPath dirName + if Directory.GetFiles tempPath |> Array.isEmpty then + Directory.Delete tempPath + with _ -> () } + + let createProjectOptions dirName fileSources extraArgs = + let fileNames = fileSources |> List.map (fun _ -> getTempFileName()) + let temp2 = getTempFileName() + let fileNames = fileNames |> List.map (fun temp1 -> getTempFilePathChangeExt dirName temp1 ".fs") + let dllName = getTempFilePathChangeExt dirName temp2 ".dll" + let projFileName = getTempFilePathChangeExt dirName temp2 ".fsproj" + + createTempDir dirName + for fileSource: string, fileName in List.zip fileSources fileNames do + FileSystem.OpenFileForWriteShim(fileName).Write(fileSource) + let args = [| yield! extraArgs; yield! mkProjectCommandLineArgs (dllName, []) |] + let options = { checker.GetProjectOptionsFromCommandLineArgs (projFileName, args) with SourceFiles = fileNames |> List.toArray } + + cleanupTempFiles dirName (fileNames @ [dllName; projFileName]), options diff --git a/tests/FSharp.Compiler.Service.Tests/EditorTests.fs b/tests/FSharp.Compiler.Service.Tests/EditorTests.fs index 4c462828857..79e7f244343 100644 --- a/tests/FSharp.Compiler.Service.Tests/EditorTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/EditorTests.fs @@ -130,6 +130,10 @@ let ``GetMethodsAsSymbols should return all overloads of a method as FSharpSymbo let expected = [("Concat", [("values", "Collections.Generic.IEnumerable<'T>")]); ("Concat", [("values", "Collections.Generic.IEnumerable")]); +#if NETCOREAPP + ("Concat", [("args", "ReadOnlySpan")]); + ("Concat", [("values", "ReadOnlySpan")]); +#endif ("Concat", [("arg0", "obj")]); ("Concat", [("args", "obj array")]); ("Concat", [("values", "string array")]); @@ -611,7 +615,7 @@ let _ = sprintf "ABCDE" |> shouldEqual [||] [] -let ``Single case discreminated union type definition`` () = +let ``Single case discriminated union type definition`` () = let input = """ type DU = Case1 @@ -726,7 +730,7 @@ let _ = su.Symbol.ToString(), (r.StartLine, r.StartColumn, r.EndLine, r.EndColumn)) |> Array.distinct |> shouldEqual - // note: these "System" sysbol uses are not duplications because each of them corresponts to different namespaces + // note: these "System" symbol uses are not duplications because each of them corresponds to different namespaces [|("System", (2, 5, 2, 11)) ("ConsoleKey", (5, 10, 5, 20)); ("field Tab", (5, 10, 5, 24)); diff --git a/tests/FSharp.Compiler.Service.Tests/ExprTests.fs b/tests/FSharp.Compiler.Service.Tests/ExprTests.fs index df074fcaa8c..3a7cf3eb68d 100644 --- a/tests/FSharp.Compiler.Service.Tests/ExprTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ExprTests.fs @@ -3,18 +3,14 @@ open Xunit open FsUnit open System -open System.IO open System.Text open System.Collections.Generic -open System.Diagnostics -open System.Threading open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.Diagnostics open FSharp.Compiler.IO open FSharp.Compiler.Service.Tests.Common open FSharp.Compiler.Symbols open FSharp.Compiler.Symbols.FSharpExprPatterns -open TestFramework type FSharpCore = | FC45 @@ -29,54 +25,13 @@ type FSharpCore = | FC47 -> "FSharp.Core 4.7" | FC50 -> "FSharp.Core 5.0" +[] +let dirName = "ExprTests" [] module internal Utils = - let getTempPath() = - Path.Combine(Path.GetTempPath(), "ExprTests") - - /// If it doesn't exists, create a folder 'ExprTests' in local user's %TEMP% folder - let createTempDir() = - let tempPath = getTempPath() - do - if Directory.Exists tempPath then () - else Directory.CreateDirectory tempPath |> ignore - - /// Returns the file name part of a temp file name created with tryCreateTemporaryFileName () - /// and an added process id and thread id to ensure uniqueness between threads. - let getTempFileName() = - let tempFileName = tryCreateTemporaryFileName () - try - let tempFile, tempExt = Path.GetFileNameWithoutExtension tempFileName, Path.GetExtension tempFileName - let procId, threadId = Process.GetCurrentProcess().Id, Thread.CurrentThread.ManagedThreadId - String.concat "" [tempFile; "_"; string procId; "_"; string threadId; tempExt] // ext includes dot - finally - try - FileSystem.FileDeleteShim tempFileName - with _ -> () - - /// Clean up after a test is run. If you need to inspect the create *.fs files, change this function to do nothing, or just break here. - let cleanupTempFiles files = - { new IDisposable with - member _.Dispose() = - for fileName in files do - try - // cleanup: only the source file is written to the temp dir. - FileSystem.FileDeleteShim fileName - with _ -> () - - try - // remove the dir when empty - let tempPath = getTempPath() - if Directory.GetFiles tempPath |> Array.isEmpty then - Directory.Delete tempPath - with _ -> () } - - /// Given just a file name, returns it with changed extension located in %TEMP%\ExprTests - let getTempFilePathChangeExt tmp ext = - Path.Combine(getTempPath(), Path.ChangeExtension(tmp, ext)) - - // This behaves slightly differently on Mono versions, 'null' is printed somethimes, 'None' other times + + // This behaves slightly differently on Mono versions, 'null' is printed sometimes, 'None' other times // Presumably this is very small differences in Mono reflection causing F# printing to change behaviour // For now just disabling this test. See https://github.com/fsharp/FSharp.Compiler.Service/pull/766 let filterHack l = @@ -163,8 +118,8 @@ module internal Utils = | [t] :: a -> "member " + t.CompiledName + "." + o.Signature.Name + printCurriedParams a + " = " + printExpr 10 o.Body | _ -> failwith "wrong this argument in object expression override" - and printIimpls iis = String.concat ";" (List.map printImlementation iis) - and printImlementation (i, ors) = "interface " + printTy i + " with " + printOverrides ors + and printIimpls iis = String.concat ";" (List.map printImplementation iis) + and printImplementation (i, ors) = "interface " + printTy i + " with " + printOverrides ors let rec printFSharpDecls prefix decls = seq { @@ -332,12 +287,12 @@ module internal Utils = | DebugPoint(_dp, innerExpr) -> collectMembers innerExpr | _ -> failwith (sprintf "unrecognized %+A" e) - let rec printMembersOfDeclatations ds = + let rec printMembersOfDeclarations ds = seq { for d in ds do match d with | FSharpImplementationFileDeclaration.Entity(_,ds) -> - yield! printMembersOfDeclatations ds + yield! printMembersOfDeclarations ds | FSharpImplementationFileDeclaration.MemberOrFunctionOrValue(v,vs,e) -> yield printMemberSignature v yield! collectMembers e |> Seq.map printMemberSignature @@ -345,22 +300,6 @@ module internal Utils = yield! collectMembers e |> Seq.map printMemberSignature } - -let createOptionsAux fileSources extraArgs = - let fileNames = fileSources |> List.map (fun _ -> Utils.getTempFileName()) - let temp2 = Utils.getTempFileName() - let fileNames = fileNames |> List.map (fun temp1 -> Utils.getTempFilePathChangeExt temp1 ".fs") - let dllName = Utils.getTempFilePathChangeExt temp2 ".dll" - let projFileName = Utils.getTempFilePathChangeExt temp2 ".fsproj" - - Utils.createTempDir() - for fileSource: string, fileName in List.zip fileSources fileNames do - FileSystem.OpenFileForWriteShim(fileName).Write(fileSource) - let args = [| yield! extraArgs; yield! mkProjectCommandLineArgs (dllName, []) |] - let options = { checker.GetProjectOptionsFromCommandLineArgs (projFileName, args) with SourceFiles = fileNames |> List.toArray } - - Utils.cleanupTempFiles (fileNames @ [dllName; projFileName]), options - //--------------------------------------------------------------------------------------------------------- // This project is a smoke test for a whole range of standard and obscure expressions @@ -425,7 +364,7 @@ type ClassWithImplicitConstructor(compiledAsArg: int) = static member SM1() = compiledAsStaticField + compiledAsGenericStaticMethod compiledAsStaticField static member SM2() = compiledAsStaticMethod() //override _.ToString() = base.ToString() + string 999 - member this.TestCallinToString() = this.ToString() + member this.TestCallingToString() = this.ToString() exception Error of int * int @@ -465,10 +404,10 @@ type ClassWithEventsAndProperties() = let c = ClassWithEventsAndProperties() let v = c.InstanceProperty -System.Console.WriteLine("777") // do a top-levl action +System.Console.WriteLine("777") // do a top-level action -let functionWithSubmsumption(x:obj) = x :?> string -//let functionWithCoercion(x:string) = (x :> obj) :?> string |> functionWithSubmsumption |> functionWithSubmsumption +let functionWithSubsumption(x:obj) = x :?> string +//let functionWithCoercion(x:string) = (x :> obj) :?> string |> functionWithSubsumption |> functionWithSubsumption type MultiArgMethods(c:int,d:int) = member x.Method(a:int, b : int) = 1 @@ -653,7 +592,7 @@ let testMutableVar = mutableVar 1 let testMutableConst = mutableConst () """ - let createOptionsWithArgs args = createOptionsAux [ fileSource1; fileSource2 ] args + let createOptionsWithArgs args = createProjectOptions dirName [ fileSource1; fileSource2 ] args let createOptions() = createOptionsWithArgs [] @@ -762,7 +701,7 @@ let ``Test Unoptimized Declarations Project1`` useTransparentCompiler = "member M2(__) (unitVar1) = __.compiledAsInstanceMethod(()) @ (56,21--56,47)"; "member SM1(unitVar0) = Operators.op_Addition (fun arg0_0 -> fun arg1_0 -> LanguagePrimitives.AdditionDynamic (arg0_0,arg1_0),compiledAsStaticField,let x: Microsoft.FSharp.Core.int = compiledAsStaticField in ClassWithImplicitConstructor.compiledAsGenericStaticMethod (x)) @ (57,26--57,101)"; "member SM2(unitVar0) = ClassWithImplicitConstructor.compiledAsStaticMethod (()) @ (58,26--58,50)"; - "member TestCallinToString(this) (unitVar1) = this.ToString() @ (60,39--60,54)"; + "member TestCallingToString(this) (unitVar1) = this.ToString() @ (60,40--60,55)"; "type Error"; "let err = {Data0 = 3; Data1 = 4} @ (64,10--64,20)"; "let matchOnException(err) = match (if err :? M.Error then $0 else $1) targets ... @ (66,33--66,36)"; "let upwardForLoop(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (69,16--69,17)"; @@ -784,7 +723,7 @@ let ``Test Unoptimized Declarations Project1`` useTransparentCompiler = "let c = new ClassWithEventsAndProperties(()) @ (97,8--97,38)"; "let v = M.c ().get_InstanceProperty(()) @ (98,8--98,26)"; "do Console.WriteLine (\"777\")"; - "let functionWithSubmsumption(x) = IntrinsicFunctions.UnboxGeneric (x) @ (102,40--102,52)"; + "let functionWithSubsumption(x) = IntrinsicFunctions.UnboxGeneric (x) @ (102,39--102,51)"; "type MultiArgMethods"; "member .ctor(c,d) = (new Object(); ()) @ (105,5--105,20)"; "member Method(x) (a,b) = 1 @ (106,37--106,38)"; @@ -903,7 +842,7 @@ let ``Test Optimized Declarations Project1`` useTransparentCompiler = "member M2(__) (unitVar1) = __.compiledAsInstanceMethod(()) @ (56,21--56,47)"; "member SM1(unitVar0) = Operators.op_Addition (fun arg0_0 -> fun arg1_0 -> LanguagePrimitives.AdditionDynamic (arg0_0,arg1_0),compiledAsStaticField,ClassWithImplicitConstructor.compiledAsGenericStaticMethod (compiledAsStaticField)) @ (57,26--57,101)"; "member SM2(unitVar0) = ClassWithImplicitConstructor.compiledAsStaticMethod (()) @ (58,26--58,50)"; - "member TestCallinToString(this) (unitVar1) = this.ToString() @ (60,39--60,54)"; + "member TestCallingToString(this) (unitVar1) = this.ToString() @ (60,40--60,55)"; "type Error"; "let err = {Data0 = 3; Data1 = 4} @ (64,10--64,20)"; "let matchOnException(err) = match (if err :? M.Error then $0 else $1) targets ... @ (66,33--66,36)"; "let upwardForLoop(unitVar0) = let mutable a: Microsoft.FSharp.Core.int = 1 in (for-loop; a) @ (69,16--69,17)"; @@ -925,7 +864,7 @@ let ``Test Optimized Declarations Project1`` useTransparentCompiler = "let c = new ClassWithEventsAndProperties(()) @ (97,8--97,38)"; "let v = M.c ().get_InstanceProperty(()) @ (98,8--98,26)"; "do Console.WriteLine (\"777\")"; - "let functionWithSubmsumption(x) = IntrinsicFunctions.UnboxGeneric (x) @ (102,40--102,52)"; + "let functionWithSubsumption(x) = IntrinsicFunctions.UnboxGeneric (x) @ (102,39--102,51)"; "type MultiArgMethods"; "member .ctor(c,d) = (new Object(); ()) @ (105,5--105,20)"; "member Method(x) (a,b) = 1 @ (106,37--106,38)"; @@ -1002,15 +941,15 @@ let ``Test Optimized Declarations Project1`` useTransparentCompiler = let testOperators dnName fsName excludedTests expectedUnoptimized expectedOptimized = - let tempFileName = Utils.getTempFileName() - let filePath = Utils.getTempFilePathChangeExt tempFileName ".fs" - let dllPath =Utils.getTempFilePathChangeExt tempFileName ".dll" - let projFilePath = Utils.getTempFilePathChangeExt tempFileName ".fsproj" + let tempFileName = getTempFileName() + let filePath = getTempFilePathChangeExt dirName tempFileName ".fs" + let dllPath =getTempFilePathChangeExt dirName tempFileName ".dll" + let projFilePath = getTempFilePathChangeExt dirName tempFileName ".fsproj" let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=true) begin - use _cleanup = Utils.cleanupTempFiles [filePath; dllPath; projFilePath] - createTempDir() + use _cleanup = cleanupTempFiles dirName [filePath; dllPath; projFilePath] + createTempDir dirName let source = String.Format(Project1.operatorTests, dnName, fsName) let replace (s:string) r = s.Replace("let " + r, "// let " + r) let fileSource = excludedTests |> List.fold replace source @@ -3192,7 +3131,7 @@ let BigSequenceExpression(outFileOpt,docFileOpt,baseAddressOpt) = """ - let createOptions() = createOptionsAux [fileSource1] [] + let createOptions() = createProjectOptions dirName [fileSource1] [] #if !NETFRAMEWORK && DEBUG [] @@ -3216,7 +3155,7 @@ let ``Test expressions of declarations stress big expressions`` useTransparentCo printDeclarations None (List.ofSeq file1.Declarations) |> Seq.toList |> ignore #if !NETFRAMEWORK && DEBUG -[] +[] #else [] [] @@ -3279,7 +3218,7 @@ let f7() = callXY (C()) (D()) let f8() = callXY (D()) (C()) """ - let createOptions() = createOptionsAux [fileSource1] ["--langversion:7.0"] + let createOptions() = createProjectOptions dirName [fileSource1] ["--langversion:7.0"] [] [] @@ -3407,7 +3346,7 @@ type MyNumberWrapper = { MyNumber: MyNumber } """ - let createOptions() = createOptionsAux [fileSource1] ["--langversion:7.0"] + let createOptions() = createProjectOptions dirName [fileSource1] ["--langversion:7.0"] [] [] @@ -3465,13 +3404,13 @@ let s2 = sign p1 """ - let createOptions() = createOptionsAux [fileSource1] ["--langversion:7.0"] + let createOptions() = createProjectOptions dirName [fileSource1] ["--langversion:7.0"] [] [] [] let ``Test ProjectForWitnesses3`` useTransparentCompiler = - let cleanup, options = createOptionsAux [ ProjectForWitnesses3.fileSource1 ] ["--langversion:7.0"] + let cleanup, options = createProjectOptions dirName [ ProjectForWitnesses3.fileSource1 ] ["--langversion:7.0"] use _holder = cleanup let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=useTransparentCompiler) let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate @@ -3563,7 +3502,7 @@ let isNullQuoted (ts : 't[]) = """ - let createOptions() = createOptionsAux [fileSource1] ["--langversion:7.0"] + let createOptions() = createProjectOptions dirName [fileSource1] ["--langversion:7.0"] [] [] @@ -3603,7 +3542,7 @@ module N.M let rec f = new System.EventHandler(fun _ _ -> f.Invoke(null,null)) """ - let createOptions() = createOptionsAux [fileSource1] [] + let createOptions() = createProjectOptions dirName [fileSource1] [] [] [] diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index 63a16671bca..3ae2414fc07 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl @@ -301,6 +301,24 @@ FSharp.Compiler.AbstractIL.IL+ILAttribute: Int32 get_Tag() FSharp.Compiler.AbstractIL.IL+ILAttribute: System.String ToString() FSharp.Compiler.AbstractIL.IL+ILAttributes: ILAttribute[] AsArray() FSharp.Compiler.AbstractIL.IL+ILAttributes: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILAttribute] AsList() +FSharp.Compiler.AbstractIL.IL+ILAttributesStored+Given: ILAttributes Item +FSharp.Compiler.AbstractIL.IL+ILAttributesStored+Given: ILAttributes get_Item() +FSharp.Compiler.AbstractIL.IL+ILAttributesStored+Reader: Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,FSharp.Compiler.AbstractIL.IL+ILAttribute[]] Item +FSharp.Compiler.AbstractIL.IL+ILAttributesStored+Reader: Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,FSharp.Compiler.AbstractIL.IL+ILAttribute[]] get_Item() +FSharp.Compiler.AbstractIL.IL+ILAttributesStored+Tags: Int32 Given +FSharp.Compiler.AbstractIL.IL+ILAttributesStored+Tags: Int32 Reader +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: Boolean IsGiven +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: Boolean IsReader +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: Boolean get_IsGiven() +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: Boolean get_IsReader() +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: FSharp.Compiler.AbstractIL.IL+ILAttributesStored+Given +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: FSharp.Compiler.AbstractIL.IL+ILAttributesStored+Reader +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: FSharp.Compiler.AbstractIL.IL+ILAttributesStored+Tags +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: ILAttributes GetCustomAttrs(Int32) +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: ILAttributesStored NewGiven(ILAttributes) +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: ILAttributesStored NewReader(Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,FSharp.Compiler.AbstractIL.IL+ILAttribute[]]) +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: Int32 Tag +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: Int32 get_Tag() FSharp.Compiler.AbstractIL.IL+ILAttributesStored: System.String ToString() FSharp.Compiler.AbstractIL.IL+ILCallingConv: Boolean Equals(ILCallingConv) FSharp.Compiler.AbstractIL.IL+ILCallingConv: Boolean Equals(ILCallingConv, System.Collections.IEqualityComparer) @@ -398,10 +416,14 @@ FSharp.Compiler.AbstractIL.IL+ILEventDef: Boolean get_IsRTSpecialName() FSharp.Compiler.AbstractIL.IL+ILEventDef: Boolean get_IsSpecialName() FSharp.Compiler.AbstractIL.IL+ILEventDef: ILAttributes CustomAttrs FSharp.Compiler.AbstractIL.IL+ILEventDef: ILAttributes get_CustomAttrs() +FSharp.Compiler.AbstractIL.IL+ILEventDef: ILAttributesStored CustomAttrsStored +FSharp.Compiler.AbstractIL.IL+ILEventDef: ILAttributesStored get_CustomAttrsStored() FSharp.Compiler.AbstractIL.IL+ILEventDef: ILMethodRef AddMethod FSharp.Compiler.AbstractIL.IL+ILEventDef: ILMethodRef RemoveMethod FSharp.Compiler.AbstractIL.IL+ILEventDef: ILMethodRef get_AddMethod() FSharp.Compiler.AbstractIL.IL+ILEventDef: ILMethodRef get_RemoveMethod() +FSharp.Compiler.AbstractIL.IL+ILEventDef: Int32 MetadataIndex +FSharp.Compiler.AbstractIL.IL+ILEventDef: Int32 get_MetadataIndex() FSharp.Compiler.AbstractIL.IL+ILEventDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILMethodRef] OtherMethods FSharp.Compiler.AbstractIL.IL+ILEventDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILMethodRef] get_OtherMethods() FSharp.Compiler.AbstractIL.IL+ILEventDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodRef] FireMethod @@ -453,10 +475,14 @@ FSharp.Compiler.AbstractIL.IL+ILFieldDef: Boolean get_IsStatic() FSharp.Compiler.AbstractIL.IL+ILFieldDef: Boolean get_NotSerialized() FSharp.Compiler.AbstractIL.IL+ILFieldDef: ILAttributes CustomAttrs FSharp.Compiler.AbstractIL.IL+ILFieldDef: ILAttributes get_CustomAttrs() +FSharp.Compiler.AbstractIL.IL+ILFieldDef: ILAttributesStored CustomAttrsStored +FSharp.Compiler.AbstractIL.IL+ILFieldDef: ILAttributesStored get_CustomAttrsStored() FSharp.Compiler.AbstractIL.IL+ILFieldDef: ILMemberAccess Access FSharp.Compiler.AbstractIL.IL+ILFieldDef: ILMemberAccess get_Access() FSharp.Compiler.AbstractIL.IL+ILFieldDef: ILType FieldType FSharp.Compiler.AbstractIL.IL+ILFieldDef: ILType get_FieldType() +FSharp.Compiler.AbstractIL.IL+ILFieldDef: Int32 MetadataIndex +FSharp.Compiler.AbstractIL.IL+ILFieldDef: Int32 get_MetadataIndex() FSharp.Compiler.AbstractIL.IL+ILFieldDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILFieldInit] LiteralValue FSharp.Compiler.AbstractIL.IL+ILFieldDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILFieldInit] get_LiteralValue() FSharp.Compiler.AbstractIL.IL+ILFieldDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILNativeType] Marshal @@ -627,9 +653,11 @@ FSharp.Compiler.AbstractIL.IL+ILFieldSpec: System.String Name FSharp.Compiler.AbstractIL.IL+ILFieldSpec: System.String ToString() FSharp.Compiler.AbstractIL.IL+ILFieldSpec: System.String get_Name() FSharp.Compiler.AbstractIL.IL+ILFieldSpec: Void .ctor(ILFieldRef, ILType) +FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Boolean HasAllowsRefStruct FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Boolean HasDefaultConstructorConstraint FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Boolean HasNotNullableValueTypeConstraint FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Boolean HasReferenceTypeConstraint +FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Boolean get_HasAllowsRefStruct() FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Boolean get_HasDefaultConstructorConstraint() FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Boolean get_HasNotNullableValueTypeConstraint() FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Boolean get_HasReferenceTypeConstraint() @@ -646,7 +674,7 @@ FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Microsoft.FSharp.Collection FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: System.String Name FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: System.String ToString() FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: System.String get_Name() -FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Void .ctor(System.String, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType], ILGenericVariance, Boolean, Boolean, Boolean, ILAttributesStored, Int32) +FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Void .ctor(System.String, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType], ILGenericVariance, Boolean, Boolean, Boolean, Boolean, ILAttributesStored, Int32) FSharp.Compiler.AbstractIL.IL+ILGenericVariance+Tags: Int32 CoVariant FSharp.Compiler.AbstractIL.IL+ILGenericVariance+Tags: Int32 ContraVariant FSharp.Compiler.AbstractIL.IL+ILGenericVariance+Tags: Int32 NonVariant @@ -775,6 +803,8 @@ FSharp.Compiler.AbstractIL.IL+ILMethodDef: Boolean get_IsVirtual() FSharp.Compiler.AbstractIL.IL+ILMethodDef: Boolean get_IsZeroInit() FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILAttributes CustomAttrs FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILAttributes get_CustomAttrs() +FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILAttributesStored CustomAttrsStored +FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILAttributesStored get_CustomAttrsStored() FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILCallingConv CallingConv FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILCallingConv get_CallingConv() FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILCallingSignature GetCallingSignature() @@ -787,7 +817,9 @@ FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILReturn get_Return() FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILSecurityDecls SecurityDecls FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILSecurityDecls get_SecurityDecls() FSharp.Compiler.AbstractIL.IL+ILMethodDef: Int32 MaxStack +FSharp.Compiler.AbstractIL.IL+ILMethodDef: Int32 MetadataIndex FSharp.Compiler.AbstractIL.IL+ILMethodDef: Int32 get_MaxStack() +FSharp.Compiler.AbstractIL.IL+ILMethodDef: Int32 get_MetadataIndex() FSharp.Compiler.AbstractIL.IL+ILMethodDef: MethodBody Body FSharp.Compiler.AbstractIL.IL+ILMethodDef: MethodBody get_Body() FSharp.Compiler.AbstractIL.IL+ILMethodDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef] GenericParams @@ -1247,10 +1279,14 @@ FSharp.Compiler.AbstractIL.IL+ILPropertyDef: Boolean get_IsRTSpecialName() FSharp.Compiler.AbstractIL.IL+ILPropertyDef: Boolean get_IsSpecialName() FSharp.Compiler.AbstractIL.IL+ILPropertyDef: ILAttributes CustomAttrs FSharp.Compiler.AbstractIL.IL+ILPropertyDef: ILAttributes get_CustomAttrs() +FSharp.Compiler.AbstractIL.IL+ILPropertyDef: ILAttributesStored CustomAttrsStored +FSharp.Compiler.AbstractIL.IL+ILPropertyDef: ILAttributesStored get_CustomAttrsStored() FSharp.Compiler.AbstractIL.IL+ILPropertyDef: ILThisConvention CallingConv FSharp.Compiler.AbstractIL.IL+ILPropertyDef: ILThisConvention get_CallingConv() FSharp.Compiler.AbstractIL.IL+ILPropertyDef: ILType PropertyType FSharp.Compiler.AbstractIL.IL+ILPropertyDef: ILType get_PropertyType() +FSharp.Compiler.AbstractIL.IL+ILPropertyDef: Int32 MetadataIndex +FSharp.Compiler.AbstractIL.IL+ILPropertyDef: Int32 get_MetadataIndex() FSharp.Compiler.AbstractIL.IL+ILPropertyDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType] Args FSharp.Compiler.AbstractIL.IL+ILPropertyDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType] get_Args() FSharp.Compiler.AbstractIL.IL+ILPropertyDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILFieldInit] Init @@ -1513,6 +1549,8 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDef: Boolean get_IsStruct() FSharp.Compiler.AbstractIL.IL+ILTypeDef: Boolean get_IsStructOrEnum() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILAttributes CustomAttrs FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILAttributes get_CustomAttrs() +FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILAttributesStored CustomAttrsStored +FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILAttributesStored get_CustomAttrsStored() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILDefaultPInvokeEncoding Encoding FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILDefaultPInvokeEncoding get_Encoding() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILEventDefs Events @@ -1527,25 +1565,29 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILPropertyDefs Properties FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILPropertyDefs get_Properties() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILSecurityDecls SecurityDecls FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILSecurityDecls get_SecurityDecls() -FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDef With(Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Reflection.TypeAttributes], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefLayout], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType]], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef]], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILFieldDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodImplDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILEventDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILPropertyDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILAttributesStored], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILSecurityDecls]) +FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDef With(Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Reflection.TypeAttributes], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefLayout], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType]], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef]], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILFieldDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodImplDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILEventDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILPropertyDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILAttributesStored], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILSecurityDecls], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]]]) FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefAccess Access FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefAccess get_Access() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefLayout Layout FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefLayout get_Layout() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefs NestedTypes FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefs get_NestedTypes() +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Int32 MetadataIndex +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Int32 get_MetadataIndex() FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef] GenericParams FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef] get_GenericParams() FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType] Implements FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType] get_Implements() FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType] Extends FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType] get_Extends() +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]] ImplementsCustomAttrs +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]] get_ImplementsCustomAttrs() FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.Reflection.TypeAttributes Attributes FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.Reflection.TypeAttributes get_Attributes() FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.String Name FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.String ToString() FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.String get_Name() -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Void .ctor(System.String, System.Reflection.TypeAttributes, ILTypeDefLayout, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType], ILMethodDefs, ILTypeDefs, ILFieldDefs, ILMethodImplDefs, ILEventDefs, ILPropertyDefs, ILTypeDefAdditionalFlags, ILSecurityDecls, ILAttributesStored) +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Void .ctor(System.String, System.Reflection.TypeAttributes, ILTypeDefLayout, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType], ILMethodDefs, ILTypeDefs, ILFieldDefs, ILMethodImplDefs, ILEventDefs, ILPropertyDefs, ILTypeDefAdditionalFlags, ILSecurityDecls, ILAttributesStored) FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess+Nested: ILMemberAccess Item FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess+Nested: ILMemberAccess get_Item() FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess+Tags: Int32 Nested @@ -2849,8 +2891,16 @@ FSharp.Compiler.EditorServices.CompletionContext+Inherit: FSharp.Compiler.Editor FSharp.Compiler.EditorServices.CompletionContext+Inherit: FSharp.Compiler.EditorServices.InheritanceContext get_context() FSharp.Compiler.EditorServices.CompletionContext+Inherit: System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[System.String],Microsoft.FSharp.Core.FSharpOption`1[System.String]] get_path() FSharp.Compiler.EditorServices.CompletionContext+Inherit: System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[System.String],Microsoft.FSharp.Core.FSharpOption`1[System.String]] path +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Boolean get_hasThis() +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Boolean get_isStatic() +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Boolean hasThis +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Boolean isStatic +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: FSharp.Compiler.EditorServices.MethodOverrideCompletionContext ctx +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: FSharp.Compiler.EditorServices.MethodOverrideCompletionContext get_ctx() FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: FSharp.Compiler.Text.Range enclosingTypeNameRange FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: FSharp.Compiler.Text.Range get_enclosingTypeNameRange() +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Int32 get_spacesBeforeOverrideKeyword() +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Int32 spacesBeforeOverrideKeyword FSharp.Compiler.EditorServices.CompletionContext+OpenDeclaration: Boolean get_isOpenType() FSharp.Compiler.EditorServices.CompletionContext+OpenDeclaration: Boolean isOpenType FSharp.Compiler.EditorServices.CompletionContext+ParameterList: FSharp.Compiler.Text.Position Item1 @@ -2904,7 +2954,7 @@ FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsUnionCaseFieldsD FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext AttributeApplication FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext Invalid FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewInherit(FSharp.Compiler.EditorServices.InheritanceContext, System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[System.String],Microsoft.FSharp.Core.FSharpOption`1[System.String]]) -FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewMethodOverride(FSharp.Compiler.Text.Range) +FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewMethodOverride(FSharp.Compiler.EditorServices.MethodOverrideCompletionContext, FSharp.Compiler.Text.Range, Int32, Boolean, Boolean) FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewOpenDeclaration(Boolean) FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewParameterList(FSharp.Compiler.Text.Position, System.Collections.Generic.HashSet`1[System.String]) FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewPattern(FSharp.Compiler.EditorServices.PatternContext) @@ -3539,6 +3589,33 @@ FSharp.Compiler.EditorServices.MethodGroupItemParameter: System.String Canonical FSharp.Compiler.EditorServices.MethodGroupItemParameter: System.String ParameterName FSharp.Compiler.EditorServices.MethodGroupItemParameter: System.String get_CanonicalTypeTextForSorting() FSharp.Compiler.EditorServices.MethodGroupItemParameter: System.String get_ParameterName() +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext+Tags: Int32 Class +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext+Tags: Int32 Interface +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext+Tags: Int32 ObjExpr +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean Equals(FSharp.Compiler.EditorServices.MethodOverrideCompletionContext) +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean Equals(FSharp.Compiler.EditorServices.MethodOverrideCompletionContext, System.Collections.IEqualityComparer) +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean Equals(System.Object) +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean Equals(System.Object, System.Collections.IEqualityComparer) +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean IsClass +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean IsInterface +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean IsObjExpr +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean get_IsClass() +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean get_IsInterface() +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean get_IsObjExpr() +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: FSharp.Compiler.EditorServices.MethodOverrideCompletionContext Class +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: FSharp.Compiler.EditorServices.MethodOverrideCompletionContext NewInterface(FSharp.Compiler.Text.Range) +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: FSharp.Compiler.EditorServices.MethodOverrideCompletionContext NewObjExpr(FSharp.Compiler.Text.Range) +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: FSharp.Compiler.EditorServices.MethodOverrideCompletionContext get_Class() +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: FSharp.Compiler.EditorServices.MethodOverrideCompletionContext+Tags +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: FSharp.Compiler.Text.Range get_mExpr() +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: FSharp.Compiler.Text.Range get_mInterfaceName() +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: FSharp.Compiler.Text.Range mExpr +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: FSharp.Compiler.Text.Range mInterfaceName +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Int32 GetHashCode() +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Int32 GetHashCode(System.Collections.IEqualityComparer) +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Int32 Tag +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Int32 get_Tag() +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: System.String ToString() FSharp.Compiler.EditorServices.ModuleKind: Boolean Equals(FSharp.Compiler.EditorServices.ModuleKind) FSharp.Compiler.EditorServices.ModuleKind: Boolean Equals(FSharp.Compiler.EditorServices.ModuleKind, System.Collections.IEqualityComparer) FSharp.Compiler.EditorServices.ModuleKind: Boolean Equals(System.Object) @@ -5560,21 +5637,25 @@ FSharp.Compiler.Symbols.FSharpSymbolPatterns: Microsoft.FSharp.Core.FSharpOption FSharp.Compiler.Symbols.FSharpSymbolPatterns: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Symbols.FSharpField,FSharp.Compiler.Symbols.FSharpType]] |Field|_|(FSharp.Compiler.Symbols.FSharpSymbol) FSharp.Compiler.Symbols.FSharpSymbolPatterns: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`3[FSharp.Compiler.Symbols.FSharpEntity,FSharp.Compiler.Symbols.FSharpEntity,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Symbols.FSharpType]]] |FSharpEntity|_|(FSharp.Compiler.Symbols.FSharpSymbol) FSharp.Compiler.Symbols.FSharpType: Boolean Equals(System.Object) +FSharp.Compiler.Symbols.FSharpType: Boolean HasNullAnnotation FSharp.Compiler.Symbols.FSharpType: Boolean HasTypeDefinition FSharp.Compiler.Symbols.FSharpType: Boolean IsAbbreviation FSharp.Compiler.Symbols.FSharpType: Boolean IsAnonRecordType FSharp.Compiler.Symbols.FSharpType: Boolean IsFunctionType FSharp.Compiler.Symbols.FSharpType: Boolean IsGenericParameter FSharp.Compiler.Symbols.FSharpType: Boolean IsMeasureType +FSharp.Compiler.Symbols.FSharpType: Boolean IsNullAmbivalent FSharp.Compiler.Symbols.FSharpType: Boolean IsStructTupleType FSharp.Compiler.Symbols.FSharpType: Boolean IsTupleType FSharp.Compiler.Symbols.FSharpType: Boolean IsUnresolved +FSharp.Compiler.Symbols.FSharpType: Boolean get_HasNullAnnotation() FSharp.Compiler.Symbols.FSharpType: Boolean get_HasTypeDefinition() FSharp.Compiler.Symbols.FSharpType: Boolean get_IsAbbreviation() FSharp.Compiler.Symbols.FSharpType: Boolean get_IsAnonRecordType() FSharp.Compiler.Symbols.FSharpType: Boolean get_IsFunctionType() FSharp.Compiler.Symbols.FSharpType: Boolean get_IsGenericParameter() FSharp.Compiler.Symbols.FSharpType: Boolean get_IsMeasureType() +FSharp.Compiler.Symbols.FSharpType: Boolean get_IsNullAmbivalent() FSharp.Compiler.Symbols.FSharpType: Boolean get_IsStructTupleType() FSharp.Compiler.Symbols.FSharpType: Boolean get_IsTupleType() FSharp.Compiler.Symbols.FSharpType: Boolean get_IsUnresolved() @@ -5925,6 +6006,18 @@ FSharp.Compiler.Syntax.ParsedHashDirective: Microsoft.FSharp.Collections.FSharpL FSharp.Compiler.Syntax.ParsedHashDirective: System.String ToString() FSharp.Compiler.Syntax.ParsedHashDirective: System.String get_ident() FSharp.Compiler.Syntax.ParsedHashDirective: System.String ident +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Ident: FSharp.Compiler.Syntax.Ident get_value() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Ident: FSharp.Compiler.Syntax.Ident value +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Ident: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Ident: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Int32: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Int32: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Int32: Int32 get_value() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Int32: Int32 value +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+LongIdent: FSharp.Compiler.Syntax.SynLongIdent get_value() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+LongIdent: FSharp.Compiler.Syntax.SynLongIdent value +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+LongIdent: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+LongIdent: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+SourceIdentifier: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+SourceIdentifier: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+SourceIdentifier: System.String constant @@ -5937,14 +6030,29 @@ FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+String: FSharp.Compiler.Text. FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+String: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+String: System.String get_value() FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+String: System.String value +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Tags: Int32 Ident +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Tags: Int32 Int32 +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Tags: Int32 LongIdent FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Tags: Int32 SourceIdentifier FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Tags: Int32 String +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: Boolean IsIdent +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: Boolean IsInt32 +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: Boolean IsLongIdent FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: Boolean IsSourceIdentifier FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: Boolean IsString +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: Boolean get_IsIdent() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: Boolean get_IsInt32() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: Boolean get_IsLongIdent() FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: Boolean get_IsSourceIdentifier() FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: Boolean get_IsString() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: FSharp.Compiler.Syntax.ParsedHashDirectiveArgument NewIdent(FSharp.Compiler.Syntax.Ident, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: FSharp.Compiler.Syntax.ParsedHashDirectiveArgument NewInt32(Int32, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: FSharp.Compiler.Syntax.ParsedHashDirectiveArgument NewLongIdent(FSharp.Compiler.Syntax.SynLongIdent, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: FSharp.Compiler.Syntax.ParsedHashDirectiveArgument NewSourceIdentifier(System.String, System.String, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: FSharp.Compiler.Syntax.ParsedHashDirectiveArgument NewString(System.String, FSharp.Compiler.Syntax.SynStringKind, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Ident +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Int32 +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+LongIdent FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+SourceIdentifier FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+String FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Tags @@ -7632,8 +7740,12 @@ FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Syntax.SynExpr get_body() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Syntax.SynExprAndBang NewSynExprAndBang(FSharp.Compiler.Syntax.DebugPointAtBinding, Boolean, Boolean, FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia) FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Syntax.SynPat get_pat() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Syntax.SynPat pat +FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia Trivia +FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia get_Trivia() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia get_trivia() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia trivia +FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Text.Range Range +FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Text.Range get_Range() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynExprAndBang: Int32 Tag @@ -7881,6 +7993,8 @@ FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.Syntax.SynMem FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.Syntax.SynMemberFlags memberFlagsForSet FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.Syntax.SynMemberKind get_propKind() FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.Syntax.SynMemberKind propKind +FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.Syntax.SynValSigAccess accessibility +FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.Syntax.SynValSigAccess get_accessibility() FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.SyntaxTrivia.SynMemberDefnAutoPropertyTrivia get_trivia() FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.SyntaxTrivia.SynMemberDefnAutoPropertyTrivia trivia FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.Text.Range get_range() @@ -7889,8 +8003,6 @@ FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.Xml.PreXmlDoc FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.Xml.PreXmlDoc xmlDoc FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList] attributes FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList] get_attributes() -FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] accessibility -FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] get_accessibility() FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynType] get_typeOpt() FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynType] typeOpt FSharp.Compiler.Syntax.SynMemberDefn+GetSetMember: FSharp.Compiler.SyntaxTrivia.SynMemberGetSetTrivia get_trivia() @@ -8000,7 +8112,7 @@ FSharp.Compiler.Syntax.SynMemberDefn: Boolean get_IsNestedType() FSharp.Compiler.Syntax.SynMemberDefn: Boolean get_IsOpen() FSharp.Compiler.Syntax.SynMemberDefn: Boolean get_IsValField() FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewAbstractSlot(FSharp.Compiler.Syntax.SynValSig, FSharp.Compiler.Syntax.SynMemberFlags, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynMemberDefnAbstractSlotTrivia) -FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewAutoProperty(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], Boolean, FSharp.Compiler.Syntax.Ident, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynType], FSharp.Compiler.Syntax.SynMemberKind, FSharp.Compiler.Syntax.SynMemberFlags, FSharp.Compiler.Syntax.SynMemberFlags, FSharp.Compiler.Xml.PreXmlDoc, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynMemberDefnAutoPropertyTrivia) +FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewAutoProperty(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], Boolean, FSharp.Compiler.Syntax.Ident, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynType], FSharp.Compiler.Syntax.SynMemberKind, FSharp.Compiler.Syntax.SynMemberFlags, FSharp.Compiler.Syntax.SynMemberFlags, FSharp.Compiler.Xml.PreXmlDoc, FSharp.Compiler.Syntax.SynValSigAccess, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynMemberDefnAutoPropertyTrivia) FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewGetSetMember(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynBinding], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynBinding], FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynMemberGetSetTrivia) FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewImplicitCtor(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], FSharp.Compiler.Syntax.SynPat, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], FSharp.Compiler.Xml.PreXmlDoc, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynMemberDefnImplicitCtorTrivia) FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewImplicitInherit(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], FSharp.Compiler.Text.Range) @@ -9041,6 +9153,8 @@ FSharp.Compiler.Syntax.SynType+StaticConstantNamed: FSharp.Compiler.Syntax.SynTy FSharp.Compiler.Syntax.SynType+StaticConstantNamed: FSharp.Compiler.Syntax.SynType value FSharp.Compiler.Syntax.SynType+StaticConstantNamed: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynType+StaticConstantNamed: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.SynType+StaticConstantNull: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.SynType+StaticConstantNull: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynType+Tags: Int32 Anon FSharp.Compiler.Syntax.SynType+Tags: Int32 AnonRecd FSharp.Compiler.Syntax.SynType+Tags: Int32 App @@ -9058,9 +9172,11 @@ FSharp.Compiler.Syntax.SynType+Tags: Int32 SignatureParameter FSharp.Compiler.Syntax.SynType+Tags: Int32 StaticConstant FSharp.Compiler.Syntax.SynType+Tags: Int32 StaticConstantExpr FSharp.Compiler.Syntax.SynType+Tags: Int32 StaticConstantNamed +FSharp.Compiler.Syntax.SynType+Tags: Int32 StaticConstantNull FSharp.Compiler.Syntax.SynType+Tags: Int32 Tuple FSharp.Compiler.Syntax.SynType+Tags: Int32 Var FSharp.Compiler.Syntax.SynType+Tags: Int32 WithGlobalConstraints +FSharp.Compiler.Syntax.SynType+Tags: Int32 WithNull FSharp.Compiler.Syntax.SynType+Tuple: Boolean get_isStruct() FSharp.Compiler.Syntax.SynType+Tuple: Boolean isStruct FSharp.Compiler.Syntax.SynType+Tuple: FSharp.Compiler.Text.Range get_range() @@ -9077,6 +9193,14 @@ FSharp.Compiler.Syntax.SynType+WithGlobalConstraints: FSharp.Compiler.Text.Range FSharp.Compiler.Syntax.SynType+WithGlobalConstraints: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynType+WithGlobalConstraints: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynTypeConstraint] constraints FSharp.Compiler.Syntax.SynType+WithGlobalConstraints: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynTypeConstraint] get_constraints() +FSharp.Compiler.Syntax.SynType+WithNull: Boolean ambivalent +FSharp.Compiler.Syntax.SynType+WithNull: Boolean get_ambivalent() +FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.Syntax.SynType get_innerType() +FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.Syntax.SynType innerType +FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia get_trivia() +FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia trivia +FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynType: Boolean IsAnon FSharp.Compiler.Syntax.SynType: Boolean IsAnonRecd FSharp.Compiler.Syntax.SynType: Boolean IsApp @@ -9094,9 +9218,11 @@ FSharp.Compiler.Syntax.SynType: Boolean IsSignatureParameter FSharp.Compiler.Syntax.SynType: Boolean IsStaticConstant FSharp.Compiler.Syntax.SynType: Boolean IsStaticConstantExpr FSharp.Compiler.Syntax.SynType: Boolean IsStaticConstantNamed +FSharp.Compiler.Syntax.SynType: Boolean IsStaticConstantNull FSharp.Compiler.Syntax.SynType: Boolean IsTuple FSharp.Compiler.Syntax.SynType: Boolean IsVar FSharp.Compiler.Syntax.SynType: Boolean IsWithGlobalConstraints +FSharp.Compiler.Syntax.SynType: Boolean IsWithNull FSharp.Compiler.Syntax.SynType: Boolean get_IsAnon() FSharp.Compiler.Syntax.SynType: Boolean get_IsAnonRecd() FSharp.Compiler.Syntax.SynType: Boolean get_IsApp() @@ -9114,9 +9240,11 @@ FSharp.Compiler.Syntax.SynType: Boolean get_IsSignatureParameter() FSharp.Compiler.Syntax.SynType: Boolean get_IsStaticConstant() FSharp.Compiler.Syntax.SynType: Boolean get_IsStaticConstantExpr() FSharp.Compiler.Syntax.SynType: Boolean get_IsStaticConstantNamed() +FSharp.Compiler.Syntax.SynType: Boolean get_IsStaticConstantNull() FSharp.Compiler.Syntax.SynType: Boolean get_IsTuple() FSharp.Compiler.Syntax.SynType: Boolean get_IsVar() FSharp.Compiler.Syntax.SynType: Boolean get_IsWithGlobalConstraints() +FSharp.Compiler.Syntax.SynType: Boolean get_IsWithNull() FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewAnon(FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewAnonRecd(Boolean, Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.Syntax.Ident,FSharp.Compiler.Syntax.SynType]], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewApp(FSharp.Compiler.Syntax.SynType, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Boolean, FSharp.Compiler.Text.Range) @@ -9134,9 +9262,11 @@ FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewSignatureParam FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewStaticConstant(FSharp.Compiler.Syntax.SynConst, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewStaticConstantExpr(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewStaticConstantNamed(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewStaticConstantNull(FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewTuple(Boolean, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynTupleTypeSegment], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewVar(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewWithGlobalConstraints(FSharp.Compiler.Syntax.SynType, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynTypeConstraint], FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewWithNull(FSharp.Compiler.Syntax.SynType, Boolean, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Anon FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+AnonRecd FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+App @@ -9154,10 +9284,12 @@ FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+SignatureParamete FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+StaticConstant FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+StaticConstantExpr FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+StaticConstantNamed +FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+StaticConstantNull FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Tags FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Tuple FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Var FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+WithGlobalConstraints +FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+WithNull FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Text.Range Range FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Text.Range get_Range() FSharp.Compiler.Syntax.SynType: Int32 Tag @@ -9172,6 +9304,7 @@ FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparIsEquatable FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparIsReferenceType FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparIsUnmanaged FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparIsValueType +FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparNotSupportsNull FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparSubtypeOfType FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparSupportsMember FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparSupportsNull @@ -9217,6 +9350,12 @@ FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsValueType: FSharp.Compiler. FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsValueType: FSharp.Compiler.Syntax.SynTypar typar FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsValueType: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsValueType: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.Syntax.SynTypar genericName +FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.Syntax.SynTypar get_genericName() +FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia get_trivia() +FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia trivia +FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSubtypeOfType: FSharp.Compiler.Syntax.SynTypar get_typar() FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSubtypeOfType: FSharp.Compiler.Syntax.SynTypar typar FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSubtypeOfType: FSharp.Compiler.Syntax.SynType get_typeName() @@ -9242,6 +9381,7 @@ FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparIsEquatable FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparIsReferenceType FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparIsUnmanaged FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparIsValueType +FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparNotSupportsNull FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparSubtypeOfType FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparSupportsMember FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparSupportsNull @@ -9254,6 +9394,7 @@ FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparIsEquatable() FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparIsReferenceType() FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparIsUnmanaged() FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparIsValueType() +FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparNotSupportsNull() FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparSubtypeOfType() FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparSupportsMember() FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparSupportsNull() @@ -9266,6 +9407,7 @@ FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstrai FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparIsReferenceType(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparIsUnmanaged(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparIsValueType(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparNotSupportsNull(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparSubtypeOfType(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparSupportsMember(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynMemberSig, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparSupportsNull(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) @@ -9279,6 +9421,7 @@ FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstrai FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsReferenceType FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsUnmanaged FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsValueType +FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSubtypeOfType FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsMember FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsNull @@ -9622,7 +9765,9 @@ FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValInfo SynInfo FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValInfo arity FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValInfo get_SynInfo() FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValInfo get_arity() -FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValSig NewSynValSig(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], FSharp.Compiler.Syntax.SynIdent, FSharp.Compiler.Syntax.SynValTyparDecls, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynValInfo, Boolean, Boolean, FSharp.Compiler.Xml.PreXmlDoc, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynExpr], FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynValSigTrivia) +FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValSig NewSynValSig(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], FSharp.Compiler.Syntax.SynIdent, FSharp.Compiler.Syntax.SynValTyparDecls, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynValInfo, Boolean, Boolean, FSharp.Compiler.Xml.PreXmlDoc, FSharp.Compiler.Syntax.SynValSigAccess, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynExpr], FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynValSigTrivia) +FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValSigAccess accessibility +FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValSigAccess get_accessibility() FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValTyparDecls explicitTypeParams FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValTyparDecls get_explicitTypeParams() FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.SyntaxTrivia.SynValSigTrivia get_trivia() @@ -9637,11 +9782,33 @@ FSharp.Compiler.Syntax.SynValSig: Int32 Tag FSharp.Compiler.Syntax.SynValSig: Int32 get_Tag() FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList] attributes FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList] get_attributes() -FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] accessibility -FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] get_accessibility() FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynExpr] get_synExpr() FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynExpr] synExpr FSharp.Compiler.Syntax.SynValSig: System.String ToString() +FSharp.Compiler.Syntax.SynValSigAccess+GetSet: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] accessibility +FSharp.Compiler.Syntax.SynValSigAccess+GetSet: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] get_accessibility() +FSharp.Compiler.Syntax.SynValSigAccess+GetSet: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] get_getterAccessibility() +FSharp.Compiler.Syntax.SynValSigAccess+GetSet: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] get_setterAccessibility() +FSharp.Compiler.Syntax.SynValSigAccess+GetSet: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] getterAccessibility +FSharp.Compiler.Syntax.SynValSigAccess+GetSet: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] setterAccessibility +FSharp.Compiler.Syntax.SynValSigAccess+Single: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] accessibility +FSharp.Compiler.Syntax.SynValSigAccess+Single: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] get_accessibility() +FSharp.Compiler.Syntax.SynValSigAccess+Tags: Int32 GetSet +FSharp.Compiler.Syntax.SynValSigAccess+Tags: Int32 Single +FSharp.Compiler.Syntax.SynValSigAccess: Boolean IsGetSet +FSharp.Compiler.Syntax.SynValSigAccess: Boolean IsSingle +FSharp.Compiler.Syntax.SynValSigAccess: Boolean get_IsGetSet() +FSharp.Compiler.Syntax.SynValSigAccess: Boolean get_IsSingle() +FSharp.Compiler.Syntax.SynValSigAccess: FSharp.Compiler.Syntax.SynValSigAccess NewGetSet(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess]) +FSharp.Compiler.Syntax.SynValSigAccess: FSharp.Compiler.Syntax.SynValSigAccess NewSingle(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess]) +FSharp.Compiler.Syntax.SynValSigAccess: FSharp.Compiler.Syntax.SynValSigAccess+GetSet +FSharp.Compiler.Syntax.SynValSigAccess: FSharp.Compiler.Syntax.SynValSigAccess+Single +FSharp.Compiler.Syntax.SynValSigAccess: FSharp.Compiler.Syntax.SynValSigAccess+Tags +FSharp.Compiler.Syntax.SynValSigAccess: Int32 Tag +FSharp.Compiler.Syntax.SynValSigAccess: Int32 get_Tag() +FSharp.Compiler.Syntax.SynValSigAccess: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] SingleAccess() +FSharp.Compiler.Syntax.SynValSigAccess: System.String ToString() +FSharp.Compiler.Syntax.SynValSigAccess: System.Tuple`2[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess],Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess]] GetSetAccessNoCheck() FSharp.Compiler.Syntax.SynValTyparDecls: Boolean canInfer FSharp.Compiler.Syntax.SynValTyparDecls: Boolean get_canInfer() FSharp.Compiler.Syntax.SynValTyparDecls: FSharp.Compiler.Syntax.SynValTyparDecls NewSynValTyparDecls(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynTyparDecls], Boolean) @@ -9980,12 +10147,14 @@ FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia: Microsoft.FSharp.Core.FSharpOpti FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_BarRange() FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia: System.String ToString() FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia: Void .ctor(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Text.Range) +FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: FSharp.Compiler.Text.Range AndBangKeyword FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: FSharp.Compiler.Text.Range EqualsRange +FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: FSharp.Compiler.Text.Range get_AndBangKeyword() FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: FSharp.Compiler.Text.Range get_EqualsRange() FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] InKeyword FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_InKeyword() FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: System.String ToString() -FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: Void .ctor(FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) +FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: Void .ctor(FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: FSharp.Compiler.Text.Range OpeningBraceRange FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: FSharp.Compiler.Text.Range get_OpeningBraceRange() FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: System.String ToString() @@ -10408,6 +10577,12 @@ FSharp.Compiler.SyntaxTrivia.SynTyparDeclTrivia: Microsoft.FSharp.Collections.FS FSharp.Compiler.SyntaxTrivia.SynTyparDeclTrivia: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range] get_AmpersandRanges() FSharp.Compiler.SyntaxTrivia.SynTyparDeclTrivia: System.String ToString() FSharp.Compiler.SyntaxTrivia.SynTyparDeclTrivia: Void .ctor(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range]) +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: FSharp.Compiler.Text.Range ColonRange +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: FSharp.Compiler.Text.Range NotRange +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: FSharp.Compiler.Text.Range get_ColonRange() +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: FSharp.Compiler.Text.Range get_NotRange() +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: Void .ctor(FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) FSharp.Compiler.SyntaxTrivia.SynTypeDefnLeadingKeyword+And: FSharp.Compiler.Text.Range Item FSharp.Compiler.SyntaxTrivia.SynTypeDefnLeadingKeyword+And: FSharp.Compiler.Text.Range get_Item() FSharp.Compiler.SyntaxTrivia.SynTypeDefnLeadingKeyword+StaticType: FSharp.Compiler.Text.Range get_staticRange() @@ -10470,6 +10645,10 @@ FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: FSharp.Compiler.Text.Range OrKeywo FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: FSharp.Compiler.Text.Range get_OrKeyword() FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: System.String ToString() FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: Void .ctor(FSharp.Compiler.Text.Range) +FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia: FSharp.Compiler.Text.Range BarRange +FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia: FSharp.Compiler.Text.Range get_BarRange() +FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia: Void .ctor(FSharp.Compiler.Text.Range) FSharp.Compiler.SyntaxTrivia.SynUnionCaseTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] BarRange FSharp.Compiler.SyntaxTrivia.SynUnionCaseTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_BarRange() FSharp.Compiler.SyntaxTrivia.SynUnionCaseTrivia: System.String ToString() diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl index 646e067251e..3ae2414fc07 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl @@ -301,6 +301,24 @@ FSharp.Compiler.AbstractIL.IL+ILAttribute: Int32 get_Tag() FSharp.Compiler.AbstractIL.IL+ILAttribute: System.String ToString() FSharp.Compiler.AbstractIL.IL+ILAttributes: ILAttribute[] AsArray() FSharp.Compiler.AbstractIL.IL+ILAttributes: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILAttribute] AsList() +FSharp.Compiler.AbstractIL.IL+ILAttributesStored+Given: ILAttributes Item +FSharp.Compiler.AbstractIL.IL+ILAttributesStored+Given: ILAttributes get_Item() +FSharp.Compiler.AbstractIL.IL+ILAttributesStored+Reader: Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,FSharp.Compiler.AbstractIL.IL+ILAttribute[]] Item +FSharp.Compiler.AbstractIL.IL+ILAttributesStored+Reader: Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,FSharp.Compiler.AbstractIL.IL+ILAttribute[]] get_Item() +FSharp.Compiler.AbstractIL.IL+ILAttributesStored+Tags: Int32 Given +FSharp.Compiler.AbstractIL.IL+ILAttributesStored+Tags: Int32 Reader +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: Boolean IsGiven +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: Boolean IsReader +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: Boolean get_IsGiven() +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: Boolean get_IsReader() +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: FSharp.Compiler.AbstractIL.IL+ILAttributesStored+Given +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: FSharp.Compiler.AbstractIL.IL+ILAttributesStored+Reader +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: FSharp.Compiler.AbstractIL.IL+ILAttributesStored+Tags +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: ILAttributes GetCustomAttrs(Int32) +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: ILAttributesStored NewGiven(ILAttributes) +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: ILAttributesStored NewReader(Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,FSharp.Compiler.AbstractIL.IL+ILAttribute[]]) +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: Int32 Tag +FSharp.Compiler.AbstractIL.IL+ILAttributesStored: Int32 get_Tag() FSharp.Compiler.AbstractIL.IL+ILAttributesStored: System.String ToString() FSharp.Compiler.AbstractIL.IL+ILCallingConv: Boolean Equals(ILCallingConv) FSharp.Compiler.AbstractIL.IL+ILCallingConv: Boolean Equals(ILCallingConv, System.Collections.IEqualityComparer) @@ -398,10 +416,14 @@ FSharp.Compiler.AbstractIL.IL+ILEventDef: Boolean get_IsRTSpecialName() FSharp.Compiler.AbstractIL.IL+ILEventDef: Boolean get_IsSpecialName() FSharp.Compiler.AbstractIL.IL+ILEventDef: ILAttributes CustomAttrs FSharp.Compiler.AbstractIL.IL+ILEventDef: ILAttributes get_CustomAttrs() +FSharp.Compiler.AbstractIL.IL+ILEventDef: ILAttributesStored CustomAttrsStored +FSharp.Compiler.AbstractIL.IL+ILEventDef: ILAttributesStored get_CustomAttrsStored() FSharp.Compiler.AbstractIL.IL+ILEventDef: ILMethodRef AddMethod FSharp.Compiler.AbstractIL.IL+ILEventDef: ILMethodRef RemoveMethod FSharp.Compiler.AbstractIL.IL+ILEventDef: ILMethodRef get_AddMethod() FSharp.Compiler.AbstractIL.IL+ILEventDef: ILMethodRef get_RemoveMethod() +FSharp.Compiler.AbstractIL.IL+ILEventDef: Int32 MetadataIndex +FSharp.Compiler.AbstractIL.IL+ILEventDef: Int32 get_MetadataIndex() FSharp.Compiler.AbstractIL.IL+ILEventDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILMethodRef] OtherMethods FSharp.Compiler.AbstractIL.IL+ILEventDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILMethodRef] get_OtherMethods() FSharp.Compiler.AbstractIL.IL+ILEventDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodRef] FireMethod @@ -453,10 +475,14 @@ FSharp.Compiler.AbstractIL.IL+ILFieldDef: Boolean get_IsStatic() FSharp.Compiler.AbstractIL.IL+ILFieldDef: Boolean get_NotSerialized() FSharp.Compiler.AbstractIL.IL+ILFieldDef: ILAttributes CustomAttrs FSharp.Compiler.AbstractIL.IL+ILFieldDef: ILAttributes get_CustomAttrs() +FSharp.Compiler.AbstractIL.IL+ILFieldDef: ILAttributesStored CustomAttrsStored +FSharp.Compiler.AbstractIL.IL+ILFieldDef: ILAttributesStored get_CustomAttrsStored() FSharp.Compiler.AbstractIL.IL+ILFieldDef: ILMemberAccess Access FSharp.Compiler.AbstractIL.IL+ILFieldDef: ILMemberAccess get_Access() FSharp.Compiler.AbstractIL.IL+ILFieldDef: ILType FieldType FSharp.Compiler.AbstractIL.IL+ILFieldDef: ILType get_FieldType() +FSharp.Compiler.AbstractIL.IL+ILFieldDef: Int32 MetadataIndex +FSharp.Compiler.AbstractIL.IL+ILFieldDef: Int32 get_MetadataIndex() FSharp.Compiler.AbstractIL.IL+ILFieldDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILFieldInit] LiteralValue FSharp.Compiler.AbstractIL.IL+ILFieldDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILFieldInit] get_LiteralValue() FSharp.Compiler.AbstractIL.IL+ILFieldDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILNativeType] Marshal @@ -627,9 +653,11 @@ FSharp.Compiler.AbstractIL.IL+ILFieldSpec: System.String Name FSharp.Compiler.AbstractIL.IL+ILFieldSpec: System.String ToString() FSharp.Compiler.AbstractIL.IL+ILFieldSpec: System.String get_Name() FSharp.Compiler.AbstractIL.IL+ILFieldSpec: Void .ctor(ILFieldRef, ILType) +FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Boolean HasAllowsRefStruct FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Boolean HasDefaultConstructorConstraint FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Boolean HasNotNullableValueTypeConstraint FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Boolean HasReferenceTypeConstraint +FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Boolean get_HasAllowsRefStruct() FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Boolean get_HasDefaultConstructorConstraint() FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Boolean get_HasNotNullableValueTypeConstraint() FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Boolean get_HasReferenceTypeConstraint() @@ -646,7 +674,7 @@ FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Microsoft.FSharp.Collection FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: System.String Name FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: System.String ToString() FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: System.String get_Name() -FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Void .ctor(System.String, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType], ILGenericVariance, Boolean, Boolean, Boolean, ILAttributesStored, Int32) +FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef: Void .ctor(System.String, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType], ILGenericVariance, Boolean, Boolean, Boolean, Boolean, ILAttributesStored, Int32) FSharp.Compiler.AbstractIL.IL+ILGenericVariance+Tags: Int32 CoVariant FSharp.Compiler.AbstractIL.IL+ILGenericVariance+Tags: Int32 ContraVariant FSharp.Compiler.AbstractIL.IL+ILGenericVariance+Tags: Int32 NonVariant @@ -775,6 +803,8 @@ FSharp.Compiler.AbstractIL.IL+ILMethodDef: Boolean get_IsVirtual() FSharp.Compiler.AbstractIL.IL+ILMethodDef: Boolean get_IsZeroInit() FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILAttributes CustomAttrs FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILAttributes get_CustomAttrs() +FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILAttributesStored CustomAttrsStored +FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILAttributesStored get_CustomAttrsStored() FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILCallingConv CallingConv FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILCallingConv get_CallingConv() FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILCallingSignature GetCallingSignature() @@ -787,7 +817,9 @@ FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILReturn get_Return() FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILSecurityDecls SecurityDecls FSharp.Compiler.AbstractIL.IL+ILMethodDef: ILSecurityDecls get_SecurityDecls() FSharp.Compiler.AbstractIL.IL+ILMethodDef: Int32 MaxStack +FSharp.Compiler.AbstractIL.IL+ILMethodDef: Int32 MetadataIndex FSharp.Compiler.AbstractIL.IL+ILMethodDef: Int32 get_MaxStack() +FSharp.Compiler.AbstractIL.IL+ILMethodDef: Int32 get_MetadataIndex() FSharp.Compiler.AbstractIL.IL+ILMethodDef: MethodBody Body FSharp.Compiler.AbstractIL.IL+ILMethodDef: MethodBody get_Body() FSharp.Compiler.AbstractIL.IL+ILMethodDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef] GenericParams @@ -1247,10 +1279,14 @@ FSharp.Compiler.AbstractIL.IL+ILPropertyDef: Boolean get_IsRTSpecialName() FSharp.Compiler.AbstractIL.IL+ILPropertyDef: Boolean get_IsSpecialName() FSharp.Compiler.AbstractIL.IL+ILPropertyDef: ILAttributes CustomAttrs FSharp.Compiler.AbstractIL.IL+ILPropertyDef: ILAttributes get_CustomAttrs() +FSharp.Compiler.AbstractIL.IL+ILPropertyDef: ILAttributesStored CustomAttrsStored +FSharp.Compiler.AbstractIL.IL+ILPropertyDef: ILAttributesStored get_CustomAttrsStored() FSharp.Compiler.AbstractIL.IL+ILPropertyDef: ILThisConvention CallingConv FSharp.Compiler.AbstractIL.IL+ILPropertyDef: ILThisConvention get_CallingConv() FSharp.Compiler.AbstractIL.IL+ILPropertyDef: ILType PropertyType FSharp.Compiler.AbstractIL.IL+ILPropertyDef: ILType get_PropertyType() +FSharp.Compiler.AbstractIL.IL+ILPropertyDef: Int32 MetadataIndex +FSharp.Compiler.AbstractIL.IL+ILPropertyDef: Int32 get_MetadataIndex() FSharp.Compiler.AbstractIL.IL+ILPropertyDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType] Args FSharp.Compiler.AbstractIL.IL+ILPropertyDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType] get_Args() FSharp.Compiler.AbstractIL.IL+ILPropertyDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILFieldInit] Init @@ -1513,6 +1549,8 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDef: Boolean get_IsStruct() FSharp.Compiler.AbstractIL.IL+ILTypeDef: Boolean get_IsStructOrEnum() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILAttributes CustomAttrs FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILAttributes get_CustomAttrs() +FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILAttributesStored CustomAttrsStored +FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILAttributesStored get_CustomAttrsStored() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILDefaultPInvokeEncoding Encoding FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILDefaultPInvokeEncoding get_Encoding() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILEventDefs Events @@ -1527,25 +1565,29 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILPropertyDefs Properties FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILPropertyDefs get_Properties() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILSecurityDecls SecurityDecls FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILSecurityDecls get_SecurityDecls() -FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDef With(Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Reflection.TypeAttributes], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefLayout], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType]], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef]], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILFieldDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodImplDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILEventDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILPropertyDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILAttributesStored], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILSecurityDecls]) +FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDef With(Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Reflection.TypeAttributes], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefLayout], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType]], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef]], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILFieldDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodImplDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILEventDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILPropertyDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILAttributesStored], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILSecurityDecls], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]]]) FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefAccess Access FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefAccess get_Access() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefLayout Layout FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefLayout get_Layout() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefs NestedTypes FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefs get_NestedTypes() +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Int32 MetadataIndex +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Int32 get_MetadataIndex() FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef] GenericParams FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef] get_GenericParams() FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType] Implements FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType] get_Implements() FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType] Extends FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType] get_Extends() +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]] ImplementsCustomAttrs +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]] get_ImplementsCustomAttrs() FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.Reflection.TypeAttributes Attributes FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.Reflection.TypeAttributes get_Attributes() FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.String Name FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.String ToString() FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.String get_Name() -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Void .ctor(System.String, System.Reflection.TypeAttributes, ILTypeDefLayout, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType], ILMethodDefs, ILTypeDefs, ILFieldDefs, ILMethodImplDefs, ILEventDefs, ILPropertyDefs, ILTypeDefAdditionalFlags, ILSecurityDecls, ILAttributesStored) +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Void .ctor(System.String, System.Reflection.TypeAttributes, ILTypeDefLayout, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType], ILMethodDefs, ILTypeDefs, ILFieldDefs, ILMethodImplDefs, ILEventDefs, ILPropertyDefs, ILTypeDefAdditionalFlags, ILSecurityDecls, ILAttributesStored) FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess+Nested: ILMemberAccess Item FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess+Nested: ILMemberAccess get_Item() FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess+Tags: Int32 Nested @@ -2849,8 +2891,16 @@ FSharp.Compiler.EditorServices.CompletionContext+Inherit: FSharp.Compiler.Editor FSharp.Compiler.EditorServices.CompletionContext+Inherit: FSharp.Compiler.EditorServices.InheritanceContext get_context() FSharp.Compiler.EditorServices.CompletionContext+Inherit: System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[System.String],Microsoft.FSharp.Core.FSharpOption`1[System.String]] get_path() FSharp.Compiler.EditorServices.CompletionContext+Inherit: System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[System.String],Microsoft.FSharp.Core.FSharpOption`1[System.String]] path +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Boolean get_hasThis() +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Boolean get_isStatic() +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Boolean hasThis +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Boolean isStatic +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: FSharp.Compiler.EditorServices.MethodOverrideCompletionContext ctx +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: FSharp.Compiler.EditorServices.MethodOverrideCompletionContext get_ctx() FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: FSharp.Compiler.Text.Range enclosingTypeNameRange FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: FSharp.Compiler.Text.Range get_enclosingTypeNameRange() +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Int32 get_spacesBeforeOverrideKeyword() +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Int32 spacesBeforeOverrideKeyword FSharp.Compiler.EditorServices.CompletionContext+OpenDeclaration: Boolean get_isOpenType() FSharp.Compiler.EditorServices.CompletionContext+OpenDeclaration: Boolean isOpenType FSharp.Compiler.EditorServices.CompletionContext+ParameterList: FSharp.Compiler.Text.Position Item1 @@ -2904,7 +2954,7 @@ FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsUnionCaseFieldsD FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext AttributeApplication FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext Invalid FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewInherit(FSharp.Compiler.EditorServices.InheritanceContext, System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[System.String],Microsoft.FSharp.Core.FSharpOption`1[System.String]]) -FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewMethodOverride(FSharp.Compiler.Text.Range) +FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewMethodOverride(FSharp.Compiler.EditorServices.MethodOverrideCompletionContext, FSharp.Compiler.Text.Range, Int32, Boolean, Boolean) FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewOpenDeclaration(Boolean) FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewParameterList(FSharp.Compiler.Text.Position, System.Collections.Generic.HashSet`1[System.String]) FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewPattern(FSharp.Compiler.EditorServices.PatternContext) @@ -3539,6 +3589,33 @@ FSharp.Compiler.EditorServices.MethodGroupItemParameter: System.String Canonical FSharp.Compiler.EditorServices.MethodGroupItemParameter: System.String ParameterName FSharp.Compiler.EditorServices.MethodGroupItemParameter: System.String get_CanonicalTypeTextForSorting() FSharp.Compiler.EditorServices.MethodGroupItemParameter: System.String get_ParameterName() +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext+Tags: Int32 Class +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext+Tags: Int32 Interface +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext+Tags: Int32 ObjExpr +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean Equals(FSharp.Compiler.EditorServices.MethodOverrideCompletionContext) +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean Equals(FSharp.Compiler.EditorServices.MethodOverrideCompletionContext, System.Collections.IEqualityComparer) +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean Equals(System.Object) +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean Equals(System.Object, System.Collections.IEqualityComparer) +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean IsClass +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean IsInterface +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean IsObjExpr +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean get_IsClass() +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean get_IsInterface() +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Boolean get_IsObjExpr() +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: FSharp.Compiler.EditorServices.MethodOverrideCompletionContext Class +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: FSharp.Compiler.EditorServices.MethodOverrideCompletionContext NewInterface(FSharp.Compiler.Text.Range) +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: FSharp.Compiler.EditorServices.MethodOverrideCompletionContext NewObjExpr(FSharp.Compiler.Text.Range) +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: FSharp.Compiler.EditorServices.MethodOverrideCompletionContext get_Class() +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: FSharp.Compiler.EditorServices.MethodOverrideCompletionContext+Tags +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: FSharp.Compiler.Text.Range get_mExpr() +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: FSharp.Compiler.Text.Range get_mInterfaceName() +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: FSharp.Compiler.Text.Range mExpr +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: FSharp.Compiler.Text.Range mInterfaceName +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Int32 GetHashCode() +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Int32 GetHashCode(System.Collections.IEqualityComparer) +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Int32 Tag +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: Int32 get_Tag() +FSharp.Compiler.EditorServices.MethodOverrideCompletionContext: System.String ToString() FSharp.Compiler.EditorServices.ModuleKind: Boolean Equals(FSharp.Compiler.EditorServices.ModuleKind) FSharp.Compiler.EditorServices.ModuleKind: Boolean Equals(FSharp.Compiler.EditorServices.ModuleKind, System.Collections.IEqualityComparer) FSharp.Compiler.EditorServices.ModuleKind: Boolean Equals(System.Object) @@ -5560,21 +5637,25 @@ FSharp.Compiler.Symbols.FSharpSymbolPatterns: Microsoft.FSharp.Core.FSharpOption FSharp.Compiler.Symbols.FSharpSymbolPatterns: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Symbols.FSharpField,FSharp.Compiler.Symbols.FSharpType]] |Field|_|(FSharp.Compiler.Symbols.FSharpSymbol) FSharp.Compiler.Symbols.FSharpSymbolPatterns: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`3[FSharp.Compiler.Symbols.FSharpEntity,FSharp.Compiler.Symbols.FSharpEntity,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Symbols.FSharpType]]] |FSharpEntity|_|(FSharp.Compiler.Symbols.FSharpSymbol) FSharp.Compiler.Symbols.FSharpType: Boolean Equals(System.Object) +FSharp.Compiler.Symbols.FSharpType: Boolean HasNullAnnotation FSharp.Compiler.Symbols.FSharpType: Boolean HasTypeDefinition FSharp.Compiler.Symbols.FSharpType: Boolean IsAbbreviation FSharp.Compiler.Symbols.FSharpType: Boolean IsAnonRecordType FSharp.Compiler.Symbols.FSharpType: Boolean IsFunctionType FSharp.Compiler.Symbols.FSharpType: Boolean IsGenericParameter FSharp.Compiler.Symbols.FSharpType: Boolean IsMeasureType +FSharp.Compiler.Symbols.FSharpType: Boolean IsNullAmbivalent FSharp.Compiler.Symbols.FSharpType: Boolean IsStructTupleType FSharp.Compiler.Symbols.FSharpType: Boolean IsTupleType FSharp.Compiler.Symbols.FSharpType: Boolean IsUnresolved +FSharp.Compiler.Symbols.FSharpType: Boolean get_HasNullAnnotation() FSharp.Compiler.Symbols.FSharpType: Boolean get_HasTypeDefinition() FSharp.Compiler.Symbols.FSharpType: Boolean get_IsAbbreviation() FSharp.Compiler.Symbols.FSharpType: Boolean get_IsAnonRecordType() FSharp.Compiler.Symbols.FSharpType: Boolean get_IsFunctionType() FSharp.Compiler.Symbols.FSharpType: Boolean get_IsGenericParameter() FSharp.Compiler.Symbols.FSharpType: Boolean get_IsMeasureType() +FSharp.Compiler.Symbols.FSharpType: Boolean get_IsNullAmbivalent() FSharp.Compiler.Symbols.FSharpType: Boolean get_IsStructTupleType() FSharp.Compiler.Symbols.FSharpType: Boolean get_IsTupleType() FSharp.Compiler.Symbols.FSharpType: Boolean get_IsUnresolved() @@ -7659,8 +7740,12 @@ FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Syntax.SynExpr get_body() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Syntax.SynExprAndBang NewSynExprAndBang(FSharp.Compiler.Syntax.DebugPointAtBinding, Boolean, Boolean, FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia) FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Syntax.SynPat get_pat() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Syntax.SynPat pat +FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia Trivia +FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia get_Trivia() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia get_trivia() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia trivia +FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Text.Range Range +FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Text.Range get_Range() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynExprAndBang: Int32 Tag @@ -7908,6 +7993,8 @@ FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.Syntax.SynMem FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.Syntax.SynMemberFlags memberFlagsForSet FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.Syntax.SynMemberKind get_propKind() FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.Syntax.SynMemberKind propKind +FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.Syntax.SynValSigAccess accessibility +FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.Syntax.SynValSigAccess get_accessibility() FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.SyntaxTrivia.SynMemberDefnAutoPropertyTrivia get_trivia() FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.SyntaxTrivia.SynMemberDefnAutoPropertyTrivia trivia FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.Text.Range get_range() @@ -7916,8 +8003,6 @@ FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.Xml.PreXmlDoc FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: FSharp.Compiler.Xml.PreXmlDoc xmlDoc FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList] attributes FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList] get_attributes() -FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] accessibility -FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] get_accessibility() FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynType] get_typeOpt() FSharp.Compiler.Syntax.SynMemberDefn+AutoProperty: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynType] typeOpt FSharp.Compiler.Syntax.SynMemberDefn+GetSetMember: FSharp.Compiler.SyntaxTrivia.SynMemberGetSetTrivia get_trivia() @@ -8027,7 +8112,7 @@ FSharp.Compiler.Syntax.SynMemberDefn: Boolean get_IsNestedType() FSharp.Compiler.Syntax.SynMemberDefn: Boolean get_IsOpen() FSharp.Compiler.Syntax.SynMemberDefn: Boolean get_IsValField() FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewAbstractSlot(FSharp.Compiler.Syntax.SynValSig, FSharp.Compiler.Syntax.SynMemberFlags, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynMemberDefnAbstractSlotTrivia) -FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewAutoProperty(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], Boolean, FSharp.Compiler.Syntax.Ident, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynType], FSharp.Compiler.Syntax.SynMemberKind, FSharp.Compiler.Syntax.SynMemberFlags, FSharp.Compiler.Syntax.SynMemberFlags, FSharp.Compiler.Xml.PreXmlDoc, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynMemberDefnAutoPropertyTrivia) +FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewAutoProperty(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], Boolean, FSharp.Compiler.Syntax.Ident, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynType], FSharp.Compiler.Syntax.SynMemberKind, FSharp.Compiler.Syntax.SynMemberFlags, FSharp.Compiler.Syntax.SynMemberFlags, FSharp.Compiler.Xml.PreXmlDoc, FSharp.Compiler.Syntax.SynValSigAccess, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynMemberDefnAutoPropertyTrivia) FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewGetSetMember(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynBinding], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynBinding], FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynMemberGetSetTrivia) FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewImplicitCtor(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], FSharp.Compiler.Syntax.SynPat, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], FSharp.Compiler.Xml.PreXmlDoc, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynMemberDefnImplicitCtorTrivia) FSharp.Compiler.Syntax.SynMemberDefn: FSharp.Compiler.Syntax.SynMemberDefn NewImplicitInherit(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], FSharp.Compiler.Text.Range) @@ -9068,6 +9153,8 @@ FSharp.Compiler.Syntax.SynType+StaticConstantNamed: FSharp.Compiler.Syntax.SynTy FSharp.Compiler.Syntax.SynType+StaticConstantNamed: FSharp.Compiler.Syntax.SynType value FSharp.Compiler.Syntax.SynType+StaticConstantNamed: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynType+StaticConstantNamed: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.SynType+StaticConstantNull: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.SynType+StaticConstantNull: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynType+Tags: Int32 Anon FSharp.Compiler.Syntax.SynType+Tags: Int32 AnonRecd FSharp.Compiler.Syntax.SynType+Tags: Int32 App @@ -9085,9 +9172,11 @@ FSharp.Compiler.Syntax.SynType+Tags: Int32 SignatureParameter FSharp.Compiler.Syntax.SynType+Tags: Int32 StaticConstant FSharp.Compiler.Syntax.SynType+Tags: Int32 StaticConstantExpr FSharp.Compiler.Syntax.SynType+Tags: Int32 StaticConstantNamed +FSharp.Compiler.Syntax.SynType+Tags: Int32 StaticConstantNull FSharp.Compiler.Syntax.SynType+Tags: Int32 Tuple FSharp.Compiler.Syntax.SynType+Tags: Int32 Var FSharp.Compiler.Syntax.SynType+Tags: Int32 WithGlobalConstraints +FSharp.Compiler.Syntax.SynType+Tags: Int32 WithNull FSharp.Compiler.Syntax.SynType+Tuple: Boolean get_isStruct() FSharp.Compiler.Syntax.SynType+Tuple: Boolean isStruct FSharp.Compiler.Syntax.SynType+Tuple: FSharp.Compiler.Text.Range get_range() @@ -9104,6 +9193,14 @@ FSharp.Compiler.Syntax.SynType+WithGlobalConstraints: FSharp.Compiler.Text.Range FSharp.Compiler.Syntax.SynType+WithGlobalConstraints: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynType+WithGlobalConstraints: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynTypeConstraint] constraints FSharp.Compiler.Syntax.SynType+WithGlobalConstraints: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynTypeConstraint] get_constraints() +FSharp.Compiler.Syntax.SynType+WithNull: Boolean ambivalent +FSharp.Compiler.Syntax.SynType+WithNull: Boolean get_ambivalent() +FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.Syntax.SynType get_innerType() +FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.Syntax.SynType innerType +FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia get_trivia() +FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia trivia +FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynType: Boolean IsAnon FSharp.Compiler.Syntax.SynType: Boolean IsAnonRecd FSharp.Compiler.Syntax.SynType: Boolean IsApp @@ -9121,9 +9218,11 @@ FSharp.Compiler.Syntax.SynType: Boolean IsSignatureParameter FSharp.Compiler.Syntax.SynType: Boolean IsStaticConstant FSharp.Compiler.Syntax.SynType: Boolean IsStaticConstantExpr FSharp.Compiler.Syntax.SynType: Boolean IsStaticConstantNamed +FSharp.Compiler.Syntax.SynType: Boolean IsStaticConstantNull FSharp.Compiler.Syntax.SynType: Boolean IsTuple FSharp.Compiler.Syntax.SynType: Boolean IsVar FSharp.Compiler.Syntax.SynType: Boolean IsWithGlobalConstraints +FSharp.Compiler.Syntax.SynType: Boolean IsWithNull FSharp.Compiler.Syntax.SynType: Boolean get_IsAnon() FSharp.Compiler.Syntax.SynType: Boolean get_IsAnonRecd() FSharp.Compiler.Syntax.SynType: Boolean get_IsApp() @@ -9141,9 +9240,11 @@ FSharp.Compiler.Syntax.SynType: Boolean get_IsSignatureParameter() FSharp.Compiler.Syntax.SynType: Boolean get_IsStaticConstant() FSharp.Compiler.Syntax.SynType: Boolean get_IsStaticConstantExpr() FSharp.Compiler.Syntax.SynType: Boolean get_IsStaticConstantNamed() +FSharp.Compiler.Syntax.SynType: Boolean get_IsStaticConstantNull() FSharp.Compiler.Syntax.SynType: Boolean get_IsTuple() FSharp.Compiler.Syntax.SynType: Boolean get_IsVar() FSharp.Compiler.Syntax.SynType: Boolean get_IsWithGlobalConstraints() +FSharp.Compiler.Syntax.SynType: Boolean get_IsWithNull() FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewAnon(FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewAnonRecd(Boolean, Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.Syntax.Ident,FSharp.Compiler.Syntax.SynType]], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewApp(FSharp.Compiler.Syntax.SynType, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Boolean, FSharp.Compiler.Text.Range) @@ -9161,9 +9262,11 @@ FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewSignatureParam FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewStaticConstant(FSharp.Compiler.Syntax.SynConst, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewStaticConstantExpr(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewStaticConstantNamed(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewStaticConstantNull(FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewTuple(Boolean, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynTupleTypeSegment], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewVar(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewWithGlobalConstraints(FSharp.Compiler.Syntax.SynType, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynTypeConstraint], FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewWithNull(FSharp.Compiler.Syntax.SynType, Boolean, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Anon FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+AnonRecd FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+App @@ -9181,10 +9284,12 @@ FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+SignatureParamete FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+StaticConstant FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+StaticConstantExpr FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+StaticConstantNamed +FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+StaticConstantNull FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Tags FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Tuple FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Var FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+WithGlobalConstraints +FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+WithNull FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Text.Range Range FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Text.Range get_Range() FSharp.Compiler.Syntax.SynType: Int32 Tag @@ -9199,6 +9304,7 @@ FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparIsEquatable FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparIsReferenceType FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparIsUnmanaged FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparIsValueType +FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparNotSupportsNull FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparSubtypeOfType FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparSupportsMember FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparSupportsNull @@ -9244,6 +9350,12 @@ FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsValueType: FSharp.Compiler. FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsValueType: FSharp.Compiler.Syntax.SynTypar typar FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsValueType: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsValueType: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.Syntax.SynTypar genericName +FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.Syntax.SynTypar get_genericName() +FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia get_trivia() +FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia trivia +FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSubtypeOfType: FSharp.Compiler.Syntax.SynTypar get_typar() FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSubtypeOfType: FSharp.Compiler.Syntax.SynTypar typar FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSubtypeOfType: FSharp.Compiler.Syntax.SynType get_typeName() @@ -9269,6 +9381,7 @@ FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparIsEquatable FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparIsReferenceType FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparIsUnmanaged FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparIsValueType +FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparNotSupportsNull FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparSubtypeOfType FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparSupportsMember FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparSupportsNull @@ -9281,6 +9394,7 @@ FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparIsEquatable() FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparIsReferenceType() FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparIsUnmanaged() FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparIsValueType() +FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparNotSupportsNull() FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparSubtypeOfType() FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparSupportsMember() FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparSupportsNull() @@ -9293,6 +9407,7 @@ FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstrai FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparIsReferenceType(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparIsUnmanaged(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparIsValueType(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparNotSupportsNull(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparSubtypeOfType(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparSupportsMember(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynMemberSig, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparSupportsNull(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) @@ -9306,6 +9421,7 @@ FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstrai FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsReferenceType FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsUnmanaged FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsValueType +FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSubtypeOfType FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsMember FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsNull @@ -9649,7 +9765,9 @@ FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValInfo SynInfo FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValInfo arity FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValInfo get_SynInfo() FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValInfo get_arity() -FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValSig NewSynValSig(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], FSharp.Compiler.Syntax.SynIdent, FSharp.Compiler.Syntax.SynValTyparDecls, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynValInfo, Boolean, Boolean, FSharp.Compiler.Xml.PreXmlDoc, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynExpr], FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynValSigTrivia) +FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValSig NewSynValSig(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], FSharp.Compiler.Syntax.SynIdent, FSharp.Compiler.Syntax.SynValTyparDecls, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynValInfo, Boolean, Boolean, FSharp.Compiler.Xml.PreXmlDoc, FSharp.Compiler.Syntax.SynValSigAccess, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynExpr], FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynValSigTrivia) +FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValSigAccess accessibility +FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValSigAccess get_accessibility() FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValTyparDecls explicitTypeParams FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.Syntax.SynValTyparDecls get_explicitTypeParams() FSharp.Compiler.Syntax.SynValSig: FSharp.Compiler.SyntaxTrivia.SynValSigTrivia get_trivia() @@ -9664,11 +9782,33 @@ FSharp.Compiler.Syntax.SynValSig: Int32 Tag FSharp.Compiler.Syntax.SynValSig: Int32 get_Tag() FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList] attributes FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList] get_attributes() -FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] accessibility -FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] get_accessibility() FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynExpr] get_synExpr() FSharp.Compiler.Syntax.SynValSig: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynExpr] synExpr FSharp.Compiler.Syntax.SynValSig: System.String ToString() +FSharp.Compiler.Syntax.SynValSigAccess+GetSet: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] accessibility +FSharp.Compiler.Syntax.SynValSigAccess+GetSet: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] get_accessibility() +FSharp.Compiler.Syntax.SynValSigAccess+GetSet: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] get_getterAccessibility() +FSharp.Compiler.Syntax.SynValSigAccess+GetSet: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] get_setterAccessibility() +FSharp.Compiler.Syntax.SynValSigAccess+GetSet: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] getterAccessibility +FSharp.Compiler.Syntax.SynValSigAccess+GetSet: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] setterAccessibility +FSharp.Compiler.Syntax.SynValSigAccess+Single: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] accessibility +FSharp.Compiler.Syntax.SynValSigAccess+Single: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] get_accessibility() +FSharp.Compiler.Syntax.SynValSigAccess+Tags: Int32 GetSet +FSharp.Compiler.Syntax.SynValSigAccess+Tags: Int32 Single +FSharp.Compiler.Syntax.SynValSigAccess: Boolean IsGetSet +FSharp.Compiler.Syntax.SynValSigAccess: Boolean IsSingle +FSharp.Compiler.Syntax.SynValSigAccess: Boolean get_IsGetSet() +FSharp.Compiler.Syntax.SynValSigAccess: Boolean get_IsSingle() +FSharp.Compiler.Syntax.SynValSigAccess: FSharp.Compiler.Syntax.SynValSigAccess NewGetSet(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess]) +FSharp.Compiler.Syntax.SynValSigAccess: FSharp.Compiler.Syntax.SynValSigAccess NewSingle(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess]) +FSharp.Compiler.Syntax.SynValSigAccess: FSharp.Compiler.Syntax.SynValSigAccess+GetSet +FSharp.Compiler.Syntax.SynValSigAccess: FSharp.Compiler.Syntax.SynValSigAccess+Single +FSharp.Compiler.Syntax.SynValSigAccess: FSharp.Compiler.Syntax.SynValSigAccess+Tags +FSharp.Compiler.Syntax.SynValSigAccess: Int32 Tag +FSharp.Compiler.Syntax.SynValSigAccess: Int32 get_Tag() +FSharp.Compiler.Syntax.SynValSigAccess: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess] SingleAccess() +FSharp.Compiler.Syntax.SynValSigAccess: System.String ToString() +FSharp.Compiler.Syntax.SynValSigAccess: System.Tuple`2[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess],Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynAccess]] GetSetAccessNoCheck() FSharp.Compiler.Syntax.SynValTyparDecls: Boolean canInfer FSharp.Compiler.Syntax.SynValTyparDecls: Boolean get_canInfer() FSharp.Compiler.Syntax.SynValTyparDecls: FSharp.Compiler.Syntax.SynValTyparDecls NewSynValTyparDecls(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.SynTyparDecls], Boolean) @@ -10007,12 +10147,14 @@ FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia: Microsoft.FSharp.Core.FSharpOpti FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_BarRange() FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia: System.String ToString() FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia: Void .ctor(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Text.Range) +FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: FSharp.Compiler.Text.Range AndBangKeyword FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: FSharp.Compiler.Text.Range EqualsRange +FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: FSharp.Compiler.Text.Range get_AndBangKeyword() FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: FSharp.Compiler.Text.Range get_EqualsRange() FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] InKeyword FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_InKeyword() FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: System.String ToString() -FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: Void .ctor(FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) +FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: Void .ctor(FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: FSharp.Compiler.Text.Range OpeningBraceRange FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: FSharp.Compiler.Text.Range get_OpeningBraceRange() FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: System.String ToString() @@ -10435,6 +10577,12 @@ FSharp.Compiler.SyntaxTrivia.SynTyparDeclTrivia: Microsoft.FSharp.Collections.FS FSharp.Compiler.SyntaxTrivia.SynTyparDeclTrivia: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range] get_AmpersandRanges() FSharp.Compiler.SyntaxTrivia.SynTyparDeclTrivia: System.String ToString() FSharp.Compiler.SyntaxTrivia.SynTyparDeclTrivia: Void .ctor(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range]) +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: FSharp.Compiler.Text.Range ColonRange +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: FSharp.Compiler.Text.Range NotRange +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: FSharp.Compiler.Text.Range get_ColonRange() +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: FSharp.Compiler.Text.Range get_NotRange() +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: Void .ctor(FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) FSharp.Compiler.SyntaxTrivia.SynTypeDefnLeadingKeyword+And: FSharp.Compiler.Text.Range Item FSharp.Compiler.SyntaxTrivia.SynTypeDefnLeadingKeyword+And: FSharp.Compiler.Text.Range get_Item() FSharp.Compiler.SyntaxTrivia.SynTypeDefnLeadingKeyword+StaticType: FSharp.Compiler.Text.Range get_staticRange() @@ -10497,6 +10645,10 @@ FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: FSharp.Compiler.Text.Range OrKeywo FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: FSharp.Compiler.Text.Range get_OrKeyword() FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: System.String ToString() FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: Void .ctor(FSharp.Compiler.Text.Range) +FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia: FSharp.Compiler.Text.Range BarRange +FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia: FSharp.Compiler.Text.Range get_BarRange() +FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia: Void .ctor(FSharp.Compiler.Text.Range) FSharp.Compiler.SyntaxTrivia.SynUnionCaseTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] BarRange FSharp.Compiler.SyntaxTrivia.SynUnionCaseTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_BarRange() FSharp.Compiler.SyntaxTrivia.SynUnionCaseTrivia: System.String ToString() diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj index d0af2696e3b..9f0c7f230b9 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj @@ -25,6 +25,7 @@ FsUnit.fs + @@ -75,11 +76,20 @@ + + + SyntaxTreeTestSource\%(RecursiveDir)\%(Extension)\%(Filename)%(Extension) + + + - + + + TargetFramework=netstandard2.0 + diff --git a/tests/FSharp.Compiler.Service.Tests/FsiTests.fs b/tests/FSharp.Compiler.Service.Tests/FsiTests.fs index b6be93042d1..f6a785af4f1 100644 --- a/tests/FSharp.Compiler.Service.Tests/FsiTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/FsiTests.fs @@ -18,7 +18,7 @@ module MyModule = module FsiTests = let createFsiSession (useOneDynamicAssembly: bool) = - // Intialize output and input streams + // Initialize output and input streams let inStream = new StringReader("") let outStream = new CompilerOutputStream() let errStream = new CompilerOutputStream() @@ -288,7 +288,7 @@ module FsiTests = Assert.shouldBe "``hello world``" boundValue.Name [] - let ``Creation of a bound value succeeds with 'it' as the indentifier`` () = + let ``Creation of a bound value succeeds with 'it' as the identifier`` () = use fsiSession = createFsiSession false fsiSession.EvalInteraction("\"test\"") diff --git a/tests/FSharp.Compiler.Service.Tests/GeneratedCodeSymbolsTests.fs b/tests/FSharp.Compiler.Service.Tests/GeneratedCodeSymbolsTests.fs new file mode 100644 index 00000000000..66b9782fb29 --- /dev/null +++ b/tests/FSharp.Compiler.Service.Tests/GeneratedCodeSymbolsTests.fs @@ -0,0 +1,104 @@ +module FSharp.Compiler.Service.Tests.GeneratedCodeSymbolsTests + +open Xunit +open FSharp.Compiler.CodeAnalysis +open FSharp.Compiler.Service.Tests.Common +open FSharp.Compiler.Symbols + +[] +let dirName = "GeneratedCodeSymbolsTests" + +[] +let ``IsUnionCaseTester for Is* member in a class`` () = + let source = """ +module Lib + +type T () = + member x.IsM = 1 +""" + let cleanup, options = createProjectOptions dirName [ source ] [ "--langversion:preview" ] + use _holder = cleanup + let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=false) + let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate + + let mfvs = + seq { + for implFile in wholeProjectResults.AssemblyContents.ImplementationFiles do + for decl in implFile.Declarations do + match decl with + | FSharpImplementationFileDeclaration.Entity(e,ds) -> + for d in ds do + match d with + | FSharpImplementationFileDeclaration.MemberOrFunctionOrValue (mfv, args, body) -> + yield mfv + | _ -> () + | _ -> () + } + + Assert.Contains(mfvs, fun x -> x.LogicalName = "get_IsM") + let mfv = mfvs |> Seq.filter (fun x -> x.LogicalName = "get_IsM") |> Seq.exactlyOne + Assert.False(mfv.IsUnionCaseTester, $"get_IsM has IsUnionCaseTester = {mfv.IsUnionCaseTester}") + +[] +let ``IsUnionCaseTester for Is* generated property in DU`` () = + let source = """ +module Lib + +type T = A | B +""" + let cleanup, options = createProjectOptions dirName [ source ] [ "--langversion:preview" ] + use _holder = cleanup + let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=false) + let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate + + let mfvs = + seq { + for implFile in wholeProjectResults.AssemblyContents.ImplementationFiles do + for decl in implFile.Declarations do + match decl with + | FSharpImplementationFileDeclaration.Entity(e,ds) -> + for d in ds do + match d with + | FSharpImplementationFileDeclaration.MemberOrFunctionOrValue (mfv, args, body) -> + yield mfv + | _ -> () + | _ -> () + } + + Assert.Contains(mfvs, fun x -> x.LogicalName = "get_IsA") + let mfv = mfvs |> Seq.filter (fun x -> x.LogicalName = "get_IsA") |> Seq.exactlyOne + Assert.True(mfv.IsUnionCaseTester, $"get_IsA has IsUnionCaseTester = {mfv.IsUnionCaseTester}") + +[] +let ``IsUnionCaseTester for Is* user property in DU`` () = + let source = """ +module Lib + +type T = + | A + | B + member x.IsC + with get () = false +""" + let cleanup, options = createProjectOptions dirName [ source ] [ "--langversion:preview" ] + use _holder = cleanup + let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=false) + let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate + + let mfvs = + seq { + for implFile in wholeProjectResults.AssemblyContents.ImplementationFiles do + for decl in implFile.Declarations do + match decl with + | FSharpImplementationFileDeclaration.Entity(e,ds) -> + for d in ds do + match d with + | FSharpImplementationFileDeclaration.MemberOrFunctionOrValue (mfv, args, body) -> + yield mfv + | _ -> () + | _ -> () + } + + Assert.Contains(mfvs, fun x -> x.LogicalName = "get_IsC") + let mfv = mfvs |> Seq.filter (fun x -> x.LogicalName = "get_IsC") |> Seq.exactlyOne + Assert.False(mfv.IsUnionCaseTester, $"get_IsC has IsUnionCaseTester = {mfv.IsUnionCaseTester}") \ No newline at end of file diff --git a/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs b/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs index 8038cb8ad38..9ce34ec9be7 100644 --- a/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs @@ -115,10 +115,9 @@ type PreTypeDefData = mkILMethods [] let typeAttributes = TypeAttributes.Public - - ILTypeDef(this.Name, typeAttributes, ILTypeDefLayout.Auto, [], [], - None, methodsDefs, mkILTypeDefs [], mkILFields [], emptyILMethodImpls, mkILEvents [], mkILProperties [], - ILTypeDefAdditionalFlags.None, emptyILSecurityDecls, emptyILCustomAttrsStored) + ILTypeDef(this.Name, typeAttributes, ILTypeDefLayout.Auto, [], None, [], + None, methodsDefs, mkILTypeDefs [], mkILFields [], emptyILMethodImpls, mkILEvents [], mkILProperties [], ILTypeDefAdditionalFlags.None, + emptyILSecurityDecls, emptyILCustomAttrsStored) type PreTypeDef(data: PreTypeDefData) = let typeDef = data.TypeDef diff --git a/tests/FSharp.Compiler.Service.Tests/MultiProjectAnalysisTests.fs b/tests/FSharp.Compiler.Service.Tests/MultiProjectAnalysisTests.fs index 8e6168f9e76..3564288b229 100644 --- a/tests/FSharp.Compiler.Service.Tests/MultiProjectAnalysisTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/MultiProjectAnalysisTests.fs @@ -23,8 +23,8 @@ let internal tups (m:range) = (m.StartLine, m.StartColumn), (m.EndLine, m.EndCol module internal Project1A = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let baseName = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let baseName = getTemporaryFileName () let dllName = Path.ChangeExtension(baseName, ".dll") let projFileName = Path.ChangeExtension(baseName, ".fsproj") let fileSource1 = """ @@ -69,8 +69,8 @@ type U = //----------------------------------------------------------------------------------------- module internal Project1B = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let baseName = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let baseName = getTemporaryFileName () let dllName = Path.ChangeExtension(baseName, ".dll") let projFileName = Path.ChangeExtension(baseName, ".fsproj") let fileSource1 = """ @@ -96,8 +96,8 @@ let x = // A project referencing two sub-projects module internal MultiProject1 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let baseName = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let baseName = getTemporaryFileName () let dllName = Path.ChangeExtension(baseName, ".dll") let projFileName = Path.ChangeExtension(baseName, ".fsproj") let fileSource1 = """ @@ -271,7 +271,7 @@ module internal ManyProjectsStressTest = type Project = { ModuleName: string; FileName: string; Options: FSharpProjectOptions; DllName: string } let projects = [ for i in 1 .. numProjectsForStressTest do - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") let moduleName = "Project" + string i let fileSource1 = "module " + moduleName + """ @@ -287,7 +287,7 @@ let p = C.Print() """ FileSystem.OpenFileForWriteShim(fileName1).Write(fileSource1) - let baseName = tryCreateTemporaryFileName () + let baseName = getTemporaryFileName () let dllName = Path.ChangeExtension(baseName, ".dll") let projFileName = Path.ChangeExtension(baseName, ".fsproj") let fileNames = [|fileName1|] @@ -296,8 +296,8 @@ let p = C.Print() yield { ModuleName = moduleName; FileName=fileName1; Options = options; DllName=dllName } ] let jointProject = - let fileName = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let dllBase = tryCreateTemporaryFileName () + let fileName = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let dllBase = getTemporaryFileName () let dllName = Path.ChangeExtension(dllBase, ".dll") let projFileName = Path.ChangeExtension(dllBase, ".fsproj") let fileSource = @@ -396,8 +396,8 @@ let ``Test ManyProjectsStressTest all symbols`` useTransparentCompiler = module internal MultiProjectDirty1 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let baseName = tryCreateTemporaryFileName() + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let baseName = getTemporaryFileName() let dllName = Path.ChangeExtension(baseName, ".dll") let projFileName = Path.ChangeExtension(baseName, ".fsproj") let content = """module Project1 @@ -418,8 +418,8 @@ let x = "F#" module internal MultiProjectDirty2 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let baseName = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let baseName = getTemporaryFileName () let dllName = Path.ChangeExtension(baseName, ".dll") let projFileName = Path.ChangeExtension(baseName, ".fsproj") @@ -444,7 +444,7 @@ let z = Project1.x ReferencedProjects = [| FSharpReferencedProject.FSharpReference(MultiProjectDirty1.dllName, MultiProjectDirty1.getOptions()) |] } [] -[] +// [] [] let ``Test multi project symbols should pick up changes in dependent projects`` useTransparentCompiler = @@ -609,10 +609,10 @@ let ``Test multi project symbols should pick up changes in dependent projects`` module internal Project2A = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName(), ".fs") - let baseName1 = tryCreateTemporaryFileName () - let baseName2 = tryCreateTemporaryFileName () - let baseName3 = tryCreateTemporaryFileName () // this one doesn't get InternalsVisibleTo rights + let fileName1 = Path.ChangeExtension(getTemporaryFileName(), ".fs") + let baseName1 = getTemporaryFileName () + let baseName2 = getTemporaryFileName () + let baseName3 = getTemporaryFileName () // this one doesn't get InternalsVisibleTo rights let dllShortName = Path.GetFileNameWithoutExtension(baseName2) let dllName = Path.ChangeExtension(baseName1, ".dll") let projFileName = Path.ChangeExtension(baseName1, ".fsproj") @@ -638,7 +638,7 @@ type C() = // A project referencing Project2A module internal Project2B = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") let dllName = Path.ChangeExtension(Project2A.baseName2, ".dll") let projFileName = Path.ChangeExtension(Project2A.baseName2, ".fsproj") let fileSource1 = """ @@ -662,7 +662,7 @@ let v = Project2A.C().InternalMember // access an internal symbol // A project referencing Project2A but without access to the internals of A module internal Project2C = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") let dllName = Path.ChangeExtension(Project2A.baseName3, ".dll") let projFileName = Path.ChangeExtension(Project2A.baseName3, ".fsproj") let fileSource1 = """ @@ -733,8 +733,8 @@ let ``Test multi project 2 all symbols`` useTransparentCompiler = module internal Project3A = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let baseName = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let baseName = getTemporaryFileName () let dllName = Path.ChangeExtension(baseName, ".dll") let projFileName = Path.ChangeExtension(baseName, ".fsproj") let fileSource1 = """ @@ -756,8 +756,8 @@ let (|DivisibleBy|_|) by n = // A project referencing a sub-project module internal MultiProject3 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let baseName = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let baseName = getTemporaryFileName () let dllName = Path.ChangeExtension(baseName, ".dll") let projFileName = Path.ChangeExtension(baseName, ".fsproj") let fileSource1 = """ diff --git a/tests/FSharp.Compiler.Service.Tests/PatternMatchCompilationTests.fs b/tests/FSharp.Compiler.Service.Tests/PatternMatchCompilationTests.fs index 2defa8e9e2f..4ae43434099 100644 --- a/tests/FSharp.Compiler.Service.Tests/PatternMatchCompilationTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/PatternMatchCompilationTests.fs @@ -314,12 +314,12 @@ match box 1 with """ assertHasSymbolUsages (List.map string ['a'..'j']) checkResults dumpDiagnostics checkResults |> shouldEqual [ - "(5,34--5,35): The type 'obj' does not support the operator '+'" - "(5,32--5,33): The type 'obj' does not support the operator '+'" - "(7,45--7,46): The type 'obj' does not match the type 'uint64'" - "(7,43--7,44): The type 'obj' does not match the type 'uint64'" - "(8,43--8,44): The type 'obj' does not match the type 'int8'" - "(8,41--8,42): The type 'obj' does not match the type 'int8'" + "(5,34--5,35): The type 'objnull' does not support the operator '+'" + "(5,32--5,33): The type 'objnull' does not support the operator '+'" + "(7,45--7,46): The type 'objnull' does not match the type 'uint64'" + "(7,43--7,44): The type 'objnull' does not match the type 'uint64'" + "(8,43--8,44): The type 'objnull' does not match the type 'int8'" + "(8,41--8,42): The type 'objnull' does not match the type 'int8'" "(3,6--3,11): Incomplete pattern matches on this expression. For example, the value '``some-other-subtype``' may indicate a case not covered by the pattern(s)." ] @@ -755,7 +755,7 @@ Some x |> eq """ assertHasSymbolUsages (List.map string ['a'..'z']) checkResults dumpDiagnostics checkResults |> shouldEqual [ - "(11,25--11,26): This expression was expected to have type\u001d 'int' \u001dbut here has type\u001d 'obj'"; + "(11,25--11,26): This expression was expected to have type\u001d 'int' \u001dbut here has type\u001d 'objnull'"; "(28,6--28,24): Incomplete pattern matches on this expression. For example, the value '``some-other-subtype``' may indicate a case not covered by the pattern(s)."; "(26,6--26,12): Incomplete pattern matches on this expression. For example, the value '``some-other-subtype``' may indicate a case not covered by the pattern(s)."; "(24,6--24,12): Incomplete pattern matches on this expression. For example, the value '``some-other-subtype``' may indicate a case not covered by the pattern(s)."; @@ -955,8 +955,8 @@ Some "" |> eq // No more type checks after the above line? """ assertHasSymbolUsages (Set.toList validSet) checkResults dumpDiagnostics checkResults |> shouldEqual [ - "(27,2--27,14): This expression was expected to have type\u001d 'obj' \u001dbut here has type\u001d 'struct ('a * 'b)'"; - "(52,2--52,13): This expression was expected to have type\u001d 'obj' \u001dbut here has type\u001d 'AAA'"; + "(27,2--27,14): This expression was expected to have type\u001d 'objnull' \u001dbut here has type\u001d 'struct ('a * 'b)'"; + "(52,2--52,13): This expression was expected to have type\u001d 'objnull' \u001dbut here has type\u001d 'AAA'"; "(26,6--26,24): Incomplete pattern matches on this expression. For example, the value '``some-other-subtype``' may indicate a case not covered by the pattern(s)."; "(24,6--24,12): Incomplete pattern matches on this expression. For example, the value '``some-other-subtype``' may indicate a case not covered by the pattern(s)."; "(22,6--22,12): Incomplete pattern matches on this expression. For example, the value '``some-other-subtype``' may indicate a case not covered by the pattern(s)."; @@ -1037,10 +1037,10 @@ Some "" |> eq """ assertHasSymbolUsages (set ['a'..'y'] - set [ 'm'..'r' ] |> Set.map string |> Set.toList) checkResults dumpDiagnostics checkResults |> shouldEqual [ - "(19,2--19,4): This expression was expected to have type\u001d 'obj' \u001dbut here has type\u001d 'int'"; - "(21,2--21,7): This expression was expected to have type\u001d 'obj' \u001dbut here has type\u001d 'bool'"; - "(23,2--23,6): This expression was expected to have type\u001d 'obj' \u001dbut here has type\u001d 'bool'"; - "(28,28--28,29): The type 'obj' does not match the type 'int'"; + "(19,2--19,4): This expression was expected to have type\u001d 'objnull' \u001dbut here has type\u001d 'int'"; + "(21,2--21,7): This expression was expected to have type\u001d 'objnull' \u001dbut here has type\u001d 'bool'"; + "(23,2--23,6): This expression was expected to have type\u001d 'objnull' \u001dbut here has type\u001d 'bool'"; + "(28,28--28,29): The type 'objnull' does not match the type 'int'"; "(41,5--41,6): The value or constructor 'm' is not defined."; "(42,5--42,6): The value or constructor 'n' is not defined."; "(43,5--43,6): The value or constructor 'o' is not defined."; diff --git a/tests/FSharp.Compiler.Service.Tests/PerfTests.fs b/tests/FSharp.Compiler.Service.Tests/PerfTests.fs index 0469338037c..0a58bd4ec72 100644 --- a/tests/FSharp.Compiler.Service.Tests/PerfTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/PerfTests.fs @@ -14,8 +14,8 @@ let internal checker = FSharpChecker.Create() module internal Project1 = - let fileNamesI = [ for i in 1 .. 10 -> (i, Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs")) ] - let base2 = tryCreateTemporaryFileName () + let fileNamesI = [ for i in 1 .. 10 -> (i, Path.ChangeExtension(getTemporaryFileName (), ".fs")) ] + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSources = [ for i,f in fileNamesI -> (f, "module M" + string i) ] diff --git a/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs b/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs index b89cfebc15d..237c49d5794 100644 --- a/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs @@ -21,8 +21,8 @@ open TestFramework module internal Project1 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let fileName2 = Path.ChangeExtension(base2, ".fs") let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") @@ -639,8 +639,8 @@ let ``Test file explicit parse all symbols`` () = module internal Project2 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -835,8 +835,8 @@ let ``Test project2 all uses of all symbols`` () = module internal Project3 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -1278,8 +1278,8 @@ let ``Test project3 all uses of all signature symbols`` () = module internal Project4 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -1433,8 +1433,8 @@ let ``Test project4 T symbols`` () = module internal Project5 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -1661,8 +1661,8 @@ let ``Test partial active patterns' exact ranges from uses of symbols`` () = module internal Project6 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -1714,8 +1714,8 @@ let ``Test project 6 all symbols`` () = module internal Project7 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -1775,8 +1775,8 @@ let ``Test project 7 all symbols`` () = //----------------------------------------------------------------------------------------- module internal Project8 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -1859,8 +1859,8 @@ let ``Test project 8 all symbols`` () = //----------------------------------------------------------------------------------------- module internal Project9 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -1936,8 +1936,8 @@ let ``Test project 9 all symbols`` () = module internal Project10 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -2018,8 +2018,8 @@ let ``Test Project10 all symbols`` () = module internal Project11 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -2085,8 +2085,8 @@ let ``Test Project11 all symbols`` () = module internal Project12 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -2153,8 +2153,8 @@ let ``Test Project12 all symbols`` () = module internal Project13 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -2309,8 +2309,8 @@ let ``Test Project13 all symbols`` () = module internal Project14 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -2378,8 +2378,8 @@ let ``Test Project14 all symbols`` () = module internal Project15 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -2437,9 +2437,9 @@ let ``Test Project15 all symbols`` () = module internal Project16 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") let sigFileName1 = Path.ChangeExtension(fileName1, ".fsi") - let base2 = tryCreateTemporaryFileName () + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1Text = """ @@ -2732,8 +2732,8 @@ let ``Test project16 DeclaringEntity`` () = module internal Project17 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -2821,12 +2821,12 @@ let ``Test Project17 all symbols`` () = //----------------------------------------------------------------------------------------- -// Misc - generic type definnitions +// Misc - generic type definitions module internal Project18 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -2875,8 +2875,8 @@ let ``Test Project18 all symbols`` () = module internal Project19 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -2954,8 +2954,8 @@ let ``Test Project19 all symbols`` () = module internal Project20 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -3006,8 +3006,8 @@ let ``Test Project20 all symbols`` () = module internal Project21 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -3084,8 +3084,8 @@ let ``Test Project21 all symbols`` () = module internal Project22 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -3223,8 +3223,8 @@ let ``Test Project22 IList properties`` () = module internal Project23 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -3357,8 +3357,8 @@ let ``Test Project23 extension properties' getters/setters should refer to the c // Misc - property symbols module internal Project24 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -3660,8 +3660,8 @@ let ``Test symbol uses of properties with both getters and setters`` () = // Misc - type provider symbols module internal Project25 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -3794,8 +3794,8 @@ let ``Test symbol uses of fully-qualified records`` () = module internal Project26 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -3885,8 +3885,8 @@ let ``Test Project26 parameter symbols`` () = module internal Project27 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -3930,8 +3930,8 @@ let ``Test project27 all symbols in signature`` () = module internal Project28 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -4034,8 +4034,8 @@ let ``Test project28 all symbols in signature`` () = #endif module internal Project29 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -4090,8 +4090,8 @@ let ``Test project29 event symbols`` () = module internal Project30 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -4150,8 +4150,8 @@ let ``Test project30 Format attributes`` () = module internal Project31 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -4283,9 +4283,9 @@ let ``Test project31 Format C# method attributes`` () = module internal Project32 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") let sigFileName1 = Path.ChangeExtension(fileName1, ".fsi") - let base2 = tryCreateTemporaryFileName () + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -4355,8 +4355,8 @@ let ``Test Project32 should be able to find impl symbols`` () = module internal Project33 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -4399,7 +4399,7 @@ let ``Test Project33 extension methods`` () = ("GetValue", ["member"; "extmem"])] module internal Project34 = - let directoryPath = tryCreateTemporaryDirectory () + let directoryPath = createTemporaryDirectory "Project34" let sourceFileName = Path.Combine(directoryPath, "Program.fs") let dllName = Path.ChangeExtension(sourceFileName, ".dll") let projFileName = Path.ChangeExtension(sourceFileName, ".fsproj") @@ -4471,8 +4471,8 @@ let ``Test project34 should report correct accessibility for System.Data.Listene module internal Project35 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -4548,7 +4548,7 @@ let ``Test project35 CurriedParameterGroups should be available for nested funct module internal Project35b = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fsx") + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fsx") let fileSource1Text = """ #r "System.dll" #r "notexist.dll" @@ -4612,8 +4612,8 @@ let ``Test project35b Dependency files for check of project`` () = module internal Project36 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """module Project36 @@ -4709,8 +4709,8 @@ let ``Test project36 FSharpMemberOrFunctionOrValue.LiteralValue`` useTransparent module internal Project37 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let fileName2 = Path.ChangeExtension(base2, ".fs") let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") @@ -4860,8 +4860,8 @@ let ``Test project37 DeclaringEntity`` () = module internal Project38 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -4962,8 +4962,8 @@ let ``Test project38 abstract slot information`` () = module internal Project39 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -5042,8 +5042,8 @@ let ``Test project39 all symbols`` () = module internal Project40 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -5075,39 +5075,42 @@ let ``Test Project40 all symbols`` () = let allSymbolUsesInfo = [ for s in allSymbolUses -> s.Symbol.DisplayName, tups s.Range, attribsOfSymbol s.Symbol ] allSymbolUsesInfo |> shouldEqual [("option", ((4, 10), (4, 16)), ["abbrev"]); ("x", ((4, 7), (4, 8)), []); - ("x", ((4, 23), (4, 24)), []); - ("IsSome", ((4, 23), (4, 31)), ["member"; "prop"; "funky"]); - ("x", ((4, 33), (4, 34)), []); - ("IsNone", ((4, 33), (4, 41)), ["member"; "prop"; "funky"]); - ("f", ((4, 4), (4, 5)), ["val"]); - ("CompilationRepresentationAttribute", ((6, 2), (6, 27)), ["class"]); - ("CompilationRepresentationAttribute", ((6, 2), (6, 27)), ["member"]); - ("CompilationRepresentationFlags", ((6, 28), (6, 58)), - ["enum"; "valuetype"]); - ("UseNullAsTrueValue", ((6, 28), (6, 77)), ["field"; "static"; "8"]); - ("string", ((9, 11), (9, 17)), ["abbrev"]); - ("string", ((9, 11), (9, 17)), ["abbrev"]); ("A", ((8, 6), (8, 7)), []); - ("B", ((9, 6), (9, 7)), []); ("C", ((7, 5), (7, 6)), ["union"]); - ("IsItAnA", ((10, 13), (10, 20)), ["member"; "getter"; "funky"]); - ("IsItAnAMethod", ((11, 13), (11, 26)), ["member"; "funky"]); - ("x", ((10, 11), (10, 12)), []); ("x", ((10, 29), (10, 30)), []); - ("A", ((10, 36), (10, 37)), []); ("B", ((10, 48), (10, 49)), []); - ("x", ((11, 11), (11, 12)), []); ("x", ((11, 37), (11, 38)), []); - ("A", ((11, 44), (11, 45)), []); ("B", ((11, 56), (11, 57)), []); - ("C", ((13, 10), (13, 11)), ["union"]); ("x", ((13, 7), (13, 8)), []); - ("x", ((13, 15), (13, 16)), []); - ("IsItAnA", ((13, 15), (13, 24)), ["member"; "prop"; "funky"]); - ("x", ((13, 25), (13, 26)), []); - ("IsItAnAMethod", ((13, 25), (13, 40)), ["member"; "funky"]); - ("g", ((13, 4), (13, 5)), ["val"]); ("M", ((2, 7), (2, 8)), ["module"])] + ("x", ((4, 23), (4, 24)), []); + ("IsSome", ((4, 23), (4, 31)), ["member"; "prop"; "funky"]); + ("x", ((4, 33), (4, 34)), []); + ("IsNone", ((4, 33), (4, 41)), ["member"; "prop"; "funky"]); + ("f", ((4, 4), (4, 5)), ["val"]); + ("CompilationRepresentationAttribute", ((6, 2), (6, 27)), ["class"]); + ("CompilationRepresentationAttribute", ((6, 2), (6, 27)), ["member"]); + ("CompilationRepresentationFlags", ((6, 28), (6, 58)), ["enum"; "valuetype"]); + ("UseNullAsTrueValue", ((6, 28), (6, 77)), ["field"; "static"; "8"]); + ("CompilationRepresentationAttribute", ((6, 2), (6, 27)), ["class"]); + ("CompilationRepresentationAttribute", ((6, 2), (6, 27)), ["member"]); + ("CompilationRepresentationFlags", ((6, 28), (6, 58)), ["enum"; "valuetype"]); + ("UseNullAsTrueValue", ((6, 28), (6, 77)), ["field"; "static"; "8"]); + ("string", ((9, 11), (9, 17)), ["abbrev"]); + ("string", ((9, 11), (9, 17)), ["abbrev"]); ("A", ((8, 6), (8, 7)), []); + ("B", ((9, 6), (9, 7)), []); ("C", ((7, 5), (7, 6)), ["union"]); + ("IsItAnA", ((10, 13), (10, 20)), ["member"; "getter"; "funky"]); + ("IsItAnAMethod", ((11, 13), (11, 26)), ["member"; "funky"]); + ("x", ((10, 11), (10, 12)), []); ("x", ((10, 29), (10, 30)), []); + ("A", ((10, 36), (10, 37)), []); ("B", ((10, 48), (10, 49)), []); + ("x", ((11, 11), (11, 12)), []); ("x", ((11, 37), (11, 38)), []); + ("A", ((11, 44), (11, 45)), []); ("B", ((11, 56), (11, 57)), []); + ("C", ((13, 10), (13, 11)), ["union"]); ("x", ((13, 7), (13, 8)), []); + ("x", ((13, 15), (13, 16)), []); + ("IsItAnA", ((13, 15), (13, 24)), ["member"; "prop"; "funky"]); + ("x", ((13, 25), (13, 26)), []); + ("IsItAnAMethod", ((13, 25), (13, 40)), ["member"; "funky"]); + ("g", ((13, 4), (13, 5)), ["val"]); ("M", ((2, 7), (2, 8)), ["module"])] //-------------------------------------------- module internal Project41 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") // We need to us a stable name to keep the hashes stable - let base2 = Path.Combine(Path.GetDirectoryName(tryCreateTemporaryFileName ()), "stabletmp.tmp") + let base2 = Path.Combine(Path.GetDirectoryName(getTemporaryFileName ()), "stabletmp.tmp") let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -5205,10 +5208,10 @@ let ``Test project41 all symbols`` () = module internal Project42 = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let fileName2 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let fileName2 = Path.ChangeExtension(getTemporaryFileName (), ".fs") // We need to us a stable name to keep the hashes stable - let base2 = Path.Combine(Path.GetDirectoryName(tryCreateTemporaryFileName ()), "stabletmp.tmp") + let base2 = Path.Combine(Path.GetDirectoryName(getTemporaryFileName ()), "stabletmp.tmp") let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -5251,8 +5254,8 @@ let ``Test project42 to ensure cached checked results are invalidated`` () = module internal ProjectBig = - let fileNamesI = [ for i in 1 .. 10 -> (i, Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs")) ] - let base2 = tryCreateTemporaryFileName () + let fileNamesI = [ for i in 1 .. 10 -> (i, Path.ChangeExtension(getTemporaryFileName (), ".fs")) ] + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSources = [ for i,f in fileNamesI -> (f, "module M" + string i) ] @@ -5287,8 +5290,8 @@ let ``add files with same name from different folders`` () = module internal ProjectStructUnions = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1 = """ @@ -5339,8 +5342,8 @@ let ``Test typed AST for struct unions`` useTransparentCompiler = // See https:/ module internal ProjectLineDirectives = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1Text = """ @@ -5406,8 +5409,8 @@ let ``Test diagnostics with line directives ignored`` () = [] let ``ParseAndCheckFileResults contains ImplFile list if FSharpChecker is created with keepAssemblyContent flag set to true`` useTransparentCompiler = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1Text = """ @@ -5492,8 +5495,8 @@ let ``#4030, Incremental builder creation warnings 5`` () = [] let ``Unused opens in rec module smoke test 1`` useTransparentCompiler = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1Text = """ @@ -5567,8 +5570,8 @@ type UseTheThings(i:int) = [] let ``Unused opens in non rec module smoke test 1`` useTransparentCompiler = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1Text = """ @@ -5600,6 +5603,14 @@ open SomeUsedModuleContainingFunction open SomeUsedModuleContainingExtensionMember open SomeUsedModuleContainingActivePattern open SomeUsedModuleContainingUnion +open type System.DayOfWeek // Used, should not appear. +open type System.DateTimeKind // Unused, should appear. + +type FSharpEnum1 = X = 1 | Y = (1 <<< 1) | Z = (1 <<< 2) +type FSharpEnum2 = H = 1 | I = (1 <<< 1) | J = (1 <<< 2) + +open type FSharpEnum1 // Used, should not appear. +open type FSharpEnum2 // Unused, should appear. type UseTheThings(i:int) = member x.Value = Dictionary() // use something from System.Collections.Generic, as a constructor @@ -5607,6 +5618,10 @@ type UseTheThings(i:int) = member x.UseSomeUsedModuleContainingActivePattern(ActivePattern g) = g member x.UseSomeUsedModuleContainingExtensionMember() = (3).Q member x.UseSomeUsedModuleContainingUnion() = A + member x.UseEnumCase = Monday // Use an enum case from System.DayOfWeek. + member x.UseEnumCaseQualified = System.DateTimeKind.Utc // Use a qualified enum case. + member x.UseFSharpEnumCase = Y // Use an enum case from FSharpEnum1. + member x.UseFSharpEnumCaseQualified = FSharpEnum2.J // Use a qualified enum case. """ let fileSource1 = SourceText.ofString fileSource1Text FileSystem.OpenFileForWriteShim(fileName1).Write(fileSource1Text) @@ -5634,7 +5649,9 @@ type UseTheThings(i:int) = (((6, 5), (6, 19)), "open FSharp.Control // unused"); (((7, 5), (7, 16)), "open FSharp.Data // unused"); (((8, 5), (8, 25)), "open System.Globalization // unused"); - (((25, 5), (25, 21)), "open SomeUnusedModule")] + (((25, 5), (25, 21)), "open SomeUnusedModule"); + (((31, 10), (31, 29)), "open type System.DateTimeKind // Unused, should appear.") + (((37, 10), (37, 21)), "open type FSharpEnum2 // Unused, should appear.")] unusedOpensData |> shouldEqual expected [] @@ -5642,8 +5659,8 @@ type UseTheThings(i:int) = [] let ``Unused opens smoke test auto open`` useTransparentCompiler = - let fileName1 = Path.ChangeExtension(tryCreateTemporaryFileName (), ".fs") - let base2 = tryCreateTemporaryFileName () + let fileName1 = Path.ChangeExtension(getTemporaryFileName (), ".fs") + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSource1Text = """ @@ -5799,7 +5816,7 @@ let ``References from #r nuget are included in script project options`` () = assemblyNames |> should contain "Dapper.dll" module internal EmptyProject = - let base2 = tryCreateTemporaryFileName () + let base2 = getTemporaryFileName () let dllName = Path.ChangeExtension(base2, ".dll") let projFileName = Path.ChangeExtension(base2, ".fsproj") diff --git a/tests/FSharp.Compiler.Service.Tests/ScriptOptionsTests.fs b/tests/FSharp.Compiler.Service.Tests/ScriptOptionsTests.fs index d88e426f7b2..2d197af0398 100644 --- a/tests/FSharp.Compiler.Service.Tests/ScriptOptionsTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ScriptOptionsTests.fs @@ -26,7 +26,7 @@ let pi = Math.PI [] let ``can generate options for different frameworks regardless of execution environment - useSdkRefs = false``(assumeDotNetFramework, useSdkRefs, flag) = let path = Path.GetTempPath() - let file = tryCreateTemporaryFileName () + ".fsx" + let file = getTemporaryFileName () + ".fsx" let tempFile = Path.Combine(path, file) let _, errors = checker.GetProjectOptionsFromScript(tempFile, SourceText.ofString scriptSource, assumeDotNetFramework = assumeDotNetFramework, useSdkRefs = useSdkRefs, otherFlags = [| flag |]) @@ -41,9 +41,9 @@ let ``can generate options for different frameworks regardless of execution envi [] [] let ``can resolve nuget packages to right target framework for different frameworks regardless of execution environment``(flag) = - let path = DirectoryInfo(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)) - let file = tryCreateTemporaryFileNameInDirectory(path) + ".fsx" - let scriptFullPath = Path.Combine(path.FullName, file) + let path = DirectoryInfo(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)).FullName + let file = (getTemporaryFileNameInDirectory path) + ".fsx" + let scriptFullPath = Path.Combine(path, file) let scriptSource = """ #r "nuget: FSharp.Data, 3.3.3" open System diff --git a/tests/FSharp.Compiler.Service.Tests/ServiceUntypedParseTests.fs b/tests/FSharp.Compiler.Service.Tests/ServiceUntypedParseTests.fs index 03ee0eac8d5..330bcae5c5c 100644 --- a/tests/FSharp.Compiler.Service.Tests/ServiceUntypedParseTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ServiceUntypedParseTests.fs @@ -1404,7 +1404,7 @@ type C(x: int, y: int) = class end Assert.True(parseFileResults.IsTypeAnnotationGivenAtPosition (mkPos 2 15), "Expected annotation for argument 'y'") [] - let ``IsTypeAnnotationGivenAtPosition - method - args no unannotions``() = + let ``IsTypeAnnotationGivenAtPosition - method - args no annotations``() = let source = """ type C() = member _.M(x, y) = () @@ -1444,7 +1444,7 @@ type C() = Assert.True(parseFileResults.IsTypeAnnotationGivenAtPosition (mkPos 3 23), "Expected annotation for argument 'y'") [] - let ``IsTypeAnnotationGivenAtPosition - method currying - args no unannotions``() = + let ``IsTypeAnnotationGivenAtPosition - method currying - args no annotations``() = let source = """ type C() = member _.M x y = () diff --git a/tests/FSharp.Compiler.Service.Tests/Symbols.fs b/tests/FSharp.Compiler.Service.Tests/Symbols.fs index 2a46d5492f9..c63dca9f6de 100644 --- a/tests/FSharp.Compiler.Service.Tests/Symbols.fs +++ b/tests/FSharp.Compiler.Service.Tests/Symbols.fs @@ -1,6 +1,5 @@ module FSharp.Compiler.Service.Tests.Symbols -open System open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.Service.Tests.Common open FSharp.Compiler.Symbols @@ -1090,19 +1089,32 @@ let builder = Builder () let x = builder { return 3 } let y = builder let z = Builder () { return 3 } + +type A () = + let builder = Builder () + let _ = builder { return 3 } + + static member Builder = Builder () + +type System.Object with + static member Builder = Builder () + +let c = A.Builder { return 3 } +let d = System.Object.Builder { return 3 } """ + shouldEqual checkResults.Diagnostics [||] shouldEqual [ // type Builder () = (2, 5), false - // … = Builder () - (6, 14), false - // let builder = … (6, 4), false + // … = Builder () + (6, 14), false + // let x = builder { return 3 } (8, 8), false // Item.Value _ (8, 8), true // Item.CustomBuilder _ @@ -1112,9 +1124,37 @@ let z = Builder () { return 3 } // let z = Builder () { return 3 } (10, 8), false + + // let builder = … + (13, 8), false + + // … = Builder () + (13, 18), false + + // let x = builder { return 3 } + (14, 12), false // Item.Value _ + (14, 12), true // Item.CustomBuilder _ + + // static member Builder = … + (16, 18), false + + // … = Builder () + (16, 28), false + + // static member Builder = … + (19, 18), false + + // … = Builder () + (19, 28), false + + // A.Builder { return 3 } + (21, 8), false + + // System.Object.Builder { return 3 } + (22, 8), false ] [ - for symbolUse in checkResults.GetAllUsesOfAllSymbolsInFile() do + for symbolUse in checkResults.GetAllUsesOfAllSymbolsInFile() |> Seq.sortBy (fun x -> x.Range.StartLine, x.Range.StartColumn) do match symbolUse.Symbol.DisplayName with | "Builder" | "builder" -> (symbolUse.Range.StartLine, symbolUse.Range.StartColumn), symbolUse.IsFromComputationExpression | _ -> () diff --git a/tests/FSharp.Compiler.Service.Tests/SyntaxTreeTests.fs b/tests/FSharp.Compiler.Service.Tests/SyntaxTreeTests.fs index 2a80d2c5626..654c01d6cc0 100644 --- a/tests/FSharp.Compiler.Service.Tests/SyntaxTreeTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/SyntaxTreeTests.fs @@ -23,7 +23,7 @@ let allTestCases = let RootDirectory = @"/root" /// -/// Everytime `__SOURCE_DIRECTORY__` was used in the code, the ast will contain an invalid value and range for it. +/// Every time `__SOURCE_DIRECTORY__` was used in the code, the ast will contain an invalid value and range for it. /// This should be cleaned up when the test runs during CI/CD. /// /// diff --git a/tests/FSharp.Compiler.Service.Tests/TokenizerTests.fs b/tests/FSharp.Compiler.Service.Tests/TokenizerTests.fs index 051056e6698..d2c2a83139f 100644 --- a/tests/FSharp.Compiler.Service.Tests/TokenizerTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/TokenizerTests.fs @@ -26,7 +26,7 @@ let tokenizeLines (lines:string[]) = let ``Tokenizer test - simple let with string``() = let tokenizedLines = tokenizeLines - [| "// Sets the hello wrold variable" + [| "// Sets the hello world variable" "let hello = \"Hello world\" " |] let actual = @@ -37,7 +37,7 @@ let ``Tokenizer test - simple let with string``() = [("LINE_COMMENT", "//"); ("LINE_COMMENT", " "); ("LINE_COMMENT", "Sets"); ("LINE_COMMENT", " "); ("LINE_COMMENT", "the"); ("LINE_COMMENT", " "); ("LINE_COMMENT", "hello"); ("LINE_COMMENT", " "); - ("LINE_COMMENT", "wrold"); ("LINE_COMMENT", " "); + ("LINE_COMMENT", "world"); ("LINE_COMMENT", " "); ("LINE_COMMENT", "variable")]); (1, [("LET", "let"); ("WHITESPACE", " "); ("IDENT", "hello"); diff --git a/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs b/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs index 62ff75d34df..e9ce93a37cd 100644 --- a/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs @@ -9,6 +9,7 @@ open FSharp.Compiler.Text open FSharp.Compiler.Tokenization open FSharp.Compiler.EditorServices open FSharp.Compiler.Symbols +open FSharp.Compiler.Xml open FSharp.Test open Xunit @@ -390,6 +391,35 @@ c.Abc testToolTipSquashing source 7 5 "c.Abc" [ "c"; "Abc" ] FSharpTokenTag.Identifier +let getCheckResults source options = + let fileName, options = + mkTestFileAndOptions + source + options + let _, checkResults = parseAndCheckFile fileName source options + checkResults + + +let taggedTextsToString (t: TaggedText array) = + t + |> Array.map (fun taggedText -> taggedText.Text) + |> String.concat "" +let assertAndExtractTooltip (ToolTipText(items)) = + Assert.Equal(1,items.Length) + match items.[0] with + | ToolTipElement.Group [ singleElement ] -> + let toolTipText = + singleElement.MainDescription + |> taggedTextsToString + toolTipText, singleElement.XmlDoc, singleElement.Remarks |> Option.map taggedTextsToString + | _ -> failwith $"Expected group, got {items.[0]}" + +let assertAndGetSingleToolTipText items = + let text,_xml,_remarks = assertAndExtractTooltip items + text + +let normalize (s:string) = s.Replace("\r\n", "\n").Replace("\n\n", "\n") + [] let ``Auto property should display a single tool tip`` () = let source = """ @@ -400,19 +430,88 @@ type Bar() = /// Some comment on class member member val Foo = "bla" with get, set """ - let fileName, options = - mkTestFileAndOptions - source - Array.empty - let _, checkResults = parseAndCheckFile fileName source options - let (ToolTipText(items)) = checkResults.GetToolTip(7, 18, " member val Foo = \"bla\" with get, set", [ "Foo" ], FSharpTokenTag.Identifier) - Assert.True (items.Length = 1) - match items.[0] with - | ToolTipElement.Group [ { MainDescription = description } ] -> - let toolTipText = - description - |> Array.map (fun taggedText -> taggedText.Text) - |> String.concat "" + let checkResults = getCheckResults source Array.empty + checkResults.GetToolTip(7, 18, " member val Foo = \"bla\" with get, set", [ "Foo" ], FSharpTokenTag.Identifier) + |> assertAndGetSingleToolTipText + |> Assert.shouldBeEquivalentTo "property Bar.Foo: string with get, set" - Assert.Equal("property Bar.Foo: string with get, set", toolTipText) - | _ -> failwith $"Expected group, got {items.[0]}" +[] +let ``Should display nullable Csharp code analysis annotations on method argument`` () = + + let source = """module Foo +let exists() = System.IO.Path.Exists(null:string) +""" + let checkResults = getCheckResults source [|"--checknulls+";"--langversion:preview"|] + checkResults.GetToolTip(2, 36, "let exists() = System.IO.Path.Exists(null:string)", [ "Exists" ], FSharpTokenTag.Identifier) + |> assertAndGetSingleToolTipText + |> Assert.shouldBeEquivalentTo "System.IO.Path.Exists([] path: string | null) : bool" + +[] +let ``Should display xml doc on a nullable BLC method`` () = + + let source = """module Foo +let exists() = System.IO.Path.Exists(null:string) +""" + let checkResults = getCheckResults source [|"--checknulls+";"--langversion:preview"|] + checkResults.GetToolTip(2, 36, "let exists() = System.IO.Path.Exists(null:string)", [ "Exists" ], FSharpTokenTag.Identifier) + |> assertAndExtractTooltip + |> fun (text,xml,remarks) -> + text |> Assert.shouldBeEquivalentTo "System.IO.Path.Exists([] path: string | null) : bool" + match xml with + | FSharpXmlDoc.FromXmlFile (_dll,sigPath) -> sigPath |> Assert.shouldBeEquivalentTo "M:System.IO.Path.Exists(System.String)" + | _ -> failwith $"Xml wrong type %A{xml}" + + +[] +let ``Should display xml doc on fsharp hosted nullable function`` () = + + let source = """module Foo +/// This is a xml doc above myFunc +let myFunc(x:string|null) : string | null = x + +let exists() = myFunc(null) +""" + let checkResults = getCheckResults source [|"--checknulls+";"--langversion:preview"|] + checkResults.GetToolTip(5, 21, "let exists() = myFunc(null)", [ "myFunc" ], FSharpTokenTag.Identifier) + |> assertAndExtractTooltip + |> fun (text,xml,remarks) -> + match xml with + | FSharpXmlDoc.FromXmlText t -> + t.UnprocessedLines |> Assert.shouldBeEquivalentTo [|" This is a xml doc above myFunc"|] + | _ -> failwith $"xml was %A{xml}" + text |> Assert.shouldBeEquivalentTo "val myFunc: x: string | null -> string | null" + remarks |> Assert.shouldBeEquivalentTo (Some "Full name: Foo.myFunc") + + +[] +let ``Should display nullable Csharp code analysis annotations on method return type`` () = + + let source = """module Foo +let getPath() = System.IO.Path.GetFileName(null:string) +""" + let checkResults = getCheckResults source [|"--checknulls+";"--langversion:preview"|] + checkResults.GetToolTip(2, 42, "let getPath() = System.IO.Path.GetFileName(null:string)", [ "GetFileName" ], FSharpTokenTag.Identifier) + |> assertAndGetSingleToolTipText + |> Assert.shouldBeEquivalentTo ("""[] +System.IO.Path.GetFileName(path: string | null) : string | null""" |> normalize) + +[] +let ``Should display nullable Csharp code analysis annotations on TryParse pattern`` () = + let source = """module Foo +let success,version = System.Version.TryParse(null) +""" + let checkResults = getCheckResults source [|"--checknulls+";"--langversion:preview"|] + checkResults.GetToolTip(2, 45, "let success,version = System.Version.TryParse(null)", [ "TryParse" ], FSharpTokenTag.Identifier) + |> assertAndGetSingleToolTipText + |> Assert.shouldBeEquivalentTo ("""System.Version.TryParse([] input: string | null, [] result: byref) : bool""") + +[] +let ``Display with nullable annotations can be squashed`` () = + let source = """module Foo +let success,version = System.Version.TryParse(null) +""" + let checkResults = getCheckResults source [|"--checknulls+";"--langversion:preview"|] + checkResults.GetToolTip(2, 45, "let success,version = System.Version.TryParse(null)", [ "TryParse" ], FSharpTokenTag.Identifier,width=100) + |> assertAndGetSingleToolTipText + |> Assert.shouldBeEquivalentTo ("""System.Version.TryParse([] input: string | null, + [] result: byref) : bool""" |> normalize) \ No newline at end of file diff --git a/tests/FSharp.Compiler.Service.Tests/expected-help-output.bsl b/tests/FSharp.Compiler.Service.Tests/expected-help-output.bsl index 8f80673a9ba..61cf7105859 100644 --- a/tests/FSharp.Compiler.Service.Tests/expected-help-output.bsl +++ b/tests/FSharp.Compiler.Service.Tests/expected-help-output.bsl @@ -72,7 +72,7 @@ -g) --debug:{full|pdbonly|portable|embedded} Specify debugging type: full, portable, embedded, pdbonly. ('full' - is the default if no debuggging type + is the default if no debugging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform @@ -109,6 +109,8 @@ --nowarn: Disable specific warning messages --warnon: Enable specific warnings that may be off by default +--checknulls[+|-] Enable nullness declarations and + checks --consolecolors[+|-] Output warning and error messages in color diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard20.debug.bsl index def2dea16c8..8b927e77440 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard20.debug.bsl @@ -126,6 +126,9 @@ Microsoft.FSharp.Collections.ArrayModule: T MaxBy[T,TResult](Microsoft.FSharp.Co Microsoft.FSharp.Collections.ArrayModule: T Max[T](T[]) Microsoft.FSharp.Collections.ArrayModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], T[]) Microsoft.FSharp.Collections.ArrayModule: T Min[T](T[]) +Microsoft.FSharp.Collections.ArrayModule: T RandomChoiceBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], T[]) +Microsoft.FSharp.Collections.ArrayModule: T RandomChoiceWith[T](System.Random, T[]) +Microsoft.FSharp.Collections.ArrayModule: T RandomChoice[T](T[]) Microsoft.FSharp.Collections.ArrayModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], T[]) Microsoft.FSharp.Collections.ArrayModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], T[]) Microsoft.FSharp.Collections.ArrayModule: T Sum$W[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], T[]) @@ -164,6 +167,15 @@ Microsoft.FSharp.Collections.ArrayModule: T[] InsertManyAt[T](Int32, System.Coll Microsoft.FSharp.Collections.ArrayModule: T[] OfList[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ArrayModule: T[] OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.ArrayModule: T[] Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], T[]) +Microsoft.FSharp.Collections.ArrayModule: T[] RandomChoicesBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], Int32, T[]) +Microsoft.FSharp.Collections.ArrayModule: T[] RandomChoicesWith[T](System.Random, Int32, T[]) +Microsoft.FSharp.Collections.ArrayModule: T[] RandomChoices[T](Int32, T[]) +Microsoft.FSharp.Collections.ArrayModule: T[] RandomSampleBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], Int32, T[]) +Microsoft.FSharp.Collections.ArrayModule: T[] RandomSampleWith[T](System.Random, Int32, T[]) +Microsoft.FSharp.Collections.ArrayModule: T[] RandomSample[T](Int32, T[]) +Microsoft.FSharp.Collections.ArrayModule: T[] RandomShuffleBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], T[]) +Microsoft.FSharp.Collections.ArrayModule: T[] RandomShuffleWith[T](System.Random, T[]) +Microsoft.FSharp.Collections.ArrayModule: T[] RandomShuffle[T](T[]) Microsoft.FSharp.Collections.ArrayModule: T[] RemoveAt[T](Int32, T[]) Microsoft.FSharp.Collections.ArrayModule: T[] RemoveManyAt[T](Int32, Int32, T[]) Microsoft.FSharp.Collections.ArrayModule: T[] Replicate[T](Int32, T) @@ -194,6 +206,9 @@ Microsoft.FSharp.Collections.ArrayModule: Void Iterate2[T1,T2](Microsoft.FSharp. Microsoft.FSharp.Collections.ArrayModule: Void IterateIndexed2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.Unit]]], T1[], T2[]) Microsoft.FSharp.Collections.ArrayModule: Void IterateIndexed[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], T[]) Microsoft.FSharp.Collections.ArrayModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], T[]) +Microsoft.FSharp.Collections.ArrayModule: Void RandomShuffleInPlaceBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], T[]) +Microsoft.FSharp.Collections.ArrayModule: Void RandomShuffleInPlaceWith[T](System.Random, T[]) +Microsoft.FSharp.Collections.ArrayModule: Void RandomShuffleInPlace[T](T[]) Microsoft.FSharp.Collections.ArrayModule: Void Set[T](T[], Int32, T) Microsoft.FSharp.Collections.ArrayModule: Void SortInPlaceBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], T[]) Microsoft.FSharp.Collections.ArrayModule: Void SortInPlaceWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], T[]) @@ -329,6 +344,15 @@ Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] OfArray[T](T[]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RandomChoicesBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], Int32, Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RandomChoicesWith[T](System.Random, Int32, Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RandomChoices[T](Int32, Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RandomSampleBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], Int32, Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RandomSampleWith[T](System.Random, Int32, Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RandomSample[T](Int32, Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RandomShuffleBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RandomShuffleWith[T](System.Random, Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RandomShuffle[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RemoveAt[T](Int32, Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RemoveManyAt[T](Int32, Int32, Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] Replicate[T](Int32, T) @@ -377,6 +401,9 @@ Microsoft.FSharp.Collections.ListModule: T MaxBy[T,TResult](Microsoft.FSharp.Cor Microsoft.FSharp.Collections.ListModule: T Max[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T Min[T](Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: T RandomChoiceBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: T RandomChoiceWith[T](System.Random, Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: T RandomChoice[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T Sum$W[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.FSharpList`1[T]) @@ -483,6 +510,15 @@ Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1 Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] OfArray[T](T[]) Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] OfList[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RandomChoicesBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], Int32, System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RandomChoicesWith[T](System.Random, Int32, System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RandomChoices[T](Int32, System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RandomSampleBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], Int32, System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RandomSampleWith[T](System.Random, Int32, System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RandomSample[T](Int32, System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RandomShuffleBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RandomShuffleWith[T](System.Random, System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RandomShuffle[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] ReadOnly[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RemoveAt[T](Int32, System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RemoveManyAt[T](Int32, Int32, System.Collections.Generic.IEnumerable`1[T]) @@ -518,6 +554,9 @@ Microsoft.FSharp.Collections.SeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core Microsoft.FSharp.Collections.SeqModule: T Max[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T Min[T](System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: T RandomChoiceBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: T RandomChoiceWith[T](System.Random, System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: T RandomChoice[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T Sum$W[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], System.Collections.Generic.IEnumerable`1[T]) @@ -1747,7 +1786,10 @@ Microsoft.FSharp.Core.Operators+Unchecked: Boolean Equals[T](T, T) Microsoft.FSharp.Core.Operators+Unchecked: Int32 Compare[T](T, T) Microsoft.FSharp.Core.Operators+Unchecked: Int32 Hash[T](T) Microsoft.FSharp.Core.Operators+Unchecked: T DefaultOf[T]() +Microsoft.FSharp.Core.Operators+Unchecked: T NonNullQuickPattern[T](T) +Microsoft.FSharp.Core.Operators+Unchecked: T NonNull[T](T) Microsoft.FSharp.Core.Operators+Unchecked: T Unbox[T](System.Object) +Microsoft.FSharp.Core.Operators: Boolean IsNullV[T](System.Nullable`1[T]) Microsoft.FSharp.Core.Operators: Boolean IsNull[T](T) Microsoft.FSharp.Core.Operators: Boolean Not(Boolean) Microsoft.FSharp.Core.Operators: Boolean op_Equality[T](T, T) @@ -1783,6 +1825,8 @@ Microsoft.FSharp.Core.Operators: Int64 ToInt64[T](T) Microsoft.FSharp.Core.Operators: IntPtr ToIntPtr$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.IntPtr], T) Microsoft.FSharp.Core.Operators: IntPtr ToIntPtr[T](T) Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Collections.FSharpList`1[T] op_Append[T](Microsoft.FSharp.Collections.FSharpList`1[T], Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpChoice`2[Microsoft.FSharp.Core.Unit,T] NullMatchPattern[T](T) +Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpChoice`2[Microsoft.FSharp.Core.Unit,T] NullValueMatchPattern[T](System.Nullable`1[T]) Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpFunc`2[T1,T3] op_ComposeLeft[T2,T3,T1](Microsoft.FSharp.Core.FSharpFunc`2[T2,T3], Microsoft.FSharp.Core.FSharpFunc`2[T1,T2]) Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpFunc`2[T1,T3] op_ComposeRight[T1,T2,T3](Microsoft.FSharp.Core.FSharpFunc`2[T1,T2], Microsoft.FSharp.Core.FSharpFunc`2[T2,T3]) Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpOption`1[System.String] FailurePattern(System.Exception) @@ -1812,6 +1856,8 @@ Microsoft.FSharp.Core.Operators: System.Exception Failure(System.String) Microsoft.FSharp.Core.Operators: System.IO.TextReader ConsoleIn[T]() Microsoft.FSharp.Core.Operators: System.IO.TextWriter ConsoleError[T]() Microsoft.FSharp.Core.Operators: System.IO.TextWriter ConsoleOut[T]() +Microsoft.FSharp.Core.Operators: System.Nullable`1[T] NullV[T]() +Microsoft.FSharp.Core.Operators: System.Nullable`1[T] WithNullV[T](T) Microsoft.FSharp.Core.Operators: System.Object Box[T](T) Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]) Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) @@ -1835,6 +1881,8 @@ Microsoft.FSharp.Core.Operators: T Cos[T](T) Microsoft.FSharp.Core.Operators: T Cosh$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,T], T) Microsoft.FSharp.Core.Operators: T Cosh[T](T) Microsoft.FSharp.Core.Operators: T DefaultArg[T](Microsoft.FSharp.Core.FSharpOption`1[T], T) +Microsoft.FSharp.Core.Operators: T DefaultIfNullV[T](T, System.Nullable`1[T]) +Microsoft.FSharp.Core.Operators: T DefaultIfNull[T](T, T) Microsoft.FSharp.Core.Operators: T DefaultValueArg[T](Microsoft.FSharp.Core.FSharpValueOption`1[T], T) Microsoft.FSharp.Core.Operators: T Exit[T](Int32) Microsoft.FSharp.Core.Operators: T Exp$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,T], T) @@ -1852,6 +1900,11 @@ Microsoft.FSharp.Core.Operators: T Log10[T](T) Microsoft.FSharp.Core.Operators: T Log[T](T) Microsoft.FSharp.Core.Operators: T Max[T](T, T) Microsoft.FSharp.Core.Operators: T Min[T](T, T) +Microsoft.FSharp.Core.Operators: T NonNullQuickPattern[T](T) +Microsoft.FSharp.Core.Operators: T NonNullQuickValuePattern[T](System.Nullable`1[T]) +Microsoft.FSharp.Core.Operators: T NonNullV[T](System.Nullable`1[T]) +Microsoft.FSharp.Core.Operators: T NonNull[T](T) +Microsoft.FSharp.Core.Operators: T NullArgCheck[T](System.String, T) Microsoft.FSharp.Core.Operators: T NullArg[T](System.String) Microsoft.FSharp.Core.Operators: T PowInteger$W[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], T, Int32) Microsoft.FSharp.Core.Operators: T PowInteger[T](T, Int32) @@ -1871,6 +1924,7 @@ Microsoft.FSharp.Core.Operators: T Tanh[T](T) Microsoft.FSharp.Core.Operators: T Truncate$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,T], T) Microsoft.FSharp.Core.Operators: T Truncate[T](T) Microsoft.FSharp.Core.Operators: T Unbox[T](System.Object) +Microsoft.FSharp.Core.Operators: T WithNull[T](T) Microsoft.FSharp.Core.Operators: T op_BitwiseAnd$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], T, T) Microsoft.FSharp.Core.Operators: T op_BitwiseAnd[T](T, T) Microsoft.FSharp.Core.Operators: T op_BitwiseOr$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], T, T) @@ -1963,8 +2017,10 @@ Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] Filt Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] Flatten[T](Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpOption`1[T]]) Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OfNullable[T](System.Nullable`1[T]) Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OfObj[T](T) +Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OfValueOption[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OrElseWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpOption`1[T]], Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OrElse[T](Microsoft.FSharp.Core.FSharpOption`1[T], Microsoft.FSharp.Core.FSharpOption`1[T]) +Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpValueOption`1[T] ToValueOption[T](Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: System.Nullable`1[T] ToNullable[T](Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: T DefaultValue[T](T, Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: T DefaultWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpOption`1[T]) @@ -2071,6 +2127,7 @@ Microsoft.FSharp.Core.ValueOption: Boolean IsNone[T](Microsoft.FSharp.Core.FShar Microsoft.FSharp.Core.ValueOption: Boolean IsSome[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Int32 Count[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpOption`1[T] ToOption[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Bind[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpValueOption`1[TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map2[T1,T2,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map3[T1,T2,T3,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2], Microsoft.FSharp.Core.FSharpValueOption`1[T3]) @@ -2079,6 +2136,7 @@ Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Flatten[T](Microsoft.FSharp.Core.FSharpValueOption`1[Microsoft.FSharp.Core.FSharpValueOption`1[T]]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfNullable[T](System.Nullable`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfObj[T](T) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfOption[T](Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElseWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpValueOption`1[T]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElse[T](Microsoft.FSharp.Core.FSharpValueOption`1[T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: System.Nullable`1[T] ToNullable[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) @@ -2091,6 +2149,9 @@ Microsoft.FSharp.Core.ValueOption: TState Fold[T,TState](Microsoft.FSharp.Core.F Microsoft.FSharp.Core.ValueOption: T[] ToArray[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.VolatileFieldAttribute: Void .ctor() +Microsoft.FSharp.Core.WarnOnWithoutNullArgumentAttribute: System.String WarningMessage +Microsoft.FSharp.Core.WarnOnWithoutNullArgumentAttribute: System.String get_WarningMessage() +Microsoft.FSharp.Core.WarnOnWithoutNullArgumentAttribute: Void .ctor(System.String) Microsoft.FSharp.Linq.NullableModule: System.Nullable`1[System.Byte] ToByte$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Byte], System.Nullable`1[T]) Microsoft.FSharp.Linq.NullableModule: System.Nullable`1[System.Byte] ToByte[T](System.Nullable`1[T]) Microsoft.FSharp.Linq.NullableModule: System.Nullable`1[System.Byte] ToUInt8$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Byte], System.Nullable`1[T]) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard20.release.bsl index e1864618be6..cac2ceae8ed 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard20.release.bsl @@ -1786,7 +1786,10 @@ Microsoft.FSharp.Core.Operators+Unchecked: Boolean Equals[T](T, T) Microsoft.FSharp.Core.Operators+Unchecked: Int32 Compare[T](T, T) Microsoft.FSharp.Core.Operators+Unchecked: Int32 Hash[T](T) Microsoft.FSharp.Core.Operators+Unchecked: T DefaultOf[T]() +Microsoft.FSharp.Core.Operators+Unchecked: T NonNullQuickPattern[T](T) +Microsoft.FSharp.Core.Operators+Unchecked: T NonNull[T](T) Microsoft.FSharp.Core.Operators+Unchecked: T Unbox[T](System.Object) +Microsoft.FSharp.Core.Operators: Boolean IsNullV[T](System.Nullable`1[T]) Microsoft.FSharp.Core.Operators: Boolean IsNull[T](T) Microsoft.FSharp.Core.Operators: Boolean Not(Boolean) Microsoft.FSharp.Core.Operators: Boolean op_Equality[T](T, T) @@ -1822,6 +1825,8 @@ Microsoft.FSharp.Core.Operators: Int64 ToInt64[T](T) Microsoft.FSharp.Core.Operators: IntPtr ToIntPtr$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.IntPtr], T) Microsoft.FSharp.Core.Operators: IntPtr ToIntPtr[T](T) Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Collections.FSharpList`1[T] op_Append[T](Microsoft.FSharp.Collections.FSharpList`1[T], Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpChoice`2[Microsoft.FSharp.Core.Unit,T] NullMatchPattern[T](T) +Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpChoice`2[Microsoft.FSharp.Core.Unit,T] NullValueMatchPattern[T](System.Nullable`1[T]) Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpFunc`2[T1,T3] op_ComposeLeft[T2,T3,T1](Microsoft.FSharp.Core.FSharpFunc`2[T2,T3], Microsoft.FSharp.Core.FSharpFunc`2[T1,T2]) Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpFunc`2[T1,T3] op_ComposeRight[T1,T2,T3](Microsoft.FSharp.Core.FSharpFunc`2[T1,T2], Microsoft.FSharp.Core.FSharpFunc`2[T2,T3]) Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpOption`1[System.String] FailurePattern(System.Exception) @@ -1851,6 +1856,8 @@ Microsoft.FSharp.Core.Operators: System.Exception Failure(System.String) Microsoft.FSharp.Core.Operators: System.IO.TextReader ConsoleIn[T]() Microsoft.FSharp.Core.Operators: System.IO.TextWriter ConsoleError[T]() Microsoft.FSharp.Core.Operators: System.IO.TextWriter ConsoleOut[T]() +Microsoft.FSharp.Core.Operators: System.Nullable`1[T] NullV[T]() +Microsoft.FSharp.Core.Operators: System.Nullable`1[T] WithNullV[T](T) Microsoft.FSharp.Core.Operators: System.Object Box[T](T) Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString[T](T) @@ -1873,6 +1880,8 @@ Microsoft.FSharp.Core.Operators: T Cos[T](T) Microsoft.FSharp.Core.Operators: T Cosh$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,T], T) Microsoft.FSharp.Core.Operators: T Cosh[T](T) Microsoft.FSharp.Core.Operators: T DefaultArg[T](Microsoft.FSharp.Core.FSharpOption`1[T], T) +Microsoft.FSharp.Core.Operators: T DefaultIfNullV[T](T, System.Nullable`1[T]) +Microsoft.FSharp.Core.Operators: T DefaultIfNull[T](T, T) Microsoft.FSharp.Core.Operators: T DefaultValueArg[T](Microsoft.FSharp.Core.FSharpValueOption`1[T], T) Microsoft.FSharp.Core.Operators: T Exit[T](Int32) Microsoft.FSharp.Core.Operators: T Exp$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,T], T) @@ -1890,6 +1899,11 @@ Microsoft.FSharp.Core.Operators: T Log10[T](T) Microsoft.FSharp.Core.Operators: T Log[T](T) Microsoft.FSharp.Core.Operators: T Max[T](T, T) Microsoft.FSharp.Core.Operators: T Min[T](T, T) +Microsoft.FSharp.Core.Operators: T NonNullQuickPattern[T](T) +Microsoft.FSharp.Core.Operators: T NonNullQuickValuePattern[T](System.Nullable`1[T]) +Microsoft.FSharp.Core.Operators: T NonNullV[T](System.Nullable`1[T]) +Microsoft.FSharp.Core.Operators: T NonNull[T](T) +Microsoft.FSharp.Core.Operators: T NullArgCheck[T](System.String, T) Microsoft.FSharp.Core.Operators: T NullArg[T](System.String) Microsoft.FSharp.Core.Operators: T PowInteger$W[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], T, Int32) Microsoft.FSharp.Core.Operators: T PowInteger[T](T, Int32) @@ -1909,6 +1923,7 @@ Microsoft.FSharp.Core.Operators: T Tanh[T](T) Microsoft.FSharp.Core.Operators: T Truncate$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,T], T) Microsoft.FSharp.Core.Operators: T Truncate[T](T) Microsoft.FSharp.Core.Operators: T Unbox[T](System.Object) +Microsoft.FSharp.Core.Operators: T WithNull[T](T) Microsoft.FSharp.Core.Operators: T op_BitwiseAnd$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], T, T) Microsoft.FSharp.Core.Operators: T op_BitwiseAnd[T](T, T) Microsoft.FSharp.Core.Operators: T op_BitwiseOr$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], T, T) @@ -2001,8 +2016,10 @@ Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] Filt Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] Flatten[T](Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpOption`1[T]]) Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OfNullable[T](System.Nullable`1[T]) Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OfObj[T](T) +Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OfValueOption[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OrElseWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpOption`1[T]], Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OrElse[T](Microsoft.FSharp.Core.FSharpOption`1[T], Microsoft.FSharp.Core.FSharpOption`1[T]) +Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpValueOption`1[T] ToValueOption[T](Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: System.Nullable`1[T] ToNullable[T](Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: T DefaultValue[T](T, Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: T DefaultWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpOption`1[T]) @@ -2109,6 +2126,7 @@ Microsoft.FSharp.Core.ValueOption: Boolean IsNone[T](Microsoft.FSharp.Core.FShar Microsoft.FSharp.Core.ValueOption: Boolean IsSome[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Int32 Count[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpOption`1[T] ToOption[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Bind[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpValueOption`1[TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map2[T1,T2,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map3[T1,T2,T3,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2], Microsoft.FSharp.Core.FSharpValueOption`1[T3]) @@ -2117,6 +2135,7 @@ Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Flatten[T](Microsoft.FSharp.Core.FSharpValueOption`1[Microsoft.FSharp.Core.FSharpValueOption`1[T]]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfNullable[T](System.Nullable`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfObj[T](T) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfOption[T](Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElseWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpValueOption`1[T]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElse[T](Microsoft.FSharp.Core.FSharpValueOption`1[T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: System.Nullable`1[T] ToNullable[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) @@ -2129,6 +2148,9 @@ Microsoft.FSharp.Core.ValueOption: TState Fold[T,TState](Microsoft.FSharp.Core.F Microsoft.FSharp.Core.ValueOption: T[] ToArray[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.VolatileFieldAttribute: Void .ctor() +Microsoft.FSharp.Core.WarnOnWithoutNullArgumentAttribute: System.String WarningMessage +Microsoft.FSharp.Core.WarnOnWithoutNullArgumentAttribute: System.String get_WarningMessage() +Microsoft.FSharp.Core.WarnOnWithoutNullArgumentAttribute: Void .ctor(System.String) Microsoft.FSharp.Linq.NullableModule: System.Nullable`1[System.Byte] ToByte$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Byte], System.Nullable`1[T]) Microsoft.FSharp.Linq.NullableModule: System.Nullable`1[System.Byte] ToByte[T](System.Nullable`1[T]) Microsoft.FSharp.Linq.NullableModule: System.Nullable`1[System.Byte] ToUInt8$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Byte], System.Nullable`1[T]) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard21.debug.bsl b/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard21.debug.bsl index 5fa4760b53e..a49aac19aaa 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard21.debug.bsl +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard21.debug.bsl @@ -126,6 +126,9 @@ Microsoft.FSharp.Collections.ArrayModule: T MaxBy[T,TResult](Microsoft.FSharp.Co Microsoft.FSharp.Collections.ArrayModule: T Max[T](T[]) Microsoft.FSharp.Collections.ArrayModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], T[]) Microsoft.FSharp.Collections.ArrayModule: T Min[T](T[]) +Microsoft.FSharp.Collections.ArrayModule: T RandomChoiceBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], T[]) +Microsoft.FSharp.Collections.ArrayModule: T RandomChoiceWith[T](System.Random, T[]) +Microsoft.FSharp.Collections.ArrayModule: T RandomChoice[T](T[]) Microsoft.FSharp.Collections.ArrayModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], T[]) Microsoft.FSharp.Collections.ArrayModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], T[]) Microsoft.FSharp.Collections.ArrayModule: T Sum$W[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], T[]) @@ -164,6 +167,15 @@ Microsoft.FSharp.Collections.ArrayModule: T[] InsertManyAt[T](Int32, System.Coll Microsoft.FSharp.Collections.ArrayModule: T[] OfList[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ArrayModule: T[] OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.ArrayModule: T[] Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], T[]) +Microsoft.FSharp.Collections.ArrayModule: T[] RandomChoicesBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], Int32, T[]) +Microsoft.FSharp.Collections.ArrayModule: T[] RandomChoicesWith[T](System.Random, Int32, T[]) +Microsoft.FSharp.Collections.ArrayModule: T[] RandomChoices[T](Int32, T[]) +Microsoft.FSharp.Collections.ArrayModule: T[] RandomSampleBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], Int32, T[]) +Microsoft.FSharp.Collections.ArrayModule: T[] RandomSampleWith[T](System.Random, Int32, T[]) +Microsoft.FSharp.Collections.ArrayModule: T[] RandomSample[T](Int32, T[]) +Microsoft.FSharp.Collections.ArrayModule: T[] RandomShuffleBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], T[]) +Microsoft.FSharp.Collections.ArrayModule: T[] RandomShuffleWith[T](System.Random, T[]) +Microsoft.FSharp.Collections.ArrayModule: T[] RandomShuffle[T](T[]) Microsoft.FSharp.Collections.ArrayModule: T[] RemoveAt[T](Int32, T[]) Microsoft.FSharp.Collections.ArrayModule: T[] RemoveManyAt[T](Int32, Int32, T[]) Microsoft.FSharp.Collections.ArrayModule: T[] Replicate[T](Int32, T) @@ -194,6 +206,9 @@ Microsoft.FSharp.Collections.ArrayModule: Void Iterate2[T1,T2](Microsoft.FSharp. Microsoft.FSharp.Collections.ArrayModule: Void IterateIndexed2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.Unit]]], T1[], T2[]) Microsoft.FSharp.Collections.ArrayModule: Void IterateIndexed[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], T[]) Microsoft.FSharp.Collections.ArrayModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], T[]) +Microsoft.FSharp.Collections.ArrayModule: Void RandomShuffleInPlaceBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], T[]) +Microsoft.FSharp.Collections.ArrayModule: Void RandomShuffleInPlaceWith[T](System.Random, T[]) +Microsoft.FSharp.Collections.ArrayModule: Void RandomShuffleInPlace[T](T[]) Microsoft.FSharp.Collections.ArrayModule: Void Set[T](T[], Int32, T) Microsoft.FSharp.Collections.ArrayModule: Void SortInPlaceBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], T[]) Microsoft.FSharp.Collections.ArrayModule: Void SortInPlaceWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], T[]) @@ -202,6 +217,7 @@ Microsoft.FSharp.Collections.ComparisonIdentity: System.Collections.Generic.ICom Microsoft.FSharp.Collections.ComparisonIdentity: System.Collections.Generic.IComparer`1[T] NonStructural$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean]], Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean]]) Microsoft.FSharp.Collections.ComparisonIdentity: System.Collections.Generic.IComparer`1[T] NonStructural[T]() Microsoft.FSharp.Collections.ComparisonIdentity: System.Collections.Generic.IComparer`1[T] Structural[T]() +Microsoft.FSharp.Collections.FSharpList: Microsoft.FSharp.Collections.FSharpList`1[T] Create[T](System.ReadOnlySpan`1[T]) Microsoft.FSharp.Collections.FSharpList`1+Tags[T]: Int32 Cons Microsoft.FSharp.Collections.FSharpList`1+Tags[T]: Int32 Empty Microsoft.FSharp.Collections.FSharpList`1[T]: Boolean Equals(Microsoft.FSharp.Collections.FSharpList`1[T]) @@ -259,6 +275,7 @@ Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: System.String ToString() Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: TValue Item [TKey] Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: TValue get_Item(TKey) Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Void .ctor(System.Collections.Generic.IEnumerable`1[System.Tuple`2[TKey,TValue]]) +Microsoft.FSharp.Collections.FSharpSet: Microsoft.FSharp.Collections.FSharpSet`1[T] Create[T](System.ReadOnlySpan`1[T]) Microsoft.FSharp.Collections.FSharpSet`1[T]: Boolean Contains(T) Microsoft.FSharp.Collections.FSharpSet`1[T]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.FSharpSet`1[T]: Boolean IsEmpty @@ -329,6 +346,15 @@ Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] OfArray[T](T[]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RandomChoicesBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], Int32, Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RandomChoicesWith[T](System.Random, Int32, Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RandomChoices[T](Int32, Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RandomSampleBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], Int32, Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RandomSampleWith[T](System.Random, Int32, Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RandomSample[T](Int32, Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RandomShuffleBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RandomShuffleWith[T](System.Random, Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RandomShuffle[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RemoveAt[T](Int32, Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] RemoveManyAt[T](Int32, Int32, Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList`1[T] Replicate[T](Int32, T) @@ -377,6 +403,9 @@ Microsoft.FSharp.Collections.ListModule: T MaxBy[T,TResult](Microsoft.FSharp.Cor Microsoft.FSharp.Collections.ListModule: T Max[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T Min[T](Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: T RandomChoiceBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: T RandomChoiceWith[T](System.Random, Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: T RandomChoice[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T Sum$W[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.FSharpList`1[T]) @@ -483,6 +512,15 @@ Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1 Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] OfArray[T](T[]) Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] OfList[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RandomChoicesBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], Int32, System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RandomChoicesWith[T](System.Random, Int32, System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RandomChoices[T](Int32, System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RandomSampleBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], Int32, System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RandomSampleWith[T](System.Random, Int32, System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RandomSample[T](Int32, System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RandomShuffleBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RandomShuffleWith[T](System.Random, System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RandomShuffle[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] ReadOnly[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RemoveAt[T](Int32, System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: System.Collections.Generic.IEnumerable`1[T] RemoveManyAt[T](Int32, Int32, System.Collections.Generic.IEnumerable`1[T]) @@ -518,6 +556,9 @@ Microsoft.FSharp.Collections.SeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core Microsoft.FSharp.Collections.SeqModule: T Max[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T Min[T](System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: T RandomChoiceBy[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.Double], System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: T RandomChoiceWith[T](System.Random, System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: T RandomChoice[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T Sum$W[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], System.Collections.Generic.IEnumerable`1[T]) @@ -1748,7 +1789,10 @@ Microsoft.FSharp.Core.Operators+Unchecked: Boolean Equals[T](T, T) Microsoft.FSharp.Core.Operators+Unchecked: Int32 Compare[T](T, T) Microsoft.FSharp.Core.Operators+Unchecked: Int32 Hash[T](T) Microsoft.FSharp.Core.Operators+Unchecked: T DefaultOf[T]() +Microsoft.FSharp.Core.Operators+Unchecked: T NonNullQuickPattern[T](T) +Microsoft.FSharp.Core.Operators+Unchecked: T NonNull[T](T) Microsoft.FSharp.Core.Operators+Unchecked: T Unbox[T](System.Object) +Microsoft.FSharp.Core.Operators: Boolean IsNullV[T](System.Nullable`1[T]) Microsoft.FSharp.Core.Operators: Boolean IsNull[T](T) Microsoft.FSharp.Core.Operators: Boolean Not(Boolean) Microsoft.FSharp.Core.Operators: Boolean op_Equality[T](T, T) @@ -1784,6 +1828,8 @@ Microsoft.FSharp.Core.Operators: Int64 ToInt64[T](T) Microsoft.FSharp.Core.Operators: IntPtr ToIntPtr$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.IntPtr], T) Microsoft.FSharp.Core.Operators: IntPtr ToIntPtr[T](T) Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Collections.FSharpList`1[T] op_Append[T](Microsoft.FSharp.Collections.FSharpList`1[T], Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpChoice`2[Microsoft.FSharp.Core.Unit,T] NullMatchPattern[T](T) +Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpChoice`2[Microsoft.FSharp.Core.Unit,T] NullValueMatchPattern[T](System.Nullable`1[T]) Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpFunc`2[T1,T3] op_ComposeLeft[T2,T3,T1](Microsoft.FSharp.Core.FSharpFunc`2[T2,T3], Microsoft.FSharp.Core.FSharpFunc`2[T1,T2]) Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpFunc`2[T1,T3] op_ComposeRight[T1,T2,T3](Microsoft.FSharp.Core.FSharpFunc`2[T1,T2], Microsoft.FSharp.Core.FSharpFunc`2[T2,T3]) Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpOption`1[System.String] FailurePattern(System.Exception) @@ -1813,6 +1859,8 @@ Microsoft.FSharp.Core.Operators: System.Exception Failure(System.String) Microsoft.FSharp.Core.Operators: System.IO.TextReader ConsoleIn[T]() Microsoft.FSharp.Core.Operators: System.IO.TextWriter ConsoleError[T]() Microsoft.FSharp.Core.Operators: System.IO.TextWriter ConsoleOut[T]() +Microsoft.FSharp.Core.Operators: System.Nullable`1[T] NullV[T]() +Microsoft.FSharp.Core.Operators: System.Nullable`1[T] WithNullV[T](T) Microsoft.FSharp.Core.Operators: System.Object Box[T](T) Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]) Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) @@ -1836,6 +1884,8 @@ Microsoft.FSharp.Core.Operators: T Cos[T](T) Microsoft.FSharp.Core.Operators: T Cosh$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,T], T) Microsoft.FSharp.Core.Operators: T Cosh[T](T) Microsoft.FSharp.Core.Operators: T DefaultArg[T](Microsoft.FSharp.Core.FSharpOption`1[T], T) +Microsoft.FSharp.Core.Operators: T DefaultIfNullV[T](T, System.Nullable`1[T]) +Microsoft.FSharp.Core.Operators: T DefaultIfNull[T](T, T) Microsoft.FSharp.Core.Operators: T DefaultValueArg[T](Microsoft.FSharp.Core.FSharpValueOption`1[T], T) Microsoft.FSharp.Core.Operators: T Exit[T](Int32) Microsoft.FSharp.Core.Operators: T Exp$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,T], T) @@ -1853,6 +1903,11 @@ Microsoft.FSharp.Core.Operators: T Log10[T](T) Microsoft.FSharp.Core.Operators: T Log[T](T) Microsoft.FSharp.Core.Operators: T Max[T](T, T) Microsoft.FSharp.Core.Operators: T Min[T](T, T) +Microsoft.FSharp.Core.Operators: T NonNullQuickPattern[T](T) +Microsoft.FSharp.Core.Operators: T NonNullQuickValuePattern[T](System.Nullable`1[T]) +Microsoft.FSharp.Core.Operators: T NonNullV[T](System.Nullable`1[T]) +Microsoft.FSharp.Core.Operators: T NonNull[T](T) +Microsoft.FSharp.Core.Operators: T NullArgCheck[T](System.String, T) Microsoft.FSharp.Core.Operators: T NullArg[T](System.String) Microsoft.FSharp.Core.Operators: T PowInteger$W[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], T, Int32) Microsoft.FSharp.Core.Operators: T PowInteger[T](T, Int32) @@ -1872,6 +1927,7 @@ Microsoft.FSharp.Core.Operators: T Tanh[T](T) Microsoft.FSharp.Core.Operators: T Truncate$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,T], T) Microsoft.FSharp.Core.Operators: T Truncate[T](T) Microsoft.FSharp.Core.Operators: T Unbox[T](System.Object) +Microsoft.FSharp.Core.Operators: T WithNull[T](T) Microsoft.FSharp.Core.Operators: T op_BitwiseAnd$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], T, T) Microsoft.FSharp.Core.Operators: T op_BitwiseAnd[T](T, T) Microsoft.FSharp.Core.Operators: T op_BitwiseOr$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], T, T) @@ -1964,8 +2020,10 @@ Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] Filt Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] Flatten[T](Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpOption`1[T]]) Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OfNullable[T](System.Nullable`1[T]) Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OfObj[T](T) +Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OfValueOption[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OrElseWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpOption`1[T]], Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OrElse[T](Microsoft.FSharp.Core.FSharpOption`1[T], Microsoft.FSharp.Core.FSharpOption`1[T]) +Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpValueOption`1[T] ToValueOption[T](Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: System.Nullable`1[T] ToNullable[T](Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: T DefaultValue[T](T, Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: T DefaultWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpOption`1[T]) @@ -2072,6 +2130,7 @@ Microsoft.FSharp.Core.ValueOption: Boolean IsNone[T](Microsoft.FSharp.Core.FShar Microsoft.FSharp.Core.ValueOption: Boolean IsSome[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Int32 Count[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpOption`1[T] ToOption[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Bind[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpValueOption`1[TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map2[T1,T2,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map3[T1,T2,T3,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2], Microsoft.FSharp.Core.FSharpValueOption`1[T3]) @@ -2080,6 +2139,7 @@ Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Flatten[T](Microsoft.FSharp.Core.FSharpValueOption`1[Microsoft.FSharp.Core.FSharpValueOption`1[T]]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfNullable[T](System.Nullable`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfObj[T](T) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfOption[T](Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElseWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpValueOption`1[T]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElse[T](Microsoft.FSharp.Core.FSharpValueOption`1[T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: System.Nullable`1[T] ToNullable[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) @@ -2092,6 +2152,9 @@ Microsoft.FSharp.Core.ValueOption: TState Fold[T,TState](Microsoft.FSharp.Core.F Microsoft.FSharp.Core.ValueOption: T[] ToArray[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.VolatileFieldAttribute: Void .ctor() +Microsoft.FSharp.Core.WarnOnWithoutNullArgumentAttribute: System.String WarningMessage +Microsoft.FSharp.Core.WarnOnWithoutNullArgumentAttribute: System.String get_WarningMessage() +Microsoft.FSharp.Core.WarnOnWithoutNullArgumentAttribute: Void .ctor(System.String) Microsoft.FSharp.Linq.NullableModule: System.Nullable`1[System.Byte] ToByte$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Byte], System.Nullable`1[T]) Microsoft.FSharp.Linq.NullableModule: System.Nullable`1[System.Byte] ToByte[T](System.Nullable`1[T]) Microsoft.FSharp.Linq.NullableModule: System.Nullable`1[System.Byte] ToUInt8$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Byte], System.Nullable`1[T]) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard21.release.bsl b/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard21.release.bsl index 92d85ccd98d..b17d1201a5a 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard21.release.bsl +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard21.release.bsl @@ -217,6 +217,7 @@ Microsoft.FSharp.Collections.ComparisonIdentity: System.Collections.Generic.ICom Microsoft.FSharp.Collections.ComparisonIdentity: System.Collections.Generic.IComparer`1[T] NonStructural$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean]], Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean]]) Microsoft.FSharp.Collections.ComparisonIdentity: System.Collections.Generic.IComparer`1[T] NonStructural[T]() Microsoft.FSharp.Collections.ComparisonIdentity: System.Collections.Generic.IComparer`1[T] Structural[T]() +Microsoft.FSharp.Collections.FSharpList: Microsoft.FSharp.Collections.FSharpList`1[T] Create[T](System.ReadOnlySpan`1[T]) Microsoft.FSharp.Collections.FSharpList`1+Tags[T]: Int32 Cons Microsoft.FSharp.Collections.FSharpList`1+Tags[T]: Int32 Empty Microsoft.FSharp.Collections.FSharpList`1[T]: Boolean Equals(Microsoft.FSharp.Collections.FSharpList`1[T]) @@ -274,6 +275,7 @@ Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: System.String ToString() Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: TValue Item [TKey] Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: TValue get_Item(TKey) Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Void .ctor(System.Collections.Generic.IEnumerable`1[System.Tuple`2[TKey,TValue]]) +Microsoft.FSharp.Collections.FSharpSet: Microsoft.FSharp.Collections.FSharpSet`1[T] Create[T](System.ReadOnlySpan`1[T]) Microsoft.FSharp.Collections.FSharpSet`1[T]: Boolean Contains(T) Microsoft.FSharp.Collections.FSharpSet`1[T]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.FSharpSet`1[T]: Boolean IsEmpty @@ -1787,7 +1789,10 @@ Microsoft.FSharp.Core.Operators+Unchecked: Boolean Equals[T](T, T) Microsoft.FSharp.Core.Operators+Unchecked: Int32 Compare[T](T, T) Microsoft.FSharp.Core.Operators+Unchecked: Int32 Hash[T](T) Microsoft.FSharp.Core.Operators+Unchecked: T DefaultOf[T]() +Microsoft.FSharp.Core.Operators+Unchecked: T NonNullQuickPattern[T](T) +Microsoft.FSharp.Core.Operators+Unchecked: T NonNull[T](T) Microsoft.FSharp.Core.Operators+Unchecked: T Unbox[T](System.Object) +Microsoft.FSharp.Core.Operators: Boolean IsNullV[T](System.Nullable`1[T]) Microsoft.FSharp.Core.Operators: Boolean IsNull[T](T) Microsoft.FSharp.Core.Operators: Boolean Not(Boolean) Microsoft.FSharp.Core.Operators: Boolean op_Equality[T](T, T) @@ -1823,6 +1828,8 @@ Microsoft.FSharp.Core.Operators: Int64 ToInt64[T](T) Microsoft.FSharp.Core.Operators: IntPtr ToIntPtr$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.IntPtr], T) Microsoft.FSharp.Core.Operators: IntPtr ToIntPtr[T](T) Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Collections.FSharpList`1[T] op_Append[T](Microsoft.FSharp.Collections.FSharpList`1[T], Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpChoice`2[Microsoft.FSharp.Core.Unit,T] NullMatchPattern[T](T) +Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpChoice`2[Microsoft.FSharp.Core.Unit,T] NullValueMatchPattern[T](System.Nullable`1[T]) Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpFunc`2[T1,T3] op_ComposeLeft[T2,T3,T1](Microsoft.FSharp.Core.FSharpFunc`2[T2,T3], Microsoft.FSharp.Core.FSharpFunc`2[T1,T2]) Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpFunc`2[T1,T3] op_ComposeRight[T1,T2,T3](Microsoft.FSharp.Core.FSharpFunc`2[T1,T2], Microsoft.FSharp.Core.FSharpFunc`2[T2,T3]) Microsoft.FSharp.Core.Operators: Microsoft.FSharp.Core.FSharpOption`1[System.String] FailurePattern(System.Exception) @@ -1852,6 +1859,8 @@ Microsoft.FSharp.Core.Operators: System.Exception Failure(System.String) Microsoft.FSharp.Core.Operators: System.IO.TextReader ConsoleIn[T]() Microsoft.FSharp.Core.Operators: System.IO.TextWriter ConsoleError[T]() Microsoft.FSharp.Core.Operators: System.IO.TextWriter ConsoleOut[T]() +Microsoft.FSharp.Core.Operators: System.Nullable`1[T] NullV[T]() +Microsoft.FSharp.Core.Operators: System.Nullable`1[T] WithNullV[T](T) Microsoft.FSharp.Core.Operators: System.Object Box[T](T) Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString[T](T) @@ -1874,6 +1883,8 @@ Microsoft.FSharp.Core.Operators: T Cos[T](T) Microsoft.FSharp.Core.Operators: T Cosh$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,T], T) Microsoft.FSharp.Core.Operators: T Cosh[T](T) Microsoft.FSharp.Core.Operators: T DefaultArg[T](Microsoft.FSharp.Core.FSharpOption`1[T], T) +Microsoft.FSharp.Core.Operators: T DefaultIfNullV[T](T, System.Nullable`1[T]) +Microsoft.FSharp.Core.Operators: T DefaultIfNull[T](T, T) Microsoft.FSharp.Core.Operators: T DefaultValueArg[T](Microsoft.FSharp.Core.FSharpValueOption`1[T], T) Microsoft.FSharp.Core.Operators: T Exit[T](Int32) Microsoft.FSharp.Core.Operators: T Exp$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,T], T) @@ -1891,6 +1902,11 @@ Microsoft.FSharp.Core.Operators: T Log10[T](T) Microsoft.FSharp.Core.Operators: T Log[T](T) Microsoft.FSharp.Core.Operators: T Max[T](T, T) Microsoft.FSharp.Core.Operators: T Min[T](T, T) +Microsoft.FSharp.Core.Operators: T NonNullQuickPattern[T](T) +Microsoft.FSharp.Core.Operators: T NonNullQuickValuePattern[T](System.Nullable`1[T]) +Microsoft.FSharp.Core.Operators: T NonNullV[T](System.Nullable`1[T]) +Microsoft.FSharp.Core.Operators: T NonNull[T](T) +Microsoft.FSharp.Core.Operators: T NullArgCheck[T](System.String, T) Microsoft.FSharp.Core.Operators: T NullArg[T](System.String) Microsoft.FSharp.Core.Operators: T PowInteger$W[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], T, Int32) Microsoft.FSharp.Core.Operators: T PowInteger[T](T, Int32) @@ -1910,6 +1926,7 @@ Microsoft.FSharp.Core.Operators: T Tanh[T](T) Microsoft.FSharp.Core.Operators: T Truncate$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,T], T) Microsoft.FSharp.Core.Operators: T Truncate[T](T) Microsoft.FSharp.Core.Operators: T Unbox[T](System.Object) +Microsoft.FSharp.Core.Operators: T WithNull[T](T) Microsoft.FSharp.Core.Operators: T op_BitwiseAnd$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], T, T) Microsoft.FSharp.Core.Operators: T op_BitwiseAnd[T](T, T) Microsoft.FSharp.Core.Operators: T op_BitwiseOr$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], T, T) @@ -2002,8 +2019,10 @@ Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] Filt Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] Flatten[T](Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpOption`1[T]]) Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OfNullable[T](System.Nullable`1[T]) Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OfObj[T](T) +Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OfValueOption[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OrElseWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpOption`1[T]], Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpOption`1[T] OrElse[T](Microsoft.FSharp.Core.FSharpOption`1[T], Microsoft.FSharp.Core.FSharpOption`1[T]) +Microsoft.FSharp.Core.OptionModule: Microsoft.FSharp.Core.FSharpValueOption`1[T] ToValueOption[T](Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: System.Nullable`1[T] ToNullable[T](Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: T DefaultValue[T](T, Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: T DefaultWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpOption`1[T]) @@ -2110,6 +2129,7 @@ Microsoft.FSharp.Core.ValueOption: Boolean IsNone[T](Microsoft.FSharp.Core.FShar Microsoft.FSharp.Core.ValueOption: Boolean IsSome[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Int32 Count[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpOption`1[T] ToOption[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Bind[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpValueOption`1[TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map2[T1,T2,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map3[T1,T2,T3,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2], Microsoft.FSharp.Core.FSharpValueOption`1[T3]) @@ -2118,6 +2138,7 @@ Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Flatten[T](Microsoft.FSharp.Core.FSharpValueOption`1[Microsoft.FSharp.Core.FSharpValueOption`1[T]]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfNullable[T](System.Nullable`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfObj[T](T) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfOption[T](Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElseWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpValueOption`1[T]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElse[T](Microsoft.FSharp.Core.FSharpValueOption`1[T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: System.Nullable`1[T] ToNullable[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) @@ -2130,6 +2151,9 @@ Microsoft.FSharp.Core.ValueOption: TState Fold[T,TState](Microsoft.FSharp.Core.F Microsoft.FSharp.Core.ValueOption: T[] ToArray[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.ValueOption: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.VolatileFieldAttribute: Void .ctor() +Microsoft.FSharp.Core.WarnOnWithoutNullArgumentAttribute: System.String WarningMessage +Microsoft.FSharp.Core.WarnOnWithoutNullArgumentAttribute: System.String get_WarningMessage() +Microsoft.FSharp.Core.WarnOnWithoutNullArgumentAttribute: Void .ctor(System.String) Microsoft.FSharp.Linq.NullableModule: System.Nullable`1[System.Byte] ToByte$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Byte], System.Nullable`1[T]) Microsoft.FSharp.Linq.NullableModule: System.Nullable`1[System.Byte] ToByte[T](System.Nullable`1[T]) Microsoft.FSharp.Linq.NullableModule: System.Nullable`1[System.Byte] ToUInt8$W[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Byte], System.Nullable`1[T]) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj index 9acbcef398e..93143ca4103 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj @@ -90,6 +90,7 @@ + diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array3Module.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array3Module.fs index cf4fa31a3b3..e8b0894ebae 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array3Module.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array3Module.fs @@ -132,7 +132,7 @@ type Array3Module() = // null array let nullArr : string[,,] = null - CheckThrowsArgumentNullException(fun () -> Array3D.iter (fun x -> Assert.Fail("Souldn't be called")) nullArr) + CheckThrowsArgumentNullException(fun () -> Array3D.iter (fun x -> Assert.Fail("Shouldn't be called")) nullArr) () [] diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule.fs index 13590a61f5c..c2b0d240372 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule.fs @@ -385,8 +385,8 @@ type ArrayModule() = // int array let intSrc:int [] = [| 1..100 |] let funcInt x = if (x%5=0) then Some x else None - let intChoosed : int[] = chooseInt funcInt intSrc - if intChoosed.[1] <> 10 then Assert.Fail() + let intChosen : int[] = chooseInt funcInt intSrc + if intChosen.[1] <> 10 then Assert.Fail() // string array let stringSrc: string [] = "Lists are a commonly used data structure. They are not mutable, i.e., you can't delete an element of a list – instead you create a new list with the element deleted. List values often share storage under the hood, i.e., a list value only allocate more memory when you actually execute construction operations.".Split([|' '|], System.StringSplitOptions.RemoveEmptyEntries) @@ -394,13 +394,13 @@ type ArrayModule() = | "list"-> Some x | "List" -> Some x | _ -> None - let strChoosed : string[] = chooseString funcString stringSrc - if strChoosed.[1].ToLower() <> "list" then Assert.Fail() + let strChosen : string[] = chooseString funcString stringSrc + if strChosen.[1].ToLower() <> "list" then Assert.Fail() // empty array let emptySrc :int[] = [| |] - let emptyChoosed = chooseInt funcInt emptySrc - Assert.True( (emptyChoosed = [| |]) ) + let emptyChosen = chooseInt funcInt emptySrc + Assert.True( (emptyChosen = [| |]) ) // null array let nullArr = null:int[] @@ -534,19 +534,19 @@ type ArrayModule() = member this.Copy() = // int array let intSrc:int [] = [| 3;5;7 |] - let intCopyed = Array.copy intSrc - if intCopyed <> [| 3;5;7 |] then Assert.Fail() + let intCopied = Array.copy intSrc + if intCopied <> [| 3;5;7 |] then Assert.Fail() // string array let stringSrc: string [] = [|"Lists"; "are"; "commonly" |] - let strCopyed = Array.copy stringSrc - if strCopyed <> [|"Lists"; "are"; "commonly" |] then Assert.Fail() + let strCopied = Array.copy stringSrc + if strCopied <> [|"Lists"; "are"; "commonly" |] then Assert.Fail() // empty array let emptySrc :int[] = [| |] - let emptyCopyed = Array.copy emptySrc - if emptyCopyed <> [| |] then Assert.Fail() + let emptyCopied = Array.copy emptySrc + if emptyCopied <> [| |] then Assert.Fail() // null array let nullArr = null:int[] diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/CollectionModulesConsistency.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/CollectionModulesConsistency.fs index 7b0ac00e5db..a0e82ab46e9 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/CollectionModulesConsistency.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/CollectionModulesConsistency.fs @@ -492,7 +492,7 @@ let iter<'a when 'a : equality> (xs : 'a []) f' = list |> Seq.toList = (xs @ xs @ xs) [] -let ``iter looks at every element exactly once and in order - consistenly over all collections`` () = +let ``iter looks at every element exactly once and in order - consistently over all collections`` () = smallerSizeCheck iter smallerSizeCheck iter smallerSizeCheck iter @@ -513,7 +513,7 @@ let iter2<'a when 'a : equality> (xs' : ('a*'a) []) f' = list |> Seq.toList = (xs @ xs @ xs) [] -let ``iter2 looks at every element exactly once and in order - consistenly over all collections when size is equal`` () = +let ``iter2 looks at every element exactly once and in order - consistently over all collections when size is equal`` () = smallerSizeCheck iter2 smallerSizeCheck iter2 smallerSizeCheck iter2 @@ -535,7 +535,7 @@ let iteri<'a when 'a : equality> (xs : 'a []) f' = indices |> Seq.toList = ([0..xs.Length-1] @ [0..xs.Length-1] @ [0..xs.Length-1]) [] -let ``iteri looks at every element exactly once and in order - consistenly over all collections`` () = +let ``iteri looks at every element exactly once and in order - consistently over all collections`` () = smallerSizeCheck iteri smallerSizeCheck iteri smallerSizeCheck iteri @@ -559,7 +559,7 @@ let iteri2<'a when 'a : equality> (xs' : ('a*'a) []) f' = indices |> Seq.toList = ([0..xs.Length-1] @ [0..xs.Length-1] @ [0..xs.Length-1]) [] -let ``iteri2 looks at every element exactly once and in order - consistenly over all collections when size is equal`` () = +let ``iteri2 looks at every element exactly once and in order - consistently over all collections when size is equal`` () = smallerSizeCheck iteri2 smallerSizeCheck iteri2 smallerSizeCheck iteri2 @@ -617,7 +617,7 @@ let map2<'a when 'a : equality> (xs' : ('a*'a) []) f' = list |> Seq.toList = (xs @ xs @ xs) [] -let ``map2 looks at every element exactly once and in order - consistenly over all collections when size is equal`` () = +let ``map2 looks at every element exactly once and in order - consistently over all collections when size is equal`` () = smallerSizeCheck map2 smallerSizeCheck map2 smallerSizeCheck map2 @@ -640,7 +640,7 @@ let map3<'a when 'a : equality> (xs' : ('a*'a*'a) []) f' = list |> Seq.toList = (xs @ xs @ xs) [] -let ``map3 looks at every element exactly once and in order - consistenly over all collections when size is equal`` () = +let ``map3 looks at every element exactly once and in order - consistently over all collections when size is equal`` () = smallerSizeCheck map3 smallerSizeCheck map3 smallerSizeCheck map3 @@ -703,7 +703,7 @@ let mapi2<'a when 'a : equality> (xs' : ('a*'a) []) f' = (Seq.toList indices = [0..xs.Length-1] @ [0..xs.Length-1] @ [0..xs.Length-1]) [] -let ``mapi2 looks at every element exactly once and in order - consistenly over all collections when size is equal`` () = +let ``mapi2 looks at every element exactly once and in order - consistently over all collections when size is equal`` () = smallerSizeCheck mapi2 smallerSizeCheck mapi2 smallerSizeCheck mapi2 diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListType.fs index 653f9b3a40b..f0eb9ff83ec 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListType.fs @@ -347,3 +347,16 @@ type ListType() = Assert.AreEqual(lst.[-3..(-4)], ([]: int list)) Assert.AreEqual(lst.[-4..(-3)], ([]: int list)) +#if NET8_0_OR_GREATER + +#nowarn "1204" // FS1204: This type/method is for compiler use and should not be used directly. + +/// Tests for methods on the static, non-generic List type. +module FSharpList = + [] + let ``List.Create creates a list from a ReadOnlySpan`` () = + let expected = [1..10] + let span = ReadOnlySpan [|1..10|] + let actual = List.Create span + Assert.Equal(expected, actual) +#endif diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapModule.fs index 90c14d92532..fec6af0757c 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapModule.fs @@ -466,23 +466,23 @@ type MapModule() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] let resultValueMap = Map.partition (fun x y -> x%2 = 0) valueKeyMap - let choosed = [(2,"b"); (4,"d")] |> Map.ofList - let notChoosed = [(3,"c"); (5,"e")] |> Map.ofList - Assert.AreEqual(resultValueMap,(choosed,notChoosed)) + let chosen = [(2,"b"); (4,"d")] |> Map.ofList + let notChosen = [(3,"c"); (5,"e")] |> Map.ofList + Assert.AreEqual(resultValueMap,(chosen,notChosen)) // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] let resultRefMap = refMap |> Map.partition (fun x y -> x.Length >2 ) - let choosed = [( "...",3); ("....",4)] |> Map.ofList - let notChoosed = [(".",1); ("..",2)] |> Map.ofList - Assert.AreEqual(resultRefMap,(choosed,notChoosed)) + let chosen = [( "...",3); ("....",4)] |> Map.ofList + let notChosen = [(".",1); ("..",2)] |> Map.ofList + Assert.AreEqual(resultRefMap,(chosen,notChosen)) // One-element Map let oeleMap = Map.ofSeq [(1, "one")] let resultOele = Map.partition (fun x y -> x<4) oeleMap - let choosed = [(1,"one")] |> Map.ofList - let notChoosed = Map.empty - Assert.AreEqual(resultOele,(choosed,notChoosed)) + let chosen = [(1,"one")] |> Map.ofList + let notChosen = Map.empty + Assert.AreEqual(resultOele,(chosen,notChosen)) // empty Map let eptMap = Map.empty diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule.fs index 7083ada323c..de6f66dd7ec 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule.fs @@ -103,11 +103,11 @@ type SeqModule() = let integerSeq1:seq = seq [0..4] let integerSeq2:seq = seq [5..9] - let appendIntergerSeq = Seq.append integerSeq1 integerSeq2 + let appendIntegerSeq = Seq.append integerSeq1 integerSeq2 let expectResultInteger = seq { for i in 0..9 -> i} - VerifySeqsEqual expectResultInteger appendIntergerSeq + VerifySeqsEqual expectResultInteger appendIntegerSeq // String Seq @@ -308,12 +308,12 @@ type SeqModule() = // int Seq let intSeq = seq [1..20] let funcInt x = if (x%5=0) then Some x else None - let intChoosed = Seq.choose funcInt intSeq - let expectedIntChoosed = seq { for i = 1 to 4 do yield i*5} + let intChosen = Seq.choose funcInt intSeq + let expectedIntChosen = seq { for i = 1 to 4 do yield i*5} - VerifySeqsEqual expectedIntChoosed intChoosed + VerifySeqsEqual expectedIntChosen intChosen // string Seq let stringSrc = seq ["list";"List"] @@ -321,14 +321,14 @@ type SeqModule() = | "list"-> Some x | "List" -> Some x | _ -> None - let strChoosed = Seq.choose funcString stringSrc + let strChosen = Seq.choose funcString stringSrc let expectedStrChoose = seq ["list";"List"] - VerifySeqsEqual expectedStrChoose strChoosed + VerifySeqsEqual expectedStrChoose strChosen // empty Seq let emptySeq = Seq.empty - let emptyChoosed = Seq.choose funcInt emptySeq + let emptyChosen = Seq.choose funcInt emptySeq let expectedEmptyChoose = Seq.empty @@ -531,9 +531,9 @@ type SeqModule() = // string Seq let strDistinctSeq = seq ["elementDup"; "ele1"; "ele2"; "elementDup"] - let DistnctStrSeq = Seq.distinct strDistinctSeq + let DistinctStrSeq = Seq.distinct strDistinctSeq let expectedStrSeq = seq ["elementDup"; "ele1"; "ele2"] - VerifySeqsEqual expectedStrSeq DistnctStrSeq + VerifySeqsEqual expectedStrSeq DistinctStrSeq // Empty Seq let emptySeq : seq = Seq.empty @@ -566,9 +566,9 @@ type SeqModule() = let funcStrDistinct (s:string) = s.IndexOf("key") let strSeq = seq [ "key"; "blank key"; "key dup"; "blank key dup"] - let DistnctStrSeq = Seq.distinctBy funcStrDistinct strSeq + let DistinctStrSeq = Seq.distinctBy funcStrDistinct strSeq let expectedStrSeq = seq ["key"; "blank key"] - VerifySeqsEqual expectedStrSeq DistnctStrSeq + VerifySeqsEqual expectedStrSeq DistinctStrSeq // Empty Seq let emptySeq : seq = Seq.empty diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetModule.fs index 7ab50c922f6..079d1aba772 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetModule.fs @@ -14,7 +14,7 @@ open Xunit Make sure each method works on: * Empty set * Single-element set -* Sets with 4 more more elements +* Sets with 4 or more elements *) type SetModule() = @@ -143,11 +143,11 @@ type SetModule() = let alphabet = new Set(['a' .. 'z']) let vowels = new Set(['a'; 'e'; 'i'; 'o'; 'u']) - let noVowelAlpa = alphabet - vowels - if compare noVowelAlpa alphabet <> 1 then Assert.Fail() - if compare alphabet alphabet <> 0 then Assert.Fail() - if compare noVowelAlpa noVowelAlpa <> 0 then Assert.Fail() - if compare alphabet noVowelAlpa <> -1 then Assert.Fail() + let noVowelAlpha = alphabet - vowels + if compare noVowelAlpha alphabet <> 1 then Assert.Fail() + if compare alphabet alphabet <> 0 then Assert.Fail() + if compare noVowelAlpha noVowelAlpha <> 0 then Assert.Fail() + if compare alphabet noVowelAlpha <> -1 then Assert.Fail() () [] @@ -169,8 +169,8 @@ type SetModule() = member _.Filter() = let emptyComplex = Set.empty : Set> * Set> - let fileredEmpty = Set.filter (fun _ -> false) emptyComplex - if (fileredEmpty = emptyComplex) <> true then Assert.Fail() + let filteredEmpty = Set.filter (fun _ -> false) emptyComplex + if (filteredEmpty = emptyComplex) <> true then Assert.Fail() let nullSet = Set.singleton null if nullSet.Count <> 1 then Assert.Fail() @@ -401,7 +401,7 @@ type SetModule() = Assert.True (Array.forall ( (=) true ) elements) [] - member _.Parition() = + member _.Partition() = // Empty let resulta, resultb = Set.partition (fun (x : int) -> Assert.Fail(); false) Set.empty @@ -629,7 +629,7 @@ type SetModule() = set <- Set.add i set) // Check that the set equals the full list Assert.True(Set.toList set = [0 .. i]) - // Remove items in permutation order, ensuring set is delt with correctly + // Remove items in permutation order, ensuring set is dealt with correctly Array.iteri (fun idx i -> set <- Set.remove i set // Verify all elements have been correctly removed diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetType.fs index ac3c213be80..9c1120675ad 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetType.fs @@ -16,7 +16,7 @@ open Xunit Make sure each method works on: * Empty set * Single-element set -* Sets with 4 more more elements +* Sets with 4 or more elements *) type SetType() = @@ -331,3 +331,17 @@ type SetType() = Assert.AreEqual(sec.MaximumElement, 7) Assert.AreEqual(Set.maxElement fir, 6) Assert.AreEqual(Set.maxElement sec, 7) + +#if NET8_0_OR_GREATER + +#nowarn "1204" // FS1204: This type/method is for compiler use and should not be used directly. + +/// Tests for methods on the static, non-generic Set type. +module FSharpSet = + [] + let ``Set.Create creates a set from a ReadOnlySpan`` () = + let expected = set [1..10] + let span = ReadOnlySpan [|1..10|] + let actual = Set.Create span + Assert.Equal>(expected, actual) +#endif diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/StringModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/StringModule.fs index 8a89a3579ea..e960a5c5cb7 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/StringModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/StringModule.fs @@ -13,7 +13,7 @@ open FSharp.Core.UnitTests.LibraryTestFx (* [Test Strategy] Make sure each method works on: -* Few charachter string ("foo") +* Few character string ("foo") * Empty string ("") * Null string (null) *) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs index a0ce3054224..145d9a70c3e 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs @@ -651,7 +651,7 @@ type AsyncModule() = Async.RunSynchronously(computation) |> ignore [] - member _.``maxDegreeOfParallelism can not be 0`` () = + member _.``maxDegreeOfParallelism cannot be 0`` () = try [| for i in 1 .. 10 -> async { return i } |] |> fun cs -> Async.Parallel(cs, 0) @@ -663,7 +663,7 @@ type AsyncModule() = Assert.True(exc.Message.Contains("maxDegreeOfParallelism must be positive, was 0")) [] - member _.``maxDegreeOfParallelism can not be negative`` () = + member _.``maxDegreeOfParallelism cannot be negative`` () = try [| for i in 1 .. 10 -> async { return i } |] |> fun cs -> Async.Parallel(cs, -1) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/MailboxProcessorType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/MailboxProcessorType.fs index 8c686a8a213..904bc7dc622 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/MailboxProcessorType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/MailboxProcessorType.fs @@ -452,7 +452,7 @@ type MailboxProcessorType() = |> fun x -> Async.Start(x, cancel.Token) System.Threading.Thread.Sleep(5000) // cancellation after 500 pause for 5 seconds if not gotGood || not gotBad then - failwith <| sprintf "Exected both good and bad async's to be cancelled afteMailbox should not fail! gotGood: %A, gotBad: %A" gotGood gotBad + failwith <| sprintf "Expected both good and bad async's to be cancelled afterMailbox should not fail! gotGood: %A, gotBad: %A" gotGood gotBad [] member this.StartImmediateStartsOnCurrentThread() = diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/NestedTaskFailures.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/NestedTaskFailures.fs index 964b87a2847..7313ad61b87 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/NestedTaskFailures.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/NestedTaskFailures.fs @@ -1,9 +1,9 @@ namespace FSharp.Core.UnitTests.Control.Tasks -// The tasks below fail state machine comilation. This failure was causing subsequent problems in code generation. +// The tasks below fail state machine compilation. This failure was causing subsequent problems in code generation. // See https://github.com/dotnet/fsharp/issues/13404 -#nowarn "3511" // state machine not staticlly compilable - this is a separate issue, see https://github.com/dotnet/fsharp/issues/13404 +#nowarn "3511" // state machine not statically compilable - this is a separate issue, see https://github.com/dotnet/fsharp/issues/13404 open System open Microsoft.FSharp.Control diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/Tasks.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/Tasks.fs index 4ed91efb2fa..5d533b880c3 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/Tasks.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/Tasks.fs @@ -1374,7 +1374,7 @@ module Issue12184c = task { // The overload resolution for Bind commits to 'Task<_>' via overload since no type annotation is available // - // This should not do an early commit to "task like" nor propogate SRTP constraints from the task-like overload for Bind. + // This should not do an early commit to "task like" nor propagate SRTP constraints from the task-like overload for Bind. let! result = t return result } diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/TasksDynamic.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/TasksDynamic.fs index 65ade4f2232..c811aecaa5c 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/TasksDynamic.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/TasksDynamic.fs @@ -17,7 +17,7 @@ namespace FSharp.Core.UnitTests.Control.TasksDynamic #nowarn "1204" // construct only for use in compiled code -#nowarn "3511" // state machine not staticlly compilable - the one in 'Run' +#nowarn "3511" // state machine not statically compilable - the one in 'Run' open System open System.Collections open System.Collections.Generic diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/OptionModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/OptionModule.fs index cecad68f233..106a1f5d7af 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/OptionModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/OptionModule.fs @@ -131,7 +131,7 @@ type OptionModule() = member this.OfToObj() = Assert.True( Option.toObj (Some "3") = "3") Assert.True( Option.toObj (Some "") = "") - Assert.True( Option.toObj (Some null) = null) + Assert.True( Option.toObj (Some null) = null) // TODO NULLNESS: this type annotation should not be needed Assert.True( Option.toObj None = null) Assert.True( Option.ofObj "3" = Some "3") @@ -142,6 +142,13 @@ type OptionModule() = Assert.True( Option.ofObj null = None) Assert.True( Option.ofObj null = None) + [] + member this.OfToValueOption() = + Assert.Equal(ValueSome 3, Option.toValueOption (Some 3)) + Assert.Equal(ValueNone, Option.toValueOption (None: int option)) + Assert.Equal(Some 3, Option.ofValueOption (ValueSome 3)) + Assert.Equal(None, Option.ofValueOption (ValueNone: int voption)) + [] member this.DefaultValue() = Assert.AreEqual( Option.defaultValue 3 None, 3) @@ -380,6 +387,13 @@ type ValueOptionTests() = Assert.True(ValueOption.ofObj null = ValueNone) Assert.True(ValueOption.ofObj null = ValueNone) + [] + member this.OfToOption() = + Assert.Equal(Some 3, ValueOption.toOption (ValueSome 3)) + Assert.Equal(None, ValueOption.toOption (ValueNone: int voption)) + Assert.Equal(ValueSome 3, ValueOption.ofOption (Some 3)) + Assert.Equal(ValueNone, ValueOption.ofOption (None: int option)) + [] member this.DefaultValue() = Assert.AreEqual(ValueOption.defaultValue 3 ValueNone, 3) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs index be9894bc22e..95de124e9f5 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs @@ -22,7 +22,7 @@ Make sure each method works on: * Record * Exception * Tuple -* Fuction +* Function * Struct versions of the above *) @@ -376,7 +376,7 @@ type FSharpValueTests() = let resultFuncInt = resultFuncIntObj :?> (int -> int) Assert.AreEqual(resultFuncInt(5), 6) - // String funcion + // String function let implementationString (x:obj) = box( unbox(x) + " function") let resultFuncStringObj = FSharpValue.MakeFunction(typeof string>, implementationString ) let resultFuncString = resultFuncStringObj :?> (string -> string) @@ -698,14 +698,14 @@ type FSharpValueTests() = // SingleCaseUnion let (singlecaseinfo, _singlevaluearray) = FSharpValue.GetUnionFields(singleCaseUnion1, typeof) let singleUnionCtor = FSharpValue.PreComputeUnionConstructor(singlecaseinfo) - let resuleSingleCaseUnion = singleUnionCtor([| box 1.0; box 2.0; box 3.0|]) - Assert.AreEqual(resuleSingleCaseUnion, singleCaseUnion1) + let resultSingleCaseUnion = singleUnionCtor([| box 1.0; box 2.0; box 3.0|]) + Assert.AreEqual(resultSingleCaseUnion, singleCaseUnion1) // DiscUnion let (discunioninfo, _discunionvaluearray) = FSharpValue.GetUnionFields(discUnionCaseB, typeof>) let discUnionCtor = FSharpValue.PreComputeUnionConstructor(discunioninfo) - let resuleDiscUnionB = discUnionCtor([| box 1; box(Some(discUnionCaseB)) |]) - Assert.AreEqual(resuleDiscUnionB, discUnionRecCaseB) + let resultDiscUnionB = discUnionCtor([| box 1; box(Some(discUnionCaseB)) |]) + Assert.AreEqual(resultDiscUnionB, discUnionRecCaseB) [] member _.PreComputeStructUnionConstructor() = @@ -713,14 +713,14 @@ type FSharpValueTests() = // SingleCaseUnion let (singlecaseinfo, _singlevaluearray) = FSharpValue.GetUnionFields(singleCaseStructUnion1, typeof) let singleUnionCtor = FSharpValue.PreComputeUnionConstructor(singlecaseinfo) - let resuleSingleCaseUnion = singleUnionCtor([| box 1.0; box 2.0; box 3.0|]) - Assert.AreEqual(resuleSingleCaseUnion, singleCaseStructUnion1) + let resultSingleCaseUnion = singleUnionCtor([| box 1.0; box 2.0; box 3.0|]) + Assert.AreEqual(resultSingleCaseUnion, singleCaseStructUnion1) // DiscUnion let (discunioninfo, _discunionvaluearray) = FSharpValue.GetUnionFields(discStructUnionCaseB, typeof>) let discUnionCtor = FSharpValue.PreComputeUnionConstructor(discunioninfo) - let resuleDiscUnionB = discUnionCtor([| box 1|]) - Assert.AreEqual(resuleDiscUnionB, discStructUnionCaseB) + let resultDiscUnionB = discUnionCtor([| box 1|]) + Assert.AreEqual(resultDiscUnionB, discStructUnionCaseB) [] member _.PreComputeUnionConstructorInfo() = diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs index a7672d9925f..727ed166b86 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs @@ -3,6 +3,10 @@ // Various tests for the: // Microsoft.FSharp.Core.Operators module +// For information on the runtime-dependent behavior differences in this file, see: +// - https://github.com/dotnet/runtime/issues/61885 +// - https://github.com/dotnet/runtime/pull/97529 + namespace FSharp.Core.UnitTests.Operators open System @@ -278,18 +282,24 @@ type OperatorsModule1() = // Overflow let result = Operators.byte Single.MinValue Assert.AreEqual(0uy, result) - + // Overflow let result = Operators.byte Single.MaxValue - Assert.AreEqual(0uy, result) - + if Info.isNetFramework then + Assert.AreEqual(0uy, result) + else + Assert.AreEqual(255uy, result) + // Overflow let result = Operators.byte Double.MinValue Assert.AreEqual(0uy, result) - + // Overflow let result = Operators.byte Double.MaxValue - Assert.AreEqual(0uy, result) + if Info.isNetFramework then + Assert.AreEqual(0uy, result) + else + Assert.AreEqual(255uy, result) // Overflow let result = Operators.byte (Int64.MaxValue * 8L) @@ -343,9 +353,15 @@ type OperatorsModule1() = // Overflow Assert.AreEqual('\000', Operators.char Single.MinValue) - Assert.AreEqual('\000', Operators.char Double.MinValue) - Assert.AreEqual('\000', Operators.char Single.MaxValue) - Assert.AreEqual('\000', Operators.char Double.MaxValue) + if Info.isNetFramework then + Assert.AreEqual('\000', Operators.char Single.MaxValue) + else + Assert.AreEqual('\uffff', Operators.char Single.MaxValue) + + if Info.isNetFramework then + Assert.AreEqual('\000', Operators.char Double.MaxValue) + else + Assert.AreEqual('\uffff', Operators.char Double.MaxValue) CheckThrowsOverflowException(fun () -> Operators.char Decimal.MinValue |> ignore) // string type diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs index d4197529ea6..57647ead9ed 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs @@ -3,6 +3,10 @@ // Various tests for the: // Microsoft.FSharp.Core.Operators module +// For information on the runtime-dependent behavior differences in this file, see: +// - https://github.com/dotnet/runtime/issues/61885 +// - https://github.com/dotnet/runtime/pull/97529 + namespace FSharp.Core.UnitTests.Operators open System @@ -53,7 +57,10 @@ type OperatorsModule2() = // Overflow. let result = Operators.int Single.MaxValue - Assert.AreEqual(Int32.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int32.MinValue, result) + else + Assert.AreEqual(Int32.MaxValue, result) // Overflow let result = Operators.int Single.MinValue @@ -61,7 +68,10 @@ type OperatorsModule2() = // Overflow let result = Operators.int Double.MaxValue - Assert.AreEqual(Int32.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int32.MinValue, result) + else + Assert.AreEqual(Int32.MaxValue, result) // Overflow let result = Operators.int Double.MinValue @@ -106,7 +116,10 @@ type OperatorsModule2() = // Overflow. let result = Operators.int16 Single.MaxValue - Assert.AreEqual(0s, result) + if Info.isNetFramework then + Assert.AreEqual(0s, result) + else + Assert.AreEqual(-1s, result) // Overflow let result = Operators.int16 Single.MinValue @@ -114,7 +127,10 @@ type OperatorsModule2() = // Overflow let result = Operators.int16 Double.MaxValue - Assert.AreEqual(0s, result) + if Info.isNetFramework then + Assert.AreEqual(0s, result) + else + Assert.AreEqual(-1s, result) // Overflow let result = Operators.int16 Double.MinValue @@ -158,7 +174,10 @@ type OperatorsModule2() = // Overflow. let result = Operators.int32 Single.MaxValue - Assert.AreEqual(Int32.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int32.MinValue, result) + else + Assert.AreEqual(Int32.MaxValue, result) // Overflow let result = Operators.int32 Single.MinValue @@ -166,8 +185,11 @@ type OperatorsModule2() = // Overflow let result = Operators.int32 Double.MaxValue - Assert.AreEqual(Int32.MinValue, result) - + if Info.isNetFramework then + Assert.AreEqual(Int32.MinValue, result) + else + Assert.AreEqual(Int32.MaxValue, result) + // Overflow let result = Operators.int32 Double.MinValue Assert.AreEqual(Int32.MinValue, result) @@ -211,7 +233,10 @@ type OperatorsModule2() = // Overflow. let result = Operators.int64 Single.MaxValue - Assert.AreEqual(Int64.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int64.MinValue, result) + else + Assert.AreEqual(Int64.MaxValue, result) // Overflow let result = Operators.int64 Single.MinValue @@ -219,7 +244,10 @@ type OperatorsModule2() = // Overflow. let result = Operators.int64 Double.MaxValue - Assert.AreEqual(Int64.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int64.MinValue, result) + else + Assert.AreEqual(Int64.MaxValue, result) // Overflow let result = Operators.int64 Double.MinValue @@ -365,8 +393,11 @@ type OperatorsModule2() = if Info.isX86Runtime then Assert.AreEqual(-2147483648n, result) else - // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 - Assert.AreEqual(-9223372036854775807n - 1n, result) + if Info.isNetFramework then + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + else + Assert.AreEqual(9223372036854775807n, result) // Overflow (depends on pointer size) let result = Operators.nativeint Single.MinValue @@ -381,9 +412,12 @@ type OperatorsModule2() = if Info.isX86Runtime then Assert.AreEqual(-2147483648n, result) else - // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 - Assert.AreEqual(-9223372036854775807n - 1n, result) - + if Info.isNetFramework then + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + else + Assert.AreEqual(9223372036854775807n, result) + // Overflow (depends on pointer size) let result = Operators.nativeint Double.MinValue if Info.isX86Runtime then @@ -414,8 +448,11 @@ type OperatorsModule2() = if Info.isX86Runtime then Assert.AreEqual(-2147483648n, result) else - // Cannot express this as a literal, see https://github.com/dotnet/fsharp/issues/9524 - Assert.AreEqual("-9223372036854775808", string result) + if Info.isNetFramework then + // Cannot express this as a literal, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual("-9223372036854775808", string result) + else + Assert.AreEqual(9223372036854775807n, result) let result = Operators.nativeint System.Double.MinValue if Info.isX86Runtime then @@ -433,7 +470,6 @@ type OperatorsModule2() = Assert.AreEqual("-9223372036854775808", string -9223372036854775808n) Assert.AreEqual("9223372036854775807", string 9223372036854775807n) - [] member _.not() = let result = Operators.not true @@ -445,7 +481,6 @@ type OperatorsModule2() = [] member _.nullArg() = CheckThrowsArgumentNullException(fun () -> Operators.nullArg "A" |> ignore) - [] member _.pown() = @@ -483,7 +518,6 @@ type OperatorsModule2() = member _.raise() = CheckThrowsArgumentException(fun () -> Operators.raise <| new ArgumentException("Invalid Argument ") |> ignore) - [] member _.ref() = // value type @@ -596,7 +630,10 @@ type OperatorsModule2() = // Overflow let result = Operators.sbyte Double.MaxValue - Assert.AreEqual(0y, result) + if Info.isNetFramework then + Assert.AreEqual(0y, result) + else + Assert.AreEqual(-1y, result) // Overflow let result = Operators.sbyte (Int64.MaxValue * 8L) @@ -954,7 +991,10 @@ type OperatorsModule2() = // Overflow let result = Operators.uint16 Single.MaxValue - Assert.AreEqual(0us, result) + if Info.isNetFramework then + Assert.AreEqual(0us, result) + else + Assert.AreEqual(65535us, result) // Overflow let result = Operators.uint16 Single.MinValue @@ -962,7 +1002,10 @@ type OperatorsModule2() = // Overflow let result = Operators.uint16 Double.MaxValue - Assert.AreEqual(0us, result) + if Info.isNetFramework then + Assert.AreEqual(0us, result) + else + Assert.AreEqual(65535us, result) // Overflow let result = Operators.uint16 Double.MinValue @@ -987,7 +1030,10 @@ type OperatorsModule2() = // Overflow let result = Operators.uint32 Single.MaxValue - Assert.AreEqual(0u, result) + if Info.isNetFramework then + Assert.AreEqual(0u, result) + else + Assert.AreEqual(4294967295u, result) // Overflow let result = Operators.uint32 Single.MinValue @@ -995,7 +1041,10 @@ type OperatorsModule2() = // Overflow let result = Operators.uint32 Double.MaxValue - Assert.AreEqual(0u, result) + if Info.isNetFramework then + Assert.AreEqual(0u, result) + else + Assert.AreEqual(4294967295u, result) // Overflow let result = Operators.uint32 Double.MinValue @@ -1037,19 +1086,31 @@ type OperatorsModule2() = // Overflow let result = Operators.uint64 Single.MaxValue - Assert.AreEqual(0UL, result) + if Info.isNetFramework then + Assert.AreEqual(0UL, result) + else + Assert.AreEqual(18446744073709551615UL, result) // Overflow let result = Operators.uint64 Single.MinValue - Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 + if Info.isNetFramework then + Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 + else + Assert.AreEqual(0UL, result) // Overflow let result = Operators.uint64 Double.MaxValue - Assert.AreEqual(0UL, result) + if Info.isNetFramework then + Assert.AreEqual(0UL, result) + else + Assert.AreEqual(18446744073709551615UL, result) // Overflow let result = Operators.uint64 Double.MinValue - Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 + if Info.isNetFramework then + Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 + else + Assert.AreEqual(0UL, result) // Overflow let result = Operators.uint64 Int64.MinValue @@ -1079,25 +1140,37 @@ type OperatorsModule2() = // Overflow Single.MaxValue is equal on 32 bits and 64 bits runtimes let result = Operators.unativeint Single.MaxValue - Assert.AreEqual(0un, result) + if Info.isNetFramework then + Assert.AreEqual(0un, result) + else + Assert.AreEqual(18446744073709551615un, result) // Overflow (depends on pointer size) let result = Operators.unativeint Single.MinValue if Info.isX86Runtime then Assert.AreEqual(0un, result) else - Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + if Info.isNetFramework then + Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + else + Assert.AreEqual(0un, result) // Overflow Double.MaxValue is equal on 32 bits and 64 bits runtimes let result = Operators.unativeint Double.MaxValue - Assert.AreEqual(0un, result) + if Info.isNetFramework then + Assert.AreEqual(0un, result) + else + Assert.AreEqual(18446744073709551615un, result) // Overflow (depends on pointer size) let result = Operators.unativeint Double.MinValue if Info.isX86Runtime then Assert.AreEqual(0un, result) else - Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + if Info.isNetFramework then + Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + else + Assert.AreEqual(0un, result) // Overflow (depends on pointer size) let result = Operators.unativeint Int64.MinValue diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs index 9af581dca52..7d8b3678821 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModuleDynamic.fs @@ -7,6 +7,10 @@ namespace FSharp.Core.UnitTests.Operators open System open Xunit +// For information on the runtime-dependent behavior differences in this file, see: +// - https://github.com/dotnet/runtime/issues/61885 +// - https://github.com/dotnet/runtime/pull/97529 + #nowarn "1204" // CompilerMessage: This function is for use by dynamic invocations of F# code and should not be used directly module OperatorsModuleDynamic = @@ -94,7 +98,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.byte Single.MaxValue - Assert.AreEqual(0uy, result) + if Info.isNetFramework then + Assert.AreEqual(0uy, result) + else + Assert.AreEqual(255uy, result) // Overflow let result = Operators.byte Double.MinValue @@ -102,7 +109,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.byte Double.MaxValue - Assert.AreEqual(0uy, result) + if Info.isNetFramework then + Assert.AreEqual(0uy, result) + else + Assert.AreEqual(255uy, result) // Overflow let result = Operators.byte (Int64.MaxValue * 8L) @@ -135,8 +145,16 @@ module OperatorsModuleDynamic = // Overflow Assert.AreEqual('\000', Operators.char Single.MinValue) Assert.AreEqual('\000', Operators.char Double.MinValue) - Assert.AreEqual('\000', Operators.char Single.MaxValue) - Assert.AreEqual('\000', Operators.char Double.MaxValue) + + if Info.isNetFramework then + Assert.AreEqual('\000', Operators.char Single.MaxValue) + else + Assert.AreEqual('\uffff', Operators.char Single.MaxValue) + + if Info.isNetFramework then + Assert.AreEqual('\000', Operators.char Double.MaxValue) + else + Assert.AreEqual('\uffff', Operators.char Double.MaxValue) CheckThrowsOverflowException(fun () -> Operators.char Decimal.MinValue |> ignore) // string type @@ -233,7 +251,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.int Single.MaxValue - Assert.AreEqual(Int32.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int32.MinValue, result) + else + Assert.AreEqual(Int32.MaxValue, result) // Overflow let result = Operators.int Single.MinValue @@ -241,7 +262,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.int Double.MaxValue - Assert.AreEqual(Int32.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int32.MinValue, result) + else + Assert.AreEqual(Int32.MaxValue, result) // Overflow let result = Operators.int Double.MinValue @@ -286,7 +310,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.int16 Single.MaxValue - Assert.AreEqual(0s, result) + if Info.isNetFramework then + Assert.AreEqual(0s, result) + else + Assert.AreEqual(-1s, result) // Overflow let result = Operators.int16 Single.MinValue @@ -294,7 +321,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.int16 Double.MaxValue - Assert.AreEqual(0s, result) + if Info.isNetFramework then + Assert.AreEqual(0s, result) + else + Assert.AreEqual(-1s, result) // Overflow let result = Operators.int16 Double.MinValue @@ -338,7 +368,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.int32 Single.MaxValue - Assert.AreEqual(Int32.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int32.MinValue, result) + else + Assert.AreEqual(Int32.MaxValue, result) // Overflow let result = Operators.int32 Single.MinValue @@ -346,7 +379,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.int32 Double.MaxValue - Assert.AreEqual(Int32.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int32.MinValue, result) + else + Assert.AreEqual(Int32.MaxValue, result) // Overflow let result = Operators.int32 Double.MinValue @@ -391,7 +427,10 @@ module OperatorsModuleDynamic = // Overflow. let result = Operators.int64 Single.MaxValue - Assert.AreEqual(Int64.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int64.MinValue, result) + else + Assert.AreEqual(Int64.MaxValue, result) // Overflow let result = Operators.int64 Single.MinValue @@ -399,7 +438,10 @@ module OperatorsModuleDynamic = // Overflow. let result = Operators.int64 Double.MaxValue - Assert.AreEqual(Int64.MinValue, result) + if Info.isNetFramework then + Assert.AreEqual(Int64.MinValue, result) + else + Assert.AreEqual(Int64.MaxValue, result) // Overflow let result = Operators.int64 Double.MinValue @@ -444,9 +486,12 @@ module OperatorsModuleDynamic = if Info.isX86Runtime then Assert.AreEqual(-2147483648n, result) else - // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 - Assert.AreEqual(-9223372036854775807n - 1n, result) - + if Info.isNetFramework then + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + else + Assert.AreEqual(9223372036854775807n, result) + // Overflow (depends on pointer size) let result = Operators.nativeint Single.MinValue if Info.isX86Runtime then @@ -454,15 +499,18 @@ module OperatorsModuleDynamic = else // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 Assert.AreEqual(-9223372036854775807n - 1n, result) - + // Overflow Double.MaxValue is equal on 32 bits and 64 bits runtimes let result = Operators.nativeint Double.MaxValue if Info.isX86Runtime then Assert.AreEqual(-2147483648n, result) else - // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 - Assert.AreEqual(-9223372036854775807n - 1n, result) - + if Info.isNetFramework then + // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual(-9223372036854775807n - 1n, result) + else + Assert.AreEqual(9223372036854775807n, result) + // Overflow (depends on pointer size) let result = Operators.nativeint Double.MinValue if Info.isX86Runtime then @@ -470,7 +518,7 @@ module OperatorsModuleDynamic = else // Cannot use -9223372036854775808, compiler doesn't allow it, see https://github.com/dotnet/fsharp/issues/9524 Assert.AreEqual(-9223372036854775807n - 1n, result) - + // Overflow (depends on pointer size) let result = Operators.nativeint Int64.MinValue if Info.isX86Runtime then @@ -492,8 +540,11 @@ module OperatorsModuleDynamic = if Info.isX86Runtime then Assert.AreEqual(-2147483648n, result) else - // Cannot express this as a literal, see https://github.com/dotnet/fsharp/issues/9524 - Assert.AreEqual("-9223372036854775808", string result) + if Info.isNetFramework then + // Cannot express this as a literal, see https://github.com/dotnet/fsharp/issues/9524 + Assert.AreEqual("-9223372036854775808", string result) + else + Assert.AreEqual(9223372036854775807n, result) let result = Operators.nativeint System.Double.MinValue if Info.isX86Runtime then @@ -501,7 +552,6 @@ module OperatorsModuleDynamic = else // Cannot express this as a literal, see https://github.com/dotnet/fsharp/issues/9524 Assert.AreEqual("-9223372036854775808", string result) - // Max and min value as literals (this breaks compilation if the lexer fails). // The following tests ensure that the proper value is parsed, which is similar to `nativeint Int64.MaxValue` etc. if Info.isX86Runtime then @@ -544,7 +594,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.sbyte Single.MaxValue - Assert.AreEqual(0y, result) + if Info.isNetFramework then + Assert.AreEqual(0y, result) + else + Assert.AreEqual(-1y, result) // Overflow let result = Operators.sbyte Double.MinValue @@ -552,7 +605,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.sbyte Double.MaxValue - Assert.AreEqual(0y, result) + if Info.isNetFramework then + Assert.AreEqual(0y, result) + else + Assert.AreEqual(-1y, result) // Overflow let result = Operators.sbyte (Int64.MaxValue * 8L) @@ -596,7 +652,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.uint16 Single.MaxValue - Assert.AreEqual(0us, result) + if Info.isNetFramework then + Assert.AreEqual(0us, result) + else + Assert.AreEqual(65535us, result) // Overflow let result = Operators.uint16 Single.MinValue @@ -604,7 +663,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.uint16 Double.MaxValue - Assert.AreEqual(0us, result) + if Info.isNetFramework then + Assert.AreEqual(0us, result) + else + Assert.AreEqual(65535us, result) // Overflow let result = Operators.uint16 Double.MinValue @@ -629,7 +691,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.uint32 Single.MaxValue - Assert.AreEqual(0u, result) + if Info.isNetFramework then + Assert.AreEqual(0u, result) + else + Assert.AreEqual(4294967295u, result) // Overflow let result = Operators.uint32 Single.MinValue @@ -637,8 +702,10 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.uint32 Double.MaxValue - Assert.AreEqual(0u, result) - + if Info.isNetFramework then + Assert.AreEqual(0u, result) + else + Assert.AreEqual(4294967295u, result) // Overflow let result = Operators.uint32 Double.MinValue Assert.AreEqual(0u, result) @@ -679,20 +746,31 @@ module OperatorsModuleDynamic = // Overflow let result = Operators.uint64 Single.MaxValue - Assert.AreEqual(0UL, result) - + if Info.isNetFramework then + Assert.AreEqual(0UL, result) + else + Assert.AreEqual(18446744073709551615UL, result) + // Overflow let result = Operators.uint64 Single.MinValue - Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 - + if Info.isNetFramework then + Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 + else + Assert.AreEqual(0UL, result) + // Overflow let result = Operators.uint64 Double.MaxValue - Assert.AreEqual(0UL, result) - + if Info.isNetFramework then + Assert.AreEqual(0UL, result) + else + Assert.AreEqual(18446744073709551615UL, result) + // Overflow let result = Operators.uint64 Double.MinValue - Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 - + if Info.isNetFramework then + Assert.AreEqual(9223372036854775808UL, result) // surprising, but true, 2^63 + 1 + else + Assert.AreEqual(0UL, result) // Overflow let result = Operators.uint64 Int64.MinValue Assert.AreEqual(9223372036854775808UL, result) @@ -721,26 +799,37 @@ module OperatorsModuleDynamic = // Overflow Single.MaxValue is equal on 32 bits and 64 bits runtimes let result = Operators.unativeint Single.MaxValue - Assert.AreEqual(0un, result) + if Info.isNetFramework then + Assert.AreEqual(0un, result) + else + Assert.AreEqual(18446744073709551615un, result) // Overflow (depends on pointer size) let result = Operators.unativeint Single.MinValue if Info.isX86Runtime then Assert.AreEqual(0un, result) else - Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + if Info.isNetFramework then + Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + else + Assert.AreEqual(0un, result) // Overflow Double.MaxValue is equal on 32 bits and 64 bits runtimes let result = Operators.unativeint Double.MaxValue - Assert.AreEqual(0un, result) + if Info.isNetFramework then + Assert.AreEqual(0un, result) + else + Assert.AreEqual(18446744073709551615un, result) // Overflow (depends on pointer size) let result = Operators.unativeint Double.MinValue if Info.isX86Runtime then Assert.AreEqual(0un, result) else - Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 - + if Info.isNetFramework then + Assert.AreEqual(9223372036854775808un, result) // surprising, but true, 2^63 + 1 + else + Assert.AreEqual(0un, result) // Overflow (depends on pointer size) let result = Operators.unativeint Int64.MinValue if Info.isX86Runtime then diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/PrimTypes.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/PrimTypes.fs index e2b6882e146..8e24be62850 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/PrimTypes.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/PrimTypes.fs @@ -592,7 +592,7 @@ type LanguagePrimitivesModule() = [] member this.PhysicalEquality() = - // revordtype + // recordtype let ref1 = ref 8 let ref2 = ref 8 let resultValue = LanguagePrimitives.PhysicalEquality ref1 ref2 diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs index 2bc98fb7996..a4fd85d07b7 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs @@ -232,7 +232,7 @@ type RecordTypesTestClass () = [] - member _.``struct recrods fields can be mutated`` () = + member _.``struct records fields can be mutated`` () = Check.QuickThrowOnFailure <| fun (i1:int) (i2:int) (m1:int) (m2:int) -> (i1 <> m1 && i2 <> m2) ==> diff --git a/tests/FSharp.Core.UnitTests/Interop/CSharpCollectionExpressions.fs b/tests/FSharp.Core.UnitTests/Interop/CSharpCollectionExpressions.fs new file mode 100644 index 00000000000..99f40530703 --- /dev/null +++ b/tests/FSharp.Core.UnitTests/Interop/CSharpCollectionExpressions.fs @@ -0,0 +1,216 @@ +module FSharp.Core.UnitTests.Interop.CSharp.CollectionExpressions + +// These tests require types available only in netstandard2.1 and up. +#if NET8_0_OR_GREATER + +open FSharp.Test +open FSharp.Test.Compiler +open Xunit + +/// Usings for the C# tests. +/// These must be prepended to each test's C# source text. +let csUsings = + """ + using System; + using System.Linq; + using Microsoft.FSharp.Collections; + + #nullable enable + """ + +/// Utility types and functions for the C# tests. +/// These must be appended to each test's C# source text. +let csUtils = + """ + public sealed record RecordClass(int X) : IComparable + { + public int CompareTo(object? obj) => obj switch + { + null => 1, + RecordClass(var otherX) => X.CompareTo(otherX), + _ => throw new ArgumentException("Invalid comparison.", nameof(obj)) + }; + } + + public readonly record struct RecordStruct(int X) : IComparable + { + public int CompareTo(object? obj) => obj switch + { + null => 1, + RecordStruct(var otherX) => X.CompareTo(otherX), + _ => throw new ArgumentException("Invalid comparison.", nameof(obj)) + }; + } + + public sealed class EqualException(string message) : Exception(message) { } + + public sealed class TrueException(string message) : Exception(message) { } + + public static class Assert + { + public static void Equal(T expected, T actual) + { + switch ((expected, actual)) + { + case (null, null): return; + case (null, not null): + case (not null, null): + case var _ when !expected.Equals(actual): throw new EqualException($"Expected '{expected}' but got '{actual}'."); + } + } + + public static void True(bool b) + { + if (!b) + { + throw new TrueException("Expected true but got false."); + } + } + } + """ + +[] +let ``FSharpList: can create using C# collection expression`` () = + CSharp $$""" + {{csUsings}} + + var expected = ListModule.OfArray([1, 2, 3]); + FSharpList actual = [1, 2, 3]; + + Assert.Equal(expected, actual); + Assert.Equal(expected.Length, actual.Length); + + for (var i = 0; i < expected.Length; i++) + { + Assert.Equal(expected[i], actual[i]); + } + + Assert.True(actual is [1, 2, 3]); + + {{csUtils}} + """ + |> withCSharpLanguageVersion CSharpLanguageVersion.CSharp12 + |> withName "Test" + |> compileExeAndRun + |> shouldSucceed + +[] +let ``FSharpList: can create using C# collection expression`` () = + CSharp $$""" + {{csUsings}} + + var expected = ListModule.OfArray([new RecordClass(1), new RecordClass(2), new RecordClass(3)]); + FSharpList actual = [new RecordClass(1), new RecordClass(2), new RecordClass(3)]; + + Assert.Equal(expected, actual); + Assert.Equal(expected.Length, actual.Length); + + for (var i = 0; i < expected.Length; i++) + { + Assert.Equal(expected[i], actual[i]); + } + + Assert.True(actual is [RecordClass(1), RecordClass(2), RecordClass(3)]); + + {{csUtils}} + """ + |> withCSharpLanguageVersion CSharpLanguageVersion.CSharp12 + |> withName "Test" + |> compileExeAndRun + |> shouldSucceed + +[] +let ``FSharpList: can create using C# collection expression`` () = + CSharp $$""" + {{csUsings}} + + var expected = ListModule.OfArray([new RecordStruct(1), new RecordStruct(2), new RecordStruct(3)]); + FSharpList actual = [new RecordStruct(1), new RecordStruct(2), new RecordStruct(3)]; + + Assert.Equal(expected, actual); + Assert.Equal(expected.Length, actual.Length); + + for (var i = 0; i < expected.Length; i++) + { + Assert.Equal(expected[i], actual[i]); + } + + Assert.True(actual is [RecordStruct(1), RecordStruct(2), RecordStruct(3)]); + + {{csUtils}} + """ + |> withCSharpLanguageVersion CSharpLanguageVersion.CSharp12 + |> withName "Test" + |> compileExeAndRun + |> shouldSucceed + +[] +let ``FSharpSet: can create using C# collection expression`` () = + CSharp $$""" + {{csUsings}} + + var expected = SetModule.OfArray([1, 2, 3]); + FSharpSet actual = [1, 2, 3]; + + Assert.Equal(expected, actual); + Assert.Equal(expected.Count, actual.Count); + + foreach (var (e, a) in expected.Zip(actual)) + { + Assert.Equal(e, a); + } + + {{csUtils}} + """ + |> withCSharpLanguageVersion CSharpLanguageVersion.CSharp12 + |> withName "Test" + |> compileExeAndRun + |> shouldSucceed + +[] +let ``FSharpSet: can create using C# collection expression`` () = + CSharp $$""" + {{csUsings}} + + var expected = SetModule.OfArray([new RecordClass(1), new RecordClass(2), new RecordClass(3)]); + FSharpSet actual = [new RecordClass(1), new RecordClass(2), new RecordClass(3)]; + + Assert.Equal(expected, actual); + Assert.Equal(expected.Count, actual.Count); + + foreach (var (e, a) in expected.Zip(actual)) + { + Assert.Equal(e, a); + } + + {{csUtils}} + """ + |> withCSharpLanguageVersion CSharpLanguageVersion.CSharp12 + |> withName "Test" + |> compileExeAndRun + |> shouldSucceed + +[] +let ``FSharpSet: can create using C# collection expression`` () = + CSharp $$""" + {{csUsings}} + + var expected = SetModule.OfArray([new RecordStruct(1), new RecordStruct(2), new RecordStruct(3)]); + FSharpSet actual = [new RecordStruct(1), new RecordStruct(2), new RecordStruct(3)]; + + Assert.Equal(expected, actual); + Assert.Equal(expected.Count, actual.Count); + + foreach (var (e, a) in expected.Zip(actual)) + { + Assert.Equal(e, a); + } + + {{csUtils}} + """ + |> withCSharpLanguageVersion CSharpLanguageVersion.CSharp12 + |> withName "Test" + |> compileExeAndRun + |> shouldSucceed + +#endif diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index 1cbf3a3aade..19c3793d64e 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -480,6 +480,9 @@ module rec Compiler = | FS fs -> FS { fs with OutputDirectory = path } | _ -> failwith "withOutputDirectory is only supported on F#" + let withCheckNulls (cUnit: CompilationUnit) : CompilationUnit = + withOptionsHelper ["--checknulls+"] "checknulls is only supported in F#" cUnit + let withBufferWidth (width: int)(cUnit: CompilationUnit) : CompilationUnit = withOptionsHelper [ $"--bufferwidth:{width}" ] "withBufferWidth is only supported on F#" cUnit @@ -507,6 +510,9 @@ module rec Compiler = let withLangVersion80 (cUnit: CompilationUnit) : CompilationUnit = withOptionsHelper [ "--langversion:8.0" ] "withLangVersion80 is only supported on F#" cUnit + let withLangVersion90 (cUnit: CompilationUnit) : CompilationUnit = + withOptionsHelper [ "--langversion:9.0" ] "withLangVersion90 is only supported on F#" cUnit + let withLangVersionPreview (cUnit: CompilationUnit) : CompilationUnit = withOptionsHelper [ "--langversion:preview" ] "withLangVersionPreview is only supported on F#" cUnit @@ -582,6 +588,9 @@ module rec Compiler = | CS cs -> CS { cs with LangVersion = ver } | _ -> failwith "Only supported in C#" + let withCSharpLanguageVersionPreview = + withCSharpLanguageVersion CSharpLanguageVersion.Preview + let withOutputType (outputType : CompileOutput) (cUnit: CompilationUnit) : CompilationUnit = match cUnit with | FS x -> FS { x with OutputType = outputType } @@ -598,6 +607,12 @@ module rec Compiler = | FS fs -> FS { fs with Options = fs.Options @ ["--realsig+"] } | _ -> failwith "withRealInternalSignatureOn only supported by f#" + let withRealInternalSignature (realSig: bool) (cUnit: CompilationUnit) : CompilationUnit = + if realSig then + cUnit |> withRealInternalSignatureOn + else + cUnit |> withRealInternalSignatureOff + let asExe (cUnit: CompilationUnit) : CompilationUnit = withOutputType CompileOutput.Exe cUnit @@ -715,7 +730,7 @@ module rec Compiler = let outputDirectory = match fs.OutputDirectory with | Some di -> di - | None -> DirectoryInfo(tryCreateTemporaryDirectory()) + | None -> DirectoryInfo(createTemporaryDirectory "compileFSharp") let references = processReferences fs.References outputDirectory let compilation = Compilation.CreateFromSources([fs.Source] @ fs.AdditionalSources, output, options, fs.TargetFramework, references, name, outputDirectory) compileFSharpCompilation compilation fs.IgnoreWarnings (FS fs) @@ -760,12 +775,12 @@ module rec Compiler = let private compileCSharp (csSource: CSharpCompilationSource) : CompilationResult = let source = csSource.Source.GetSourceText |> Option.defaultValue "" - let name = defaultArg csSource.Name (tryCreateTemporaryFileName()) + let name = defaultArg csSource.Name (getTemporaryFileName()) let outputDirectory = match csSource.OutputDirectory with | Some di -> di - | None -> DirectoryInfo(tryCreateTemporaryDirectory()) + | None -> DirectoryInfo(createTemporaryDirectory "compileCSharp") let additionalReferences = processReferences csSource.References outputDirectory @@ -777,12 +792,7 @@ module rec Compiler = let references = TargetFrameworkUtil.getReferences csSource.TargetFramework - let lv = - match csSource.LangVersion with - | CSharpLanguageVersion.CSharp8 -> LanguageVersion.CSharp8 - | CSharpLanguageVersion.CSharp9 -> LanguageVersion.CSharp9 - | CSharpLanguageVersion.Preview -> LanguageVersion.Preview - | _ -> LanguageVersion.Default + let lv = CSharpLanguageVersion.toLanguageVersion csSource.LangVersion let outputKind, extension = match csSource.OutputType with @@ -912,7 +922,7 @@ module rec Compiler = let outputDirectory = match fsSource.OutputDirectory with | Some di -> di - | None -> DirectoryInfo(tryCreateTemporaryDirectory()) + | None -> DirectoryInfo(createTemporaryDirectory "typecheckResults") let references = processReferences fsSource.References outputDirectory if references.IsEmpty then Array.empty @@ -1048,7 +1058,7 @@ module rec Compiler = let outputDirectory = match fs.OutputDirectory with | Some di -> di - | None -> DirectoryInfo(tryCreateTemporaryDirectory()) + | None -> DirectoryInfo(createTemporaryDirectory "runFsi") outputDirectory.Create() disposals.Add({ new IDisposable with member _.Dispose() = outputDirectory.Delete(true) }) @@ -1318,7 +1328,7 @@ Actual: if reader.ImportScopes.Count < 2 then failwith $"Expected to have at least 2 import scopes, but found {reader.ImportScopes.Count}." - // Sanity check: explicitly test that first import scope is indeed an apty one (i.e. there are no imports). + // Sanity check: explicitly test that first import scope is indeed an empty one (i.e. there are no imports). let rootScope = reader.ImportScopes.ToImmutableArray().Item(0) |> reader.GetImportScope let rootScopeImportsLength = rootScope.GetImports().ToImmutableArray().Length @@ -1402,7 +1412,7 @@ Actual: verifyPdbFormat reader compilationType verifyPdbOptions result.OutputPath reader options - | _ -> failwith "Output path is not set, please make sure compilation was successfull." + | _ -> failwith "Output path is not set, please make sure compilation was successful." () @@ -1420,7 +1430,7 @@ Actual: let pdbPath = Path.ChangeExtension(assemblyPath, ".pdb") if not (FileSystem.FileExistsShim pdbPath) then failwith $"PDB file does not exists: {pdbPath}" - | _ -> failwith "Output path is not set, please make sure compilation was successfull." + | _ -> failwith "Output path is not set, please make sure compilation was successful." match result with | CompilationResult.Success r -> verifyPdbExists r | _ -> failwith "Result should be \"Success\" in order to verify PDB." @@ -1432,7 +1442,7 @@ Actual: let pdbPath = Path.ChangeExtension(assemblyPath, ".pdb") if FileSystem.FileExistsShim pdbPath then failwith $"PDB file exists: {pdbPath}" - | _ -> failwith "Output path is not set, please make sure compilation was successfull." + | _ -> failwith "Output path is not set, please make sure compilation was successful." match result with | CompilationResult.Success r -> verifyPdbNotExists r | _ -> failwith "Result should be \"Success\" in order to verify PDB." @@ -1610,6 +1620,7 @@ Actual: | null -> () | _ when expectedContent = actualErrors -> () | _ -> File.WriteAllText(path, actualErrors) + //File.WriteAllText(path, actualErrors) match Assert.shouldBeSameMultilineStringSets expectedContent actualErrors with | None -> () diff --git a/tests/FSharp.Test.Utilities/CompilerAssert.fs b/tests/FSharp.Test.Utilities/CompilerAssert.fs index a97b214acde..0713d5fa8d2 100644 --- a/tests/FSharp.Test.Utilities/CompilerAssert.fs +++ b/tests/FSharp.Test.Utilities/CompilerAssert.fs @@ -172,20 +172,25 @@ type CSharpLanguageVersion = | CSharp8 = 0 | CSharp9 = 1 | CSharp11 = 11 + | CSharp12 = 12 | Preview = 99 +module CSharpLanguageVersion = + /// Converts the given C# language version to a Roslyn language version value. + let toLanguageVersion lv = + match lv with + | CSharpLanguageVersion.CSharp8 -> LanguageVersion.CSharp8 + | CSharpLanguageVersion.CSharp9 -> LanguageVersion.CSharp9 + | CSharpLanguageVersion.CSharp11 -> LanguageVersion.CSharp11 + | CSharpLanguageVersion.CSharp12 -> LanguageVersion.CSharp12 + | CSharpLanguageVersion.Preview -> LanguageVersion.Preview + | _ -> LanguageVersion.Default + [] type CompilationUtil private () = static let createCSharpCompilation (source: SourceCodeFileKind, lv, tf, additionalReferences, name) = - let lv = - match lv with - | CSharpLanguageVersion.CSharp8 -> LanguageVersion.CSharp8 - | CSharpLanguageVersion.CSharp9 -> LanguageVersion.CSharp9 - | CSharpLanguageVersion.CSharp11 -> LanguageVersion.CSharp11 - | CSharpLanguageVersion.Preview -> LanguageVersion.Preview - | _ -> LanguageVersion.Default - + let lv = CSharpLanguageVersion.toLanguageVersion lv let tf = defaultArg tf TargetFramework.NetStandard20 let source = match source.GetSourceText with @@ -215,9 +220,8 @@ type CompilationUtil private () = static member CreateILCompilation (source: string) = let compute = lazy - let ilFilePath = tryCreateTemporaryFileName () - let tmp = tryCreateTemporaryFileName () - let dllFilePath = Path.ChangeExtension (tmp, ".dll") + let ilFilePath = getTemporaryFileName() + ".il" + let dllFilePath = Path.ChangeExtension (ilFilePath, ".dll") try File.WriteAllText (ilFilePath, source) let errors = ILChecker.reassembleIL ilFilePath dllFilePath @@ -226,9 +230,7 @@ type CompilationUtil private () = with | _ -> (errors, [||]) finally - try File.Delete ilFilePath with | _ -> () - try File.Delete tmp with | _ -> () - try File.Delete dllFilePath with | _ -> () + try Directory.Delete(Path.GetDirectoryName ilFilePath, true) with _ -> () TestCompilation.IL (source, compute) and CompilationReference = @@ -428,7 +430,7 @@ module rec CompilerAssertHelpers = let name = match nameOpt with | Some name -> name - | _ -> tryCreateTemporaryFileNameInDirectory(outputDirectory) + | _ -> getTemporaryFileNameInDirectory outputDirectory.FullName let outputFilePath = Path.ChangeExtension (Path.Combine(outputDirectory.FullName, name), if isExe then ".exe" else ".dll") disposals.Add(disposeFile outputFilePath) @@ -499,23 +501,24 @@ module rec CompilerAssertHelpers = let compile isExe options (source:SourceCodeFileKind) f = + let outputFilePath = Path.ChangeExtension (getTemporaryFileName (), if isExe then ".exe" else ".dll") + let tempDir = Path.GetDirectoryName outputFilePath + let sourceFile = match source.GetSourceText with | Some text -> // In memory source file copy it to the build directory - let s = source.WithFileName(tryCreateTemporaryFileName ()).ChangeExtension - File.WriteAllText (source.GetSourceFileName, text) - s + let sourceWithTempFileName = source.WithFileName(getTemporaryFileNameInDirectory tempDir).ChangeExtension + File.WriteAllText(sourceWithTempFileName.GetSourceFileName, text) + sourceWithTempFileName | None -> // On Disk file source - let outputFilePath = Path.ChangeExtension (tryCreateTemporaryFileName (), if isExe then ".exe" else ".dll") try - f (rawCompile outputFilePath isExe options TargetFramework.Current [source]) + f (rawCompile outputFilePath isExe options TargetFramework.Current [sourceFile]) finally - try File.Delete sourceFile.GetSourceFileName with | _ -> () - try File.Delete outputFilePath with | _ -> () + try Directory.Delete(tempDir, true) with | _ -> () let rec evaluateReferences (outputPath:DirectoryInfo) (disposals: ResizeArray) ignoreWarnings (cmpl: Compilation) : string[] * string list = match cmpl with @@ -530,7 +533,7 @@ module rec CompilerAssertHelpers = let fileName = match cmpl with | TestCompilation.CSharp c when not (String.IsNullOrWhiteSpace c.AssemblyName) -> c.AssemblyName - | _ -> tryCreateTemporaryFileName() + | _ -> getTemporaryFileNameInDirectory outputPath.FullName let tmp = Path.Combine(outputPath.FullName, Path.ChangeExtension(fileName, ".dll")) disposals.Add({ new IDisposable with member _.Dispose() = File.Delete tmp }) cmpl.EmitAsFile tmp @@ -582,7 +585,7 @@ module rec CompilerAssertHelpers = let compileCompilation ignoreWarnings (cmpl: Compilation) f = let disposals = ResizeArray() try - let outputDirectory = DirectoryInfo(tryCreateTemporaryDirectory()) + let outputDirectory = DirectoryInfo(createTemporaryDirectory "compileCompilation") disposals.Add({ new IDisposable with member _.Dispose() = try File.Delete (outputDirectory.FullName) with | _ -> () }) f (compileCompilationAux outputDirectory disposals ignoreWarnings cmpl) finally @@ -596,7 +599,7 @@ module rec CompilerAssertHelpers = let outputDirectory = match cmpl with | Compilation(outputDirectory = Some outputDirectory) -> DirectoryInfo(outputDirectory.FullName) - | Compilation _ -> DirectoryInfo(tryCreateTemporaryDirectory()) + | Compilation _ -> DirectoryInfo(createTemporaryDirectory "returnCompilation") outputDirectory.Create() compileCompilationAux outputDirectory (ResizeArray()) ignoreWarnings cmpl @@ -646,7 +649,7 @@ module rec CompilerAssertHelpers = let runtimeconfig = """ { "runtimeOptions": { - "tfm": "net8.0", + "tfm": "net9.0", "framework": { "name": "Microsoft.NETCore.App", "version": "7.0" @@ -1001,8 +1004,11 @@ Updated automatically, please check diffs in your pull request, changes must be static member CompileLibraryAndVerifyIL((source: string), (f: ILVerifier -> unit)) = compileLibraryAndVerifyILWithOptions [||] (SourceCodeFileKind.Create("test.fs", source)) f + static member CompileLibraryAndVerifyILRealSig((source: string), (f: ILVerifier -> unit)) = + compileLibraryAndVerifyILWithOptions [|"--realsig+"|] (SourceCodeFileKind.Create("test.fs", source)) f + static member RunScriptWithOptionsAndReturnResult options (source: string) = - // Intialize output and input streams + // Initialize output and input streams use inStream = new StringReader("") use outStream = new StringWriter() use errStream = new StringWriter() diff --git a/tests/FSharp.Test.Utilities/ILChecker.fs b/tests/FSharp.Test.Utilities/ILChecker.fs index 3c60114d85e..15579833bcd 100644 --- a/tests/FSharp.Test.Utilities/ILChecker.fs +++ b/tests/FSharp.Test.Utilities/ILChecker.fs @@ -36,9 +36,10 @@ module ILChecker = let strings = @"""((\\[^\n]|[^""\n])*)""" let verbatimStrings = @"@(""[^""]*"")+" let methodSingleLine = "^(\s*\.method.*)(?: \s*)$[\r?\n?]^(\s*\{)" - let methodMultiLine = "^(\s*\.method.*)(?: \s*)$[\r?\n?]^(?: \s*)(.*)\s*$[\r?\n?]^(\s*\{)" - + let methodDoubleLine = "^(\s*\.method.*)(?: \s*)$[\r?\n?]^(?: \s*)(.*)\s*$[\r?\n?]^(\s*\{)" + let methodTripleLine = "^(\s*\.method.*)(?: \s*)$[\r?\n?]^(?: \s*)(.*)\s*$[\r?\n?]^(?: \s*)(.*)\s*$[\r?\n?]^(\s*\{)" let normalizeNewLines (text: string) = text.Replace("\r\n", "\n").Replace("\r\n", "\r") + let resourceMultiLine = @"(?\.mresource\s+.*)(?\s*\{[^}]*\})" let stripComments (text:string) = Regex.Replace(text, @@ -52,8 +53,9 @@ module ILChecker = let unifyMethodLine (text:string) = let text1 = Regex.Replace(text, $"{methodSingleLine}", (fun me -> $"{me.Groups[1].Value}\n{me.Groups[2].Value}"), RegexOptions.Multiline) - let text2 = Regex.Replace(text1, $"{methodMultiLine}", (fun me -> $"{me.Groups[1].Value} {me.Groups[2].Value}\n{me.Groups[3].Value}"), RegexOptions.Multiline) - text2 + let text2 = Regex.Replace(text1, $"{methodDoubleLine}", (fun me -> $"{me.Groups[1].Value} {me.Groups[2].Value}\n{me.Groups[3].Value}"), RegexOptions.Multiline) + let text3 = Regex.Replace(text2, $"{methodTripleLine}", (fun me -> $"{me.Groups[1].Value} {me.Groups[2].Value} {me.Groups[3].Value}\n{me.Groups[4].Value}"), RegexOptions.Multiline) + text3 let replace input (pattern, replacement: string) = Regex.Replace(input, pattern, replacement, RegexOptions.Singleline) @@ -72,15 +74,25 @@ module ILChecker = |> unifyRuntimeAssemblyName |> unifyImageBase + let stripManagedResources (text: string) = + let result = Regex.Replace(text, "\.mresource public .*\r?\n{\s*}\r?\n", "", RegexOptions.Multiline) + result + // This lets the same test be used when targeting both netfx and netcore. let unifyNetStandardVersions (text: string) = text.Replace(".ver 2:0:0:0", ".ver 2:1:0:0") + let unifyResourceBlock text = + let text2 = Regex.Replace(text, resourceMultiLine, (fun (res: Match) -> $"""{res.Groups["resource"].Value} {{ }}"""), RegexOptions.Multiline) + text2 + ilCode.Trim() |> normalizeNewLines |> stripComments |> unifyingAssemblyNames |> unifyMethodLine + |> stripManagedResources |> unifyNetStandardVersions + |> unifyResourceBlock let private generateIlFile dllFilePath ildasmArgs = let ilFilePath = Path.ChangeExtension(dllFilePath, ".il") @@ -115,6 +127,7 @@ module ILChecker = let prepareLines (s: string) = s.Split('\n') + // Skip emitted managed resources |> Array.map(fun e -> e.Trim('\r')) |> Array.skipWhile(String.IsNullOrWhiteSpace) |> Array.rev diff --git a/tests/FSharp.Test.Utilities/ProjectGeneration.fs b/tests/FSharp.Test.Utilities/ProjectGeneration.fs index 892d7c16701..c8cc066daa7 100644 --- a/tests/FSharp.Test.Utilities/ProjectGeneration.fs +++ b/tests/FSharp.Test.Utilities/ProjectGeneration.fs @@ -2,7 +2,7 @@ /// /// Each file in the project has a string identifier. It then contains a type and a function. /// The function calls functions from all the files the given file depends on and returns their -/// results + it's own type in a tuple. +/// results + its own type in a tuple. /// /// To model changes, we change the type name in a file which results in signatures of all the /// dependent files also changing. @@ -244,7 +244,8 @@ type SyntheticProject = UseScriptResolutionRules: bool } static member Create(?name: string) = - let name = defaultArg name $"TestProject_{Guid.NewGuid().ToString()[..7]}" + let name = defaultArg name "TestProject" + let name = $"{name}_{Guid.NewGuid().ToString()[..7]}" let dir = Path.GetFullPath projectRoot { Name = name @@ -439,7 +440,7 @@ let private renderFsProj (p: SyntheticProject) = Exe - net8.0 + net9.0 @@ -742,7 +743,7 @@ module ProjectOperations = expectOk result () Assert.NotEqual(oldSignature, newSignature) - let expectSignatureContains expected result (_oldSignature, newSignature) = + let expectSignatureContains (expected: string) result (_oldSignature, newSignature) = expectOk result () Assert.Contains(expected, newSignature) diff --git a/tests/FSharp.Test.Utilities/ScriptHelpers.fs b/tests/FSharp.Test.Utilities/ScriptHelpers.fs index 204168f5df2..aaaf5c458d8 100644 --- a/tests/FSharp.Test.Utilities/ScriptHelpers.fs +++ b/tests/FSharp.Test.Utilities/ScriptHelpers.fs @@ -20,6 +20,7 @@ type LangVersion = | V60 | V70 | V80 + | V90 | Preview | Latest | SupportsMl @@ -48,6 +49,7 @@ type FSharpScript(?additionalArgs: string[], ?quiet: bool, ?langVersion: LangVer | LangVersion.V60 -> "--langversion:6.0" | LangVersion.V70 -> "--langversion:7.0" | LangVersion.V80 -> "--langversion:8.0" + | LangVersion.V90 -> "--langversion:9.0" |] let argv = Array.append baseArgs additionalArgs diff --git a/tests/FSharp.Test.Utilities/TestFramework.fs b/tests/FSharp.Test.Utilities/TestFramework.fs index f7ec7f48001..d32ce4fcda8 100644 --- a/tests/FSharp.Test.Utilities/TestFramework.fs +++ b/tests/FSharp.Test.Utilities/TestFramework.fs @@ -7,31 +7,52 @@ open System.IO open System.Reflection open System.Diagnostics open Scripting -open NUnit.Framework +open Xunit open FSharp.Compiler.IO -let inline getTestsDirectory src dir = src ++ dir - -// Temporary directory is TempPath + "/FSharp.Test.Utilities/" date ("yyy-MM-dd") -// Throws exception if it Fails -let tryCreateTemporaryDirectory () = - let date() = DateTime.Now.ToString("yyyy-MM-dd") - let now() = $"{date()}-{Guid.NewGuid().ToString()}" - let directory = Path.Combine(Path.GetTempPath(), now()).Replace('-', '_') - Directory.CreateDirectory(directory).FullName - -// Create a temporaryFileName -- newGuid is random --- there is no point validating the file alread exists because: threading and Path.ChangeExtension() is commonly used after this API -let tryCreateTemporaryFileName () = - let directory = tryCreateTemporaryDirectory () - let fileName = ("Temp-" + Guid.NewGuid().ToString() + ".tmp").Replace('-', '_') - let filePath = Path.Combine(directory, fileName) - filePath - -// Create a temporaryFileName -- newGuid is random --- there is no point validating the file alread exists because: threading and Path.ChangeExtension() is commonly used after this API -let tryCreateTemporaryFileNameInDirectory (directory: DirectoryInfo) = - let fileName = ("Temp-" + Guid.NewGuid().ToString() + ".tmp").Replace('-', '_') - let filePath = Path.Combine(directory.FullName, fileName) - filePath +let getShortId() = Guid.NewGuid().ToString().[..7] + +// Temporary directory is TempPath + "/FSharp.Test.Utilities/yyy-MM-dd-xxxxxxx/" +let tempDirectoryOfThisTestRun = + let tempDir = Path.GetTempPath() + let today = DateTime.Now.ToString("yyyy-MM-dd") + DirectoryInfo(tempDir) + .CreateSubdirectory($"FSharp.Test.Utilities/{today}-{getShortId()}") + .FullName + +let createTemporaryDirectory (part: string) = + DirectoryInfo(tempDirectoryOfThisTestRun) + .CreateSubdirectory($"{part}-{getShortId()}") + .FullName + +let getTemporaryFileName () = + (createTemporaryDirectory "temp") ++ $"tmp_{getShortId()}" + +let getTemporaryFileNameInDirectory (directory: string) = + directory ++ $"tmp_{getShortId()}" + +// Well, this function is AI generated. +let rec copyDirectory (sourceDir: string) (destinationDir: string) (recursive: bool) = + // Get information about the source directory + let dir = DirectoryInfo(sourceDir) + + // Check if the source directory exists + if not dir.Exists then + raise (DirectoryNotFoundException($"Source directory not found: {dir.FullName}")) + + // Create the destination directory + Directory.CreateDirectory(destinationDir) |> ignore + + // Get the files in the source directory and copy to the destination directory + for file in dir.EnumerateFiles() do + let targetFilePath = Path.Combine(destinationDir, file.Name) + file.CopyTo(targetFilePath) |> ignore + + // If recursive and copying subdirectories, recursively call this method + if recursive then + for subDir in dir.EnumerateDirectories() do + let newDestinationDir = Path.Combine(destinationDir, subDir.Name) + copyDirectory subDir.FullName newDestinationDir true [] module Commands = @@ -46,8 +67,8 @@ module Commands = let commandLine = ResizeArray() let errorsList = ResizeArray() let outputList = ResizeArray() - let mutable errorslock = obj - let mutable outputlock = obj + let errorslock = obj() + let outputlock = obj() let outputDataReceived (message: string) = if not (isNull message) then lock outputlock (fun () -> outputList.Add(message)) @@ -211,12 +232,6 @@ module Commands = let peverify exec peverifyExe flags path = exec peverifyExe (sprintf "%s %s" (quotepath path) flags) - let createTempDir () = - let path = tryCreateTemporaryFileName () - File.Delete path - Directory.CreateDirectory path |> ignore - path - type TestConfig = { EnvironmentVariables : Map CSC : string @@ -302,7 +317,7 @@ let config configurationName envVars = let fsharpCoreArchitecture = "netstandard2.0" let fsharpBuildArchitecture = "netstandard2.0" let fsharpCompilerInteractiveSettingsArchitecture = "netstandard2.0" - let dotnetArchitecture = "net8.0" + let dotnetArchitecture = "net9.0" #if NET472 let fscArchitecture = "net472" let fsiArchitecture = "net472" @@ -463,29 +478,24 @@ let initializeSuite () = let suiteHelpers = lazy (initializeSuite ()) -[] -type public InitializeSuiteAttribute () = - inherit TestActionAttribute() +let testConfig sourceDir (relativePathToTestFixture: string) = + let cfg = suiteHelpers.Value + let testFixtureFullPath = Path.GetFullPath(sourceDir ++ relativePathToTestFixture) + + let description = relativePathToTestFixture.Split('\\', '/') |> String.concat "-" - override x.BeforeTest details = - try - if details.IsSuite - then suiteHelpers.Force() |> ignore - with - | e -> raise (Exception("failed test suite initialization, debug code in InitializeSuiteAttribute", e)) - override x.AfterTest _details = - () + let tempTestRoot = createTemporaryDirectory description + let tempTestDir = + DirectoryInfo(tempTestRoot) + .CreateSubdirectory(relativePathToTestFixture) + .FullName + copyDirectory testFixtureFullPath tempTestDir true - override x.Targets = ActionTargets.Test ||| ActionTargets.Suite + { cfg with Directory = tempTestDir } -let testConfig (testDir: string) = +let createConfigWithEmptyDirectory() = let cfg = suiteHelpers.Value - if not (Path.IsPathRooted testDir) then - failwith $"path is not rooted: {testDir}" - let testDir = Path.GetFullPath testDir // mostly used to normalize / and \ - log "------------------ %s ---------------" testDir - log "cd %s" testDir - { cfg with Directory = testDir } + { cfg with Directory = createTemporaryDirectory "temp" } [] type FileGuard(path: string) = diff --git a/tests/FSharp.Test.Utilities/Utilities.fs b/tests/FSharp.Test.Utilities/Utilities.fs index 897837c6bce..199f047dfd1 100644 --- a/tests/FSharp.Test.Utilities/Utilities.fs +++ b/tests/FSharp.Test.Utilities/Utilities.fs @@ -13,7 +13,7 @@ open System.Threading.Tasks open Microsoft.CodeAnalysis open Microsoft.CodeAnalysis.CSharp open TestFramework -open NUnit.Framework +open Xunit open System.Collections.Generic open FSharp.Compiler.CodeAnalysis open Newtonsoft.Json @@ -21,19 +21,19 @@ open Newtonsoft.Json.Linq type TheoryForNETCOREAPPAttribute() = - inherit Xunit.TheoryAttribute() + inherit TheoryAttribute() #if !NETCOREAPP do base.Skip <- "Only NETCOREAPP is supported runtime for this kind of test." #endif type FactForNETCOREAPPAttribute() = - inherit Xunit.FactAttribute() + inherit FactAttribute() #if !NETCOREAPP do base.Skip <- "Only NETCOREAPP is supported runtime for this kind of test." #endif type FactForDESKTOPAttribute() = - inherit Xunit.FactAttribute() + inherit FactAttribute() #if NETCOREAPP do base.Skip <- "NETCOREAPP is not supported runtime for this kind of test, it is intended for DESKTOP only" #endif @@ -299,7 +299,7 @@ let main argv = 0""" let directoryBuildTargetsFileName = Path.Combine(projectDirectory, "Directory.Build.targets") let frameworkReferencesFileName = Path.Combine(projectDirectory, "FrameworkReferences.txt") #if NETCOREAPP - File.WriteAllText(projectFileName, projectFile.Replace("$TARGETFRAMEWORK", "net8.0").Replace("$FSHARPCORELOCATION", pathToFSharpCore)) + File.WriteAllText(projectFileName, projectFile.Replace("$TARGETFRAMEWORK", "net9.0").Replace("$FSHARPCORELOCATION", pathToFSharpCore)) #else File.WriteAllText(projectFileName, projectFile.Replace("$TARGETFRAMEWORK", "net472").Replace("$FSHARPCORELOCATION", pathToFSharpCore)) #endif diff --git a/tests/README.md b/tests/README.md index a049313bd81..8f36be0195a 100644 --- a/tests/README.md +++ b/tests/README.md @@ -100,7 +100,7 @@ Existing FSharpQA and Cambridge need to be migrated to corresponding test projec ## Open questions: -* As far as I know, [FSharp.Compiler.Service](https://github.com/fsharp/FSharp.Compiler.Service) is dependant on some of the F# compiler tests. Does it have to be changed as well? +* As far as I know, [FSharp.Compiler.Service](https://github.com/fsharp/FSharp.Compiler.Service) is dependent on some of the F# compiler tests. Does it have to be changed as well? ## Other diff --git a/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.Runner/Runner.fs b/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.Runner/Runner.fs index 92f64645d30..c471060bdba 100644 --- a/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.Runner/Runner.fs +++ b/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.Runner/Runner.fs @@ -182,7 +182,7 @@ type RunConfig = BaseDir : string /// How many revisions should be checked out and built in parallel Parallelism : int - /// Name to suffx the benchmark result files with + /// Name to suffix the benchmark result files with ResultsSuffix : string /// Whether to build local codebases before benchmarking BuildLocalCodebases : bool diff --git a/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/runner.ipynb b/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/runner.ipynb index 4e27b1c39b7..b862fdaf4e5 100644 --- a/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/runner.ipynb +++ b/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/runner.ipynb @@ -18,7 +18,7 @@ "#r \"nuget: Plotly.NET.Interactive, 3.0.0\"\n", "#r \"nuget: LibGit2Sharp, 0.26.2\"\n", "#r \"nuget: BenchmarkDotnet, 0.13.1\"\n", - "#r \"../../../../artifacts/bin/HistoricalBenchmark.Runner/Release/net8.0/HistoricalBenchmark.Runner.dll\"\n", + "#r \"../../../../artifacts/bin/HistoricalBenchmark.Runner/Release/net9.0/HistoricalBenchmark.Runner.dll\"\n", "\n", "open HistoricalBenchmark.Runner\n", "\n", diff --git a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/BackgroundCompilerBenchmarks.fs b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/BackgroundCompilerBenchmarks.fs index ff67e1acabe..a49f4e39f11 100644 --- a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/BackgroundCompilerBenchmarks.fs +++ b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/BackgroundCompilerBenchmarks.fs @@ -106,7 +106,7 @@ type ParsingBenchmark() = let mutable checker: FSharpChecker = Unchecked.defaultof<_> let mutable parsingOptions: FSharpParsingOptions = Unchecked.defaultof<_> - let filePath = __SOURCE_DIRECTORY__ ++ ".." ++ ".." ++ ".." ++ ".." ++ "src" ++ "Compiler" ++ "Checking" ++ "CheckExpressions.fs" + let filePath = __SOURCE_DIRECTORY__ ++ ".." ++ ".." ++ ".." ++ ".." ++ "src" ++ "Compiler" ++ "Checking" ++ "Expressions" ++ "CheckExpressions.fs" let source = File.ReadAllText filePath |> SourceText.ofString [] diff --git a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/CompilerServiceBenchmarks.fs b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/CompilerServiceBenchmarks.fs index 44a0f9fdaaf..a3eb749868f 100644 --- a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/CompilerServiceBenchmarks.fs +++ b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/CompilerServiceBenchmarks.fs @@ -105,7 +105,7 @@ type CompilerServiceBenchmarks() = | Some _ -> configOpt | None -> let checker = FSharpChecker.Create(projectCacheSize = 200) - let path = __SOURCE_DIRECTORY__ ++ ".." ++ ".." ++ ".." ++ ".." ++ "src" ++ "Compiler" ++ "Checking" ++ "CheckExpressions.fs" + let path = __SOURCE_DIRECTORY__ ++ ".." ++ ".." ++ ".." ++ ".." ++ "src" ++ "Compiler" ++ "Checking" ++ "Expressions" ++ "CheckExpressions.fs" let source = FSharpSourceText.From(File.OpenRead(path), Encoding.Default, FSharpSourceHashAlgorithm.Sha1, true) let assemblies = AppDomain.CurrentDomain.GetAssemblies() diff --git a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/SomethingToCompile.fs b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/SomethingToCompile.fs index 6d3e9bd2cdd..345273cba56 100644 --- a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/SomethingToCompile.fs +++ b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/SomethingToCompile.fs @@ -654,7 +654,7 @@ module String = let uppercase (s: string) = s.ToUpperInvariant() // Scripts that distinguish between upper and lower case (bicameral) DU Discriminators and Active Pattern identifiers are required to start with an upper case character. - // For valid identifiers where the case of the identifier can not be determined because there is no upper and lower case we will allow DU Discriminators and upper case characters + // For valid identifiers where the case of the identifier cannot be determined because there is no upper and lower case we will allow DU Discriminators and upper case characters // to be used. This means that developers using unicameral scripts such as hindi, are not required to prefix these identifiers with an Upper case latin character. // let isLeadingIdentifierCharacterUpperCase (s: string) = diff --git a/tests/benchmarks/FCSBenchmarks/FCSSourceFiles/Program.fs b/tests/benchmarks/FCSBenchmarks/FCSSourceFiles/Program.fs index 7b716505156..6bbd617708c 100644 --- a/tests/benchmarks/FCSBenchmarks/FCSSourceFiles/Program.fs +++ b/tests/benchmarks/FCSBenchmarks/FCSSourceFiles/Program.fs @@ -641,10 +641,13 @@ module Project = __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\Compiler\Checking\QuotationTranslator.fs" __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\Compiler\Checking\PostInferenceChecks.fsi" __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\Compiler\Checking\PostInferenceChecks.fs" - __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\Compiler\Checking\CheckExpressions.fsi" - __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\Compiler\Checking\CheckExpressions.fs" - __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\Compiler\Checking\CheckComputationExpressions.fsi" - __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\Compiler\Checking\CheckComputationExpressions.fs" + __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\Compiler\Checking\Expressions\CheckExpressionsOps.fs" + __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\Compiler\Checking\Expressions\CheckExpressions.fsi" + __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\Compiler\Checking\Expressions\CheckExpressions.fs" + __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\Compiler\Checking\Expressions\CheckComputationExpressions.fsi" + __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\Compiler\Checking\Expressions\CheckComputationExpressions.fs" + __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\Compiler\Checking\Expressions\CheckSequenceExpressions.fs" + __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\Compiler\Checking\Expressions\CheckArrayOrListComputedExpressions.fs" __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\Compiler\Checking\CheckDeclarations.fsi" __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\Compiler\Checking\CheckDeclarations.fs" __SOURCE_DIRECTORY__ + @"\..\..\..\..\src\Compiler\Optimize\Optimizer.fsi" diff --git a/tests/benchmarks/FCSBenchmarks/decentlySizedStandAloneFile.fs b/tests/benchmarks/FCSBenchmarks/decentlySizedStandAloneFile.fs index deea6ccbaee..53412c942d1 100644 --- a/tests/benchmarks/FCSBenchmarks/decentlySizedStandAloneFile.fs +++ b/tests/benchmarks/FCSBenchmarks/decentlySizedStandAloneFile.fs @@ -8,7 +8,7 @@ original algorithm which only parsed languages which use expression-only grammar. The parsers is "impure" in the sense that is uses a ref-cell for storing the - input in the T<_, _, _> record class, this is soley for performance reasons + input in the T<_, _, _> record class, this is solely for performance reasons as it's to expensive to create a new record object for every consumed token. Certain functions also throw exceptions, which generally also is considered impure. @@ -56,7 +56,7 @@ (* Creates a string error snippet that points out the exact source position - where the error occured, for example: + where the error occurred, for example: 4: if(x == y) { 5: print'x equals y'); diff --git a/tests/benchmarks/README.md b/tests/benchmarks/README.md index dc304fed2ce..288309564aa 100644 --- a/tests/benchmarks/README.md +++ b/tests/benchmarks/README.md @@ -122,7 +122,7 @@ Here are the steps for creating benchmarks: match sourceOpt with | None -> - sourceOpt <- Some <| SourceText.ofString(File.ReadAllText("""C:\Users\vlza\code\fsharp\src\Compiler\Checking\CheckExpressions.fs""")) + sourceOpt <- Some <| SourceText.ofString(File.ReadAllText("""C:\Users\vlza\code\fsharp\src\Compiler\Checking\Expressions\CheckExpressions.fs""")) | _ -> () [] @@ -196,4 +196,3 @@ Here are the steps for creating benchmarks: 8. Repeat for any number of changes you would like to test. 9. **Optionally:** benchmark code and results can be included as part of the PR for future reference. - diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/BooleanLogic.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/BooleanLogic.fs index 55b02adf099..7d7ebba13fb 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/BooleanLogic.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/BooleanLogic.fs @@ -3,12 +3,11 @@ namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL open FSharp.Test -open NUnit.Framework +open Xunit -[] module BooleanLogic = - [] + [] let BooleanOrs() = CompilerAssert.CompileLibraryAndVerifyILWithOptions ([|"-g"; "--optimize+"|], """ @@ -54,7 +53,7 @@ let compute (x: int) = """ ])) -[] + // We had a regression in debug code regression where we were falsely marking pipelines // as non-side-effecting, causing them to be eliminated in loops. // @@ -63,7 +62,7 @@ let compute (x: int) = // 2. we don't eliminate loops anyway module DontEliminateForLoopsInDebugCode = - [] + [] // See https://github.com/dotnet/fsharp/pull/12021 let Regression12021() = CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"-g"; "--optimize-"|], diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/ByrefTailcalls.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/ByrefTailcalls.fs index fff363d406b..a3911244365 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/ByrefTailcalls.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/ByrefTailcalls.fs @@ -3,15 +3,14 @@ namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL open FSharp.Test -open NUnit.Framework +open Xunit open System open System.Threading.Tasks -[] module ByrefTailcalls = - [] + [] let ``check no tailcall to inref``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions([| "/optimize";"/tailcalls" |], """ diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/CeEdiThrow.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/CeEdiThrow.fs index cf9f65fecbb..2bdee531d90 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/CeEdiThrow.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/CeEdiThrow.fs @@ -2,13 +2,12 @@ namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL open FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test -[] module CeEdiThrow = - [] + [] let ``Emits EDI.Throw``() = CompilerAssert.CompileLibraryAndVerifyIL( """ diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/ComputationExpressionOptimizations.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/ComputationExpressionOptimizations.fs index ddf3ea41c90..ff2ebbcf55d 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/ComputationExpressionOptimizations.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/ComputationExpressionOptimizations.fs @@ -3,15 +3,15 @@ namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL open FSharp.Test -open NUnit.Framework +open Xunit open System #if !DEBUG // sensitive to debug-level code coming across from debug FSharp.Core -[] + module ComputationExpressionOptimizations = - [] + [] // See https://github.com/fsharp/fslang-design/blob/master/tooling/FST-1034-lambda-optimizations.md // // This tests a number of code optimizations cooperating together. @@ -19,7 +19,7 @@ module ComputationExpressionOptimizations = // - Computed functions must be reduced. // // This is for the "sync { ... }" builder that simply runs code synchronously - no - // one uses this in practice but it's a good baseline test for the elimination and redution of constructs. + // one uses this in practice but it's a good baseline test for the elimination and reduction of constructs. // let ``check reduction of sample builder for synchronous code``() = CompilerAssert.CompileLibraryAndVerifyIL( diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/ComputedListExpressions.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/ComputedListExpressions.fs index 184dc71facc..d32c0c9d630 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/ComputedListExpressions.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/ComputedListExpressions.fs @@ -3,12 +3,12 @@ namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL open FSharp.Test -open NUnit.Framework +open Xunit + -[] module ``ComputedListExpressions`` = - [] + [] let ``ComputedListExpression01``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"-g"; "--optimize-"|], """ @@ -35,7 +35,7 @@ let ListExpressionSteppingTest1 () = [ yield 1 ] """ ])) - [] + [] let ``ComputedListExpression02``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"-g"; "--optimize-"|], """ @@ -78,7 +78,7 @@ let ListExpressionSteppingTest2 () = """ ])) - [] + [] let ``ComputedListExpression03``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions( [|"-g"; "--optimize-"|], @@ -128,7 +128,7 @@ let ListExpressionSteppingTest3 () = """ ])) - [] + [] let ``ComputedListExpression04``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"-g"; "--optimize-"|], """ @@ -212,7 +212,7 @@ let ListExpressionSteppingTest4 () = """ ])) - [] + [] let ``ComputedListExpression05``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"-g"; "--optimize-"|], """ @@ -224,72 +224,58 @@ let ListExpressionSteppingTest5 () = """, (fun verifier -> verifier.VerifyIL [ """ -.method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - ListExpressionSteppingTest5() cil managed - { - - .maxstack 5 +.class public abstract auto ansi sealed ComputedListExpression05 + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ListExpressionSteppingTest5() cil managed + { + + .maxstack 4 .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, - class [runtime]System.Collections.Generic.IEnumerator`1 V_1, - class [runtime]System.Collections.Generic.IEnumerable`1 V_2, - int32 V_3, - class [runtime]System.IDisposable V_4) - IL_0000: nop - IL_0001: ldc.i4.1 - IL_0002: ldc.i4.1 - IL_0003: ldc.i4.4 - IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0009: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_000e: stloc.1 - .try - { - IL_000f: br.s IL_0031 - - IL_0011: ldloc.1 - IL_0012: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() - IL_0017: stloc.3 - IL_0018: ldstr "hello" - IL_001d: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) - IL_0022: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_0027: pop - IL_0028: ldloca.s V_0 - IL_002a: ldloc.3 - IL_002b: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) - IL_0030: nop - IL_0031: ldloc.1 - IL_0032: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() - IL_0037: brtrue.s IL_0011 + uint64 V_1, + int32 V_2, + int32 V_3) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.1 + IL_0003: ldc.i4.1 + IL_0004: stloc.2 + IL_0005: br.s IL_002b - IL_0039: ldnull - IL_003a: stloc.2 - IL_003b: leave.s IL_0052 + IL_0007: ldloca.s V_0 + IL_0009: ldloc.2 + IL_000a: stloc.3 + IL_000b: ldstr "hello" + IL_0010: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) + IL_0015: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_001a: pop + IL_001b: ldloc.3 + IL_001c: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0021: nop + IL_0022: ldloc.2 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.2 + IL_0026: ldloc.1 + IL_0027: ldc.i4.1 + IL_0028: conv.i8 + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.1 + IL_002c: ldc.i4.4 + IL_002d: conv.i8 + IL_002e: blt.un.s IL_0007 - } - finally - { - IL_003d: ldloc.1 - IL_003e: isinst [runtime]System.IDisposable - IL_0043: stloc.s V_4 - IL_0045: ldloc.s V_4 - IL_0047: brfalse.s IL_0051 + IL_0030: ldloca.s V_0 + IL_0032: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0037: ret + } - IL_0049: ldloc.s V_4 - IL_004b: callvirt instance void [runtime]System.IDisposable::Dispose() - IL_0050: endfinally - IL_0051: endfinally - } - IL_0052: ldloc.2 - IL_0053: pop - IL_0054: ldloca.s V_0 - IL_0056: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() - IL_005b: ret } - """ - ])) +"""])) - [] + [] let ``ComputedListExpression06``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"-g"; "--optimize-"|], """ diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/DebugScopes.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/DebugScopes.fs index b6bb427b336..4374e8491c9 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/DebugScopes.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/DebugScopes.fs @@ -3,12 +3,12 @@ namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL open FSharp.Test -open NUnit.Framework +open Xunit + -[] module DebugScopes = - [] + [] let SimpleFunction() = CompilerAssert.CompileLibraryAndVerifyDebugInfoWithOptions( [|"--debug:portable"; "--optimize-"; "--optimize-"|], @@ -20,7 +20,7 @@ let f x = 2 """) - [] + [] let SimpleShadowingFunction() = CompilerAssert.CompileLibraryAndVerifyDebugInfoWithOptions( [|"--debug:portable"; "--optimize-"; "--optimize-"|], @@ -34,7 +34,7 @@ let f x = 2 """) - [] + [] let ComplexShadowingFunction() = CompilerAssert.CompileLibraryAndVerifyDebugInfoWithOptions( [|"--debug:portable"; "--optimize-"; "--optimize-"|], diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/DelegateAndFuncOptimizations.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/DelegateAndFuncOptimizations.fs index 00966cab905..2b96a319740 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/DelegateAndFuncOptimizations.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/DelegateAndFuncOptimizations.fs @@ -3,13 +3,13 @@ namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL open FSharp.Test -open NUnit.Framework +open Xunit #if !DEBUG // sensitive to debug-level code coming across from debug FSharp.Core -[] + module DelegateAndFuncOptimizations = - [] + [] // See https://github.com/fsharp/fslang-design/blob/master/tooling/FST-1034-lambda-optimizations.md let ``Reduce function via InlineIfLambda``() = CompilerAssert.CompileLibraryAndVerifyIL( @@ -153,7 +153,7 @@ type C = """ ])) - [] + [] // See https://github.com/fsharp/fslang-design/blob/master/tooling/FST-1034-lambda-optimizations.md let ``Reduce delegate invoke via InlineIfLambda``() = CompilerAssert.CompileLibraryAndVerifyIL( @@ -301,7 +301,7 @@ type C = """ ])) - [] + [] // See https://github.com/fsharp/fslang-design/blob/master/tooling/FST-1034-lambda-optimizations.md let ``Reduce computed function invoke``() = CompilerAssert.CompileLibraryAndVerifyIL( @@ -341,7 +341,7 @@ let ApplyComputedFunction(c: int) = """ ])) - [] + [] // See https://github.com/fsharp/fslang-design/blob/master/tooling/FST-1034-lambda-optimizations.md let ``Reduce Computed Delegate``() = CompilerAssert.CompileLibraryAndVerifyIL( @@ -381,7 +381,7 @@ let ApplyComputedDelegate(c: int) = """ ])) - [] + [] // See https://github.com/fsharp/fslang-design/blob/master/tooling/FST-1034-lambda-optimizations.md let ``Reduce Computed Function with irreducible match``() = CompilerAssert.CompileLibraryAndVerifyIL( @@ -433,7 +433,7 @@ let ApplyComputedFunction(c: int) = """ ])) - [] + [] // See https://github.com/fsharp/fslang-design/blob/master/tooling/FST-1034-lambda-optimizations.md let ``Immediately apply computed function in sequential``() = CompilerAssert.CompileLibraryAndVerifyIL( @@ -492,8 +492,10 @@ let ApplyComputedFunction(c: int) = """ ])) - [] + [] // See https://github.com/fsharp/fslang-design/blob/master/tooling/FST-1034-lambda-optimizations.md + // See also https://github.com/dotnet/fsharp/issues/17607 for a regression caused by realsig+ becoming default + // This test case must keep using direct call to ReduceComputedDelegate, and not a FSharpFunc invocation. let ``Reduce Computed Delegate with let rec``() = CompilerAssert.CompileLibraryAndVerifyIL( """ @@ -524,7 +526,7 @@ let ApplyComputedDelegate(c: int) = IL_001d: ldc.i4.3 IL_001e: add IL_001f: ret -} + } """ ])) diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/DeterministicTests.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/DeterministicTests.fs index 6900827bb9b..057004ff01f 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/DeterministicTests.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/DeterministicTests.fs @@ -5,10 +5,10 @@ namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL open System.IO open FSharp.Test open FSharp.Test.Compiler -open NUnit.Framework +open Xunit + -[] module DeterministicTests = let commonOptions = ["--refonly";"--deterministic";"--nooptimizationdata"] @@ -37,7 +37,7 @@ let test() = Console.WriteLine("Hello World!")""" - let getMvid codeSnippet compileOptions = + let getMvid (codeSnippet: string) compileOptions = File.WriteAllText(inputPath, codeSnippet) let mvid1 = @@ -61,7 +61,7 @@ let test() = mvid1 , mvid2 - [] + [] let ``Simple assembly should be deterministic``() = File.WriteAllText(inputPath, basicCodeSnippet) @@ -71,55 +71,55 @@ let test() = |> compileGuid // Two identical compilations should produce the same MVID - Assert.AreEqual(getMvid(), getMvid()) + Assert.Equal(getMvid(), getMvid()) - [] + [] let ``Simple assembly with different platform should not be deterministic``() = let mvid1 = getMvid basicCodeSnippet ["--deterministic"] let mvid2 = getMvid basicCodeSnippet ["--deterministic";"--platform:Itanium"] // No two platforms should produce the same MVID - Assert.AreNotEqual(mvid1, mvid2) + Assert.NotEqual(mvid1, mvid2) - [] + [] let ``Simple reference assembly should be deterministic``() = let mvid1, mvid2 = calculateRefAssMvids basicCodeSnippet basicCodeSnippet - Assert.AreEqual(mvid1, mvid2) + Assert.Equal(mvid1, mvid2) - [] + [] let ``Simple reference assembly with different platform should not be deterministic``() = let mvid1 = getMvid basicCodeSnippet ["--refonly";"--deterministic"] let mvid2 = getMvid basicCodeSnippet ["--refonly";"--deterministic";"--platform:Itanium"] // No two platforms should produce the same MVID - Assert.AreNotEqual(mvid1, mvid2) + Assert.NotEqual(mvid1, mvid2) - [] - let ``False-positive reference assemblies test, different aseemblies' mvid should not match`` () = + [] + let ``False-positive reference assemblies test, different assemblies' mvid should not match`` () = let src2 = basicCodeSnippet.Replace("test()","test2()") let mvid1, mvid2 = calculateRefAssMvids basicCodeSnippet src2 - Assert.AreNotEqual(mvid1, mvid2) + Assert.NotEqual(mvid1, mvid2) - [] + [] let ``Reference assemblies should be deterministic when only private function name is different with the same function name length`` () = let privCode1 = basicCodeSnippet.Replace("privTest()","privTest1()") let privCode2 = basicCodeSnippet.Replace("privTest()","privTest2()") let mvid1, mvid2 = calculateRefAssMvids privCode1 privCode2 - Assert.AreEqual(mvid1, mvid2) + Assert.Equal(mvid1, mvid2) - [] + [] let ``Reference assemblies should be deterministic when only private function name is different with the different function name length`` () = let src2 = basicCodeSnippet.Replace("privTest()","privTest11()") let mvid1, mvid2 = calculateRefAssMvids basicCodeSnippet src2 - Assert.AreEqual(mvid1, mvid2) + Assert.Equal(mvid1, mvid2) - [] + [] let ``Reference assemblies should be deterministic when only private function body is different`` () = let src2 = basicCodeSnippet.Replace("""Console.WriteLine("Private Hello World!")""","""Console.Write("Private Hello World!")""") let mvid1, mvid2 = calculateRefAssMvids basicCodeSnippet src2 - Assert.AreEqual(mvid1, mvid2) + Assert.Equal(mvid1, mvid2) - [] + [] let ``Reference assemblies should be deterministic when only private function return type is different`` () = let src2 = @@ -135,9 +135,9 @@ let test() = Console.WriteLine() """ let mvid1, mvid2 = calculateRefAssMvids basicCodeSnippet src2 - Assert.AreEqual(mvid1, mvid2) + Assert.Equal(mvid1, mvid2) - [] + [] let ``Reference assemblies should be deterministic when only private function parameter count is different`` () = let src = """ @@ -166,9 +166,9 @@ let test() = """ let mvid1, mvid2 = calculateRefAssMvids src src2 - Assert.AreEqual(mvid1, mvid2) + Assert.Equal(mvid1, mvid2) - [] + [] let ``Reference assemblies should be deterministic when only private function parameter count is different and private function is unused`` () = let src = """ @@ -194,9 +194,9 @@ let test() = """ let mvid1, mvid2 = calculateRefAssMvids src src2 - Assert.AreEqual(mvid1, mvid2) + Assert.Equal(mvid1, mvid2) - [] + [] let ``Reference assemblies should be deterministic when only private function parameter types are different`` () = let src = """ @@ -225,9 +225,9 @@ let test() = """ let mvid1, mvid2 = calculateRefAssMvids src src2 - Assert.AreEqual(mvid1, mvid2) + Assert.Equal(mvid1, mvid2) - [] + [] let ``Reference assemblies should be deterministic when private function is missing in one of them`` () = let src = """ @@ -253,9 +253,9 @@ let test() = """ let mvid1, mvid2 = calculateRefAssMvids src src2 - Assert.AreEqual(mvid1, mvid2) + Assert.Equal(mvid1, mvid2) - [] + [] let ``Reference assemblies should be deterministic when inner function is removed`` () = let src = """ @@ -282,9 +282,9 @@ let test() = """ let mvid1, mvid2 = calculateRefAssMvids src src2 - Assert.AreEqual(mvid1, mvid2) + Assert.Equal(mvid1, mvid2) - [] + [] let ``Reference assemblies should be same when contents of quoted expression change`` () = let src = """ @@ -301,26 +301,26 @@ let foo () = <@ 2 + 3 @> """ let mvid1, mvid2 = calculateRefAssMvids src src2 - Assert.AreEqual(mvid1, mvid2) + Assert.Equal(mvid1, mvid2) - [] + [] let ``Reference assemblies must change when a must-inline function changes body`` () = let codeBefore = """module ReferenceAssembly let inline myFunc x y = x + y""" let codeAfter = codeBefore.Replace("+","-") let mvid1, mvid2 = calculateRefAssMvids codeBefore codeAfter - Assert.AreNotEqual(mvid1,mvid2) + Assert.NotEqual(mvid1,mvid2) - [] + [] let ``Reference assemblies must not change when a must-inline function does not change`` () = let codeBefore = """module ReferenceAssembly let inline myFunc x y = x - y""" let mvid1, mvid2 = calculateRefAssMvids codeBefore codeBefore - Assert.AreEqual(mvid1,mvid2) - + Assert.Equal(mvid1,mvid2) - [] // If IVT provided -> MVID must reflect internal binding - [] // No IVT => internal binding can be ignored for mvid purposes + [] + [] // If IVT provided -> MVID must reflect internal binding + [] // No IVT => internal binding can be ignored for mvid purposes let ``Reference assemblies MVID when having internal binding``(additionalSnippet:string, shouldBeStable:bool) = let codeAfter = basicCodeSnippet @@ -330,7 +330,6 @@ let inline myFunc x y = x - y""" let mvid1, mvid2 = calculateRefAssMvids basicCodeSnippet codeAfter if shouldBeStable then - Assert.AreEqual(mvid1,mvid2) + Assert.Equal(mvid1,mvid2) else - Assert.AreNotEqual(mvid1,mvid2) - + Assert.NotEqual(mvid1,mvid2) diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/Mutation.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/Mutation.fs index 2f7eb6de700..4030c65d302 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/Mutation.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/Mutation.fs @@ -4,16 +4,16 @@ namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL open FSharp.Compiler.UnitTests open FSharp.Test -open NUnit.Framework +open Xunit + -[] module ``Mutation`` = // Regression test for FSHARP1.0:1206 - [] + [] let ``Mutation 01``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions( - [|"-g"; "--optimize-"|], + [|"-g"; "--optimize-";"--realsig+"|], """ module Mutation01 type Test = struct @@ -45,10 +45,10 @@ type Test = struct """ ])) - [] + [] let ``Mutation 02``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions( - [|"-g"; "--optimize-"|], + [|"-g"; "--optimize-";"--realsig+"|], """ module Mutation02 let x = System.TimeSpan.MinValue @@ -56,48 +56,45 @@ x.ToString() """, (fun verifier -> verifier.VerifyIL [ """ - .method public specialname static valuetype [mscorlib]System.TimeSpan get_x() cil managed + .method public specialname static valuetype [runtime]System.TimeSpan get_x() cil managed { - + .maxstack 8 - IL_0000: ldsfld valuetype [mscorlib]System.TimeSpan ''.$Mutation02::x@3 + IL_0000: ldsfld valuetype [runtime]System.TimeSpan Mutation02::x@3 IL_0005: ret - } + } """ """ - .property valuetype [mscorlib]System.TimeSpan - x() + .method assembly specialname static void staticInitialization@() cil managed { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .get valuetype [mscorlib]System.TimeSpan Mutation02::get_x() - } - """ - """ -void .cctor() cil managed - { - - .maxstack 4 - .locals init (valuetype [runtime]System.TimeSpan V_0, - valuetype [runtime]System.TimeSpan V_1) + + .maxstack 3 + .locals init (valuetype [runtime]System.TimeSpan V_0) IL_0000: ldsfld valuetype [runtime]System.TimeSpan [runtime]System.TimeSpan::MinValue - IL_0005: dup - IL_0006: stsfld valuetype [runtime]System.TimeSpan ''.$Mutation02::x@3 - IL_000b: stloc.0 - IL_000c: call valuetype [runtime]System.TimeSpan Mutation02::get_x() - IL_0011: stloc.1 - IL_0012: ldloca.s V_1 - IL_0014: constrained. [runtime]System.TimeSpan - IL_001a: callvirt instance string [runtime]System.Object::ToString() - IL_001f: pop - IL_0020: ret - } + IL_0005: stsfld valuetype [runtime]System.TimeSpan Mutation02::x@3 + IL_000a: call valuetype [runtime]System.TimeSpan Mutation02::get_x() + IL_000f: stloc.0 + IL_0010: ldloca.s V_0 + IL_0012: constrained. [runtime]System.TimeSpan + IL_0018: callvirt instance string [runtime]System.Object::ToString() + IL_001d: pop + IL_001e: ret + } + """ + """ + .property valuetype [runtime]System.TimeSpan + x() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get valuetype [runtime]System.TimeSpan Mutation02::get_x() + } """ ])) - [] + [] let ``Mutation 03``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions( - [|"-g"; "--optimize-"|], + [|"-g"; "--optimize-";"--realsig+"|], """ module Mutation03 let x = System.DateTime.Now @@ -105,47 +102,44 @@ x.Day """, (fun verifier -> verifier.VerifyIL [ """ - .method public specialname static valuetype [mscorlib]System.DateTime get_x() cil managed + .method public specialname static valuetype [runtime]System.DateTime get_x() cil managed { - + .maxstack 8 - IL_0000: ldsfld valuetype [mscorlib]System.DateTime ''.$Mutation03::x@3 + IL_0000: ldsfld valuetype [runtime]System.DateTime Mutation03::x@3 IL_0005: ret - } + } """ """ - .property valuetype [mscorlib]System.DateTime + .property valuetype [runtime]System.DateTime x() { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .get valuetype [mscorlib]System.DateTime Mutation03::get_x() - } + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get valuetype [runtime]System.DateTime Mutation03::get_x() + } """ """ - void .cctor() cil managed + .method assembly specialname static void staticInitialization@() cil managed { - - .maxstack 4 - .locals init (valuetype [runtime]System.DateTime V_0, - valuetype [runtime]System.DateTime V_1) + + .maxstack 3 + .locals init (valuetype [runtime]System.DateTime V_0) IL_0000: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() - IL_0005: dup - IL_0006: stsfld valuetype [runtime]System.DateTime ''.$Mutation03::x@3 - IL_000b: stloc.0 - IL_000c: call valuetype [runtime]System.DateTime Mutation03::get_x() - IL_0011: stloc.1 - IL_0012: ldloca.s V_1 - IL_0014: call instance int32 [runtime]System.DateTime::get_Day() - IL_0019: pop - IL_001a: ret - } + IL_0005: stsfld valuetype [runtime]System.DateTime Mutation03::x@3 + IL_000a: call valuetype [runtime]System.DateTime Mutation03::get_x() + IL_000f: stloc.0 + IL_0010: ldloca.s V_0 + IL_0012: call instance int32 [runtime]System.DateTime::get_Day() + IL_0017: pop + IL_0018: ret + } """ ])) - [] + [] let ``Mutation 04``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions( - [|"-g"; "--optimize-"|], + [|"-g"; "--optimize-";"--realsig+"|], """ module Mutation04 let x = System.Decimal.MaxValue @@ -153,48 +147,45 @@ x.ToString() """, (fun verifier -> verifier.VerifyIL [ """ - .method public specialname static valuetype [mscorlib]System.Decimal get_x() cil managed + .method public specialname static valuetype [runtime]System.Decimal get_x() cil managed { - + .maxstack 8 - IL_0000: ldsfld valuetype [mscorlib]System.Decimal ''.$Mutation04::x@3 + IL_0000: ldsfld valuetype [runtime]System.Decimal Mutation04::x@3 IL_0005: ret - } + } """ """ - .property valuetype [mscorlib]System.Decimal + .property valuetype [runtime]System.Decimal x() { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .get valuetype [mscorlib]System.Decimal Mutation04::get_x() - } + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get valuetype [runtime]System.Decimal Mutation04::get_x() + } """ """ -void .cctor() cil managed + .method assembly specialname static void staticInitialization@() cil managed { - - .maxstack 4 - .locals init (valuetype [runtime]System.Decimal V_0, - valuetype [runtime]System.Decimal V_1) + + .maxstack 3 + .locals init (valuetype [runtime]System.Decimal V_0) IL_0000: ldsfld valuetype [runtime]System.Decimal [runtime]System.Decimal::MaxValue - IL_0005: dup - IL_0006: stsfld valuetype [runtime]System.Decimal ''.$Mutation04::x@3 - IL_000b: stloc.0 - IL_000c: call valuetype [runtime]System.Decimal Mutation04::get_x() - IL_0011: stloc.1 - IL_0012: ldloca.s V_1 - IL_0014: constrained. [runtime]System.Decimal - IL_001a: callvirt instance string [runtime]System.Object::ToString() - IL_001f: pop - IL_0020: ret - } + IL_0005: stsfld valuetype [runtime]System.Decimal Mutation04::x@3 + IL_000a: call valuetype [runtime]System.Decimal Mutation04::get_x() + IL_000f: stloc.0 + IL_0010: ldloca.s V_0 + IL_0012: constrained. [runtime]System.Decimal + IL_0018: callvirt instance string [runtime]System.Object::ToString() + IL_001d: pop + IL_001e: ret + } """ ])) - [] + [] let ``Mutation 05``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions( - [|"-g"; "--optimize-"|], + [|"-g"; "--optimize-";"--realsig+"|], """ module Mutation05 type C() = @@ -213,17 +204,17 @@ type StaticC() = (fun verifier -> verifier.VerifyIL [ """ .class auto ansi serializable nested public C - extends [mscorlib]System.Object + extends [runtime]System.Object { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) .field assembly int32 x - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.VolatileFieldAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.VolatileFieldAttribute::.ctor() = ( 01 00 00 00 ) .method public specialname rtspecialname instance void .ctor() cil managed { - + .maxstack 8 IL_0000: ldarg.0 - IL_0001: callvirt instance void [mscorlib]System.Object::.ctor() + IL_0001: callvirt instance void [runtime]System.Object::.ctor() IL_0006: ldarg.0 IL_0007: pop IL_0008: ldarg.0 @@ -231,58 +222,58 @@ type StaticC() = IL_000a: volatile. IL_000c: stfld int32 Mutation05/C::x IL_0011: ret - } + } .method public hidebysig specialname instance int32 get_X() cil managed { - + .maxstack 8 IL_0000: ldarg.0 IL_0001: volatile. IL_0003: ldfld int32 Mutation05/C::x IL_0008: ret - } + } .method public hidebysig specialname instance void set_X(int32 v) cil managed { - + .maxstack 8 IL_0000: ldarg.0 IL_0001: ldarg.1 IL_0002: volatile. IL_0004: stfld int32 Mutation05/C::x IL_0009: ret - } + } .property instance int32 X() { .set instance void Mutation05/C::set_X(int32) .get instance int32 Mutation05/C::get_X() - } - } + } + } """ """ .class auto ansi serializable nested public StaticC - extends [mscorlib]System.Object + extends [runtime]System.Object { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) .field static assembly int32 x - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.VolatileFieldAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.VolatileFieldAttribute::.ctor() = ( 01 00 00 00 ) .field static assembly int32 init@10 .method public specialname rtspecialname instance void .ctor() cil managed { - + .maxstack 8 IL_0000: ldarg.0 - IL_0001: callvirt instance void [mscorlib]System.Object::.ctor() + IL_0001: callvirt instance void [runtime]System.Object::.ctor() IL_0006: ldarg.0 IL_0007: pop IL_0008: ret - } + } .method public specialname static int32 get_X() cil managed { - + .maxstack 8 IL_0000: nop IL_0001: volatile. @@ -299,11 +290,11 @@ type StaticC() = IL_0015: volatile. IL_0017: ldsfld int32 Mutation05/StaticC::x IL_001c: ret - } + } .method public specialname static void set_X(int32 v) cil managed { - + .maxstack 8 IL_0000: nop IL_0001: volatile. @@ -321,33 +312,58 @@ type StaticC() = IL_0016: volatile. IL_0018: stsfld int32 Mutation05/StaticC::x IL_001d: ret - } + } .method private specialname rtspecialname static void .cctor() cil managed { - + .maxstack 8 IL_0000: ldc.i4.0 IL_0001: stsfld int32 ''.$Mutation05::init@ IL_0006: ldsfld int32 ''.$Mutation05::init@ IL_000b: pop IL_000c: ret - } + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: volatile. + IL_0003: stsfld int32 Mutation05/StaticC::x + IL_0008: ldc.i4.1 + IL_0009: volatile. + IL_000b: stsfld int32 Mutation05/StaticC::init@10 + IL_0010: ret + } .property int32 X() { .set void Mutation05/StaticC::set_X(int32) .get int32 Mutation05/StaticC::get_X() - } - } - """ - """ - IL_0000: ldc.i4.1 - IL_0001: volatile. - IL_0003: stsfld int32 Mutation05/StaticC::x - IL_0008: ldc.i4.1 - IL_0009: volatile. - IL_000b: stsfld int32 Mutation05/StaticC::init@10 - IL_0010: ret + } + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Mutation05::init@ + IL_0006: ldsfld int32 ''.$Mutation05::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void Mutation05/StaticC::staticInitialization@() + IL_0005: ret + } + +} """ ])) diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/ReferenceAssemblyTests.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/ReferenceAssemblyTests.fs index ddf93122ee3..e3803ce8437 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/ReferenceAssemblyTests.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/ReferenceAssemblyTests.fs @@ -3,16 +3,16 @@ namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL open FSharp.Test.Compiler -open NUnit.Framework +open Xunit open FSharp.Compiler.IO -[] + module ReferenceAssemblyTests = let referenceAssemblyAttributeExpectedIL = """.custom instance void [runtime]System.Runtime.CompilerServices.ReferenceAssemblyAttribute::.ctor() = ( 01 00 00 00 )""" - [] + [] let ``Simple reference assembly should have expected IL``() = let src = """ @@ -46,7 +46,7 @@ let test() = ] |> ignore - [] + [] let ``Simple reference assembly should have expected IL without a private function``() = let src = """ @@ -84,7 +84,7 @@ let test() = ] |> ignore - [] + [] let ``Simple reference assembly should have expected IL with anonymous record``() = let src = """ @@ -111,7 +111,7 @@ let test(_x: {| a: int32 |}) = ] |> ignore - [] + [] let ``Simple reference assembly with nested module should have expected IL``() = let src = """ @@ -153,7 +153,7 @@ module Nested = ] |> ignore - [] + [] let ``Simple reference assembly with nested module with type should have expected IL``() = let src = """ @@ -203,8 +203,7 @@ module Nested = IL_0001: throw } - .method public specialname rtspecialname - instance void .ctor(int32 x) cil managed + .method public specialname rtspecialname instance void .ctor(int32 x) cil managed { .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, class [runtime]System.Type) = ( 01 00 60 06 00 00 1D 52 65 66 65 72 65 6E 63 65 @@ -497,7 +496,7 @@ module Nested = #endif ] |> ignore - [] + [] let ``--refout should produce both normal and reference assemblies``() = // TODO: We probably want a built-in test framework functionality which will be taking care of comparing/verifying refout. let refoutDllPath = FileSystem.GetTempPathShim() + "Test.ref.dll" @@ -559,7 +558,7 @@ let test() = }""" ] - [] + [] let ``Internal DU type doesn't generate any properties/methods without IVT`` () = FSharp """ module ReferenceAssembly @@ -592,7 +591,7 @@ extends [runtime]System.Object } """] - [] + [] let ``Types with internal-only properties and methods don't generate anything without IVT`` () = FSharp """ module ReferenceAssembly @@ -629,7 +628,7 @@ extends [runtime]System.Object }"""] - [] + [] let ``Cli events are emitted even for CliEvent members which are not last in a file`` () = FSharp """ module LibraryWithTwoClassesAndTwoEvents @@ -727,7 +726,7 @@ type MyClass2() = .removeon instance void LibraryWithTwoClassesAndTwoEvents/MyClass2::remove_EventFromSecondType(class [runtime]System.EventHandler`1) """ ] - [] + [] let ``Properties are emitted for CliMutable records`` () = FSharp """ namespace ReferenceAssembly @@ -739,7 +738,7 @@ type [] MyRecord = { MyId: int }""" referenceAssemblyAttributeExpectedIL " .property instance int32 MyId()"] - [] + [] let ``Properties are emitted even for CliMutable records which are not last in a file`` () = FSharp """ namespace ReferenceAssembly @@ -754,7 +753,7 @@ type [] MySecondRecord = { MySecondId: strin " .property instance int32 MyId()" " .property instance string MySecondId()"] - [] // Regression https://github.com/dotnet/fsharp/issues/14088 . + [] // Regression https://github.com/dotnet/fsharp/issues/14088 . // Generated IL was assigning properties to the last record in file instead of where they are supposed to be let ``Properties are emitted for equal records in the same file`` () = FSharp """ @@ -905,7 +904,7 @@ type [] MySecondRecord = { Name: string } ] - [] + [] let ``Properties, getters, setters are emitted for internal properties`` () = FSharp """ module ReferenceAssembly @@ -1014,7 +1013,7 @@ type MySecondaryAttribute() = } """ ] - [] + [] let ``Internal and private fields are emitted for structs`` () = FSharp """ module ReferenceAssembly @@ -1043,7 +1042,7 @@ type AStruct = .custom instance void [FSharp.Core]Microsoft.FSharp.Core.DefaultValueAttribute::.ctor() = ( 01 00 00 00 ) }""" ] - [] + [] let ``Only public properties are emitted on non-IVT assemblies`` () = FSharp """ module ReferenceAssembly @@ -1118,7 +1117,7 @@ type MType() = } } """ ] - [] + [] let ``Only public events are emitted for non-IVT assembly`` () = FSharp """ module ReferenceAssembly @@ -1150,7 +1149,7 @@ type MType() = } """ ] - [] + [] let ``Internal constructor is emitted for attribute`` () = FSharp """ module ReferenceAssembly @@ -1216,9 +1215,7 @@ type Person(name : string, age : int) = extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) - .method public specialname rtspecialname - instance void .ctor(string name, - int32 age) cil managed + .method public specialname rtspecialname instance void .ctor(string name, int32 age) cil managed { .maxstack 8 @@ -1281,7 +1278,7 @@ type Person(name : string, age : int) = }""" ] - [] + [] let ``Internal constructor is emitted for attribute (with fsi)`` () = let fsSig = Fsi """ @@ -1380,7 +1377,7 @@ extends [runtime]System.Object } """ ] - [] + [] let ``Build .exe with --refonly ensure it produces a main in the ref assembly`` () = FSharp """module ReferenceAssembly open System @@ -1410,7 +1407,7 @@ Console.WriteLine("Hello World!")""" ] |> ignore #if NETCOREAPP - [] + [] #endif let ``Refassembly_emits_static_abstracts_implementations_the_same_way_it_does_for_instance_with_empty_signature`` () = @@ -1476,7 +1473,7 @@ type CompilerGoesBoom<'a>() = #if NETCOREAPP - [] + [] #endif let ``Refassembly_emits_static_abstracts_implementations_the_same_way_it_does_for_instance_with_signature`` () = let signature = """namespace Foobar diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticLinkTests.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticLinkTests.fs index 2349afe4fd6..a76c80a6dd9 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticLinkTests.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticLinkTests.fs @@ -6,12 +6,12 @@ open System.IO open System.Reflection open FSharp.Test open FSharp.Test.Utilities -open NUnit.Framework +open Xunit + -[] module StaticLinkTests = - [] + [] let ``Static link simple library``() = let module1 = let source = @@ -35,7 +35,7 @@ printfn "%A" y deps |> List.iter (fun dep -> try File.Delete dep with | _ -> ()))) - [] + [] let ``Simple exe should fail to execute if dependency was not found and is not statically linked``() = let module1 = let source = @@ -60,7 +60,7 @@ printfn "%A" y deps |> List.iter (fun dep -> try File.Delete dep with | _ -> ())))) |> ignore - [] + [] let ``Simple exe should execute if dependency was found and is not statically linked``() = let module1 = let source = @@ -81,7 +81,7 @@ printfn "%A" y CompilerAssert.Execute module2 - [] + [] let ``Static link quotes in multiple modules``() = let module1 = let source = @@ -105,7 +105,7 @@ type C() = [] static member F x = (C(), System.DateTime.Now) """ - Compilation.Create(source, Library, options = [|"--langversion:preview"|]) + Compilation.Create(source, Library, options = [| |]) let module2 = let source = @@ -154,7 +154,7 @@ else failwith "Test Failed" CompilerAssert.Execute(module2, ignoreWarnings=true) - [] + [] let ``Static link quotes in multiple modules - optimized``() = let module1 = let source = @@ -227,7 +227,7 @@ else failwith "Test Failed" CompilerAssert.Execute(module2, ignoreWarnings=true) - [] + [] let ``Standalone linking``() = let source = """ @@ -240,7 +240,7 @@ let _ = exit 0 let module1 = Compilation.Create(source, Exe, [|"--standalone"|]) CompilerAssert.Execute(module1, newProcess=true) - [] + [] let ``Standalone linking - optimized``() = let source = """ diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticMember.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticMember.fs index b3fb18b8c2e..464b7ca7d13 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticMember.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticMember.fs @@ -3,14 +3,14 @@ namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL open FSharp.Test -open NUnit.Framework +open Xunit + -[] module ``Static Member`` = - [] + [] let ``Action on Static Member``() = - CompilerAssert.CompileLibraryAndVerifyIL( + CompilerAssert.CompileLibraryAndVerifyILRealSig( """ module StaticMember01 @@ -22,27 +22,59 @@ type C = """, (fun verifier -> verifier.VerifyIL [ """ -.method public static class [runtime]System.Action - CreateAction() cil managed +.class public abstract auto ansi sealed StaticMember01 + extends [runtime]System.Object { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public C + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .class abstract auto autochar serializable sealed nested assembly beforefieldinit specialname CreateAction@8 + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) + .method assembly static void Invoke() cil managed + { + + .maxstack 8 + IL_0000: ret + } + + } + + .method public static void M() cil managed + { + + .maxstack 8 + IL_0000: ret + } + + .method public static class [runtime]System.Action CreateAction() cil managed + { + + .maxstack 8 + IL_0000: ldnull + IL_0001: ldftn void StaticMember01/C/CreateAction@8::Invoke() + IL_0007: newobj instance void [runtime]System.Action::.ctor(object, + native int) + IL_000c: ret + } + + } - .maxstack 8 - IL_0000: ldnull - IL_0001: ldftn void StaticMember01/CreateAction@8::Invoke() - IL_0007: newobj instance void [runtime]System.Action::.ctor(object, - native int) - IL_000c: ret -} - """ - """ -.class abstract auto autochar serializable sealed nested assembly beforefieldinit specialname CreateAction@8 +} + +.class private abstract auto ansi sealed ''.$StaticMember01 extends [runtime]System.Object +{ +} """ ])) - [] + [] let ``Action on Static Member with lambda``() = - CompilerAssert.CompileLibraryAndVerifyIL( + CompilerAssert.CompileLibraryAndVerifyILRealSig( """ module StaticMember02 @@ -54,27 +86,54 @@ type C = """, (fun verifier -> verifier.VerifyIL [ """ -.method public static class [runtime]System.Action`1 - CreateAction() cil managed +.class public abstract auto ansi sealed StaticMember02 + extends [runtime]System.Object { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public C + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .class abstract auto autochar serializable sealed nested assembly beforefieldinit specialname CreateAction@8 + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) + .method assembly static void Invoke(int32 x) cil managed + { + + .maxstack 8 + IL_0000: ret + } + + } + + .method public static void M(int32 x) cil managed + { + + .maxstack 8 + IL_0000: ret + } + + .method public static class [runtime]System.Action`1 CreateAction() cil managed + { + + .maxstack 8 + IL_0000: ldnull + IL_0001: ldftn void StaticMember02/C/CreateAction@8::Invoke(int32) + IL_0007: newobj instance void class [runtime]System.Action`1::.ctor(object, + native int) + IL_000c: ret + } - .maxstack 8 - IL_0000: ldnull - IL_0001: ldftn void StaticMember02/CreateAction@8::Invoke(int32) - IL_0007: newobj instance void class [runtime]System.Action`1::.ctor(object, - native int) - IL_000c: ret -} - """ - """ -.class abstract auto autochar serializable sealed nested assembly beforefieldinit specialname CreateAction@8 - extends [runtime]System.Object + } + +} """ ])) - [] + [] let ``Action on Static Member with closure``() = - CompilerAssert.CompileLibraryAndVerifyIL( + CompilerAssert.CompileLibraryAndVerifyILRealSig( """ module StaticMember03 @@ -95,38 +154,100 @@ let main _ = """, (fun verifier -> verifier.VerifyIL [ """ -.method public static int32 main(string[] _arg1) cil managed +.class public abstract auto ansi sealed StaticMember03 + extends [runtime]System.Object { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.EntryPointAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 4 - .locals init (class StaticMember03/MyClass V_0, - class [runtime]System.Action`1 V_1, - object V_2) - IL_0000: ldc.i4.7 - IL_0001: newobj instance void StaticMember03/MyClass::.ctor(int32) - IL_0006: stloc.0 - IL_0007: ldnull - IL_0008: ldftn void StaticMember03/func@15::Invoke(int32) - IL_000e: newobj instance void class [runtime]System.Action`1::.ctor(object, - native int) - IL_0013: stloc.1 - IL_0014: ldloc.1 - IL_0015: box class [runtime]System.Action`1 - IL_001a: stloc.2 - IL_001b: ldc.i4.0 - IL_001c: ret + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public C + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .method public static void M(int32 x) cil managed + { + + .maxstack 8 + IL_0000: ret + } + + } + + .class auto ansi serializable nested public MyClass + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .field assembly int32 x + .method public specialname rtspecialname instance void .ctor(int32 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: stfld int32 StaticMember03/MyClass::x + IL_000f: ret + } + + .method public hidebysig specialname instance int32 get_X() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 StaticMember03/MyClass::x + IL_0006: ret + } + + .property instance int32 X() + { + .get instance int32 StaticMember03/MyClass::get_X() + } + } + + .class abstract auto autochar serializable sealed nested assembly beforefieldinit specialname func@15 + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) + .method assembly static void Invoke(int32 x) cil managed + { + + .maxstack 8 + IL_0000: ret + } + + } + + .method public static int32 main(string[] _arg1) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.EntryPointAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (class StaticMember03/MyClass V_0, + class [runtime]System.Action`1 V_1, + object V_2) + IL_0000: ldc.i4.7 + IL_0001: newobj instance void StaticMember03/MyClass::.ctor(int32) + IL_0006: stloc.0 + IL_0007: ldnull + IL_0008: ldftn void StaticMember03/func@15::Invoke(int32) + IL_000e: newobj instance void class [runtime]System.Action`1::.ctor(object, + native int) + IL_0013: stloc.1 + IL_0014: ldloc.1 + IL_0015: box class [runtime]System.Action`1 + IL_001a: stloc.2 + IL_001b: ldc.i4.0 + IL_001c: ret + } + } - """ - """ -.class abstract auto autochar serializable sealed nested assembly beforefieldinit specialname func@15 - extends [runtime]System.Object """ ])) - [] + [] let ``Func on Static Member``() = - CompilerAssert.CompileLibraryAndVerifyIL( + CompilerAssert.CompileLibraryAndVerifyILRealSig( """ module StaticMember04 @@ -139,27 +260,60 @@ type C = """, (fun verifier -> verifier.VerifyIL [ """ -.method public static class [runtime]System.Func`2 - CreateFunc() cil managed +.class public abstract auto ansi sealed StaticMember04 + extends [runtime]System.Object { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public C + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .class abstract auto autochar serializable sealed nested assembly beforefieldinit specialname CreateFunc@9 + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) + .method assembly static int32 Invoke(int32 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: add + IL_0003: ret + } + + } + + .method public static int32 M(int32 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: add + IL_0003: ret + } + + .method public static class [runtime]System.Func`2 CreateFunc() cil managed + { + + .maxstack 8 + IL_0000: ldnull + IL_0001: ldftn int32 StaticMember04/C/CreateFunc@9::Invoke(int32) + IL_0007: newobj instance void class [runtime]System.Func`2::.ctor(object, + native int) + IL_000c: ret + } + + } - .maxstack 8 - IL_0000: ldnull - IL_0001: ldftn int32 StaticMember04/CreateFunc@9::Invoke(int32) - IL_0007: newobj instance void class [runtime]System.Func`2::.ctor(object, - native int) - IL_000c: ret -} - """ - """ -.class abstract auto autochar serializable sealed nested assembly beforefieldinit specialname CreateFunc@9 - extends [runtime]System.Object +} """ ])) - [] + [] let ``Func on Static Member with lambda``() = - CompilerAssert.CompileLibraryAndVerifyIL( + CompilerAssert.CompileLibraryAndVerifyILRealSig( """ module StaticMember05 @@ -172,27 +326,60 @@ type C = """, (fun verifier -> verifier.VerifyIL [ """ -.method public static class [runtime]System.Func`2 - CreateFunc() cil managed +.class public abstract auto ansi sealed StaticMember05 + extends [runtime]System.Object { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public C + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .class abstract auto autochar serializable sealed nested assembly beforefieldinit specialname CreateFunc@9 + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) + .method assembly static int32 Invoke(int32 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.s 43 + IL_0003: add + IL_0004: ret + } + + } + + .method public static int32 M(int32 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.s 43 + IL_0003: add + IL_0004: ret + } + + .method public static class [runtime]System.Func`2 CreateFunc() cil managed + { + + .maxstack 8 + IL_0000: ldnull + IL_0001: ldftn int32 StaticMember05/C/CreateFunc@9::Invoke(int32) + IL_0007: newobj instance void class [runtime]System.Func`2::.ctor(object, + native int) + IL_000c: ret + } + + } - .maxstack 8 - IL_0000: ldnull - IL_0001: ldftn int32 StaticMember05/CreateFunc@9::Invoke(int32) - IL_0007: newobj instance void class [runtime]System.Func`2::.ctor(object, - native int) - IL_000c: ret -} - """ - """ -.class abstract auto autochar serializable sealed nested assembly beforefieldinit specialname CreateFunc@9 - extends [runtime]System.Object +} """ ])) - [] + [] let ``Func on Static Member with closure``() = - CompilerAssert.CompileLibraryAndVerifyIL( + CompilerAssert.CompileLibraryAndVerifyILRealSig( """ module StaticMember06 @@ -245,9 +432,9 @@ let main _ = ])) #if !FX_NO_WINFORMS - [] + [] let ``EventHandler from Regression/83``() = - CompilerAssert.CompileLibraryAndVerifyIL( + CompilerAssert.CompileLibraryAndVerifyILRealSig( """ module StaticMember07 diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs index 492bb64bfc4..7fe5a0db4b4 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs @@ -3,7 +3,7 @@ namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL open FSharp.Test -open NUnit.Framework +open Xunit open System open System.Threading.Tasks @@ -12,7 +12,7 @@ open System.Threading.Tasks // The code generated changes slightly in debug mode #if !DEBUG // Check the exact code produced for tasks -[] + module TaskGeneratedCode = // This tests the exact optimized code generated for the MoveNext for a trivial task - we expect 'MoveNext' to be there @@ -26,10 +26,10 @@ module TaskGeneratedCode = // IL_000e: ldc.i4.1 // IL_000f: stfld int32 Test/testTask@4::Result - [] + [] let ``check MoveNext of simple task debug``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions( - [| "/langversion:preview";"/optimize-";"/debug:portable";"/tailcalls-" |], + [| "/optimize-"; "/debug:portable";"--realsig+"; "/tailcalls-" |], """ module Test @@ -113,10 +113,10 @@ let testTask() = task { return 1 } // IL_000e: ldc.i4.1 // IL_000f: stfld int32 Test/testTask@4::Result - [] + [] let ``check MoveNext of simple task optimized``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions( - [| "/langversion:preview";"/optimize+";"/debug:portable";"/tailcalls+" |], + [| "/optimize+"; "/debug:portable";"--realsig+"; "/tailcalls+" |], """ module Test @@ -187,10 +187,10 @@ let testTask() = task { return 1 } ])) - [] + [] let ``check MoveNext of simple binding task debug``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions( - [| "/langversion:preview"; "/debug:portable"; "/optimize-"; "/tailcalls-" |], + [| "/debug:portable";"--realsig+"; "/optimize-"; "/tailcalls-" |], """ module Test open System.Threading.Tasks @@ -367,10 +367,10 @@ let testTask(t: Task) = task { let! res = t in return res+1 } module TaskTryFinallyGeneration = - [] + [] let ``check MoveNext of task try/finally optimized``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions( - [| "/langversion:preview";"/optimize+";"/debug:portable";"/tailcalls+" |], + [| "/optimize+"; "/debug:portable";"--realsig+"; "/tailcalls+" |], """ module Test @@ -476,10 +476,10 @@ let testTask() = task { try 1+1 finally System.Console.WriteLine("finally") } ])) - [] + [] let ``check MoveNext of task try/finally debug``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions( - [| "/langversion:preview";"/optimize-";"/debug:portable";"/tailcalls-" |], + [| "/optimize-"; "/debug:portable";"--realsig+"; "/tailcalls-" |], """ module Test @@ -593,10 +593,10 @@ let testTask() = task { try 1+1 finally System.Console.WriteLine("finally") } module TaskTryWithGeneration = - [] + [] let ``check MoveNext of task try/with optimized``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions( - [| "/langversion:preview";"/optimize+";"/debug:portable";"/tailcalls+" |], + [| "/optimize+"; "/debug:portable";"--realsig+"; "/tailcalls+" |], """ module Test @@ -706,10 +706,10 @@ let testTask() = task { try 1 with e -> System.Console.WriteLine("finally"); 2 } ])) - [] + [] let ``check MoveNext of task try/with debug``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions( - [| "/langversion:preview";"/optimize-";"/debug:portable";"/tailcalls-" |], + [| "/optimize-"; "/debug:portable";"--realsig+"; "/tailcalls-" |], """ module Test @@ -826,10 +826,10 @@ let testTask() = task { try 1 with e -> System.Console.WriteLine("with"); 2 } module TaskWhileLoopGeneration = - [] + [] let ``check MoveNext of task while loop optimized``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions( - [| "/langversion:preview";"/optimize+";"/debug:portable";"/tailcalls+" |], + [| "/optimize+"; "/debug:portable";"--realsig+"; "/tailcalls+" |], """ module Test @@ -924,10 +924,10 @@ let testTask() = task { while x > 4 do System.Console.WriteLine("loop") } ])) - [] + [] let ``check MoveNext of task while loop debug``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions( - [| "/langversion:preview";"/optimize-";"/debug:portable";"/tailcalls-" |], + [| "/optimize-"; "/debug:portable";"--realsig+"; "/tailcalls-" |], """ module Test @@ -1027,10 +1027,10 @@ let testTask() = task { while x > 4 do System.Console.WriteLine("loop") } module TaskTypeInference = // This tests the compilation of a case that hits corner cases in SRTP constraint processing. // See https://github.com/dotnet/fsharp/issues/12188 - [] + [] let ``check initially ambiguous SRTP task code ``() = CompilerAssert.CompileExeAndRunWithOptions( - [| "/langversion:preview"; "/optimize-"; "/debug:portable";"/tailcalls-" |], + [| "/optimize-"; "/debug:portable";"--realsig+"; "/tailcalls-" |], """ module Test @@ -1047,10 +1047,10 @@ let myTuple : (string -> Task) * int = (fun (_s: string) -> Task.FromResul """) // Test task code in generic position - [] + [] let ``check generic task code ``() = CompilerAssert.CompileExeAndRunWithOptions( - [| "/langversion:preview";"/optimize-";"/debug:portable";"/tailcalls-" |], + [| "/optimize-"; "/debug:portable";"--realsig+"; "/tailcalls-" |], """ module Test @@ -1080,10 +1080,10 @@ printfn "test passed" #if !DEBUG - [] + [] let ``check generic task exact code``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions( - [| "/langversion:preview";"/optimize-";"/debug:portable";"/tailcalls-" |], + [| "/optimize-"; "/debug:portable";"--realsig+"; "/tailcalls-" |], """ module Test @@ -1096,207 +1096,295 @@ type Generic1InGeneric1<'T>() = """, (fun verifier -> verifier.VerifyIL [ """ - .method assembly hidebysig instance class [runtime]System.Threading.Tasks.Task`1 - run(class [runtime]System.Threading.Tasks.Task`1 computation) cil managed +.class public abstract auto ansi sealed Test + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public beforefieldinit Generic1InGeneric1`1 + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .class auto autochar sealed nested assembly beforefieldinit specialname clo@7 + extends [runtime]System.ValueType + implements [runtime]System.Runtime.CompilerServices.IAsyncStateMachine, + class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.IResumableStateMachine`1> + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) + .field public valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Data + .field public int32 ResumptionPoint + .field public class [runtime]System.Threading.Tasks.Task`1 computation + .field public valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 awaiter + .method public strict virtual instance void MoveNext() cil managed + { + .override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext + + .maxstack 5 + .locals init (int32 V_0, + class [runtime]System.Exception V_1, + bool V_2, + class [runtime]System.Threading.Tasks.Task`1 V_3, + bool V_4, + bool V_5, + !A V_6, + !A V_7, + valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 V_8, + class [runtime]System.Exception V_9, + class [runtime]System.Exception V_10) + IL_0000: ldarg.0 + IL_0001: ldfld int32 valuetype Test/Generic1InGeneric1`1/clo@7::ResumptionPoint + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: ldc.i4.1 + IL_0009: sub + IL_000a: switch ( + IL_0015) + IL_0013: br.s IL_0018 + + IL_0015: nop + IL_0016: br.s IL_001b + + IL_0018: nop + IL_0019: ldnull + IL_001a: stloc.1 + .try + { + IL_001b: ldloc.0 + IL_001c: ldc.i4.1 + IL_001d: sub + IL_001e: switch ( + IL_0029) + IL_0027: br.s IL_002c + + IL_0029: nop + IL_002a: br.s IL_0055 + + IL_002c: nop + IL_002d: ldarg.0 + IL_002e: ldfld class [runtime]System.Threading.Tasks.Task`1 valuetype Test/Generic1InGeneric1`1/clo@7::computation + IL_0033: stloc.3 + IL_0034: ldarg.0 + IL_0035: ldloc.3 + IL_0036: callvirt instance valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1 class [netstandard]System.Threading.Tasks.Task`1::GetAwaiter() + IL_003b: stfld valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter + IL_0040: ldc.i4.1 + IL_0041: stloc.s V_4 + IL_0043: ldarg.0 + IL_0044: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter + IL_0049: call instance bool valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1::get_IsCompleted() + IL_004e: brfalse.s IL_0052 + + IL_0050: br.s IL_006b + + IL_0052: ldc.i4.0 + IL_0053: brfalse.s IL_0059 + + IL_0055: ldc.i4.1 + IL_0056: nop + IL_0057: br.s IL_0062 + + IL_0059: ldarg.0 + IL_005a: ldc.i4.1 + IL_005b: stfld int32 valuetype Test/Generic1InGeneric1`1/clo@7::ResumptionPoint + IL_0060: ldc.i4.0 + IL_0061: nop + IL_0062: stloc.s V_5 + IL_0064: ldloc.s V_5 + IL_0066: stloc.s V_4 + IL_0068: nop + IL_0069: br.s IL_006c + + IL_006b: nop + IL_006c: ldloc.s V_4 + IL_006e: brfalse.s IL_0092 + + IL_0070: ldarg.0 + IL_0071: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter + IL_0076: call instance !0 valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1::GetResult() + IL_007b: stloc.s V_6 + IL_007d: ldloc.s V_6 + IL_007f: stloc.s V_7 + IL_0081: ldarg.0 + IL_0082: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_0087: ldloc.s V_7 + IL_0089: stfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result + IL_008e: ldc.i4.1 + IL_008f: nop + IL_0090: br.s IL_00ab + + IL_0092: ldarg.0 + IL_0093: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_0098: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder + IL_009d: ldarg.0 + IL_009e: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter + IL_00a3: ldarg.0 + IL_00a4: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::AwaitUnsafeOnCompleted,valuetype Test/Generic1InGeneric1`1/clo@7>(!!0&, + !!1&) + IL_00a9: ldc.i4.0 + IL_00aa: nop + IL_00ab: brfalse.s IL_00c1 + + IL_00ad: ldarg.0 + IL_00ae: ldloca.s V_8 + IL_00b0: initobj valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 + IL_00b6: ldloc.s V_8 + IL_00b8: stfld valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter + IL_00bd: ldc.i4.1 + IL_00be: nop + IL_00bf: br.s IL_00c3 + + IL_00c1: ldc.i4.0 + IL_00c2: nop + IL_00c3: stloc.2 + IL_00c4: ldloc.2 + IL_00c5: brfalse.s IL_00e4 + + IL_00c7: ldarg.0 + IL_00c8: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_00cd: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder + IL_00d2: ldarg.0 + IL_00d3: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_00d8: ldfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result + IL_00dd: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetResult(!0) + IL_00e2: leave.s IL_00f2 + + IL_00e4: leave.s IL_00f2 + + } + catch [runtime]System.Object + { + IL_00e6: castclass [runtime]System.Exception + IL_00eb: stloc.s V_9 + IL_00ed: ldloc.s V_9 + IL_00ef: stloc.1 + IL_00f0: leave.s IL_00f2 + + } + IL_00f2: ldloc.1 + IL_00f3: stloc.s V_10 + IL_00f5: ldloc.s V_10 + IL_00f7: brtrue.s IL_00fa + + IL_00f9: ret + + IL_00fa: ldarg.0 + IL_00fb: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_0100: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder + IL_0105: ldloc.s V_10 + IL_0107: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetException(class [netstandard]System.Exception) + IL_010c: ret + } + + .method public strict virtual instance void SetStateMachine(class [runtime]System.Runtime.CompilerServices.IAsyncStateMachine state) cil managed + { + .override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::SetStateMachine + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_0006: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder + IL_000b: ldarg.1 + IL_000c: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetStateMachine(class [netstandard]System.Runtime.CompilerServices.IAsyncStateMachine) + IL_0011: ret + } + + .method public strict virtual instance int32 get_ResumptionPoint() cil managed + { + .override method instance int32 class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.IResumableStateMachine`1>::get_ResumptionPoint() + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 valuetype Test/Generic1InGeneric1`1/clo@7::ResumptionPoint + IL_0006: ret + } + + .method public strict virtual instance valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 get_Data() cil managed + { + .override method instance !0 class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.IResumableStateMachine`1>::get_Data() + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_0006: ret + } + + .method public strict virtual instance void set_Data(valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 'value') cil managed + { + .override method instance void class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.IResumableStateMachine`1>::set_Data(!0) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stfld valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_0007: ret + } + + } + + .method public specialname rtspecialname instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + .method public hidebysig instance class [runtime]System.Threading.Tasks.Task`1 Run() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.3 + IL_0002: call class [runtime]System.Threading.Tasks.Task`1 [runtime]System.Threading.Tasks.Task::FromResult(!!0) + IL_0007: callvirt instance class [runtime]System.Threading.Tasks.Task`1 class Test/Generic1InGeneric1`1::run(class [runtime]System.Threading.Tasks.Task`1) + IL_000c: ret + } + + .method assembly hidebysig instance class [runtime]System.Threading.Tasks.Task`1 run(class [runtime]System.Threading.Tasks.Task`1 computation) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 4 - .locals init (valuetype Test/clo@7 V_0, - valuetype Test/clo@7& V_1) + .locals init (valuetype Test/Generic1InGeneric1`1/clo@7 V_0, + valuetype Test/Generic1InGeneric1`1/clo@7& V_1) IL_0000: ldloca.s V_0 - IL_0002: initobj valuetype Test/clo@7 + IL_0002: initobj valuetype Test/Generic1InGeneric1`1/clo@7 IL_0008: ldloca.s V_0 IL_000a: stloc.1 IL_000b: ldloc.1 IL_000c: ldarg.1 - IL_000d: stfld class [runtime]System.Threading.Tasks.Task`1 valuetype Test/clo@7::computation + IL_000d: stfld class [runtime]System.Threading.Tasks.Task`1 valuetype Test/Generic1InGeneric1`1/clo@7::computation IL_0012: ldloc.1 - IL_0013: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/clo@7::Data + IL_0013: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data IL_0018: call valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::Create() IL_001d: stfld valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder IL_0022: ldloc.1 - IL_0023: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/clo@7::Data + IL_0023: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data IL_0028: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder IL_002d: ldloc.1 - IL_002e: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::Start>(!!0&) + IL_002e: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::Start>(!!0&) IL_0033: ldloc.1 - IL_0034: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/clo@7::Data + IL_0034: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data IL_0039: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder IL_003e: call instance class [netstandard]System.Threading.Tasks.Task`1 valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::get_Task() IL_0043: ret } - """ - """ - .method public strict virtual instance void - MoveNext() cil managed - { - .override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext - - .maxstack 5 - .locals init (int32 V_0, - class [runtime]System.Exception V_1, - bool V_2, - class [runtime]System.Threading.Tasks.Task`1 V_3, - bool V_4, - bool V_5, - !A V_6, - !A V_7, - valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 V_8, - class [runtime]System.Exception V_9, - class [runtime]System.Exception V_10) - IL_0000: ldarg.0 - IL_0001: ldfld int32 valuetype Test/clo@7::ResumptionPoint - IL_0006: stloc.0 - IL_0007: ldloc.0 - IL_0008: ldc.i4.1 - IL_0009: sub - IL_000a: switch ( - IL_0015) - IL_0013: br.s IL_0018 - - IL_0015: nop - IL_0016: br.s IL_001b - - IL_0018: nop - IL_0019: ldnull - IL_001a: stloc.1 - .try - { - IL_001b: ldloc.0 - IL_001c: ldc.i4.1 - IL_001d: sub - IL_001e: switch ( - IL_0029) - IL_0027: br.s IL_002c - - IL_0029: nop - IL_002a: br.s IL_0055 - - IL_002c: nop - IL_002d: ldarg.0 - IL_002e: ldfld class [runtime]System.Threading.Tasks.Task`1 valuetype Test/clo@7::computation - IL_0033: stloc.3 - IL_0034: ldarg.0 - IL_0035: ldloc.3 - IL_0036: callvirt instance valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1 class [netstandard]System.Threading.Tasks.Task`1::GetAwaiter() - IL_003b: stfld valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/clo@7::awaiter - IL_0040: ldc.i4.1 - IL_0041: stloc.s V_4 - IL_0043: ldarg.0 - IL_0044: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/clo@7::awaiter - IL_0049: call instance bool valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1::get_IsCompleted() - IL_004e: brfalse.s IL_0052 - - IL_0050: br.s IL_006b - - IL_0052: ldc.i4.0 - IL_0053: brfalse.s IL_0059 - - IL_0055: ldc.i4.1 - IL_0056: nop - IL_0057: br.s IL_0062 - - IL_0059: ldarg.0 - IL_005a: ldc.i4.1 - IL_005b: stfld int32 valuetype Test/clo@7::ResumptionPoint - IL_0060: ldc.i4.0 - IL_0061: nop - IL_0062: stloc.s V_5 - IL_0064: ldloc.s V_5 - IL_0066: stloc.s V_4 - IL_0068: nop - IL_0069: br.s IL_006c - - IL_006b: nop - IL_006c: ldloc.s V_4 - IL_006e: brfalse.s IL_0092 - - IL_0070: ldarg.0 - IL_0071: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/clo@7::awaiter - IL_0076: call instance !0 valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1::GetResult() - IL_007b: stloc.s V_6 - IL_007d: ldloc.s V_6 - IL_007f: stloc.s V_7 - IL_0081: ldarg.0 - IL_0082: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/clo@7::Data - IL_0087: ldloc.s V_7 - IL_0089: stfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result - IL_008e: ldc.i4.1 - IL_008f: nop - IL_0090: br.s IL_00ab - - IL_0092: ldarg.0 - IL_0093: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/clo@7::Data - IL_0098: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_009d: ldarg.0 - IL_009e: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/clo@7::awaiter - IL_00a3: ldarg.0 - IL_00a4: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::AwaitUnsafeOnCompleted,valuetype Test/clo@7>(!!0&, - !!1&) - IL_00a9: ldc.i4.0 - IL_00aa: nop - IL_00ab: brfalse.s IL_00c1 - - IL_00ad: ldarg.0 - IL_00ae: ldloca.s V_8 - IL_00b0: initobj valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 - IL_00b6: ldloc.s V_8 - IL_00b8: stfld valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/clo@7::awaiter - IL_00bd: ldc.i4.1 - IL_00be: nop - IL_00bf: br.s IL_00c3 - - IL_00c1: ldc.i4.0 - IL_00c2: nop - IL_00c3: stloc.2 - IL_00c4: ldloc.2 - IL_00c5: brfalse.s IL_00e4 - - IL_00c7: ldarg.0 - IL_00c8: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/clo@7::Data - IL_00cd: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_00d2: ldarg.0 - IL_00d3: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/clo@7::Data - IL_00d8: ldfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result - IL_00dd: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetResult(!0) - IL_00e2: leave.s IL_00f2 - - IL_00e4: leave.s IL_00f2 - } - catch [runtime]System.Object - { - IL_00e6: castclass [runtime]System.Exception - IL_00eb: stloc.s V_9 - IL_00ed: ldloc.s V_9 - IL_00ef: stloc.1 - IL_00f0: leave.s IL_00f2 + } - } - IL_00f2: ldloc.1 - IL_00f3: stloc.s V_10 - IL_00f5: ldloc.s V_10 - IL_00f7: brtrue.s IL_00fa - - IL_00f9: ret - - IL_00fa: ldarg.0 - IL_00fb: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/clo@7::Data - IL_0100: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_0105: ldloc.s V_10 - IL_0107: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetException(class [netstandard]System.Exception) - IL_010c: ret - } +} """ ])) #endif #if NETCOREAPP -[] + module ``Check stack traces`` = - [] + [] let ``check stack trace of async exception from task``() = let t() = task { @@ -1319,20 +1407,20 @@ module ``Check stack traces`` = failwith "expected MoveNext() on stack trace" if stackTrace.Contains("End of stack trace from previous location") then - failwith "expected emit of CompilerGeneratedAtrtibute to suppress message in .NET Core stack walking " + failwith "expected emit of CompilerGeneratedAttribute to suppress message in .NET Core stack walking " #endif // Test that the SRTP Bind on a ValueTask is still generic in the bind type -[] + module ``Check return attributes`` = let incr (x:int) : [] (int -> int) = (fun a -> a + x) - // Putting a return atribute of any kind on f function should be respected + // Putting a return attribute of any kind on f function should be respected // If the function is curried its inferred arity should be no more than // the declared arguments (the F# rule that infers additional arguments // should not kick in). - [] + [] let ``check return attribute of curried function``() = match <@ incr 3 4 @> with | Quotations.Patterns.Application (Quotations.Patterns.Call(None, mi, [Quotations.DerivedPatterns.Int32 3]), Quotations.DerivedPatterns.Int32 4) -> diff --git a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/BasicConstants.fs b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/BasicConstants.fs index 1b24224e055..5606ff7bc79 100644 --- a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/BasicConstants.fs +++ b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/BasicConstants.fs @@ -2,14 +2,12 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test -open FSharp.Compiler.Diagnostics -[] module ``Basic Grammar Element Constants`` = - [] + [] let ``Basic constants compile `` () = CompilerAssert.Pass """ @@ -53,7 +51,7 @@ let boolConst2 = false let unitConst = () """ - [] + [] let ``Long with underscores``() = CompilerAssert.CompileExeAndRun """ @@ -66,7 +64,7 @@ printfn "%A" socialSecurityNumber printfn "%A" creditCardNumber """ - [] + [] let ``float 32 with underscores``() = CompilerAssert.CompileExeAndRun """ @@ -75,7 +73,7 @@ if pi <> 3.1415F then failwith "Wrong parsing" printfn "%A" pi """ - [] + [] let ``int with underscores hexBytes``() = CompilerAssert.CompileExeAndRun """ @@ -85,7 +83,7 @@ printfn "%A" hexBytes """ - [] + [] let ``int with underscore hexWords``() = CompilerAssert.CompileExeAndRun """ @@ -94,7 +92,7 @@ if hexWords <> 0xCAFEBABE then failwith "Wrong parsing" printfn "%A" hexWords """ - [] + [] let ``Long with underscores maxLong``() = CompilerAssert.CompileExeAndRun """ @@ -103,7 +101,7 @@ if maxLong <> 0x7fffffffffffffffL then failwith "Wrong parsing" printfn "%A" maxLong """ - [] + [] let ``int with underscore nybbles``() = CompilerAssert.CompileExeAndRun """ @@ -112,7 +110,7 @@ if nybbles <> 0b00100101 then failwith "Wrong parsing" printfn "%A" nybbles """ - [] + [] let ``int with underscores bytes``() = CompilerAssert.CompileExeAndRun """ @@ -121,7 +119,7 @@ if bytes <> 0b11010010011010011001010010010010 then failwith "Wrong parsing" printfn "%A" bytes """ - [] + [] let ``int with single underscore literal``() = CompilerAssert.CompileExeAndRun """ @@ -130,7 +128,7 @@ if x2 <> 52 then failwith "Wrong parsing" printfn "%A" x2 """ - [] + [] let ``int with multiple underscores literal``() = CompilerAssert.CompileExeAndRun """ @@ -139,7 +137,7 @@ if x4 <> 52 then failwith "Wrong parsing" printfn "%A" x4 """ - [] + [] let ``int with single underscore Hex literal``() = CompilerAssert.CompileExeAndRun """ @@ -149,7 +147,7 @@ if x7 <> 0x52 then printfn "%A" x7 """ - [] + [] let ``int with single underscore after leading zero literal``() = CompilerAssert.CompileExeAndRun """ @@ -158,8 +156,8 @@ if x9 <> 052 then failwith "Wrong parsing" printfn "%A" x9 """ - [] - let ``int with single underscore after leteral with leading zero ``() = + [] + let ``int with single underscore after literal with leading zero ``() = CompilerAssert.CompileExeAndRun """ let x10 = 05_2 @@ -167,15 +165,15 @@ if x10 <> 052 then failwith "Wrong parsing" printfn "%A" x10 """ - [] - let ``int with single underscore after octo leteral ``() = + [] + let ``int with single underscore after octo literal ``() = CompilerAssert.CompileExeAndRun """ let x14 = 0o5_2 if x14 <> 0o52 then failwith "Wrong parsing" printfn "%A" x14 """ - [] + [] let ``dotless float``() = CompilerAssert.CompileExeWithOptions([|"--langversion:5.0"|], """ @@ -183,35 +181,35 @@ let x = 42f printfn "%A" x """) - [] + [] let ``dotted float``() = CompilerAssert.CompileExe(""" let x = 42.f printfn "%A" x """) - [] + [] let ``dotted floats should be equal to dotless floats``() = CompilerAssert.CompileExeAndRunWithOptions([|"--langversion:5.0"|], """ if 1.0f <> 1f then failwith "1.0f <> 1f" """) - [] + [] let ``exponent dotted floats should be equal to dotted floats``() = CompilerAssert.CompileExeAndRun """ if 1.0e1f <> 10.f then failwith "1.0e1f <> 10.f" """ - [] + [] let ``exponent dotless floats should be equal to dotted floats``() = CompilerAssert.CompileExeAndRun """ if 1e1f <> 10.f then failwith "1e1f <> 10.f" """ - [] + [] let ``exponent dotted floats should be equal to dotless floats``() = CompilerAssert.CompileExeAndRunWithOptions( [|"--langversion:5.0"|], @@ -219,7 +217,7 @@ if 1e1f <> 10.f then failwith "1e1f <> 10.f" if 1.0e1f <> 10f then failwith "1.0e1f <> 10f" """) - [] + [] let ``exponent dotless floats should be equal to dotless floats``() = CompilerAssert.CompileExeAndRunWithOptions( [|"--langversion:5.0"|], diff --git a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/CharConstants.fs b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/CharConstants.fs index 0ff4375ce51..7f91ed7653b 100644 --- a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/CharConstants.fs +++ b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/CharConstants.fs @@ -2,20 +2,21 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit + -[] module ``Char Constants`` = - [] // alert - [] // backspace - [] // horizontal tab - [] // new line - [] // vertical tab - [] // form feed - [] // return - [] // double quote - [] // single quote - [] // backslash + [] + [] // alert + [] // backspace + [] // horizontal tab + [] // new line + [] // vertical tab + [] // form feed + [] // return + [] // double quote + [] // single quote + [] // backslash let ``Escape characters`` character value = Assert.areEqual character (char value) \ No newline at end of file diff --git a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/DecimalConstants.fs b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/DecimalConstants.fs index 4fd012f7a03..e40e1024006 100644 --- a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/DecimalConstants.fs +++ b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/DecimalConstants.fs @@ -2,19 +2,19 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit + -[] module ``Decimal Constants`` = - [] + [] let ``Product of decimal constants``() = let oneOfOneMiDec = 1.0E-6M let oneMiDec = 1.0E+6M Assert.areEqual 1.0M (oneOfOneMiDec * oneMiDec) - [] + [] let ``Sum of decimal constants``() = let x = 1.0E0M @@ -38,13 +38,13 @@ module ``Decimal Constants`` = Assert.areEqual 987654321.123456789M x - [] + [] let ``Sum of decimal literals with leading zero in exponential``() = let x = 1.0E00M + 2.0E01M + 3.E02M + 1.E-01M + 2.0E-02M Assert.areEqual 321.12M x - [] + [] let ``Non-representable small values are rounded to zero``() = // This test involves rounding of decimals. The F# design is to follow the BCL. // This means that the behavior is not deterministic, e.g. Mono and NetFx4 round; NetFx2 gives an error diff --git a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/IntegerConstants.fs b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/IntegerConstants.fs index a5be0ccde11..a91c92ae6e9 100644 --- a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/IntegerConstants.fs +++ b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/IntegerConstants.fs @@ -2,12 +2,12 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit + -[] module ``Integer Constants`` = - [] + [] let ``Operations with negative one``() = // Verify the ability to specify negative numbers // (And not get confused wrt subtraction.) @@ -19,7 +19,7 @@ module ``Integer Constants`` = Assert.areEqual 1 (x * x) Assert.areEqual 1 (x / x) - [] + [] let ``Operations with negative integers``() = // Verify the ability to specify negative numbers // (And not get confused wrt subtraction.) @@ -32,7 +32,7 @@ module ``Integer Constants`` = Assert.areEqual -2 fiveMinusSeven Assert.areEqual (-1 * 7) negativeSeven - [] + [] let ``Functions with negative integers``() = // Verify the ability to specify negative numbers // (And not get confused wrt subtraction.) diff --git a/tests/fsharp/Compiler/Conformance/DataExpressions/ComputationExpressions.fs b/tests/fsharp/Compiler/Conformance/DataExpressions/ComputationExpressions.fs index 09b64c6cb70..715a1e060a1 100644 --- a/tests/fsharp/Compiler/Conformance/DataExpressions/ComputationExpressions.fs +++ b/tests/fsharp/Compiler/Conformance/DataExpressions/ComputationExpressions.fs @@ -2,12 +2,11 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Test.Compiler open FSharp.Compiler.Diagnostics -[] module ``ComputationExpressions`` = let tmp = 1 @@ -183,13 +182,13 @@ let check msg actual expected = if actual <> expected then failwithf "FAILED %s, let includeMinimal = { includeMergeSourcesOverloads = false; includeBindReturnExtras=false } let ApplicativeLibTest opts source = - CompilerAssert.CompileExeAndRunWithOptions([| "/langversion:preview" |], (Source (applicativeLib opts + source))) + CompilerAssert.CompileExeAndRunWithOptions([| |], (Source (applicativeLib opts + source))) let ApplicativeLibErrorTest opts source errors = let lib = applicativeLib opts // Adjust the expected errors for the number of lines in the library let libLineAdjust = lib |> Seq.filter (fun c -> c = '\n') |> Seq.length - CompilerAssert.TypeCheckWithErrorsAndOptionsAndAdjust [| "/langversion:preview" |] libLineAdjust (lib + source) errors + CompilerAssert.TypeCheckWithErrorsAndOptionsAndAdjust [| |] libLineAdjust (lib + source) errors let ApplicativeLibErrorTestFeatureDisabled opts source errors = let lib = applicativeLib opts @@ -197,7 +196,7 @@ let check msg actual expected = if actual <> expected then failwithf "FAILED %s, let libLineAdjust = lib |> Seq.filter (fun c -> c = '\n') |> Seq.length CompilerAssert.TypeCheckWithErrorsAndOptionsAndAdjust [| "/langversion:4.7" |] libLineAdjust (lib + source) errors - [] + [] let ``AndBang TraceApplicative`` () = ApplicativeLibTest includeAll """ @@ -214,7 +213,7 @@ check "fewljvwerjl1" ceResult.Value 3 check "fewljvwerj12" (tracer.GetTrace ()) [|TraceOp.ApplicativeBind2Return|] """ - [] + [] let ``AndBang TraceApplicativeCustomOp`` () = ApplicativeLibTest includeAll """ @@ -232,7 +231,7 @@ check "fewljvwerjlvwe1" ceResult.Value 3 check "fewljvwerjvwe12" (tracer.GetTrace ()) [|TraceOp.ApplicativeBind2Return; TraceOp.Log "hello!";TraceOp.ApplicativeBindReturn|] """ - [] + [] let ``AndBang TraceApplicativeCustomOp Minimal`` () = ApplicativeLibTest includeMinimal """ @@ -250,7 +249,7 @@ check "fewljvwerjlvwe1" ceResult.Value 3 check "fewljvwerjvwe12" (tracer.GetTrace ()) [|TraceOp.MergeSources; TraceOp.ApplicativeBindReturn; TraceOp.Log "hello!";TraceOp.ApplicativeBindReturn|] """ - [] + [] let ``AndBang TraceApplicativeCustomOpTwice`` () = ApplicativeLibTest includeAll """ @@ -269,7 +268,7 @@ check "fewljvwerjlvwe1" ceResult.Value 3 check "fewljvwerjvwe12" (tracer.GetTrace ()) [|TraceOp.ApplicativeBind2Return; TraceOp.Log "hello!";TraceOp.Log "goodbye!";TraceOp.ApplicativeBindReturn|] """ - [] + [] let ``AndBang TraceApplicative Disable`` () = ApplicativeLibErrorTestFeatureDisabled includeAll """ @@ -284,7 +283,7 @@ let ceResult : Trace = """ [| FSharpDiagnosticSeverity.Error, 3344, (6, 9, 8, 35), "This feature is not supported in this version of F#. You may need to add /langversion:preview to use this feature." |] - [] + [] let ``AndBang TraceMultiBindingMonoid`` () = ApplicativeLibTest includeAll """ @@ -302,7 +301,7 @@ check "fewljvwerjl5" ceResult.Value [3; 5] check "fewljvwerj16" (tracer.GetTrace ()) [|TraceOp.Delay; TraceOp.MonadicBind2; TraceOp.ApplicativeYield; TraceOp.Delay; TraceOp.ApplicativeYield; TraceOp.ApplicativeCombine|] """ - [] + [] let ``AndBang TraceMultiBindingMonadic`` () = ApplicativeLibTest includeAll """ @@ -325,7 +324,7 @@ check "gwrhjkrwpoiwer1" ceResult.Value 3 check "gwrhjkrwpoiwer2" (tracer.GetTrace ()) [|TraceOp.MonadicBind; TraceOp.MonadicBind2; TraceOp.MonadicReturn|] """ - [] + [] let ``AndBang TraceMultiBindingMonadicCustomOp A`` () = ApplicativeLibTest includeAll """ @@ -340,7 +339,7 @@ let ceResult : Trace = check "gwrhjkrwpoiwer1t4" ceResult.Value 3 """ - [] + [] let ``AndBang TraceMultiBindingMonadicCustomOp B`` () = ApplicativeLibTest includeAll """ let tracer = TraceMultiBindingMonadicCustomOp() @@ -356,7 +355,7 @@ check "gwrhjkrwpoiwer1t45" ceResult.Value 3 check "gwrhjkrwpoiwer2t36" (tracer.GetTrace ()) [|TraceOp.MonadicBind2; TraceOp.MonadicReturn; TraceOp.Log "(3, true)"; TraceOp.MonadicBind; TraceOp.MonadicReturn |] """ - [] + [] let ``AndBang TraceMultiBindingMonadic TwoBind`` () = ApplicativeLibTest includeAll """ @@ -381,7 +380,7 @@ check "gwrhjkrwpoiwer38" ceResult.Value 3 check "gwrhjkrwpoiwer39" (tracer.GetTrace ()) [|TraceOp.MonadicBind; TraceOp.MonadicBind2; TraceOp.MonadicBind2; TraceOp.MonadicReturn|] """ - [] + [] let ``AndBang TraceApplicativeWithDelayAndRun`` () = ApplicativeLibTest includeAll """ @@ -398,7 +397,7 @@ check "vlkjrrlwevlk23" ceResult.Value 3 check "vlkjrrlwevlk24" (tracer.GetTrace ()) [|TraceOp.Delay; TraceOp.ApplicativeBind2Return; TraceOp.Run|] """ - [] + [] let ``AndBang TraceApplicativeWithDelay`` () = ApplicativeLibTest includeAll """ @@ -415,7 +414,7 @@ check "vlkjrrlwevlk23" ceResult.Value 3 check "vlkjrrlwevlk24" (tracer.GetTrace ()) [|TraceOp.Delay; TraceOp.ApplicativeBind2Return|] """ - [] + [] let ``AndBang TraceApplicativeWithDelay Minimal`` () = ApplicativeLibTest includeMinimal """ @@ -432,7 +431,7 @@ check "vlkjrrlwevlk23" ceResult.Value 3 check "vlkjrrlwevlk24" (tracer.GetTrace ()) [|TraceOp.Delay; TraceOp.MergeSources; TraceOp.ApplicativeBindReturn|] """ - [] + [] let ``AndBang TraceApplicativeWithRun`` () = ApplicativeLibTest includeAll """ @@ -450,7 +449,7 @@ check "vwerweberlk4" (tracer.GetTrace ()) [|TraceOp.ApplicativeBind2Return; Tra """ - [] + [] let ``AndBang TraceApplicative Size 3`` () = ApplicativeLibTest includeAll """ @@ -468,7 +467,7 @@ check "fewljvwerjl7" ceResult.Value 3 check "fewljvwerj18" (tracer.GetTrace ()) [|TraceOp.MergeSources3; TraceOp.ApplicativeBindReturn|] """ - [] + [] let ``AndBang TraceApplicative Size 3 minimal`` () = ApplicativeLibTest includeMinimal """ @@ -485,7 +484,7 @@ let ceResult = check "fewljvwerjl7" ceResult.Value 3 check "fewljvwerj18" (tracer.GetTrace ()) [|TraceOp.MergeSources; TraceOp.MergeSources; TraceOp.ApplicativeBindReturn|] """ - [] + [] let ``AndBang TraceApplicative Size 4`` () = ApplicativeLibTest includeAll """ @@ -504,7 +503,7 @@ check "fewljvwerjl191" ceResult.Value 3 check "fewljvwerj1192" (tracer.GetTrace ()) [|TraceOp.MergeSources4; TraceOp.ApplicativeBindReturn|] """ - [] + [] let ``AndBang TraceApplicative Size 5`` () = ApplicativeLibTest includeAll """ @@ -524,7 +523,7 @@ check "fewljvwerjl193" ceResult.Value 16 check "fewljvwerj1194" (tracer.GetTrace ()) [|TraceOp.MergeSources; TraceOp.MergeSources4; TraceOp.ApplicativeBindReturn|] """ - [] + [] let ``AndBang TraceApplicative Size 6`` () = ApplicativeLibTest includeAll """ @@ -545,7 +544,7 @@ check "fewljvwerjl195" ceResult.Value 25 check "fewljvwerj1196" (tracer.GetTrace ()) [|TraceOp.MergeSources3; TraceOp.MergeSources4; TraceOp.ApplicativeBindReturn|] """ - [] + [] let ``AndBang TraceApplicative Size 10`` () = ApplicativeLibTest includeAll """ @@ -571,7 +570,7 @@ check "fewljvwerj1198" (tracer.GetTrace ()) [|TraceOp.MergeSources4; TraceOp.Mer """ - [] + [] let ``AndBang Negative TraceApplicative missing MergeSources`` () = ApplicativeLibErrorTest includeAll """ let tracer = TraceApplicativeNoMergeSources() @@ -585,7 +584,7 @@ let _ = """ [|(FSharpDiagnosticSeverity.Error, 3343, (6, 9, 6, 25), "The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a 'Bind2' method or appropriate 'MergeSources' and 'Bind' methods")|] - [] + [] let ``AndBang Negative TraceApplicative missing Bind and BindReturn`` () = ApplicativeLibErrorTest includeAll """ let tracer = TraceApplicativeNoBindReturn() @@ -600,7 +599,7 @@ let _ = [|(FSharpDiagnosticSeverity.Error, 708, (6, 9, 6, 25), "This control construct may only be used if the computation expression builder defines a 'Bind' method")|] - [] + [] let ``AndBang Negative TraceApplicative with bad construct`` () = ApplicativeLibErrorTest includeAll """ @@ -615,7 +614,7 @@ let _ = """ [| FSharpDiagnosticSeverity.Error, 708, (7, 9, 7, 25), "This control construct may only be used if the computation expression builder defines a 'Bind' method" |] - [] + [] let ``AndBang TraceApplicative with do-bang`` () = ApplicativeLibErrorTest includeAll """ let tracer = TraceApplicative() @@ -632,8 +631,8 @@ let _ = (FSharpDiagnosticSeverity.Error, 604, (5, 12, 5, 13), "Unmatched '{'"); (FSharpDiagnosticSeverity.Error, 10, (8, 9, 8, 13), "Unexpected keyword 'and!' in implementation file")|] - [] - let ``AndBang Negative TraceApplicative let betweeen let! and and!`` () = + [] + let ``AndBang Negative TraceApplicative let between let! and and!`` () = ApplicativeLibErrorTest includeAll """ let tracer = TraceApplicative() @@ -648,7 +647,7 @@ let _ = [| (FSharpDiagnosticSeverity.Error, 10, (8, 9, 8, 13), "Unexpected keyword 'and!' in expression") |] - [] + [] let ``AndBang Negative TraceApplicative no return`` () = ApplicativeLibErrorTest includeAll """ let tracer = TraceApplicative() @@ -661,7 +660,7 @@ let _ = """ [|(FSharpDiagnosticSeverity.Error, 10, (8, 5, 8, 6), "Unexpected symbol '}' in expression")|] - [] + [] let ``AndBang TraceApplicative conditional return`` () = ApplicativeLibTest includeAll """ let tracer = TraceApplicative() @@ -678,7 +677,7 @@ let ceResult = check "grwerjkrwejgk" ceResult.Value 2 """ - [] + [] let ``AndBang TraceApplicative match return`` () = ApplicativeLibTest includeAll """ let tracer = TraceApplicative() @@ -694,7 +693,7 @@ let ceResult = check "grwerjkrwejgk42" ceResult.Value 2 """ - [] + [] let ``AndBang TraceApplicative incomplete match return`` () = ApplicativeLibTest includeAll """ #nowarn "25" @@ -785,9 +784,9 @@ let check msg actual expected = if actual <> expected then failwithf "FAILED %s, """ let OverloadLibTest inclInternalExt inclExternalExt source = - CompilerAssert.CompileExeAndRunWithOptions([| "/langversion:preview" |], (Source (overloadLib inclInternalExt inclExternalExt + source))) + CompilerAssert.CompileExeAndRunWithOptions([| |], (Source (overloadLib inclInternalExt inclExternalExt + source))) - [] + [] let ``OverloadLib accepts overloaded methods`` () = OverloadLibTest false false """ let mem = new System.IO.MemoryStream("Stream"B) @@ -804,7 +803,7 @@ let ceResult = check "TmFtZVxyXG5FbWF1" ceResult "Name\r\nEmail\r\nsswo\r\nBYTES\r\nStream\r\nDescription\r\nof\r\ncontent\r\n"B """ - [] + [] let ``OverloadLib accepts overloaded internal extension methods`` () = OverloadLibTest true false """ let mem = new System.IO.MemoryStream("Stream"B) @@ -821,7 +820,7 @@ let ceResult = check "TmFtZVxyXG5FbWF2" ceResult "Name\r\nEmail\r\nsswo\r\nBYTES\r\nStream\r\nDescription\r\nof\r\ncontent\r\n"B """ - [] + [] let ``OverloadLib accepts overloaded internal and external extensions`` () = OverloadLibTest true true """ let mem = new System.IO.MemoryStream("Stream"B) diff --git a/tests/fsharp/Compiler/Language/AnonRecordTests.fs b/tests/fsharp/Compiler/Language/AnonRecordTests.fs index fd7535d0079..57f50937fc1 100644 --- a/tests/fsharp/Compiler/Language/AnonRecordTests.fs +++ b/tests/fsharp/Compiler/Language/AnonRecordTests.fs @@ -2,14 +2,14 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Compiler.Diagnostics -[] + module AnonRecordsTests = - [] + [] let NotStructConstraintPass() = CompilerAssert.Pass """ @@ -17,7 +17,7 @@ type RefClass<'a when 'a : not struct>() = class end let rAnon = RefClass<{| R: int |}>() """ - [] + [] let StructConstraintPass() = CompilerAssert.Pass """ @@ -25,7 +25,7 @@ type StructClass<'a when 'a : struct>() = class end let sAnon = StructClass() """ - [] + [] let NotStructConstraintFail() = CompilerAssert.TypeCheckSingleError """ @@ -37,7 +37,7 @@ let rAnon = RefClass() (3, 13, 3, 42) "A generic construct requires that the type 'struct {| R: int |}' have reference semantics, but it does not, i.e. it is a struct" - [] + [] let StructConstraintFail() = CompilerAssert.TypeCheckSingleError """ diff --git a/tests/fsharp/Compiler/Language/ComparisonOptimizationTest.fs b/tests/fsharp/Compiler/Language/ComparisonOptimizationTest.fs index 4fad1c2faef..5099728921e 100644 --- a/tests/fsharp/Compiler/Language/ComparisonOptimizationTest.fs +++ b/tests/fsharp/Compiler/Language/ComparisonOptimizationTest.fs @@ -1,13 +1,12 @@ namespace FSharp.Compiler.UnitTests open System -open NUnit.Framework +open Xunit open FSharp.Test -[] module ComparisonOptimizationTests = - [] + [] let Script_Compare_int() = let script = """ @@ -36,7 +35,7 @@ let f (x: int) (y: int) = compare x y ) ) - [] + [] let Script_Compare_uint() = let script = """ @@ -65,7 +64,7 @@ let f (x: uint) (y: uint) = compare x y ) ) - [] + [] let Script_Compare_int64() = let script = """ @@ -94,7 +93,7 @@ let f (x: int64) (y: int64) = compare x y ) ) - [] + [] let Script_Compare_uint64() = let script = """ @@ -124,7 +123,7 @@ let f (x: uint64) (y: uint64) = compare x y ) - [] + [] let Script_Compare_int16() = let script = """ @@ -153,7 +152,7 @@ let f (x: int16) (y: int16) = compare x y ) ) - [] + [] let Script_Compare_uint16() = let script = """ @@ -182,7 +181,7 @@ let f (x: uint16) (y: uint16) = compare x y ) ) - [] + [] let Script_Compare_byte() = let script = """ @@ -212,7 +211,7 @@ let f (x: byte) (y: byte) = compare x y ) - [] + [] let Script_Compare_sbyte() = let script = """ @@ -242,7 +241,7 @@ let f (x: sbyte) (y: sbyte) = compare x y ) - [] + [] let Script_Compare_char() = let script = """ @@ -271,7 +270,7 @@ let f (x: char) (y: char) = compare x y ) ) - [] + [] let Script_Compare_bool() = let script = """ @@ -307,7 +306,7 @@ let f (x: bool) (y: bool) = compare x y let areSameSign (x: int) (y: int) = Math.Sign(x) |> Assert.areEqual (Math.Sign(y)) - [] + [] let Check_equivalence_with_CompareTo() = let rnd = Random() for i in 0 .. 1000 do @@ -318,7 +317,7 @@ let f (x: bool) (y: bool) = compare x y - [] + [] let Check_limit_case_equivalence_with_CompareTo_int32() = let values = [0; 1; -1; Int32.MinValue; Int32.MaxValue; Int32.MinValue+1; Int32.MaxValue-1] @@ -326,7 +325,7 @@ let f (x: bool) (y: bool) = compare x y for y in values do compare x y |> Assert.areSameSign (x.CompareTo(y)) - [] + [] let Check_limit_case_equivalence_with_CompareTo_uint32() = let values = [0u; 1u; UInt32.MaxValue; UInt32.MaxValue-1u] @@ -334,7 +333,7 @@ let f (x: bool) (y: bool) = compare x y for y in values do compare x y |> Assert.areSameSign (x.CompareTo(y)) - [] + [] let Check_limit_case_equivalence_with_CompareTo_int64() = let values = [0L; 1L; -1L; Int64.MinValue; Int64.MaxValue; Int64.MinValue+1L; Int64.MaxValue-1L] @@ -342,7 +341,7 @@ let f (x: bool) (y: bool) = compare x y for y in values do compare x y |> Assert.areSameSign (x.CompareTo(y)) - [] + [] let Check_limit_case_equivalence_with_CompareTo_uint64() = let values = [0UL; 1UL; UInt64.MaxValue; UInt64.MaxValue-1UL] @@ -350,7 +349,7 @@ let f (x: bool) (y: bool) = compare x y for y in values do compare x y |> Assert.areSameSign (x.CompareTo(y)) - [] + [] let Check_limit_case_equivalence_with_CompareTo_int16() = let values = [0s; 1s; -1s; Int16.MinValue; Int16.MaxValue; Int16.MinValue+1s; Int16.MaxValue-1s] @@ -358,7 +357,7 @@ let f (x: bool) (y: bool) = compare x y for y in values do compare x y |> Assert.areSameSign (x.CompareTo(y)) - [] + [] let Check_limit_case_equivalence_with_CompareTo_uint16() = let values = [0us; 1us; UInt16.MaxValue; UInt16.MaxValue-1us] @@ -367,7 +366,7 @@ let f (x: bool) (y: bool) = compare x y compare x y |> Assert.areSameSign (x.CompareTo(y)) - [] + [] let Check_limit_case_equivalence_with_CompareTo_sbyte() = let values = [0y; 1y; -1y; SByte.MinValue; SByte.MaxValue; SByte.MinValue+1y; SByte.MaxValue-1y] @@ -375,7 +374,7 @@ let f (x: bool) (y: bool) = compare x y for y in values do compare x y |> Assert.areSameSign (x.CompareTo(y)) - [] + [] let Check_limit_case_equivalence_with_CompareTo_byte() = let values = [0uy; 1uy; Byte.MaxValue; Byte.MaxValue-1uy] @@ -383,7 +382,7 @@ let f (x: bool) (y: bool) = compare x y for y in values do compare x y |> Assert.areSameSign (x.CompareTo(y)) - [] + [] let Check_limit_case_equivalence_with_CompareTo_char() = let values = [Char.MinValue; Char.MinValue+char 1 ; Char.MaxValue; Char.MaxValue+char -1] @@ -391,7 +390,7 @@ let f (x: bool) (y: bool) = compare x y for y in values do compare x y |> Assert.areSameSign (x.CompareTo(y)) - [] + [] let Check_limit_case_equivalence_with_CompareTo_bool() = let values = [false; true] diff --git a/tests/fsharp/Compiler/Language/CompilerDirectiveTests.fs b/tests/fsharp/Compiler/Language/CompilerDirectiveTests.fs index d47cff9905d..7ddfc34e2fe 100644 --- a/tests/fsharp/Compiler/Language/CompilerDirectiveTests.fs +++ b/tests/fsharp/Compiler/Language/CompilerDirectiveTests.fs @@ -2,14 +2,14 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Compiler.Diagnostics -[] + module ``Test Compiler Directives`` = - [] + [] let ``compiler #r "" is invalid``() = let source = """ #r "" @@ -20,7 +20,7 @@ module ``Test Compiler Directives`` = FSharpDiagnosticSeverity.Warning, 213, (2,1,2,6), "'' is not a valid assembly name" |]) - [] + [] let ``compiler #r " " is invalid``() = let source = """ #r " " diff --git a/tests/fsharp/Compiler/Language/ComputationExpressionTests.fs b/tests/fsharp/Compiler/Language/ComputationExpressionTests.fs index 583c1c31e99..1994e86590c 100644 --- a/tests/fsharp/Compiler/Language/ComputationExpressionTests.fs +++ b/tests/fsharp/Compiler/Language/ComputationExpressionTests.fs @@ -1,10 +1,10 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Compiler.Diagnostics -[] + module ComputationExpressionTests = let ``complex CE with source member and applicatives`` ceUsage = @@ -159,7 +159,7 @@ let asyncResult = AsyncResultBuilder() %s""" ceUsage - [] + [] let ``do-bang can be used with nested CE expressions``() = let code = ``complex CE with source member and applicatives`` """ asyncResult { @@ -175,7 +175,7 @@ asyncResult { """ CompilerAssert.Pass code - [] + [] let ``match-bang should apply source transformations to its inputs`` () = let code = ``complex CE with source member and applicatives`` """ asyncResult { diff --git a/tests/fsharp/Compiler/Language/CustomCollectionTests.fs b/tests/fsharp/Compiler/Language/CustomCollectionTests.fs index b1ff29a2a1d..0d1aa07d5e1 100644 --- a/tests/fsharp/Compiler/Language/CustomCollectionTests.fs +++ b/tests/fsharp/Compiler/Language/CustomCollectionTests.fs @@ -1,12 +1,12 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Compiler.Diagnostics -[] + module CustomCollectionTests = - [] + [] let ``Custom collection with Item and GetReverseIndex should support reverse index mutation``() = CompilerAssert.CompileExeAndRunWithOptions( [| "--langversion:preview" |], @@ -23,7 +23,7 @@ a[^"2"] <- "-1" if a["2"] <> "2 -1" then failwithf "expected 2 -1 but got %A" a["2"] """) - [] + [] let ``Custom collection with GetSlice and GetReverseIndex should support reverse index set slicing``() = CompilerAssert.CompileExeAndRunWithOptions( [| "--langversion:preview" |], @@ -41,7 +41,7 @@ a[^"2"..^"1"] <- "-1" if a["2".."1"] <> "2 1 -1" then failwithf "expected 2 1 -1 but got %A" a["2".."1"] """) - [] + [] let ``Custom collection with Item and GetReverseIndex should support reverse index indexing``() = CompilerAssert.CompileExeAndRunWithOptions([| "--langversion:preview" |], """ @@ -56,7 +56,7 @@ let a = foo() if a[^2] <> 12 then failwith "expected 12" """) - [] + [] let ``Custom collection with Item and GetReverseIndex should support n-rank reverse index mutation``() = CompilerAssert.CompileExeAndRunWithOptions( [| "--langversion:preview" |], @@ -74,7 +74,7 @@ a[^"1",^"2"] <- "3" if a[""] <> "0 1 1 2 3" then failwithf "expected 0 1 1 2 3 but got %A" a[""] """) - [] + [] let ``Custom collection with Item and GetReverseIndex should support n-rank reverse index indexing``() = CompilerAssert.CompileExeAndRunWithOptions( [| "--langversion:preview" |], @@ -90,7 +90,7 @@ let a = foo() if a[^2,^1] <> 24 then failwithf "expected 23 but got %A" a[^2,^1] """) - [] + [] let ``Custom collection with Item and no GetReverseIndex should not support reverse index indexing``() = CompilerAssert.TypeCheckSingleErrorWithOptions [| "--langversion:preview" |] @@ -109,7 +109,7 @@ if a.[^2] <> 12 then failwith "expected 12" (9,7,9,9) "The type 'foo' does not define the field, constructor or member 'GetReverseIndex'." - [] + [] let ``Custom collection with GetSlice and GetReverseIndex should support reverse index slicing``() = CompilerAssert.CompileExeAndRunWithOptions( [| "--langversion:preview" |], @@ -129,7 +129,7 @@ let a = foo() if a[^2..1] <> 13 then failwith "expected 13" """) - [] + [] let ``Custom collection without GetReverseIndex should not support reverse index slicing``() = CompilerAssert.TypeCheckSingleErrorWithOptions [| "--langversion:preview" |] """ diff --git a/tests/fsharp/Compiler/Language/DefaultInterfaceMemberTests.fs b/tests/fsharp/Compiler/Language/DefaultInterfaceMemberTests.fs index e202ddc50c9..04ef1ce8265 100644 --- a/tests/fsharp/Compiler/Language/DefaultInterfaceMemberTests.fs +++ b/tests/fsharp/Compiler/Language/DefaultInterfaceMemberTests.fs @@ -2,20 +2,20 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Test.Utilities open FSharp.Compiler.Diagnostics #if NETCOREAPP -[] + module DefaultInterfaceMemberConsumptionTests_LanguageVersion_4_6 = [] let targetVersion = "5.0" - [] + [] let ``IL - Errors with lang version not supported`` () = let ilSource = """ @@ -55,7 +55,7 @@ type Test () = (FSharpDiagnosticSeverity.Error, 366, (8, 15, 8, 20), "No implementation was given for 'ITest.DefaultMethod() : unit'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# with explicit implementation - Runs`` () = let csharpSource = """ @@ -134,7 +134,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "FSharp-Method1-FSharp-Method2-FSharp-Method3-FSharp-Method4") - [] + [] let ``C# simple - Errors with lang version not supported`` () = let csharpSource = """ @@ -180,7 +180,7 @@ type Test () = Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# simple - Errors with lang version not supported - 2`` () = let csharpSource = """ @@ -225,7 +225,7 @@ type Test () = (FSharpDiagnosticSeverity.Error, 366, (8, 15, 8, 20), "No implementation was given for 'ITest.DefaultMethod() : unit'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# simple - Errors with lang version not supported - 3`` () = let csharpSource = """ @@ -270,7 +270,7 @@ type Test () = Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# simple with internal DIM - Errors with lang version not supported`` () = let csharpSource = """ @@ -316,7 +316,7 @@ type Test () = (FSharpDiagnosticSeverity.Error, 366, (9, 15, 9, 20), "No implementation was given for 'ITest.DefaultMethod() : unit'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# simple with internal DIM - Errors with not accessible`` () = let csharpSource = """ @@ -363,7 +363,7 @@ type Test () = (FSharpDiagnosticSeverity.Error, 855, (11, 19, 11, 32), "No abstract or interface member was found that corresponds to this override") |]) - [] + [] let ``C# simple with static operator method - Errors with lang version not supported`` () = let csharpSource = """ @@ -414,7 +414,7 @@ let f () = (FSharpDiagnosticSeverity.Error, 3350, (14, 9, 14, 10), "Feature 'default interface member consumption' is not available in F# 4.6. Please use language version " + targetVersion + " or greater.") |]) - [] + [] let ``C# simple with static method - Errors with lang version not supported`` () = let csharpSource = """ @@ -464,7 +464,7 @@ let f () = (FSharpDiagnosticSeverity.Error, 3350, (14, 5, 14, 27), "Feature 'default interface member consumption' is not available in F# 4.6. Please use language version " + targetVersion + " or greater.") |]) - [] + [] let ``C# simple with static property - Errors with lang version not supported`` () = let csharpSource = """ @@ -501,7 +501,7 @@ let f () = (FSharpDiagnosticSeverity.Error, 3350, (8, 5, 8, 22), "Feature 'default interface member consumption' is not available in F# 4.6. Please use language version " + targetVersion + " or greater.") |]) - [] + [] let ``C# simple with static field - Errors with lang version not supported`` () = let csharpSource = """ @@ -538,7 +538,7 @@ let f () = (FSharpDiagnosticSeverity.Error, 3350, (8, 5, 8, 19), "Feature 'default interface member consumption' is not available in F# 4.6. Please use language version " + targetVersion + " or greater.") |]) - [] + [] let ``C# simple with static method using SRTP - Errors with lang version not supported`` () = let csharpSource = """ @@ -579,7 +579,7 @@ let f1 () = (FSharpDiagnosticSeverity.Error, 3350, (9, 5, 9, 15), "Feature 'default interface member consumption' is not available in F# 4.6. Please use language version " + targetVersion + " or greater.") |]) - [] + [] let ``C# simple diamond inheritance - Errors with lang version not supported and should not see the error for specific implementation`` () = let csharpSource = """ @@ -633,7 +633,7 @@ type Test () = (FSharpDiagnosticSeverity.Error, 366, (8, 15, 8, 17), "No implementation was given for 'IA.M() : unit'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# simple diamond inheritance - Errors with lang version not supported and should not see the error for specific implementation - 2`` () = let csharpSource = """ @@ -685,7 +685,7 @@ type Test () = (FSharpDiagnosticSeverity.Error, 366, (10, 15, 10, 17), "No implementation was given for 'IA.M() : unit'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# simple with protected DIM - Runs`` () = let csharpSource = """ @@ -763,7 +763,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "Explicit-Explicit") - [] + [] let ``C# with overloading and generics - Runs`` () = let csharpSource = """ @@ -863,7 +863,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "InTestInTest2123456789111STRING-STRINGABC222FSharpABC333CSharp") - [] + [] let ``C# with overloading and generics - Errors with lang version`` () = let csharpSource = """ @@ -943,13 +943,13 @@ type Test2 () = #else -[] + module DefaultInterfaceMemberConsumptionTests_LanguageVersion_4_6_net472 = [] let targetVersion = "5.0" - [] + [] let ``IL - Errors with lang version and target runtime not supported`` () = let ilSource = """ @@ -990,7 +990,7 @@ type Test () = (FSharpDiagnosticSeverity.Error, 366, (8, 15, 8, 20), "No implementation was given for 'ITest.DefaultMethod() : unit'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``IL - Errors with target runtime not supported when implemented`` () = let ilSource = """ @@ -1031,7 +1031,7 @@ type Test () = (FSharpDiagnosticSeverity.Error, 3351, (8, 15, 8, 20), "Feature 'default interface member consumption' is not supported by target runtime.") |]) - [] + [] let ``C# simple with static method - Errors with lang version and target runtime not supported`` () = let csharpSource = """ @@ -1086,10 +1086,10 @@ let f () = #if NETCOREAPP -[] + module DefaultInterfaceMemberConsumptionTests = - [] + [] let ``C# simple - Errors with un-implemented non-DIM`` () = let csharpSource = """ @@ -1131,7 +1131,7 @@ type Test () = (FSharpDiagnosticSeverity.Error, 366, (8, 15, 8, 20), "No implementation was given for 'ITest.NonDefaultMethod() : unit'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# simple with static operator method - Runs`` () = let csharpSource = """ @@ -1180,7 +1180,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "I1.+1") - [] + [] let ``C# simple - Runs`` () = let csharpSource = """ @@ -1230,7 +1230,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "DefaultMethod-NonDefaultMethod") - [] + [] let ``C# simple with protected DIM - Runs`` () = let csharpSource = """ @@ -1304,7 +1304,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "ProtectedProtected-ProtectedOverrideProtectedOverride") - [] + [] let ``C# simple with protected DIM using object expression - Runs`` () = let csharpSource = """ @@ -1367,7 +1367,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "ObjExprProtectedObjExprProtected-ObjExprProtected2ObjExprProtected2") - [] + [] let ``C# simple with protected DIM - Errors due to protected level`` () = let csharpSource = """ @@ -1445,7 +1445,7 @@ let f () = (FSharpDiagnosticSeverity.Error, 491, (31, 5, 31, 16), "The member or object constructor 'M1' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.") |]) - [] + [] let ``C# simple with protected DIM - Errors due to protected level - 2`` () = let csharpSource = """ @@ -1527,7 +1527,7 @@ type Test2 () = (FSharpDiagnosticSeverity.Error, 629, (30, 13, 30, 31), "Method 'M1' is not accessible from this code location") |]) - [] + [] let ``C# simple with internal DIM - Runs`` () = let csharpSource = """ @@ -1575,7 +1575,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "NonDefaultMethod") - [] + [] let ``C# simple with internal DIM - Errors with missing method`` () = let csharpSource = """ @@ -1627,7 +1627,7 @@ let f () = NonDefaultMethod") |]) - [] + [] let ``C# simple with internal DIM - Errors with not accessible`` () = let csharpSource = """ @@ -1676,7 +1676,7 @@ type Test () = (FSharpDiagnosticSeverity.Error, 855, (11, 19, 11, 32), "No abstract or interface member was found that corresponds to this override") |]) - [] + [] let ``C# simple with internal DIM but with IVT - Runs`` () = let csharpSource = """ @@ -1731,7 +1731,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "IVT-NonDefaultMethod") - [] + [] let ``C# simple with one DIM for F# object expression - Runs`` () = let csharpSource = """ @@ -1770,7 +1770,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "DefaultMethod") - [] + [] let ``C# simple with one DIM and one non-DIM for F# object expression - Runs`` () = let csharpSource = """ @@ -1813,7 +1813,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "DefaultMethod-ObjExpr") - [] + [] let ``C# simple with one DIM and one non-DIM for F# object expression - Errors with lack of implementation`` () = let csharpSource = """ @@ -1854,7 +1854,7 @@ let test = { new ITest } (FSharpDiagnosticSeverity.Error, 366, (7, 12, 7, 25), "No implementation was given for 'ITest.NonDefaultMethod() : unit'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# simple with override - Runs`` () = let csharpSource = """ @@ -1907,7 +1907,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "OverrideDefaultMethod-NonDefaultMethod") - [] + [] let ``C# simple with override for object expression - Runs`` () = let csharpSource = """ @@ -1955,7 +1955,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "ObjExprOverrideDefaultMethod-ObjExprNonDefaultMethod") - [] + [] let ``C# from hierarchical interfaces - Runs`` () = let csharpSource = """ @@ -2015,7 +2015,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "FromITest2-Method1-FromITest2-Method2") - [] + [] let ``C# diamond hierarchical interfaces - Errors with lack of explicit shared interface type`` () = let csharpSource = """ @@ -2097,7 +2097,7 @@ Note that all interface members must be implemented and listed under an appropri Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# diamond hierarchical interfaces - Errors with no most specific implementation`` () = let csharpSource = """ @@ -2173,7 +2173,7 @@ type Test () = Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# diamond hierarchical interfaces but combined in one C# interface - Errors with no most specific implementation`` () = let csharpSource = """ @@ -2251,7 +2251,7 @@ type Test () = Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# diamond hierarchical interfaces but combined in one F# interface - Errors with no most specific implementation`` () = let csharpSource = """ @@ -2329,7 +2329,7 @@ type Test () = Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# diamond hierarchical interfaces but re-abstracted in one and then combined in one F# interface - Errors with no most specific implementation`` () = let csharpSource = """ @@ -2401,7 +2401,7 @@ type Test () = Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# diamond hierarchical interfaces but all re-abstracted and then combined in one F# interface - Errors with need to implement members`` () = let csharpSource = """ @@ -2467,7 +2467,7 @@ type Test () = Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# diamond hierarchical interfaces then combined in one F# interface and then implemented - Runs`` () = let csharpSource = """ @@ -2549,7 +2549,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "FSharpICombinedTest-Method1-FSharpICombinedTest-Method2") - [] + [] let ``C# diamond hierarchical interfaces but all re-abstracted and then combined in one F# interface and then implemented - Runs`` () = let csharpSource = """ @@ -2619,7 +2619,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "FSharpICombinedTest-Method1-FSharpICombinedTest-Method2") - [] + [] let ``C# diamond hierarchical interfaces then using explicit interfaces and then implemented - Runs`` () = let csharpSource = """ @@ -2698,7 +2698,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "FSharpExplicitTest-Method1-FSharpExplicitTest-Method2") - [] + [] let ``C# diamond hierarchical interfaces but all re-abstracted and then combined in one F# interface and then implemented one method - Errors with no most specific implementation`` () = let csharpSource = """ @@ -2763,7 +2763,7 @@ type Test () = (FSharpDiagnosticSeverity.Error, 366, (14, 15, 14, 28), "No implementation was given for 'ITest1.Method1() : unit'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# diamond hierarchical interfaces then combined in one C# interface and then implemented - Runs`` () = let csharpSource = """ @@ -2849,7 +2849,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "CSharpICombinedTest-Method1-CSharpICombinedTest-Method2") - [] + [] let ``C# diamond complex hierarchical interfaces then combined in one C# interface and then implemented - Runs`` () = let csharpSource = """ @@ -2974,7 +2974,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "CSharpIFinalCombinedTest-Method1-CSharpIFinalCombinedTest-Method2") - [] + [] let ``C# diamond complex hierarchical interfaces then combined in one C# interface and then implemented - Runs - 2`` () = let csharpSource = """ @@ -3085,7 +3085,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "CSharpIFinalCombinedTest-Method1-") - [] + [] let ``C# diamond complex hierarchical interfaces then combined in one C# interface and then implemented - Runs - 3`` () = let csharpSource = """ @@ -3197,7 +3197,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "CSharpIFinalCombinedTest-Method1-CSharpIFinalCombinedTest-Method2") - [] + [] let ``C# multi-diamond complex hierarchical interfaces with hiding methods then explicitly implemented - Runs`` () = let csharpSource = """ @@ -3313,7 +3313,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "IBase-IB1-IA1-IC1-") - [] + [] let ``C# multi-diamond complex hierarchical interfaces then explicitly implemented - Runs`` () = let csharpSource = """ @@ -3419,7 +3419,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "123XYZ") - [] + [] let ``C# diamond complex hierarchical interfaces then explicitly implemented - Runs`` () = let csharpSource = """ @@ -3522,7 +3522,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "-") - [] + [] let ``C# diamond complex hierarchical interfaces then combined in one C# interface and then implemented - Errors with no impl`` () = let csharpSource = """ @@ -3623,7 +3623,7 @@ type Test2 () = (FSharpDiagnosticSeverity.Error, 366, (10, 15, 10, 32), "No implementation was given for 'ITest1.Method2() : unit'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# simple with property - Runs`` () = let csharpSource = """ @@ -3668,7 +3668,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "A-NonDefaultMethod") - [] + [] let ``C# simple with property and override - Runs`` () = let csharpSource = """ @@ -3715,7 +3715,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "OverrideA-NonDefaultMethod") - [] + [] let ``C# with same methods names that hide with overloading - Runs`` () = let csharpSource = """ @@ -3778,8 +3778,8 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "") - [] - let ``C# with mutliple separate interfaces - Runs`` () = + [] + let ``C# with multiple separate interfaces - Runs`` () = let csharpSource = """ using System; @@ -3845,7 +3845,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "IA.MA-IB1.IB.MB-IB1.IB.MB") - [] + [] let ``C# simple diamond inheritance - Errors with no specific implementation`` () = let csharpSource = """ @@ -3899,7 +3899,7 @@ type Test () = (FSharpDiagnosticSeverity.Error, 366, (8, 15, 8, 17), "No implementation was given for 'IA.M() : unit'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# simple diamond inheritance - Errors with no specific implementation - 2`` () = let csharpSource = """ @@ -3951,7 +3951,7 @@ type Test () = (FSharpDiagnosticSeverity.Error, 366, (10, 15, 10, 17), "No implementation was given for 'IA.M() : unit'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# simple diamond inheritance - Runs`` () = let csharpSource = """ @@ -4013,7 +4013,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "MMM") - [] + [] let ``C# simple diamond inheritance with overloading - Runs`` () = let csharpSource = """ @@ -4103,7 +4103,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "M123456floatfs_single") - [] + [] let ``C# simple diamond inheritance with overloading - Errors with missing overload method`` () = let csharpSource = """ @@ -4183,7 +4183,7 @@ type Test () = (FSharpDiagnosticSeverity.Error, 366, (12, 15, 12, 17), "No implementation was given for 'IA.M(x: float32) : unit'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# with overloading and generics - Runs`` () = let csharpSource = """ @@ -4278,7 +4278,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "InTestInTest123456789111STRING-STRINGABC222FSharpABC333CSharpM(U, T)M(U, T)") - [] + [] let ``C# diamond inheritance with overloading and generics and properties - Runs`` () = let csharpSource = """ @@ -4373,7 +4373,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "Test.String-Test.Prop2") - [] + [] let ``C# diamond inheritance with overloading and generics and properties - Errors with no specific implementation`` () = let csharpSource = """ @@ -4463,7 +4463,7 @@ type Test () = (FSharpDiagnosticSeverity.Error, 366, (12, 15, 12, 25), "No implementation was given for 'IA.set_Prop2(value: string) : unit'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# simple diamond inheritance using object expression - Errors with no specific implementation`` () = let csharpSource = """ @@ -4516,7 +4516,7 @@ let test = (FSharpDiagnosticSeverity.Error, 366, (8, 7, 8, 21), "No implementation was given for 'IA.M() : unit'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# diamond inheritance with no most specific problem - Runs`` () = let csharpSource = """ @@ -4573,7 +4573,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "IB.IA.M") - [] + [] let ``C# diamond inheritance with no most specific problem - Runs - 2`` () = let csharpSource = """ @@ -4629,7 +4629,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "IB.IA.M") - [] + [] let ``C# with interface statics - Runs`` () = let csharpSource = """ @@ -4693,7 +4693,7 @@ f () CompilerAssert.ExecutionHasOutput(fsCmpl, "1011") - [] + [] let ``C# interface statics and F# SRTP (statically resolved type parameters) - Runs`` () = let csharpSource = """ @@ -4753,7 +4753,7 @@ f3 () CompilerAssert.ExecutionHasOutput(fsCmpl, "359") - [] + [] let ``C# interface statics - Errors with method not defined on C# class`` () = let csharpSource = """ @@ -4800,7 +4800,7 @@ let f () = (FSharpDiagnosticSeverity.Error, 39, (6, 17, 6, 29), "The type 'CSharpClass' does not define the field, constructor or member 'StaticMethod'.") |]) - [] + [] let ``C# interface statics - Errors with method not defined on F# class`` () = let csharpSource = """ @@ -4850,7 +4850,7 @@ let f () = (FSharpDiagnosticSeverity.Error, 39, (11, 17, 11, 29), "The type 'FSharpClass' does not define the field, constructor or member 'StaticMethod'.") |]) - [] + [] let ``C# interface statics - Errors with method not defined on C# class using SRTP`` () = let csharpSource = """ @@ -4900,7 +4900,7 @@ let f () = (FSharpDiagnosticSeverity.Error, 1, (9, 5, 9, 15), "The type 'CSharpClass' does not support the operator 'StaticMethod'") |]) - [] + [] let ``C# interface statics - Errors with method not defined on F# class using SRTP`` () = let csharpSource = """ @@ -4955,13 +4955,13 @@ let f () = #else -[] + module DefaultInterfaceMemberConsumptionTests_net472 = [] let targetVersion = "5.0" - [] + [] let ``IL - Errors with target runtime not supported`` () = let ilSource = """ @@ -5002,7 +5002,7 @@ type Test () = (FSharpDiagnosticSeverity.Error, 366, (8, 15, 8, 20), "No implementation was given for 'ITest.DefaultMethod() : unit'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") |]) - [] + [] let ``C# simple with static method - Errors with target runtime not supported`` () = let csharpSource = """ diff --git a/tests/fsharp/Compiler/Language/FixedIndexSliceTests.fs b/tests/fsharp/Compiler/Language/FixedIndexSliceTests.fs index 344c5178b18..fc93877cfa1 100644 --- a/tests/fsharp/Compiler/Language/FixedIndexSliceTests.fs +++ b/tests/fsharp/Compiler/Language/FixedIndexSliceTests.fs @@ -1,13 +1,13 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Compiler.Diagnostics -[] + module FixedIndexSliceTests = - [] + [] let ``Fixed index 3d slicing should not be available in 47``() = CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:4.7"|] """ @@ -30,7 +30,7 @@ arr3.[*, 1, 1] FSharpDiagnosticSeverity.Error, 39, (10,1,10,15), "The type '[,,]<_>' does not define the field, constructor or member 'GetSlice'." |] - [] + [] let ``Fixed index 4d slicing should not be available in 47``() = CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:4.7"|] """ @@ -67,7 +67,7 @@ arr4.[*, 1, 1, 1] FSharpDiagnosticSeverity.Error, 39, (17,1,17,18), "The type '[,,,]<_>' does not define the field, constructor or member 'GetSlice'." |] - [] + [] let ``Fixed index 3d set slicing should not be available in 47``() = CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:4.7"|] """ @@ -92,7 +92,7 @@ arr3.[*, 1, 1] <- arr1 FSharpDiagnosticSeverity.Error, 39, (12,1,12,15), "The type '[,,]<_>' does not define the field, constructor or member 'SetSlice'." |] - [] + [] let ``Fixed index 4d set slicing should not be available in 47``() = CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:4.7"|] """ diff --git a/tests/fsharp/Compiler/Language/HatDesugaringTests.fs b/tests/fsharp/Compiler/Language/HatDesugaringTests.fs index 2210e3a9851..2d8b44a0ae7 100644 --- a/tests/fsharp/Compiler/Language/HatDesugaringTests.fs +++ b/tests/fsharp/Compiler/Language/HatDesugaringTests.fs @@ -1,13 +1,12 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Compiler.Diagnostics -[] module HatDesugaringTests = - [] + [] let ``Hat operator should be overloadable in infix context``() = CompilerAssert.CompileExeAndRunWithOptions( [| "--langversion:preview" |], @@ -21,7 +20,7 @@ if 1 ^ 2 <> 3 then failwithf "expected result to be 3 but got %i" (1 ^ 2) Console.WriteLine() """) - [] + [] let ``Reverse slicing should work with overloaded infix hat``() = CompilerAssert.CompileExeAndRunWithOptions( [| "--langversion:preview" |], @@ -35,7 +34,7 @@ if result <> [1;2] then failwithf "expected result to be [1;2] but got %A" resul Console.WriteLine() """) - [] + [] let ``At operator should not be usable in prefix context``() = CompilerAssert.ParseWithErrors (""" @@ -47,7 +46,7 @@ let x = @1 FSharpDiagnosticSeverity.Error, 1208, (4,9,4,10), "Invalid prefix operator" |] - [] + [] let ``Hat operator should not be overloadable as prefix operator``() = CompilerAssert.ParseWithErrors """ @@ -60,7 +59,7 @@ let (~^) (x: int) (y:int) = x + y FSharpDiagnosticSeverity.Error, 1208, (5,6,5,8), "Invalid operator definition. Prefix operator definitions must use a valid prefix operator name."; |] - [] + [] let ``Reverse slicing should not work with at symbol in 1st slice index``() = CompilerAssert.ParseWithErrors (""" @@ -74,7 +73,7 @@ Console.WriteLine(list[@1..]) FSharpDiagnosticSeverity.Error, 1208, (6,24,6,25), "Invalid prefix operator" |] - [] + [] let ``Reverse slicing should not work with at symbol in 2nd slice index``() = CompilerAssert.ParseWithErrors (""" @@ -88,7 +87,7 @@ Console.WriteLine(list[..@1]) FSharpDiagnosticSeverity.Error, 1208, (6,24,6,27), "Invalid prefix operator" |] - [] + [] let ``Reverse slicing should not work with at symbol in both slice index``() = CompilerAssert.ParseWithErrors (""" @@ -103,7 +102,7 @@ Console.WriteLine(list[@1..@1]) FSharpDiagnosticSeverity.Error, 1208, (6,28,6,29), "Invalid prefix operator" |] - [] + [] let ``Reverse indexing should not work with at symbol``() = CompilerAssert.ParseWithErrors (""" diff --git a/tests/fsharp/Compiler/Language/InitOnlyPropertyConsumptionTests.fs b/tests/fsharp/Compiler/Language/InitOnlyPropertyConsumptionTests.fs index 14f04745f88..5bc6fca837b 100644 --- a/tests/fsharp/Compiler/Language/InitOnlyPropertyConsumptionTests.fs +++ b/tests/fsharp/Compiler/Language/InitOnlyPropertyConsumptionTests.fs @@ -2,17 +2,17 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Test.Compiler open FSharp.Test.Utilities #if NETCOREAPP -[] + module InitOnlyPropertyConsumptionTests = - [] + [] let ``Should be able to set an init-only property from a C# record`` () = let csharpSource = """ diff --git a/tests/fsharp/Compiler/Language/InterfaceTests.fs b/tests/fsharp/Compiler/Language/InterfaceTests.fs index 79358958633..a002d2f3793 100644 --- a/tests/fsharp/Compiler/Language/InterfaceTests.fs +++ b/tests/fsharp/Compiler/Language/InterfaceTests.fs @@ -3,14 +3,13 @@ namespace FSharp.Compiler.UnitTests open FSharp.Compiler.Diagnostics -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Test.Utilities -[] module InterfaceTests = - [] + [] let ShouldnWork() = CompilerAssert.Pass """ type IGet<'T> = @@ -162,7 +161,7 @@ assertion (fun (x:float) -> x * 3.0) (fun v -> ``Many Instantiations of the same interface - SetUp`` + ``Many Instantiations of the same interface - Asserts`` - [] + [] let MultipleTypedInterfacesFSharp50() = #if NETSTANDARD @@ -188,7 +187,7 @@ assertion (fun (x:float) -> x * 3.0) (fun v -> CompilerAssert.Compile fsCmpl - [] + [] let MultipleTypedInterfacesFSharp47() = CompilerAssert.TypeCheckWithErrorsAndOptions [| @@ -202,7 +201,7 @@ assertion (fun (x:float) -> x * 3.0) (fun v -> (FSharpDiagnosticSeverity.Error, 3350, (24, 6, 24, 20), "Feature 'interfaces with multiple generic instantiation' is not available in F# 4.7. Please use language version 5.0 or greater.") |] - [] + [] let MultipleTypedInterfacesFSharp50VerifyIl() = CompilerAssert.CompileLibraryAndVerifyILWithOptions( [| diff --git a/tests/fsharp/Compiler/Language/OpenTypeDeclarationTests.fs b/tests/fsharp/Compiler/Language/OpenTypeDeclarationTests.fs index 162b75d94a5..440bc7721ba 100644 --- a/tests/fsharp/Compiler/Language/OpenTypeDeclarationTests.fs +++ b/tests/fsharp/Compiler/Language/OpenTypeDeclarationTests.fs @@ -3,12 +3,12 @@ namespace FSharp.Compiler.UnitTests open FSharp.Compiler.Diagnostics -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Test.Utilities open FSharp.Test.Compiler -[] + module OpenTypeDeclarationTests = [] @@ -34,7 +34,7 @@ type NotAllowedToOpen() = """ - [] + [] let ``OpenSystemMathOnce - langversion:4.6`` () = Fsx (baseModule + """ module OpenSystemMathOnce = @@ -50,7 +50,7 @@ module OpenSystemMathOnce = ] |> ignore - [] + [] let ``OpenSystemMathOnce - langversion:5.0`` () = Fsx (baseModule + """ module OpenSystemMathOnce = @@ -62,7 +62,7 @@ module OpenSystemMathOnce = |> shouldSucceed |> ignore - [] + [] let ``OpenSystemMathTwice - langversion:4.6`` () = Fsx (baseModule + """ module OpenSystemMathTwice = @@ -83,7 +83,7 @@ module OpenSystemMathTwice = ] |> ignore - [] + [] let ``OpenSystemMathTwice - langversion:50`` () = Fsx (baseModule + """ module OpenSystemMathOnce = @@ -95,7 +95,7 @@ module OpenSystemMathOnce = |> shouldSucceed |> ignore - [] + [] let ``OpenMyMathOnce - langversion:4.6`` () = Fsx (baseModule + """ module OpenMyMathOnce = @@ -113,7 +113,7 @@ module OpenMyMathOnce = ] |> ignore - [] + [] let ``OpenMyMathOnce - langversion:5.0`` () = Fsx (baseModule + """ module OpenMyMathOnce = @@ -126,7 +126,7 @@ module OpenMyMathOnce = |> shouldSucceed |> ignore - [] + [] let ``DontOpenAutoMath - langversion:4.6`` () = Fsx (baseModule + """ module DontOpenAutoMath = @@ -142,7 +142,7 @@ module DontOpenAutoMath = ] |> ignore - [] + [] let ``DontOpenAutoMath - langversion:5.0`` () = Fsx (baseModule + """ module DontOpenAutoMath = @@ -154,7 +154,7 @@ module DontOpenAutoMath = |> shouldSucceed |> ignore - [] + [] let ``OpenAutoMath - langversion:4.6`` () = Fsx (baseModule + """ module OpenAutoMath = @@ -173,7 +173,7 @@ module OpenAutoMath = ] |> ignore - [] + [] let ``OpenAutoMath - langversion:5.0`` () = Fsx (baseModule + """ module OpenAutoMath = @@ -187,7 +187,7 @@ module OpenAutoMath = |> shouldSucceed |> ignore - [] + [] let ``OpenAccessibleFields - langversion:5.0`` () = Fsx (baseModule + """ module OpenAFieldFromMath = @@ -199,7 +199,7 @@ module OpenAFieldFromMath = |> shouldSucceed |> ignore - [] + [] let ``Open type and use nested types as unqualified`` () = let csharp = CSharp """ @@ -241,7 +241,7 @@ module Test = |> shouldSucceed |> ignore - [] + [] let ``Open a type where the type declaration uses a type abbreviation as a qualifier to a real nested type`` () = let csharp = CSharp """ @@ -279,7 +279,7 @@ open type Abbrev.NestedTest""" |> shouldSucceed |> ignore - [] + [] let ``Open a type where the type declaration uses a type abbreviation`` () = let csharp = CSharp """ @@ -317,7 +317,7 @@ open type Abbrev""" |> shouldSucceed |> ignore - [] + [] let ``Open a nested type as qualified`` () = let csharp = CSharp """ @@ -350,7 +350,7 @@ module Test = |> shouldSucceed |> ignore - [] + [] let ``Open generic type and use nested types as unqualified`` () = let csharp = CSharp """ @@ -421,7 +421,7 @@ module Test2 = |> shouldSucceed |> ignore - [] + [] let ``Open generic type and use nested types as unqualified 2`` () = FSharp """ namespace FSharpTest @@ -435,7 +435,7 @@ module Test = |> shouldSucceed |> ignore - [] + [] let ``Open generic type and use nested types as unqualified 3`` () = let csharp = CSharp """ @@ -540,7 +540,7 @@ module Test4 = |> shouldSucceed |> ignore - [] + [] let ``Open generic type and use nested types as unqualified 4`` () = let csharp = CSharp """ @@ -639,7 +639,7 @@ module Test3 = |> shouldSucceed |> ignore - [] + [] let ``Open unit of measure - Errors`` () = FSharp """ namespace FSharpTest @@ -659,7 +659,7 @@ open type kg ] |> ignore - [] + [] let ``Open type with unit of measure`` () = FSharp """ namespace FSharpTest @@ -682,7 +682,7 @@ open type vec3 |> shouldSucceed |> ignore - [] + [] let ``Open custom type with unit of measure`` () = FSharp """ namespace FSharpTest @@ -714,7 +714,7 @@ module Test = |> shouldSucceed |> ignore - [] + [] let ``Open custom type with unit of measure and more type params`` () = FSharp """ namespace FSharpTest @@ -755,7 +755,7 @@ module Test = |> shouldSucceed |> ignore - [] + [] let ``Open custom type with unit of measure should error with measure mismatch`` () = FSharp """ namespace FSharpTest @@ -787,7 +787,7 @@ module Test = |> withErrorCode 1 |> ignore - [] + [] let ``Open tuple - Errors`` () = FSharp """ namespace FSharpTest @@ -802,7 +802,7 @@ open type (int * int) ] |> ignore - [] + [] let ``Open struct tuple - Errors`` () = FSharp """ namespace FSharpTest @@ -817,7 +817,7 @@ open type struct (int * int) ] |> ignore - [] + [] let ``Open function - Errors`` () = FSharp """ namespace FSharpTest @@ -832,7 +832,7 @@ open type (int -> int) ] |> ignore - [] + [] let ``Open anon type - Errors`` () = FSharp """ namespace FSharpTest @@ -847,7 +847,7 @@ open type {| x: int |} ] |> ignore - [] + [] let ``Open struct anon type - Errors`` () = FSharp """ namespace FSharpTest @@ -862,7 +862,7 @@ open type struct {| x: int |} ] |> ignore - [] + [] let ``Open direct tuple - Errors`` () = // Note: `Tuple` is technically a named type but it gets decompiled into F#'s representation of a tuple in its type system. // This test is to verify that behavior. @@ -881,7 +881,7 @@ open type Tuple ] |> ignore - [] + [] let ``Open direct value tuple - Errors`` () = // Note: `ValueTuple` is technically a named type but it gets decompiled into F#'s representation of a struct tuple in its type system. // This test is to verify that behavior. @@ -900,7 +900,7 @@ open type ValueTuple ] |> ignore - [] + [] let ``Open direct function - Errors`` () = // Note: `FSharpFunc` is technically a named type but it gets decompiled into F#'s representation of a function in its type system. // This test is to verify that behavior. @@ -917,7 +917,7 @@ open type FSharpFunc ] |> ignore - [] + [] let ``Open enum should have access to its cases`` () = FSharp """ namespace FSharpTest @@ -938,7 +938,7 @@ module Test = |> shouldSucceed |> ignore - [] + [] let ``Open C# enum should have access to its cases`` () = let csharp = CSharp """ @@ -967,7 +967,7 @@ module Test = |> compile |> ignore - [] + [] let ``Open union should have access to union cases`` () = FSharp """ namespace FSharpTest @@ -993,7 +993,7 @@ module Test2 = |> shouldSucceed |> ignore - [] + [] let ``Open generic union should have access to union cases with the enclosing type instantiations`` () = FSharp """ namespace FSharpTest @@ -1019,7 +1019,7 @@ module Test2 = |> withErrorCode 1 |> ignore - [] + [] let ``Open generic union should have access to pattern union cases with the enclosing type instantiations - Errors`` () = FSharp """ namespace FSharpTest @@ -1041,7 +1041,7 @@ module Test2 = |> withErrorCode 1 |> ignore - [] + [] let ``Open record should have access to construct record via labels`` () = FSharp """ namespace FSharpTest @@ -1065,7 +1065,7 @@ module Test2 = |> shouldSucceed |> ignore - [] + [] let ``Open generic record should have access to construct record via labels with enclosing type instantiations`` () = FSharp """ namespace FSharpTest @@ -1095,7 +1095,7 @@ module Test3 = |> withErrorCode 1 |> ignore - [] + [] let ``Open generic record should have access to pattern record via labels with enclosing type instantiations - Errors`` () = FSharp """ namespace FSharpTest @@ -1124,7 +1124,7 @@ module Test3 = |> withErrorCode 1 |> ignore - [] + [] let ``Open type should have no access to constructor - Errors`` () = FSharp """ namespace FSharpTest @@ -1148,7 +1148,7 @@ module Test2 = |> withErrorCode 39 |> ignore - [] + [] let ``Open type should combine both extension and intrinsic method groups`` () = FSharp """ namespace FSharpTest @@ -1177,7 +1177,7 @@ module Test2 = |> shouldSucceed |> ignore - [] + [] let ``Open type should combine both extension and intrinsic method groups but error if extensions are added after opening the type`` () = FSharp """ namespace FSharpTest @@ -1206,7 +1206,7 @@ module Test2 = |> withErrorCodes [1;1] |> ignore - [] + [] let ``Using the 'open' declaration on a possible type identifier - Error`` () = let csharp = CSharp """ @@ -1241,7 +1241,7 @@ module Test = ] |> ignore - [] + [] let ``Open type declaration on a namespace - Error`` () = FSharp """ namespace FSharpTest @@ -1255,7 +1255,7 @@ open type System""" ] |> ignore - [] + [] let ``Open type declaration on a module - Error`` () = FSharp """ namespace FSharpTest @@ -1269,7 +1269,7 @@ open type FSharp.Core.Option""" ] |> ignore - [] + [] let ``Open type declaration on a byref - Error`` () = FSharp """ namespace FSharpTest @@ -1287,7 +1287,7 @@ open type outref""" ] |> ignore - [] + [] let ``Type extensions with static members are able to be accessed in an unqualified manner`` () = let fsharpSource = """ @@ -1324,7 +1324,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "MPM2ExtP2Ext") - [] + [] let ``Type extensions with static members are able to be accessed in an unqualified manner with no shadowing on identical names`` () = let fsharpSource = """ @@ -1359,7 +1359,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "MP") - [] + [] let ``Type extensions with static members are able to be accessed in an unqualified manner with the nuance of favoring extension properties over extension methods of identical names`` () = let fsharpSource = """ @@ -1397,7 +1397,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "MExtP") - [] + [] let ``Type extensions with static members are able to be accessed in an unqualified manner with no shadowing on identical method/property names`` () = let fsharpSource = """ @@ -1427,7 +1427,7 @@ let main _ = CompilerAssert.ExecutionHasOutput(fsCmpl, "M") - [] + [] let ``Opened types do no allow unqualified access to their inherited type's members - Error`` () = Fsx """ open type System.Math @@ -1442,7 +1442,7 @@ let x = Equals(2.0, 3.0) ] |> ignore - [] + [] let ``Opened types do no allow unqualified access to C#-style extension methods - Error`` () = FSharp """ open System.Runtime.CompilerServices @@ -1472,7 +1472,7 @@ let main _ = ] |> ignore - [] + [] let ``Opened types do allow unqualified access to C#-style extension methods if type has no [] attribute`` () = FSharp """ open System.Runtime.CompilerServices @@ -1495,7 +1495,7 @@ let main _ = |> shouldSucceed |> ignore - [] + [] let ``Opened types do allow unqualified access to members with no [] attribute`` () = FSharp """ open System.Runtime.CompilerServices @@ -1518,7 +1518,7 @@ let main _ = |> shouldSucceed |> ignore - [] + [] let ``Opened types with C# style extension members are available for normal extension method lookup`` () = FSharp """ open System.Runtime.CompilerServices @@ -1543,7 +1543,7 @@ let main _ = |> shouldSucceed |> ignore - [] + [] let ``Opened types with operators`` () = FSharp """ type A() = @@ -1562,7 +1562,7 @@ let main _ = |> shouldSucceed |> ignore - [] + [] let ``An assembly with an event and field with the same name, favor the field`` () = let ilSource = """ @@ -1689,7 +1689,7 @@ let x2: int = X CompilerAssert.Compile(fsCmpl) - [] + [] let ``An assembly with an event and field with the same name, favor the field - reversed`` () = let ilSource = """ @@ -1815,7 +1815,7 @@ let x2: int = X CompilerAssert.Compile(fsCmpl) - [] + [] let ``An assembly with a property, event, and field with the same name`` () = let ilSource = """ @@ -1965,7 +1965,7 @@ let x2: string = X CompilerAssert.Compile(fsCmpl) - [] + [] let ``An assembly with a method, property, event, and field with the same name`` () = let ilSource = """ @@ -2126,7 +2126,7 @@ let x2: float32 = X() #if NETCOREAPP - [] + [] let ``Opening an interface with a static method`` () = let csharpSource = """ @@ -2165,7 +2165,7 @@ let main _ = CompilerAssert.Compile(fsCmpl) - [] + [] let ``Opening an interface with an internal static method`` () = let csharpSource = """ @@ -2207,7 +2207,7 @@ let main _ = CompilerAssert.Compile(fsCmpl) - [] + [] let ``Opening an interface with an internal static method - Error`` () = let csharpSource = """ @@ -2252,7 +2252,7 @@ let main _ = #if !NETCOREAPP - [] + [] let ``Opening type providers with abbreviation result in unqualified access to types and members`` () = let dir = getTestsDirectory __SOURCE_DIRECTORY__ "../../typeProviders/helloWorld" @@ -2294,7 +2294,7 @@ if StaticProperty1 <> "You got a static property" then compileAndRun test |> ignore - [] + [] let ``Opening type providers result in unqualified access to types and members`` () = let dir = getTestsDirectory __SOURCE_DIRECTORY__ "../../typeProviders/helloWorld" @@ -2334,7 +2334,7 @@ if StaticProperty1 <> "You got a static property" then compileAndRun test |> ignore - [] + [] let ``Opening type providers with nested result in unqualified access to types and members`` () = let dir = getTestsDirectory __SOURCE_DIRECTORY__ "../../typeProviders/helloWorld" @@ -2367,7 +2367,7 @@ if StaticProperty1 <> "You got a static property" then compileAndRun test |> ignore - [] + [] let ``Opening generative type providers in unqualified access to types and members`` () = let dir = getTestsDirectory __SOURCE_DIRECTORY__ "../../typeProviders/helloWorld" @@ -2401,7 +2401,7 @@ let _ : TheNestedGeneratedType = Unchecked.defaultof<_> compileAndRun test |> ignore - [] + [] let ``Opening generative type providers directly in unqualified access to types and members - Errors`` () = let dir = getTestsDirectory __SOURCE_DIRECTORY__ "../../typeProviders/helloWorld" diff --git a/tests/fsharp/Compiler/Language/OptionalInteropTests.fs b/tests/fsharp/Compiler/Language/OptionalInteropTests.fs index 2e099bfe5b9..02e54c46fd4 100644 --- a/tests/fsharp/Compiler/Language/OptionalInteropTests.fs +++ b/tests/fsharp/Compiler/Language/OptionalInteropTests.fs @@ -3,16 +3,17 @@ namespace FSharp.Compiler.UnitTests open System.Collections.Immutable -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Test.Utilities open Microsoft.CodeAnalysis -[] + module OptionalInteropTests = - [] - [] + [] + [] + [] let ``C# method with an optional parameter and called with an option type should compile`` langVersion = let csSrc = """ diff --git a/tests/fsharp/Compiler/Language/SlicingQuotationTests.fs b/tests/fsharp/Compiler/Language/SlicingQuotationTests.fs index 414d562708e..0962d45b6f5 100644 --- a/tests/fsharp/Compiler/Language/SlicingQuotationTests.fs +++ b/tests/fsharp/Compiler/Language/SlicingQuotationTests.fs @@ -1,12 +1,12 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Compiler.Diagnostics -[] + module SlicingQuotationTests = - [] + [] let ``Reverse slicing quotation on array with range return expected expression``() = CompilerAssert.RunScriptWithOptions [| "--langversion:preview" |] """ @@ -35,7 +35,7 @@ test() [] - [] + [] let ``Reverse slicing quotation on array2d with ranges return expected expression``() = CompilerAssert.RunScriptWithOptions [| "--langversion:preview" |] """ @@ -63,7 +63,7 @@ test() """ [] - [] + [] let ``Reverse slicing quotation on array2d with fixed index return expected expression``() = CompilerAssert.RunScriptWithOptions [| "--langversion:preview" |] """ @@ -91,7 +91,7 @@ test() """ [] - [] + [] let ``Reverse indexing quotation on array2d return expected expression``() = CompilerAssert.RunScriptWithOptions [| "--langversion:preview" |] """ @@ -119,7 +119,7 @@ test() """ [] - [] + [] let ``Reverse slicing quotation on list with range return expected expression``() = CompilerAssert.RunScriptWithOptions [| "--langversion:preview" |] """ @@ -149,7 +149,7 @@ test() - [] + [] let ``Regular slicing quotation on array with star return expected expression``() = CompilerAssert.RunScriptWithOptions [| "--langversion:preview" |] """ @@ -177,7 +177,7 @@ test() """ [] - [] + [] let ``Regular slicing quotation on array with range return expected expression``() = CompilerAssert.RunScriptWithOptions [| "--langversion:preview" |] """ @@ -206,7 +206,7 @@ test() [] - [] + [] let ``Regular slicing quotation on array2d with ranges return expected expression``() = CompilerAssert.RunScriptWithOptions [| "--langversion:preview" |] """ @@ -234,7 +234,7 @@ test() """ [] - [] + [] let ``Regular slicing quotation on array2d with fixed index return expected expression``() = CompilerAssert.RunScriptWithOptions [| "--langversion:preview" |] """ @@ -262,7 +262,7 @@ test() """ [] - [] + [] let ``Regular indexing quotation on array2d return expected expression``() = CompilerAssert.RunScriptWithOptions [| "--langversion:preview" |] """ @@ -290,7 +290,7 @@ test() """ [] - [] + [] let ``Regular slicing quotation on list with star return expected expression``() = CompilerAssert.RunScriptWithOptions [| "--langversion:preview" |] """ @@ -318,7 +318,7 @@ test() """ [] - [] + [] let ``Regular slicing quotation on list with range return expected expression``() = CompilerAssert.RunScriptWithOptions [| "--langversion:preview" |] """ diff --git a/tests/fsharp/Compiler/Language/SpanOptimizationTests.fs b/tests/fsharp/Compiler/Language/SpanOptimizationTests.fs index 3ac380941fa..d2161a85d72 100644 --- a/tests/fsharp/Compiler/Language/SpanOptimizationTests.fs +++ b/tests/fsharp/Compiler/Language/SpanOptimizationTests.fs @@ -2,14 +2,14 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test #if NETCOREAPP -[] + module SpanOptimizationTests = - [] + [] let SpanForInDo() = let source = """ @@ -62,7 +62,7 @@ let test () = }""" ])) - [] + [] let ReadOnlySpanForInDo() = let source = """ @@ -114,7 +114,7 @@ let test () = }""" ])) - [] + [] let ExplicitSpanTypeForInDo() = let source = @@ -203,7 +203,7 @@ module Test = """ ])) - [] + [] let SpanForInBoundsDo() = let source = """ @@ -254,7 +254,7 @@ let test () = }""" ])) - [] + [] let ReadOnlySpanForInBoundsDo() = let source = """ diff --git a/tests/fsharp/Compiler/Language/SpanTests.fs b/tests/fsharp/Compiler/Language/SpanTests.fs index aef001deec2..5e4d39af8dd 100644 --- a/tests/fsharp/Compiler/Language/SpanTests.fs +++ b/tests/fsharp/Compiler/Language/SpanTests.fs @@ -4,14 +4,14 @@ namespace FSharp.Compiler.UnitTests open System open FSharp.Compiler.Diagnostics -open NUnit.Framework +open Xunit open FSharp.Test #if NETCOREAPP -[] + module SpanTests = - [] + [] let Script_SpanForInDo() = let script = """ @@ -30,7 +30,7 @@ test () """ CompilerAssert.RunScript script [] - [] + [] let Script_SpanForInBoundsDo() = let script = """ @@ -50,7 +50,7 @@ test () CompilerAssert.RunScript script [] - [] + [] let Script_EmptySpanForInBoundsDo() = let script = """ @@ -70,7 +70,7 @@ test () CompilerAssert.RunScript script [] - [] + [] let Script_ReadOnlySpanForInDo() = let script = """ @@ -90,7 +90,7 @@ test () CompilerAssert.RunScript script [] - [] + [] let Script_ReadOnlySpanForInBoundsDo() = let script = """ @@ -111,7 +111,7 @@ test () CompilerAssert.RunScript script [] - [] + [] let ``Invalid usage of type abbreviated span should fail to compile``() = CompilerAssert.TypeCheckWithErrors """ open System @@ -148,7 +148,7 @@ let test () = FSharpDiagnosticSeverity.Error, 412, (19, 27, 19, 29), "A type instantiation involves a byref type. This is not permitted by the rules of Common IL." |] - [] + [] let ``Type abbreviation that boxes a span should fail to compile``() = CompilerAssert.TypeCheckWithErrors """ open System @@ -161,7 +161,7 @@ let f (x: TA) = () FSharpDiagnosticSeverity.Error, 3300, (6, 8, 6, 9), "The parameter 'x' has an invalid type 'TA'. This is not permitted by the rules of Common IL." |] - [] + [] let ``A custom IsByRefLikeAttribute can define a ref struct``() = CompilerAssert.TypeCheckWithErrors """ namespace System.Runtime.CompilerServices @@ -175,4 +175,22 @@ type IsByRefLikeAttribute() = inherit Attribute() type T(span: Span) = struct end """ [| |] -#endif \ No newline at end of file + + [] + let ``A byref struct with custom attr can be passed as typar``() = + CompilerAssert.TypeCheckWithErrors """ +namespace System.Runtime.CompilerServices + +open System + +[] +type IsByRefLikeAttribute() = inherit Attribute() + +[] +type T(span: Span) = struct end + +module WhatEver = + let processT (a: Action, ie: seq, asList: list) = () + """ + [| FSharpDiagnosticSeverity.Error, 3300, (13, 45, 13, 51), "The parameter 'asList' has an invalid type 'T list'. This is not permitted by the rules of Common IL." |] +#endif diff --git a/tests/fsharp/Compiler/Language/StaticNameResolutionTests.fs b/tests/fsharp/Compiler/Language/StaticNameResolutionTests.fs index def04c10063..f32c9f7a6c0 100644 --- a/tests/fsharp/Compiler/Language/StaticNameResolutionTests.fs +++ b/tests/fsharp/Compiler/Language/StaticNameResolutionTests.fs @@ -3,15 +3,15 @@ namespace FSharp.Compiler.UnitTests open System.Collections.Immutable -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Test.Utilities open Microsoft.CodeAnalysis -[] + module StaticNameResolutionTests = - [] + [] let ``C# nested type is accessible even when extension method is present with same name``() = let csSrc = """ diff --git a/tests/fsharp/Compiler/Language/StringConcatOptimizationTests.fs b/tests/fsharp/Compiler/Language/StringConcatOptimizationTests.fs index d361eb8adf2..ca911a9bcf1 100644 --- a/tests/fsharp/Compiler/Language/StringConcatOptimizationTests.fs +++ b/tests/fsharp/Compiler/Language/StringConcatOptimizationTests.fs @@ -3,15 +3,15 @@ namespace FSharp.Compiler.UnitTests open System -open NUnit.Framework +open Xunit open FSharp.Test #if !NETCOREAPP -[] + module StringConcatOptimizationTests = // helper methods in this test only run on the full framework - [] + [] let Optimizations () = let baseSource = """ module Test diff --git a/tests/fsharp/Compiler/Language/StringInterpolation.fs b/tests/fsharp/Compiler/Language/StringInterpolation.fs index 293a44459dc..9362d7d73b9 100644 --- a/tests/fsharp/Compiler/Language/StringInterpolation.fs +++ b/tests/fsharp/Compiler/Language/StringInterpolation.fs @@ -2,11 +2,10 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Compiler.Diagnostics open FSharp.Test -[] module StringInterpolationTests = let SimpleCheckTest text = @@ -18,7 +17,7 @@ let check msg a b = """ + text)) - [] + [] let ``Basic string interpolation`` () = SimpleCheckTest """ @@ -43,7 +42,7 @@ check "basic-string-interp9" $"{1} 2" """ - [] + [] let ``Neighbouring specifiers for string interpolation`` () = SimpleCheckTest """ @@ -100,7 +99,7 @@ check "nbr-interp7c" $"this is %d{1}%d{2} %d{3}" "this is 12 3" check "nbr-interp7c" $"this is %d{1}%d{2}" "this is 12" """ - [] + [] let ``Basic string interpolation verbatim strings`` () = SimpleCheckTest """ @@ -130,7 +129,7 @@ check "basic-string-interp-verbatim6b" $@"this i\s {1}" "this i\s 1" """ - [] + [] let ``Basic string interpolation triple quote strings`` () = SimpleCheckTest " @@ -157,7 +156,7 @@ is {1+1}\"\"\" is 2\"\"\" " - [] + [] let ``String interpolation using atomic expression forms`` () = SimpleCheckTest """ @@ -180,7 +179,7 @@ check "vcewwei8" $"abc{4%3}def" "abc1def" """ - [] + [] let ``String interpolation using nested control flow expressions`` () = SimpleCheckTest """ @@ -247,7 +246,7 @@ check "vcewweh17" $"abc{while false do ()}def" "abcdef" - [] + [] let ``String interpolation using nested string`` () = SimpleCheckTest " @@ -263,7 +262,7 @@ do " - [] + [] let ``Triple quote string interpolation using nested string`` () = SimpleCheckTest " @@ -283,7 +282,7 @@ for(i=0;i<100;++i) { }\"\"\" " - [] + [] let ``Mixed quote string interpolation using nested string`` () = SimpleCheckTest " @@ -311,7 +310,7 @@ check \"vcewweh22n2\" END;\"\"\" " - [] + [] let ``String interpolation to FormattableString`` () = SimpleCheckTest """ @@ -340,7 +339,7 @@ check "fwejwflpej17" (fmt_de $"abc {30000,-10:N2} def {40000:N2} hij") "abc 30.0 """ - [] + [] let ``String interpolation to IFormattable`` () = SimpleCheckTest """ @@ -369,7 +368,7 @@ check "fwejwflpej17" (fmt_de $"abc {30000,-10:N2} def {40000:N2} hij") "abc 30.0 """ - [] + [] let ``String interpolation to PrintFormat`` () = SimpleCheckTest """ @@ -389,7 +388,7 @@ check "fwejwflpej4" (sb.ToString()) "0abcabc1" """ - [] + [] let ``String interpolation using .NET Formats`` () = SimpleCheckTest """ @@ -404,7 +403,7 @@ check "vcewweh225u" $"abc %5d{1}" "abc 1" check "vcewweh225u" $"abc %-5d{1}" "abc 1 " """ - [] + [] let ``String interpolation of null`` () = SimpleCheckTest """ @@ -415,7 +414,7 @@ check "vcewweh221q3" $"abc %s{null}" "abc " check "vcewweh221q4" $"abc %s{null} def" "abc def" """ - [] + [] let ``String interpolation of basic types`` () = SimpleCheckTest """ @@ -450,7 +449,7 @@ check "vcewweh221q1l" $"%d{1un}" "1" check "vcewweh221q1" $"%f{1.0}" "1.000000" """ - [] + [] let ``String interpolation using escaped braces`` () = SimpleCheckTest """ @@ -463,7 +462,7 @@ check "vcewweh228d" "{{" "{{" check "vcewweh229f" "}}" "}}" """ - [] + [] let ``String interpolation using verbatim strings`` () = SimpleCheckTest """ @@ -477,7 +476,7 @@ check "vcewweh229f" "}}" "}}" """ - [] + [] let ``String interpolation using record data`` () = SimpleCheckTest """ @@ -507,7 +506,7 @@ check "vcewweh21" $"abc{{X=1; Y=2}}def" "abc{X=1; Y=2}def" """ - [] + [] let ``String interpolation using printf formats`` () = SimpleCheckTest """ @@ -538,23 +537,23 @@ check "vcewweh22g" $"x = %A{s}" "x = \"sixsix\"" check "vcewweh20" $"x = %A{1}" "x = 1" """ - [] + [] let ``%B fails for langVersion 5.0`` () = CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:5.0" |] """printf "%B" 10""" [|(FSharpDiagnosticSeverity.Error, 3350, (1, 8, 1, 12), "Feature 'binary formatting for integers' is not available in F# 5.0. Please use language version 6.0 or greater.")|] - [] + [] let ``%B succeeds for langVersion preview`` () = CompilerAssert.CompileExeAndRunWithOptions( - [| "--langversion:preview" |], + [| |], """ let check msg a b = if a = b then printfn "test case '%s' succeeded" msg else failwithf "test case '%s' failed, expected %A, got %A" msg b a check "vcewweh22a" $"x = %B{19}" "x = 10011" """) - [] + [] let ``String interpolation using list and array data`` () = SimpleCheckTest """ @@ -581,7 +580,7 @@ check "vcewweh22k" $"x = %0A{[|0..100|]} " "x = [|0; 1; 2; 3; 4; 5; 6; 7; 8; 9; """ - [] + [] let ``Quotations of interpolation`` () = SimpleCheckTest """ @@ -590,14 +589,14 @@ check "vcewweh1" "Call (None, PrintFormatToString, [NewObject (PrintfFormat`5, Value (this %P() is 2), NewArray (Object, Call (None, Box, [Value (1)])), Value ())])" """ - [] + [] let ``Quotations in interpolation`` () = SimpleCheckTest """ check "check-quotation1" $"this {<@ 1 @>} is 2" "this Value (1) is 2" """ - [] + [] let ``Object expression in interpolation`` () = SimpleCheckTest """ @@ -606,7 +605,7 @@ check "check-object-expression-in-interpolation1" "this AA is 2" """ - [] + [] let ``Exception handling in interpolation`` () = SimpleCheckTest """ @@ -615,7 +614,7 @@ check "check-object-expression-in-interpolation1" "this AA is 2" """ - [] + [] let ``String interpolation using anonymous records`` () = SimpleCheckTest """ @@ -625,7 +624,7 @@ check "vcewweh23" $"abc{({| A=1 |})}def" "abc{ A = 1 }def" """ - [] + [] let ``Basic string interpolation (4.7)`` () = CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:4.7" |] """ @@ -635,7 +634,7 @@ let x = $"one" "Feature 'string interpolation' is not available in F# 4.7. Please use language version 5.0 or greater.")|] - [] + [] let ``Basic string interpolation negative`` () = let code = """ let x1 = $"one %d{System.String.Empty}" // mismatched types @@ -643,9 +642,9 @@ let x2 = $"one %s{1}" // mismatched types let x3 = $"one %s" // naked percent in interpolated let x4 = $"one %d" // naked percent in interpolated let x5 = $"one %A" // naked percent in interpolated -let x6 = $"one %P" // interpolation hole marker in interploation -let x7 = $"one %P()" // interpolation hole marker in interploation -let x8 = $"one %P(){1}" // interpolation hole marker in interploation +let x6 = $"one %P" // interpolation hole marker in interpolation +let x7 = $"one %P()" // interpolation hole marker in interpolation +let x8 = $"one %P(){1}" // interpolation hole marker in interpolation let x9 = $"one %f" // naked percent in interpolated let xa = $"one %d{3:N}" // mix of formats let xc = $"5%6" // bad F# format specifier @@ -712,7 +711,7 @@ let xd = $"%A{ }" // empty expression "Invalid interpolated string. This interpolated string expression fill is empty, an expression was expected.") |] - [] + [] let ``String interpolation FormattableString negative`` () = let code = """ @@ -731,7 +730,7 @@ let x3 : FormattableString = $"one %10s{String.Empty}" // no %10s in Formattable "Invalid interpolated string. Interpolated strings used as type IFormattable or type FormattableString may not use '%' specifiers, only .NET-style interpolands such as '{expr}', '{expr,3}' or '{expr:N5}' may be used.")|] - [] + [] let ``String interpolation negative nested in single`` () = let code = """ @@ -767,7 +766,7 @@ let s9 = @$"123{456}789{$@"012"}345" (FSharpDiagnosticSeverity.Error, 3373, (12, 25, 12, 28), "Invalid interpolated string. Single quote or verbatim string literals may not be used in interpolated expressions in single quote or verbatim strings. Consider using an explicit 'let' binding for the interpolation expression or use a triple quote string as the outer string literal.")|] - [] + [] let ``String interpolation negative nested in triple`` () = let code = " @@ -794,7 +793,7 @@ let TripleInterpolatedInVerbatimInterpolated = $\"123{456}789{$\"\"\"012\"\"\"}3 (FSharpDiagnosticSeverity.Error, 3374, (9, 62, 9, 66), "Invalid interpolated string. Triple quote string literals may not be used in interpolated expressions. Consider using an explicit 'let' binding for the interpolation expression.")|] - [] + [] let ``String interpolation negative incomplete string`` () = let code = """let x1 = $"one %d{System.String.Empty}""" CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:5.0" |] @@ -804,7 +803,7 @@ let TripleInterpolatedInVerbatimInterpolated = $\"123{456}789{$\"\"\"012\"\"\"}3 (FSharpDiagnosticSeverity.Error, 3379, (1, 38, 1, 39), "Incomplete interpolated string begun at or before here")|] - [] + [] let ``String interpolation negative incomplete string fill`` () = let code = """let x1 = $"one %d{System.String.Empty""" CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:5.0" |] @@ -814,7 +813,7 @@ let TripleInterpolatedInVerbatimInterpolated = $\"123{456}789{$\"\"\"012\"\"\"}3 (FSharpDiagnosticSeverity.Error, 3378, (1, 18, 1, 19), "Incomplete interpolated string expression fill begun at or before here")|] - [] + [] let ``String interpolation negative incomplete verbatim string`` () = let code = """let x1 = @$"one %d{System.String.Empty} """ CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:5.0" |] @@ -824,7 +823,7 @@ let TripleInterpolatedInVerbatimInterpolated = $\"123{456}789{$\"\"\"012\"\"\"}3 (FSharpDiagnosticSeverity.Error, 3380, (1, 39, 1, 40), "Incomplete interpolated verbatim string begun at or before here")|] - [] + [] let ``String interpolation negative incomplete triple quote string`` () = let code = "let x1 = $\"\"\"one" CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:5.0" |] @@ -838,7 +837,7 @@ let TripleInterpolatedInVerbatimInterpolated = $\"123{456}789{$\"\"\"012\"\"\"}3 (FSharpDiagnosticSeverity.Error, 3381, (1, 10, 1, 14), "Incomplete interpolated triple-quote string begun at or before here")|] - [] + [] let ``String interpolation extra right brace single quote`` () = let code = "let x1 = $\"}\"" CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:5.0" |] @@ -846,7 +845,7 @@ let TripleInterpolatedInVerbatimInterpolated = $\"123{456}789{$\"\"\"012\"\"\"}3 [|(FSharpDiagnosticSeverity.Error, 3383, (1, 10, 1, 14), "A '}' character must be escaped (by doubling) in an interpolated string.")|] - [] + [] let ``String interpolation extra right brace verbatim`` () = let code = "let x1 = @$\"}\"" CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:5.0" |] @@ -854,7 +853,7 @@ let TripleInterpolatedInVerbatimInterpolated = $\"123{456}789{$\"\"\"012\"\"\"}3 [|(FSharpDiagnosticSeverity.Error, 3383, (1, 10, 1, 15), "A '}' character must be escaped (by doubling) in an interpolated string.")|] - [] + [] let ``String interpolation extra right brace triple`` () = let code = "let x1 = $\"\"\"}\"\"\"" CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:5.0" |] @@ -862,7 +861,7 @@ let TripleInterpolatedInVerbatimInterpolated = $\"123{456}789{$\"\"\"012\"\"\"}3 [|(FSharpDiagnosticSeverity.Error, 3383, (1, 10, 1, 18), "A '}' character must be escaped (by doubling) in an interpolated string.")|] - [] + [] let ``String interpolation extra right brace single quote with hole`` () = let code = "let x1 = $\"{0}}\"" CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:5.0" |] @@ -870,7 +869,7 @@ let TripleInterpolatedInVerbatimInterpolated = $\"123{456}789{$\"\"\"012\"\"\"}3 [|(FSharpDiagnosticSeverity.Error, 3383, (1, 14, 1, 17), "A '}' character must be escaped (by doubling) in an interpolated string.")|] - [] + [] let ``String continuation character gives right ranges`` () = let code = "let x1 = \"hello \\\n world\", foo" CompilerAssert.TypeCheckWithErrorsAndOptions [| |] diff --git a/tests/fsharp/Compiler/Language/StructActivePatternTests.fs b/tests/fsharp/Compiler/Language/StructActivePatternTests.fs index c1e71755e1b..aac654f549c 100644 --- a/tests/fsharp/Compiler/Language/StructActivePatternTests.fs +++ b/tests/fsharp/Compiler/Language/StructActivePatternTests.fs @@ -2,15 +2,14 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Compiler.Diagnostics open FSharp.Test -[] module StructActivePatternTests = let private pass = CompilerAssert.PassWithOptions [||] - let private fail = CompilerAssert.TypeCheckWithErrorsAndOptions [||] + let private fail = CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:8.0"|] let private run src = CompilerAssert.CompileExeAndRunWithOptions( [||], (""" @@ -19,15 +18,15 @@ let fail msg = failwith msg """ + src)) - [] + [] let ``Partial active pattern returns Option`1`` () = pass "let (|Foo|_|) x = None" - [] + [] let ``Partial struct active pattern returns ValueOption`1`` () = pass "[] let (|P1|_|) x = ValueNone" - [] + [] let ``StructAttribute can be placed at the active pattern return type annotation`` () = pass """ @@ -35,7 +34,7 @@ let (|P1|_|) x: [] _ = ValueNone let (|P2|_|) x: [] _ = ValueNone """ - [] + [] let ``Partial struct active pattern results can be retrieved`` () = run """ [] @@ -88,7 +87,7 @@ match t4 with | _ -> fail "nested" """ - [] + [] let ``[] attribute is rotated to the return value``() = run """ @@ -122,7 +121,7 @@ match ret_attrs, binding_attrs with | "MyAttribute", "" -> () | _ -> fail $"ret_attrs = {ret_attrs}, binding_attrs = {binding_attrs} method = {method}" """ - [] + [] let ``Implicitly-targeted attribute on let binding do not target return``() = run """ @@ -160,17 +159,17 @@ match ret_attrs, binding_attrs with // negative tests - [] + [] let ``Struct active pattern (-langversion:5.0)`` () = CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:5.0"|] """ [] let (|Foo|_|) x = ValueNone """ - [|(FSharpDiagnosticSeverity.Error, 3350, (2, 1, 3, 16), + [|(FSharpDiagnosticSeverity.Error, 3350, (3, 6, 3, 13), "Feature 'struct representation for active patterns' is not available in F# 5.0. Please use language version 6.0 or greater.")|] - [] + [] let ``StructAttribute must explicitly target active pattern return value`` () = fail """ @@ -179,10 +178,10 @@ let (|Foo|_|) x = ValueNone """ [|(FSharpDiagnosticSeverity.Error, 842, (2, 3, 2, 9), "This attribute is not valid for use on this language element"); - (FSharpDiagnosticSeverity.Error, 3350, (2, 1, 3, 16), - "Feature 'Boolean-returning and return-type-directed partial active patterns' is not available in F# 8.0. Please use language version 'PREVIEW' or greater.")|] + (FSharpDiagnosticSeverity.Error, 3350, (3, 6, 3, 13), + "Feature 'Boolean-returning and return-type-directed partial active patterns' is not available in F# 8.0. Please use language version 9.0 or greater.")|] - [] + [] let ``StructAttribute not allowed on other bindings than partial active pattern definitions`` () = fail """ @@ -195,10 +194,10 @@ let f x = x [] let (|A|B|) x = A """ - [|(FSharpDiagnosticSeverity.Error, 3385, (2, 1, 3, 6), + [|(FSharpDiagnosticSeverity.Error, 3385, (3, 5, 3, 6), "The use of '[]' on values, functions and methods is only allowed on partial active pattern definitions") - (FSharpDiagnosticSeverity.Error, 3385, (5, 1, 6, 8), + (FSharpDiagnosticSeverity.Error, 3385, (6, 5, 6, 6), "The use of '[]' on values, functions and methods is only allowed on partial active pattern definitions") - (FSharpDiagnosticSeverity.Error, 3385, (8, 1, 9, 14), + (FSharpDiagnosticSeverity.Error, 3385, (9, 6, 9, 11), "The use of '[]' on values, functions and methods is only allowed on partial active pattern definitions")|] diff --git a/tests/fsharp/Compiler/Language/TypeAttributeTests.fs b/tests/fsharp/Compiler/Language/TypeAttributeTests.fs index 23d09d9e706..4e82cce7df3 100644 --- a/tests/fsharp/Compiler/Language/TypeAttributeTests.fs +++ b/tests/fsharp/Compiler/Language/TypeAttributeTests.fs @@ -1,20 +1,20 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Compiler.Diagnostics -[] + module TypeAttributeTests = - [] + [] let ``Attribute can be applied to type definition``() = CompilerAssert.Pass """ [] type Point = {x:int; y:int} """ - [] + [] let ``Attribute cannot be applied to optional type extension``() = CompilerAssert.TypeCheckSingleError """ @@ -29,7 +29,7 @@ type String with (4, 1, 4, 15) "Attributes cannot be applied to type extensions." - [] + [] let ``Attribute cannot be applied to intrinsic type extension``() = CompilerAssert.TypeCheckSingleError """ diff --git a/tests/fsharp/Compiler/Language/TypeDirectedConversionTests.fs b/tests/fsharp/Compiler/Language/TypeDirectedConversionTests.fs index 054664224c9..37c8596d3e5 100644 --- a/tests/fsharp/Compiler/Language/TypeDirectedConversionTests.fs +++ b/tests/fsharp/Compiler/Language/TypeDirectedConversionTests.fs @@ -2,13 +2,12 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Compiler.Diagnostics -[] module TypeDirectedConversionTests = - [] + [] let ``int32 converts to float in method call parameter``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"--optimize-"|], """ @@ -33,7 +32,7 @@ let test() = Thing.Do(100) """ ])) - [] + [] let ``int32 converts to System.Nullable in method call parameter``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"--optimize-"|], """ @@ -59,7 +58,7 @@ let test() = Thing.Do(100) """ ])) - [] + [] let ``int32 converts to float in method call property setter``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"--optimize-"|], """ @@ -91,7 +90,7 @@ let test() = Thing(Do = 100) ])) - [] + [] let ``int32 converts to System.Nullable in method call property setter``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"--optimize-"|], """ @@ -123,7 +122,7 @@ let test() = Thing(Do = 100) """ ])) - [] + [] let ``int converts to System.Nullable in method call property setter``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"--optimize-"|], """ @@ -154,7 +153,7 @@ let test() = Thing(Do = 100) """ ])) - [] + [] let ``int converts to System.Nullable in method call parameter``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"--optimize-"|], """ @@ -179,7 +178,7 @@ let test() = Thing.Do(100) """ ])) - [] + [] let ``Passing an incompatible argument for System.Nullable<'T> method call parameter produces accurate error``() = CompilerAssert.TypeCheckSingleError """ @@ -199,7 +198,7 @@ is not compatible with type 'System.Nullable' """ - [] + [] let ``Assigning a 'T value to a System.Nullable<'T> binding succeeds``() = CompilerAssert.TypeCheckSingleError """ @@ -212,7 +211,7 @@ let test(): System.Nullable = 1 (4, 36, 4, 37) """This expression uses the implicit conversion 'System.Nullable.op_Implicit(value: int) : System.Nullable' to convert type 'int' to type 'System.Nullable'. See https://aka.ms/fsharp-implicit-convs. This warning may be disabled using '#nowarn "3391".""" - [] + [] let ``Assigning an int32 to a System.Nullable binding fails``() = CompilerAssert.TypeCheckSingleError """ @@ -228,7 +227,7 @@ let test(): System.Nullable = 1 but here has type 'int' """ - [] + [] let ``Overloading on System.Nullable and Result both work without error``() = CompilerAssert.Pass """ @@ -244,7 +243,7 @@ let test() = """ - [] + [] let ``Overloading on System.Nullable and Result produces a builtin conversion warning when Nullable is picked``() = CompilerAssert.TypeCheckSingleErrorWithOptions [| "--warnon:3389" |] @@ -263,7 +262,7 @@ let test() = (9, 9, 9, 10) """This expression uses a built-in implicit conversion to convert type 'int' to type 'System.Nullable'. See https://aka.ms/fsharp-implicit-convs.""" - [] + [] let ``Overloading on System.Nullable, System.Nullable<'T> and int all work without error``() = CompilerAssert.RunScript """ @@ -283,7 +282,7 @@ let test() = test() """ [] - [] + [] let ``Picking overload for typar does not favor any form of System.Nullable nor produce ambiguity warnings``() = CompilerAssert.TypeCheckSingleError """ @@ -303,7 +302,8 @@ let test(x: 'T) = (11, 5, 11, 11) """This construct causes code to be less generic than indicated by the type annotations. The type variable 'T has been constrained to be type 'int'.""" - [] + [] + // https://github.com/dotnet/fsharp/issues/13731 let ``Picking overload for typar fails when incompatible types are part of the candidate set``() = CompilerAssert.TypeCheckWithErrors """ @@ -352,7 +352,7 @@ Candidates: - static member M2.A: n: int -> unit""") |] - [] + [] let ``Ambiguous overload for typar does not pick System.Nullable<'T>``() = CompilerAssert.TypeCheckSingleError """ @@ -378,7 +378,7 @@ Candidates: - static member M.A: n: float -> unit - static member M.A: n: int -> unit""" - [] + [] let ``Passing an argument in nested method call property setter works``() = CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"--optimize-"|], """ @@ -422,7 +422,7 @@ let test() = """ ])) - [] + [] let ``Test retrieving an argument provided in a nested method call property setter works``() = CompilerAssert.RunScript """ @@ -441,7 +441,7 @@ let test() = if not (test().OtherArgs.Value.Name = "test") then failwith "Unexpected value was returned after setting Name" """ [] - [] + [] let ``Prefer nullable conversion only candidate when multiple candidates require conversions``() = CompilerAssert.RunScript """ @@ -454,7 +454,7 @@ let test() = M.A(System.DateTime.UtcNow, 1) if test() <> 1 then failwith "Incorrect overload picked" """ [] - [] + [] let ``Prefer nullable conversion over numeric conversion``() = CompilerAssert.RunScript """ @@ -467,7 +467,7 @@ let test() = M.A(0) if test() <> 2 then failwith "Incorrect overload picked" """ [] - [] + [] let ``Prefer nullable conversion over op_Implicit conversion``() = CompilerAssert.RunScript @@ -482,7 +482,8 @@ if test() <> 2 then failwith "Incorrect overload picked" """ [] - [] + [] + // https://github.com/dotnet/fsharp/issues/14318 let ``Picking overload for TDC candidate set fails as ambiguous while one candidate requires more conversions``() = CompilerAssert.TypeCheckSingleError """ diff --git a/tests/fsharp/Compiler/Language/UIntTests.fs b/tests/fsharp/Compiler/Language/UIntTests.fs index 05bf78bbebf..eeb518f93c3 100644 --- a/tests/fsharp/Compiler/Language/UIntTests.fs +++ b/tests/fsharp/Compiler/Language/UIntTests.fs @@ -1,9 +1,9 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test -[] + module UIntTests = let ``uint type abbreviation works`` () = let src = "let x = uint 12" diff --git a/tests/fsharp/Compiler/Language/WitnessTests.fs b/tests/fsharp/Compiler/Language/WitnessTests.fs index 74e7cba55f4..46cfad83240 100644 --- a/tests/fsharp/Compiler/Language/WitnessTests.fs +++ b/tests/fsharp/Compiler/Language/WitnessTests.fs @@ -2,7 +2,7 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Test.Utilities open FSharp.Test.Compiler @@ -10,12 +10,12 @@ open TestFramework #if !NETCOREAPP -[] + module WitnessTests = - [] + [] let ``Witness expressions are created as a result of compiling the type provider tests`` () = - let dir = getTestsDirectory __SOURCE_DIRECTORY__ "../../typeProviders/helloWorld" + let dir = __SOURCE_DIRECTORY__ ++ "../../typeProviders/helloWorld" Fsx (sprintf """ #load @"%s" """ (dir ++ "provider.fsx")) diff --git a/tests/fsharp/Compiler/Libraries/Core/Collections/CollectionTests.fs b/tests/fsharp/Compiler/Libraries/Core/Collections/CollectionTests.fs index 934936fd0c3..c72e5dd916c 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Collections/CollectionTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Collections/CollectionTests.fs @@ -2,27 +2,23 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit + -[] module ``Array2D Tests`` = - [] + [] let ``Iter should not throw on non-zero based 2D arrays``() = // Regression for FSHARP1.0: 5919 // bug in array2D functions would cause iter to blow up let a = Array2D.createBased 1 5 10 10 0.0 - let testDelegate = TestDelegate (fun _ -> a |> Array2D.iter (printf "%f")) - - Assert.DoesNotThrow testDelegate + a |> Array2D.iter (printf "%f") - [] + [] let ``Iteri should not throw on non-zero based 2D arrays``() = // Regression for FSHARP1.0: 5919 // bug in array2D functions would cause iteri to blow up let a = Array2D.createBased 1 5 10 10 0.0 - let testDelegate = TestDelegate (fun _ -> a |> Array2D.iteri (fun _ _ x -> printf "%f" x)) - - Assert.DoesNotThrow testDelegate \ No newline at end of file + a |> Array2D.iteri (fun _ _ x -> printf "%f" x) diff --git a/tests/fsharp/Compiler/Libraries/Core/Collections/IEnumerableTests.fs b/tests/fsharp/Compiler/Libraries/Core/Collections/IEnumerableTests.fs index d9671884293..e7bca1b380e 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Collections/IEnumerableTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Collections/IEnumerableTests.fs @@ -2,9 +2,9 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit + -[] module ``IEnumerable Tests`` = // Regression test for FSHARP1.0:4726 @@ -34,7 +34,7 @@ module ``IEnumerable Tests`` = end end - [] + [] let ``Dispose``() = let _ = Seq.cast (new C()) |> Seq.map (fun x -> use o = x; o) |> Seq.length diff --git a/tests/fsharp/Compiler/Libraries/Core/Collections/ListTests.fs b/tests/fsharp/Compiler/Libraries/Core/Collections/ListTests.fs index 626f9c6e2c0..c4eb8cba354 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Collections/ListTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Collections/ListTests.fs @@ -2,14 +2,14 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Compiler.Diagnostics -[] + module ``List Tests`` = - [] + [] let ``List hd should not exist``() = // Regression test for FSharp1.0:5641 // Title: List.hd/tl --> List.head/tail @@ -25,7 +25,7 @@ List.hd [1] |> ignore - [] + [] let ``List tl should not exist``() = // Regression test for FSharp1.0:5641 // Title: List.hd/tl --> List.head/tail @@ -39,19 +39,19 @@ List.tl [1] |> ignore (2, 6, 2, 8) "The value, constructor, namespace or type 'tl' is not defined." - [] + [] let ``List head of empty list``() = - let testDelegate = TestDelegate (fun _ -> (List.head [] |> ignore)) + let testDelegate = fun _ -> (List.head [] |> ignore) Assert.Throws testDelegate |> ignore - [] + [] let ``List tail of empty list``() = - let testDelegate = TestDelegate (fun _ -> (List.tail [] |> ignore)) + let testDelegate = fun _ -> (List.tail [] |> ignore) Assert.Throws testDelegate |> ignore - [] + [] let ``List head and tail``() = Assert.areEqual 1 (List.head [1 .. 10]) Assert.areEqual "a" (List.head ["a"]) diff --git a/tests/fsharp/Compiler/Libraries/Core/Collections/MapTests.fs b/tests/fsharp/Compiler/Libraries/Core/Collections/MapTests.fs index a0418bb000b..c9450738b2c 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Collections/MapTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Collections/MapTests.fs @@ -2,16 +2,14 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit + -[] module ``Map Tests`` = - [] + [] let ``Equality should be implemented on map``() = // Dev11:19569 - this used to throw an ArgumentException saying Object didn't implement IComparable let m = Map.ofArray [| 1, obj() |] - let testDelegate = TestDelegate (fun _ -> (m = m) |> ignore) - - Assert.DoesNotThrow testDelegate \ No newline at end of file + (m = m) |> ignore \ No newline at end of file diff --git a/tests/fsharp/Compiler/Libraries/Core/ExtraTopLevelOperators/DictionaryTests.fs b/tests/fsharp/Compiler/Libraries/Core/ExtraTopLevelOperators/DictionaryTests.fs index d52624ee01c..1faab163a46 100644 --- a/tests/fsharp/Compiler/Libraries/Core/ExtraTopLevelOperators/DictionaryTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/ExtraTopLevelOperators/DictionaryTests.fs @@ -2,12 +2,12 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test module ``Dictionary Tests`` = - [] + [] let ``Assigning to dictionary should compile``() = // Regression test for FSHARP1.0:5365 @@ -26,7 +26,7 @@ module N.M dict.[key] <- value """ - [] + [] let ``Assigning to dictionary with type constraint should compile``() = // Regression test for FSHARP1.0:5365 // Used to give error: value must be local and mutable in order to mutate the contents of a value type, e.g. 'let mutable x = ...' diff --git a/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/CastToUnitsTests.fs b/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/CastToUnitsTests.fs index be85ccd4092..dde7f59f5d8 100644 --- a/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/CastToUnitsTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/CastToUnitsTests.fs @@ -2,15 +2,15 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test -[] + module ``Cast to Units Tests`` = - [] + [] let ``Casting to Measures should compile``() = - CompilerAssert.PassWithOptions [| "--langversion:preview" |] + CompilerAssert.PassWithOptions [| |] """ module M diff --git a/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/ComparisonTests.fs b/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/ComparisonTests.fs index e3b5abf34ff..4b18cced18d 100644 --- a/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/ComparisonTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/ComparisonTests.fs @@ -2,24 +2,24 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test -[] + module ``Comparison Tests`` = type 'a www = W of 'a - [] + [] let ``Comparisons with wrapped NaN``() = // Regression test for FSHARP1.0:5640 // This is a sanity test: more coverage in FSHARP suite... - Assert.IsFalse (W System.Double.NaN = W System.Double.NaN) - Assert.IsTrue ((W System.Double.NaN).Equals(W System.Double.NaN)) + Assert.False (W System.Double.NaN = W System.Double.NaN) + Assert.True ((W System.Double.NaN).Equals(W System.Double.NaN)) Assert.areEqual (compare (W System.Double.NaN) (W System.Double.NaN)) 0 - [] + [] let ``Comparisons with wrapped NaN in FSI``() = // Regression test for FSHARP1.0:5640 // This is a sanity test: more coverage in FSHARP suite... diff --git a/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/StringFormatTests.fs b/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/StringFormatTests.fs index 46380acecde..218cbdafe9d 100644 --- a/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/StringFormatTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/StringFormatTests.fs @@ -2,13 +2,13 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test -[] + module ``String Format Tests`` = - [] + [] let ``sprintf with %d format specifier``() = // Regression test for FSHARP1.0:4120 // format specifier %d does not work correctly with UInt64 values @@ -32,7 +32,7 @@ module ``String Format Tests`` = Assert.areEqual (sprintf "%d" 1un) "1" Assert.areEqual (sprintf "%d" -1n) "-1" - [] + [] let ``sprintf with %i format specifier``() = // Regression test for FSHARP1.0:4120 // format specifier %i does not work correctly with UInt64 values @@ -56,7 +56,7 @@ module ``String Format Tests`` = Assert.areEqual (sprintf "%i" 1un) "1" Assert.areEqual (sprintf "%i" -1n) "-1" - [] + [] let ``sprintf with %u format specifier``() = // Regression test for FSHARP1.0:4120 // format specifier %u does not work correctly with UInt64 values @@ -80,7 +80,7 @@ module ``String Format Tests`` = Assert.areEqual (sprintf "%u" 1un) "1" Assert.areEqual (sprintf "%u" -1n) (if System.IntPtr.Size = 4 then "4294967295" else "18446744073709551615") - [] + [] let ``string constructor``() = // Regression test for FSHARP1.0:5894 @@ -139,7 +139,7 @@ module ``String Format Tests`` = Assert.areEqual (string nanf) "NaN" Assert.areEqual (string (new System.Guid("210f4d6b-cb42-4b09-baa1-f1aa8e59d4b0"))) "210f4d6b-cb42-4b09-baa1-f1aa8e59d4b0" - [] + [] let ``string constructor in FSI``() = // Regression test for FSHARP1.0:5894 diff --git a/tests/fsharp/Compiler/Libraries/Core/NativeInterop/StackallocTests.fs b/tests/fsharp/Compiler/Libraries/Core/NativeInterop/StackallocTests.fs index 1e244b53aa5..b01da9cd01e 100644 --- a/tests/fsharp/Compiler/Libraries/Core/NativeInterop/StackallocTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/NativeInterop/StackallocTests.fs @@ -2,19 +2,19 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Compiler.Diagnostics #nowarn "9" -[] + module ``Stackalloc Tests`` = type E = | A = 1 | B = 2 - [] + [] let ``Stackalloc of DateTime``() = let data = NativeInterop.NativePtr.stackalloc 100 let now = System.DateTime.Now @@ -31,7 +31,7 @@ module ``Stackalloc Tests`` = let datai = NativeInterop.NativePtr.toByRef (NativeInterop.NativePtr.add data i) Assert.areEqual datai later - [] + [] let ``Stackalloc of enum``() = let data = NativeInterop.NativePtr.stackalloc 10 @@ -51,17 +51,15 @@ module ``Stackalloc Tests`` = let expected = if (i % 2)=1 then E.A else E.B Assert.areEqual datai expected - [] + [] let ``Stackalloc of imported enum``() = - Assert.DoesNotThrow (TestDelegate (fun () -> - NativeInterop.NativePtr.stackalloc 1 |> ignore)) + NativeInterop.NativePtr.stackalloc 1 |> ignore - [] + [] let ``Stackalloc of imported struct``() = - Assert.DoesNotThrow (TestDelegate (fun () -> - NativeInterop.NativePtr.stackalloc 1 |> ignore)) + NativeInterop.NativePtr.stackalloc 1 |> ignore - [] + [] let ``Stackalloc of imported class``() = CompilerAssert.TypeCheckSingleError """ @@ -74,7 +72,7 @@ let _ = NativeInterop.NativePtr.stackalloc 1 (4, 9, 4, 43) "A generic construct requires that the type 'System.Object' is an unmanaged type" - [] + [] let ``Stackalloc of imported interface``() = CompilerAssert.TypeCheckSingleError """ @@ -87,7 +85,7 @@ let _ = NativeInterop.NativePtr.stackalloc 1 (4, 9, 4, 43) "A generic construct requires that the type 'System.Collections.IEnumerable' is an unmanaged type" - [] + [] let ``Stackalloc of imported delegate``() = CompilerAssert.TypeCheckSingleError """ @@ -100,7 +98,7 @@ let _ = NativeInterop.NativePtr.stackalloc 1 (4, 9, 4, 43) "A generic construct requires that the type 'System.EventHandler' is an unmanaged type" - [] + [] let ``Stackalloc of int``() = let data = NativeInterop.NativePtr.stackalloc 100 @@ -118,7 +116,7 @@ let _ = NativeInterop.NativePtr.stackalloc 1 let datai = NativeInterop.NativePtr.toByRef (NativeInterop.NativePtr.add data i) Assert.areEqual datai (1-i) - [] + [] let ``Stackalloc of int64``() = let data = NativeInterop.NativePtr.stackalloc 100 @@ -135,7 +133,7 @@ let _ = NativeInterop.NativePtr.stackalloc 1 let datai = NativeInterop.NativePtr.toByRef (NativeInterop.NativePtr.add data i) Assert.areEqual datai (int64 (1-i)) - [] + [] let ``Stackalloc of managed class``() = CompilerAssert.TypeCheckSingleError """ @@ -154,7 +152,7 @@ let _ = NativeInterop.NativePtr.stackalloc 1 (10, 9, 10, 43) "A generic construct requires that the type 'C' is an unmanaged type" - [] + [] let ``Stackalloc of managed record``() = CompilerAssert.TypeCheckSingleError """ @@ -169,19 +167,16 @@ let _ = NativeInterop.NativePtr.stackalloc 1 (6, 9, 6, 43) "A generic construct requires that the type 'R' is an unmanaged type" - [] + [] let ``Stackalloc zero-size``() = // Regression test for FSHARP1.0: // stackalloc 0 - let testDelegate = TestDelegate (fun () -> - // check stackalloc 0 -- ok - let data = NativeInterop.NativePtr.stackalloc 0 + // check stackalloc 0 -- ok + let data = NativeInterop.NativePtr.stackalloc 0 - // The returned pointer is undefined - // No allocation should happen - let _ = NativeInterop.NativePtr.toNativeInt data + // The returned pointer is undefined + // No allocation should happen + let _ = NativeInterop.NativePtr.toNativeInt data - ()) - - Assert.DoesNotThrow testDelegate \ No newline at end of file + () \ No newline at end of file diff --git a/tests/fsharp/Compiler/Libraries/Core/Operators/AbsTests.fs b/tests/fsharp/Compiler/Libraries/Core/Operators/AbsTests.fs index a6e07ba38e4..6e0f1216564 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Operators/AbsTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Operators/AbsTests.fs @@ -2,14 +2,14 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Compiler.Diagnostics open FSharp.Test -[] + module ``Abs Tests`` = - [] + [] let ``Abs of signed integral types``() = // Regression test for FSHARP1.0:3470 - exception on abs of native integer @@ -20,7 +20,7 @@ module ``Abs Tests`` = Assert.areEqual (abs -1L) 1L // int64 Assert.areEqual (abs -1I) 1I // bigint - [] + [] let ``Abs of byte``() = CompilerAssert.TypeCheckSingleError """ @@ -31,7 +31,7 @@ abs -1uy |> ignore (2, 6, 2, 9) "The type 'byte' does not support the operator 'abs'" - [] + [] let ``Abs of uint16``() = CompilerAssert.TypeCheckSingleError """ @@ -42,7 +42,7 @@ abs -1us |> ignore (2, 6, 2, 9) "The type 'uint16' does not support the operator 'abs'" - [] + [] let ``Abs of uint32``() = CompilerAssert.TypeCheckSingleError """ @@ -62,7 +62,7 @@ abs -1u |> ignore (2, 6, 2, 8) "The type 'uint32' does not support the operator 'abs'" - [] + [] let ``Abs of unativeint``() = CompilerAssert.TypeCheckSingleError """ @@ -73,7 +73,7 @@ abs -1un |> ignore (2, 6, 2, 9) "The type 'unativeint' does not support the operator 'abs'" - [] + [] let ``Abs of uint64``() = CompilerAssert.TypeCheckSingleError """ diff --git a/tests/fsharp/Compiler/Libraries/Core/Operators/CastTests.fs b/tests/fsharp/Compiler/Libraries/Core/Operators/CastTests.fs index df5bc326025..e6bbbfcde60 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Operators/CastTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Operators/CastTests.fs @@ -2,18 +2,21 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open System -[] + module ``Cast Tests`` = - [] + let inline isTypeOf<'T> x = + Assert.True(typeof<'T>.IsInstanceOfType(x)) + + [] let ``Cast precedence over expression forms``() = // Regression test for FSHARP1.0:1247 // Precedence of type annotations :> and :?> over preceeding expression forms, e.g. if-then-else etc. - Assert.IsInstanceOf (2 :> Object) - Assert.IsInstanceOf [(2 :> Object)] - Assert.IsInstanceOf [2 :> Object] \ No newline at end of file + isTypeOf (2 :> Object) + isTypeOf [(2 :> Object)] + isTypeOf [2 :> Object] \ No newline at end of file diff --git a/tests/fsharp/Compiler/Libraries/Core/Operators/HashTests.fs b/tests/fsharp/Compiler/Libraries/Core/Operators/HashTests.fs index e809fafa937..b6597769b48 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Operators/HashTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Operators/HashTests.fs @@ -2,14 +2,14 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Compiler.Diagnostics open FSharp.Test -[] + module ``Hash Tests`` = - [] + [] let ``Hash of function values``() = // Regression test for FSHARP1.0:5436 // You should not be able to hash F# function values @@ -25,7 +25,7 @@ hash id |> ignore (2, 6, 2, 8) "The type '('a -> 'a)' does not support the 'equality' constraint because it is a function type" - [] + [] let ``Unchecked hash of function values``() = // Regression test for FSHARP1.0:5436 // You should not be able to hash F# function values diff --git a/tests/fsharp/Compiler/Libraries/Core/Operators/PowTests.fs b/tests/fsharp/Compiler/Libraries/Core/Operators/PowTests.fs index 4bdb77bca28..2e88c04a1ef 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Operators/PowTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Operators/PowTests.fs @@ -2,9 +2,9 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit + -[] module ``Pow Tests`` = type T() = @@ -14,7 +14,7 @@ module ``Pow Tests`` = g static member Check() = m - [] + [] let ``Pow of custom type``() = // Regression test for FSHARP1.0:4487 // Feature request: loosen Pow operator constraints @@ -22,4 +22,4 @@ module ``Pow Tests`` = let t = T() let _ = t ** 3. - Assert.IsTrue (T.Check()) \ No newline at end of file + Assert.True (T.Check()) \ No newline at end of file diff --git a/tests/fsharp/Compiler/Libraries/Core/Operators/RoundTests.fs b/tests/fsharp/Compiler/Libraries/Core/Operators/RoundTests.fs index bdb8e321823..523c5aeb47b 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Operators/RoundTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Operators/RoundTests.fs @@ -2,19 +2,19 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit + -[] module ``Round Tests`` = - [] + [] let ``Round of integers``() = for i in [1 .. 10000] do Assert.areEqual (i |> float |> round) (float i) Assert.areEqual (i |> float32 |> round) (float32 i) Assert.areEqual (i |> decimal |> round) (decimal i) - [] + [] let ``Round of floats``() = // Round down Assert.areEqual (round 1.1) 1.0 diff --git a/tests/fsharp/Compiler/Libraries/Core/Operators/SignTests.fs b/tests/fsharp/Compiler/Libraries/Core/Operators/SignTests.fs index ca3edf8b377..14c4ef591e1 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Operators/SignTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Operators/SignTests.fs @@ -2,14 +2,14 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Compiler.Diagnostics open FSharp.Test -[] + module ``Sign Tests`` = - [] + [] let ``Sign of signed types``() = Assert.areEqual (sign 1y) 1 // byte Assert.areEqual (sign 1s) 1 // int16 @@ -36,7 +36,7 @@ module ``Sign Tests`` = // #Regression #Libraries #Operators // Test sign function on unsigned primitives, should get error. - [] + [] let ``Sign of byte``() = CompilerAssert.TypeCheckSingleError """ @@ -47,7 +47,7 @@ sign 0uy |> ignore (2, 6, 2, 9) "The type 'byte' does not support the operator 'sign'" - [] + [] let ``Sign of uint16``() = CompilerAssert.TypeCheckSingleError """ @@ -58,7 +58,7 @@ sign 0us |> ignore (2, 6, 2, 9) "The type 'uint16' does not support the operator 'sign'" - [] + [] let ``Sign of uint32``() = CompilerAssert.TypeCheckSingleError """ @@ -69,7 +69,7 @@ sign 0u |> ignore (2, 6, 2, 8) "The type 'uint32' does not support the operator 'sign'" - [] + [] let ``Sign of uint64``() = CompilerAssert.TypeCheckSingleError """ diff --git a/tests/fsharp/Compiler/Libraries/Core/Operators/StringTests.fs b/tests/fsharp/Compiler/Libraries/Core/Operators/StringTests.fs index ad54fd0940f..0a4de5d8219 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Operators/StringTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Operators/StringTests.fs @@ -2,10 +2,10 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open System -[] + module ``String Tests`` = type CalcSum(x : int, y: int) = @@ -24,15 +24,15 @@ module ``String Tests`` = override x.ToString() = (x :> IFormattable).ToString(null, null) - [] + [] let ``String of custom type``() = let calc = CalcSum(10, 20) Assert.areEqual (string calc) "X + Y = 30" - let testDelegate = TestDelegate (fun () -> + let testDelegate = fun () -> printfn "%s" (calc.ToString()) Console.WriteLine("{0:S}", calc) - Console.Write("{0} {1} {2:D}", 10, 20, calc)) + Console.Write("{0} {1} {2:D}", 10, 20, calc) let e = Assert.Throws testDelegate Assert.areEqual e.ParamName "D" @@ -41,7 +41,7 @@ module ``String Tests`` = | A = 1 | B = 2 - [] + [] let ``String of int32 based enum``() = let a = Foo.A let r = a :> System.IFormattable @@ -53,7 +53,7 @@ module ``String Tests`` = | A = 3u | B = 4u - [] + [] let ``String of uint32 based enum``() = let a = Foo2.A let r = a :> System.IFormattable @@ -64,7 +64,7 @@ module ``String Tests`` = | A = 'a' | B = 'b' - [] + [] let ``String of char based enum``() = let a = Foo3.A let r = a :> System.IFormattable @@ -75,7 +75,7 @@ module ``String Tests`` = | A = 1s | B = 2s - [] + [] let ``String of int16 based enum``() = let a = Foo4.A let r = a :> System.IFormattable @@ -86,7 +86,7 @@ module ``String Tests`` = | A = 1us | B = 2us - [] + [] let ``String of uint16 based enum``() = let a = Foo5.A let r = a :> System.IFormattable @@ -97,7 +97,7 @@ module ``String Tests`` = | A = 1y | B = 2y - [] + [] let ``String of sbyte based enum``() = let a = Foo6.A let r = a :> System.IFormattable @@ -108,7 +108,7 @@ module ``String Tests`` = | A = 1uy | B = 2uy - [] + [] let ``String of byte based enum``() = let a = Foo7.A let r = a :> System.IFormattable diff --git a/tests/fsharp/Compiler/Libraries/Core/Reflection/PreComputedTupleConstructorTests.fs b/tests/fsharp/Compiler/Libraries/Core/Reflection/PreComputedTupleConstructorTests.fs index 6b2a0c0752d..58e695c19d7 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Reflection/PreComputedTupleConstructorTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Reflection/PreComputedTupleConstructorTests.fs @@ -2,27 +2,23 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit + -[] module ``PreComputedTupleConstructor Tests`` = - [] + [] let ``PreComputedTupleConstructor of int and string``() = // Regression test for FSHARP1.0:5113 // MT DCR: Reflection.FSharpValue.PreComputeTupleConstructor fails when executed for NetFx 2.0 by a Dev10 compiler + Reflection.FSharpValue.PreComputeTupleConstructor(typeof) [| box 12; box "text" |] |> ignore - let testDelegate = TestDelegate (fun () -> - Reflection.FSharpValue.PreComputeTupleConstructor(typeof) [| box 12; box "text" |] |> ignore) - - Assert.DoesNotThrow testDelegate |> ignore - - [] + [] let ``PreComputedTupleConstructor with wrong order of arguments``() = // Regression test for FSHARP1.0:5113 // MT DCR: Reflection.FSharpValue.PreComputeTupleConstructor fails when executed for NetFx 2.0 by a Dev10 compiler - let testDelegate = TestDelegate (fun () -> - Reflection.FSharpValue.PreComputeTupleConstructor(typeof) [| box "text"; box 12; |] |> ignore) + let testDelegate = fun () -> + Reflection.FSharpValue.PreComputeTupleConstructor(typeof) [| box "text"; box 12; |] |> ignore Assert.Throws testDelegate |> ignore \ No newline at end of file diff --git a/tests/fsharp/Compiler/Libraries/Core/Reflection/SprintfTests.fs b/tests/fsharp/Compiler/Libraries/Core/Reflection/SprintfTests.fs index 67ea1baa1bb..aa4aa6aac8a 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Reflection/SprintfTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Reflection/SprintfTests.fs @@ -2,14 +2,14 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit + -[] module ``Sprintf Tests`` = type MyR = {c:int;b:int;a:int} - [] + [] let ``Sprintf %A of record type``() = // Regression test for FSHARP1.0:5113 @@ -20,7 +20,7 @@ module ``Sprintf Tests`` = type MyT = MyC of int * string * bool - [] + [] let ``Sprintf %A of discriminated union type``() = // Regression test for FSHARP1.0:5113 diff --git a/tests/fsharp/Compiler/Libraries/Core/Unchecked/DefaultOfTests.fs b/tests/fsharp/Compiler/Libraries/Core/Unchecked/DefaultOfTests.fs index 7c732e479ad..e34c074ef13 100644 --- a/tests/fsharp/Compiler/Libraries/Core/Unchecked/DefaultOfTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Unchecked/DefaultOfTests.fs @@ -2,9 +2,9 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit + -[] module ``DefaultOf Tests`` = type DUType = @@ -31,14 +31,14 @@ module ``DefaultOf Tests`` = member this.SValue = this.m_svalue end - [] + [] let `` Unchecked defaultof reference types``() = - Assert.areEqual Unchecked.defaultof null + Assert.areEqual Unchecked.defaultof null Assert.areEqual (box Unchecked.defaultof) null Assert.areEqual (box Unchecked.defaultof) null Assert.areEqual (box Unchecked.defaultof) null - [] + [] let ``Unchecked defaultof stack types``() = Assert.areEqual Unchecked.defaultof 0 Assert.areEqual Unchecked.defaultof 0.0 @@ -51,7 +51,7 @@ module ``DefaultOf Tests`` = type S = struct val mutable x : int end type C() = class end - [] + [] let ``Unchecked defaultof and equality``() = // FSharp1.0:5417 - Unchecked.defaultof<_> on records/unions can cause structural equality check to throw // Check that Unchecked.defaultof<_> works correctly on various types, mostly structs/unions/records diff --git a/tests/fsharp/Compiler/Regressions/ForInDoMutableRegressionTest.fs b/tests/fsharp/Compiler/Regressions/ForInDoMutableRegressionTest.fs index ccbe6f21999..b36521cca8c 100644 --- a/tests/fsharp/Compiler/Regressions/ForInDoMutableRegressionTest.fs +++ b/tests/fsharp/Compiler/Regressions/ForInDoMutableRegressionTest.fs @@ -3,14 +3,13 @@ namespace FSharp.Compiler.UnitTests open System -open NUnit.Framework +open Xunit open FSharp.Test -[] module ForInDoMutableRegressionTest = /// This test is to ensure we initialize locals inside loops. - [] + [] let Script_ForInDoMutableRegressionTest() = let script = """ diff --git a/tests/fsharp/Compiler/Regressions/IndexerRegressionTests.fs b/tests/fsharp/Compiler/Regressions/IndexerRegressionTests.fs index c9c1a77bafd..93acb0b609b 100644 --- a/tests/fsharp/Compiler/Regressions/IndexerRegressionTests.fs +++ b/tests/fsharp/Compiler/Regressions/IndexerRegressionTests.fs @@ -3,13 +3,12 @@ namespace FSharp.Compiler.UnitTests open System -open NUnit.Framework +open Xunit open FSharp.Test -[] module IndexerRegressionTests = - [] + [] let ``Indexer has qualified type value``() = CompilerAssert.Pass """ diff --git a/tests/fsharp/Compiler/Regressions/NullableOptionalRegressionTests.fs b/tests/fsharp/Compiler/Regressions/NullableOptionalRegressionTests.fs index 87f55ac4cce..c7669c0a837 100644 --- a/tests/fsharp/Compiler/Regressions/NullableOptionalRegressionTests.fs +++ b/tests/fsharp/Compiler/Regressions/NullableOptionalRegressionTests.fs @@ -2,13 +2,13 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test.Compiler -[] module NullableOptionalRegressionTests = - [] + //Disabled, see RFC for nullable + //[] let ``Should compile with generic overloaded nullable methods``() = Fsx """ open System @@ -34,7 +34,7 @@ let test () = |> shouldSucceed |> ignore - [] + [] let ``Method should infer 'z' correctly``() = let fsSrc = """ @@ -55,7 +55,7 @@ type Test with |> shouldSucceed |> ignore - [] + [] let ``Method should infer correctly``() = let fsSrc = """ @@ -76,7 +76,7 @@ type Test with |> shouldSucceed |> ignore - [] + [] let ``Method should infer correctly 2``() = let fsSrc = """ diff --git a/tests/fsharp/Compiler/Service/MultiProjectTests.fs b/tests/fsharp/Compiler/Service/MultiProjectTests.fs index caef7bc916a..9e89927220d 100644 --- a/tests/fsharp/Compiler/Service/MultiProjectTests.fs +++ b/tests/fsharp/Compiler/Service/MultiProjectTests.fs @@ -5,7 +5,7 @@ namespace FSharp.Compiler.UnitTests open System open System.IO open FSharp.Compiler.Diagnostics -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Test.Utilities open FSharp.Test.Compiler @@ -15,7 +15,7 @@ open Microsoft.CodeAnalysis.CSharp open FSharp.Compiler.Text open TestFramework -[] + module MultiProjectTests = let AssertInMemoryCSharpReferenceIsValid () = @@ -86,15 +86,15 @@ let test() = try File.Delete(outputFilePath) with | _ -> () reraise() - let createOnDisk src = - let tmpFilePath = tryCreateTemporaryFileName () + let createOnDisk (src: string) = + let tmpFilePath = getTemporaryFileName () let tmpRealFilePath = Path.ChangeExtension(tmpFilePath, ".fs") try File.Delete(tmpFilePath) with | _ -> () File.WriteAllText(tmpRealFilePath, src) tmpRealFilePath - let createOnDiskCompiledAsDll checker src = - let tmpFilePath = tryCreateTemporaryFileName () + let createOnDiskCompiledAsDll checker (src: string) = + let tmpFilePath = getTemporaryFileName () let tmpRealFilePath = Path.ChangeExtension(tmpFilePath, ".fs") try File.Delete(tmpFilePath) with | _ -> () File.WriteAllText(tmpRealFilePath, src) @@ -107,7 +107,7 @@ let test() = finally try File.Delete(tmpRealFilePath) with | _ -> () - let updateFileOnDisk filePath src = + let updateFileOnDisk filePath (src: string) = File.WriteAllText(filePath, src) let updateCompiledDllOnDisk checker (dllPath: string) src = @@ -121,18 +121,18 @@ let test() = finally try File.Delete(filePath) with | _ -> () - [] + [] let ``Using a CSharp reference project in-memory``() = AssertInMemoryCSharpReferenceIsValid() |> ignore - [] + [] let ``Using a CSharp reference project in-memory and it gets GCed``() = let weakRef = AssertInMemoryCSharpReferenceIsValid() CompilerAssert.Checker.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients() GC.Collect(2, GCCollectionMode.Forced, true) Assert.shouldBeFalse(weakRef.IsAlive) - [] + [] let ``Using compiler service, file referencing a DLL will correctly update when the referenced DLL file changes``() = let checker = CompilerAssert.Checker @@ -168,7 +168,7 @@ let x = Script1.x checker.ParseAndCheckProject(fsOptions1) |> Async.RunImmediate - Assert.IsEmpty(checkProjectResults1.Diagnostics) + Assert.Empty(checkProjectResults1.Diagnostics) // Create script with that uses Script1 and function x and function y updateFileOnDisk filePath1 @@ -184,7 +184,7 @@ let y = Script1.y checker.ParseAndCheckProject(fsOptions1) |> Async.RunImmediate - Assert.IsNotEmpty(checkProjectResults2.Diagnostics) + Assert.NotEmpty(checkProjectResults2.Diagnostics) // Create an assembly with the module Script1 and function x and function y updateCompiledDllOnDisk checker dllPath1 @@ -200,7 +200,7 @@ let y = 1 checker.ParseAndCheckProject(fsOptions1) |> Async.RunImmediate - Assert.IsEmpty(checkProjectResults3.Diagnostics) + Assert.Empty(checkProjectResults3.Diagnostics) finally try File.Delete(dllPath1) with | _ -> () diff --git a/tests/fsharp/Compiler/Service/SignatureGenerationTests.fs b/tests/fsharp/Compiler/Service/SignatureGenerationTests.fs index e3b878c7cfa..5acac6c1429 100644 --- a/tests/fsharp/Compiler/Service/SignatureGenerationTests.fs +++ b/tests/fsharp/Compiler/Service/SignatureGenerationTests.fs @@ -3,12 +3,11 @@ namespace FSharp.Compiler.UnitTests open FSharp.Compiler.Diagnostics -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Test.Utilities open FSharp.Test.Compiler -[] module SignatureGenerationTests = let sigText (checkResults: FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults) = @@ -37,7 +36,7 @@ module SignatureGenerationTests = Assert.shouldBeEquivalentTo expected2 actual - [] + [] let ``can generate sigs with comments`` () = """ namespace Sample @@ -128,7 +127,7 @@ module Inner = member Thing: int """ - [] + [] let ``can generate signatures for autoproperties`` () = """ namespace Sample @@ -180,7 +179,7 @@ module Inner = member SomeAutoPropWithGetOnly: string""" - [] + [] let ``can generate attributes for implicit namespace`` () = """ [] @@ -204,7 +203,7 @@ module Say = val f: a: 'a -> 'a""" - [] + [] let ``can generate attributes for implicit namespace with multiple modules`` () = """ [] diff --git a/tests/fsharp/Compiler/SourceTextTests.fs b/tests/fsharp/Compiler/SourceTextTests.fs index 1111039c304..42211a55733 100644 --- a/tests/fsharp/Compiler/SourceTextTests.fs +++ b/tests/fsharp/Compiler/SourceTextTests.fs @@ -3,32 +3,32 @@ namespace FSharp.Compiler.UnitTests open System -open NUnit.Framework +open Xunit open FSharp.Compiler.Diagnostics open FSharp.Compiler.Text -[] + module SourceTextTests = - [] + [] let StringText () = let text = "test\ntest2\r\ntest3\n\ntest4\ntest5\rtest6\n" let sourceText = SourceText.ofString text - Assert.AreEqual("test", sourceText.GetLineString(0)) - Assert.AreEqual("test2", sourceText.GetLineString(1)) - Assert.AreEqual("test3", sourceText.GetLineString(2)) - Assert.AreEqual("", sourceText.GetLineString(3)) - Assert.AreEqual("test4", sourceText.GetLineString(4)) - Assert.AreEqual("test5", sourceText.GetLineString(5)) - Assert.AreEqual("test6", sourceText.GetLineString(6)) - Assert.AreEqual("", sourceText.GetLineString(7)) - Assert.AreEqual(8, sourceText.GetLineCount()) + Assert.Equal("test", sourceText.GetLineString(0)) + Assert.Equal("test2", sourceText.GetLineString(1)) + Assert.Equal("test3", sourceText.GetLineString(2)) + Assert.Equal("", sourceText.GetLineString(3)) + Assert.Equal("test4", sourceText.GetLineString(4)) + Assert.Equal("test5", sourceText.GetLineString(5)) + Assert.Equal("test6", sourceText.GetLineString(6)) + Assert.Equal("", sourceText.GetLineString(7)) + Assert.Equal(8, sourceText.GetLineCount()) let (count, length) = sourceText.GetLastCharacterPosition() - Assert.AreEqual(8, count) - Assert.AreEqual(0, length) + Assert.Equal(8, count) + Assert.Equal(0, length) Assert.True(sourceText.SubTextEquals("test", 0)) Assert.True(sourceText.SubTextEquals("test2", 5)) diff --git a/tests/fsharp/Compiler/Stress/LargeExprTests.fs b/tests/fsharp/Compiler/Stress/LargeExprTests.fs index e3fd61dba3f..d428e3867a4 100644 --- a/tests/fsharp/Compiler/Stress/LargeExprTests.fs +++ b/tests/fsharp/Compiler/Stress/LargeExprTests.fs @@ -2,14 +2,14 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test #if !DEBUG // requires release version of compiler to avoid very deep stacks -[] + module LargeExprTests = - [] + [] let LargeRecordDoesNotStackOverflow() = CompilerAssert.CompileExe """ @@ -991,7 +991,7 @@ type TestRecord = let main _ = 0 """ - [] + [] let LargeRecordWithStringFieldsDoesNotStackOverflow() = CompilerAssert.CompileExe """ @@ -1974,7 +1974,7 @@ type TestRecord = let main _ = 0 """ - [] + [] let LargeStructRecordDoesNotStackOverflow() = CompilerAssert.CompileExe """ @@ -2987,7 +2987,7 @@ type TestRecord = let main _ = 0 """ - [] + [] let LargeExprDoesNotStackOverflow() = CompilerAssert.CompileExe """ @@ -4999,7 +4999,7 @@ module Test = let main _ = 0 """ - [] + [] let LargeListExprDoesNotStackOverflow() = let source = """ let test () : unit = diff --git a/tests/fsharp/Compiler/Warnings/AssignmentWarningTests.fs b/tests/fsharp/Compiler/Warnings/AssignmentWarningTests.fs index d6ef26bcdf1..7d936daab1d 100644 --- a/tests/fsharp/Compiler/Warnings/AssignmentWarningTests.fs +++ b/tests/fsharp/Compiler/Warnings/AssignmentWarningTests.fs @@ -2,14 +2,14 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Compiler.Diagnostics -[] + module ``Warnings assigning to mutable and immutable objects`` = - [] + [] let ``Unused compare with immutable when assignment might be intended``() = CompilerAssert.TypeCheckSingleError """ @@ -25,7 +25,7 @@ let changeX() = (6, 5, 6, 11) "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. 'x <- expression'." - [] + [] let ``Unused compare with mutable when assignment might be intended``() = CompilerAssert.TypeCheckSingleError """ @@ -41,7 +41,7 @@ let changeX() = (6, 5, 6, 11) "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. 'x <- expression'." - [] + [] let ``Unused comparison of property in dotnet object when assignment might be intended``() = CompilerAssert.TypeCheckSingleError """ @@ -59,7 +59,7 @@ let changeProperty() = (8, 5, 8, 21) "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. 'z.Enabled <- expression'." - [] + [] let ``Unused comparison of property when assignment might be intended ``() = CompilerAssert.TypeCheckSingleError """ @@ -79,7 +79,7 @@ let changeProperty() = (10, 5, 10, 23) "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. 'x.Property2 <- expression'." - [] + [] let ``Don't warn if assignment to property without setter ``() = CompilerAssert.TypeCheckSingleError """ diff --git a/tests/fsharp/Compiler/Warnings/ExperimentalAttributeTests.fs b/tests/fsharp/Compiler/Warnings/ExperimentalAttributeTests.fs index ed51078bf7a..582ddf1ac06 100644 --- a/tests/fsharp/Compiler/Warnings/ExperimentalAttributeTests.fs +++ b/tests/fsharp/Compiler/Warnings/ExperimentalAttributeTests.fs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Compiler.Diagnostics -[] + module ``Validate ExperimentalAttribute and LanguageVersion`` = let experimentalSource = """ @@ -17,13 +17,13 @@ module TestModule = if getString = "A string" then () """ - [] + [] let ``ExperimentalAttribute nowarn when preview specified``() = CompilerAssert.PassWithOptions [| "--langversion:preview" |] experimentalSource - [] + [] let ``ExperimentalAttribute warn when preview not specified``() = CompilerAssert.TypeCheckSingleError experimentalSource diff --git a/tests/fsharp/Compiler/Warnings/PatternMatchingWarningTests.fs b/tests/fsharp/Compiler/Warnings/PatternMatchingWarningTests.fs index 864f760cc04..b5f7cb5113f 100644 --- a/tests/fsharp/Compiler/Warnings/PatternMatchingWarningTests.fs +++ b/tests/fsharp/Compiler/Warnings/PatternMatchingWarningTests.fs @@ -1,13 +1,13 @@ namespace FSharp.Compiler.UnitTests -open NUnit.Framework +open Xunit open FSharp.Test open FSharp.Compiler.Diagnostics -[] + module PatternMatchingWarningTests = - [] + [] let ``Complete pattern match on byte should not trigger FS0025 warning`` () = CompilerAssert.Pass """ @@ -271,7 +271,7 @@ module PatternMatchingWarningTests = | 255uy -> 255 printfn "" """ - [] + [] let ``Complete pattern match on sbyte should not trigger FS0025 warning`` () = CompilerAssert.Pass """ diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 3e5488adac4..5bd5feda50a 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -12,7 +12,7 @@ false false $(OtherFlags) --warnon:1182 --langversion:preview - nunit + xunit 3186 @@ -20,7 +20,7 @@ scriptlib.fsx - + @@ -95,11 +95,14 @@ - + + + + diff --git a/tests/fsharp/NUnitHelpers.fs b/tests/fsharp/NUnitHelpers.fs deleted file mode 100644 index 1a212fdfdc4..00000000000 --- a/tests/fsharp/NUnitHelpers.fs +++ /dev/null @@ -1,17 +0,0 @@ -namespace NUnit.Framework - -module Assert = - - [] - do() - - let inline fail message = Assert.Fail message - - let inline failf fmt = Printf.kprintf fail fmt - - let inline areEqual (expected: ^T) (actual: ^T) = - Assert.AreEqual(expected, actual) - -module StringAssert = - - let inline contains expected actual = StringAssert.Contains(expected, actual) diff --git a/tests/fsharp/SDKTests/tests/PackageTest.props b/tests/fsharp/SDKTests/tests/PackageTest.props index c49e1b6b536..27d615066da 100644 --- a/tests/fsharp/SDKTests/tests/PackageTest.props +++ b/tests/fsharp/SDKTests/tests/PackageTest.props @@ -1,6 +1,6 @@ - + net472 @@ -8,7 +8,7 @@ .NETFramework Release - ..\..\..\..\artifacts\bin\FSharpSuite.Tests\$(Configuration)\$(TARGETFRAMEWORK) + $(FSharpRepositoryPath)\artifacts\bin\FSharpSuite.Tests\$(Configuration)\$(TARGETFRAMEWORK) AnyCPU diff --git a/tests/fsharp/SDKTests/tests/PackageTest.targets b/tests/fsharp/SDKTests/tests/PackageTest.targets index c018aa9a326..818f96713f2 100644 --- a/tests/fsharp/SDKTests/tests/PackageTest.targets +++ b/tests/fsharp/SDKTests/tests/PackageTest.targets @@ -15,7 +15,7 @@ - + diff --git a/tests/fsharp/SDKTests/tests/SetImplicitReferenceTest.proj b/tests/fsharp/SDKTests/tests/SetImplicitReferenceTest.proj index 61725fffff0..4c4e30ded9a 100644 --- a/tests/fsharp/SDKTests/tests/SetImplicitReferenceTest.proj +++ b/tests/fsharp/SDKTests/tests/SetImplicitReferenceTest.proj @@ -7,7 +7,7 @@ 44.44.44 - + diff --git a/tests/fsharp/SDKTests/tests/ToolsTest.props b/tests/fsharp/SDKTests/tests/ToolsTest.props index 76d5438175b..cd4e4437dc4 100644 --- a/tests/fsharp/SDKTests/tests/ToolsTest.props +++ b/tests/fsharp/SDKTests/tests/ToolsTest.props @@ -1,6 +1,6 @@ - + net472 @@ -8,7 +8,7 @@ .NETFramework Release - $(MSBuildThisFileDirectory)..\..\..\..\artifacts\bin\FSharpSuite.Tests\$(Configuration)\$(TARGETFRAMEWORK) + $(FSharpRepositoryPath)\artifacts\bin\FSharpSuite.Tests\$(Configuration)\$(TARGETFRAMEWORK) AnyCPU diff --git a/tests/fsharp/TypeProviderTests.fs b/tests/fsharp/TypeProviderTests.fs index fa56bbcc99c..04b82f1c818 100644 --- a/tests/fsharp/TypeProviderTests.fs +++ b/tests/fsharp/TypeProviderTests.fs @@ -7,14 +7,13 @@ #load "../FSharp.Test.Utilities/TestFramework.fs" #load "single-test.fs" #else -[] module FSharp.Test.FSharpSuite.TypeProviderTests #endif open System open System.IO open System.Reflection -open NUnit.Framework +open Xunit open TestFramework open Scripting open SingleTest @@ -33,13 +32,17 @@ let FSC_OPTIMIZED = FSC_NETFX (true, false) let FSI = FSI_NETFX #endif -let inline getTestsDirectory dir = getTestsDirectory __SOURCE_DIRECTORY__ dir -let testConfig = getTestsDirectory >> testConfig +let copyHelloWorld cfgDirectory = + for helloDir in DirectoryInfo(__SOURCE_DIRECTORY__ + "/typeProviders").GetDirectories("hello*") do + DirectoryInfo(cfgDirectory + "\\..").CreateSubdirectory(helloDir.Name).FullName + |> copyFilesToDest helloDir.FullName -[] +[] let diamondAssembly () = let cfg = testConfig "typeProviders/diamondAssembly" + copyHelloWorld cfg.Directory + rm cfg "provider.dll" // Add a version flag to make this generate native resources. The native resources aren't important and @@ -72,7 +75,7 @@ let diamondAssembly () = testOkFile.CheckExists() -[] +[] let globalNamespace () = let cfg = testConfig "typeProviders/globalNamespace" @@ -146,15 +149,15 @@ let helloWorld p = peverify cfg (bincompat2 ++ "testlib_client.exe") -[] +[] let ``helloWorld fsc`` () = helloWorld FSC_OPTIMIZED #if !NETCOREAPP -[] +[] let ``helloWorld fsi`` () = helloWorld FSI_NETFX_STDIN #endif -[] +[] let helloWorldCSharp () = let cfg = testConfig "typeProviders/helloWorldCSharp" @@ -176,42 +179,14 @@ let helloWorldCSharp () = exec cfg ("." ++ "test.exe") "" - -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -[] -let ``negative type provider tests`` (name:string) = +let singleNegTest name = let cfg = testConfig "typeProviders/negTests" - let dir = cfg.Directory + + copyHelloWorld cfg.Directory if requireENCulture () then - let fileExists = Commands.fileExists dir >> Option.isSome + let fileExists = Commands.fileExists cfg.Directory >> Option.isSome rm cfg "provided.dll" @@ -242,7 +217,7 @@ let ``negative type provider tests`` (name:string) = fsc cfg "--out:MostBasicProvider.dll -g --optimize- -a" ["MostBasicProvider.fsx"] let preprocess name pref = - let dirp = (dir |> Commands.pathAddBackslash) + let dirp = (cfg.Directory |> Commands.pathAddBackslash) do FileSystem.OpenFileForReadShim(sprintf "%s%s.%sbslpp" dirp name pref) .ReadAllText() @@ -260,10 +235,41 @@ let ``negative type provider tests`` (name:string) = SingleTest.singleNegTest cfg name +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +let ``negative type provider tests`` (name:string) = singleNegTest name + let splitAssembly subdir project = - let subdir = getTestsDirectory subdir let cfg = testConfig project + copyHelloWorld cfg.Directory + let clean() = rm cfg "providerDesigner.dll" rmdir cfg "typeproviders" @@ -337,16 +343,18 @@ let splitAssembly subdir project = clean() -[] +[] let splitAssemblyTools () = splitAssembly "tools" "typeProviders/splitAssemblyTools" -[] +[] let splitAssemblyTypeProviders () = splitAssembly "typeproviders" "typeProviders/splitAssemblyTypeproviders" -[] +[] let wedgeAssembly () = let cfg = testConfig "typeProviders/wedgeAssembly" + copyHelloWorld cfg.Directory + rm cfg "provider.dll" rm cfg "provided.dll" diff --git a/tests/fsharp/XunitHelpers.fs b/tests/fsharp/XunitHelpers.fs new file mode 100644 index 00000000000..c7e7493c046 --- /dev/null +++ b/tests/fsharp/XunitHelpers.fs @@ -0,0 +1,15 @@ +namespace Xunit + +open Xunit + +module Assert = + + [] + do() + + let inline fail message = Assert.Fail message + + let inline failf fmt = Printf.kprintf fail fmt + + let inline areEqual (expected: ^T) (actual: ^T) = + Assert.Equal<^T>(expected, actual) diff --git a/tests/fsharp/conformance/inference/E_TwoDifferentTypeVariablesGen00.bsl b/tests/fsharp/conformance/inference/E_TwoDifferentTypeVariablesGen00.bsl index b8d0b1ba38c..9d9d4a60369 100644 --- a/tests/fsharp/conformance/inference/E_TwoDifferentTypeVariablesGen00.bsl +++ b/tests/fsharp/conformance/inference/E_TwoDifferentTypeVariablesGen00.bsl @@ -1,13 +1,13 @@ E_TwoDifferentTypeVariablesGen00.fsx(61,52,61,53): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type ''b'. -E_TwoDifferentTypeVariablesGen00.fsx(61,18,61,42): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type ''a'. +E_TwoDifferentTypeVariablesGen00.fsx(61,18,61,21): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type ''a'. -E_TwoDifferentTypeVariablesGen00.fsx(61,18,61,42): typecheck error FS0043: The type ''b' does not match the type ''b0' +E_TwoDifferentTypeVariablesGen00.fsx(61,18,61,21): typecheck error FS0043: The type ''b' does not match the type ''b0' E_TwoDifferentTypeVariablesGen00.fsx(62,52,62,53): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type 'int'. -E_TwoDifferentTypeVariablesGen00.fsx(62,18,62,42): typecheck error FS0043: The type ''b' does not match the type 'int' +E_TwoDifferentTypeVariablesGen00.fsx(62,18,62,21): typecheck error FS0043: The type ''b' does not match the type 'int' E_TwoDifferentTypeVariablesGen00.fsx(63,45,63,55): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. @@ -19,15 +19,15 @@ Candidates: E_TwoDifferentTypeVariablesGen00.fsx(64,56,64,57): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type ''b'. -E_TwoDifferentTypeVariablesGen00.fsx(64,18,64,42): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type ''a'. +E_TwoDifferentTypeVariablesGen00.fsx(64,18,64,21): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type ''a'. -E_TwoDifferentTypeVariablesGen00.fsx(64,18,64,42): typecheck error FS0043: The type ''b' does not match the type ''b0' +E_TwoDifferentTypeVariablesGen00.fsx(64,18,64,21): typecheck error FS0043: The type ''b' does not match the type ''b0' E_TwoDifferentTypeVariablesGen00.fsx(65,54,65,55): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type ''a'. E_TwoDifferentTypeVariablesGen00.fsx(65,56,65,57): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type 'int'. -E_TwoDifferentTypeVariablesGen00.fsx(65,18,65,42): typecheck error FS0043: The type ''a' does not match the type 'int' +E_TwoDifferentTypeVariablesGen00.fsx(65,18,65,21): typecheck error FS0043: The type ''a' does not match the type 'int' E_TwoDifferentTypeVariablesGen00.fsx(66,45,66,59): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. @@ -39,9 +39,9 @@ Candidates: E_TwoDifferentTypeVariablesGen00.fsx(67,55,67,56): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type ''b'. -E_TwoDifferentTypeVariablesGen00.fsx(67,18,67,42): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type ''a'. +E_TwoDifferentTypeVariablesGen00.fsx(67,18,67,21): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type ''a'. -E_TwoDifferentTypeVariablesGen00.fsx(67,18,67,42): typecheck error FS0043: The type ''b' does not match the type ''b0' +E_TwoDifferentTypeVariablesGen00.fsx(67,18,67,21): typecheck error FS0043: The type ''b' does not match the type ''b0' E_TwoDifferentTypeVariablesGen00.fsx(68,45,68,58): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. @@ -53,4 +53,4 @@ Candidates: E_TwoDifferentTypeVariablesGen00.fsx(69,55,69,56): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type 'int'. -E_TwoDifferentTypeVariablesGen00.fsx(69,18,69,42): typecheck error FS0043: The type ''b' does not match the type 'int' +E_TwoDifferentTypeVariablesGen00.fsx(69,18,69,21): typecheck error FS0043: The type ''b' does not match the type 'int' diff --git a/tests/fsharp/conformance/inference/E_TwoDifferentTypeVariablesGen00rec.bsl b/tests/fsharp/conformance/inference/E_TwoDifferentTypeVariablesGen00rec.bsl index f24aa582b86..99d338ef47a 100644 --- a/tests/fsharp/conformance/inference/E_TwoDifferentTypeVariablesGen00rec.bsl +++ b/tests/fsharp/conformance/inference/E_TwoDifferentTypeVariablesGen00rec.bsl @@ -1,13 +1,13 @@ E_TwoDifferentTypeVariablesGen00rec.fsx(61,52,61,53): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type ''b'. -E_TwoDifferentTypeVariablesGen00rec.fsx(61,18,61,42): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type ''a'. +E_TwoDifferentTypeVariablesGen00rec.fsx(61,18,61,21): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type ''a'. -E_TwoDifferentTypeVariablesGen00rec.fsx(61,18,61,42): typecheck error FS0043: The type ''b' does not match the type ''b0' +E_TwoDifferentTypeVariablesGen00rec.fsx(61,18,61,21): typecheck error FS0043: The type ''b' does not match the type ''b0' E_TwoDifferentTypeVariablesGen00rec.fsx(62,52,62,53): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type 'int'. -E_TwoDifferentTypeVariablesGen00rec.fsx(62,18,62,42): typecheck error FS0043: The type ''b' does not match the type 'int' +E_TwoDifferentTypeVariablesGen00rec.fsx(62,18,62,21): typecheck error FS0043: The type ''b' does not match the type 'int' E_TwoDifferentTypeVariablesGen00rec.fsx(63,45,63,55): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. @@ -19,15 +19,15 @@ Candidates: E_TwoDifferentTypeVariablesGen00rec.fsx(64,56,64,57): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type ''b'. -E_TwoDifferentTypeVariablesGen00rec.fsx(64,18,64,42): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type ''a'. +E_TwoDifferentTypeVariablesGen00rec.fsx(64,18,64,21): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type ''a'. -E_TwoDifferentTypeVariablesGen00rec.fsx(64,18,64,42): typecheck error FS0043: The type ''b' does not match the type ''b0' +E_TwoDifferentTypeVariablesGen00rec.fsx(64,18,64,21): typecheck error FS0043: The type ''b' does not match the type ''b0' E_TwoDifferentTypeVariablesGen00rec.fsx(65,54,65,55): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type ''a'. E_TwoDifferentTypeVariablesGen00rec.fsx(65,56,65,57): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type 'int'. -E_TwoDifferentTypeVariablesGen00rec.fsx(65,18,65,42): typecheck error FS0043: The type ''a' does not match the type 'int' +E_TwoDifferentTypeVariablesGen00rec.fsx(65,18,65,21): typecheck error FS0043: The type ''a' does not match the type 'int' E_TwoDifferentTypeVariablesGen00rec.fsx(66,45,66,59): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. @@ -39,9 +39,9 @@ Candidates: E_TwoDifferentTypeVariablesGen00rec.fsx(67,55,67,56): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type ''b'. -E_TwoDifferentTypeVariablesGen00rec.fsx(67,18,67,42): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type ''a'. +E_TwoDifferentTypeVariablesGen00rec.fsx(67,18,67,21): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type ''a'. -E_TwoDifferentTypeVariablesGen00rec.fsx(67,18,67,42): typecheck error FS0043: The type ''b' does not match the type ''b0' +E_TwoDifferentTypeVariablesGen00rec.fsx(67,18,67,21): typecheck error FS0043: The type ''b' does not match the type ''b0' E_TwoDifferentTypeVariablesGen00rec.fsx(68,45,68,58): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. @@ -53,4 +53,4 @@ Candidates: E_TwoDifferentTypeVariablesGen00rec.fsx(69,55,69,56): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type 'int'. -E_TwoDifferentTypeVariablesGen00rec.fsx(69,18,69,42): typecheck error FS0043: The type ''b' does not match the type 'int' +E_TwoDifferentTypeVariablesGen00rec.fsx(69,18,69,21): typecheck error FS0043: The type ''b' does not match the type 'int' diff --git a/tests/fsharp/conformance/inference/E_TwoEqualYypeVariables02rec.bsl b/tests/fsharp/conformance/inference/E_TwoEqualTypeVariables02rec.bsl similarity index 83% rename from tests/fsharp/conformance/inference/E_TwoEqualYypeVariables02rec.bsl rename to tests/fsharp/conformance/inference/E_TwoEqualTypeVariables02rec.bsl index 6584af92343..9380c2906a8 100644 --- a/tests/fsharp/conformance/inference/E_TwoEqualYypeVariables02rec.bsl +++ b/tests/fsharp/conformance/inference/E_TwoEqualTypeVariables02rec.bsl @@ -1,5 +1,5 @@ -E_TwoEqualYypeVariables02rec.fsx(60,37,60,47): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. +E_TwoEqualTypeVariables02rec.fsx(60,37,60,47): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. Known types of arguments: 'a * 'a @@ -7,7 +7,7 @@ Candidates: - static member C12.M: x: 'a * y: 'a -> One - static member C12.M: x: 'a * y: 'b -> Two -E_TwoEqualYypeVariables02rec.fsx(61,37,61,47): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. +E_TwoEqualTypeVariables02rec.fsx(61,37,61,47): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. Known types of arguments: 'a * 'a @@ -15,7 +15,7 @@ Candidates: - static member C14.M: x: 'a * y: 'a -> One - static member C14.M: x: 'a * y: C -> Four -E_TwoEqualYypeVariables02rec.fsx(62,37,62,47): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. +E_TwoEqualTypeVariables02rec.fsx(62,37,62,47): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. Known types of arguments: 'a * 'a @@ -23,7 +23,7 @@ Candidates: - static member C24.M: x: 'a * y: 'b -> Two - static member C24.M: x: 'a * y: C -> Four -E_TwoEqualYypeVariables02rec.fsx(63,37,63,48): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. +E_TwoEqualTypeVariables02rec.fsx(63,37,63,48): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. Known types of arguments: 'a * 'a @@ -32,7 +32,7 @@ Candidates: - static member C123.M: x: 'a * y: 'b -> Two - static member C123.M: x: 'a * y: int -> Three -E_TwoEqualYypeVariables02rec.fsx(64,37,64,49): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. +E_TwoEqualTypeVariables02rec.fsx(64,37,64,49): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. Known types of arguments: 'a * 'a @@ -42,7 +42,7 @@ Candidates: - static member C1234.M: x: 'a * y: C -> Four - static member C1234.M: x: 'a * y: int -> Three -E_TwoEqualYypeVariables02rec.fsx(65,37,65,50): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. +E_TwoEqualTypeVariables02rec.fsx(65,37,65,50): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. Known types of arguments: 'a * 'a diff --git a/tests/fsharp/conformance/inference/E_TwoEqualYypeVariables02rec.fsx b/tests/fsharp/conformance/inference/E_TwoEqualTypeVariables02rec.fsx similarity index 100% rename from tests/fsharp/conformance/inference/E_TwoEqualYypeVariables02rec.fsx rename to tests/fsharp/conformance/inference/E_TwoEqualTypeVariables02rec.fsx diff --git a/tests/fsharp/core/access/test.fsx b/tests/fsharp/core/access/test.fsx index 3d7e7f1624a..21a8c056ee0 100644 --- a/tests/fsharp/core/access/test.fsx +++ b/tests/fsharp/core/access/test.fsx @@ -52,7 +52,7 @@ type MyClassStaticMembers = static member public SMPublic() = 12 static member SMDefault() = 12 -type MyClassPropertiyGetters = +type MyClassPropertyGetters = member internal x.InstInternal = 12 member private x.InstPrivate = 12 member public x.InstPublic = 12 diff --git a/tests/fsharp/core/anon/lib.fs b/tests/fsharp/core/anon/lib.fs index cc3f7de7043..271c8266b46 100644 --- a/tests/fsharp/core/anon/lib.fs +++ b/tests/fsharp/core/anon/lib.fs @@ -84,7 +84,7 @@ module KindB1 = // Access code may not be generic except through existing member constraints - // To speciy a struct representation use this: + // To specify a struct representation use this: let data3 = struct {| X = 1 |} // Types can be written with the same syntax @@ -110,7 +110,7 @@ module TestInAttributes = module KindB2 = - // Gives object that has full C#-compatibe anonymous metadata. Compiles to an instantiation of a generic type in the declaring assembly with appropriate .NET + // Gives object that has full C#-compatible anonymous metadata. Compiles to an instantiation of a generic type in the declaring assembly with appropriate .NET // metadata (property names). The types are CLIMutable to be C#-compatible. The identity of the types are implicitly assembly-qualified. let data1 = {| X = 1 |} diff --git a/tests/fsharp/core/apporder/test.fsx b/tests/fsharp/core/apporder/test.fsx index 521ea7aaa61..7830de44c1a 100644 --- a/tests/fsharp/core/apporder/test.fsx +++ b/tests/fsharp/core/apporder/test.fsx @@ -949,7 +949,7 @@ module OrderOfRecordInitialisation = B = 2 C = 3 } - let ShouldInitialzeInGivenOrder1 = + let ShouldInitializeInGivenOrder1 = let order = ref "" let actual = { A = let _ = order := !order + "1" in 1 @@ -959,7 +959,7 @@ module OrderOfRecordInitialisation = check "cnclewlecp2" expected actual check "ceiewoi" "123" !order - let ShouldInitialzeInGivenOrder2 = + let ShouldInitializeInGivenOrder2 = let order = ref "" let actual = { A = let _ = order := !order + "1" in 1 @@ -969,7 +969,7 @@ module OrderOfRecordInitialisation = check "cd33289e0ewn1" expected actual check "ewlknewv90we2" "123" !order - let ShouldInitialzeInGivenOrder3 = + let ShouldInitializeInGivenOrder3 = let order = ref "" let actual = { B = let _ = order := !order + "1" in 2 @@ -980,7 +980,7 @@ module OrderOfRecordInitialisation = check "cewekcjnwe4" "123" !order - let ShouldInitialzeInGivenOrder4 = + let ShouldInitializeInGivenOrder4 = let order = ref "" let actual = { B = let _ = order := !order + "1" in 2 @@ -991,7 +991,7 @@ module OrderOfRecordInitialisation = check "cewekcjnwe6" "123" !order - let ShouldInitialzeInGivenOrder5 = + let ShouldInitializeInGivenOrder5 = let order = ref "" let actual = { C = let _ = order := !order + "1" in 3 @@ -1002,7 +1002,7 @@ module OrderOfRecordInitialisation = check "cewekcjnwe8" "123" !order - let ShouldInitialzeInGivenOrder6 = + let ShouldInitializeInGivenOrder6 = let order = ref "" let actual = { C = let _ = order := !order + "1" in 3 @@ -1020,7 +1020,7 @@ type RecordWithDifferentTypes = D : RecordWithInts } -module RecordInitialisationWithDifferentTxpes = +module RecordInitialisationWithDifferentTypes = let expected = { A = 1 @@ -1032,7 +1032,7 @@ module RecordInitialisationWithDifferentTxpes = C = 6 }} - let ShouldInitialzeInGivenOrder1 = + let ShouldInitializeInGivenOrder1 = let order = ref "" let actual = { A = let _ = order := !order + "1" in 1 @@ -1047,7 +1047,7 @@ module RecordInitialisationWithDifferentTxpes = check "cewekcjnwe12" "1234567" !order - let ShouldInitialzeInGivenOrder2 = + let ShouldInitializeInGivenOrder2 = let order = ref "" let actual = { A = let _ = order := !order + "1" in 1 @@ -1063,7 +1063,7 @@ module RecordInitialisationWithDifferentTxpes = check "cewekcjnwe14" "1234567" !order - let ShouldInitialzeInGivenOrder3 = + let ShouldInitializeInGivenOrder3 = let order = ref "" let actual = { A = let _ = order := !order + "1" in 1 @@ -1079,7 +1079,7 @@ module RecordInitialisationWithDifferentTxpes = - let ShouldInitialzeInGivenOrder4 = + let ShouldInitializeInGivenOrder4 = let order = ref "" let actual = { B = let _ = order := !order + "1" in "2" @@ -1094,7 +1094,7 @@ module RecordInitialisationWithDifferentTxpes = check "cewekcjnwe18" "1234567" !order - let ShouldInitialzeInGivenOrder5 = + let ShouldInitializeInGivenOrder5 = let order = ref "" let actual = { D = let _ = order := !order + "1" in @@ -1109,7 +1109,7 @@ module RecordInitialisationWithDifferentTxpes = check "cewekcjnwe20" "1234567" !order - let ShouldInitialzeInGivenOrder6 = + let ShouldInitializeInGivenOrder6 = let order = ref "" let actual = { D = let _ = order := !order + "1" in diff --git a/tests/fsharp/core/array/test.fsx b/tests/fsharp/core/array/test.fsx index 49b7a1f3030..69d1feada8c 100644 --- a/tests/fsharp/core/array/test.fsx +++ b/tests/fsharp/core/array/test.fsx @@ -1092,7 +1092,7 @@ module manyIndexes = let CompileIndexerTest = let test = Test () - // No problems with method having vaiable number of parameters + // No problems with method having variable number of parameters let u1 = test.Foo(null, null, null, null) let u2 = test.Foo(null, null, null, null, null) let u3 = test.Foo(null, null, null, null, null, null, null, null, null) diff --git a/tests/fsharp/core/attributes/test.fsx b/tests/fsharp/core/attributes/test.fsx index 392cd6299fd..30509f450fd 100644 --- a/tests/fsharp/core/attributes/test.fsx +++ b/tests/fsharp/core/attributes/test.fsx @@ -42,7 +42,7 @@ open System.Diagnostics [] #endif -let main = () +let main () = () (* attribute on a type *) @@ -254,7 +254,7 @@ type DontPressThisButtonAttribute = new(s:string) = { inherit System.Attribute(); v=s; someOtherField="" } end -type [] button = Buttpon +type [] button = Button let ca5 = typeof