diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 34ccbbf8056..871b8f40a13 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -45,7 +45,7 @@ "rollForward": true }, "fantomas": { - "version": "6.2.3", + "version": "7.0.1", "commands": [ "fantomas" ], diff --git a/.config/service-branch-merge.json b/.config/service-branch-merge.json index 0c9d996e850..49561874be8 100644 --- a/.config/service-branch-merge.json +++ b/.config/service-branch-merge.json @@ -5,6 +5,10 @@ "MergeToBranch": "main", "ExtraSwitches": "-QuietComments" }, + "release/dev17.14": { + "MergeToBranch": "release/dev18.0", + "ExtraSwitches": "-QuietComments" + }, "main": { "MergeToBranch": "release/dev17.14", "ExtraSwitches": "-QuietComments" diff --git a/.github/ISSUE_TEMPLATE/nullness_issue.yml b/.github/ISSUE_TEMPLATE/nullness_issue.yml index 5d46cbdffae..5902c3feb47 100644 --- a/.github/ISSUE_TEMPLATE/nullness_issue.yml +++ b/.github/ISSUE_TEMPLATE/nullness_issue.yml @@ -13,7 +13,7 @@ body: - 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 check at [Nullable Reference Types RFC](https://github.com/fsharp/fslang-design/blob/main/FSharp-9.0/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 @@ -73,4 +73,4 @@ body: 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 + required: false diff --git a/.gitignore b/.gitignore index 33c9666c14b..6ca107a5779 100644 --- a/.gitignore +++ b/.gitignore @@ -134,4 +134,6 @@ positive.exe /tests/FSharp.Compiler.ComponentTests/FSharpChecker/StandardOutput.txt # ilverify baseline result files -*.bsl.actual \ No newline at end of file +*.bsl.actual +/src/FSharp.DependencyManager.Nuget/StandardError.txt +/src/FSharp.DependencyManager.Nuget/StandardOutput.txt diff --git a/NuGet.config b/NuGet.config index e348c8b6abe..944ae5b686e 100644 --- a/NuGet.config +++ b/NuGet.config @@ -6,6 +6,11 @@ + + + + + diff --git a/buildtools/checkpackages/FSharp.Core_notshipped.fsproj b/buildtools/checkpackages/FSharp.Core_notshipped.fsproj index f104ff30fe7..7301910fba3 100644 --- a/buildtools/checkpackages/FSharp.Core_notshipped.fsproj +++ b/buildtools/checkpackages/FSharp.Core_notshipped.fsproj @@ -3,7 +3,7 @@ - ne87.0 + net9.0 diff --git a/docs/release-notes/.FSharp.Compiler.Service/9.0.202.md b/docs/release-notes/.FSharp.Compiler.Service/9.0.202.md new file mode 100644 index 00000000000..54ee092c09b --- /dev/null +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.202.md @@ -0,0 +1,59 @@ +### Fixed + +* Fix missing TailCall warning in Sequential in use scope ([PR #17927](https://github.com/dotnet/fsharp/pull/17927)) +* Fix false negatives for passing null to "obj" arguments. Only "obj | null" can now subsume any type ([PR #17757](https://github.com/dotnet/fsharp/pull/17757)) +* Fix internal error when calling 'AddSingleton' and other overloads only differing in generic arity ([PR #17804](https://github.com/dotnet/fsharp/pull/17804)) +* Fix extension methods support for non-reference system assemblies ([PR #17799](https://github.com/dotnet/fsharp/pull/17799)) +* Ensure `frameworkTcImportsCache` mutations are threadsafe. ([PR #17795](https://github.com/dotnet/fsharp/pull/17795)) +* Disallow abstract member with access modifiers in sig file. ([PR #17802](https://github.com/dotnet/fsharp/pull/17802)) +* Fix concurrency issue in `ILPreTypeDefImpl` ([PR #17812](https://github.com/dotnet/fsharp/pull/17812)) +* Fix nullness inference for member val and other OO scenarios ([PR #17845](https://github.com/dotnet/fsharp/pull/17845)) +* Fix internal error when analyzing incomplete inherit member ([PR #17905](https://github.com/dotnet/fsharp/pull/17905)) +* Add warning when downcasting from nullable type to non-nullable ([PR #17965](https://github.com/dotnet/fsharp/pull/17965)) +* Fix missing nullness warning in case of method resolution multiple candidates ([PR #17917](https://github.com/dotnet/fsharp/pull/17918)) +* Fix failure to use bound values in `when` clauses of `try-with` in `seq` expressions ([PR #17990](https://github.com/dotnet/fsharp/pull/17990)) +* Fix locals allocating for the special `copyOfStruct` defensive copy ([PR #18025](https://github.com/dotnet/fsharp/pull/18025)) +* Fix lowering of computed array expressions when the expression consists of a simple mapping from a `uint64` or `unativeint` array. [PR #18081](https://github.com/dotnet/fsharp/pull/18081) +* Add missing nullable-metadata for C# consumers of records,exceptions and DU subtypes generated from F# code. [PR #18079](https://github.com/dotnet/fsharp/pull/18079) +* Reduce excess memory usage in TransparentCompiler. [PR #17543](https://github.com/dotnet/fsharp/pull/17543) +* Fix a race condition in file book keeping in the compiler service ([#18008](https://github.com/dotnet/fsharp/pull/18008)) +* Fix trimming '%' characters when lowering interpolated string to a concat call [PR #18123](https://github.com/dotnet/fsharp/pull/18123) +* Completion: fix qualified completion in sequence expressions [PR #18111](https://github.com/dotnet/fsharp/pull/18111) +* Symbols: try to use ValReprInfoForDisplay in Mfv.CurriedParameterGroups ([PR #18124](https://github.com/dotnet/fsharp/pull/18124)) +* Shim/file system: fix leaks of the shim [PR #18144](https://github.com/dotnet/fsharp/pull/18144) + +### Added + +* Let `dotnet fsi --help` print a link to the documentation website. ([PR #18006](https://github.com/dotnet/fsharp/pull/18006)) +* Deprecate places where `seq` can be omitted. ([Language suggestion #1033](https://github.com/fsharp/fslang-suggestions/issues/1033), [PR #17772](https://github.com/dotnet/fsharp/pull/17772)) +* Support literal attribute on decimals ([PR #17769](https://github.com/dotnet/fsharp/pull/17769)) +* Added type conversions cache, only enabled for compiler runs, guarded by language version preview ([PR #17668](https://github.com/dotnet/fsharp/pull/17668)) +* Added project property ParallelCompilation which turns on graph based type checking, parallel ILXGen and parallel optimization. By default on for users of langversion=preview ([PR #17948](https://github.com/dotnet/fsharp/pull/17948)) +* Adding warning when consuming generic method returning T|null for types not supporting nullness (structs,anons,tuples) ([PR #18057](https://github.com/dotnet/fsharp/pull/18057)) +* Sink: report SynPat.ArrayOrList type ([PR #18127](https://github.com/dotnet/fsharp/pull/18127)) +* Show the default value of compiler options ([PR #18054](https://github.com/dotnet/fsharp/pull/18054)) +* Support ValueOption + Struct attribute as optional parameter for methods ([Language suggestion #1136](https://github.com/fsharp/fslang-suggestions/issues/1136), [PR #18098](https://github.com/dotnet/fsharp/pull/18098)) +* Cancellable: add safer APIs to check the token ([PR #18175](https://github.com/dotnet/fsharp/pull/18175)) + +### Changed + +* Make ILTypeDef interface impls calculation lazy. ([PR #17392](https://github.com/dotnet/fsharp/pull/17392)) +* Remove non-functional useSyntaxTreeCache option. ([PR #17768](https://github.com/dotnet/fsharp/pull/17768)) +* Better ranges for CE `let!` and `use!` error reporting. ([PR #17712](https://github.com/dotnet/fsharp/pull/17712)) +* Better ranges for CE `do!` error reporting. ([PR #17779](https://github.com/dotnet/fsharp/pull/17779)) +* Better ranges for CE `return, yield, return! and yield!` error reporting. ([PR #17792](https://github.com/dotnet/fsharp/pull/17792)) +* Better ranges for CE `match!`. ([PR #17789](https://github.com/dotnet/fsharp/pull/17789)) +* Better ranges for CE `use` error reporting. ([PR #17811](https://github.com/dotnet/fsharp/pull/17811)) +* Better ranges for `inherit` error reporting. ([PR #17879](https://github.com/dotnet/fsharp/pull/17879)) +* Better ranges for `inherit` `struct` error reporting. ([PR #17886](https://github.com/dotnet/fsharp/pull/17886)) +* Warn on uppercase identifiers in patterns. ([PR #15816](https://github.com/dotnet/fsharp/pull/15816)) +* Better ranges for `inherit` objects error reporting. ([PR #17893](https://github.com/dotnet/fsharp/pull/17893)) +* Better ranges for #nowarn error reporting; bring back #nowarn warnings for --langVersion:80; add warnings under feature flag ([PR #17871](https://github.com/dotnet/fsharp/pull/17871)) +* Better ranges for #nowarn error reporting; bring back #nowarn warnings for --langVersion:80; add warnings under feature flag ([PR #17871](https://github.com/dotnet/fsharp/pull/17871)) +* CheckAndThrow can be invoked only from within Cancellable context ([PR #18037](https://github.com/dotnet/fsharp/pull/18037)) +* Make ILTypeDef base type calculation lazy. ([PR #18005](https://github.com/dotnet/fsharp/pull/18005)) +* Revert EnforceAttributeTargets Feature. ([PR #18005](https://github.com/dotnet/fsharp/pull/18005)) + +### Breaking Changes + +* Aliasing `StructAttribute` will now produce a warning (part of [Language suggestion #18298](https://github.com/fsharp/fslang-suggestions/issues/18298), [PR #18355](https://github.com/dotnet/fsharp/pull/18355)) \ No newline at end of file diff --git a/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md b/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md index 1c78cff8fe9..c4e4a6a1403 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md @@ -1,4 +1,5 @@ ### Fixed +* Fix missing TailCall warning in TOp.IntegerForLoop ([PR #18399](https://github.com/dotnet/fsharp/pull/18399)) * Fix classification of `nameof` in `nameof<'T>`, `match … with nameof ident -> …`. ([Issue #10026](https://github.com/dotnet/fsharp/issues/10026), [PR #18300](https://github.com/dotnet/fsharp/pull/18300)) * Fix Realsig+ generates nested closures with incorrect Generic ([Issue #17797](https://github.com/dotnet/fsharp/issues/17797), [PR #17877](https://github.com/dotnet/fsharp/pull/17877)) * Fix optimizer internal error for records with static fields ([Issue #18165](https://github.com/dotnet/fsharp/issues/18165), [PR #18280](https://github.com/dotnet/fsharp/pull/18280)) @@ -12,6 +13,13 @@ * Cancellable: fix leaking cancellation token ([PR #18295](https://github.com/dotnet/fsharp/pull/18295)) * Fix NRE when accessing nullable fields of types within their equals/hash/compare methods ([PR #18296](https://github.com/dotnet/fsharp/pull/18296)) * Fix nullness warning for overrides of generic code with nullable type instance ([Issue #17988](https://github.com/dotnet/fsharp/issues/17988), [PR #18337](https://github.com/dotnet/fsharp/pull/18337)) +* Unsafe downcast from `obj` to generic `T` no longer requires `not null` constraint on `T`([Issue #18275](https://github.com/dotnet/fsharp/issues/18275), [PR #18343](https://github.com/dotnet/fsharp/pull/18343)) +* Fix "type inference problem too complicated" for SRTP with T:null and T:struct dummy constraint([Issue #18288](https://github.com/dotnet/fsharp/issues/18288), [PR #18345](https://github.com/dotnet/fsharp/pull/18345)) +* Fix for missing parse diagnostics in TransparentCompiler.ParseAndCheckProject ([PR #18366](https://github.com/dotnet/fsharp/pull/18366)) +* Miscellanous parentheses analyzer fixes. ([PR #18350](https://github.com/dotnet/fsharp/pull/18350)) +* Fix duplicate parse error reporting for GetBackgroundCheckResultsForFileInProject ([Issue #18379](https://github.com/dotnet/fsharp/issues/18379) [PR #18380](https://github.com/dotnet/fsharp/pull/18380)) +* Fix MethodDefNotFound when compiling code invoking delegate with option parameter ([Issue #5171](https://github.com/dotnet/fsharp/issues/5171), [PR #18385](https://github.com/dotnet/fsharp/pull/18385)) +* Fix #r nuget ..." downloads unneeded packages ([Issue #18231](https://github.com/dotnet/fsharp/issues/18231), [PR #18393](https://github.com/dotnet/fsharp/pull/18393)) ### Added * Added missing type constraints in FCS. ([PR #18241](https://github.com/dotnet/fsharp/pull/18241)) @@ -20,15 +28,18 @@ * Nullness warnings are issued for signature<>implementation conformance ([PR #18186](https://github.com/dotnet/fsharp/pull/18186)) * Symbols: Add FSharpAssembly.IsFSharp ([PR #18290](https://github.com/dotnet/fsharp/pull/18290)) * Type parameter constraint `null` in generic code will now automatically imply `not struct` ([Issue #18320](https://github.com/dotnet/fsharp/issues/18320), [PR #18323](https://github.com/dotnet/fsharp/pull/18323)) +* Add a switch to determine whether to generate a default implementation body for overridden method when completing. [PR #18341](https://github.com/dotnet/fsharp/pull/18341) -### Changed +### Changed * FSharpCheckFileResults.ProjectContext.ProjectOptions will not be available when using the experimental Transparent Compiler feature. ([PR #18205](https://github.com/dotnet/fsharp/pull/18205)) * Update `Obsolete` attribute checking to account for `DiagnosticId` and `UrlFormat` properties. ([PR #18224](https://github.com/dotnet/fsharp/pull/18224)) * Remove `Cancellable.UsingToken` from tests ([PR #18276](https://github.com/dotnet/fsharp/pull/18276)) * Added nullability annotations to `.Using` builder method for `async`, `task` and compiler-internal builders ([PR #18292](https://github.com/dotnet/fsharp/pull/18292)) * Warn when `unit` is passed to an `obj`-typed argument ([PR #18330](https://github.com/dotnet/fsharp/pull/18330)) * Warning for "useless null handling" works with piped syntax constructs now ([PR #18331](https://github.com/dotnet/fsharp/pull/18331)) +* Make indent in generated overridden member code depend on the context, not fix to 4. ([PR #18341](https://github.com/dotnet/fsharp/pull/18341)) +* Adjust caller info attribute error message range ([PR #18388](https://github.com/dotnet/fsharp/pull/18388)) ### Breaking Changes * Struct unions with overlapping fields now generate mappings needed for reading via reflection ([Issue #18121](https://github.com/dotnet/fsharp/issues/17797), [PR #18274](https://github.com/dotnet/fsharp/pull/17877)) diff --git a/docs/release-notes/.FSharp.Core/9.0.300.md b/docs/release-notes/.FSharp.Core/9.0.300.md index 5e6903f3fa4..3b2fdab5cfe 100644 --- a/docs/release-notes/.FSharp.Core/9.0.300.md +++ b/docs/release-notes/.FSharp.Core/9.0.300.md @@ -1,4 +1,5 @@ ### Fixed +* Modified the behavior of `Array.insertManyAt` to return a copy of the original array when inserting an empty array. ([PR #18353](https://github.com/dotnet/fsharp/pull/18353)) ### Added * Added nullability annotations to `.Using` builder method for `async` and `task` builders ([PR #18292](https://github.com/dotnet/fsharp/pull/18292)) diff --git a/docs/release-notes/.Language/9.0.md b/docs/release-notes/.Language/9.0.md index 2785a646e56..d2247aa35c4 100644 --- a/docs/release-notes/.Language/9.0.md +++ b/docs/release-notes/.Language/9.0.md @@ -21,6 +21,7 @@ * 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)) +* Revert EnforceAttributeTargets Feature. ([PR #18005](https://github.com/dotnet/fsharp/pull/18005)) ### Changed diff --git a/docs/release-notes/.VisualStudio/17.14.md b/docs/release-notes/.VisualStudio/17.14.md new file mode 100644 index 00000000000..f9b710ea122 --- /dev/null +++ b/docs/release-notes/.VisualStudio/17.14.md @@ -0,0 +1,10 @@ +### Fixed +* Fix #r nuget ..." downloads unneeded packages ([Issue #18231](https://github.com/dotnet/fsharp/issues/18231), [PR #18393](https://github.com/dotnet/fsharp/pull/18393)) + +### Added +* Add a switch to determine whether to generate a default implementation body for overridden method when completing. [PR #18341](https://github.com/dotnet/fsharp/pull/18341) + +### Changed +* Make indent in generated overridden member code depend on the context, not fix to 4. ([PR #18341](https://github.com/dotnet/fsharp/pull/18341)) + +### Breaking Changes diff --git a/eng/SourceBuildPrebuiltBaseline.xml b/eng/SourceBuildPrebuiltBaseline.xml index 18f3b782d76..a3c0b4e6619 100644 --- a/eng/SourceBuildPrebuiltBaseline.xml +++ b/eng/SourceBuildPrebuiltBaseline.xml @@ -26,4 +26,8 @@ + + + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 983446e2b7b..a3b61734d48 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,32 +1,32 @@ - + https://github.com/dotnet/source-build-reference-packages - 1cec3b4a8fb07138136a1ca1e04763bfcf7841db + 6968f7059f4418e985febe704a3b1320f9e5887d - + https://github.com/dotnet/msbuild - 2d02daa886f279e2ee749cad03db4b1b75bb9adb + 0ca03f84b7848ce9d7d3e5d1f68c5e090efa4f30 - + https://github.com/dotnet/msbuild - 2d02daa886f279e2ee749cad03db4b1b75bb9adb + 0ca03f84b7848ce9d7d3e5d1f68c5e090efa4f30 - + https://github.com/dotnet/msbuild - 2d02daa886f279e2ee749cad03db4b1b75bb9adb + 0ca03f84b7848ce9d7d3e5d1f68c5e090efa4f30 - + https://github.com/dotnet/msbuild - 2d02daa886f279e2ee749cad03db4b1b75bb9adb + 0ca03f84b7848ce9d7d3e5d1f68c5e090efa4f30 - + https://github.com/dotnet/msbuild - 2d02daa886f279e2ee749cad03db4b1b75bb9adb + 0ca03f84b7848ce9d7d3e5d1f68c5e090efa4f30 https://github.com/dotnet/runtime @@ -42,14 +42,14 @@ - + https://github.com/dotnet/arcade - 5da211e1c42254cb35e7ef3d5a8428fb24853169 + 5ba9ca776c1d0bb72b2791591e54cf51fc52dfee - + https://github.com/dotnet/arcade - 5da211e1c42254cb35e7ef3d5a8428fb24853169 + 5ba9ca776c1d0bb72b2791591e54cf51fc52dfee diff --git a/eng/Versions.props b/eng/Versions.props index bacdd4e3233..5993821c9ea 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -94,7 +94,7 @@ 17.10.40152 17.10.526-pre-g1b474069f5 17.10.41 - 17.11.0-preview-24178-03 + 17.13.22 $(RoslynVersion) $(RoslynVersion) @@ -130,9 +130,9 @@ 15.0.25123-Dev15Preview - $(MicrosoftBuildVersion) - $(MicrosoftBuildVersion) - $(MicrosoftBuildVersion) + 17.13.22 + 17.13.22 + 17.13.22 $(VisualStudioEditorPackagesVersion) diff --git a/eng/common/core-templates/steps/generate-sbom.yml b/eng/common/core-templates/steps/generate-sbom.yml index d938b60e1bb..56a09009482 100644 --- a/eng/common/core-templates/steps/generate-sbom.yml +++ b/eng/common/core-templates/steps/generate-sbom.yml @@ -38,7 +38,7 @@ steps: PackageName: ${{ parameters.packageName }} BuildDropPath: ${{ parameters.buildDropPath }} PackageVersion: ${{ parameters.packageVersion }} - ManifestDirPath: ${{ parameters.manifestDirPath }} + ManifestDirPath: ${{ parameters.manifestDirPath }}/$(ARTIFACT_NAME) ${{ if ne(parameters.IgnoreDirectories, '') }}: AdditionalComponentDetectorArgs: '--IgnoreDirectories ${{ parameters.IgnoreDirectories }}' diff --git a/eng/common/generate-sbom-prep.ps1 b/eng/common/generate-sbom-prep.ps1 index 3e5c1c74a1c..a0c7d792a76 100644 --- a/eng/common/generate-sbom-prep.ps1 +++ b/eng/common/generate-sbom-prep.ps1 @@ -4,18 +4,26 @@ Param( . $PSScriptRoot\pipeline-logging-functions.ps1 +# Normally - we'd listen to the manifest path given, but 1ES templates will overwrite if this level gets uploaded directly +# with their own overwriting ours. So we create it as a sub directory of the requested manifest path. +$ArtifactName = "${env:SYSTEM_STAGENAME}_${env:AGENT_JOBNAME}_SBOM" +$SafeArtifactName = $ArtifactName -replace '["/:<>\\|?@*"() ]', '_' +$SbomGenerationDir = Join-Path $ManifestDirPath $SafeArtifactName + +Write-Host "Artifact name before : $ArtifactName" +Write-Host "Artifact name after : $SafeArtifactName" + Write-Host "Creating dir $ManifestDirPath" + # create directory for sbom manifest to be placed -if (!(Test-Path -path $ManifestDirPath)) +if (!(Test-Path -path $SbomGenerationDir)) { - New-Item -ItemType Directory -path $ManifestDirPath - Write-Host "Successfully created directory $ManifestDirPath" + New-Item -ItemType Directory -path $SbomGenerationDir + Write-Host "Successfully created directory $SbomGenerationDir" } else{ Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder." } Write-Host "Updating artifact name" -$artifact_name = "${env:SYSTEM_STAGENAME}_${env:AGENT_JOBNAME}_SBOM" -replace '["/:<>\\|?@*"() ]', '_' -Write-Host "Artifact name $artifact_name" -Write-Host "##vso[task.setvariable variable=ARTIFACT_NAME]$artifact_name" +Write-Host "##vso[task.setvariable variable=ARTIFACT_NAME]$SafeArtifactName" diff --git a/eng/common/generate-sbom-prep.sh b/eng/common/generate-sbom-prep.sh index d5c76dc827b..b8ecca72bbf 100755 --- a/eng/common/generate-sbom-prep.sh +++ b/eng/common/generate-sbom-prep.sh @@ -14,19 +14,24 @@ done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" . $scriptroot/pipeline-logging-functions.sh + +# replace all special characters with _, some builds use special characters like : in Agent.Jobname, that is not a permissible name while uploading artifacts. +artifact_name=$SYSTEM_STAGENAME"_"$AGENT_JOBNAME"_SBOM" +safe_artifact_name="${artifact_name//["/:<>\\|?@*$" ]/_}" manifest_dir=$1 -if [ ! -d "$manifest_dir" ] ; then - mkdir -p "$manifest_dir" - echo "Sbom directory created." $manifest_dir +# Normally - we'd listen to the manifest path given, but 1ES templates will overwrite if this level gets uploaded directly +# with their own overwriting ours. So we create it as a sub directory of the requested manifest path. +sbom_generation_dir="$manifest_dir/$safe_artifact_name" + +if [ ! -d "$sbom_generation_dir" ] ; then + mkdir -p "$sbom_generation_dir" + echo "Sbom directory created." $sbom_generation_dir else Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder." fi -artifact_name=$SYSTEM_STAGENAME"_"$AGENT_JOBNAME"_SBOM" echo "Artifact name before : "$artifact_name -# replace all special characters with _, some builds use special characters like : in Agent.Jobname, that is not a permissible name while uploading artifacts. -safe_artifact_name="${artifact_name//["/:<>\\|?@*$" ]/_}" echo "Artifact name after : "$safe_artifact_name export ARTIFACT_NAME=$safe_artifact_name echo "##vso[task.setvariable variable=ARTIFACT_NAME]$safe_artifact_name" diff --git a/eng/common/templates-official/job/job.yml b/eng/common/templates-official/job/job.yml index 605692d2fb7..817555505aa 100644 --- a/eng/common/templates-official/job/job.yml +++ b/eng/common/templates-official/job/job.yml @@ -16,6 +16,7 @@ jobs: parameters: PackageVersion: ${{ parameters.packageVersion }} BuildDropPath: ${{ parameters.buildDropPath }} + ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom publishArtifacts: false # publish artifacts diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index a46b6deb759..22b49e09d09 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -42,7 +42,7 @@ [bool]$useInstalledDotNetCli = if (Test-Path variable:useInstalledDotNetCli) { $useInstalledDotNetCli } else { $true } # Enable repos to use a particular version of the on-line dotnet-install scripts. -# default URL: https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1 +# default URL: https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.ps1 [string]$dotnetInstallScriptVersion = if (Test-Path variable:dotnetInstallScriptVersion) { $dotnetInstallScriptVersion } else { 'v1' } # True to use global NuGet cache instead of restoring packages to repository-local directory. @@ -262,7 +262,7 @@ function GetDotNetInstallScript([string] $dotnetRoot) { if (!(Test-Path $installScript)) { Create-Directory $dotnetRoot $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit - $uri = "https://dotnet.microsoft.com/download/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.ps1" + $uri = "https://builds.dotnet.microsoft.com/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.ps1" Retry({ Write-Host "GET $uri" diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 1159726a10f..01b09b65796 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -54,7 +54,7 @@ warn_as_error=${warn_as_error:-true} use_installed_dotnet_cli=${use_installed_dotnet_cli:-true} # Enable repos to use a particular version of the on-line dotnet-install scripts. -# default URL: https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh +# default URL: https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh dotnetInstallScriptVersion=${dotnetInstallScriptVersion:-'v1'} # True to use global NuGet cache instead of restoring packages to repository-local directory. @@ -295,7 +295,7 @@ function with_retries { function GetDotNetInstallScript { local root=$1 local install_script="$root/dotnet-install.sh" - local install_script_url="https://dotnet.microsoft.com/download/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.sh" + local install_script_url="https://builds.dotnet.microsoft.com/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.sh" if [[ ! -a "$install_script" ]]; then mkdir -p "$root" diff --git a/global.json b/global.json index 598d8b7367b..eca327e814a 100644 --- a/global.json +++ b/global.json @@ -1,23 +1,23 @@ { "sdk": { - "version": "9.0.200", + "version": "9.0.202", "allowPrerelease": true }, "tools": { - "dotnet": "9.0.200", + "dotnet": "9.0.202", "vs": { "version": "17.8", "components": [ "Microsoft.VisualStudio.Component.FSharp" ] }, - "xcopy-msbuild": "17.12.0" + "xcopy-msbuild": "17.13.0" }, "native-tools": { "perl": "5.38.2.2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.25111.5", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.25164.2", "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23255.2" } } diff --git a/src/Compiler/AbstractIL/ilnativeres.fs b/src/Compiler/AbstractIL/ilnativeres.fs index 62961613b3f..2eb03ab674e 100644 --- a/src/Compiler/AbstractIL/ilnativeres.fs +++ b/src/Compiler/AbstractIL/ilnativeres.fs @@ -83,7 +83,7 @@ type CvtResFile() = pAdditional.DataSize <- cbData pAdditional.pstringType <- CvtResFile.ReadStringOrID reader pAdditional.pstringName <- CvtResFile.ReadStringOrID reader - stream.Position <- stream.Position + 3L &&& ~~~ 3L + stream.Position <- stream.Position + 3L &&& ~~~3L pAdditional.DataVersion <- reader.ReadUInt32() pAdditional.MemoryFlags <- reader.ReadUInt16() pAdditional.LanguageId <- reader.ReadUInt16() @@ -91,7 +91,7 @@ type CvtResFile() = pAdditional.Characteristics <- reader.ReadUInt32() pAdditional.data <- Array.zeroCreate (int pAdditional.DataSize) reader.Read(pAdditional.data, 0, pAdditional.data.Length) |> ignore - stream.Position <- stream.Position + 3L &&& ~~~ 3L + stream.Position <- stream.Position + 3L &&& ~~~3L if pAdditional.pstringType.theString = Unchecked.defaultof<_> @@ -174,6 +174,7 @@ type SectionCharacteristics = type ResourceSection() = new(sectionBytes: byte[], relocations: uint32[]) as this = (ResourceSection()) + then Debug.Assert(sectionBytes :> obj <> Unchecked.defaultof<_>) Debug.Assert(relocations :> obj <> Unchecked.defaultof<_>) @@ -374,13 +375,8 @@ type VersionHelper() = /// /// True when parsing succeeds completely (i.e. every character in the string was consumed), false otherwise. static member private TryParse - ( - s: string, - allowWildcard: bool, - maxValue: uint16, - allowPartialParse: bool, - [] version: byref - ) = + (s: string, allowWildcard: bool, maxValue: uint16, allowPartialParse: bool, [] version: byref) + = Debug.Assert(not allowWildcard || maxValue < UInt16.MaxValue) if String.IsNullOrWhiteSpace s then @@ -520,20 +516,24 @@ type VersionResourceSerializer() = member val private _isDll = Unchecked.defaultof with get, set - new(isDll: bool, - comments: string, - companyName: string, - fileDescription: string, - fileVersion: string, - internalName: string, - legalCopyright: string, - legalTrademark: string, - originalFileName: string, - productName: string, - productVersion: string, - assemblyVersion: Version) as this = + new + ( + isDll: bool, + comments: string, + companyName: string, + fileDescription: string, + fileVersion: string, + internalName: string, + legalCopyright: string, + legalTrademark: string, + originalFileName: string, + productName: string, + productVersion: string, + assemblyVersion: Version + ) as this = VersionResourceSerializer() + then this._isDll <- isDll this._commentsContents <- comments @@ -620,7 +620,7 @@ type VersionResourceSerializer() = static member private PadKeyLen(cb: int) = VersionResourceSerializer.PadToDword(cb + 3 * sizeof) - 3 * sizeof - static member private PadToDword(cb: int) = cb + 3 &&& ~~~ 3 + static member private PadToDword(cb: int) = cb + 3 &&& ~~~3 static member val private HDRSIZE = (int (3 * sizeof)) with get, set @@ -667,7 +667,7 @@ type VersionResourceSerializer() = let mutable (sum: int) = 0 for verString in this.GetVerStrings() do - sum <- sum + 3 &&& ~~~ 3 + sum <- sum + 3 &&& ~~~3 sum <- sum + VersionResourceSerializer.SizeofVerString(verString.Key, verString.Value) sum @@ -801,7 +801,7 @@ type VersionResourceSerializer() = for entry in this.GetVerStrings() do let mutable writerPos = writer.BaseStream.Position - writer.Write(Array.zeroCreate (int ((writerPos + 3L) &&& ~~~ 3L - writerPos)): byte[]) + writer.Write(Array.zeroCreate (int ((writerPos + 3L) &&& ~~~3L - writerPos)): byte[]) Debug.Assert(entry.Value <> Unchecked.defaultof<_>) VersionResourceSerializer.WriteVersionString(entry, writer) @@ -861,7 +861,7 @@ type Win32ResourceConversions() = let mutable (i: uint16) = 0us while (i < count) do - resStream.Position <- resStream.Position + 3L &&& ~~~ 3L + resStream.Position <- resStream.Position + 3L &&& ~~~3L resWriter.Write iconDirEntries[(int i)].dwBytesInRes resWriter.Write 0x00000020u resWriter.Write 0xFFFFus @@ -878,7 +878,7 @@ type Win32ResourceConversions() = i <- i + 1us let mutable (RT_GROUP_ICON: WORD) = (RT_ICON + 11us) - resStream.Position <- resStream.Position + 3L &&& ~~~ 3L + resStream.Position <- resStream.Position + 3L &&& ~~~3L resWriter.Write(uint32 (3 * sizeof + int count * 14)) resWriter.Write 0x00000020u resWriter.Write 0xFFFFus @@ -933,7 +933,7 @@ type Win32ResourceConversions() = let comments = (defaultArg comments) Unchecked.defaultof<_> let companyName = (defaultArg companyName) Unchecked.defaultof<_> let mutable resWriter = new BinaryWriter(resStream, Encoding.Unicode) - resStream.Position <- resStream.Position + 3L &&& ~~~ 3L + resStream.Position <- resStream.Position + 3L &&& ~~~3L let mutable (RT_VERSION: DWORD) = 16u let mutable ver = @@ -970,7 +970,7 @@ type Win32ResourceConversions() = Debug.Assert(resStream.Position - startPos = int64 dataSize + int64 headerSize) static member AppendManifestToResourceStream(resStream: Stream, manifestStream: Stream, isDll: bool) = - resStream.Position <- resStream.Position + 3L &&& ~~~ 3L (* ERROR UnknownPrefixOperator "~" *) + resStream.Position <- resStream.Position + 3L &&& ~~~3L (* ERROR UnknownPrefixOperator "~" *) let mutable (RT_MANIFEST: WORD) = 24us let mutable resWriter = new BinaryWriter(resStream) resWriter.Write(uint32 manifestStream.Length) diff --git a/src/Compiler/AbstractIL/ilread.fs b/src/Compiler/AbstractIL/ilread.fs index 14af625419b..4f280f8ad29 100644 --- a/src/Compiler/AbstractIL/ilread.fs +++ b/src/Compiler/AbstractIL/ilread.fs @@ -4180,16 +4180,8 @@ and seekReadTopExportedTypes (ctxt: ILMetadataReader) = // Note, pectxtEager and pevEager must not be captured by the results of this function let openMetadataReader - ( - fileName, - mdfile: BinaryFile, - metadataPhysLoc, - peinfo, - pectxtEager: PEReader, - pevEager, - pectxtCaptured, - reduceMemoryUsage - ) = + (fileName, mdfile: BinaryFile, metadataPhysLoc, peinfo, pectxtEager: PEReader, pevEager, pectxtCaptured, reduceMemoryUsage) + = let mdv = mdfile.GetView() let magic = seekReadUInt16AsInt32 mdv metadataPhysLoc diff --git a/src/Compiler/AbstractIL/ilreflect.fs b/src/Compiler/AbstractIL/ilreflect.fs index 45c0652c59d..6151c28b8f0 100644 --- a/src/Compiler/AbstractIL/ilreflect.fs +++ b/src/Compiler/AbstractIL/ilreflect.fs @@ -290,10 +290,7 @@ type OpCode with member opcode.RefEmitName = match opcode.Name with | null -> "" - | name -> - (string (Char.ToUpper(name[0])) + name[1..]) - .Replace(".", "_") - .Replace("_i4", "_I4") + | name -> (string (Char.ToUpper(name[0])) + name[1..]).Replace(".", "_").Replace("_i4", "_I4") type ILGenerator with @@ -713,7 +710,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 @@ -1491,7 +1488,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() @@ -1517,7 +1514,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( @@ -2497,7 +2494,7 @@ let mkDynamicAssemblyAndModule (assemblyName: string, optimize, collectible) = let daType = typeof let daCtor = - !! daType.GetConstructor([| typeof |]) + !!daType.GetConstructor([| typeof |]) let daBuilder = CustomAttributeBuilder( diff --git a/src/Compiler/AbstractIL/ilsupp.fs b/src/Compiler/AbstractIL/ilsupp.fs index 513d14d9f51..cd30137faaf 100644 --- a/src/Compiler/AbstractIL/ilsupp.fs +++ b/src/Compiler/AbstractIL/ilsupp.fs @@ -653,8 +653,7 @@ let unlinkResource (ulLinkedResourceBaseRVA: int32) (pbLinkedResource: byte[]) = for i = 0 to (nResNodes - 1) do size <- size - + pResNodes[i] - .Save(ulLinkedResourceBaseRVA, pbLinkedResource, Unchecked.defaultof, 0) + + pResNodes[i].Save(ulLinkedResourceBaseRVA, pbLinkedResource, Unchecked.defaultof, 0) let pResBuffer = Bytes.zeroCreate size @@ -670,7 +669,6 @@ let unlinkResource (ulLinkedResourceBaseRVA: int32) (pbLinkedResource: byte[]) = for i = 0 to (nResNodes - 1) do resBufferOffset <- resBufferOffset - + pResNodes[i] - .Save(ulLinkedResourceBaseRVA, pbLinkedResource, pResBuffer, resBufferOffset) + + pResNodes[i].Save(ulLinkedResourceBaseRVA, pbLinkedResource, pResBuffer, resBufferOffset) pResBuffer diff --git a/src/Compiler/Checking/AugmentWithHashCompare.fs b/src/Compiler/Checking/AugmentWithHashCompare.fs index 7efb505c9f3..b2e2eaf9be7 100644 --- a/src/Compiler/Checking/AugmentWithHashCompare.fs +++ b/src/Compiler/Checking/AugmentWithHashCompare.fs @@ -1647,13 +1647,7 @@ let rec TypeDefinitelyHasEquality g ty = match appTy with | ValueSome(tcref, _) when HasFSharpAttribute g g.attrib_NoEqualityAttribute tcref.Attribs -> false | _ -> - if - isTyparTy g ty - && (destTyparTy g ty).Constraints - |> List.exists (function - | TyparConstraint.SupportsEquality _ -> true - | _ -> false) - then + if ty |> IsTyparTyWithConstraint g _.IsSupportsEquality then true else match ty with diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index f6b405bf1d6..78acf62bb98 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -2138,17 +2138,13 @@ module TyconConstraintInference = // Is the field type a type parameter? match tryDestTyparTy g ty with - | ValueSome tp -> - // Look for an explicit 'comparison' constraint - if tp.Constraints |> List.exists (function TyparConstraint.SupportsComparison _ -> true | _ -> false) then - true - + | ValueSome tp when tp |> HasConstraint _.IsSupportsComparison -> true + | ValueSome tp -> // Within structural types, type parameters can be optimistically assumed to have comparison // We record the ones for which we have made this assumption. - elif tycon.TyparsNoRange |> List.exists (fun tp2 -> typarRefEq tp tp2) then + if tycon.TyparsNoRange |> List.exists (fun tp2 -> typarRefEq tp tp2) then assumedTyparsAcc <- assumedTyparsAcc.Add(tp.Stamp) - true - + true else false | _ -> @@ -2267,14 +2263,11 @@ module TyconConstraintInference = // and type parameters. let rec checkIfFieldTypeSupportsEquality (tycon: Tycon) (ty: TType) = match tryDestTyparTy g ty with + | ValueSome tp when tp |> HasConstraint _.IsSupportsEquality -> true | ValueSome tp -> - // Look for an explicit 'equality' constraint - if tp.Constraints |> List.exists (function TyparConstraint.SupportsEquality _ -> true | _ -> false) then - true - // Within structural types, type parameters can be optimistically assumed to have equality // We record the ones for which we have made this assumption. - elif tycon.Typars(tycon.Range) |> List.exists (fun tp2 -> typarRefEq tp tp2) then + if tycon.Typars(tycon.Range) |> List.exists (fun tp2 -> typarRefEq tp tp2) then assumedTyparsAcc <- assumedTyparsAcc.Add(tp.Stamp) true else @@ -3704,7 +3697,20 @@ module EstablishTypeDefinitionCores = if curriedArgInfos.Length < 1 then error(Error(FSComp.SR.tcInvalidDelegateSpecification(), m)) if curriedArgInfos.Length > 1 then error(Error(FSComp.SR.tcDelegatesCannotBeCurried(), m)) let ttps = thisTyconRef.Typars m - let fparams = curriedArgInfos.Head |> List.map MakeSlotParam + let fparams = + curriedArgInfos.Head + |> List.map (fun (ty, argInfo: ArgReprInfo) -> + let ty = + if HasFSharpAttribute g g.attrib_OptionalArgumentAttribute argInfo.Attribs then + match TryFindFSharpAttribute g g.attrib_StructAttribute argInfo.Attribs with + | Some (Attrib(range=m)) -> + checkLanguageFeatureAndRecover g.langVersion LanguageFeature.SupportValueOptionsAsOptionalParameters m + mkValueOptionTy g ty + | _ -> + mkOptionTy g ty + else ty + + MakeSlotParam(ty, argInfo)) TFSharpDelegate (MakeSlotSig("Invoke", thisTy, ttps, [], [fparams], returnTy)) | _ -> error(InternalError("should have inferred tycon kind", m)) diff --git a/src/Compiler/Checking/CheckPatterns.fs b/src/Compiler/Checking/CheckPatterns.fs index cdffd9acb7f..9587c3b5e9f 100644 --- a/src/Compiler/Checking/CheckPatterns.fs +++ b/src/Compiler/Checking/CheckPatterns.fs @@ -58,14 +58,6 @@ let UnifyRefTupleType contextInfo (cenv: cenv) denv m ty ps = AddCxTypeEqualsType contextInfo denv cenv.css m ty (TType_tuple (tupInfoRef, ptys)) ptys -let inline mkOptionalParamTyBasedOnAttribute (g: TcGlobals) tyarg attribs = - if g.langVersion.SupportsFeature(LanguageFeature.SupportValueOptionsAsOptionalParameters) - && findSynAttribute "StructAttribute" attribs - then - mkValueOptionTy g tyarg - else - mkOptionTy g tyarg - let rec TryAdjustHiddenVarNameToCompGenName (cenv: cenv) env (id: Ident) altNameRefCellOpt = match altNameRefCellOpt with | Some ({contents = SynSimplePatAlternativeIdInfo.Undecided altId } as altNameRefCell) -> diff --git a/src/Compiler/Checking/ConstraintSolver.fs b/src/Compiler/Checking/ConstraintSolver.fs index a45bb37234f..02829f564ad 100644 --- a/src/Compiler/Checking/ConstraintSolver.fs +++ b/src/Compiler/Checking/ConstraintSolver.fs @@ -958,13 +958,6 @@ let rec SolveTyparEqualsTypePart1 (csenv: ConstraintSolverEnv) m2 (trace: Option // 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) } @@ -1295,8 +1288,9 @@ and SolveTypeEqualsType (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTr 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) -> + isAppTy g sty2 && + tp1 |> HasConstraint _.IsSupportsNull && + not(tp1 |> HasConstraint _.IsIsNonNullableStruct)-> 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 @@ -1614,10 +1608,10 @@ and SolveTyparSubtypeOfType (csenv: ConstraintSolverEnv) ndeep m2 trace tp ty1 = else AddConstraint csenv ndeep m2 trace tp (TyparConstraint.CoercesTo(ty1, csenv.m)) -and DepthCheck ndeep m = - if ndeep > 300 then - error(Error(FSComp.SR.csTypeInferenceMaxDepth(), m)) - else +and DepthCheck ndeep m = + if ndeep > 300 then + error(Error(FSComp.SR.csTypeInferenceMaxDepth(), m)) + else CompleteD // If this is a type that's parameterized on a unit-of-measure (expected to be numeric), unify its measure with 1 @@ -2426,7 +2420,9 @@ and EnforceConstraintConsistency (csenv: ConstraintSolverEnv) ndeep m2 trace ret return! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy1 retTy2 | TyparConstraint.SupportsComparison _, TyparConstraint.IsDelegate _ - | TyparConstraint.IsDelegate _, TyparConstraint.SupportsComparison _ + | TyparConstraint.IsDelegate _, TyparConstraint.SupportsComparison _ -> + return! ErrorD (Error(FSComp.SR.csComparisonDelegateConstraintInconsistent(), m)) + | TyparConstraint.IsNonNullableStruct _, TyparConstraint.IsReferenceType _ | TyparConstraint.IsReferenceType _, TyparConstraint.IsNonNullableStruct _ -> return! ErrorD (Error(FSComp.SR.csStructConstraintInconsistent(), m)) @@ -2434,6 +2430,11 @@ and EnforceConstraintConsistency (csenv: ConstraintSolverEnv) ndeep m2 trace ret | TyparConstraint.SupportsNull _, TyparConstraint.NotSupportsNull _ | TyparConstraint.NotSupportsNull _, TyparConstraint.SupportsNull _ -> return! ErrorD (Error(FSComp.SR.csNullNotNullConstraintInconsistent(), m)) + + | TyparConstraint.SupportsNull _, TyparConstraint.IsNonNullableStruct _ + | TyparConstraint.IsNonNullableStruct _, TyparConstraint.SupportsNull _ -> + () + //return! WarnD (Error(FSComp.SR.csNullStructConstraintInconsistent(), m)) | TyparConstraint.IsUnmanaged _, TyparConstraint.IsReferenceType _ | TyparConstraint.IsReferenceType _, TyparConstraint.IsUnmanaged _ -> @@ -2640,7 +2641,7 @@ and SolveTypeUseSupportsNull (csenv: ConstraintSolverEnv) ndeep m2 trace ty = | 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 + if not (tp |> HasConstraint _.IsIsReferenceType) then do! AddConstraint csenv ndeep m2 trace tp (TyparConstraint.IsReferenceType m) return! SolveNullnessSupportsNull csenv ndeep m2 trace ty nullness | _ -> @@ -2737,7 +2738,7 @@ and SolveTypeCanCarryNullness (csenv: ConstraintSolverEnv) ty nullness = let strippedTy = stripTyEqnsA g true ty match tryAddNullnessToTy nullness strippedTy with | Some _ -> - if isTyparTy g strippedTy && not (isReferenceTyparTy g strippedTy) then + 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 @@ -2978,10 +2979,11 @@ and SolveTypeRequiresDefaultValue (csenv: ConstraintSolverEnv) ndeep m2 trace or let g = csenv.g let m = csenv.m let ty = stripTyEqnsAndMeasureEqns g origTy + if isTyparTy g ty then - if isNonNullableStructTyparTy g ty then + if IsNonNullableStructTyparTy g ty then SolveTypeRequiresDefaultConstructor csenv ndeep m2 trace ty - elif isReferenceTyparTy g ty then + elif IsReferenceTyparTy g ty then SolveTypeUseSupportsNull csenv ndeep m2 trace ty else ErrorD (ConstraintSolverError(FSComp.SR.csGenericConstructRequiresStructOrReferenceConstraint(), m, m2)) diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index 22b603d211a..52cb3c0d61a 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -3083,9 +3083,7 @@ let TcComputationExpression (cenv: TcFileState) env (overallTy: OverallTy) tpenv TranslateComputationExpression ceenv CompExprTranslationPass.Initial hasCustomOperations (LazyWithContext.NotLazy([], env)) comp id let mDelayOrQuoteOrRun = - mBuilderVal - .NoteSourceConstruct(NotedSourceConstruct.DelayOrQuoteOrRun) - .MakeSynthetic() + mBuilderVal.NoteSourceConstruct(NotedSourceConstruct.DelayOrQuoteOrRun).MakeSynthetic() // Add a call to 'Delay' if the method is present let delayedExpr = diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index ee465013b6b..f1e6960cc21 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -2194,7 +2194,7 @@ module GeneralizationHelpers = let relevantUniqueSubtypeConstraint (tp: Typar) = // Find a single subtype constraint - match tp.Constraints |> List.partition (function TyparConstraint.CoercesTo _ -> true | _ -> false) with + match tp.Constraints |> List.partition _.IsCoercesTo with | [TyparConstraint.CoercesTo(tgtTy, _)], others -> // Throw away null constraints if they are implied if others |> List.exists (function TyparConstraint.SupportsNull _ -> not (TypeNullIsExtraValue g m tgtTy) | _ -> true) @@ -2976,11 +2976,9 @@ let TcRuntimeTypeTest isCast isOperator (cenv: cenv) denv m tgtTy srcTy = if isSealedTy g srcTy then error(RuntimeCoercionSourceSealed(denv, srcTy, m)) - if isSealedTy g tgtTy || isTyparTy g tgtTy || not (isInterfaceTy g srcTy) then - if isCast then - AddCxTypeMustSubsumeType (ContextInfo.RuntimeTypeTest isOperator) denv cenv.css m NoTrace srcTy tgtTy - else - AddCxTypeMustSubsumeType ContextInfo.NoContext denv cenv.css m NoTrace srcTy tgtTy + if (isSealedTy g tgtTy || isTyparTy g tgtTy || not (isInterfaceTy g srcTy)) && not (isObjTyAnyNullness g srcTy) then + let context = if isCast then ContextInfo.RuntimeTypeTest isOperator else ContextInfo.NoContext + AddCxTypeMustSubsumeType context denv cenv.css m NoTrace srcTy tgtTy if isErasedType g tgtTy then if isCast then @@ -4309,8 +4307,8 @@ and TcValSpec (cenv: cenv) env declKind newOk containerInfo memFlagsOpt thisTyOp ((List.mapSquared fst curriedArgTys), valSynInfo.CurriedArgInfos) ||> List.map2 (fun argTys argInfos -> (argTys, argInfos) - ||> List.map2 (fun argTy argInfo -> - if SynInfo.IsOptionalArg argInfo then mkOptionTy g argTy + ||> List.map2 (fun argTy (SynArgInfo(attribs, _, _) as argInfo) -> + if SynInfo.IsOptionalArg argInfo then mkOptionalParamTyBasedOnAttribute g argTy attribs else argTy)) mkIteratedFunTy g (List.map (mkRefTupledTy g) curriedArgTys) returnTy else tyR diff --git a/src/Compiler/Checking/Expressions/CheckExpressionsOps.fs b/src/Compiler/Checking/Expressions/CheckExpressionsOps.fs index 4b9de82d758..7f5ff2f9f64 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressionsOps.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressionsOps.fs @@ -384,3 +384,12 @@ let compileSeqExprMatchClauses (cenv: TcFileState) env inputExprMark (pat: Patte bindPatTy genInnerTy tclauses + +let inline mkOptionalParamTyBasedOnAttribute (g: TcGlobals.TcGlobals) tyarg attribs = + if + g.langVersion.SupportsFeature(LanguageFeature.SupportValueOptionsAsOptionalParameters) + && findSynAttribute "StructAttribute" attribs + then + mkValueOptionTy g tyarg + else + mkOptionTy g tyarg diff --git a/src/Compiler/Checking/PostInferenceChecks.fs b/src/Compiler/Checking/PostInferenceChecks.fs index 3a4fe0e65ed..4df0185a2e5 100644 --- a/src/Compiler/Checking/PostInferenceChecks.fs +++ b/src/Compiler/Checking/PostInferenceChecks.fs @@ -2398,9 +2398,23 @@ let CheckEntityDefn cenv env (tycon: Entity) = errorR(Error(FSComp.SR.chkCurriedMethodsCantHaveOutParams(), m)) if numCurriedArgSets = 1 then + let errorIfNotStringTy m ty callerInfo = + if not (typeEquiv g g.string_ty ty) then + errorR(Error(FSComp.SR.tcCallerInfoWrongType(callerInfo |> string, "string", NicePrint.minimalStringOfType cenv.denv ty), m)) + + let errorIfNotStringOptionTy m ty callerInfo = + if not ((isOptionTy g ty) && (typeEquiv g g.string_ty (destOptionTy g ty))) then + errorR(Error(FSComp.SR.tcCallerInfoWrongType(callerInfo |> string, "string", NicePrint.minimalStringOfType cenv.denv (destOptionTy g ty)), m)) + minfo.GetParamDatas(cenv.amap, m, minfo.FormalMethodInst) - |> List.iterSquared (fun (ParamData(_, isInArg, _, optArgInfo, callerInfo, _, _, ty)) -> + |> List.iterSquared (fun (ParamData(_, isInArg, _, optArgInfo, callerInfo, nameOpt, _, ty)) -> ignore isInArg + + let m = + match nameOpt with + | Some name -> name.idRange + | None -> m + match (optArgInfo, callerInfo) with | _, NoCallerInfo -> () | NotOptional, _ -> errorR(Error(FSComp.SR.tcCallerInfoNotOptional(callerInfo |> string), m)) @@ -2410,18 +2424,9 @@ let CheckEntityDefn cenv env (tycon: Entity) = | CalleeSide, CallerLineNumber -> if not ((isOptionTy g ty) && (typeEquiv g g.int32_ty (destOptionTy g ty))) then 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 |> 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 |> 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 |> 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 |> string, "string", NicePrint.minimalStringOfType cenv.denv (destOptionTy g ty)), m))) + | CallerSide _, (CallerFilePath | CallerMemberName) -> errorIfNotStringTy m ty callerInfo + | CalleeSide, (CallerFilePath | CallerMemberName) -> errorIfNotStringOptionTy m ty callerInfo + ) for pinfo in immediateProps do let nm = pinfo.PropertyName diff --git a/src/Compiler/Checking/TailCallChecks.fs b/src/Compiler/Checking/TailCallChecks.fs index a7ea9ad802a..20e9bec8945 100644 --- a/src/Compiler/Checking/TailCallChecks.fs +++ b/src/Compiler/Checking/TailCallChecks.fs @@ -792,7 +792,12 @@ let CheckModuleBinding cenv (isRec: bool) (TBind _ as bind) = // warn for recursive calls in TryWith/TryFinally operations exprs |> Seq.iter (checkTailCall true) | Expr.Op(args = exprs) -> exprs |> Seq.iter (checkTailCall insideSubBindingOrTry) - | Expr.Sequential(expr2 = expr2) -> checkTailCall insideSubBindingOrTry expr2 + | Expr.Sequential(expr1 = expr1; expr2 = expr2) -> + match expr1 with + | Expr.Op(args = exprs; op = TOp.IntegerForLoop _) -> checkTailCall insideSubBindingOrTry expr1 + | _ -> () + + checkTailCall insideSubBindingOrTry expr2 | _ -> () checkTailCall false bodyExpr diff --git a/src/Compiler/CodeGen/EraseUnions.fs b/src/Compiler/CodeGen/EraseUnions.fs index e841010c837..18eaed4be6f 100644 --- a/src/Compiler/CodeGen/EraseUnions.fs +++ b/src/Compiler/CodeGen/EraseUnions.fs @@ -742,12 +742,14 @@ let mkMethodsAndPropertiesForFields basicProps, basicMethods let convAlternativeDef - (addMethodGeneratedAttrs, - addPropertyGeneratedAttrs, - addPropertyNeverAttrs, - addFieldGeneratedAttrs, - addFieldNeverAttrs, - mkDebuggerTypeProxyAttribute) + ( + addMethodGeneratedAttrs, + addPropertyGeneratedAttrs, + addPropertyNeverAttrs, + addFieldGeneratedAttrs, + addFieldNeverAttrs, + mkDebuggerTypeProxyAttribute + ) (g: TcGlobals) num (td: ILTypeDef) @@ -1255,12 +1257,14 @@ let convAlternativeDef baseMakerMeths, baseMakerProps, altUniqObjMeths, typeDefs, altDebugTypeDefs, altNullaryFields let mkClassUnionDef - (addMethodGeneratedAttrs, - addPropertyGeneratedAttrs, - addPropertyNeverAttrs, - addFieldGeneratedAttrs: ILFieldDef -> ILFieldDef, - addFieldNeverAttrs: ILFieldDef -> ILFieldDef, - mkDebuggerTypeProxyAttribute) + ( + addMethodGeneratedAttrs, + addPropertyGeneratedAttrs, + addPropertyNeverAttrs, + addFieldGeneratedAttrs: ILFieldDef -> ILFieldDef, + addFieldNeverAttrs: ILFieldDef -> ILFieldDef, + mkDebuggerTypeProxyAttribute + ) (g: TcGlobals) tref (td: ILTypeDef) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 1faeaddf82f..1be3b7be3a2 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -1510,18 +1510,7 @@ let GetMethodSpecForMemberVal cenv (memberInfo: ValMemberInfo) (vref: ValRef) = /// Determine how a top-level value is represented, when representing as a field, by computing an ILFieldSpec let ComputeFieldSpecForVal - ( - optIntraAssemblyInfo: IlxGenIntraAssemblyInfo option, - isInteractive, - g, - ilTyForProperty, - vspec: Val, - nm, - m, - cloc, - ilTy, - ilGetterMethRef - ) = + (optIntraAssemblyInfo: IlxGenIntraAssemblyInfo option, isInteractive, g, ilTyForProperty, vspec: Val, nm, m, cloc, ilTy, ilGetterMethRef) = assert vspec.IsCompiledAsTopLevel let generate () = @@ -1615,14 +1604,8 @@ let IsFSharpValCompiledAsMethod g (v: Val) = /// method (possibly and instance method). Otherwise it gets represented as a /// static field and property. let ComputeStorageForValWithValReprInfo - ( - cenv, - optIntraAssemblyInfo: IlxGenIntraAssemblyInfo option, - isInteractive, - optShadowLocal, - vref: ValRef, - cloc - ) = + (cenv, optIntraAssemblyInfo: IlxGenIntraAssemblyInfo option, isInteractive, optShadowLocal, vref: ValRef, cloc) + = if isUnitTy cenv.g vref.Type @@ -2420,9 +2403,7 @@ and AssemblyBuilder(cenv: cenv, anonTypeTable: AnonTypeGenerationTable) as mgbuf anonTypeTable.GrabExtraBindingsToGenerate() member _.AddTypeDef(tref: ILTypeRef, tdef, eliminateIfEmpty, addAtEnd, tdefDiscards) = - gtdefs - .FindNestedTypeDefsBuilder(tref.Enclosing) - .AddTypeDef(tdef, eliminateIfEmpty, addAtEnd, tdefDiscards) + gtdefs.FindNestedTypeDefsBuilder(tref.Enclosing).AddTypeDef(tdef, eliminateIfEmpty, addAtEnd, tdefDiscards) member _.FindNestedTypeDefBuilder(tref: ILTypeRef) = gtdefs.FindNestedTypeDefBuilder(tref) @@ -5676,32 +5657,14 @@ and GenGenericParam cenv eenv (tp: Typar) = |> List.map (GenTypeAux cenv tp.Range eenv.tyenv VoidNotOK PtrTypesNotOK) let refTypeConstraint = - tp.Constraints - |> List.exists (function - | TyparConstraint.IsReferenceType _ - // 'null' automatically implies 'not struct' - | TyparConstraint.SupportsNull _ -> true - | _ -> false) + tp |> HasConstraint(fun tc -> tc.IsIsReferenceType || tc.IsSupportsNull) // `null` implies not struct - let notNullableValueTypeConstraint = - tp.Constraints - |> List.exists (function - | TyparConstraint.IsNonNullableStruct _ -> true - | _ -> false) + let notNullableValueTypeConstraint = tp |> HasConstraint _.IsIsNonNullableStruct 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) + let hasNotSupportsNull = tp |> HasConstraint _.IsNotSupportsNull + let hasSupportsNull () = tp |> HasConstraint _.IsSupportsNull if hasNotSupportsNull || notNullableValueTypeConstraint then NullnessInfo.WithoutNull @@ -5714,17 +5677,11 @@ and GenGenericParam cenv eenv (tp: Typar) = None let defaultConstructorConstraint = - tp.Constraints - |> List.exists (function - | TyparConstraint.RequiresDefaultConstructor _ -> true - | _ -> false) + tp |> HasConstraint _.IsRequiresDefaultConstructor let emitUnmanagedInIlOutput = cenv.g.langVersion.SupportsFeature(LanguageFeature.UnmanagedConstraintCsharpInterop) - && tp.Constraints - |> List.exists (function - | TyparConstraint.IsUnmanaged _ -> true - | _ -> false) + && tp |> HasConstraint _.IsIsUnmanaged let tpName = // use the CompiledName if given @@ -5960,11 +5917,7 @@ and renameMethodDef nameOfOverridingMethod (mdef: ILMethodDef) = mdef.With(name = nameOfOverridingMethod) and fixupMethodImplFlags (mdef: ILMethodDef) = - mdef - .WithAccess(ILMemberAccess.Private) - .WithHideBySig() - .WithFinal(true) - .WithNewSlot + mdef.WithAccess(ILMemberAccess.Private).WithHideBySig().WithFinal(true).WithNewSlot and fixupStaticAbstractSlotFlags (mdef: ILMethodDef) = mdef.WithHideBySig(true) @@ -6488,15 +6441,17 @@ and GenSequenceExpr cenv (cgbuf: CodeGenBuffer) eenvouter - (nextEnumeratorValRef: ValRef, - pcvref: ValRef, - currvref: ValRef, - stateVars, - generateNextExpr, - closeExpr, - checkCloseExpr: Expr, - seqElemTy, - m) + ( + nextEnumeratorValRef: ValRef, + pcvref: ValRef, + currvref: ValRef, + stateVars, + generateNextExpr, + closeExpr, + checkCloseExpr: Expr, + seqElemTy, + m + ) sequel = @@ -6637,8 +6592,7 @@ and GenSequenceExpr |> AddNonUserCompilerGeneratedAttribs g let ilCtorBody = - mkILSimpleStorageCtor(Some ilCloBaseTy.TypeSpec, ilCloTyInner, [], [], ILMemberAccess.Assembly, None, eenvouter.imports) - .MethodBody + mkILSimpleStorageCtor(Some ilCloBaseTy.TypeSpec, ilCloTyInner, [], [], ILMemberAccess.Assembly, None, eenvouter.imports).MethodBody let cloMethods = [ @@ -6684,18 +6638,19 @@ and GenSequenceExpr /// Generate the class for a closure type definition and GenClosureTypeDefs cenv - (tref: ILTypeRef, - ilGenParams, - attrs, - ilCloAllFreeVars, - ilCloLambdas, - ilCtorBody, - mdefs, - mimpls, - ext, - ilIntfTys, - cloSpec: IlxClosureSpec option) - = + ( + tref: ILTypeRef, + ilGenParams, + attrs, + ilCloAllFreeVars, + ilCloLambdas, + ilCtorBody, + mdefs, + mimpls, + ext, + ilIntfTys, + cloSpec: IlxClosureSpec option + ) = let g = cenv.g let cloInfo = @@ -6723,8 +6678,7 @@ and GenClosureTypeDefs let cctor = mkILClassCtor (MethodBody.IL(notlazy ilCode)) let ilFieldDef = - mkILStaticField(fspec.Name, fspec.FormalType, None, None, ILMemberAccess.Assembly) - .WithInitOnly(true) + mkILStaticField(fspec.Name, fspec.FormalType, None, None, ILMemberAccess.Assembly).WithInitOnly(true) (cctor :: mdefs), [ ilFieldDef ] else @@ -6778,9 +6732,7 @@ and GenStaticDelegateClosureTypeDefs // Remove the redundant constructor. tdefs |> List.map (fun td -> - td - .WithAbstract(true) - .With(methods = mkILMethodsFromArray (td.Methods.AsArray() |> Array.filter (fun m -> not m.IsConstructor)))) + td.WithAbstract(true).With(methods = mkILMethodsFromArray (td.Methods.AsArray() |> Array.filter (fun m -> not m.IsConstructor)))) and GenGenericParams cenv eenv tps = tps |> DropErasedTypars |> List.map (GenGenericParam cenv eenv) @@ -8588,8 +8540,7 @@ and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt = let ilMethodBody = MethodBody.IL(ilLazyCode) - (mkILStaticMethod ([], ilGetterMethSpec.Name, access, [], mkILReturn ilTy, ilMethodBody)) - .WithSpecialName + (mkILStaticMethod ([], ilGetterMethSpec.Name, access, [], mkILReturn ilTy, ilMethodBody)).WithSpecialName |> AddNonUserCompilerGeneratedAttribs g CountMethodDef() @@ -8766,8 +8717,7 @@ and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt = let body = mkMethodBody (true, [], 2, nonBranchingInstrsToCode [ mkNormalLdsfld fspec ], None, eenv.imports) - mkILStaticMethod([], ilGetterMethRef.Name, access, [], mkILReturn fty, body) - .WithSpecialName + mkILStaticMethod([], ilGetterMethRef.Name, access, [], mkILReturn fty, body).WithSpecialName cgbuf.mgbuf.AddMethodDef(ilTypeRefForProperty, getterMethod) @@ -9197,26 +9147,27 @@ and GenMethodForBinding cenv mgbuf eenv - (v: Val, - mspec, - hasWitnessEntry, - generateWitnessArgs, - access, - ctps, - mtps, - witnessInfos, - curriedArgInfos, - paramInfos, - argTys, - retInfo, - valReprInfo, - ctorThisValOpt, - baseValOpt, - methLambdaTypars, - methLambdaVars, - methLambdaBody, - returnTy) - = + ( + v: Val, + mspec, + hasWitnessEntry, + generateWitnessArgs, + access, + ctps, + mtps, + witnessInfos, + curriedArgInfos, + paramInfos, + argTys, + retInfo, + valReprInfo, + ctorThisValOpt, + baseValOpt, + methLambdaTypars, + methLambdaVars, + methLambdaBody, + returnTy + ) = let g = cenv.g let m = v.Range @@ -10205,18 +10156,8 @@ and CreatePermissionSets cenv eenv (securityAttributes: Attrib list) = /// Generate a static class at the given cloc and GenTypeDefForCompLoc - ( - cenv, - eenv, - mgbuf: AssemblyBuilder, - cloc, - hidden, - accessibility: Accessibility, - attribs, - initTrigger, - eliminateIfEmpty, - addAtEnd - ) = + (cenv, eenv, mgbuf: AssemblyBuilder, cloc, hidden, accessibility: Accessibility, attribs, initTrigger, eliminateIfEmpty, addAtEnd) + = let g = cenv.g let tref = TypeRefForCompLoc cloc @@ -10298,8 +10239,7 @@ and CodeGenInitMethod cenv (cgbuf: CodeGenBuffer) eenv tref (codeGenInitFunc: Co let ilReturn = mkILReturn ILType.Void let method = - (mkILNonGenericStaticMethod (eenv.staticInitializationName, access, [], ilReturn, ilBody)) - .WithSpecialName + (mkILNonGenericStaticMethod (eenv.staticInitializationName, access, [], ilReturn, ilBody)).WithSpecialName cgbuf.mgbuf.AddMethodDef(tref, method) CountMethodDef() @@ -12232,14 +12172,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 MaybeNull) + (!!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) @@ -12252,7 +12192,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) @@ -12279,14 +12219,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 2583e93fe79..0799dbde60a 100644 --- a/src/Compiler/CodeGen/IlxGenSupport.fs +++ b/src/Compiler/CodeGen/IlxGenSupport.fs @@ -83,12 +83,8 @@ let getFieldMemberAccess = | EncapsulatedProperties -> ILMemberAccess.Private let mkLocalPrivateAttributeWithPropertyConstructors - ( - g: TcGlobals, - name: string, - attrProperties: (string * ILType) list option, - codegenStyle: AttrDataGenerationStyle - ) = + (g: TcGlobals, name: string, attrProperties: (string * ILType) list option, codegenStyle: AttrDataGenerationStyle) + = let ilTypeRef = mkILTyRef (ILScopeRef.Local, name) let ilTy = mkILFormalNamedTy ILBoxity.AsObject ilTypeRef [] @@ -227,8 +223,7 @@ let mkLocalPrivateInt32Enum (g: TcGlobals, tref: ILTypeRef, values: (string * in |> Array.map (fun (name, value) -> mkILStaticLiteralField (name, ilType, ILFieldInit.Int32 value, None, ILMemberAccess.Public)) |> Array.append [| - (mkILInstanceField ("value__", g.ilg.typ_Int32, None, ILMemberAccess.Public)) - .WithSpecialName(true) + (mkILInstanceField ("value__", g.ilg.typ_Int32, None, ILMemberAccess.Public)).WithSpecialName(true) |] |> Array.toList @@ -290,9 +285,7 @@ let GetDynamicallyAccessedMemberTypes (g: TcGlobals) = ("Interfaces", 8192) |] - (mkLocalPrivateInt32Enum (g, tref, values)) - .WithSerializable(true) - .WithSealed(true)) + (mkLocalPrivateInt32Enum (g, tref, values)).WithSerializable(true).WithSealed(true)) ) ILType.Value(mkILNonGenericTySpec (tref)) diff --git a/src/Compiler/DependencyManager/AssemblyResolveHandler.fs b/src/Compiler/DependencyManager/AssemblyResolveHandler.fs index 1f20caa392e..75f8797341d 100644 --- a/src/Compiler/DependencyManager/AssemblyResolveHandler.fs +++ b/src/Compiler/DependencyManager/AssemblyResolveHandler.fs @@ -15,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 prop = - (!! loadContextType.GetProperty("Default", BindingFlags.Static ||| BindingFlags.Public)) - .GetValue(null, null) + (!!loadContextType.GetProperty("Default", BindingFlags.Static ||| BindingFlags.Public)).GetValue(null, null) del, prop @@ -41,7 +40,7 @@ type AssemblyResolveHandlerCoreclr(assemblyProbingPaths: AssemblyResolutionProbe member _.ResolveAssemblyNetStandard (ctxt: 'T) (assemblyName: AssemblyName) : Assembly = let loadAssembly path = - !! loadFromAssemblyPathMethod.Invoke(ctxt, [| path |]) :?> Assembly + !!loadFromAssemblyPathMethod.Invoke(ctxt, [| path |]) :?> Assembly let assemblyPaths = match assemblyProbingPaths with diff --git a/src/Compiler/DependencyManager/NativeDllResolveHandler.fs b/src/Compiler/DependencyManager/NativeDllResolveHandler.fs index 3c6bbe0a900..058dbedd0b7 100644 --- a/src/Compiler/DependencyManager/NativeDllResolveHandler.fs +++ b/src/Compiler/DependencyManager/NativeDllResolveHandler.fs @@ -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)) - .GetValue(null, null) + (!!assemblyLoadContextType.GetProperty("Default", BindingFlags.Static ||| BindingFlags.Public)).GetValue(null, null) do eventInfo.AddEventHandler(defaultAssemblyLoadContext, handler) diff --git a/src/Compiler/Driver/CompilerConfig.fs b/src/Compiler/Driver/CompilerConfig.fs index cf875be4959..cccbcb15810 100644 --- a/src/Compiler/Driver/CompilerConfig.fs +++ b/src/Compiler/Driver/CompilerConfig.fs @@ -218,7 +218,7 @@ 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 @@ -680,7 +680,7 @@ type TcConfigBuilder = yield! (tcConfigB.referencedDLLs - |> Seq.map (fun ref -> !! Path.GetDirectoryName(ref.Text))) + |> Seq.map (fun ref -> !!Path.GetDirectoryName(ref.Text))) tcConfigB.implicitIncludeDir } @@ -1203,7 +1203,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 @@ -1504,7 +1504,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/CompilerDiagnostics.fs b/src/Compiler/Driver/CompilerDiagnostics.fs index 7124c5ce1ac..9eb56d1cc54 100644 --- a/src/Compiler/Driver/CompilerDiagnostics.fs +++ b/src/Compiler/Driver/CompilerDiagnostics.fs @@ -721,10 +721,7 @@ type Exception with os.AppendString(SeeAlsoE().Format(stringOfRange m2)) | ConstraintSolverMissingConstraint(denv, tpr, tpc, m, m2) -> - os.AppendString( - ConstraintSolverMissingConstraintE() - .Format(NicePrint.stringOfTyparConstraint denv (tpr, tpc)) - ) + os.AppendString(ConstraintSolverMissingConstraintE().Format(NicePrint.stringOfTyparConstraint denv (tpr, tpc))) if m.StartLine <> m2.StartLine then os.AppendString(SeeAlsoE().Format(stringOfRange m)) @@ -1525,10 +1522,7 @@ type Exception with foundInContext |> ignore // suppress unused variable warning in RELEASE #endif let fix (s: string) = - s - .Replace(SR.GetString("FixKeyword"), "") - .Replace(SR.GetString("FixSymbol"), "") - .Replace(SR.GetString("FixReplace"), "") + s.Replace(SR.GetString("FixKeyword"), "").Replace(SR.GetString("FixSymbol"), "").Replace(SR.GetString("FixReplace"), "") let tokenNames = ctxt.ShiftTokens diff --git a/src/Compiler/Driver/CompilerOptions.fs b/src/Compiler/Driver/CompilerOptions.fs index 7c4c81efd40..cdeda6b6566 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 @@ -701,7 +701,7 @@ let SetEmbedAllSourceSwitch (tcConfigB: TcConfigBuilder) switch = tcConfigB.embedAllSource <- false let setOutFileName tcConfigB (path: string) = - let outputDir = !! Path.GetDirectoryName(path) + let outputDir = !!Path.GetDirectoryName(path) tcConfigB.outputDir <- Some outputDir tcConfigB.outputFile <- Some path diff --git a/src/Compiler/Driver/CreateILModule.fs b/src/Compiler/Driver/CreateILModule.fs index 5ed836631d7..6c7dfeb31b6 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 dfeff2cabf3..5f55f6abe97 100644 --- a/src/Compiler/Driver/FxResolver.fs +++ b/src/Compiler/Driver/FxResolver.fs @@ -98,13 +98,9 @@ type internal FxResolver p.WaitForExit() #if DEBUG if workingDir.IsSome then - FileSystem - .OpenFileForWriteShim(Path.Combine(workingDir.Value, "StandardOutput.txt")) - .WriteAllLines(outputList) + FileSystem.OpenFileForWriteShim(Path.Combine(workingDir.Value, "StandardOutput.txt")).WriteAllLines(outputList) - FileSystem - .OpenFileForWriteShim(Path.Combine(workingDir.Value, "StandardError.txt")) - .WriteAllLines(errorsList) + FileSystem.OpenFileForWriteShim(Path.Combine(workingDir.Value, "StandardError.txt")).WriteAllLines(errorsList) #endif p.ExitCode, outputList.ToArray(), errorsList.ToArray() else @@ -284,10 +280,7 @@ 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 = @@ -498,7 +491,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 diff --git a/src/Compiler/Driver/OptimizeInputs.fs b/src/Compiler/Driver/OptimizeInputs.fs index 36eae5734ce..c79af5b33bc 100644 --- a/src/Compiler/Driver/OptimizeInputs.fs +++ b/src/Compiler/Driver/OptimizeInputs.fs @@ -28,9 +28,7 @@ let PrintWholeAssemblyImplementation (tcConfig: TcConfig) outfile header expr = let fileName = outfile + ".terms" use f = - FileSystem - .OpenFileForWriteShim(fileName + "-" + string showTermFileCount + "-" + header, FileMode.Create) - .GetWriter() + FileSystem.OpenFileForWriteShim(fileName + "-" + string showTermFileCount + "-" + header, FileMode.Create).GetWriter() showTermFileCount <- showTermFileCount + 1 LayoutRender.outL f (Display.squashTo 192 (DebugPrint.implFilesL expr)) @@ -306,17 +304,8 @@ let optimizeFilesSequentially optEnv (phases: PhaseInfo[]) implFiles = results, optEnvFirstLoop let ApplyAllOptimizations - ( - tcConfig: TcConfig, - tcGlobals, - tcVal, - outfile, - importMap, - isIncrementalFragment, - optEnv, - ccu: CcuThunk, - implFiles - ) = + (tcConfig: TcConfig, tcGlobals, tcVal, outfile, importMap, isIncrementalFragment, optEnv, ccu: CcuThunk, implFiles) + = // NOTE: optEnv - threads through // // Always optimize once - the results of this step give the x-module optimization @@ -562,15 +551,7 @@ let CreateIlxAssemblyGenerator (_tcConfig: TcConfig, tcImports: TcImports, tcGlo ilxGenerator let GenerateIlxCode - ( - ilxBackend, - isInteractiveItExpr, - tcConfig: TcConfig, - topAttrs: TopAttribs, - optimizedImpls, - fragName, - ilxGenerator: IlxAssemblyGenerator - ) = + (ilxBackend, isInteractiveItExpr, tcConfig: TcConfig, topAttrs: TopAttribs, optimizedImpls, fragName, ilxGenerator: IlxAssemblyGenerator) = let mainMethodInfo = if diff --git a/src/Compiler/Driver/ParseAndCheckInputs.fs b/src/Compiler/Driver/ParseAndCheckInputs.fs index 975bfeef66f..6b7171b5697 100644 --- a/src/Compiler/Driver/ParseAndCheckInputs.fs +++ b/src/Compiler/Driver/ParseAndCheckInputs.fs @@ -352,7 +352,7 @@ type ModuleNamesDict = Map> /// Checks if a module name is already given and deduplicates the name if needed. let DeduplicateModuleName (moduleNamesDict: ModuleNamesDict) (fileName: string) (qualNameOfFile: QualifiedNameOfFile) = - let path = !! Path.GetDirectoryName(fileName) + let path = !!Path.GetDirectoryName(fileName) let path = if FileSystem.IsPathRootedShim path then @@ -433,7 +433,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 "" |] @@ -703,15 +703,8 @@ let checkInputFile (tcConfig: TcConfig) fileName = error (Error(FSComp.SR.buildInvalidSourceFileExtension (SanitizeFileName fileName tcConfig.implicitIncludeDir), rangeStartup)) let parseInputStreamAux - ( - tcConfig: TcConfig, - lexResourceManager, - fileName, - isLastCompiland, - diagnosticsLogger, - retryLocked, - stream: Stream - ) = + (tcConfig: TcConfig, lexResourceManager, fileName, isLastCompiland, diagnosticsLogger, retryLocked, stream: Stream) + = use reader = stream.GetReader(tcConfig.inputCodePage, retryLocked) // Set up the LexBuffer for the file @@ -722,14 +715,8 @@ let parseInputStreamAux ParseOneInputLexbuf(tcConfig, lexResourceManager, lexbuf, fileName, isLastCompiland, diagnosticsLogger) let parseInputSourceTextAux - ( - tcConfig: TcConfig, - lexResourceManager, - fileName, - isLastCompiland, - diagnosticsLogger, - sourceText: ISourceText - ) = + (tcConfig: TcConfig, lexResourceManager, fileName, isLastCompiland, diagnosticsLogger, sourceText: ISourceText) + = // Set up the LexBuffer for the file let lexbuf = UnicodeLexing.SourceTextAsLexbuf(not tcConfig.compilingFSharpCore, tcConfig.langVersion, tcConfig.strictIndentation, sourceText) @@ -751,15 +738,8 @@ let parseInputFileAux (tcConfig: TcConfig, lexResourceManager, fileName, isLastC /// Parse an input from stream let ParseOneInputStream - ( - tcConfig: TcConfig, - lexResourceManager, - fileName, - isLastCompiland, - diagnosticsLogger, - retryLocked, - stream: Stream - ) = + (tcConfig: TcConfig, lexResourceManager, fileName, isLastCompiland, diagnosticsLogger, retryLocked, stream: Stream) + = try parseInputStreamAux (tcConfig, lexResourceManager, fileName, isLastCompiland, diagnosticsLogger, retryLocked, stream) with RecoverableException exn -> @@ -768,14 +748,8 @@ let ParseOneInputStream /// Parse an input from source text let ParseOneInputSourceText - ( - tcConfig: TcConfig, - lexResourceManager, - fileName, - isLastCompiland, - diagnosticsLogger, - sourceText: ISourceText - ) = + (tcConfig: TcConfig, lexResourceManager, fileName, isLastCompiland, diagnosticsLogger, sourceText: ISourceText) + = try parseInputSourceTextAux (tcConfig, lexResourceManager, fileName, isLastCompiland, diagnosticsLogger, sourceText) with RecoverableException exn -> @@ -862,9 +836,11 @@ let ParseInputFiles (tcConfig: TcConfig, lexResourceManager, sourceFiles, diagno tcConfig.exiter.Exit 1 let ProcessMetaCommandsFromInput - (nowarnF: 'state -> range * string -> 'state, - hashReferenceF: 'state -> range * string * Directive -> 'state, - loadSourceF: 'state -> range * string -> unit) + ( + nowarnF: 'state -> range * string -> 'state, + hashReferenceF: 'state -> range * string * Directive -> 'state, + loadSourceF: 'state -> range * string -> unit + ) (tcConfig: TcConfigBuilder, inp: ParsedInput, pathOfMetaCommandSource, state0) = @@ -1520,16 +1496,18 @@ type NodeToTypeCheck = /// a callback functions that takes a `TcState` and will add the checked result to it. let CheckOneInputWithCallback (node: NodeToTypeCheck) - ((checkForErrors, - tcConfig: TcConfig, - tcImports: TcImports, - tcGlobals, - prefixPathOpt, - tcSink, - tcState: TcState, - input: ParsedInput, - _skipImplIfSigExists: bool): - (unit -> bool) * TcConfig * TcImports * TcGlobals * LongIdent option * TcResultsSink * TcState * ParsedInput * bool) + ( + (checkForErrors, + tcConfig: TcConfig, + tcImports: TcImports, + tcGlobals, + prefixPathOpt, + tcSink, + tcState: TcState, + input: ParsedInput, + _skipImplIfSigExists: bool): + (unit -> bool) * TcConfig * TcImports * TcGlobals * LongIdent option * TcResultsSink * TcState * ParsedInput * bool + ) : Cancellable> = cancellable { try @@ -1823,16 +1801,18 @@ let TransformDependencyGraph (graph: Graph, filePairs: FilePairMap) = /// Constructs a file dependency graph and type-checks the files in parallel where possible. let CheckMultipleInputsUsingGraphMode - ((ctok, checkForErrors, tcConfig: TcConfig, tcImports: TcImports, tcGlobals, prefixPathOpt, tcState, eagerFormat, inputs): - 'a * - (unit -> bool) * - TcConfig * - TcImports * - TcGlobals * - LongIdent option * - TcState * - (PhasedDiagnostic -> PhasedDiagnostic) * - ParsedInput list) + ( + (ctok, checkForErrors, tcConfig: TcConfig, tcImports: TcImports, tcGlobals, prefixPathOpt, tcState, eagerFormat, inputs): + 'a * + (unit -> bool) * + TcConfig * + TcImports * + TcGlobals * + LongIdent option * + TcState * + (PhasedDiagnostic -> PhasedDiagnostic) * + ParsedInput list + ) : FinalFileResult list * TcState = use cts = new CancellationTokenSource() @@ -1864,9 +1844,7 @@ let CheckMultipleInputsUsingGraphMode graph |> Graph.map (fun idx -> let friendlyFileName = - sourceFiles[idx] - .FileName.Replace(tcConfig.implicitIncludeDir, "") - .TrimStart([| '\\'; '/' |]) + sourceFiles[idx].FileName.Replace(tcConfig.implicitIncludeDir, "").TrimStart([| '\\'; '/' |]) (idx, friendlyFileName)) |> Graph.writeMermaidToFile graphFile) diff --git a/src/Compiler/Driver/ScriptClosure.fs b/src/Compiler/Driver/ScriptClosure.fs index 0e22231abb8..b97b11a8054 100644 --- a/src/Compiler/Driver/ScriptClosure.fs +++ b/src/Compiler/Driver/ScriptClosure.fs @@ -45,6 +45,9 @@ type LoadClosure = /// The resolved package references along with the ranges of the #r positions in each file. PackageReferences: (range * string list)[] + /// The raw package manager lines in the script + PackageManagerLines: Map + /// Whether we're decided to use .NET Framework analysis for this script UseDesktopFramework: bool @@ -82,7 +85,8 @@ type CodeContext = module ScriptPreprocessClosure = /// Represents an input to the closure finding process - type ClosureSource = ClosureSource of fileName: string * referenceRange: range * sourceText: ISourceText * parseRequired: bool + type ClosureSource = + | ClosureSource of fileName: string * referenceRange: range * sourceText: ISourceText * Position option * parseRequired: bool /// Represents an output of the closure finding process type ClosureFile = @@ -159,7 +163,7 @@ module ScriptPreprocessClosure = reduceMemoryUsage ) = - let projectDir = !! Path.GetDirectoryName(fileName) + let projectDir = !!Path.GetDirectoryName(fileName) let isInteractive = (codeContext = CodeContext.CompilationAndEvaluation) let isInvalidationSupported = (codeContext = CodeContext.Editing) @@ -253,18 +257,14 @@ module ScriptPreprocessClosure = | Some(n: int) -> new StreamReader(stream, Encoding.GetEncoding n) let source = reader.ReadToEnd() - [ ClosureSource(fileName, m, SourceText.ofString source, parseRequired) ] + [ ClosureSource(fileName, m, SourceText.ofString source, None, parseRequired) ] with RecoverableException exn -> errorRecovery exn m [] let ApplyMetaCommandsFromInputToTcConfigAndGatherNoWarn - ( - tcConfig: TcConfig, - inp: ParsedInput, - pathOfMetaCommandSource, - dependencyProvider - ) = + (tcConfig: TcConfig, inp: ParsedInput, pathOfMetaCommandSource, dependencyProvider) + = let tcConfigB = tcConfig.CloneToBuilder() let mutable nowarns = [] @@ -313,16 +313,25 @@ module ScriptPreprocessClosure = let packageReferences = Dictionary(HashIdentity.Structural) // Resolve the packages - let rec resolveDependencyManagerSources scriptName = + let rec resolveDependencyManagerSources scriptName (caret: Position option) = + let caretLine = + match caret with + | None -> Int32.MinValue + | Some pos -> pos.Line + + let isEditorCursorInPackageLines (line: PackageManagerLine) = + caretLine >= line.Range.StartLine && caretLine <= line.Range.EndLine + [ if not (loadScripts.Contains scriptName) then for kv in tcConfig.packageManagerLines do let packageManagerKey, packageManagerLines = kv.Key, kv.Value - match packageManagerLines with + match packageManagerLines |> List.filter (not << isEditorCursorInPackageLines) with | [] -> () | packageManagerLine :: _ -> let m = packageManagerLine.Range + let packageManagerLines = packageManagerLines yield! processPackageManagerLines m packageManagerLines scriptName packageManagerKey ] @@ -426,7 +435,7 @@ module ScriptPreprocessClosure = let scriptText = stream.ReadAllText() loadScripts.Add script |> ignore let iSourceText = SourceText.ofString scriptText - yield! processClosureSource (ClosureSource(script, m, iSourceText, true)) + yield! processClosureSource (ClosureSource(script, m, iSourceText, None, true)) else // Send outputs via diagnostics @@ -443,7 +452,7 @@ module ScriptPreprocessClosure = tcConfig <- TcConfig.Create(tcConfigB, validate = false) ] - and processClosureSource (ClosureSource(fileName, m, sourceText, parseRequired)) = + and processClosureSource (ClosureSource(fileName, m, sourceText, caret, parseRequired)) = [ if not (observedSources.HaveSeen(fileName)) then observedSources.SetSeen(fileName) @@ -460,7 +469,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 = @@ -473,7 +482,7 @@ module ScriptPreprocessClosure = tcConfig <- tcConfigResult // We accumulate the tcConfig in order to collect assembly references - yield! resolveDependencyManagerSources fileName + yield! resolveDependencyManagerSources fileName caret let postSources = tcConfig.GetAvailableLoadedSources() @@ -483,7 +492,7 @@ module ScriptPreprocessClosure = else [] - yield! resolveDependencyManagerSources fileName + yield! resolveDependencyManagerSources fileName caret for m, subFile in sources do if IsScript subFile then @@ -540,7 +549,7 @@ module ScriptPreprocessClosure = | _ -> lastClosureFile /// Reduce the full directive closure into LoadClosure - let GetLoadClosure (rootFilename, closureFiles, tcConfig: TcConfig, codeContext, packageReferences, earlierDiagnostics) = + let GetLoadClosure (rootFilename, closureFiles, tcConfig: TcConfig, codeContext, packageReferences, earlierDiagnostics) : LoadClosure = // Mark the last file as isLastCompiland. let closureFiles = @@ -612,23 +621,21 @@ module ScriptPreprocessClosure = // Filter out non-root errors and warnings let allRootDiagnostics = allRootDiagnostics |> List.filter (fst >> isRootRange) - let result: LoadClosure = - { - SourceFiles = List.groupBy fst sourceFiles |> List.map (map2Of2 (List.map snd)) - References = List.groupBy fst references |> List.map (map2Of2 (List.map snd)) - PackageReferences = packageReferences - UseDesktopFramework = (tcConfig.primaryAssembly = PrimaryAssembly.Mscorlib) - SdkDirOverride = tcConfig.sdkDirOverride - UnresolvedReferences = unresolvedReferences - Inputs = sourceInputs - NoWarns = List.groupBy fst globalNoWarns |> List.map (map2Of2 (List.map snd)) - OriginalLoadReferences = tcConfig.loadedSources - ResolutionDiagnostics = resolutionDiagnostics - AllRootFileDiagnostics = allRootDiagnostics - LoadClosureRootFileDiagnostics = loadClosureRootDiagnostics - } - - result + { + SourceFiles = List.groupBy fst sourceFiles |> List.map (map2Of2 (List.map snd)) + References = List.groupBy fst references |> List.map (map2Of2 (List.map snd)) + PackageReferences = packageReferences + PackageManagerLines = tcConfig.packageManagerLines + UseDesktopFramework = (tcConfig.primaryAssembly = PrimaryAssembly.Mscorlib) + SdkDirOverride = tcConfig.sdkDirOverride + UnresolvedReferences = unresolvedReferences + Inputs = sourceInputs + NoWarns = List.groupBy fst globalNoWarns |> List.map (map2Of2 (List.map snd)) + OriginalLoadReferences = tcConfig.loadedSources + ResolutionDiagnostics = resolutionDiagnostics + AllRootFileDiagnostics = allRootDiagnostics + LoadClosureRootFileDiagnostics = loadClosureRootDiagnostics + } /// Given source text, find the full load closure. Used from service.fs, when editing a script file let GetFullClosureOfScriptText @@ -637,6 +644,7 @@ module ScriptPreprocessClosure = defaultFSharpBinariesDir, fileName, sourceText, + caret, codeContext, useSimpleResolution, useFsiAuxLib, @@ -649,7 +657,6 @@ module ScriptPreprocessClosure = reduceMemoryUsage, dependencyProvider ) = - // Resolve the basic references such as FSharp.Core.dll first, before processing any #I directives in the script // // This is tries to mimic the action of running the script in F# Interactive - the initial context for scripting is created @@ -700,7 +707,7 @@ module ScriptPreprocessClosure = reduceMemoryUsage ) - let closureSources = [ ClosureSource(fileName, range0, sourceText, true) ] + let closureSources = [ ClosureSource(fileName, range0, sourceText, caret, true) ] let closureFiles, tcConfig, packageReferences = FindClosureFiles(fileName, closureSources, tcConfig, codeContext, lexResourceManager, dependencyProvider) @@ -710,13 +717,8 @@ module ScriptPreprocessClosure = /// Given source file fileName, find the full load closure /// Used from fsi.fs and fsc.fs, for #load and command line let GetFullClosureOfScriptFiles - ( - tcConfig: TcConfig, - files: (string * range) list, - codeContext, - lexResourceManager: Lexhelp.LexResourceManager, - dependencyProvider - ) = + (tcConfig: TcConfig, files: (string * range) list, codeContext, lexResourceManager: Lexhelp.LexResourceManager, dependencyProvider) + = let mainFile, _mainFileRange = List.last files @@ -742,6 +744,7 @@ type LoadClosure with defaultFSharpBinariesDir, fileName: string, sourceText: ISourceText, + caret: Position option, implicitDefines, useSimpleResolution: bool, useFsiAuxLib, @@ -762,6 +765,7 @@ type LoadClosure with defaultFSharpBinariesDir, fileName, sourceText, + caret, implicitDefines, useSimpleResolution, useFsiAuxLib, diff --git a/src/Compiler/Driver/ScriptClosure.fsi b/src/Compiler/Driver/ScriptClosure.fsi index 6f764b299a9..249885036cd 100644 --- a/src/Compiler/Driver/ScriptClosure.fsi +++ b/src/Compiler/Driver/ScriptClosure.fsi @@ -42,6 +42,9 @@ type LoadClosure = /// The resolved package references along with the ranges of the #r positions in each file. PackageReferences: (range * string list)[] + /// The raw package manager lines in the script + PackageManagerLines: Map + /// Whether we're decided to use .NET Framework analysis for this script UseDesktopFramework: bool @@ -80,6 +83,7 @@ type LoadClosure = defaultFSharpBinariesDir: string * fileName: string * sourceText: ISourceText * + caret: Position option * implicitDefines: CodeContext * useSimpleResolution: bool * useFsiAuxLib: bool * diff --git a/src/Compiler/Driver/StaticLinking.fs b/src/Compiler/Driver/StaticLinking.fs index 53916744622..3624ecef9b2 100644 --- a/src/Compiler/Driver/StaticLinking.fs +++ b/src/Compiler/Driver/StaticLinking.fs @@ -104,13 +104,8 @@ let debugStaticLinking = isEnvVarSet "FSHARP_DEBUG_STATIC_LINKING" #endif let StaticLinkILModules - ( - tcConfig: TcConfig, - ilGlobals, - tcImports, - ilxMainModule, - dependentILModules: (CcuThunk option * ILModuleDef) list - ) = + (tcConfig: TcConfig, ilGlobals, tcImports, ilxMainModule, dependentILModules: (CcuThunk option * ILModuleDef) list) + = if isNil dependentILModules then ilxMainModule, id else diff --git a/src/Compiler/Driver/fsc.fs b/src/Compiler/Driver/fsc.fs index 0e26f2db4ac..3518d9d4884 100644 --- a/src/Compiler/Driver/fsc.fs +++ b/src/Compiler/Driver/fsc.fs @@ -139,18 +139,8 @@ let AbortOnError (diagnosticsLogger: DiagnosticsLogger, exiter: Exiter) = exiter.Exit 1 let TypeCheck - ( - ctok, - tcConfig, - tcImports, - tcGlobals, - diagnosticsLogger: DiagnosticsLogger, - assemblyName, - tcEnv0, - openDecls0, - inputs, - exiter: Exiter - ) = + (ctok, tcConfig, tcImports, tcGlobals, diagnosticsLogger: DiagnosticsLogger, assemblyName, tcEnv0, openDecls0, inputs, exiter: Exiter) + = try if isNil inputs then error (Error(FSComp.SR.fscNoImplementationFiles (), rangeStartup)) @@ -346,9 +336,7 @@ module InterfaceFileWriter = if String.IsNullOrEmpty(tcConfig.printSignatureFile) then Console.Out else - FileSystem - .OpenFileForWriteShim(tcConfig.printSignatureFile, FileMode.Create) - .GetWriter() + FileSystem.OpenFileForWriteShim(tcConfig.printSignatureFile, FileMode.Create).GetWriter() writeHeader tcConfig.printSignatureFile os @@ -367,7 +355,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() @@ -388,7 +376,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) @@ -408,7 +396,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) diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index eedaecbb9be..9bfa12ce963 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -324,6 +324,8 @@ csMethodFoundButIsStatic,"The type '%s' has a method '%s' (full name '%s'), but csMethodFoundButIsNotStatic,"The type '%s' has a method '%s' (full name '%s'), but the method is not static" 472,csStructConstraintInconsistent,"The constraints 'struct' and 'not struct' are inconsistent" 473,csUnmanagedConstraintInconsistent,"The constraints 'unmanaged' and 'not struct' are inconsistent" +474,csComparisonDelegateConstraintInconsistent,"The constraints 'comparison' and 'delegate' are inconsistent" +475,csNullStructConstraintInconsistent,"The constraints 'struct' and 'null' are inconsistent" csTypeDoesNotHaveNull,"The type '%s' does not have 'null' as a proper value" csNullableTypeDoesNotHaveNull,"The type '%s' does not have 'null' as a proper value. To create a null value for a Nullable type use 'System.Nullable()'." csTypeDoesNotSupportComparison1,"The type '%s' does not support the 'comparison' constraint because it has the 'NoComparison' attribute" diff --git a/src/Compiler/Facilities/CompilerLocation.fs b/src/Compiler/Facilities/CompilerLocation.fs index 2e9137fc75d..7d902aefc27 100644 --- a/src/Compiler/Facilities/CompilerLocation.fs +++ b/src/Compiler/Facilities/CompilerLocation.fs @@ -14,9 +14,7 @@ open Internal.Utilities.Library module internal FSharpEnvironment = - type private TypeInThisAssembly = - class - end + type private TypeInThisAssembly = class end /// The F# version reported in the banner let FSharpBannerVersion = @@ -90,7 +88,7 @@ module internal FSharpEnvironment = let fallback () = let d = Assembly.GetExecutingAssembly() - Some(!! Path.GetDirectoryName(d.Location)) + Some(!!Path.GetDirectoryName(d.Location)) match tryCurrentDomain () with | None -> fallback () @@ -171,12 +169,8 @@ module internal FSharpEnvironment = } let getTypeProviderAssembly - ( - runTimeAssemblyFileName: string, - designTimeAssemblyName: string, - compilerToolPaths: string list, - raiseError - ) = + (runTimeAssemblyFileName: string, designTimeAssemblyName: string, compilerToolPaths: string list, raiseError) + = // Find and load the designer assembly for the type provider component. // We look in the directories stepping up from the location of the runtime assembly. let loadFromLocation designTimeAssemblyPath = @@ -213,7 +207,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 @@ -224,7 +218,7 @@ 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.FullName.Equals(name.Name, StringComparison.OrdinalIgnoreCase) then let designTimeFileName = designTimeAssemblyName + ".dll" @@ -276,7 +270,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) @@ -355,12 +349,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/DiagnosticsLogger.fs b/src/Compiler/Facilities/DiagnosticsLogger.fs index e5869fe04b2..eb96a5f6e0b 100644 --- a/src/Compiler/Facilities/DiagnosticsLogger.fs +++ b/src/Compiler/Facilities/DiagnosticsLogger.fs @@ -435,8 +435,7 @@ module DiagnosticsLoggerExtensions = try if not tryAndDetectDev15 then let preserveStackTrace = - !!typeof - .GetMethod("InternalPreserveStackTrace", BindingFlags.Instance ||| BindingFlags.NonPublic) + !!typeof.GetMethod("InternalPreserveStackTrace", BindingFlags.Instance ||| BindingFlags.NonPublic) preserveStackTrace.Invoke(exn, null) |> ignore with _ -> diff --git a/src/Compiler/Facilities/LanguageFeatures.fs b/src/Compiler/Facilities/LanguageFeatures.fs index 9ee90f98bb4..7a9a14b8602 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fs +++ b/src/Compiler/Facilities/LanguageFeatures.fs @@ -217,9 +217,9 @@ type LanguageVersion(versionText) = LanguageFeature.LowerSimpleMappingsInComprehensionsToFastLoops, languageVersion90 LanguageFeature.ParsedHashDirectiveArgumentNonQuotes, languageVersion90 LanguageFeature.EmptyBodiedComputationExpressions, languageVersion90 - LanguageFeature.EnforceAttributeTargets, languageVersion90 // F# preview + LanguageFeature.EnforceAttributeTargets, previewVersion // Not enabled due to a number of external library dependencies on unenforced attributes LanguageFeature.UseTypeSubsumptionCache, previewVersion LanguageFeature.UnmanagedConstraintCsharpInterop, previewVersion // not enabled because: https://github.com/dotnet/fsharp/issues/17509 LanguageFeature.FromEndSlicing, previewVersion // Unfinished features --- needs work diff --git a/src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs b/src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs index c9f84390367..dc0e30cac72 100644 --- a/src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs +++ b/src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs @@ -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" @@ -150,7 +150,7 @@ let private SimulatedMSBuildResolver = let fscoreDir0 = let PF = match Environment.GetEnvironmentVariable("ProgramFiles(x86)") with - | null -> !! Environment.GetEnvironmentVariable("ProgramFiles") + | null -> !!Environment.GetEnvironmentVariable("ProgramFiles") | s -> s PF @@ -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, _ diff --git a/src/Compiler/Facilities/prim-lexing.fs b/src/Compiler/Facilities/prim-lexing.fs index c305052587c..381e11eaa3a 100644 --- a/src/Compiler/Facilities/prim-lexing.fs +++ b/src/Compiler/Facilities/prim-lexing.fs @@ -192,7 +192,7 @@ module SourceTextNew = member _.GetChecksum() = // TODO: something better... - !! sourceText.ToString() + !!sourceText.ToString() |> Md5Hasher.hashString |> fun byteArray -> ImmutableArray.Create(byteArray, 0, byteArray.Length) } @@ -356,12 +356,8 @@ and [] internal LexBuffer<'Char> FSharp.Compiler.DiagnosticsLogger.checkLanguageFeatureAndRecover langVersion featureId range static member FromFunction - ( - reportLibraryOnlyFeatures, - langVersion, - strictIndentation, - f: 'Char[] * int * int -> int - ) : LexBuffer<'Char> = + (reportLibraryOnlyFeatures, langVersion, strictIndentation, f: 'Char[] * int * int -> int) + : LexBuffer<'Char> = let extension = Array.zeroCreate 4096 let filler (lexBuffer: LexBuffer<'Char>) = @@ -385,8 +381,7 @@ and [] internal LexBuffer<'Char> static member FromArray(reportLibraryOnlyFeatures, langVersion, strictIndentation, s: 'Char[]) : LexBuffer<'Char> = let buffer = Array.copy s - LexBuffer<'Char> - .FromArrayNoCopy(reportLibraryOnlyFeatures, langVersion, strictIndentation, buffer) + LexBuffer<'Char>.FromArrayNoCopy(reportLibraryOnlyFeatures, langVersion, strictIndentation, buffer) // Important: This method takes ownership of the array static member FromChars(reportLibraryOnlyFeatures, langVersion, strictIndentation, arr: char[]) = diff --git a/src/Compiler/Interactive/fsi.fs b/src/Compiler/Interactive/fsi.fs index eaba5aa6582..78d5cb94dcd 100644 --- a/src/Compiler/Interactive/fsi.fs +++ b/src/Compiler/Interactive/fsi.fs @@ -128,7 +128,7 @@ module internal Utilities = } else let specialized = typedefof>.MakeGenericType [| ty |] - !! Activator.CreateInstance(specialized) :?> IAnyToLayoutCall + !!Activator.CreateInstance(specialized) :?> IAnyToLayoutCall let callStaticMethod (ty: Type) name args = ty.InvokeMember( @@ -395,7 +395,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 @@ -442,7 +442,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)) @@ -1581,7 +1581,7 @@ let rec ConvReflectionTypeToILType (reflectionTy: Type) = let elementOrItemTref = if reflectionTy.HasElementType then - !! reflectionTy.GetElementType() + !!reflectionTy.GetElementType() else reflectionTy |> ConvReflectionTypeToILTypeRef @@ -1904,7 +1904,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 ( @@ -2438,14 +2438,8 @@ type internal FsiDynamicCompiler /// Evaluate the given definitions and produce a new interactive state. member _.EvalParsedDefinitions - ( - ctok, - diagnosticsLogger: DiagnosticsLogger, - istate, - showTypes, - isInteractiveItExpr, - defs: SynModuleDecl list - ) = + (ctok, diagnosticsLogger: DiagnosticsLogger, istate, showTypes, isInteractiveItExpr, defs: SynModuleDecl list) + = let fileName = stdinMockFileName let m = @@ -2681,12 +2675,8 @@ type internal FsiDynamicCompiler member _.HasDelayedDependencyManagerText = hasDelayedDependencyManagerText member fsiDynamicCompiler.ProcessDelayedDependencyManagerText - ( - ctok, - istate: FsiDynamicCompilerState, - lexResourceManager, - diagnosticsLogger - ) = + (ctok, istate: FsiDynamicCompilerState, lexResourceManager, diagnosticsLogger) + = if not hasDelayedDependencyManagerText then istate else @@ -2828,12 +2818,8 @@ type internal FsiDynamicCompiler /// Scrape #r, #I and package manager commands from a #load member fsiDynamicCompiler.ProcessMetaCommandsFromParsedInputAsInteractiveCommands - ( - ctok, - istate: FsiDynamicCompilerState, - sourceFile, - input - ) = + (ctok, istate: FsiDynamicCompilerState, sourceFile, input) + = WithImplicitHome (tcConfigB, directoryName sourceFile) (fun () -> ProcessMetaCommandsFromInput ((fun st (m, nm) -> @@ -2845,7 +2831,7 @@ type internal FsiDynamicCompiler 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) @@ -4468,11 +4454,8 @@ let internal SpawnThread name f = th.Start() let internal SpawnInteractiveServer - ( - fsi: FsiEvaluationSessionHostConfig, - fsiOptions: FsiCommandLineOptions, - fsiConsoleOutput: FsiConsoleOutput - ) = + (fsi: FsiEvaluationSessionHostConfig, fsiOptions: FsiCommandLineOptions, fsiConsoleOutput: FsiConsoleOutput) + = //printf "Spawning fsi server on channel '%s'" !fsiServerName; SpawnThread "ServerThread" (fun () -> use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID @@ -4486,11 +4469,8 @@ let internal SpawnInteractiveServer /// /// This gives us a last chance to catch an abort on the main execution thread. let internal DriveFsiEventLoop - ( - fsi: FsiEvaluationSessionHostConfig, - fsiInterruptController: FsiInterruptController, - fsiConsoleOutput: FsiConsoleOutput - ) = + (fsi: FsiEvaluationSessionHostConfig, fsiInterruptController: FsiInterruptController, fsiConsoleOutput: FsiConsoleOutput) + = if progress then fprintfn fsiConsoleOutput.Out "GUI thread runLoop" @@ -4770,7 +4750,7 @@ type FsiEvaluationSession let makeNestedException (userExn: #Exception) = // clone userExn -- make userExn the inner exception, to retain the stacktrace on raise let arguments = [| userExn.Message :> obj; userExn :> obj |] - !! Activator.CreateInstance(userExn.GetType(), arguments) :?> Exception + !!Activator.CreateInstance(userExn.GetType(), arguments) :?> Exception let commitResult res = match res with diff --git a/src/Compiler/Service/BackgroundCompiler.fs b/src/Compiler/Service/BackgroundCompiler.fs index a55aaa490be..5eb8bd35f99 100644 --- a/src/Compiler/Service/BackgroundCompiler.fs +++ b/src/Compiler/Service/BackgroundCompiler.fs @@ -112,6 +112,7 @@ type internal IBackgroundCompiler = abstract member GetProjectOptionsFromScript: fileName: string * sourceText: ISourceText * + caret: Position option * previewEnabled: bool option * loadedTimeStamp: System.DateTime option * otherFlags: string array option * @@ -126,6 +127,7 @@ type internal IBackgroundCompiler = abstract GetProjectSnapshotFromScript: fileName: string * sourceText: ISourceTextNew * + caret: Position option * documentSource: DocumentSource * previewEnabled: bool option * loadedTimeStamp: System.DateTime option * @@ -578,14 +580,8 @@ type internal BackgroundCompiler res) member _.ParseFile - ( - fileName: string, - sourceText: ISourceText, - options: FSharpParsingOptions, - cache: bool, - flatErrors: bool, - userOpName: string - ) = + (fileName: string, sourceText: ISourceText, options: FSharpParsingOptions, cache: bool, flatErrors: bool, userOpName: string) + = async { use _ = Activity.start @@ -781,14 +777,8 @@ type internal BackgroundCompiler /// Type-check the result obtained by parsing, but only if the antecedent type checking context is available. member bc.CheckFileInProjectAllowingStaleCachedResults - ( - parseResults: FSharpParseFileResults, - fileName, - fileVersion, - sourceText: ISourceText, - options, - userOpName - ) = + (parseResults: FSharpParseFileResults, fileName, fileVersion, sourceText: ISourceText, options, userOpName) + = async { use _ = Activity.start @@ -841,14 +831,8 @@ type internal BackgroundCompiler /// Type-check the result obtained by parsing. Force the evaluation of the antecedent type checking context if needed. member bc.CheckFileInProject - ( - parseResults: FSharpParseFileResults, - fileName, - fileVersion, - sourceText: ISourceText, - options, - userOpName - ) = + (parseResults: FSharpParseFileResults, fileName, fileVersion, sourceText: ISourceText, options, userOpName) + = async { use _ = Activity.start @@ -890,13 +874,8 @@ type internal BackgroundCompiler /// Parses and checks the source file and returns untyped AST and check results. member bc.ParseAndCheckFileInProject - ( - fileName: string, - fileVersion, - sourceText: ISourceText, - options: FSharpProjectOptions, - userOpName - ) = + (fileName: string, fileVersion, sourceText: ISourceText, options: FSharpProjectOptions, userOpName) + = async { use _ = Activity.start @@ -1071,7 +1050,7 @@ type internal BackgroundCompiler Some options, Array.ofList tcDependencyFiles, creationDiags, - parseResults.Diagnostics, + [||], tcDiagnostics, keepAssemblyContents, Option.get latestCcuSigForFile, @@ -1090,13 +1069,8 @@ type internal BackgroundCompiler } member _.FindReferencesInFile - ( - fileName: string, - options: FSharpProjectOptions, - symbol: FSharpSymbol, - canInvalidateProject: bool, - userOpName: string - ) = + (fileName: string, options: FSharpProjectOptions, symbol: FSharpSymbol, canInvalidateProject: bool, userOpName: string) + = async { use _ = Activity.start @@ -1150,12 +1124,8 @@ type internal BackgroundCompiler /// Try to get recent approximate type check results for a file. member _.TryGetRecentCheckResultsForFile - ( - fileName: string, - options: FSharpProjectOptions, - sourceText: ISourceText option, - _userOpName: string - ) = + (fileName: string, options: FSharpProjectOptions, sourceText: ISourceText option, _userOpName: string) + = use _ = Activity.start "BackgroundCompiler.GetSemanticClassificationForFile" @@ -1308,6 +1278,7 @@ type internal BackgroundCompiler ( fileName, sourceText, + caret, previewEnabled, loadedTimeStamp, otherFlags, @@ -1358,6 +1329,7 @@ type internal BackgroundCompiler FSharpCheckerResultsSettings.defaultFSharpBinariesDir, fileName, sourceText, + caret, CodeContext.Editing, useSimpleResolution, useFsiAuxLib, @@ -1539,13 +1511,8 @@ type internal BackgroundCompiler member _.FileParsed: IEvent = self.FileParsed member _.FindReferencesInFile - ( - fileName: string, - options: FSharpProjectOptions, - symbol: FSharpSymbol, - canInvalidateProject: bool, - userOpName: string - ) : Async> = + (fileName: string, options: FSharpProjectOptions, symbol: FSharpSymbol, canInvalidateProject: bool, userOpName: string) + : Async> = self.FindReferencesInFile(fileName, options, symbol, canInvalidateProject, userOpName) member this.FindReferencesInFile(fileName, projectSnapshot, symbol, userOpName) = @@ -1557,42 +1524,30 @@ type internal BackgroundCompiler self.GetAssemblyData(options, userOpName) member _.GetAssemblyData - ( - projectSnapshot: FSharpProjectSnapshot, - _fileName: string, - userOpName: string - ) : Async = + (projectSnapshot: FSharpProjectSnapshot, _fileName: string, userOpName: string) + : Async = self.GetAssemblyData(projectSnapshot.ToOptions(), userOpName) member _.GetBackgroundCheckResultsForFileInProject - ( - fileName: string, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, options: FSharpProjectOptions, userOpName: string) + : Async = self.GetBackgroundCheckResultsForFileInProject(fileName, options, userOpName) member _.GetBackgroundParseResultsForFileInProject - ( - fileName: string, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, options: FSharpProjectOptions, userOpName: string) + : Async = self.GetBackgroundParseResultsForFileInProject(fileName, options, userOpName) member _.GetCachedCheckFileResult - ( - builder: IncrementalBuilder, - fileName: string, - sourceText: ISourceText, - options: FSharpProjectOptions - ) : Async<(FSharpParseFileResults * FSharpCheckFileResults) option> = + (builder: IncrementalBuilder, fileName: string, sourceText: ISourceText, options: FSharpProjectOptions) + : Async<(FSharpParseFileResults * FSharpCheckFileResults) option> = self.GetCachedCheckFileResult(builder, fileName, sourceText, options) member _.GetProjectOptionsFromScript ( fileName: string, sourceText: ISourceText, + caret: Position option, previewEnabled: bool option, loadedTimeStamp: DateTime option, otherFlags: string array option, @@ -1606,6 +1561,7 @@ type internal BackgroundCompiler self.GetProjectOptionsFromScript( fileName, sourceText, + caret, previewEnabled, loadedTimeStamp, otherFlags, @@ -1621,6 +1577,7 @@ type internal BackgroundCompiler ( fileName: string, sourceText: ISourceTextNew, + caret: Position option, documentSource: DocumentSource, previewEnabled: bool option, loadedTimeStamp: DateTime option, @@ -1637,6 +1594,7 @@ type internal BackgroundCompiler self.GetProjectOptionsFromScript( fileName, sourceText, + caret, previewEnabled, loadedTimeStamp, otherFlags, @@ -1653,19 +1611,13 @@ type internal BackgroundCompiler } member _.GetSemanticClassificationForFile - ( - fileName: string, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, options: FSharpProjectOptions, userOpName: string) + : Async = self.GetSemanticClassificationForFile(fileName, options, userOpName) member _.GetSemanticClassificationForFile - ( - fileName: string, - snapshot: FSharpProjectSnapshot, - userOpName: string - ) : Async = + (fileName: string, snapshot: FSharpProjectSnapshot, userOpName: string) + : Async = self.GetSemanticClassificationForFile(fileName, snapshot.ToOptions(), userOpName) member _.InvalidateConfiguration(options: FSharpProjectOptions, userOpName: string) : unit = @@ -1682,21 +1634,13 @@ type internal BackgroundCompiler self.NotifyProjectCleaned(options, userOpName) member _.ParseAndCheckFileInProject - ( - fileName: string, - fileVersion: int, - sourceText: ISourceText, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, fileVersion: int, sourceText: ISourceText, options: FSharpProjectOptions, userOpName: string) + : Async = self.ParseAndCheckFileInProject(fileName, fileVersion, sourceText, options, userOpName) member _.ParseAndCheckFileInProject - ( - fileName: string, - projectSnapshot: FSharpProjectSnapshot, - userOpName: string - ) : Async = + (fileName: string, projectSnapshot: FSharpProjectSnapshot, userOpName: string) + : Async = async { let fileSnapshot = projectSnapshot.ProjectSnapshot.SourceFiles @@ -1715,14 +1659,8 @@ type internal BackgroundCompiler self.ParseAndCheckProject(projectSnapshot.ToOptions(), userOpName) member _.ParseFile - ( - fileName: string, - sourceText: ISourceText, - options: FSharpParsingOptions, - cache: bool, - flatErrors: bool, - userOpName: string - ) = + (fileName: string, sourceText: ISourceText, options: FSharpParsingOptions, cache: bool, flatErrors: bool, userOpName: string) + = self.ParseFile(fileName, sourceText, options, cache, flatErrors, userOpName) member _.ParseFile(fileName: string, projectSnapshot: FSharpProjectSnapshot, userOpName: string) = @@ -1733,18 +1671,11 @@ type internal BackgroundCompiler member _.ProjectChecked: IEvent = self.ProjectChecked member _.TryGetRecentCheckResultsForFile - ( - fileName: string, - options: FSharpProjectOptions, - sourceText: ISourceText option, - userOpName: string - ) : (FSharpParseFileResults * FSharpCheckFileResults * SourceTextHash) option = + (fileName: string, options: FSharpProjectOptions, sourceText: ISourceText option, userOpName: string) + : (FSharpParseFileResults * FSharpCheckFileResults * SourceTextHash) option = self.TryGetRecentCheckResultsForFile(fileName, options, sourceText, userOpName) member _.TryGetRecentCheckResultsForFile - ( - fileName: string, - projectSnapshot: FSharpProjectSnapshot, - userOpName: string - ) : (FSharpParseFileResults * FSharpCheckFileResults) option = + (fileName: string, projectSnapshot: FSharpProjectSnapshot, userOpName: string) + : (FSharpParseFileResults * FSharpCheckFileResults) option = self.TryGetRecentCheckResultsForFile(fileName, projectSnapshot, userOpName) diff --git a/src/Compiler/Service/BackgroundCompiler.fsi b/src/Compiler/Service/BackgroundCompiler.fsi index d93ece6217b..6192b23e3f9 100644 --- a/src/Compiler/Service/BackgroundCompiler.fsi +++ b/src/Compiler/Service/BackgroundCompiler.fsi @@ -90,6 +90,7 @@ type internal IBackgroundCompiler = abstract GetProjectOptionsFromScript: fileName: string * sourceText: ISourceText * + caret: Position option * previewEnabled: bool option * loadedTimeStamp: System.DateTime option * otherFlags: string array option * @@ -104,6 +105,7 @@ type internal IBackgroundCompiler = abstract GetProjectSnapshotFromScript: fileName: string * sourceText: ISourceTextNew * + caret: Position option * documentSource: DocumentSource * previewEnabled: bool option * loadedTimeStamp: System.DateTime option * diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index 771ab536ff8..57d322c81a8 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -188,7 +188,7 @@ and FSharpProjectOptions = && options1.ReferencedProjects = options2.ReferencedProjects && options1.LoadTime = options2.LoadTime - member po.ProjectDirectory = !! Path.GetDirectoryName(po.ProjectFileName) + member po.ProjectDirectory = !!Path.GetDirectoryName(po.ProjectFileName) override this.ToString() = "FSharpProjectOptions(" + this.ProjectFileName + ")" @@ -1063,7 +1063,7 @@ type internal TypeCheckInfo |> Option.defaultValue completions /// Gets all methods that a type can override, but has not yet done so. - let GetOverridableMethods pos ctx (typeNameRange: range) spacesBeforeOverrideKeyword hasThis isStatic = + let GetOverridableMethods pos ctx (typeNameRange: range) newlineIndentCount hasThis isStatic genBodyForOverriddenMeth = let checkImplementedSlotDeclareType ty slots = slots |> Option.map (List.exists (fun (TSlotSig(declaringType = ty2)) -> typeEquiv g ty ty2)) @@ -1111,8 +1111,11 @@ type internal TypeCheckInfo let (nenv, ad), m = GetBestEnvForPos pos let denv = nenv.DisplayEnv + /// Check if the method is abstract, return "raise (NotImplementedException())" if it is abstract, otherwise return the given body let checkMethAbstractAndGetImplementBody (meth: MethInfo) implementBody = - if meth.IsAbstract then + if not genBodyForOverriddenMeth then + String.Empty + elif meth.IsAbstract then if nenv.DisplayEnv.openTopPathsSorted.Force() |> List.contains [ "System" ] then "raise (NotImplementedException())" else @@ -1120,8 +1123,8 @@ type internal TypeCheckInfo else implementBody - let newlineIndent = - Environment.NewLine + String.make (spacesBeforeOverrideKeyword + 4) ' ' + let newlineIndentCount = max 1 newlineIndentCount + let newlineIndent = Environment.NewLine + String.make newlineIndentCount ' ' let getOverridableMethods superTy (overriddenMethods: MethInfo list) overriddenProperties = // Do not check a method with same name twice @@ -1197,12 +1200,6 @@ type internal TypeCheckInfo 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 = @@ -1211,6 +1208,10 @@ type internal TypeCheckInfo + newlineIndent + "with " + getterWithBody + + (if String.IsNullOrEmpty keywordAnd then + String.Empty + else + newlineIndent) + keywordAnd + setterWithBody @@ -1721,7 +1722,8 @@ type internal TypeCheckInfo filterCtors, resolveOverloads, completionContextAtPos: (pos * CompletionContext option) option, - getAllSymbols: unit -> AssemblySymbol list + getAllSymbols: unit -> AssemblySymbol list, + genBodyForOverriddenMeth ) : (CompletionItem list * DisplayEnv * CompletionContext option * range) option = let loc = @@ -1957,8 +1959,22 @@ type internal TypeCheckInfo getDeclaredItemsNotInRangeOpWithAllSymbols () |> Option.bind (FilterRelevantItemsBy getItem2 None IsPatternCandidate) - | Some(CompletionContext.MethodOverride(ctx, enclosingTypeNameRange, spacesBeforeOverrideKeyword, hasThis, isStatic)) -> - GetOverridableMethods pos ctx enclosingTypeNameRange spacesBeforeOverrideKeyword hasThis isStatic + | Some(CompletionContext.MethodOverride(ctx, + enclosingTypeNameRange, + spacesBeforeOverrideKeyword, + hasThis, + isStatic, + spacesBeforeEnclosingDefinition)) -> + let indent = max 1 (spacesBeforeOverrideKeyword - spacesBeforeEnclosingDefinition) + + GetOverridableMethods + pos + ctx + enclosingTypeNameRange + (spacesBeforeOverrideKeyword + indent) + hasThis + isStatic + genBodyForOverriddenMeth // Other completions | cc -> @@ -2025,7 +2041,9 @@ type internal TypeCheckInfo scope.IsRelativeNameResolvable(cursorPos, plid, symbol.Item) /// Get the auto-complete items at a location - member _.GetDeclarations(parseResultsOpt, line, lineStr, partialName, completionContextAtPos, getAllEntities) = + member _.GetDeclarations + (parseResultsOpt, line, lineStr, partialName, completionContextAtPos, getAllEntities, genBodyForOverriddenMeth) + = let isSigFile = SourceFileImpl.IsSignatureFile mainInputFileName DiagnosticsScope.Protect @@ -2044,7 +2062,8 @@ type internal TypeCheckInfo ResolveTypeNamesToCtors, ResolveOverloads.Yes, completionContextAtPos, - getAllEntities + getAllEntities, + genBodyForOverriddenMeth ) match declItemsOpt with @@ -2085,7 +2104,7 @@ type internal TypeCheckInfo DeclarationListInfo.Error msg) /// Get the symbols for auto-complete items at a location - member _.GetDeclarationListSymbols(parseResultsOpt, line, lineStr, partialName, getAllEntities) = + member _.GetDeclarationListSymbols(parseResultsOpt, line, lineStr, partialName, getAllEntities, genBodyForOverriddenMeth) = let isSigFile = SourceFileImpl.IsSignatureFile mainInputFileName DiagnosticsScope.Protect @@ -2104,7 +2123,8 @@ type internal TypeCheckInfo ResolveTypeNamesToCtors, ResolveOverloads.Yes, None, - getAllEntities + getAllEntities, + genBodyForOverriddenMeth ) match declItemsOpt with @@ -2285,7 +2305,8 @@ type internal TypeCheckInfo ResolveTypeNamesToCtors, ResolveOverloads.Yes, None, - (fun () -> []) + (fun () -> []), + false ) match declItemsOpt with @@ -2347,7 +2368,8 @@ type internal TypeCheckInfo ResolveTypeNamesToCtors, ResolveOverloads.No, None, - (fun () -> []) + (fun () -> []), + false ) match declItemsOpt with @@ -2393,7 +2415,8 @@ type internal TypeCheckInfo ResolveTypeNamesToCtors, ResolveOverloads.No, None, - (fun () -> []) + (fun () -> []), + false ) match declItemsOpt with @@ -2434,7 +2457,8 @@ type internal TypeCheckInfo ResolveTypeNamesToCtors, ResolveOverloads.No, None, - (fun () -> []) + (fun () -> []), + false ) match declItemsOpt with @@ -2470,7 +2494,8 @@ type internal TypeCheckInfo ResolveTypeNamesToCtors, ResolveOverloads.Yes, None, - (fun () -> []) + (fun () -> []), + false ) match declItemsOpt with @@ -2618,7 +2643,8 @@ type internal TypeCheckInfo ResolveTypeNamesToCtors, ResolveOverloads.Yes, None, - (fun () -> []) + (fun () -> []), + false ) match declItemsOpt with @@ -2647,7 +2673,8 @@ type internal TypeCheckInfo ResolveTypeNamesToCtors, ResolveOverloads.Yes, None, - (fun () -> []) + (fun () -> []), + false ) match declItemsOpt with @@ -3075,14 +3102,8 @@ module internal ParseAndCheckFile = errHandler.CollectedDiagnostics(None), parseResult, errHandler.AnyErrors let ApplyLoadClosure - ( - tcConfig, - parsedMainInput, - mainInputFileName: string, - loadClosure: LoadClosure option, - tcImports: TcImports, - backgroundDiagnostics - ) = + (tcConfig, parsedMainInput, mainInputFileName: string, loadClosure: LoadClosure option, tcImports: TcImports, backgroundDiagnostics) + = // If additional references were brought in by the preprocessor then we need to process them match loadClosure with @@ -3170,7 +3191,7 @@ module internal ParseAndCheckFile = ApplyMetaCommandsFromInputToTcConfig( tcConfig, parsedMainInput, - !! Path.GetDirectoryName(mainInputFileName), + !!Path.GetDirectoryName(mainInputFileName), tcImports.DependencyProvider ) |> ignore @@ -3221,7 +3242,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 @@ -3348,20 +3369,33 @@ type FSharpCheckFileResults | Some(scope, _builderOpt) -> Some scope.TcImports /// Intellisense autocompletions - member _.GetDeclarationListInfo(parsedFileResults, line, lineText, partialName, ?getAllEntities, ?completionContextAtPos) = + member _.GetDeclarationListInfo + (parsedFileResults, line, lineText, partialName, ?getAllEntities, ?completionContextAtPos, ?genBodyForOverriddenMeth) + = let getAllEntities = defaultArg getAllEntities (fun () -> []) + let genBodyForOverriddenMeth = defaultArg genBodyForOverriddenMeth true match details with | None -> DeclarationListInfo.Empty | Some(scope, _builderOpt) -> - scope.GetDeclarations(parsedFileResults, line, lineText, partialName, completionContextAtPos, getAllEntities) + scope.GetDeclarations( + parsedFileResults, + line, + lineText, + partialName, + completionContextAtPos, + getAllEntities, + genBodyForOverriddenMeth + ) - member _.GetDeclarationListSymbols(parsedFileResults, line, lineText, partialName, ?getAllEntities) = + member _.GetDeclarationListSymbols(parsedFileResults, line, lineText, partialName, ?getAllEntities, ?genBodyForOverriddenMeth) = let getAllEntities = defaultArg getAllEntities (fun () -> []) + let genBodyForOverriddenMeth = defaultArg genBodyForOverriddenMeth true match details with | None -> [] - | Some(scope, _builderOpt) -> scope.GetDeclarationListSymbols(parsedFileResults, line, lineText, partialName, getAllEntities) + | Some(scope, _builderOpt) -> + scope.GetDeclarationListSymbols(parsedFileResults, line, lineText, partialName, getAllEntities, genBodyForOverriddenMeth) member _.GetKeywordTooltip(names: string list) = ToolTipText.ToolTipText @@ -3584,12 +3618,7 @@ type FSharpCheckFileResults FSharpCheckFileResults(fileName, creationErrors, None, [||], None, keepAssemblyContents) static member JoinErrors - ( - isIncompleteTypeCheckEnvironment, - creationErrors: FSharpDiagnostic[], - parseErrors: FSharpDiagnostic[], - tcErrors: FSharpDiagnostic[] - ) = + (isIncompleteTypeCheckEnvironment, creationErrors: FSharpDiagnostic[], parseErrors: FSharpDiagnostic[], tcErrors: FSharpDiagnostic[]) = [| yield! creationErrors yield! parseErrors @@ -3952,6 +3981,7 @@ type FsiInteractiveChecker(legacyReferenceResolver, tcConfig: TcConfig, tcGlobal defaultFSharpBinariesDir, fileName, sourceText, + None, CodeContext.Editing, tcConfig.useSimpleResolution, tcConfig.useFsiAuxLib, diff --git a/src/Compiler/Service/FSharpCheckerResults.fsi b/src/Compiler/Service/FSharpCheckerResults.fsi index 607232f3c92..cbc5ecc5f1b 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fsi +++ b/src/Compiler/Service/FSharpCheckerResults.fsi @@ -290,13 +290,17 @@ type public FSharpCheckFileResults = /// /// Completion context for a particular position computed in advance. /// + /// + /// A switch to determine whether to generate a default implementation body for overridden method when completing. + /// member GetDeclarationListInfo: parsedFileResults: FSharpParseFileResults option * line: int * lineText: string * partialName: PartialLongName * ?getAllEntities: (unit -> AssemblySymbol list) * - ?completionContextAtPos: (pos * CompletionContext option) -> + ?completionContextAtPos: (pos * CompletionContext option) * + ?genBodyForOverriddenMeth: bool -> DeclarationListInfo /// Get the items for a declaration list in FSharpSymbol format @@ -317,12 +321,16 @@ type public FSharpCheckFileResults = /// /// Function that returns all entities from current and referenced assemblies. /// + /// + /// A switch to determine whether to generate a default implementation body for overridden method when completing. + /// member GetDeclarationListSymbols: parsedFileResults: FSharpParseFileResults option * line: int * lineText: string * partialName: PartialLongName * - ?getAllEntities: (unit -> AssemblySymbol list) -> + ?getAllEntities: (unit -> AssemblySymbol list) * + ?genBodyForOverriddenMeth: bool -> FSharpSymbolUse list list /// Compute a formatted tooltip for the given keywords diff --git a/src/Compiler/Service/FSharpProjectSnapshot.fs b/src/Compiler/Service/FSharpProjectSnapshot.fs index 030d070a375..8ca44143037 100644 --- a/src/Compiler/Service/FSharpProjectSnapshot.fs +++ b/src/Compiler/Service/FSharpProjectSnapshot.fs @@ -436,15 +436,18 @@ and [] Proj ((projectFileName, outputFileNameValue.Value |> Option.defaultValue "") |> FSharpProjectIdentifier) - new(projectFileName: string, - outputFileName: string option, - referencesOnDisk: string seq, - otherOptions: string seq, - ?isIncompleteTypeCheckEnvironment: bool, - ?useScriptResolutionRules: bool, - ?loadTime: DateTime, - ?stamp: int64, - ?projectId: string) = + new + ( + projectFileName: string, + outputFileName: string option, + referencesOnDisk: string seq, + otherOptions: string seq, + ?isIncompleteTypeCheckEnvironment: bool, + ?useScriptResolutionRules: bool, + ?loadTime: DateTime, + ?stamp: int64, + ?projectId: string + ) = let referencesOnDisk = referencesOnDisk @@ -469,7 +472,7 @@ and [] Proj projectId = projectId ) - member val ProjectDirectory = !! Path.GetDirectoryName(projectFileName) + member val ProjectDirectory = !!Path.GetDirectoryName(projectFileName) member _.OutputFileName = outputFileNameValue.Value member _.Identifier = identifier.Value member _.Version = fullHash.Value @@ -726,13 +729,8 @@ and [] FSha ) static member FromOptions - ( - options: FSharpProjectOptions, - fileName: string, - fileVersion: int, - sourceText: ISourceText, - documentSource: DocumentSource - ) = + (options: FSharpProjectOptions, fileName: string, fileVersion: int, sourceText: ISourceText, documentSource: DocumentSource) + = let getFileSnapshot _ fName = if fName = fileName then diff --git a/src/Compiler/Service/FSharpWorkspaceState.fs b/src/Compiler/Service/FSharpWorkspaceState.fs index cc3d3d8524d..b7a3a70dd89 100644 --- a/src/Compiler/Service/FSharpWorkspaceState.fs +++ b/src/Compiler/Service/FSharpWorkspaceState.fs @@ -148,10 +148,8 @@ module internal WorkspaceDependencyGraphExtensions = [] static member AddProjectWithoutFiles - ( - this: GraphBuilder<_, _, (ProjectConfig * FSharpProjectSnapshot seq), _>, - computeProjectWithoutFiles - ) = + (this: GraphBuilder<_, _, (ProjectConfig * FSharpProjectSnapshot seq), _>, computeProjectWithoutFiles) + = this.AddDependentNode( WorkspaceNodeKey.ProjectWithoutFiles this.State, computeProjectWithoutFiles >> WorkspaceNodeValue.ProjectWithoutFiles, @@ -174,10 +172,8 @@ module internal WorkspaceDependencyGraphExtensions = [] static member AddProjectSnapshot - ( - this: GraphBuilder<_, _, (ProjectWithoutFiles * FSharpFileSnapshot seq), _>, - computeProjectSnapshot - ) = + (this: GraphBuilder<_, _, (ProjectWithoutFiles * FSharpFileSnapshot seq), _>, computeProjectSnapshot) + = this.AddDependentNode( WorkspaceNodeKey.ProjectSnapshot this.State, @@ -199,9 +195,7 @@ module internal WorkspaceDependencyGraphExtensions = [] static member GetProjectSnapshot(this: IDependencyGraph<_, _>, project) = - this - .GetValue(WorkspaceNodeKey.ProjectSnapshot project) - .Unpack(WorkspaceNode.projectSnapshot) + this.GetValue(WorkspaceNodeKey.ProjectSnapshot project).Unpack(WorkspaceNode.projectSnapshot) [] static member GetProjectReferencesOf(this: IDependencyGraph<_, _>, project) = @@ -212,9 +206,7 @@ module internal WorkspaceDependencyGraphExtensions = [] static member GetProjectsThatReference(this: IDependencyGraph<_, _>, dllPath) = - this - .GetDependentsOf(WorkspaceNodeKey.ReferenceOnDisk dllPath) - .UnpackMany(WorkspaceNode.projectConfigKey) + this.GetDependentsOf(WorkspaceNodeKey.ReferenceOnDisk dllPath).UnpackMany(WorkspaceNode.projectConfigKey) [] static member GetProjectsContaining(this: IDependencyGraph<_, _>, file) = diff --git a/src/Compiler/Service/SemanticClassification.fs b/src/Compiler/Service/SemanticClassification.fs index 3de24222311..f384cabebdc 100644 --- a/src/Compiler/Service/SemanticClassification.fs +++ b/src/Compiler/Service/SemanticClassification.fs @@ -135,12 +135,8 @@ module TcResolutionsExtensions = type TcResolutions with member sResolutions.GetSemanticClassification - ( - g: TcGlobals, - amap: ImportMap, - formatSpecifierLocations: (range * int)[], - range: range option - ) : SemanticClassificationItem[] = + (g: TcGlobals, amap: ImportMap, formatSpecifierLocations: (range * int)[], range: range option) + : SemanticClassificationItem[] = DiagnosticsScope.Protect range0 (fun () -> diff --git a/src/Compiler/Service/ServiceInterfaceStubGenerator.fs b/src/Compiler/Service/ServiceInterfaceStubGenerator.fs index fb3e8dfbecc..94051957876 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() = diff --git a/src/Compiler/Service/ServiceLexing.fs b/src/Compiler/Service/ServiceLexing.fs index 083bae1d6d8..8e97816290f 100644 --- a/src/Compiler/Service/ServiceLexing.fs +++ b/src/Compiler/Service/ServiceLexing.fs @@ -1920,17 +1920,8 @@ module FSharpLexerImpl = type FSharpLexer = static member Tokenize - ( - text: ISourceText, - tokenCallback, - ?langVersion, - ?strictIndentation, - ?filePath: string, - ?conditionalDefines, - ?flags, - ?pathMap, - ?ct - ) = + (text: ISourceText, tokenCallback, ?langVersion, ?strictIndentation, ?filePath: string, ?conditionalDefines, ?flags, ?pathMap, ?ct) + = let langVersion = defaultArg langVersion "latestmajor" |> LanguageVersion let flags = defaultArg flags FSharpLexerFlags.Default ignore filePath // can be removed at later point diff --git a/src/Compiler/Service/ServiceParseTreeWalk.fs b/src/Compiler/Service/ServiceParseTreeWalk.fs index b55844e51ae..659f4c4bc60 100644 --- a/src/Compiler/Service/ServiceParseTreeWalk.fs +++ b/src/Compiler/Service/ServiceParseTreeWalk.fs @@ -56,12 +56,8 @@ type SyntaxVisitorBase<'T>() = 'T option default _.VisitExpr - ( - path: SyntaxVisitorPath, - traverseSynExpr: SynExpr -> 'T option, - defaultTraverse: SynExpr -> 'T option, - synExpr: SynExpr - ) = + (path: SyntaxVisitorPath, traverseSynExpr: SynExpr -> 'T option, defaultTraverse: SynExpr -> 'T option, synExpr: SynExpr) + = ignore (path, traverseSynExpr, defaultTraverse, synExpr) None diff --git a/src/Compiler/Service/ServiceParsedInputOps.fs b/src/Compiler/Service/ServiceParsedInputOps.fs index 2ed457116b6..f5b15936902 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fs +++ b/src/Compiler/Service/ServiceParsedInputOps.fs @@ -118,7 +118,8 @@ type CompletionContext = enclosingTypeNameRange: range * spacesBeforeOverrideKeyword: int * hasThis: bool * - isStatic: bool + isStatic: bool * + spacesBeforeEnclosingDefinition: int type ShortIdent = string @@ -1519,11 +1520,8 @@ module ParsedInput = | _ -> None member _.VisitBinding - ( - path, - defaultTraverse, - (SynBinding(headPat = headPat; trivia = trivia; returnInfo = returnInfo) as synBinding) - ) = + (path, defaultTraverse, (SynBinding(headPat = headPat; trivia = trivia; returnInfo = returnInfo) as synBinding)) + = let isOverrideOrMember leadingKeyword = match leadingKeyword with @@ -1543,7 +1541,8 @@ module ParsedInput = let overrideContext path (mOverride: range) hasThis isStatic isMember = match path with - | _ :: SyntaxNode.SynTypeDefn(SynTypeDefn(typeInfo = SynComponentInfo(longId = [ enclosingType ]))) :: _ when + | _ :: SyntaxNode.SynTypeDefn(SynTypeDefn( + typeInfo = SynComponentInfo(longId = [ enclosingType ]); trivia = { LeadingKeyword = keyword })) :: _ when not isMember -> Some( @@ -1552,12 +1551,13 @@ module ParsedInput = enclosingType.idRange, mOverride.StartColumn, hasThis, - isStatic + isStatic, + keyword.Range.StartColumn ) ) - | SyntaxNode.SynMemberDefn(SynMemberDefn.Interface(interfaceType = ty)) :: SyntaxNode.SynTypeDefn(SynTypeDefn( + | SyntaxNode.SynMemberDefn(SynMemberDefn.Interface(interfaceType = ty) as enclosingDefn) :: SyntaxNode.SynTypeDefn(SynTypeDefn( typeInfo = SynComponentInfo(longId = [ enclosingType ]))) :: _ - | _ :: SyntaxNode.SynMemberDefn(SynMemberDefn.Interface(interfaceType = ty)) :: SyntaxNode.SynTypeDefn(SynTypeDefn( + | _ :: SyntaxNode.SynMemberDefn(SynMemberDefn.Interface(interfaceType = ty) as enclosingDefn) :: SyntaxNode.SynTypeDefn(SynTypeDefn( typeInfo = SynComponentInfo(longId = [ enclosingType ]))) :: _ -> let ty = match ty with @@ -1570,11 +1570,12 @@ module ParsedInput = enclosingType.idRange, mOverride.StartColumn, hasThis, - isStatic + isStatic, + enclosingDefn.Range.StartColumn ) ) - | SyntaxNode.SynMemberDefn(SynMemberDefn.Interface(interfaceType = ty)) :: (SyntaxNode.SynExpr(SynExpr.ObjExpr _) as expr) :: _ - | _ :: SyntaxNode.SynMemberDefn(SynMemberDefn.Interface(interfaceType = ty)) :: (SyntaxNode.SynExpr(SynExpr.ObjExpr _) as expr) :: _ -> + | SyntaxNode.SynMemberDefn(SynMemberDefn.Interface(interfaceType = ty) as enclosingDefn) :: (SyntaxNode.SynExpr(SynExpr.ObjExpr _) as expr) :: _ + | _ :: SyntaxNode.SynMemberDefn(SynMemberDefn.Interface(interfaceType = ty) as enclosingDefn) :: (SyntaxNode.SynExpr(SynExpr.ObjExpr _) as expr) :: _ -> let ty = match ty with | SynType.App(typeName = ty) -> ty @@ -1586,10 +1587,11 @@ module ParsedInput = ty.Range, mOverride.StartColumn, hasThis, - isStatic + isStatic, + enclosingDefn.Range.StartColumn ) ) - | SyntaxNode.SynExpr(SynExpr.ObjExpr(objType = ty)) as expr :: _ -> + | SyntaxNode.SynExpr(SynExpr.ObjExpr(objType = ty; newExprRange = newExprRange)) as expr :: _ -> let ty = match ty with | SynType.App(typeName = ty) -> ty @@ -1601,7 +1603,8 @@ module ParsedInput = ty.Range, mOverride.StartColumn, hasThis, - isStatic + isStatic, + newExprRange.StartColumn ) ) | _ -> Some CompletionContext.Invalid diff --git a/src/Compiler/Service/ServiceParsedInputOps.fsi b/src/Compiler/Service/ServiceParsedInputOps.fsi index 427ffda43aa..d99277893d4 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fsi +++ b/src/Compiler/Service/ServiceParsedInputOps.fsi @@ -90,7 +90,8 @@ type public CompletionContext = enclosingTypeNameRange: range * spacesBeforeOverrideKeyword: int * hasThis: bool * - isStatic: bool + isStatic: bool * + spacesBeforeEnclosingDefinition: int type public ModuleKind = { IsAutoOpen: bool diff --git a/src/Compiler/Service/SynExpr.fs b/src/Compiler/Service/SynExpr.fs index e9605582514..5981dd5b286 100644 --- a/src/Compiler/Service/SynExpr.fs +++ b/src/Compiler/Service/SynExpr.fs @@ -343,6 +343,7 @@ module SynExpr = | PrefixApp prec -> ValueSome(prec, Non) | InfixApp(prec, side) -> ValueSome(prec, side) | SynExpr.App(argExpr = SynExpr.ComputationExpr _) -> ValueSome(UnaryPrefix, Left) + | SynExpr.App(argExpr = SynExpr.Paren(expr = SynExpr.App _ & Is inner)) -> ValueSome(Apply, Right) | SynExpr.App(funcExpr = SynExpr.Paren(expr = SynExpr.App _)) -> ValueSome(Apply, Left) | SynExpr.App(flag = ExprAtomicFlag.Atomic) -> ValueSome(Dot, Non) | SynExpr.App _ -> ValueSome(Apply, Non) @@ -396,6 +397,7 @@ module SynExpr = | SynExpr.DotIndexedSet _ | SynExpr.DotNamedIndexedPropertySet _ | SynExpr.DotSet _ -> ValueSome Set + | SynExpr.TypeTest _ -> ValueSome TypeTest | _ -> ValueNone module Dangling = @@ -540,7 +542,7 @@ module SynExpr = if i >= 0 && i < offsidesCol then let slice = line.AsSpan(i, min (offsidesCol - i) (line.Length - i)) - let j = slice.IndexOfAnyExcept("*/%-+:^@><=!|0$.?".AsSpan()) + let j = slice.IndexOfAnyExcept("*/%-+:^@><=!|$.?".AsSpan()) let lo = i + (if j >= 0 && slice[j] = ' ' then j else 0) @@ -845,22 +847,6 @@ module SynExpr = // precedence than regular function application. | _, SyntaxNode.SynExpr(SynExpr.App _) :: SyntaxNode.SynExpr(PrefixApp High) :: _ -> true - // Parens are never required around suffixed or infixed numeric literals, e.g., - // - // (1l).ToString() - // (1uy).ToString() - // (0b1).ToString() - // (1e10).ToString() - // (1.0).ToString() - | DotSafeNumericLiteral, _ -> false - - // Parens are required around bare decimal ints or doubles ending - // in dots when being dotted into, e.g., - // - // (1).ToString() - // (1.).ToString() - | SynExpr.Const(constant = SynConst.Int32 _ | SynConst.Double _), SyntaxNode.SynExpr(SynExpr.DotGet _) :: _ -> true - // Parens are required around join conditions: // // join … on (… = …) @@ -907,6 +893,22 @@ module SynExpr = -> true + // Parens are never required around suffixed or infixed numeric literals, e.g., + // + // (1l).ToString() + // (1uy).ToString() + // (0b1).ToString() + // (1e10).ToString() + // (1.0).ToString() + | DotSafeNumericLiteral, _ -> false + + // Parens are required around bare decimal ints or doubles ending + // in dots when being dotted into, e.g., + // + // (1).ToString() + // (1.).ToString() + | SynExpr.Const(constant = SynConst.Int32 _ | SynConst.Double _), SyntaxNode.SynExpr(SynExpr.DotGet _) :: _ -> true + // The :: operator is parsed differently from other symbolic infix operators, // so we need to give it special treatment. @@ -952,6 +954,7 @@ module SynExpr = let rec loop = function | [] -> false + | SynMatchClause(whenExpr = Some(SynExpr.Paren(expr = Dangling.ArrowSensitive _ & Is inner))) :: _ -> true | SynMatchClause(trivia = trivia) :: clauses -> trivia.BarRange |> Option.exists (problematic matchOrTryRange) || trivia.ArrowRange |> Option.exists (problematic matchOrTryRange) @@ -1148,6 +1151,7 @@ module SynExpr = | _, MulDivMod(Mod, _) | _, AddSub(Sub, _) -> true | Relational _, Relational _ -> true + | Apply, Apply -> true | _ -> false | c -> c > 0 diff --git a/src/Compiler/Service/TransparentCompiler.fs b/src/Compiler/Service/TransparentCompiler.fs index 9007a111e7d..39560cb3b6b 100644 --- a/src/Compiler/Service/TransparentCompiler.fs +++ b/src/Compiler/Service/TransparentCompiler.fs @@ -496,6 +496,7 @@ type internal TransparentCompiler defaultFSharpBinariesDir, fileName, source, + None, CodeContext.Editing, useSimpleResolution, useFsiAuxLib, @@ -907,7 +908,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) @@ -1393,7 +1394,7 @@ 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 @@ -1733,22 +1734,26 @@ type internal TransparentCompiler let! projectSnapshot = parseSourceFiles projectSnapshot bootstrapInfo.TcConfig + let parseDiagnostics = + projectSnapshot.SourceFiles + |> Seq.collect (fun f -> f.ParseDiagnostics) + |> Seq.toArray + let! graph, dependencyFiles = ComputeDependencyGraphForProject bootstrapInfo.TcConfig projectSnapshot - return! + let! results, tcInfo = processTypeCheckingGraph graph (processGraphNode projectSnapshot bootstrapInfo dependencyFiles true) bootstrapInfo.InitialTcInfo + + return results, tcInfo, parseDiagnostics } ) let TryGetRecentCheckResultsForFile - ( - fileName: string, - projectSnapshot: FSharpProjectSnapshot, - userOpName: string - ) : (FSharpParseFileResults * FSharpCheckFileResults) option = + (fileName: string, projectSnapshot: FSharpProjectSnapshot, userOpName: string) + : (FSharpParseFileResults * FSharpCheckFileResults) option = ignore userOpName let cacheKey = @@ -1771,7 +1776,7 @@ type internal TransparentCompiler projectSnapshot.SignatureKey, async { - let! results, finalInfo = ComputeParseAndCheckAllFilesInProject bootstrapInfo projectSnapshot + let! results, finalInfo, parseDiagnostics = ComputeParseAndCheckAllFilesInProject bootstrapInfo projectSnapshot let assemblyName = bootstrapInfo.AssemblyName let tcConfig = bootstrapInfo.TcConfig @@ -1855,7 +1860,7 @@ type internal TransparentCompiler errorRecoveryNoRange exn ProjectAssemblyDataResult.Unavailable true - return finalInfo, ilAssemRef, assemblyDataResult, checkedImplFiles + return finalInfo, ilAssemRef, assemblyDataResult, checkedImplFiles, parseDiagnostics } ) @@ -1897,7 +1902,7 @@ type internal TransparentCompiler let! snapshotWithSources = LoadSources bootstrapInfo projectSnapshot - let! _, _, assemblyDataResult, _ = ComputeProjectExtras bootstrapInfo snapshotWithSources + let! _, _, assemblyDataResult, _, _ = ComputeProjectExtras bootstrapInfo snapshotWithSources Trace.TraceInformation($"Using in-memory project reference: {name}") return assemblyDataResult @@ -1919,7 +1924,8 @@ type internal TransparentCompiler | Some bootstrapInfo, creationDiags -> let! snapshotWithSources = LoadSources bootstrapInfo projectSnapshot - let! tcInfo, ilAssemRef, assemblyDataResult, checkedImplFiles = ComputeProjectExtras bootstrapInfo snapshotWithSources + let! tcInfo, ilAssemRef, assemblyDataResult, checkedImplFiles, parseDiagnostics = + ComputeProjectExtras bootstrapInfo snapshotWithSources let diagnosticsOptions = bootstrapInfo.TcConfig.diagnosticsOptions let fileName = DummyFileNameForRangesWithoutASpecificLocation @@ -1934,18 +1940,18 @@ type internal TransparentCompiler SymbolEnv(bootstrapInfo.TcGlobals, tcInfo.tcState.Ccu, Some tcInfo.tcState.CcuSig, bootstrapInfo.TcImports) |> Some - let tcDiagnostics = + let diagnostics = DiagnosticHelpers.CreateDiagnostics( diagnosticsOptions, true, fileName, - tcDiagnostics, + Array.concat [| parseDiagnostics; tcDiagnostics |], suggestNamesForErrors, bootstrapInfo.TcConfig.flatErrors, symbolEnv ) - let diagnostics = [| yield! creationDiags; yield! tcDiagnostics |] + let diagnostics = [| yield! creationDiags; yield! diagnostics |] let getAssemblyData () = match assemblyDataResult with @@ -2090,14 +2096,8 @@ type internal TransparentCompiler } member _.ParseFileWithoutProject - ( - fileName: string, - sourceText: ISourceText, - options: FSharpParsingOptions, - cache: bool, - flatErrors: bool, - userOpName: string - ) : Async = + (fileName: string, sourceText: ISourceText, options: FSharpParsingOptions, cache: bool, flatErrors: bool, userOpName: string) + : Async = let parseFileAsync = async { let! ct = Async.CancellationToken @@ -2251,13 +2251,8 @@ type internal TransparentCompiler member _.ProjectChecked = projectChecked.Publish member this.FindReferencesInFile - ( - fileName: string, - options: FSharpProjectOptions, - symbol: FSharpSymbol, - canInvalidateProject: bool, - userOpName: string - ) : Async> = + (fileName: string, options: FSharpProjectOptions, symbol: FSharpSymbol, canInvalidateProject: bool, userOpName: string) + : Async> = async { ignore canInvalidateProject @@ -2280,19 +2275,13 @@ type internal TransparentCompiler } member this.GetAssemblyData - ( - projectSnapshot: FSharpProjectSnapshot, - fileName, - userOpName: string - ) : Async = + (projectSnapshot: FSharpProjectSnapshot, fileName, userOpName: string) + : Async = this.GetAssemblyData(projectSnapshot.ProjectSnapshot, fileName, userOpName) member this.GetBackgroundCheckResultsForFileInProject - ( - fileName: string, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, options: FSharpProjectOptions, userOpName: string) + : Async = async { let! snapshot = FSharpProjectSnapshot.FromOptions(options, documentSource) @@ -2302,11 +2291,8 @@ type internal TransparentCompiler } member this.GetBackgroundParseResultsForFileInProject - ( - fileName: string, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, options: FSharpProjectOptions, userOpName: string) + : Async = async { let! snapshot = FSharpProjectSnapshot.FromOptions(options, documentSource) @@ -2314,12 +2300,8 @@ type internal TransparentCompiler } member this.GetCachedCheckFileResult - ( - builder: IncrementalBuilder, - fileName: string, - sourceText: ISourceText, - options: FSharpProjectOptions - ) : Async<(FSharpParseFileResults * FSharpCheckFileResults) option> = + (builder: IncrementalBuilder, fileName: string, sourceText: ISourceText, options: FSharpProjectOptions) + : Async<(FSharpParseFileResults * FSharpCheckFileResults) option> = async { ignore builder @@ -2334,6 +2316,7 @@ type internal TransparentCompiler ( fileName: string, sourceText: ISourceText, + caret: Position option, previewEnabled: bool option, loadedTimeStamp: DateTime option, otherFlags: string array option, @@ -2351,6 +2334,7 @@ type internal TransparentCompiler bc.GetProjectSnapshotFromScript( fileName, SourceTextNew.ofISourceText sourceText, + caret, DocumentSource.FileSystem, previewEnabled, loadedTimeStamp, @@ -2371,6 +2355,7 @@ type internal TransparentCompiler ( fileName: string, sourceText: ISourceTextNew, + caret: Position option, documentSource: DocumentSource, previewEnabled: bool option, loadedTimeStamp: DateTime option, @@ -2514,11 +2499,8 @@ type internal TransparentCompiler } member this.GetSemanticClassificationForFile - ( - fileName: string, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, options: FSharpProjectOptions, userOpName: string) + : Async = async { ignore userOpName @@ -2540,13 +2522,8 @@ type internal TransparentCompiler backgroundCompiler.NotifyProjectCleaned(options, userOpName) member this.ParseAndCheckFileInProject - ( - fileName: string, - fileVersion: int, - sourceText: ISourceText, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, fileVersion: int, sourceText: ISourceText, options: FSharpProjectOptions, userOpName: string) + : Async = async { let! snapshot = FSharpProjectSnapshot.FromOptions(options, fileName, fileVersion, sourceText, documentSource) @@ -2575,29 +2552,16 @@ type internal TransparentCompiler this.ParseFile(fileName, projectSnapshot.ProjectSnapshot, userOpName) member this.ParseFile - ( - fileName: string, - sourceText: ISourceText, - options: FSharpParsingOptions, - cache: bool, - flatErrors: bool, - userOpName: string - ) : Async = + (fileName: string, sourceText: ISourceText, options: FSharpParsingOptions, cache: bool, flatErrors: bool, userOpName: string) + : Async = this.ParseFileWithoutProject(fileName, sourceText, options, cache, flatErrors, userOpName) member this.TryGetRecentCheckResultsForFile - ( - fileName: string, - options: FSharpProjectOptions, - sourceText: ISourceText option, - userOpName: string - ) : (FSharpParseFileResults * FSharpCheckFileResults * SourceTextHash) option = + (fileName: string, options: FSharpProjectOptions, sourceText: ISourceText option, userOpName: string) + : (FSharpParseFileResults * FSharpCheckFileResults * SourceTextHash) option = backgroundCompiler.TryGetRecentCheckResultsForFile(fileName, options, sourceText, userOpName) member this.TryGetRecentCheckResultsForFile - ( - fileName: string, - projectSnapshot: FSharpProjectSnapshot, - userOpName: string - ) : (FSharpParseFileResults * FSharpCheckFileResults) option = + (fileName: string, projectSnapshot: FSharpProjectSnapshot, userOpName: string) + : (FSharpParseFileResults * FSharpCheckFileResults) option = TryGetRecentCheckResultsForFile(fileName, projectSnapshot, userOpName) diff --git a/src/Compiler/Service/TransparentCompiler.fsi b/src/Compiler/Service/TransparentCompiler.fsi index 93df10b29e2..8703df0fe7f 100644 --- a/src/Compiler/Service/TransparentCompiler.fsi +++ b/src/Compiler/Service/TransparentCompiler.fsi @@ -156,8 +156,11 @@ type internal CompilerCaches = member ParseAndCheckAllFilesInProject: AsyncMemoizeDisabled member ParseAndCheckFileInProject: - AsyncMemoize<(string * FSharpProjectIdentifier), string * string, (FSharpParseFileResults * - FSharpCheckFileAnswer)> + AsyncMemoize< + (string * FSharpProjectIdentifier), + string * string, + (FSharpParseFileResults * FSharpCheckFileAnswer) + > member ParseAndCheckProject: AsyncMemoize diff --git a/src/Compiler/Service/service.fs b/src/Compiler/Service/service.fs index 4835b784bf8..1e053fde7ff 100644 --- a/src/Compiler/Service/service.fs +++ b/src/Compiler/Service/service.fs @@ -389,14 +389,8 @@ type FSharpChecker /// Typecheck a source code file, returning a handle to the results of the /// parse including the reconstructed types in the file. member _.CheckFileInProjectAllowingStaleCachedResults - ( - parseResults: FSharpParseFileResults, - fileName: string, - fileVersion: int, - source: string, - options: FSharpProjectOptions, - ?userOpName: string - ) = + (parseResults: FSharpParseFileResults, fileName: string, fileVersion: int, source: string, options: FSharpProjectOptions, ?userOpName: string) + = let userOpName = defaultArg userOpName "Unknown" backgroundCompiler.CheckFileInProjectAllowingStaleCachedResults( @@ -426,13 +420,8 @@ type FSharpChecker /// Typecheck a source code file, returning a handle to the results of the /// parse including the reconstructed types in the file. member _.ParseAndCheckFileInProject - ( - fileName: string, - fileVersion: int, - sourceText: ISourceText, - options: FSharpProjectOptions, - ?userOpName: string - ) = + (fileName: string, fileVersion: int, sourceText: ISourceText, options: FSharpProjectOptions, ?userOpName: string) + = let userOpName = defaultArg userOpName "Unknown" backgroundCompiler.ParseAndCheckFileInProject(fileName, fileVersion, sourceText, options, userOpName) @@ -453,14 +442,8 @@ type FSharpChecker backgroundCompiler.ParseAndCheckProject(projectSnapshot, userOpName) member _.FindBackgroundReferencesInFile - ( - fileName: string, - options: FSharpProjectOptions, - symbol: FSharpSymbol, - ?canInvalidateProject: bool, - ?fastCheck: bool, - ?userOpName: string - ) = + (fileName: string, options: FSharpProjectOptions, symbol: FSharpSymbol, ?canInvalidateProject: bool, ?fastCheck: bool, ?userOpName: string) + = let canInvalidateProject = defaultArg canInvalidateProject true let userOpName = defaultArg userOpName "Unknown" @@ -509,6 +492,7 @@ type FSharpChecker ( fileName, source, + ?caret, ?previewEnabled, ?loadedTimeStamp, ?otherFlags, @@ -524,6 +508,7 @@ type FSharpChecker backgroundCompiler.GetProjectOptionsFromScript( fileName, source, + caret, previewEnabled, loadedTimeStamp, otherFlags, @@ -540,6 +525,7 @@ type FSharpChecker ( fileName, source, + ?caret, ?documentSource, ?previewEnabled, ?loadedTimeStamp, @@ -557,6 +543,7 @@ type FSharpChecker backgroundCompiler.GetProjectSnapshotFromScript( fileName, source, + caret, documentSource, previewEnabled, loadedTimeStamp, diff --git a/src/Compiler/Service/service.fsi b/src/Compiler/Service/service.fsi index 58c4a8c1dfb..69ae46b16b5 100644 --- a/src/Compiler/Service/service.fsi +++ b/src/Compiler/Service/service.fsi @@ -226,6 +226,7 @@ type public FSharpChecker = /// /// Used to differentiate between scripts, to consider each script a separate project. Also used in formatted error messages. /// The source for the file. + /// The editor location for the cursor if available. /// Is the preview compiler enabled. /// Indicates when the script was loaded into the editing environment, /// so that an 'unload' and 'reload' action will cause the script to be considered as a new project, @@ -240,6 +241,7 @@ type public FSharpChecker = member GetProjectOptionsFromScript: fileName: string * source: ISourceText * + ?caret: Position * ?previewEnabled: bool * ?loadedTimeStamp: DateTime * ?otherFlags: string[] * @@ -253,6 +255,7 @@ type public FSharpChecker = /// Used to differentiate between scripts, to consider each script a separate project. Also used in formatted error messages. /// The source for the file. + /// The editor location for the cursor if available. /// DocumentSource to load any additional files. /// Is the preview compiler enabled. /// Indicates when the script was loaded into the editing environment, @@ -269,6 +272,7 @@ type public FSharpChecker = member GetProjectSnapshotFromScript: fileName: string * source: ISourceTextNew * + ?caret: Position * ?documentSource: DocumentSource * ?previewEnabled: bool * ?loadedTimeStamp: DateTime * diff --git a/src/Compiler/Symbols/FSharpDiagnostic.fsi b/src/Compiler/Symbols/FSharpDiagnostic.fsi index 8c79ee95232..0118cc41cf3 100644 --- a/src/Compiler/Symbols/FSharpDiagnostic.fsi +++ b/src/Compiler/Symbols/FSharpDiagnostic.fsi @@ -46,9 +46,7 @@ module public ExtendedData = /// Contextually-relevant data to each particular diagnostic [] - type public IFSharpDiagnosticExtendedData = - interface - end + type public IFSharpDiagnosticExtendedData = interface end /// Additional data for diagnostics about obsolete attributes. [] diff --git a/src/Compiler/SyntaxTree/LexHelpers.fs b/src/Compiler/SyntaxTree/LexHelpers.fs index f7f090a6b00..faf85ad811d 100644 --- a/src/Compiler/SyntaxTree/LexHelpers.fs +++ b/src/Compiler/SyntaxTree/LexHelpers.fs @@ -77,15 +77,8 @@ type LongUnicodeLexResult = | Invalid let mkLexargs - ( - conditionalDefines, - indentationSyntaxStatus, - resourceManager, - ifdefStack, - diagnosticsLogger, - pathMap: PathMap, - applyLineDirectives - ) = + (conditionalDefines, indentationSyntaxStatus, resourceManager, ifdefStack, diagnosticsLogger, pathMap: PathMap, applyLineDirectives) + = { conditionalDefines = conditionalDefines ifdefStack = ifdefStack @@ -499,7 +492,7 @@ module Keywords = 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/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index 1c0428eb835..a8a8724f58b 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -275,15 +275,8 @@ let mkSynMemberDefnGetSet let xmlDoc = grabXmlDocAtRangeStart (parseState, attrs, rangeStart) let tryMkSynMemberDefnMember - ( - mOptInline: range option, - optAttrs: SynAttributeList list, - (bindingPat, mBindLhs), - optReturnType, - mEquals, - expr, - mExpr - ) : (SynMemberDefn * Ident option) option = + (mOptInline: range option, optAttrs: SynAttributeList list, (bindingPat, mBindLhs), optReturnType, mEquals, expr, mExpr) + : (SynMemberDefn * Ident option) option = let optInline = Option.isSome opt_inline || Option.isSome mOptInline // optional attributes are only applied to getters and setters // the "top level" attrs will be applied to both @@ -810,13 +803,8 @@ let checkEndOfFileError t = type BindingSet = BindingSetPreAttrs of range * bool * bool * (SynAttributes -> SynAccess option -> SynAttributes * SynBinding list) * range let mkClassMemberLocalBindings - ( - isStatic, - initialRangeOpt, - attrs, - vis, - BindingSetPreAttrs(_, isRec, isUse, declsPreAttrs, bindingSetRange) - ) = + (isStatic, initialRangeOpt, attrs, vis, BindingSetPreAttrs(_, isRec, isUse, declsPreAttrs, bindingSetRange)) + = let ignoredFreeAttrs, decls = declsPreAttrs attrs vis let mWhole = diff --git a/src/Compiler/SyntaxTree/UnicodeLexing.fs b/src/Compiler/SyntaxTree/UnicodeLexing.fs index 5a2d4393ee7..abb3d0e3d83 100644 --- a/src/Compiler/SyntaxTree/UnicodeLexing.fs +++ b/src/Compiler/SyntaxTree/UnicodeLexing.fs @@ -9,16 +9,13 @@ open Internal.Utilities.Text.Lexing type Lexbuf = LexBuffer let StringAsLexbuf (reportLibraryOnlyFeatures, langVersion, strictIndentation, s: string) = - LexBuffer - .FromChars(reportLibraryOnlyFeatures, langVersion, strictIndentation, s.ToCharArray()) + LexBuffer.FromChars(reportLibraryOnlyFeatures, langVersion, strictIndentation, s.ToCharArray()) let FunctionAsLexbuf (reportLibraryOnlyFeatures, langVersion, strictIndentation, bufferFiller) = - LexBuffer - .FromFunction(reportLibraryOnlyFeatures, langVersion, strictIndentation, bufferFiller) + LexBuffer.FromFunction(reportLibraryOnlyFeatures, langVersion, strictIndentation, bufferFiller) let SourceTextAsLexbuf (reportLibraryOnlyFeatures, langVersion, strictIndentation, sourceText) = - LexBuffer - .FromSourceText(reportLibraryOnlyFeatures, langVersion, strictIndentation, sourceText) + LexBuffer.FromSourceText(reportLibraryOnlyFeatures, langVersion, strictIndentation, sourceText) let StreamReaderAsLexbuf (reportLibraryOnlyFeatures, langVersion, strictIndentation, reader: StreamReader) = let mutable isFinished = false diff --git a/src/Compiler/TypedTree/TcGlobals.fsi b/src/Compiler/TypedTree/TcGlobals.fsi index b172536d4f0..b8c3610ef91 100644 --- a/src/Compiler/TypedTree/TcGlobals.fsi +++ b/src/Compiler/TypedTree/TcGlobals.fsi @@ -835,7 +835,10 @@ type internal TcGlobals = member knownFSharpCoreModules: System.Collections.Generic.IDictionary member knownIntrinsics: - System.Collections.Concurrent.ConcurrentDictionary<(string * string option * string * int), FSharp.Compiler.TypedTree.ValRef> + System.Collections.Concurrent.ConcurrentDictionary< + (string * string option * string * int), + FSharp.Compiler.TypedTree.ValRef + > member knownWithNull: FSharp.Compiler.TypedTree.Nullness diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index 4cabe94d952..e5e330759dc 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -9150,41 +9150,34 @@ let IsUnionTypeWithNullAsTrueValue (g: TcGlobals) (tycon: Tycon) = let TyconCompilesInstanceMembersAsStatic g tycon = IsUnionTypeWithNullAsTrueValue g tycon let TcrefCompilesInstanceMembersAsStatic g (tcref: TyconRef) = TyconCompilesInstanceMembersAsStatic g tcref.Deref +let inline HasConstraint ([] predicate) (tp:Typar) = + tp.Constraints |> List.exists predicate + +let inline tryGetTyparTyWithConstraint g ([] predicate) ty = + match tryDestTyparTy g ty with + | ValueSome tp as x when HasConstraint predicate tp -> x + | _ -> ValueNone + +let inline IsTyparTyWithConstraint g ([] predicate) ty = + match tryDestTyparTy g ty with + | ValueSome tp -> HasConstraint predicate tp + | ValueNone -> false + // Note, isStructTy does not include type parameters with the ': struct' constraint // This predicate is used to detect those type parameters. -let isNonNullableStructTyparTy g ty = - match tryDestTyparTy g ty with - | ValueSome tp -> - tp.Constraints |> List.exists (function TyparConstraint.IsNonNullableStruct _ -> true | _ -> false) - | ValueNone -> - false +let IsNonNullableStructTyparTy g ty = ty |> IsTyparTyWithConstraint g _.IsIsNonNullableStruct // 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 - | TyparConstraint.SupportsNull _ -> true - | _ -> false) - | ValueNone -> - false +let IsReferenceTyparTy g ty = ty |> IsTyparTyWithConstraint g (fun tc -> tc.IsIsReferenceType || tc.IsSupportsNull) -let GetTyparTyIfSupportsNull g ty = - if isReferenceTyparTy g ty then - let tp = destTyparTy g ty - if tp.Constraints |> List.exists (function TyparConstraint.SupportsNull _ -> true | _ -> false) then - ValueSome tp - else ValueNone - else - ValueNone +let GetTyparTyIfSupportsNull g ty = ty |> tryGetTyparTyWithConstraint g _.IsSupportsNull let TypeNullNever g ty = let underlyingTy = stripTyEqnsAndMeasureEqns g ty isStructTy g underlyingTy || isByrefTy g underlyingTy || - isNonNullableStructTyparTy g ty + IsNonNullableStructTyparTy g ty /// The pre-nullness logic about whether a type admits the use of 'null' as a value. let TypeNullIsExtraValue g m ty = @@ -9244,7 +9237,7 @@ let changeWithNullReqTyToVariable g reqTy = 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))-> + | ValueSome t when t.IsCompilerGenerated && not(t |> HasConstraint _.IsSupportsNull) -> changeWithNullReqTyToVariable g reqTy | _ -> reqTy @@ -9366,8 +9359,9 @@ let rec TypeHasDefaultValueAux isNew g m ty = true)) || // Check for type variables with the ":struct" and "(new : unit -> 'T)" constraints - (isNonNullableStructTyparTy g ty && - (destTyparTy g ty).Constraints |> List.exists (function TyparConstraint.RequiresDefaultConstructor _ -> true | _ -> false)) + ( match ty |> tryGetTyparTyWithConstraint g _.IsIsNonNullableStruct with + | ValueSome tp -> tp |> HasConstraint _.IsRequiresDefaultConstructor + | ValueNone -> false) let TypeHasDefaultValue (g: TcGlobals) m ty = TypeHasDefaultValueAux false g m ty @@ -9984,7 +9978,7 @@ let isCompiledOrWitnessPassingConstraint (g: TcGlobals) cx = // FSharpTypeFunc, but rather bake a "local type function" for each TyLambda abstraction. let IsGenericValWithGenericConstraints g (v: Val) = isForallTy g v.Type && - v.Type |> destForallTy g |> fst |> List.exists (fun tp -> List.exists (isCompiledOrWitnessPassingConstraint g) tp.Constraints) + v.Type |> destForallTy g |> fst |> List.exists (fun tp -> HasConstraint (isCompiledOrWitnessPassingConstraint g) tp) // Does a type support a given interface? type Entity with diff --git a/src/Compiler/TypedTree/TypedTreeOps.fsi b/src/Compiler/TypedTree/TypedTreeOps.fsi index 7e98ce5bc78..c67ccb30800 100755 --- a/src/Compiler/TypedTree/TypedTreeOps.fsi +++ b/src/Compiler/TypedTree/TypedTreeOps.fsi @@ -1734,13 +1734,18 @@ val isStructOrEnumTyconTy: TcGlobals -> TType -> bool /// /// Note, isStructTy does not include type parameters with the ': struct' constraint /// This predicate is used to detect those type parameters. -val isNonNullableStructTyparTy: TcGlobals -> TType -> bool +val IsNonNullableStructTyparTy: TcGlobals -> TType -> bool + +val inline HasConstraint: [] predicate: (TyparConstraint -> bool) -> Typar -> bool + +val inline IsTyparTyWithConstraint: + TcGlobals -> [] predicate: (TyparConstraint -> bool) -> TType -> bool /// Determine if a type is a variable type with the ': not struct' constraint. /// /// Note, isRefTy does not include type parameters with the ': not struct' constraint /// This predicate is used to detect those type parameters. -val isReferenceTyparTy: TcGlobals -> TType -> bool +val IsReferenceTyparTy: TcGlobals -> TType -> bool /// Determine if a type is an unmanaged type val isUnmanagedTy: TcGlobals -> TType -> bool diff --git a/src/Compiler/TypedTree/TypedTreePickle.fs b/src/Compiler/TypedTree/TypedTreePickle.fs index d2b3bd0ec79..ba09c7a6029 100644 --- a/src/Compiler/TypedTree/TypedTreePickle.fs +++ b/src/Compiler/TypedTree/TypedTreePickle.fs @@ -34,17 +34,19 @@ let verbose = false #endif let ffailwith fileName str = - let msg = FSComp.SR.pickleErrorReadingWritingMetadata(fileName, str) + let msg = FSComp.SR.pickleErrorReadingWritingMetadata (fileName, str) System.Diagnostics.Debug.Assert(false, msg) failwith msg // Fixup pickled data w.r.t. a set of CCU thunks indexed by name [] type PickledDataWithReferences<'rawData> = - { /// The data that uses a collection of CcuThunks internally - RawData: 'rawData - /// The assumptions that need to be fixed up - FixupThunks: CcuThunk [] } + { + /// The data that uses a collection of CcuThunks internally + RawData: 'rawData + /// The assumptions that need to be fixed up + FixupThunks: CcuThunk[] + } member x.Fixup loader = x.FixupThunks |> Array.iter (fun reqd -> reqd.Fixup(loader reqd.AssemblyName)) @@ -53,13 +55,15 @@ type PickledDataWithReferences<'rawData> = /// Like Fixup but loader may return None, in which case there is no fixup. member x.OptionalFixup loader = x.FixupThunks - |> Array.iter(fun reqd-> + |> Array.iter (fun reqd -> // Only fixup what needs fixing up if reqd.IsUnresolvedReference then match loader reqd.AssemblyName with | Some loaded -> - if reqd.IsUnresolvedReference then reqd.Fixup loaded - | _ -> () ) + if reqd.IsUnresolvedReference then + reqd.Fixup loaded + | _ -> ()) + x.RawData //--------------------------------------------------------------------------- @@ -68,108 +72,132 @@ type PickledDataWithReferences<'rawData> = [] type Table<'T when 'T: not null> = - { name: string - tbl: Dictionary<'T, int> - mutable rows: ResizeArray<'T> - mutable count: int } + { + name: string + tbl: Dictionary<'T, int> + mutable rows: ResizeArray<'T> + mutable count: int + } + member tbl.AsArray = Seq.toArray tbl.rows member tbl.Size = tbl.rows.Count + member tbl.Add x = let n = tbl.count tbl.count <- tbl.count + 1 tbl.tbl[x] <- n tbl.rows.Add x n + member tbl.FindOrAdd x = match tbl.tbl.TryGetValue x with | true, res -> res | _ -> tbl.Add x - static member Create n = - { name = n - tbl = Dictionary<_, _>(1000, HashIdentity.Structural) - rows= ResizeArray<_>(1000) - count=0 } + { + name = n + tbl = Dictionary<_, _>(1000, HashIdentity.Structural) + rows = ResizeArray<_>(1000) + count = 0 + } [] type InputTable<'T> = - { itbl_name: string - itbl_rows: 'T array } + { + itbl_name: string + itbl_rows: 'T array + } -let new_itbl n r = { itbl_name=n; itbl_rows=r } +let new_itbl n r = { itbl_name = n; itbl_rows = r } [] type NodeOutTable<'Data, 'Node> = - { NodeStamp : 'Node -> Stamp - NodeName : 'Node -> string - GetRange : 'Node -> range - Deref: 'Node -> 'Data - Name: string - Table: Table } + { + NodeStamp: 'Node -> Stamp + NodeName: 'Node -> string + GetRange: 'Node -> range + Deref: 'Node -> 'Data + Name: string + Table: Table + } + member x.Size = x.Table.Size // inline this to get known-type-information through to the HashMultiMap constructor - static member inline Create (stampF, nameF, rangeF, derefF, nm) = - { NodeStamp = stampF - NodeName = nameF - GetRange = rangeF - Deref = derefF - Name = nm - Table = Table<_>.Create nm } + static member inline Create(stampF, nameF, rangeF, derefF, nm) = + { + NodeStamp = stampF + NodeName = nameF + GetRange = rangeF + Deref = derefF + Name = nm + Table = Table<_>.Create nm + } [] type WriterState = - { os: ByteBuffer - osB: ByteBuffer - oscope: CcuThunk - occus: Table - oentities: NodeOutTable - otypars: NodeOutTable - ovals: NodeOutTable - oanoninfos: NodeOutTable - ostrings: Table - opubpaths: Table - onlerefs: Table - osimpletys: Table - oglobals : TcGlobals - mutable isStructThisArgPos : bool - ofile : string - /// Indicates if we are using in-memory format, where we store XML docs as well - oInMem : bool - } + { + os: ByteBuffer + osB: ByteBuffer + oscope: CcuThunk + occus: Table + oentities: NodeOutTable + otypars: NodeOutTable + ovals: NodeOutTable + oanoninfos: NodeOutTable + ostrings: Table + opubpaths: Table + onlerefs: Table + osimpletys: Table + oglobals: TcGlobals + mutable isStructThisArgPos: bool + ofile: string + /// Indicates if we are using in-memory format, where we store XML docs as well + oInMem: bool + } + let pfailwith st str = ffailwith st.ofile str [] type NodeInTable<'Data, 'Node> = - { LinkNode : 'Node -> 'Data -> unit - IsLinked : 'Node -> bool - Name : string - Nodes : 'Node[] } + { + LinkNode: 'Node -> 'Data -> unit + IsLinked: 'Node -> bool + Name: string + Nodes: 'Node[] + } + member x.Get n = x.Nodes[n] member x.Count = x.Nodes.Length - static member Create (mkEmpty, lnk, isLinked, nm, n) = - { LinkNode = lnk; IsLinked = isLinked; Name = nm; Nodes = Array.init n (fun _i -> mkEmpty() ) } + static member Create(mkEmpty, lnk, isLinked, nm, n) = + { + LinkNode = lnk + IsLinked = isLinked + Name = nm + Nodes = Array.init n (fun _i -> mkEmpty ()) + } [] type ReaderState = - { is: ByteStream - // secondary stream of information for F# 5.0 - isB: ByteStream - iilscope: ILScopeRef - iccus: InputTable - ientities: NodeInTable - itypars: NodeInTable - ivals: NodeInTable - ianoninfos: NodeInTable - istrings: InputTable - ipubpaths: InputTable - inlerefs: InputTable - isimpletys: InputTable - ifile: string - iILModule : ILModuleDef option // the Abstract IL metadata for the DLL being read - } + { + is: ByteStream + // secondary stream of information for F# 5.0 + isB: ByteStream + iilscope: ILScopeRef + iccus: InputTable + ientities: NodeInTable + itypars: NodeInTable + ivals: NodeInTable + ianoninfos: NodeInTable + istrings: InputTable + ipubpaths: InputTable + inlerefs: InputTable + isimpletys: InputTable + ifile: string + iILModule: ILModuleDef option // the Abstract IL metadata for the DLL being read + } let ufailwith st str = ffailwith st.ifile str @@ -186,23 +214,23 @@ let p_byteB b st = st.osB.EmitIntAsByte b let p_bool b st = p_byte (if b then 1 else 0) st /// Write an uncompressed integer to the main stream. -let prim_p_int32 i st = +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 /// Write an uncompressed integer to the B stream. -let prim_p_int32B i st = +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 +/// 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 @@ -212,17 +240,18 @@ let p_int32 n 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 +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 + 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 p_byte 0 st @@ -257,60 +286,98 @@ let p_uint8 (i: byte) st = p_byte (int i) st let p_int16 (i: int16) st = p_int32 (int32 i) st let p_uint16 (x: uint16) st = p_int32 (int32 x) st let p_uint32 (x: uint32) st = p_int32 (int32 x) st + let p_int64 (i: int64) st = p_int32 (int32 (i &&& 0xFFFFFFFFL)) st p_int32 (int32 (i >>> 32)) st let p_uint64 (x: uint64) st = p_int64 (int64 x) st -let bits_of_float32 (x: float32) = System.BitConverter.ToInt32(System.BitConverter.GetBytes x, 0) +let bits_of_float32 (x: float32) = + System.BitConverter.ToInt32(System.BitConverter.GetBytes x, 0) + let bits_of_float (x: float) = System.BitConverter.DoubleToInt64Bits x let p_single i st = p_int32 (bits_of_float32 i) st let p_char i st = p_uint16 (uint16 (int32 i)) st let inline p_tup2 p1 p2 (a, b) (st: WriterState) = - (p1 a st : unit); (p2 b st : unit) + (p1 a st: unit) + (p2 b st: unit) let inline p_tup3 p1 p2 p3 (a, b, c) (st: WriterState) = - (p1 a st : unit); (p2 b st : unit); (p3 c st : unit) - -let inline p_tup4 p1 p2 p3 p4 (a, b, c, d) (st: WriterState) = - (p1 a st : unit); (p2 b st : unit); (p3 c st : unit); (p4 d st : unit) - -let inline p_tup5 p1 p2 p3 p4 p5 (a, b, c, d, e) (st: WriterState) = - (p1 a st : unit); (p2 b st : unit); (p3 c st : unit); (p4 d st : unit); (p5 e st : unit) - -let inline p_tup6 p1 p2 p3 p4 p5 p6 (a, b, c, d, e, f) (st: WriterState) = - (p1 a st : unit); (p2 b st : unit); (p3 c st : unit); (p4 d st : unit); (p5 e st : unit); (p6 f st : unit) - -let inline p_tup9 p1 p2 p3 p4 p5 p6 p7 p8 p9 (a, b, c, d, e, f, x7, x8, x9) (st: WriterState) = - (p1 a st : unit); (p2 b st : unit); (p3 c st : unit); (p4 d st : unit); (p5 e st : unit); (p6 f st : unit); (p7 x7 st : unit); (p8 x8 st : unit); (p9 x9 st : unit) - -let inline p_tup11 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 (a, b, c, d, e, f, x7, x8, x9, x10, x11) (st: WriterState) = - (p1 a st : unit); (p2 b st : unit); (p3 c st : unit); (p4 d st : unit); (p5 e st : unit); (p6 f st : unit); (p7 x7 st : unit); (p8 x8 st : unit); (p9 x9 st : unit); (p10 x10 st : unit); (p11 x11 st : unit) + (p1 a st: unit) + (p2 b st: unit) + (p3 c st: unit) + +let inline p_tup4 p1 p2 p3 p4 (a, b, c, d) (st: WriterState) = + (p1 a st: unit) + (p2 b st: unit) + (p3 c st: unit) + (p4 d st: unit) + +let inline p_tup5 p1 p2 p3 p4 p5 (a, b, c, d, e) (st: WriterState) = + (p1 a st: unit) + (p2 b st: unit) + (p3 c st: unit) + (p4 d st: unit) + (p5 e st: unit) + +let inline p_tup6 p1 p2 p3 p4 p5 p6 (a, b, c, d, e, f) (st: WriterState) = + (p1 a st: unit) + (p2 b st: unit) + (p3 c st: unit) + (p4 d st: unit) + (p5 e st: unit) + (p6 f st: unit) + +let inline p_tup9 p1 p2 p3 p4 p5 p6 p7 p8 p9 (a, b, c, d, e, f, x7, x8, x9) (st: WriterState) = + (p1 a st: unit) + (p2 b st: unit) + (p3 c st: unit) + (p4 d st: unit) + (p5 e st: unit) + (p6 f st: unit) + (p7 x7 st: unit) + (p8 x8 st: unit) + (p9 x9 st: unit) + +let inline p_tup11 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 (a, b, c, d, e, f, x7, x8, x9, x10, x11) (st: WriterState) = + (p1 a st: unit) + (p2 b st: unit) + (p3 c st: unit) + (p4 d st: unit) + (p5 e st: unit) + (p6 f st: unit) + (p7 x7 st: unit) + (p8 x8 st: unit) + (p9 x9 st: unit) + (p10 x10 st: unit) + (p11 x11 st: unit) 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 = +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) +let u_bool st = + let b = u_byte st + 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) - let b2 = (u_byte st) - let b3 = (u_byte st) + let b0 = (u_byte st) + let b1 = (u_byte st) + let b2 = (u_byte 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 prim_u_int32B st = let b0 = u_byteB st let b1 = u_byteB st let b2 = u_byteB st @@ -319,37 +386,40 @@ let prim_u_int32B st = let u_int32 st = let b0 = u_byte st - if b0 <= 0x7F then b0 + + if b0 <= 0x7F then + b0 else if b0 <= 0xbf then let b0 = b0 &&& 0x7F let b1 = (u_byte st) (b0 <<< 8) ||| b1 else - assert(b0 = 0xFF) + 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 u_int32B st = let b0 = u_byteB st - if b0 <= 0x7F then b0 - else if b0 <= 0xbf then + + 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) + else + assert (b0 = 0xFF) prim_u_int32B st let u_byte_memory st = - let n = (u_int32 st) + let n = (u_int32 st) st.is.ReadBytes n -let u_bytes st = - (u_byte_memory st).ToArray() +let u_bytes st = (u_byte_memory st).ToArray() let u_prim_string st = - let len = (u_int32 st) + let len = (u_int32 st) st.is.ReadUtf8String len let u_int st = u_int32 st @@ -359,26 +429,33 @@ let u_uint8 st = byte (u_byte st) let u_int16 st = int16 (u_int32 st) let u_uint16 st = uint16 (u_int32 st) let u_uint32 st = uint32 (u_int32 st) + let u_int64 st = let b1 = (int64 (u_int32 st)) &&& 0xFFFFFFFFL let b2 = int64 (u_int32 st) b1 ||| (b2 <<< 32) let u_uint64 st = uint64 (u_int64 st) -let float32_of_bits (x: int32) = System.BitConverter.ToSingle(System.BitConverter.GetBytes x, 0) + +let float32_of_bits (x: int32) = + System.BitConverter.ToSingle(System.BitConverter.GetBytes x, 0) + let float_of_bits (x: int64) = System.BitConverter.Int64BitsToDouble x let u_single st = float32_of_bits (u_int32 st) let u_char st = char (int32 (u_uint16 st)) + let u_space n st = for i = 0 to n - 1 do let b = u_byte st + if b <> 0 then - warning(Error(FSComp.SR.pickleUnexpectedNonZero st.ifile, range0)) + warning (Error(FSComp.SR.pickleUnexpectedNonZero st.ifile, range0)) /// Represents space that was reserved but is now possibly used let u_used_space1 f st = let b = u_byte st + match b with | 0 -> None | 1 -> @@ -386,47 +463,102 @@ let u_used_space1 f st = u_space 1 st Some x | _ -> - warning(Error(FSComp.SR.pickleUnexpectedNonZero st.ifile, range0)); None + warning (Error(FSComp.SR.pickleUnexpectedNonZero st.ifile, range0)) + None +let inline u_tup2 p1 p2 (st: ReaderState) = + let a = p1 st + let b = p2 st + (a, b) -let inline u_tup2 p1 p2 (st: ReaderState) = let a = p1 st in let b = p2 st in (a, b) - -let inline u_tup3 p1 p2 p3 (st: ReaderState) = - let a = p1 st in let b = p2 st in let c = p3 st in (a, b, c) +let inline u_tup3 p1 p2 p3 (st: ReaderState) = + let a = p1 st + let b = p2 st + let c = p3 st + (a, b, c) let inline u_tup4 p1 p2 p3 p4 (st: ReaderState) = - let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in (a, b, c, d) + let a = p1 st + let b = p2 st + let c = p3 st + let d = p4 st + (a, b, c, d) let inline u_tup5 p1 p2 p3 p4 p5 (st: ReaderState) = - let a = p1 st - let b = p2 st - let c = p3 st - let d = p4 st - let e = p5 st - (a, b, c, d, e) + let a = p1 st + let b = p2 st + let c = p3 st + let d = p4 st + let e = p5 st + (a, b, c, d, e) let inline u_tup6 p1 p2 p3 p4 p5 p6 (st: ReaderState) = - let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in let e = p5 st in let f = p6 st in (a, b, c, d, e, f) + let a = p1 st + let b = p2 st + let c = p3 st + let d = p4 st + let e = p5 st + let f = p6 st + (a, b, c, d, e, f) let inline u_tup8 p1 p2 p3 p4 p5 p6 p7 p8 (st: ReaderState) = - let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in (a, b, c, d, e, f, x7, x8) + let a = p1 st + let b = p2 st + let c = p3 st + let d = p4 st + let e = p5 st + let f = p6 st + let x7 = p7 st + let x8 = p8 st + (a, b, c, d, e, f, x7, x8) let inline u_tup9 p1 p2 p3 p4 p5 p6 p7 p8 p9 (st: ReaderState) = - let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in let x9 = p9 st in (a, b, c, d, e, f, x7, x8, x9) + let a = p1 st + let b = p2 st + let c = p3 st + let d = p4 st + let e = p5 st + let f = p6 st + let x7 = p7 st + let x8 = p8 st + let x9 = p9 st + (a, b, c, d, e, f, x7, x8, x9) let inline u_tup13 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 (st: ReaderState) = - let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in - let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in - let x9 = p9 st in let x10 = p10 st in let x11 = p11 st in let x12 = p12 st in let x13 = p13 st in - (a, b, c, d, e, f, x7, x8, x9, x10, x11, x12, x13) + let a = p1 st + let b = p2 st + let c = p3 st + let d = p4 st + let e = p5 st + let f = p6 st + let x7 = p7 st + let x8 = p8 st + let x9 = p9 st + let x10 = p10 st + let x11 = p11 st + let x12 = p12 st + let x13 = p13 st + (a, b, c, d, e, f, x7, x8, x9, x10, x11, x12, x13) let inline u_tup17 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 (st: ReaderState) = - let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in - let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in - let x9 = p9 st in let x10 = p10 st in let x11 = p11 st in let x12 = p12 st in let x13 = p13 st in - let x14 = p14 st in let x15 = p15 st in let x16 = p16 st in let x17 = p17 st in - (a, b, c, d, e, f, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17) - + let a = p1 st + let b = p2 st + let c = p3 st + let d = p4 st + let e = p5 st + let f = p6 st + let x7 = p7 st + let x8 = p8 st + let x9 = p9 st + let x10 = p10 st + let x11 = p11 st + let x12 = p12 st + let x13 = p13 st + let x14 = p14 st + let x15 = p15 st + let x16 = p16 st + let x17 = p17 st + (a, b, c, d, e, f, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17) //--------------------------------------------------------------------------- // Pickle/unpickle operations for observably shared graph nodes @@ -435,8 +567,8 @@ let inline u_tup17 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 (s // exception Nope // ctxt is for debugging -let p_osgn_ref (_ctxt: string) (outMap : NodeOutTable<_, _>) x st = - let idx = outMap.Table.FindOrAdd (outMap.NodeStamp x) +let p_osgn_ref (_ctxt: string) (outMap: NodeOutTable<_, _>) x st = + let idx = outMap.Table.FindOrAdd(outMap.NodeStamp x) //if ((idx = 0) && outMap.Name = "oentities") then // let msg = // sprintf "idx %d#%d in table %s has name '%s', was defined at '%s' and is referenced from context %s\n" @@ -447,7 +579,7 @@ let p_osgn_ref (_ctxt: string) (outMap : NodeOutTable<_, _>) x st = // System.Diagnostics.Debug.Assert(false, msg ) p_int idx st -let p_osgn_decl (outMap : NodeOutTable<_, _>) p x st = +let p_osgn_decl (outMap: NodeOutTable<_, _>) p x st = let stamp = outMap.NodeStamp x let idx = outMap.Table.FindOrAdd stamp //dprintf "decl %d#%d in table %s has name %s\n" idx (outMap.NodeStamp x) outMap.Name (outMap.NodeName x) @@ -455,7 +587,10 @@ let p_osgn_decl (outMap : NodeOutTable<_, _>) p x st = let u_osgn_ref (inMap: NodeInTable<_, _>) st = let n = u_int st - if n < 0 || n >= inMap.Count then ufailwith st ("u_osgn_ref: out of range, table = "+inMap.Name+", n = "+string n) + + if n < 0 || n >= inMap.Count then + ufailwith st ("u_osgn_ref: out of range, table = " + inMap.Name + ", n = " + string n) + inMap.Get n let u_osgn_decl (inMap: NodeInTable<_, _>) u st = @@ -470,9 +605,20 @@ let u_osgn_decl (inMap: NodeInTable<_, _>) u st = //--------------------------------------------------------------------------- let encode_uniq (tbl: Table<_>) key = tbl.FindOrAdd key + let lookup_uniq st tbl n = let arr = tbl.itbl_rows - if n < 0 || n >= arr.Length then ufailwith st ("lookup_uniq in table "+tbl.itbl_name+" out of range, n = "+string n+ ", sizeof(tab) = " + string (Array.length arr)) + + if n < 0 || n >= arr.Length then + ufailwith + st + ("lookup_uniq in table " + + tbl.itbl_name + + " out of range, n = " + + string n + + ", sizeof(tab) = " + + string (Array.length arr)) + arr[n] //--------------------------------------------------------------------------- @@ -481,7 +627,7 @@ let lookup_uniq st tbl n = //------------------------------------------------------------------------- let p_array_core f (x: 'T[]) st = - for i = 0 to x.Length-1 do + for i = 0 to x.Length - 1 do f x[i] st let p_array f (x: 'T[]) st = @@ -496,26 +642,31 @@ let p_list f x st = p_int (List.length x) st p_list_core f x st -let p_listB 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 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 + match extraf with | None -> () | Some f -> f st + p_list_core f x st let p_List f (x: 'T list) st = p_list f x st -let p_wrap (f: 'T -> 'U) (p : 'U pickler) : 'T pickler = (fun x st -> p (f x) st) +let p_wrap (f: 'T -> 'U) (p: 'U pickler) : 'T pickler = (fun x st -> p (f x) st) + let p_option f x st = match x with | None -> p_byte 0 st - | Some h -> p_byte 1 st; f h st + | Some h -> + p_byte 1 st + f h st // Pickle lazy values in such a way that they can, in some future F# compiler version, be read back // lazily. However, a lazy reader is not used in this version because the value may contain the definitions of some @@ -544,7 +695,7 @@ let private p_lazy_impl p v st = p v st // Determine and fixup the length of the pickled data let idx2 = st.os.Position - st.os.FixupInt32 fixupPos1 (idx2-idx1) + st.os.FixupInt32 fixupPos1 (idx2 - idx1) // Determine and fixup the ranges of OSGN nodes defined within the lazy portion let otyconsIdx2 = st.oentities.Size let otyparsIdx2 = st.otypars.Size @@ -559,29 +710,39 @@ let private p_lazy_impl p v st = let p_lazy p x st = p_lazy_impl p (InterruptibleLazy.force x) st -let p_maybe_lazy p (x: MaybeLazy<_>) st = - p_lazy_impl p x.Value st +let p_maybe_lazy p (x: MaybeLazy<_>) st = p_lazy_impl p x.Value st let p_hole () = let mutable h = None - (fun f -> h <- Some f), (fun x st -> match h with Some f -> f x st | None -> pfailwith st "p_hole: unfilled hole") + + (fun f -> h <- Some f), + (fun x st -> + match h with + | Some f -> f x st + | None -> pfailwith st "p_hole: unfilled hole") let p_hole2 () = let mutable h = None - (fun f -> h <- Some f), (fun arg x st -> match h with Some f -> f arg x st | None -> pfailwith st "p_hole2: unfilled hole") + + (fun f -> h <- Some f), + (fun arg x st -> + match h with + | Some f -> f arg x st + | None -> pfailwith st "p_hole2: unfilled hole") let u_array_core f n st = let res = Array.zeroCreate n - for i = 0 to n-1 do + + for i = 0 to n - 1 do res[i] <- f st + res let u_array f st = let n = u_int st u_array_core f n st -let u_list_core f n st = - List.init n (fun _ -> f st) +let u_list_core f n st = List.init n (fun _ -> f st) let u_list f st = let n = u_int st @@ -594,11 +755,13 @@ let u_listB f st = let u_list_ext extra f st = let n = u_int st + let extraItem = if n &&& 0x80000000 = 0x80000000 then - Some (extra st) + Some(extra st) else None + let list = u_list_core f (n &&& 0x7FFFFFFF) st extraItem, list @@ -607,37 +770,45 @@ let u_List f st = u_list f st // new List<_> (u_array f st) // Mark up default constraints with a priority in reverse order: last gets 0 etc. See comment on TyparConstraint.DefaultsTo let u_list_revi f st = let n = u_int st - [ for i = 0 to n-1 do - yield f st (n-1-i) ] + [ + for i = 0 to n - 1 do + yield f st (n - 1 - i) + ] -let u_wrap (f: 'U -> 'T) (u : 'U unpickler) : 'T unpickler = (u >> f) +let u_wrap (f: 'U -> 'T) (u: 'U unpickler) : 'T unpickler = (u >> f) let u_option f st = let tag = u_byte st + match tag with | 0 -> None - | 1 -> Some (f st) + | 1 -> Some(f st) | n -> ufailwith st ("u_option: found number " + string n) let u_lazy u st = // Read the number of bytes in the record - let len = prim_u_int32 st // fixupPos1 + let len = prim_u_int32 st // fixupPos1 // These are the ranges of OSGN nodes defined within the lazily read portion of the graph let otyconsIdx1 = prim_u_int32 st // fixupPos2 let otyconsIdx2 = prim_u_int32 st // fixupPos3 let otyparsIdx1 = prim_u_int32 st // fixupPos4 let otyparsIdx2 = prim_u_int32 st // fixupPos5 - let ovalsIdx1 = prim_u_int32 st // fixupPos6 - let ovalsIdx2 = prim_u_int32 st // fixupPos7 + let ovalsIdx1 = prim_u_int32 st // fixupPos6 + let ovalsIdx2 = prim_u_int32 st // fixupPos7 ignore (len, otyconsIdx1, otyconsIdx2, otyparsIdx1, otyparsIdx2, ovalsIdx1, ovalsIdx2) InterruptibleLazy.FromValue(u st) let u_hole () = let mutable h = None - (fun f -> h <- Some f), (fun st -> match h with Some f -> f st | None -> ufailwith st "u_hole: unfilled hole") + + (fun f -> h <- Some f), + (fun st -> + match h with + | Some f -> f st + | None -> ufailwith st "u_hole: unfilled hole") //--------------------------------------------------------------------------- // Pickle/unpickle F# interface data @@ -649,7 +820,7 @@ let encode_string stringTab x = encode_uniq stringTab x let decode_string x = x let lookup_string st stringTab x = lookup_uniq st stringTab x let u_encoded_string = u_prim_string -let u_string st = lookup_uniq st st.istrings (u_int st) +let u_string st = lookup_uniq st st.istrings (u_int st) let u_strings = u_list u_string let p_encoded_string = p_prim_string let p_string s st = p_int (encode_string st.ostrings s) st @@ -659,11 +830,13 @@ let p_strings = p_list p_string // A huge number of these occur in pickled F# data, so make them unique let encode_ccuref ccuTab (x: CcuThunk) = encode_uniq ccuTab x.AssemblyName let lookup_ccuref st ccuTab x = lookup_uniq st ccuTab x + let u_encoded_ccuref st = match u_byte st with | 0 -> u_prim_string st | n -> ufailwith st ("u_encoded_ccuref: found number " + string n) -let u_ccuref st = lookup_uniq st st.iccus (u_int st) + +let u_ccuref st = lookup_uniq st st.iccus (u_int st) let p_encoded_ccuref x st = p_byte 0 st // leave a dummy tag to make room for future encodings of ccurefs @@ -673,17 +846,25 @@ let p_ccuref s st = p_int (encode_ccuref st.occus s) st // References to public items in this module // A huge number of these occur in pickled F# data, so make them unique -let decode_pubpath st stringTab a = PubPath(Array.map (lookup_string st stringTab) a) +let decode_pubpath st stringTab a = + PubPath(Array.map (lookup_string st stringTab) a) + let u_encoded_pubpath = u_array u_int let u_pubpath st = lookup_uniq st st.ipubpaths (u_int st) -let encode_pubpath stringTab pubpathTab (PubPath a) = encode_uniq pubpathTab (Array.map (encode_string stringTab) a) +let encode_pubpath stringTab pubpathTab (PubPath a) = + encode_uniq pubpathTab (Array.map (encode_string stringTab) a) + let p_encoded_pubpath = p_array p_int -let p_pubpath x st = p_int (encode_pubpath st.ostrings st.opubpaths x) st + +let p_pubpath x st = + p_int (encode_pubpath st.ostrings st.opubpaths x) st // References to other modules // A huge number of these occur in pickled F# data, so make them unique -let decode_nleref st ccuTab stringTab (a, b) = mkNonLocalEntityRef (lookup_ccuref st ccuTab a) (Array.map (lookup_string st stringTab) b) +let decode_nleref st ccuTab stringTab (a, b) = + mkNonLocalEntityRef (lookup_ccuref st ccuTab a) (Array.map (lookup_string st stringTab) b) + let lookup_nleref st nlerefTab x = lookup_uniq st nlerefTab x let u_encoded_nleref = u_tup2 u_int (u_array u_int) let u_nleref st = lookup_uniq st st.inlerefs (u_int st) @@ -695,7 +876,9 @@ let encode_nleref ccuTab stringTab nlerefTab thisCcu (nleref: NonLocalEntityRef) let nleref = match nleref.Deref.PublicPath with | Some pubpath when nleref.Deref.IsProvidedGeneratedTycon -> - if verbose then dprintfn "remapping pickled reference to provider-generated type %s" nleref.Deref.DisplayNameWithStaticParameters + if verbose then + dprintfn "remapping pickled reference to provider-generated type %s" nleref.Deref.DisplayNameWithStaticParameters + rescopePubPath thisCcu pubpath | _ -> nleref #else @@ -704,8 +887,11 @@ let encode_nleref ccuTab stringTab nlerefTab thisCcu (nleref: NonLocalEntityRef) let (NonLocalEntityRef(a, b)) = nleref encode_uniq nlerefTab (encode_ccuref ccuTab a, Array.map (encode_string stringTab) b) + let p_encoded_nleref = p_tup2 p_int (p_array p_int) -let p_nleref x st = p_int (encode_nleref st.occus st.ostrings st.onlerefs st.oscope x) st + +let p_nleref x st = + p_int (encode_nleref st.occus st.ostrings st.onlerefs st.oscope x) st // 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. @@ -714,121 +900,172 @@ let p_nleref x st = p_int (encode_nleref st.occus st.ostrings st.onlerefs st.osc // 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 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) + +let encode_simpletyp ccuTab stringTab nlerefTab simpleTyTab thisCcu a = + encode_uniq simpleTyTab (encode_nleref ccuTab stringTab nlerefTab thisCcu a) + let p_encoded_simpletyp x st = p_int x st -let p_simpletyp x st = p_int (encode_simpletyp st.occus st.ostrings st.onlerefs st.osimpletys st.oscope x) st + +let p_simpletyp x st = + p_int (encode_simpletyp st.occus st.ostrings st.onlerefs st.osimpletys st.oscope x) st /// Arbitrary value [] 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") - 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), id , "ovals") - oanoninfos=NodeOutTable<_, _>.Create((fun (v: AnonRecdTypeInfo) -> v.Stamp), (fun v -> string v.IlTypeName), (fun _ -> range0), id, "oanoninfos") - ostrings=Table<_>.Create "ostrings" - onlerefs=Table<_>.Create "onlerefs" - opubpaths=Table<_>.Create "opubpaths" - osimpletys=Table<_>.Create "osimpletys" - oglobals=g - ofile=file - oInMem=inMem - 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.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") - 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)" - opubpaths=Table<_>.Create "opubpaths (fake)" - onlerefs=Table<_>.Create "onlerefs (fake)" - osimpletys=Table<_>.Create "osimpletys (fake)" - oglobals=g - ofile=file - oInMem=inMem - isStructThisArgPos = false } - - let phase2bytes = - p_array p_encoded_ccuref ccuNameTab.AsArray st2 - // Add a 4th integer indicated by a negative 1st integer - let z1 = if nanoninfos > 0 then -ntycons-1 else ntycons - p_int z1 st2 - p_tup2 p_int p_int (ntypars, nvals) st2 - if nanoninfos > 0 then - p_int nanoninfos st2 - p_tup5 - (p_array p_encoded_string) - (p_array p_encoded_pubpath) - (p_array p_encoded_nleref) - (p_array p_encoded_simpletyp) - 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, phase1bytesB - -let check (ilscope: ILScopeRef) (inMap: NodeInTable<_,_>) = + 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") + 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), id, "ovals") + oanoninfos = + NodeOutTable<_, _> + .Create((fun (v: AnonRecdTypeInfo) -> v.Stamp), (fun v -> string v.IlTypeName), (fun _ -> range0), id, "oanoninfos") + ostrings = Table<_>.Create "ostrings" + onlerefs = Table<_>.Create "onlerefs" + opubpaths = Table<_>.Create "opubpaths" + osimpletys = Table<_>.Create "osimpletys" + oglobals = g + ofile = file + oInMem = inMem + 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.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") + 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)" + opubpaths = Table<_>.Create "opubpaths (fake)" + onlerefs = Table<_>.Create "onlerefs (fake)" + osimpletys = Table<_>.Create "osimpletys (fake)" + oglobals = g + ofile = file + oInMem = inMem + isStructThisArgPos = false + } + + let phase2bytes = + p_array p_encoded_ccuref ccuNameTab.AsArray st2 + // Add a 4th integer indicated by a negative 1st integer + let z1 = if nanoninfos > 0 then -ntycons - 1 else ntycons + p_int z1 st2 + p_tup2 p_int p_int (ntypars, nvals) st2 + + if nanoninfos > 0 then + p_int nanoninfos st2 + + p_tup5 + (p_array p_encoded_string) + (p_array p_encoded_pubpath) + (p_array p_encoded_nleref) + (p_array p_encoded_simpletyp) + 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, 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 - warning(Error(FSComp.SR.pickleMissingDefinition (i, inMap.Name, ilscope.QualifiedName), range0)) - // Note for compiler developers: to get information about which item this index relates to, - // enable the conditional in Pickle.p_osgn_ref to refer to the given index number and recompile - // 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) (phase1bytesB: ReadOnlyByteMemory) = + let n = inMap.Get i + + if not (inMap.IsLinked n) then + warning (Error(FSComp.SR.pickleMissingDefinition (i, inMap.Name, ilscope.QualifiedName), range0)) +// Note for compiler developers: to get information about which item this index relates to, +// enable the conditional in Pickle.p_osgn_ref to refer to the given index number and recompile +// 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) + (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) - itypars = NodeInTable<_, _>.Create (Typar.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "itypars", 0) - ivals = NodeInTable<_, _>.Create (Val.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "ivals", 0) - ianoninfos = NodeInTable<_, _>.Create(AnonRecdTypeInfo.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "ianoninfos", 0) - istrings = new_itbl "istrings (fake)" [| |] - inlerefs = new_itbl "inlerefs (fake)" [| |] - ipubpaths = new_itbl "ipubpaths (fake)" [| |] - isimpletys = new_itbl "isimpletys (fake)" [| |] - ifile = file - iILModule = ilModule } + { + 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) + itypars = + NodeInTable<_, _> + .Create(Typar.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "itypars", 0) + ivals = + NodeInTable<_, _> + .Create(Val.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "ivals", 0) + ianoninfos = + NodeInTable<_, _> + .Create(AnonRecdTypeInfo.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "ianoninfos", 0) + istrings = new_itbl "istrings (fake)" [||] + inlerefs = new_itbl "inlerefs (fake)" [||] + ipubpaths = new_itbl "ipubpaths (fake)" [||] + isimpletys = new_itbl "isimpletys (fake)" [||] + ifile = file + iILModule = ilModule + } + let ccuNameTab = u_array u_encoded_ccuref st2 let z1 = u_int st2 - let ntycons = if z1 < 0 then -z1-1 else z1 + let ntycons = if z1 < 0 then -z1 - 1 else z1 let ntypars, nvals = u_tup2 u_int u_int st2 let nanoninfos = if z1 < 0 then u_int st2 else 0 + let stringTab, pubpathTab, nlerefTab, simpleTyTab, phase1bytes = u_tup5 (u_array u_encoded_string) @@ -837,27 +1074,52 @@ let unpickleObjWithDanglingCcus file viewedScope (ilModule: ILModuleDef option) (u_array u_encoded_simpletyp) u_byte_memory st2 - let ccuTab = new_itbl "iccus" (Array.map CcuThunk.CreateDelayed ccuNameTab) - let stringTab = new_itbl "istrings" (Array.map decode_string stringTab) - let pubpathTab = new_itbl "ipubpaths" (Array.map (decode_pubpath st2 stringTab) pubpathTab) - let nlerefTab = new_itbl "inlerefs" (Array.map (decode_nleref st2 ccuTab stringTab) nlerefTab) - let simpletypTab = new_itbl "simpleTyTab" (Array.map (decode_simpletyp st2 ccuTab stringTab nlerefTab) simpleTyTab) + + let ccuTab = new_itbl "iccus" (Array.map CcuThunk.CreateDelayed ccuNameTab) + let stringTab = new_itbl "istrings" (Array.map decode_string stringTab) + + let pubpathTab = + new_itbl "ipubpaths" (Array.map (decode_pubpath st2 stringTab) pubpathTab) + + let nlerefTab = + new_itbl "inlerefs" (Array.map (decode_nleref st2 ccuTab stringTab) nlerefTab) + + let simpletypTab = + new_itbl "simpleTyTab" (Array.map (decode_simpletyp st2 ccuTab stringTab nlerefTab) simpleTyTab) + 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) - itypars = NodeInTable<_, _>.Create(Typar.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "itypars", ntypars) - ivals = NodeInTable<_, _>.Create(Val.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "ivals", nvals) - ianoninfos = NodeInTable<_, _>.Create(AnonRecdTypeInfo.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "ianoninfos", nanoninfos) - istrings = stringTab - ipubpaths = pubpathTab - inlerefs = nlerefTab - isimpletys = simpletypTab - ifile = file - iILModule = ilModule } + { + 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) + itypars = + NodeInTable<_, _> + .Create(Typar.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "itypars", ntypars) + ivals = + NodeInTable<_, _> + .Create(Val.NewUnlinked, (fun osgn tg -> osgn.Link tg), (fun osgn -> osgn.IsLinked), "ivals", nvals) + ianoninfos = + NodeInTable<_, _> + .Create( + AnonRecdTypeInfo.NewUnlinked, + (fun osgn tg -> osgn.Link tg), + (fun osgn -> osgn.IsLinked), + "ianoninfos", + nanoninfos + ) + istrings = stringTab + ipubpaths = pubpathTab + inlerefs = nlerefTab + isimpletys = simpletypTab + ifile = file + iILModule = ilModule + } + let res = u st1 check viewedScope st1.ientities check viewedScope st1.ientities @@ -865,8 +1127,10 @@ let unpickleObjWithDanglingCcus file viewedScope (ilModule: ILModuleDef option) check viewedScope st1.itypars res - {RawData=data; FixupThunks=ccuTab.itbl_rows } - + { + RawData = data + FixupThunks = ccuTab.itbl_rows + } //========================================================================= // PART II @@ -878,29 +1142,49 @@ let unpickleObjWithDanglingCcus file viewedScope (ilModule: ILModuleDef option) let p_ILPublicKey x st = match x with - | PublicKey b -> p_byte 0 st; p_bytes b st - | PublicKeyToken b -> p_byte 1 st; p_bytes b st + | PublicKey b -> + p_byte 0 st + p_bytes b st + | PublicKeyToken b -> + p_byte 1 st + p_bytes b st -let p_ILVersion (x: ILVersionInfo) st = p_tup4 p_uint16 p_uint16 p_uint16 p_uint16 (x.Major, x.Minor, x.Build, x.Revision) st +let p_ILVersion (x: ILVersionInfo) st = + p_tup4 p_uint16 p_uint16 p_uint16 p_uint16 (x.Major, x.Minor, x.Build, x.Revision) st let p_ILModuleRef (x: ILModuleRef) st = p_tup3 p_string p_bool (p_option p_bytes) (x.Name, x.HasMetadata, x.Hash) st let p_ILAssemblyRef (x: ILAssemblyRef) st = p_byte 0 st // leave a dummy tag to make room for future encodings of assembly refs - p_tup6 p_string (p_option p_bytes) (p_option p_ILPublicKey) p_bool (p_option p_ILVersion) (p_option p_string) - ( x.Name, x.Hash, x.PublicKey, x.Retargetable, x.Version, x.Locale) st + + p_tup6 + p_string + (p_option p_bytes) + (p_option p_ILPublicKey) + p_bool + (p_option p_ILVersion) + (p_option p_string) + (x.Name, x.Hash, x.PublicKey, x.Retargetable, x.Version, x.Locale) + st let p_ILScopeRef x st = match x with - | ILScopeRef.Local -> p_byte 0 st - | ILScopeRef.Module mref -> p_byte 1 st; p_ILModuleRef mref st - | ILScopeRef.Assembly aref -> p_byte 2 st; p_ILAssemblyRef aref st + | ILScopeRef.Local -> p_byte 0 st + | ILScopeRef.Module mref -> + p_byte 1 st + p_ILModuleRef mref st + | ILScopeRef.Assembly aref -> + p_byte 2 st + p_ILAssemblyRef aref st // Encode primary assembly as a normal assembly ref - | ILScopeRef.PrimaryAssembly -> p_byte 2 st; p_ILAssemblyRef st.oglobals.ilg.primaryAssemblyRef st + | ILScopeRef.PrimaryAssembly -> + p_byte 2 st + p_ILAssemblyRef st.oglobals.ilg.primaryAssemblyRef st let u_ILPublicKey st = let tag = u_byte st + match tag with | 0 -> u_bytes st |> PublicKey | 1 -> u_bytes st |> PublicKeyToken @@ -916,9 +1200,12 @@ let u_ILModuleRef st = let u_ILAssemblyRef st = let tag = u_byte st + match tag with | 0 -> - let a, b, c, d, e, f = u_tup6 u_string (u_option u_bytes) (u_option u_ILPublicKey) u_bool (u_option u_ILVersion) (u_option u_string) st + let a, b, c, d, e, f = + u_tup6 u_string (u_option u_bytes) (u_option u_ILPublicKey) u_bool (u_option u_ILVersion) (u_option u_string) st + ILAssemblyRef.Create(a, b, c, d, e, f) | _ -> ufailwith st "u_ILAssemblyRef" @@ -928,52 +1215,79 @@ let u_ILAssemblyRef st = let u_ILScopeRef st = let res = let tag = u_byte st + match tag with | 0 -> ILScopeRef.Local | 1 -> u_ILModuleRef st |> ILScopeRef.Module | 2 -> u_ILAssemblyRef st |> ILScopeRef.Assembly | _ -> ufailwith st "u_ILScopeRef" + let res = rescopeILScopeRef st.iilscope res res let p_ILHasThis x st = - p_byte (match x with - | ILThisConvention.Instance -> 0 - | ILThisConvention.InstanceExplicit -> 1 - | ILThisConvention.Static -> 2) st + p_byte + (match x with + | ILThisConvention.Instance -> 0 + | ILThisConvention.InstanceExplicit -> 1 + | ILThisConvention.Static -> 2) + st -let p_ILArrayShape = p_wrap (fun (ILArrayShape x) -> x) (p_list (p_tup2 (p_option p_int32) (p_option p_int32))) +let p_ILArrayShape = + p_wrap (fun (ILArrayShape x) -> x) (p_list (p_tup2 (p_option p_int32) (p_option p_int32))) let rec p_ILType ty st = match ty with - | ILType.Void -> p_byte 0 st - | ILType.Array (shape, ty) -> p_byte 1 st; p_tup2 p_ILArrayShape p_ILType (shape, ty) st - | ILType.Value tspec -> p_byte 2 st; p_ILTypeSpec tspec st - | ILType.Boxed tspec -> p_byte 3 st; p_ILTypeSpec tspec st - | ILType.Ptr ty -> p_byte 4 st; p_ILType ty st - | ILType.Byref ty -> p_byte 5 st; p_ILType ty st - | ILType.FunctionPointer csig -> p_byte 6 st; p_ILCallSig csig st - | ILType.TypeVar n -> p_byte 7 st; p_uint16 n st - | ILType.Modified (req, tref, ty) -> p_byte 8 st; p_tup3 p_bool p_ILTypeRef p_ILType (req, tref, ty) st + | ILType.Void -> p_byte 0 st + | ILType.Array(shape, ty) -> + p_byte 1 st + p_tup2 p_ILArrayShape p_ILType (shape, ty) st + | ILType.Value tspec -> + p_byte 2 st + p_ILTypeSpec tspec st + | ILType.Boxed tspec -> + p_byte 3 st + p_ILTypeSpec tspec st + | ILType.Ptr ty -> + p_byte 4 st + p_ILType ty st + | ILType.Byref ty -> + p_byte 5 st + p_ILType ty st + | ILType.FunctionPointer csig -> + p_byte 6 st + p_ILCallSig csig st + | ILType.TypeVar n -> + p_byte 7 st + p_uint16 n st + | ILType.Modified(req, tref, ty) -> + p_byte 8 st + p_tup3 p_bool p_ILTypeRef p_ILType (req, tref, ty) st and p_ILTypes tys = p_list p_ILType tys and p_ILBasicCallConv x st = - p_byte (match x with - | ILArgConvention.Default -> 0 - | ILArgConvention.CDecl -> 1 - | ILArgConvention.StdCall -> 2 - | ILArgConvention.ThisCall -> 3 - | ILArgConvention.FastCall -> 4 - | ILArgConvention.VarArg -> 5) st + p_byte + (match x with + | ILArgConvention.Default -> 0 + | ILArgConvention.CDecl -> 1 + | ILArgConvention.StdCall -> 2 + | ILArgConvention.ThisCall -> 3 + | ILArgConvention.FastCall -> 4 + | ILArgConvention.VarArg -> 5) + st -and p_ILCallConv (Callconv(x, y)) st = p_tup2 p_ILHasThis p_ILBasicCallConv (x, y) st +and p_ILCallConv (Callconv(x, y)) st = + p_tup2 p_ILHasThis p_ILBasicCallConv (x, y) st -and p_ILCallSig x st = p_tup3 p_ILCallConv p_ILTypes p_ILType (x.CallingConv, x.ArgTypes, x.ReturnType) st +and p_ILCallSig x st = + p_tup3 p_ILCallConv p_ILTypes p_ILType (x.CallingConv, x.ArgTypes, x.ReturnType) st -and p_ILTypeRef (x: ILTypeRef) st = p_tup3 p_ILScopeRef p_strings p_string (x.Scope, x.Enclosing, x.Name) st +and p_ILTypeRef (x: ILTypeRef) st = + p_tup3 p_ILScopeRef p_strings p_string (x.Scope, x.Enclosing, x.Name) st -and p_ILTypeSpec (a: ILTypeSpec) st = p_tup2 p_ILTypeRef p_ILTypes (a.TypeRef, a.GenericArgs) st +and p_ILTypeSpec (a: ILTypeSpec) st = + p_tup2 p_ILTypeRef p_ILTypes (a.TypeRef, a.GenericArgs) st let u_ILBasicCallConv st = match u_byte st with @@ -992,67 +1306,115 @@ let u_ILHasThis st = | 2 -> ILThisConvention.Static | _ -> ufailwith st "u_ILHasThis" -let u_ILCallConv st = let a, b = u_tup2 u_ILHasThis u_ILBasicCallConv st in Callconv(a, b) -let u_ILTypeRef st = let a, b, c = u_tup3 u_ILScopeRef u_strings u_string st in ILTypeRef.Create(a, b, c) -let u_ILArrayShape = u_wrap (ILArrayShape) (u_list (u_tup2 (u_option u_int32) (u_option u_int32))) +let u_ILCallConv st = + let a, b = u_tup2 u_ILHasThis u_ILBasicCallConv st + Callconv(a, b) +let u_ILTypeRef st = + let a, b, c = u_tup3 u_ILScopeRef u_strings u_string st + ILTypeRef.Create(a, b, c) + +let u_ILArrayShape = + u_wrap (ILArrayShape) (u_list (u_tup2 (u_option u_int32) (u_option u_int32))) let rec u_ILType st = let tag = u_byte st + match tag with | 0 -> ILType.Void - | 1 -> u_tup2 u_ILArrayShape u_ILType st |> ILType.Array - | 2 -> u_ILTypeSpec st |> ILType.Value - | 3 -> u_ILTypeSpec st |> mkILBoxedType - | 4 -> u_ILType st |> ILType.Ptr - | 5 -> u_ILType st |> ILType.Byref - | 6 -> u_ILCallSig st |> ILType.FunctionPointer - | 7 -> u_uint16 st |> mkILTyvarTy - | 8 -> u_tup3 u_bool u_ILTypeRef u_ILType st |> ILType.Modified + | 1 -> u_tup2 u_ILArrayShape u_ILType st |> ILType.Array + | 2 -> u_ILTypeSpec st |> ILType.Value + | 3 -> u_ILTypeSpec st |> mkILBoxedType + | 4 -> u_ILType st |> ILType.Ptr + | 5 -> u_ILType st |> ILType.Byref + | 6 -> u_ILCallSig st |> ILType.FunctionPointer + | 7 -> u_uint16 st |> mkILTyvarTy + | 8 -> u_tup3 u_bool u_ILTypeRef u_ILType st |> ILType.Modified | _ -> ufailwith st "u_ILType" and u_ILTypes st = u_list u_ILType st -and u_ILCallSig = u_wrap (fun (a, b, c) -> {CallingConv=a; ArgTypes=b; ReturnType=c}) (u_tup3 u_ILCallConv u_ILTypes u_ILType) - -and u_ILTypeSpec st = let a, b = u_tup2 u_ILTypeRef u_ILTypes st in ILTypeSpec.Create(a, b) +and u_ILCallSig = + u_wrap + (fun (a, b, c) -> + { + CallingConv = a + ArgTypes = b + ReturnType = c + }) + (u_tup3 u_ILCallConv u_ILTypes u_ILType) + +and u_ILTypeSpec st = + let a, b = u_tup2 u_ILTypeRef u_ILTypes st + ILTypeSpec.Create(a, b) + +let p_ILMethodRef (x: ILMethodRef) st = + p_tup6 + p_ILTypeRef + p_ILCallConv + p_int + p_string + p_ILTypes + p_ILType + (x.DeclaringTypeRef, x.CallingConv, x.GenericArity, x.Name, x.ArgTypes, x.ReturnType) + st +let p_ILFieldRef (x: ILFieldRef) st = + p_tup3 p_ILTypeRef p_string p_ILType (x.DeclaringTypeRef, x.Name, x.Type) st -let p_ILMethodRef (x: ILMethodRef) st = p_tup6 p_ILTypeRef p_ILCallConv p_int p_string p_ILTypes p_ILType (x.DeclaringTypeRef, x.CallingConv, x.GenericArity, x.Name, x.ArgTypes, x.ReturnType) st +let p_ILMethodSpec (x: ILMethodSpec) st = + p_tup3 p_ILMethodRef p_ILType p_ILTypes (x.MethodRef, x.DeclaringType, x.GenericArgs) st -let p_ILFieldRef (x: ILFieldRef) st = p_tup3 p_ILTypeRef p_string p_ILType (x.DeclaringTypeRef, x.Name, x.Type) st +let p_ILFieldSpec (x: ILFieldSpec) st = + p_tup2 p_ILFieldRef p_ILType (x.FieldRef, x.DeclaringType) st -let p_ILMethodSpec (x: ILMethodSpec) st = p_tup3 p_ILMethodRef p_ILType p_ILTypes (x.MethodRef, x.DeclaringType, x.GenericArgs) st +let p_ILBasicType x st = + p_int + (match x with + | DT_R -> 0 + | DT_I1 -> 1 + | DT_U1 -> 2 + | DT_I2 -> 3 + | DT_U2 -> 4 + | DT_I4 -> 5 + | DT_U4 -> 6 + | DT_I8 -> 7 + | DT_U8 -> 8 + | DT_R4 -> 9 + | DT_R8 -> 10 + | DT_I -> 11 + | DT_U -> 12 + | DT_REF -> 13) + st -let p_ILFieldSpec (x : ILFieldSpec) st = p_tup2 p_ILFieldRef p_ILType (x.FieldRef, x.DeclaringType) st +let p_ILVolatility x st = + p_int + (match x with + | Volatile -> 0 + | Nonvolatile -> 1) + st -let p_ILBasicType x st = - p_int (match x with - | DT_R -> 0 - | DT_I1 -> 1 - | DT_U1 -> 2 - | DT_I2 -> 3 - | DT_U2 -> 4 - | DT_I4 -> 5 - | DT_U4 -> 6 - | DT_I8 -> 7 - | DT_U8 -> 8 - | DT_R4 -> 9 - | DT_R8 -> 10 - | DT_I -> 11 - | DT_U -> 12 - | DT_REF -> 13) st - -let p_ILVolatility x st = p_int (match x with Volatile -> 0 | Nonvolatile -> 1) st -let p_ILReadonly x st = p_int (match x with ReadonlyAddress -> 0 | NormalAddress -> 1) st +let p_ILReadonly x st = + p_int + (match x with + | ReadonlyAddress -> 0 + | NormalAddress -> 1) + st let u_ILMethodRef st = - let x1, x2, x3, x4, x5, x6 = u_tup6 u_ILTypeRef u_ILCallConv u_int u_string u_ILTypes u_ILType st + let x1, x2, x3, x4, x5, x6 = + u_tup6 u_ILTypeRef u_ILCallConv u_int u_string u_ILTypes u_ILType st + ILMethodRef.Create(x1, x2, x4, x3, x5, x6) let u_ILFieldRef st = let x1, x2, x3 = u_tup3 u_ILTypeRef u_string u_ILType st - {DeclaringTypeRef=x1;Name=x2;Type=x3} + + { + DeclaringTypeRef = x1 + Name = x2 + Type = x3 + } let u_ILMethodSpec st = let x1, x2, x3 = u_tup3 u_ILMethodRef u_ILType u_ILTypes st @@ -1060,7 +1422,7 @@ let u_ILMethodSpec st = let u_ILFieldSpec st = let x1, x2 = u_tup2 u_ILFieldRef u_ILType st - {FieldRef=x1;DeclaringType=x2} + { FieldRef = x1; DeclaringType = x2 } let u_ILBasicType st = match u_int st with @@ -1080,113 +1442,254 @@ let u_ILBasicType st = | 13 -> DT_REF | _ -> ufailwith st "u_ILBasicType" -let u_ILVolatility st = (match u_int st with 0 -> Volatile | 1 -> Nonvolatile | _ -> ufailwith st "u_ILVolatility" ) -let u_ILReadonly st = (match u_int st with 0 -> ReadonlyAddress | 1 -> NormalAddress | _ -> ufailwith st "u_ILReadonly" ) - -let [] itag_nop = 0 -let [] itag_ldarg = 1 -let [] itag_ldnull = 2 -let [] itag_ilzero = 3 -let [] itag_call = 4 -let [] itag_add = 5 -let [] itag_sub = 6 -let [] itag_mul = 7 -let [] itag_div = 8 -let [] itag_div_un = 9 -let [] itag_rem = 10 -let [] itag_rem_un = 11 -let [] itag_and = 12 -let [] itag_or = 13 -let [] itag_xor = 14 -let [] itag_shl = 15 -let [] itag_shr = 16 -let [] itag_shr_un = 17 -let [] itag_neg = 18 -let [] itag_not = 19 -let [] itag_conv = 20 -let [] itag_conv_ovf = 22 -let [] itag_conv_ovf_un = 23 -let [] itag_callvirt = 24 -let [] itag_ldobj = 25 -let [] itag_ldstr = 26 -let [] itag_castclass = 27 -let [] itag_isinst = 28 -let [] itag_unbox = 29 -let [] itag_throw = 30 -let [] itag_ldfld = 31 -let [] itag_ldflda = 32 -let [] itag_stfld = 33 -let [] itag_ldsfld = 34 -let [] itag_ldsflda = 35 -let [] itag_stsfld = 36 -let [] itag_stobj = 37 -let [] itag_box = 38 -let [] itag_newarr = 39 -let [] itag_ldlen = 40 -let [] itag_ldelema = 41 -let [] itag_ckfinite = 42 -let [] itag_ldtoken = 43 -let [] itag_add_ovf = 44 -let [] itag_add_ovf_un = 45 -let [] itag_mul_ovf = 46 -let [] itag_mul_ovf_un = 47 -let [] itag_sub_ovf = 48 -let [] itag_sub_ovf_un = 49 -let [] itag_ceq = 50 -let [] itag_cgt = 51 -let [] itag_cgt_un = 52 -let [] itag_clt = 53 -let [] itag_clt_un = 54 -let [] itag_ldvirtftn = 55 -let [] itag_localloc = 56 -let [] itag_rethrow = 57 -let [] itag_sizeof = 58 -let [] itag_ldelem_any = 59 -let [] itag_stelem_any = 60 -let [] itag_unbox_any = 61 -let [] itag_ldlen_multi = 62 -let [] itag_initobj = 63 -let [] itag_initblk = 64 -let [] itag_cpobj = 65 -let [] itag_cpblk = 66 +let u_ILVolatility st = + (match u_int st with + | 0 -> Volatile + | 1 -> Nonvolatile + | _ -> ufailwith st "u_ILVolatility") + +let u_ILReadonly st = + (match u_int st with + | 0 -> ReadonlyAddress + | 1 -> NormalAddress + | _ -> ufailwith st "u_ILReadonly") + +[] +let itag_nop = 0 + +[] +let itag_ldarg = 1 + +[] +let itag_ldnull = 2 + +[] +let itag_ilzero = 3 + +[] +let itag_call = 4 + +[] +let itag_add = 5 + +[] +let itag_sub = 6 + +[] +let itag_mul = 7 + +[] +let itag_div = 8 + +[] +let itag_div_un = 9 + +[] +let itag_rem = 10 + +[] +let itag_rem_un = 11 + +[] +let itag_and = 12 + +[] +let itag_or = 13 + +[] +let itag_xor = 14 + +[] +let itag_shl = 15 + +[] +let itag_shr = 16 + +[] +let itag_shr_un = 17 + +[] +let itag_neg = 18 + +[] +let itag_not = 19 + +[] +let itag_conv = 20 + +[] +let itag_conv_ovf = 22 + +[] +let itag_conv_ovf_un = 23 + +[] +let itag_callvirt = 24 + +[] +let itag_ldobj = 25 + +[] +let itag_ldstr = 26 + +[] +let itag_castclass = 27 + +[] +let itag_isinst = 28 + +[] +let itag_unbox = 29 + +[] +let itag_throw = 30 + +[] +let itag_ldfld = 31 + +[] +let itag_ldflda = 32 + +[] +let itag_stfld = 33 + +[] +let itag_ldsfld = 34 + +[] +let itag_ldsflda = 35 + +[] +let itag_stsfld = 36 + +[] +let itag_stobj = 37 + +[] +let itag_box = 38 + +[] +let itag_newarr = 39 + +[] +let itag_ldlen = 40 + +[] +let itag_ldelema = 41 + +[] +let itag_ckfinite = 42 + +[] +let itag_ldtoken = 43 + +[] +let itag_add_ovf = 44 + +[] +let itag_add_ovf_un = 45 + +[] +let itag_mul_ovf = 46 + +[] +let itag_mul_ovf_un = 47 + +[] +let itag_sub_ovf = 48 + +[] +let itag_sub_ovf_un = 49 + +[] +let itag_ceq = 50 + +[] +let itag_cgt = 51 + +[] +let itag_cgt_un = 52 + +[] +let itag_clt = 53 + +[] +let itag_clt_un = 54 + +[] +let itag_ldvirtftn = 55 + +[] +let itag_localloc = 56 + +[] +let itag_rethrow = 57 + +[] +let itag_sizeof = 58 + +[] +let itag_ldelem_any = 59 + +[] +let itag_stelem_any = 60 + +[] +let itag_unbox_any = 61 + +[] +let itag_ldlen_multi = 62 + +[] +let itag_initobj = 63 + +[] +let itag_initblk = 64 + +[] +let itag_cpobj = 65 + +[] +let itag_cpblk = 66 let simple_instrs = - [ itag_add, AI_add - itag_add_ovf, AI_add_ovf - itag_add_ovf_un, AI_add_ovf_un - itag_and, AI_and - itag_div, AI_div - itag_div_un, AI_div_un - itag_ceq, AI_ceq - itag_cgt, AI_cgt - itag_cgt_un, AI_cgt_un - itag_clt, AI_clt - itag_clt_un, AI_clt_un - itag_mul, AI_mul - itag_mul_ovf, AI_mul_ovf - itag_mul_ovf_un, AI_mul_ovf_un - itag_rem, AI_rem - itag_rem_un, AI_rem_un - itag_shl, AI_shl - itag_shr, AI_shr - itag_shr_un, AI_shr_un - itag_sub, AI_sub - itag_sub_ovf, AI_sub_ovf - itag_sub_ovf_un, AI_sub_ovf_un - itag_xor, AI_xor - itag_or, AI_or - itag_neg, AI_neg - itag_not, AI_not - itag_ldnull, AI_ldnull - itag_ckfinite, AI_ckfinite - itag_nop, AI_nop - itag_localloc, I_localloc - itag_throw, I_throw - itag_ldlen, I_ldlen - itag_rethrow, I_rethrow - itag_rethrow, I_rethrow - itag_initblk, I_initblk (Aligned, Nonvolatile) - itag_cpblk, I_cpblk (Aligned, Nonvolatile) + [ + itag_add, AI_add + itag_add_ovf, AI_add_ovf + itag_add_ovf_un, AI_add_ovf_un + itag_and, AI_and + itag_div, AI_div + itag_div_un, AI_div_un + itag_ceq, AI_ceq + itag_cgt, AI_cgt + itag_cgt_un, AI_cgt_un + itag_clt, AI_clt + itag_clt_un, AI_clt_un + itag_mul, AI_mul + itag_mul_ovf, AI_mul_ovf + itag_mul_ovf_un, AI_mul_ovf_un + itag_rem, AI_rem + itag_rem_un, AI_rem_un + itag_shl, AI_shl + itag_shr, AI_shr + itag_shr_un, AI_shr_un + itag_sub, AI_sub + itag_sub_ovf, AI_sub_ovf + itag_sub_ovf_un, AI_sub_ovf_un + itag_xor, AI_xor + itag_or, AI_or + itag_neg, AI_neg + itag_not, AI_not + itag_ldnull, AI_ldnull + itag_ckfinite, AI_ckfinite + itag_nop, AI_nop + itag_localloc, I_localloc + itag_throw, I_throw + itag_ldlen, I_ldlen + itag_rethrow, I_rethrow + itag_rethrow, I_rethrow + itag_initblk, I_initblk(Aligned, Nonvolatile) + itag_cpblk, I_cpblk(Aligned, Nonvolatile) ] let encode_table = Dictionary<_, _>(300, HashIdentity.Structural) @@ -1195,95 +1698,163 @@ let encode_instr si = encode_table[si] let isNoArgInstr s = encode_table.ContainsKey s let decoders = - [ itag_ldarg, u_uint16 >> mkLdarg - itag_call, u_ILMethodSpec >> (fun a -> I_call (Normalcall, a, None)) - itag_callvirt, u_ILMethodSpec >> (fun a -> I_callvirt (Normalcall, a, None)) - itag_ldvirtftn, u_ILMethodSpec >> I_ldvirtftn - itag_conv, u_ILBasicType >> AI_conv - itag_conv_ovf, u_ILBasicType >> AI_conv_ovf - itag_conv_ovf_un, u_ILBasicType >> AI_conv_ovf_un - itag_ldfld, u_tup2 u_ILVolatility u_ILFieldSpec >> (fun (b, c) -> I_ldfld (Aligned, b, c)) - itag_ldflda, u_ILFieldSpec >> I_ldflda - itag_ldsfld, u_tup2 u_ILVolatility u_ILFieldSpec >> I_ldsfld - itag_ldsflda, u_ILFieldSpec >> I_ldsflda - itag_stfld, u_tup2 u_ILVolatility u_ILFieldSpec >> (fun (b, c) -> I_stfld (Aligned, b, c)) - itag_stsfld, u_tup2 u_ILVolatility u_ILFieldSpec >> I_stsfld - itag_ldtoken, u_ILType >> (ILToken.ILType >> I_ldtoken) - itag_ldstr, u_string >> I_ldstr - itag_box, u_ILType >> I_box - itag_unbox, u_ILType >> I_unbox - itag_unbox_any, u_ILType >> I_unbox_any - itag_newarr, u_tup2 u_ILArrayShape u_ILType >> I_newarr - itag_stelem_any, u_tup2 u_ILArrayShape u_ILType >> I_stelem_any - itag_ldelem_any, u_tup2 u_ILArrayShape u_ILType >> I_ldelem_any - itag_ldelema, u_tup3 u_ILReadonly u_ILArrayShape u_ILType >> (fun (a, b, c) -> I_ldelema(a, false, b, c)) - itag_castclass, u_ILType >> I_castclass - itag_isinst, u_ILType >> I_isinst - itag_ldobj, u_ILType >> (fun c -> I_ldobj (Aligned, Nonvolatile, c)) - itag_stobj, u_ILType >> (fun c -> I_stobj (Aligned, Nonvolatile, c)) - itag_sizeof, u_ILType >> I_sizeof - itag_ldlen_multi, u_tup2 u_int32 u_int32 >> EI_ldlen_multi - itag_ilzero, u_ILType >> EI_ilzero - itag_ilzero, u_ILType >> EI_ilzero - itag_initobj, u_ILType >> I_initobj - itag_cpobj, u_ILType >> I_cpobj - ] + [ + itag_ldarg, u_uint16 >> mkLdarg + itag_call, u_ILMethodSpec >> (fun a -> I_call(Normalcall, a, None)) + itag_callvirt, u_ILMethodSpec >> (fun a -> I_callvirt(Normalcall, a, None)) + itag_ldvirtftn, u_ILMethodSpec >> I_ldvirtftn + itag_conv, u_ILBasicType >> AI_conv + itag_conv_ovf, u_ILBasicType >> AI_conv_ovf + itag_conv_ovf_un, u_ILBasicType >> AI_conv_ovf_un + itag_ldfld, u_tup2 u_ILVolatility u_ILFieldSpec >> (fun (b, c) -> I_ldfld(Aligned, b, c)) + itag_ldflda, u_ILFieldSpec >> I_ldflda + itag_ldsfld, u_tup2 u_ILVolatility u_ILFieldSpec >> I_ldsfld + itag_ldsflda, u_ILFieldSpec >> I_ldsflda + itag_stfld, u_tup2 u_ILVolatility u_ILFieldSpec >> (fun (b, c) -> I_stfld(Aligned, b, c)) + itag_stsfld, u_tup2 u_ILVolatility u_ILFieldSpec >> I_stsfld + itag_ldtoken, u_ILType >> (ILToken.ILType >> I_ldtoken) + itag_ldstr, u_string >> I_ldstr + itag_box, u_ILType >> I_box + itag_unbox, u_ILType >> I_unbox + itag_unbox_any, u_ILType >> I_unbox_any + itag_newarr, u_tup2 u_ILArrayShape u_ILType >> I_newarr + itag_stelem_any, u_tup2 u_ILArrayShape u_ILType >> I_stelem_any + itag_ldelem_any, u_tup2 u_ILArrayShape u_ILType >> I_ldelem_any + itag_ldelema, + u_tup3 u_ILReadonly u_ILArrayShape u_ILType + >> (fun (a, b, c) -> I_ldelema(a, false, b, c)) + itag_castclass, u_ILType >> I_castclass + itag_isinst, u_ILType >> I_isinst + itag_ldobj, u_ILType >> (fun c -> I_ldobj(Aligned, Nonvolatile, c)) + itag_stobj, u_ILType >> (fun c -> I_stobj(Aligned, Nonvolatile, c)) + itag_sizeof, u_ILType >> I_sizeof + itag_ldlen_multi, u_tup2 u_int32 u_int32 >> EI_ldlen_multi + itag_ilzero, u_ILType >> EI_ilzero + itag_ilzero, u_ILType >> EI_ilzero + itag_initobj, u_ILType >> I_initobj + itag_cpobj, u_ILType >> I_cpobj + ] let decode_tab = - let tab = Array.init 256 (fun n -> (fun st -> ufailwith st ("no decoder for instruction "+string n))) - let add_instr (icode, f) = tab[icode] <- f + let tab = + Array.init 256 (fun n -> (fun st -> ufailwith st ("no decoder for instruction " + string n))) + + let add_instr (icode, f) = tab[icode] <- f List.iter add_instr decoders List.iter (fun (icode, mk) -> add_instr (icode, (fun _ -> mk))) simple_instrs tab let p_ILInstr x st = match x with - | si when isNoArgInstr si -> p_byte (encode_instr si) st - | I_call(Normalcall, mspec, None) -> p_byte itag_call st; p_ILMethodSpec mspec st - | I_callvirt(Normalcall, mspec, None) -> p_byte itag_callvirt st; p_ILMethodSpec mspec st - | I_ldvirtftn mspec -> p_byte itag_ldvirtftn st; p_ILMethodSpec mspec st - | I_ldarg x -> p_byte itag_ldarg st; p_uint16 x st - | AI_conv a -> p_byte itag_conv st; p_ILBasicType a st - | AI_conv_ovf a -> p_byte itag_conv_ovf st; p_ILBasicType a st - | AI_conv_ovf_un a -> p_byte itag_conv_ovf_un st; p_ILBasicType a st - | I_ldfld (Aligned, b, c) -> p_byte itag_ldfld st; p_tup2 p_ILVolatility p_ILFieldSpec (b, c) st - | I_ldsfld (a, b) -> p_byte itag_ldsfld st; p_tup2 p_ILVolatility p_ILFieldSpec (a, b) st - | I_stfld (Aligned, b, c) -> p_byte itag_stfld st; p_tup2 p_ILVolatility p_ILFieldSpec (b, c) st - | I_stsfld (a, b) -> p_byte itag_stsfld st; p_tup2 p_ILVolatility p_ILFieldSpec (a, b) st - | I_ldflda c -> p_byte itag_ldflda st; p_ILFieldSpec c st - | I_ldsflda a -> p_byte itag_ldsflda st; p_ILFieldSpec a st - | I_ldtoken (ILToken.ILType ty) -> p_byte itag_ldtoken st; p_ILType ty st - | I_ldstr s -> p_byte itag_ldstr st; p_string s st - | I_box ty -> p_byte itag_box st; p_ILType ty st - | I_unbox ty -> p_byte itag_unbox st; p_ILType ty st - | I_unbox_any ty -> p_byte itag_unbox_any st; p_ILType ty st - | I_newarr (a, b) -> p_byte itag_newarr st; p_tup2 p_ILArrayShape p_ILType (a, b) st - | I_stelem_any (a, b) -> p_byte itag_stelem_any st; p_tup2 p_ILArrayShape p_ILType (a, b) st - | I_ldelem_any (a, b) -> p_byte itag_ldelem_any st; p_tup2 p_ILArrayShape p_ILType (a, b) st - | I_ldelema (a, _, b, c) -> p_byte itag_ldelema st; p_tup3 p_ILReadonly p_ILArrayShape p_ILType (a, b, c) st - | I_castclass ty -> p_byte itag_castclass st; p_ILType ty st - | I_isinst ty -> p_byte itag_isinst st; p_ILType ty st - | I_ldobj (Aligned, Nonvolatile, c) -> p_byte itag_ldobj st; p_ILType c st - | I_stobj (Aligned, Nonvolatile, c) -> p_byte itag_stobj st; p_ILType c st - | I_sizeof ty -> p_byte itag_sizeof st; p_ILType ty st - | EI_ldlen_multi (n, m) -> p_byte itag_ldlen_multi st; p_tup2 p_int32 p_int32 (n, m) st - | EI_ilzero a -> p_byte itag_ilzero st; p_ILType a st - | I_initobj c -> p_byte itag_initobj st; p_ILType c st - | I_cpobj c -> p_byte itag_cpobj st; p_ILType c st + | si when isNoArgInstr si -> p_byte (encode_instr si) st + | I_call(Normalcall, mspec, None) -> + p_byte itag_call st + p_ILMethodSpec mspec st + | I_callvirt(Normalcall, mspec, None) -> + p_byte itag_callvirt st + p_ILMethodSpec mspec st + | I_ldvirtftn mspec -> + p_byte itag_ldvirtftn st + p_ILMethodSpec mspec st + | I_ldarg x -> + p_byte itag_ldarg st + p_uint16 x st + | AI_conv a -> + p_byte itag_conv st + p_ILBasicType a st + | AI_conv_ovf a -> + p_byte itag_conv_ovf st + p_ILBasicType a st + | AI_conv_ovf_un a -> + p_byte itag_conv_ovf_un st + p_ILBasicType a st + | I_ldfld(Aligned, b, c) -> + p_byte itag_ldfld st + p_tup2 p_ILVolatility p_ILFieldSpec (b, c) st + | I_ldsfld(a, b) -> + p_byte itag_ldsfld st + p_tup2 p_ILVolatility p_ILFieldSpec (a, b) st + | I_stfld(Aligned, b, c) -> + p_byte itag_stfld st + p_tup2 p_ILVolatility p_ILFieldSpec (b, c) st + | I_stsfld(a, b) -> + p_byte itag_stsfld st + p_tup2 p_ILVolatility p_ILFieldSpec (a, b) st + | I_ldflda c -> + p_byte itag_ldflda st + p_ILFieldSpec c st + | I_ldsflda a -> + p_byte itag_ldsflda st + p_ILFieldSpec a st + | I_ldtoken(ILToken.ILType ty) -> + p_byte itag_ldtoken st + p_ILType ty st + | I_ldstr s -> + p_byte itag_ldstr st + p_string s st + | I_box ty -> + p_byte itag_box st + p_ILType ty st + | I_unbox ty -> + p_byte itag_unbox st + p_ILType ty st + | I_unbox_any ty -> + p_byte itag_unbox_any st + p_ILType ty st + | I_newarr(a, b) -> + p_byte itag_newarr st + p_tup2 p_ILArrayShape p_ILType (a, b) st + | I_stelem_any(a, b) -> + p_byte itag_stelem_any st + p_tup2 p_ILArrayShape p_ILType (a, b) st + | I_ldelem_any(a, b) -> + p_byte itag_ldelem_any st + p_tup2 p_ILArrayShape p_ILType (a, b) st + | I_ldelema(a, _, b, c) -> + p_byte itag_ldelema st + p_tup3 p_ILReadonly p_ILArrayShape p_ILType (a, b, c) st + | I_castclass ty -> + p_byte itag_castclass st + p_ILType ty st + | I_isinst ty -> + p_byte itag_isinst st + p_ILType ty st + | I_ldobj(Aligned, Nonvolatile, c) -> + p_byte itag_ldobj st + p_ILType c st + | I_stobj(Aligned, Nonvolatile, c) -> + p_byte itag_stobj st + p_ILType c st + | I_sizeof ty -> + p_byte itag_sizeof st + p_ILType ty st + | EI_ldlen_multi(n, m) -> + p_byte itag_ldlen_multi st + p_tup2 p_int32 p_int32 (n, m) st + | EI_ilzero a -> + p_byte itag_ilzero st + p_ILType a st + | I_initobj c -> + p_byte itag_initobj st + p_ILType c st + | I_cpobj c -> + p_byte itag_cpobj st + p_ILType c st | i -> pfailwith st (sprintf "the IL instruction '%+A' cannot be emitted" i) let u_ILInstr st = let n = u_byte st - decode_tab[n] st - - + decode_tab[n]st //--------------------------------------------------------------------------- // Pickle/unpickle for F# types and module signatures //--------------------------------------------------------------------------- let p_Map_core pk pv xs st = - xs |> Map.iter (fun k v -> pk k st; pv v st) + xs + |> Map.iter (fun k v -> + pk k st + pv v st) let p_Map pk pv x st = p_int (Map.count x) st @@ -1302,64 +1873,99 @@ let u_Map uk uv st = let u_qlist uv = u_wrap QueueList.ofList (u_list uv) let u_namemap u = u_Map u_string u -let p_pos (x: pos) st = p_tup2 p_int p_int (x.Line, x.Column) st +let p_pos (x: pos) st = + p_tup2 p_int p_int (x.Line, x.Column) st let p_range (x: range) st = let fileName = PathMap.apply st.oglobals.pathMap x.FileName p_tup3 p_string p_pos p_pos (fileName, x.Start, x.End) st -let p_dummy_range : range pickler = fun _x _st -> () -let p_ident (x: Ident) st = p_tup2 p_string p_range (x.idText, x.idRange) st -let p_xmldoc (doc: XmlDoc) st = p_array p_string doc.UnprocessedLines st +let p_dummy_range: range pickler = fun _x _st -> () + +let p_ident (x: Ident) st = + p_tup2 p_string p_range (x.idText, x.idRange) st -let u_pos st = let a = u_int st in let b = u_int st in mkPos a b -let u_range st = let a = u_string st in let b = u_pos st in let c = u_pos st in mkRange a b c +let p_xmldoc (doc: XmlDoc) st = + p_array p_string doc.UnprocessedLines st + +let u_pos st = + let a = u_int st + let b = u_int st + mkPos a b + +let u_range st = + let a = u_string st + let b = u_pos st + let c = u_pos st + mkRange a b c // Most ranges (e.g. on optimization expressions) can be elided from stored data -let u_dummy_range : range unpickler = fun _st -> range0 -let u_ident st = let a = u_string st in let b = u_range st in ident(a, b) -let u_xmldoc st = XmlDoc (u_array u_string st, range0) +let u_dummy_range: range unpickler = fun _st -> range0 + +let u_ident st = + let a = u_string st + let b = u_range st + ident (a, b) + +let u_xmldoc st = XmlDoc(u_array u_string st, range0) let p_local_item_ref ctxt tab st = p_osgn_ref ctxt tab st let p_tcref ctxt (x: EntityRef) st = match x with - | ERefLocal x -> p_byte 0 st; p_local_item_ref ctxt st.oentities x st - | ERefNonLocal x -> p_byte 1 st; p_nleref x st + | ERefLocal x -> + p_byte 0 st + p_local_item_ref ctxt st.oentities x st + | ERefNonLocal x -> + p_byte 1 st + p_nleref x st + +let p_ucref (UnionCaseRef(a, b)) st = + p_tup2 (p_tcref "ucref") p_string (a, b) st + +let p_rfref (RecdFieldRef(a, b)) st = + p_tup2 (p_tcref "rfref") p_string (a, b) st -let p_ucref (UnionCaseRef(a, b)) st = p_tup2 (p_tcref "ucref") p_string (a, b) st -let p_rfref (RecdFieldRef(a, b)) st = p_tup2 (p_tcref "rfref") p_string (a, b) st -let p_tpref x st = p_local_item_ref "typar" st.otypars x st +let p_tpref x st = + p_local_item_ref "typar" st.otypars x st let u_local_item_ref tab st = u_osgn_ref tab st let u_tcref st = let tag = u_byte st + match tag with - | 0 -> u_local_item_ref st.ientities st |> ERefLocal - | 1 -> u_nleref st |> ERefNonLocal + | 0 -> u_local_item_ref st.ientities st |> ERefLocal + | 1 -> u_nleref st |> ERefNonLocal | _ -> ufailwith st "u_item_ref" -let u_ucref st = let a, b = u_tup2 u_tcref u_string st in UnionCaseRef(a, b) +let u_ucref st = + let a, b = u_tup2 u_tcref u_string st + UnionCaseRef(a, b) -let u_rfref st = let a, b = u_tup2 u_tcref u_string st in RecdFieldRef(a, b) +let u_rfref st = + let a, b = u_tup2 u_tcref u_string st + RecdFieldRef(a, b) let u_tpref st = u_local_item_ref st.itypars st // forward reference -let fill_p_ty2, p_ty2 = p_hole2() +let fill_p_ty2, p_ty2 = p_hole2 () let p_ty = p_ty2 false let p_tys = (p_list p_ty) -let fill_p_attribs, p_attribs = p_hole() +let fill_p_attribs, p_attribs = p_hole () // In F# 4.5, the type of the "this" pointer for structs is considered to be inref for the purposes of checking the implementation // of the struct. However for backwards compat reasons we can't serialize this as the type. let checkForInRefStructThisArg st ty = let g = st.oglobals let _, tauTy = tryDestForallTy g ty - isFunTy g tauTy && isFunTy g (rangeOfFunTy g tauTy) && isInByrefTy g (domainOfFunTy g tauTy) + + isFunTy g tauTy + && isFunTy g (rangeOfFunTy g tauTy) + && isInByrefTy g (domainOfFunTy g tauTy) let p_nonlocal_val_ref (nlv: NonLocalValOrMemberRef) st = let a = nlv.EnclosingEntity @@ -1370,22 +1976,28 @@ let p_nonlocal_val_ref (nlv: NonLocalValOrMemberRef) st = p_bool pkey.MemberIsOverride st p_string pkey.LogicalName st p_int pkey.TotalArgCount st + let isStructThisArgPos = match key.TypeForLinkage with | None -> false | Some ty -> checkForInRefStructThisArg st ty + p_option (p_ty2 isStructThisArgPos) key.TypeForLinkage st let rec p_vref ctxt x st = match x with - | VRefLocal x -> p_byte 0 st; p_local_item_ref ctxt st.ovals x st - | VRefNonLocal x -> p_byte 1 st; p_nonlocal_val_ref x st + | VRefLocal x -> + p_byte 0 st + p_local_item_ref ctxt st.ovals x st + | VRefNonLocal x -> + p_byte 1 st + p_nonlocal_val_ref x st let p_vrefs ctxt = p_list (p_vref ctxt) -let fill_u_ty, u_ty = u_hole() +let fill_u_ty, u_ty = u_hole () let u_tys = (u_list u_ty) -let fill_u_attribs, u_attribs = u_hole() +let fill_u_attribs, u_attribs = u_hole () let u_nonlocal_val_ref st : NonLocalValOrMemberRef = let a = u_tcref st @@ -1394,11 +2006,24 @@ let u_nonlocal_val_ref st : NonLocalValOrMemberRef = let b3 = u_string st let c = u_int st let d = u_option u_ty st - { EnclosingEntity = a - ItemKey=ValLinkageFullKey({ MemberParentMangledName=b1; MemberIsOverride=b2;LogicalName=b3; TotalArgCount=c }, d) } + + { + EnclosingEntity = a + ItemKey = + ValLinkageFullKey( + { + MemberParentMangledName = b1 + MemberIsOverride = b2 + LogicalName = b3 + TotalArgCount = c + }, + d + ) + } let u_vref st = let tag = u_byte st + match tag with | 0 -> u_local_item_ref st.ivals st |> VRefLocal | 1 -> u_nonlocal_val_ref st |> VRefNonLocal @@ -1407,18 +2032,22 @@ let u_vref st = let u_vrefs = u_list u_vref let p_kind x st = - p_byte (match x with - | TyparKind.Type -> 0 - | TyparKind.Measure -> 1) st + p_byte + (match x with + | TyparKind.Type -> 0 + | TyparKind.Measure -> 1) + st let p_member_kind x st = - p_byte (match x with - | SynMemberKind.Member -> 0 - | SynMemberKind.PropertyGet -> 1 - | SynMemberKind.PropertySet -> 2 - | SynMemberKind.Constructor -> 3 - | SynMemberKind.ClassConstructor -> 4 - | SynMemberKind.PropertyGetSet -> pfailwith st "pickling: SynMemberKind.PropertyGetSet only expected in parse trees") st + p_byte + (match x with + | SynMemberKind.Member -> 0 + | SynMemberKind.PropertyGet -> 1 + | SynMemberKind.PropertySet -> 2 + | SynMemberKind.Constructor -> 3 + | SynMemberKind.ClassConstructor -> 4 + | SynMemberKind.PropertyGetSet -> pfailwith st "pickling: SynMemberKind.PropertyGetSet only expected in parse trees") + st let u_kind st = match u_byte st with @@ -1436,24 +2065,31 @@ let u_member_kind st = | _ -> ufailwith st "u_member_kind" let p_MemberFlags (x: SynMemberFlags) st = - p_tup6 p_bool p_bool p_bool p_bool p_bool p_member_kind - (x.IsInstance, - false (* _x3UnusedBoolInFormat *), - x.IsDispatchSlot, - x.IsOverrideOrExplicitImpl, - x.IsFinal, - x.MemberKind) st -let u_MemberFlags st : SynMemberFlags= - let x2, _x3UnusedBoolInFormat, x4, x5, x6, x7 = u_tup6 u_bool u_bool u_bool u_bool u_bool u_member_kind st - { IsInstance=x2 - IsDispatchSlot=x4 - IsOverrideOrExplicitImpl=x5 - IsFinal=x6 - GetterOrSetterIsCompilerGenerated=false - MemberKind=x7 } - -let fill_u_Expr_hole, u_expr_fwd = u_hole() -let fill_p_Expr_hole, p_expr_fwd = p_hole() + p_tup6 + p_bool + p_bool + p_bool + p_bool + p_bool + p_member_kind + (x.IsInstance, false (* _x3UnusedBoolInFormat *) , x.IsDispatchSlot, x.IsOverrideOrExplicitImpl, x.IsFinal, x.MemberKind) + st + +let u_MemberFlags st : SynMemberFlags = + let x2, _x3UnusedBoolInFormat, x4, x5, x6, x7 = + u_tup6 u_bool u_bool u_bool u_bool u_bool u_member_kind st + + { + IsInstance = x2 + IsDispatchSlot = x4 + IsOverrideOrExplicitImpl = x5 + IsFinal = x6 + GetterOrSetterIsCompilerGenerated = false + MemberKind = x7 + } + +let fill_u_Expr_hole, u_expr_fwd = u_hole () +let fill_p_Expr_hole, p_expr_fwd = p_hole () let p_anonInfo_data (anonInfo: AnonRecdTypeInfo) st = p_tup3 p_ccuref p_bool (p_array p_ident) (anonInfo.Assembly, evalTupInfoIsStruct anonInfo.TupInfo, anonInfo.SortedIds) st @@ -1464,29 +2100,34 @@ let p_anonInfo x st = let p_trait_sln sln st = match sln with | ILMethSln(a, b, c, d, None) -> - p_byte 0 st; p_tup4 p_ty (p_option p_ILTypeRef) p_ILMethodRef p_tys (a, b, c, d) st + p_byte 0 st + p_tup4 p_ty (p_option p_ILTypeRef) p_ILMethodRef p_tys (a, b, c, d) st | FSMethSln(a, b, c, None) -> - p_byte 1 st; p_tup3 p_ty (p_vref "trait") p_tys (a, b, c) st - | BuiltInSln -> - p_byte 2 st + p_byte 1 st + p_tup3 p_ty (p_vref "trait") p_tys (a, b, c) st + | BuiltInSln -> p_byte 2 st | ClosedExprSln expr -> - p_byte 3 st; p_expr_fwd expr st + p_byte 3 st + p_expr_fwd expr st | FSRecdFieldSln(a, b, c) -> - p_byte 4 st; p_tup3 p_tys p_rfref p_bool (a, b, c) st + p_byte 4 st + p_tup3 p_tys p_rfref p_bool (a, b, c) st | FSAnonRecdFieldSln(a, b, c) -> - p_byte 5 st; p_tup3 p_anonInfo p_tys p_int (a, b, c) st + p_byte 5 st + p_tup3 p_anonInfo p_tys p_int (a, b, c) st | ILMethSln(a, b, c, d, Some e) -> - p_byte 6 st; p_tup5 p_ty (p_option p_ILTypeRef) p_ILMethodRef p_tys p_ty (a, b, c, d, e) st + p_byte 6 st + p_tup5 p_ty (p_option p_ILTypeRef) p_ILMethodRef p_tys p_ty (a, b, c, d, e) st | FSMethSln(a, b, c, Some d) -> - p_byte 7 st; p_tup4 p_ty (p_vref "trait") p_tys p_ty (a, b, c, d) st - + p_byte 7 st + p_tup4 p_ty (p_vref "trait") p_tys p_ty (a, b, c, d) st -let p_trait (TTrait(a, b, c, d, e, _, f)) st = +let p_trait (TTrait(a, b, c, d, e, _, f)) st = p_tup6 p_tys p_string p_MemberFlags p_tys (p_option p_ty) (p_option p_trait_sln) (a, b, c, d, e, f.Value) st let u_anonInfo_data st = let ccu, info, nms = u_tup3 u_ccuref u_bool (u_array u_ident) st - AnonRecdTypeInfo.Create (ccu, mkTupInfo info, nms) + AnonRecdTypeInfo.Create(ccu, mkTupInfo info, nms) let u_anonInfo st = u_osgn_decl st.ianoninfos u_anonInfo_data st @@ -1494,6 +2135,7 @@ let u_anonInfo st = // We have to store trait solutions since they can occur in optimization data let u_trait_sln st = let tag = u_byte st + match tag with | 0 -> let a, b, c, d = u_tup4 u_ty (u_option u_ILTypeRef) u_ILMethodRef u_tys st @@ -1501,16 +2143,14 @@ let u_trait_sln st = | 1 -> let a, b, c = u_tup3 u_ty u_vref u_tys st FSMethSln(a, b, c, None) - | 2 -> - BuiltInSln - | 3 -> - ClosedExprSln (u_expr_fwd st) + | 2 -> BuiltInSln + | 3 -> ClosedExprSln(u_expr_fwd st) | 4 -> let a, b, c = u_tup3 u_tys u_rfref u_bool st FSRecdFieldSln(a, b, c) | 5 -> - let a, b, c = u_tup3 u_anonInfo u_tys u_int st - FSAnonRecdFieldSln(a, b, c) + let a, b, c = u_tup3 u_anonInfo u_tys u_int st + FSAnonRecdFieldSln(a, b, c) | 6 -> let a, b, c, d, e = u_tup5 u_ty (u_option u_ILTypeRef) u_ILMethodRef u_tys u_ty st ILMethSln(a, b, c, d, Some e) @@ -1520,56 +2160,78 @@ let u_trait_sln st = | _ -> ufailwith st "u_trait_sln" let u_trait st = - let a, b, c, d, e, f = u_tup6 u_tys u_string u_MemberFlags u_tys (u_option u_ty) (u_option u_trait_sln) st - TTrait (a, b, c, d, e, ref None, ref f) + let a, b, c, d, e, f = + u_tup6 u_tys u_string u_MemberFlags u_tys (u_option u_ty) (u_option u_trait_sln) st + TTrait(a, b, c, d, e, ref None, ref f) -let p_rational q st = p_int32 (GetNumerator q) st; p_int32 (GetDenominator q) st +let p_rational q st = + p_int32 (GetNumerator q) st + p_int32 (GetDenominator q) st -let p_measure_con tcref st = p_byte 0 st; p_tcref "measure" tcref st +let p_measure_con tcref st = + p_byte 0 st + p_tcref "measure" tcref st -let p_measure_var v st = p_byte 3 st; p_tpref v st +let p_measure_var v st = + p_byte 3 st + p_tpref v st let p_measure_one = p_byte 4 // Pickle a unit-of-measure variable or constructor let p_measure_varcon unt st = - match unt with - | Measure.Const(tyconRef= tcref) -> p_measure_con tcref st - | Measure.Var v -> p_measure_var v st - | _ -> pfailwith st "p_measure_varcon: expected measure variable or constructor" + match unt with + | Measure.Const(tyconRef = tcref) -> p_measure_con tcref st + | Measure.Var v -> p_measure_var v st + | _ -> pfailwith st "p_measure_varcon: expected measure variable or constructor" // Pickle a positive integer power of a unit-of-measure variable or constructor let rec p_measure_pospower unt n st = - if n = 1 - then p_measure_varcon unt st - else p_byte 2 st; p_measure_varcon unt st; p_measure_pospower unt (n-1) st + if n = 1 then + p_measure_varcon unt st + else + p_byte 2 st + p_measure_varcon unt st + p_measure_pospower unt (n - 1) st // Pickle a non-zero integer power of a unit-of-measure variable or constructor let p_measure_intpower unt n st = - if n < 0 - then p_byte 1 st; p_measure_pospower unt (-n) st - else p_measure_pospower unt n st + if n < 0 then + p_byte 1 st + p_measure_pospower unt (-n) st + else + p_measure_pospower unt n st // Pickle a rational power of a unit-of-measure variable or constructor let rec p_measure_power unt q st = - if q = ZeroRational then p_measure_one st - elif GetDenominator q = 1 - then p_measure_intpower unt (GetNumerator q) st - else p_byte 5 st; p_measure_varcon unt st; p_rational q st + if q = ZeroRational then + p_measure_one st + elif GetDenominator q = 1 then + p_measure_intpower unt (GetNumerator q) st + else + p_byte 5 st + p_measure_varcon unt st + p_rational q st // Pickle a normalized unit-of-measure expression // Normalized means of the form cv1 ^ q1 * ... * cvn ^ qn // where q1, ..., qn are non-zero, and cv1, ..., cvn are distinct unit-of-measure variables or constructors let rec p_normalized_measure unt st = - let unt = stripUnitEqnsAux false unt - match unt with - | Measure.Const(tyconRef= tcref) -> p_measure_con tcref st - | Measure.Inv x -> p_byte 1 st; p_normalized_measure x st - | Measure.Prod(measure1= x1; measure2= x2) -> p_byte 2 st; p_normalized_measure x1 st; p_normalized_measure x2 st - | Measure.Var v -> p_measure_var v st - | Measure.One _ -> p_measure_one st - | Measure.RationalPower(measure= x; power= q) -> p_measure_power x q st + let unt = stripUnitEqnsAux false unt + + match unt with + | Measure.Const(tyconRef = tcref) -> p_measure_con tcref st + | Measure.Inv x -> + p_byte 1 st + p_normalized_measure x st + | Measure.Prod(measure1 = x1; measure2 = x2) -> + p_byte 2 st + p_normalized_measure x1 st + p_normalized_measure x2 st + | Measure.Var v -> p_measure_var v st + | Measure.One _ -> p_measure_one st + | Measure.RationalPower(measure = x; power = q) -> p_measure_power x q st // By normalizing the unit-of-measure and treating integer powers as a special case, // we ensure that the pickle format for rational powers of units (byte 5 followed by @@ -1577,80 +2239,116 @@ let rec p_normalized_measure unt st = // compatibility of formats with versions prior to F# 4.0. // // See https://github.com/dotnet/fsharp/issues/69 -let p_measure_expr unt st = p_normalized_measure (normalizeMeasure st.oglobals unt) st +let p_measure_expr unt st = + p_normalized_measure (normalizeMeasure st.oglobals unt) st let u_rational st = - let a, b = u_tup2 u_int32 u_int32 st in DivRational (intToRational a) (intToRational b) + let a, b = u_tup2 u_int32 u_int32 st + DivRational (intToRational a) (intToRational b) let rec u_measure_expr st = let tag = u_byte st + match tag with - | 0 -> let a = u_tcref st in Measure.Const(a, range0) - | 1 -> let a = u_measure_expr st in Measure.Inv a - | 2 -> let a, b = u_tup2 u_measure_expr u_measure_expr st in Measure.Prod (a, b, range0) - | 3 -> let a = u_tpref st in Measure.Var(a) + | 0 -> + let a = u_tcref st + Measure.Const(a, range0) + | 1 -> + let a = u_measure_expr st + Measure.Inv a + | 2 -> + let a, b = u_tup2 u_measure_expr u_measure_expr st + Measure.Prod(a, b, range0) + | 3 -> + let a = u_tpref st + Measure.Var(a) | 4 -> Measure.One(range0) - | 5 -> let a = u_measure_expr st in let b = u_rational st in Measure.RationalPower (a, b) + | 5 -> + let a = u_measure_expr st + let b = u_rational st + Measure.RationalPower(a, b) | _ -> ufailwith st "u_measure_expr" let p_tyar_constraint x st = match x with - | TyparConstraint.CoercesTo (a, _) -> p_byte 0 st; p_ty a st - | TyparConstraint.MayResolveMember(traitInfo, _) -> p_byte 1 st; p_trait traitInfo st - | TyparConstraint.DefaultsTo(_, rty, _) -> p_byte 2 st; p_ty rty st - | TyparConstraint.SupportsNull _ -> p_byte 3 st - | TyparConstraint.IsNonNullableStruct _ -> p_byte 4 st - | TyparConstraint.IsReferenceType _ -> p_byte 5 st - | TyparConstraint.RequiresDefaultConstructor _ -> p_byte 6 st - | TyparConstraint.SimpleChoice(tys, _) -> p_byte 7 st; p_tys tys st - | TyparConstraint.IsEnum(ty, _) -> p_byte 8 st; p_ty ty st - | TyparConstraint.IsDelegate(aty, bty, _) -> p_byte 9 st; p_ty aty st; p_ty bty st - | TyparConstraint.SupportsComparison _ -> p_byte 10 st - | TyparConstraint.SupportsEquality _ -> p_byte 11 st - | TyparConstraint.IsUnmanaged _ -> p_byte 12 st - + | TyparConstraint.CoercesTo(a, _) -> + p_byte 0 st + p_ty a st + | TyparConstraint.MayResolveMember(traitInfo, _) -> + p_byte 1 st + p_trait traitInfo st + | TyparConstraint.DefaultsTo(_, rty, _) -> + p_byte 2 st + p_ty rty st + | TyparConstraint.SupportsNull _ -> p_byte 3 st + | TyparConstraint.IsNonNullableStruct _ -> p_byte 4 st + | TyparConstraint.IsReferenceType _ -> p_byte 5 st + | TyparConstraint.RequiresDefaultConstructor _ -> p_byte 6 st + | TyparConstraint.SimpleChoice(tys, _) -> + p_byte 7 st + p_tys tys st + | TyparConstraint.IsEnum(ty, _) -> + p_byte 8 st + p_ty ty st + | TyparConstraint.IsDelegate(aty, bty, _) -> + p_byte 9 st + p_ty aty st + p_ty bty st + | TyparConstraint.SupportsComparison _ -> p_byte 10 st + | TyparConstraint.SupportsEquality _ -> p_byte 11 st + | TyparConstraint.IsUnmanaged _ -> p_byte 12 st + | TyparConstraint.NotSupportsNull _ - | TyparConstraint.AllowsRefStruct _ -> - failwith $"%A{x} constraints should only be emitted to streamB" + | TyparConstraint.AllowsRefStruct _ -> failwith $"%A{x} constraints should only be emitted to streamB" // Some extra F#9+ 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 - | TyparConstraint.AllowsRefStruct _ -> p_byteB 2 st +let p_tyar_constraintB x st = + match x with + | TyparConstraint.NotSupportsNull _ -> p_byteB 1 st + | TyparConstraint.AllowsRefStruct _ -> p_byteB 2 st | _ -> failwith "only NotSupportsNull and AllowsRefStruct constraints should be emitted to streamB" -let p_tyar_constraints cxs st = - let cxs1, cxs2 = cxs |> List.partition (function TyparConstraint.NotSupportsNull _ | TyparConstraint.AllowsRefStruct _ -> false | _ -> true) +let p_tyar_constraints cxs st = + let cxs1, cxs2 = + cxs + |> List.partition (function + | TyparConstraint.NotSupportsNull _ + | TyparConstraint.AllowsRefStruct _ -> false + | _ -> true) + p_list p_tyar_constraint cxs1 st // Some extra F#9+ 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 + match tag with - | 0 -> u_ty st |> (fun a _ -> TyparConstraint.CoercesTo (a, range0) ) - | 1 -> u_trait st |> (fun a _ -> TyparConstraint.MayResolveMember(a, range0)) - | 2 -> u_ty st |> (fun a ridx -> TyparConstraint.DefaultsTo(ridx, a, range0)) - | 3 -> (fun _ -> TyparConstraint.SupportsNull range0) - | 4 -> (fun _ -> TyparConstraint.IsNonNullableStruct range0) - | 5 -> (fun _ -> TyparConstraint.IsReferenceType range0) - | 6 -> (fun _ -> TyparConstraint.RequiresDefaultConstructor range0) - | 7 -> u_tys st |> (fun a _ -> TyparConstraint.SimpleChoice(a, range0)) - | 8 -> u_ty st |> (fun a _ -> TyparConstraint.IsEnum(a, range0)) - | 9 -> u_tup2 u_ty u_ty st |> (fun (a, b) _ -> TyparConstraint.IsDelegate(a, b, range0)) - | 10 -> (fun _ -> TyparConstraint.SupportsComparison range0) - | 11 -> (fun _ -> TyparConstraint.SupportsEquality range0) - | 12 -> (fun _ -> TyparConstraint.IsUnmanaged range0) + | 0 -> u_ty st |> (fun a _ -> TyparConstraint.CoercesTo(a, range0)) + | 1 -> u_trait st |> (fun a _ -> TyparConstraint.MayResolveMember(a, range0)) + | 2 -> u_ty st |> (fun a ridx -> TyparConstraint.DefaultsTo(ridx, a, range0)) + | 3 -> (fun _ -> TyparConstraint.SupportsNull range0) + | 4 -> (fun _ -> TyparConstraint.IsNonNullableStruct range0) + | 5 -> (fun _ -> TyparConstraint.IsReferenceType range0) + | 6 -> (fun _ -> TyparConstraint.RequiresDefaultConstructor range0) + | 7 -> u_tys st |> (fun a _ -> TyparConstraint.SimpleChoice(a, range0)) + | 8 -> u_ty st |> (fun a _ -> TyparConstraint.IsEnum(a, range0)) + | 9 -> + u_tup2 u_ty u_ty st + |> (fun (a, b) _ -> TyparConstraint.IsDelegate(a, b, range0)) + | 10 -> (fun _ -> TyparConstraint.SupportsComparison range0) + | 11 -> (fun _ -> TyparConstraint.SupportsEquality range0) + | 12 -> (fun _ -> TyparConstraint.IsUnmanaged range0) | _ -> ufailwith st "u_tyar_constraint" // Some extra F#9+ constraints are stored in stream B, these will be ignored by earlier F# compilers -let u_tyar_constraintB st = +let u_tyar_constraintB st = let tag = u_byteB st + match tag with | 1 -> TyparConstraint.NotSupportsNull range0 | 2 -> TyparConstraint.AllowsRefStruct range0 - | _ -> ufailwith st "u_tyar_constraintB - unexpected constraint in streamB" + | _ -> ufailwith st "u_tyar_constraintB - unexpected constraint in streamB" let u_tyar_constraints st = let cxs1 = u_list_revi u_tyar_constraint st @@ -1658,211 +2356,237 @@ let u_tyar_constraints st = // // 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 + let cxs2 = u_listB u_tyar_constraintB st cxs1 @ cxs2 let p_tyar_spec_data (x: Typar) st = p_tup5 - p_ident - p_attribs - p_int64 - p_tyar_constraints - p_xmldoc - (x.typar_id, x.Attribs, int64 x.typar_flags.PickledBits, x.Constraints, x.XmlDoc) st + p_ident + p_attribs + p_int64 + p_tyar_constraints + p_xmldoc + (x.typar_id, x.Attribs, int64 x.typar_flags.PickledBits, x.Constraints, x.XmlDoc) + st let p_tyar_spec (x: Typar) st = //Disabled, workaround for bug 2721: if x.Rigidity <> TyparRigidity.Rigid then warning(Error(sprintf "p_tyar_spec: typar#%d is not rigid" x.Stamp, x.Range)) - if x.IsFromError then warning(Error((0, "p_tyar_spec: from error"), x.Range)) + if x.IsFromError then + warning (Error((0, "p_tyar_spec: from error"), x.Range)) + p_osgn_decl st.otypars p_tyar_spec_data x st let p_tyar_specs = (p_list p_tyar_spec) let u_tyar_spec_data st = let a, c, d, e, g = u_tup5 u_ident u_attribs u_int64 u_tyar_constraints u_xmldoc st - { typar_id=a - typar_stamp=newStamp() - typar_flags=TyparFlags(int32 d) - typar_solution=None - typar_astype= Unchecked.defaultof<_> - 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;typar_is_contravariant = false } } + + { + typar_id = a + typar_stamp = newStamp () + typar_flags = TyparFlags(int32 d) + typar_solution = None + typar_astype = Unchecked.defaultof<_> + 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 + typar_is_contravariant = false + } + } let u_tyar_spec st = u_osgn_decl st.itypars u_tyar_spec_data st let u_tyar_specs = (u_list u_tyar_spec) -let _ = fill_p_ty2 (fun isStructThisArgPos ty st -> - let ty = stripTyparEqns ty - - // See comment on 'checkForInRefStructThisArg' - let ty = - if isInByrefTy st.oglobals ty && isStructThisArgPos then - // Convert the inref to a byref - mkByrefTy st.oglobals (destByrefTy st.oglobals ty) - else - ty - - match ty with - | TType_tuple (tupInfo, l) -> - if evalTupInfoIsStruct tupInfo then - p_byte 8 st; p_tys l st - else - p_byte 0 st; p_tys l st - - | 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, 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, 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 - p_tyar_specs tps st - // Note, the "this" argument may be found in the body of a generic forall type, so propagate the isStructThisArgPos value - p_ty2 isStructThisArgPos r st - - | TType_measure unt -> - p_byte 6 st - p_measure_expr unt st +let _ = + fill_p_ty2 (fun isStructThisArgPos ty st -> + let ty = stripTyparEqns ty + + // See comment on 'checkForInRefStructThisArg' + let ty = + if isInByrefTy st.oglobals ty && isStructThisArgPos then + // Convert the inref to a byref + mkByrefTy st.oglobals (destByrefTy st.oglobals ty) + else + ty + + match ty with + | TType_tuple(tupInfo, l) -> + if evalTupInfoIsStruct tupInfo then + p_byte 8 st + p_tys l st + else + p_byte 0 st + p_tys l st + + | 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 - | TType_ucase (uc, tinst) -> - p_byte 7 st - p_ucref uc st - p_tys tinst st + p_byte 1 st + p_simpletyp nleref st - // p_byte 8 taken by TType_tuple above - | TType_anon (anonInfo, l) -> - p_byte 9 st - p_anonInfo anonInfo st - p_tys l st - ) + | 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 -let _ = fill_u_ty (fun st -> - let tag = u_byte 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, 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 + p_tyar_specs tps st + // Note, the "this" argument may be found in the body of a generic forall type, so propagate the isStructThisArgPos value + p_ty2 isStructThisArgPos r st + + | TType_measure unt -> + p_byte 6 st + p_measure_expr unt st + + | TType_ucase(uc, tinst) -> + p_byte 7 st + p_ucref uc st + p_tys tinst st + + // p_byte 8 taken by TType_tuple above + | TType_anon(anonInfo, l) -> + p_byte 9 st + p_anonInfo anonInfo st + p_tys l 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 -> - let tagB = u_byteB st - let sty = u_simpletyp st - match tagB with + match tag 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 - 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 - 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 - 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 - let r = u_ty st - TType_forall (tps, r) - - | 6 -> - let unt = u_measure_expr st - TType_measure unt - - | 7 -> - let uc = u_ucref st - let tinst = u_tys st - TType_ucase (uc, tinst) - - | 8 -> - let l = u_tys st - TType_tuple (tupInfoStruct, l) - - | 9 -> - let anonInfo = u_anonInfo st - let l = u_tys st - TType_anon (anonInfo, l) - - | _ -> - ufailwith st "u_typ") - -let fill_p_binds, p_binds = p_hole() -let fill_p_targets, p_targets = p_hole() -let fill_p_Exprs, p_Exprs = p_hole() -let fill_p_constraints, p_constraints = p_hole() -let fill_p_Vals, p_Vals = p_hole() - -let fill_u_binds, u_binds = u_hole() -let fill_u_targets, u_targets = u_hole() -let fill_u_Exprs, u_Exprs = u_hole() -let fill_u_constraints, u_constraints = u_hole() -let fill_u_Vals, u_Vals = u_hole() + let l = u_tys st + TType_tuple(tupInfoRef, l) + | 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 + + 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 + + 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 + + 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 + let r = u_ty st + TType_forall(tps, r) + + | 6 -> + let unt = u_measure_expr st + TType_measure unt + + | 7 -> + let uc = u_ucref st + let tinst = u_tys st + TType_ucase(uc, tinst) + + | 8 -> + let l = u_tys st + TType_tuple(tupInfoStruct, l) + + | 9 -> + let anonInfo = u_anonInfo st + let l = u_tys st + TType_anon(anonInfo, l) + + | _ -> ufailwith st "u_typ") + +let fill_p_binds, p_binds = p_hole () +let fill_p_targets, p_targets = p_hole () +let fill_p_Exprs, p_Exprs = p_hole () +let fill_p_constraints, p_constraints = p_hole () +let fill_p_Vals, p_Vals = p_hole () + +let fill_u_binds, u_binds = u_hole () +let fill_u_targets, u_targets = u_hole () +let fill_u_Exprs, u_Exprs = u_hole () +let fill_u_constraints, u_constraints = u_hole () +let fill_u_Vals, u_Vals = u_hole () let p_ArgReprInfo (x: ArgReprInfo) st = p_attribs x.Attribs st @@ -1872,7 +2596,7 @@ let p_TyparReprInfo (TyparReprInfo(a, b)) st = p_ident a st p_kind b st -let p_ValReprInfo (ValReprInfo (a, args, ret)) st = +let p_ValReprInfo (ValReprInfo(a, args, ret)) st = p_list p_TyparReprInfo a st p_list (p_list p_ArgReprInfo) args st p_ArgReprInfo ret st @@ -1880,9 +2604,15 @@ let p_ValReprInfo (ValReprInfo (a, args, ret)) st = let u_ArgReprInfo st = let a = u_attribs st let b = u_option u_ident st + match a, b with | [], None -> ValReprInfo.unnamedTopArg1 - | _ -> { Attribs = a; Name = b; OtherRange = None } + | _ -> + { + Attribs = a + Name = b + OtherRange = None + } let u_TyparReprInfo st = let a = u_ident st @@ -1893,16 +2623,15 @@ let u_ValReprInfo st = let a = u_list u_TyparReprInfo st let b = u_list (u_list u_ArgReprInfo) st let c = u_ArgReprInfo st - ValReprInfo (a, b, c) + ValReprInfo(a, b, c) -let p_ranges x st = - p_option (p_tup2 p_range p_range) x st +let p_ranges x st = p_option (p_tup2 p_range p_range) x st let p_istype x st = match x with | FSharpModuleWithSuffix -> p_byte 0 st - | ModuleOrType -> p_byte 1 st - | Namespace _ -> p_byte 2 st + | ModuleOrType -> p_byte 1 st + | Namespace _ -> p_byte 2 st let p_cpath (CompPath(a, _, b)) st = p_tup2 p_ILScopeRef (p_list (p_tup2 p_string p_istype)) (a, b) st @@ -1911,6 +2640,7 @@ let u_ranges st = u_option (u_tup2 u_range u_range) st let u_istype st = let tag = u_byte st + match tag with | 0 -> FSharpModuleWithSuffix | 1 -> ModuleOrType @@ -1918,7 +2648,7 @@ let u_istype st = | _ -> ufailwith st "u_istype" let u_cpath st = - let a, b = u_tup2 u_ILScopeRef (u_list (u_tup2 u_string u_istype)) st + let a, b = u_tup2 u_ILScopeRef (u_list (u_tup2 u_string u_istype)) st CompPath(a, SyntaxAccess.Unknown, b) let rec p_tycon_repr x st = @@ -1926,27 +2656,42 @@ let rec p_tycon_repr x st = match x with // Records - | TFSharpTyconRepr { fsobjmodel_rfields = fs; fsobjmodel_kind = TFSharpRecord } -> + | TFSharpTyconRepr { + fsobjmodel_rfields = fs + fsobjmodel_kind = TFSharpRecord + } -> p_byte 1 st p_byte 0 st p_rfield_table fs st false // Unions without static fields - | TFSharpTyconRepr { fsobjmodel_cases = x; fsobjmodel_kind = TFSharpUnion; fsobjmodel_rfields = fs } when fs.FieldsByIndex.Length = 0 -> + | TFSharpTyconRepr { + fsobjmodel_cases = x + fsobjmodel_kind = TFSharpUnion + fsobjmodel_rfields = fs + } when fs.FieldsByIndex.Length = 0 -> p_byte 1 st p_byte 1 st p_array p_unioncase_spec x.CasesTable.CasesByIndex st false // Unions with static fields, added to format - | TFSharpTyconRepr ({ fsobjmodel_cases = cases; fsobjmodel_kind = TFSharpUnion } as r) -> + | TFSharpTyconRepr({ + fsobjmodel_cases = cases + fsobjmodel_kind = TFSharpUnion + } as r) -> if st.oglobals.compilingFSharpCore then let fields = r.fsobjmodel_rfields.FieldsByIndex let firstFieldRange = fields[0].DefinitionRange - let allFieldsText = fields |> Array.map (fun f -> f.LogicalName) |> String.concat System.Environment.NewLine - raise (Error(FSComp.SR.pickleFsharpCoreBackwardsCompatible("fields in union",allFieldsText), firstFieldRange)) - + + let allFieldsText = + fields + |> Array.map (fun f -> f.LogicalName) + |> String.concat System.Environment.NewLine + + raise (Error(FSComp.SR.pickleFsharpCoreBackwardsCompatible ("fields in union", allFieldsText), firstFieldRange)) + p_byte 2 st p_array p_unioncase_spec cases.CasesTable.CasesByIndex st p_tycon_objmodel_data r st @@ -1958,13 +2703,13 @@ let rec p_tycon_repr x st = p_ILType ilTy st false - | TFSharpTyconRepr r -> + | TFSharpTyconRepr r -> p_byte 1 st p_byte 3 st p_tycon_objmodel_data r st false - | TMeasureableRepr ty -> + | TMeasureableRepr ty -> p_byte 1 st p_byte 4 st p_ty ty st @@ -1984,7 +2729,7 @@ let rec p_tycon_repr x st = // Pickle generated type definitions as a TAsmRepr p_byte 1 st p_byte 2 st - p_ILType (mkILBoxedType(ILTypeSpec.Create(TypeProviders.GetILTypeRefOfProvidedType(info.ProvidedType, range0), []))) st + p_ILType (mkILBoxedType (ILTypeSpec.Create(TypeProviders.GetILTypeRefOfProvidedType(info.ProvidedType, range0), []))) st true | TProvidedNamespaceRepr _ -> @@ -1992,13 +2737,12 @@ let rec p_tycon_repr x st = false #endif - | TILObjectRepr (TILObjectReprData (_, _, td)) -> - error (Failure("Unexpected IL type definition"+td.Name)) + | TILObjectRepr(TILObjectReprData(_, _, td)) -> error (Failure("Unexpected IL type definition" + td.Name)) and p_tycon_objmodel_data x st = - p_tycon_objmodel_kind x.fsobjmodel_kind st - p_vrefs "vslots" x.fsobjmodel_vslots st - p_rfield_table x.fsobjmodel_rfields st + p_tycon_objmodel_kind x.fsobjmodel_kind st + p_vrefs "vslots" x.fsobjmodel_vslots st + p_rfield_table x.fsobjmodel_rfields st and p_attribs_ext f x st = p_list_ext f p_attrib x st @@ -2010,16 +2754,22 @@ and p_unioncase_spec x st = p_string x.CompiledName st p_ident x.Id st // The XmlDoc are only written for the extended in-memory format. We encode their presence using a marker bit here - p_attribs_ext (if st.oInMem then Some (p_xmldoc x.XmlDoc) else None) x.Attribs st + p_attribs_ext (if st.oInMem then Some(p_xmldoc x.XmlDoc) else None) x.Attribs st p_string x.XmlDocSig st p_access x.Accessibility st and p_exnc_repr x st = match x with - | TExnAbbrevRepr x -> p_byte 0 st; (p_tcref "exn abbrev") x st - | TExnAsmRepr x -> p_byte 1 st; p_ILTypeRef x st - | TExnFresh x -> p_byte 2 st; p_rfield_table x st - | TExnNone -> p_byte 3 st + | TExnAbbrevRepr x -> + p_byte 0 st + (p_tcref "exn abbrev") x st + | TExnAsmRepr x -> + p_byte 1 st + p_ILTypeRef x st + | TExnFresh x -> + p_byte 2 st + p_rfield_table x st + | TExnNone -> p_byte 3 st and p_access (TAccess n) st = p_list p_cpath n st @@ -2031,7 +2781,7 @@ and p_recdfield_spec x st = p_bool x.rfield_secret st p_option p_const x.rfield_const st p_ident x.rfield_id st - p_attribs_ext (if st.oInMem then Some (p_xmldoc x.XmlDoc) else None) x.rfield_pattribs st + p_attribs_ext (if st.oInMem then Some(p_xmldoc x.XmlDoc) else None) x.rfield_pattribs st p_attribs x.rfield_fattribs st p_string x.rfield_xmldocsig st p_access x.rfield_access st @@ -2043,101 +2793,128 @@ and p_entity_spec_data (x: Entity) st = p_tyar_specs (x.entity_typars.Force(x.entity_range)) st p_string x.entity_logical_name st p_option p_string x.EntityCompiledName st - p_range x.entity_range st + p_range x.entity_range st p_option p_pubpath x.entity_pubpath st p_access x.Accessibility st - p_access x.TypeReprAccessibility st + p_access x.TypeReprAccessibility st p_attribs x.entity_attribs st let flagBit = p_tycon_repr x.entity_tycon_repr st p_option p_ty x.TypeAbbrev st p_tcaug x.entity_tycon_tcaug st p_string System.String.Empty st p_kind x.TypeOrMeasureKind st - p_int64 (x.entity_flags.PickledBits ||| (if flagBit then EntityFlags.ReservedBitForPickleFormatTyconReprFlag else 0L)) st + + p_int64 + (x.entity_flags.PickledBits + ||| (if flagBit then + EntityFlags.ReservedBitForPickleFormatTyconReprFlag + else + 0L)) + st + p_option p_cpath x.entity_cpath st p_maybe_lazy p_modul_typ x.entity_modul_type st p_exnc_repr x.ExceptionInfo st + if st.oInMem then p_used_space1 (p_xmldoc x.XmlDoc) st else p_space 1 () st - and p_tcaug p st = p_tup9 - (p_option (p_tup2 (p_vref "compare_obj") (p_vref "compare"))) - (p_option (p_vref "compare_withc")) - (p_option (p_tup3 (p_vref "hash_obj") (p_vref "hash_withc") (p_vref "equals_withc"))) - (p_option (p_tup2 (p_vref "hash") (p_vref "equals"))) - (p_list (p_tup2 p_string (p_vref "adhoc"))) - (p_list (p_tup3 p_ty p_bool p_dummy_range)) - (p_option p_ty) - p_bool - (p_space 1) - (p.tcaug_compare, - p.tcaug_compare_withc, - p.tcaug_hash_and_equals_withc |> Option.map (fun (v1, v2, v3, _) -> (v1, v2, v3)), - p.tcaug_equals, - (p.tcaug_adhoc_list - |> ResizeArray.toList - // Explicit impls of interfaces only get kept in the adhoc list - // in order to get check the well-formedness of an interface. - // Keeping them across assembly boundaries is not valid, because relinking their ValRefs - // does not work correctly (they may get incorrectly relinked to a default member) - |> List.filter (fun (isExplicitImpl, _) -> not isExplicitImpl) - |> List.map (fun (_, vref) -> vref.LogicalName, vref)), - p.tcaug_interfaces, - p.tcaug_super, - p.tcaug_abstract, - space) st - -and p_entity_spec x st = p_osgn_decl st.oentities p_entity_spec_data x st + (p_option (p_tup2 (p_vref "compare_obj") (p_vref "compare"))) + (p_option (p_vref "compare_withc")) + (p_option (p_tup3 (p_vref "hash_obj") (p_vref "hash_withc") (p_vref "equals_withc"))) + (p_option (p_tup2 (p_vref "hash") (p_vref "equals"))) + (p_list (p_tup2 p_string (p_vref "adhoc"))) + (p_list (p_tup3 p_ty p_bool p_dummy_range)) + (p_option p_ty) + p_bool + (p_space 1) + (p.tcaug_compare, + p.tcaug_compare_withc, + p.tcaug_hash_and_equals_withc + |> Option.map (fun (v1, v2, v3, _) -> (v1, v2, v3)), + p.tcaug_equals, + (p.tcaug_adhoc_list + |> ResizeArray.toList + // Explicit impls of interfaces only get kept in the adhoc list + // in order to get check the well-formedness of an interface. + // Keeping them across assembly boundaries is not valid, because relinking their ValRefs + // does not work correctly (they may get incorrectly relinked to a default member) + |> List.filter (fun (isExplicitImpl, _) -> not isExplicitImpl) + |> List.map (fun (_, vref) -> vref.LogicalName, vref)), + p.tcaug_interfaces, + p.tcaug_super, + p.tcaug_abstract, + space) + st + +and p_entity_spec x st = + p_osgn_decl st.oentities p_entity_spec_data x st and p_parentref x st = match x with | ParentNone -> p_byte 0 st - | Parent x -> p_byte 1 st; p_tcref "parent tycon" x st + | Parent x -> + p_byte 1 st + p_tcref "parent tycon" x st and p_attribkind x st = match x with - | ILAttrib x -> p_byte 0 st; p_ILMethodRef x st - | FSAttrib x -> p_byte 1 st; p_vref "attrib" x st + | ILAttrib x -> + p_byte 0 st + p_ILMethodRef x st + | FSAttrib x -> + p_byte 1 st + p_vref "attrib" x st -and p_attrib (Attrib (a, b, c, d, e, _targets, f)) st = // AttributeTargets are not preserved +and p_attrib (Attrib(a, b, c, d, e, _targets, f)) st = // AttributeTargets are not preserved p_tup6 (p_tcref "attrib") p_attribkind (p_list p_attrib_expr) (p_list p_attrib_arg) p_bool p_dummy_range (a, b, c, d, e, f) st -and p_attrib_expr (AttribExpr(e1, e2)) st = - p_tup2 p_expr p_expr (e1, e2) st +and p_attrib_expr (AttribExpr(e1, e2)) st = p_tup2 p_expr p_expr (e1, e2) st and p_attrib_arg (AttribNamedArg(a, b, c, d)) st = p_tup4 p_string p_ty p_bool p_attrib_expr (a, b, c, d) st and p_member_info (x: ValMemberInfo) st = - p_tup4 (p_tcref "member_info") p_MemberFlags (p_list p_slotsig) p_bool - (x.ApparentEnclosingEntity, x.MemberFlags, x.ImplementedSlotSigs, x.IsImplemented) st + p_tup4 + (p_tcref "member_info") + p_MemberFlags + (p_list p_slotsig) + p_bool + (x.ApparentEnclosingEntity, x.MemberFlags, x.ImplementedSlotSigs, x.IsImplemented) + st and p_tycon_objmodel_kind x st = match x with - | TFSharpClass -> p_byte 0 st - | TFSharpInterface -> p_byte 1 st - | TFSharpStruct -> p_byte 2 st - | TFSharpDelegate ss -> p_byte 3 st; p_slotsig ss st - | TFSharpEnum -> p_byte 4 st - | TFSharpUnion -> + | TFSharpClass -> p_byte 0 st + | TFSharpInterface -> p_byte 1 st + | TFSharpStruct -> p_byte 2 st + | TFSharpDelegate ss -> + p_byte 3 st + p_slotsig ss st + | TFSharpEnum -> p_byte 4 st + | TFSharpUnion -> if st.oglobals.compilingFSharpCore then - raise (Error(FSComp.SR.pickleFsharpCoreBackwardsCompatible("union as FSharpTyconKind ",st.ofile), range.Zero)) + raise (Error(FSComp.SR.pickleFsharpCoreBackwardsCompatible ("union as FSharpTyconKind ", st.ofile), range.Zero)) + p_byte 5 st - | TFSharpRecord -> + | TFSharpRecord -> if st.oglobals.compilingFSharpCore then - raise (Error(FSComp.SR.pickleFsharpCoreBackwardsCompatible("record as FSharpTyconKind ",st.ofile), range.Zero)) + raise (Error(FSComp.SR.pickleFsharpCoreBackwardsCompatible ("record as FSharpTyconKind ", st.ofile), range.Zero)) + p_byte 6 st and p_vrefFlags x st = match x with | NormalValUse -> p_byte 0 st - | CtorValUsedAsSuperInit -> p_byte 1 st - | CtorValUsedAsSelfInit -> p_byte 2 st - | PossibleConstrainedCall ty -> p_byte 3 st; p_ty ty st + | CtorValUsedAsSuperInit -> p_byte 1 st + | CtorValUsedAsSelfInit -> p_byte 2 st + | PossibleConstrainedCall ty -> + p_byte 3 st + p_ty ty st | VSlotDirectCall -> p_byte 4 st and p_ValData x st = @@ -2157,44 +2934,42 @@ and p_ValData x st = p_access x.Accessibility st p_parentref x.TryDeclaringEntity st p_option p_const x.LiteralValue st + if st.oInMem then p_used_space1 (p_xmldoc x.XmlDoc) st else p_space 1 () st -and p_Val x st = - p_osgn_decl st.ovals p_ValData x st +and p_Val x st = p_osgn_decl st.ovals p_ValData x st and p_modul_typ (x: ModuleOrNamespaceType) st = - p_tup3 - p_istype - (p_qlist p_Val) - (p_qlist p_entity_spec) - (x.ModuleOrNamespaceKind, x.AllValsAndMembers, x.AllEntities) - st + p_tup3 p_istype (p_qlist p_Val) (p_qlist p_entity_spec) (x.ModuleOrNamespaceKind, x.AllValsAndMembers, x.AllEntities) st and u_tycon_repr st = let tag1 = u_byte st + match tag1 with | 0 -> (fun _flagBit -> TNoRepr) | 1 -> let tag2 = u_byte st + match tag2 with // Records historically use a different format to other FSharpTyconRepr | 0 -> let v = u_rfield_table st + (fun _flagBit -> TFSharpTyconRepr { fsobjmodel_cases = Construct.MakeUnionCases [] - fsobjmodel_kind=TFSharpRecord - fsobjmodel_vslots=[] - fsobjmodel_rfields=v + fsobjmodel_kind = TFSharpRecord + fsobjmodel_vslots = [] + fsobjmodel_rfields = v }) // Unions without static fields historically use a different format to other FSharpTyconRepr | 1 -> - let v = u_list u_unioncase_spec st + let v = u_list u_unioncase_spec st (fun _flagBit -> Construct.MakeUnionRepr v) | 2 -> @@ -2205,26 +2980,32 @@ and u_tycon_repr st = (fun flagBit -> if flagBit then let iltref = v.TypeRef + match st.iILModule with | None -> TNoRepr | Some iILModule -> - try - let rec find acc enclosingTypeNames (tdefs: ILTypeDefs) = - match enclosingTypeNames with - | [] -> List.rev acc, tdefs.FindByName iltref.Name - | h :: t -> - let nestedTypeDef = tdefs.FindByName h - find (nestedTypeDef :: acc) t nestedTypeDef.NestedTypes - let nestedILTypeDefs, ilTypeDef = find [] iltref.Enclosing iILModule.TypeDefs - TILObjectRepr(TILObjectReprData(st.iilscope, nestedILTypeDefs, ilTypeDef)) - with _ -> - System.Diagnostics.Debug.Assert(false, sprintf "failed to find IL backing metadata for cross-assembly generated type %s" iltref.FullName) - TNoRepr + try + let rec find acc enclosingTypeNames (tdefs: ILTypeDefs) = + match enclosingTypeNames with + | [] -> List.rev acc, tdefs.FindByName iltref.Name + | h :: t -> + let nestedTypeDef = tdefs.FindByName h + find (nestedTypeDef :: acc) t nestedTypeDef.NestedTypes + + let nestedILTypeDefs, ilTypeDef = find [] iltref.Enclosing iILModule.TypeDefs + TILObjectRepr(TILObjectReprData(st.iilscope, nestedILTypeDefs, ilTypeDef)) + with _ -> + System.Diagnostics.Debug.Assert( + false, + sprintf "failed to find IL backing metadata for cross-assembly generated type %s" iltref.FullName + ) + + TNoRepr else TAsmRepr v) | 3 -> - let v = u_tycon_objmodel_data st + let v = u_tycon_objmodel_data st (fun _flagBit -> TFSharpTyconRepr v) | 4 -> @@ -2237,45 +3018,56 @@ and u_tycon_repr st = | 2 -> let cases = u_array u_unioncase_spec st let data = u_tycon_objmodel_data st - fun _flagBit -> TFSharpTyconRepr { data with fsobjmodel_cases = Construct.MakeUnionCases (Array.toList cases) } + + fun _flagBit -> + TFSharpTyconRepr + { data with + fsobjmodel_cases = Construct.MakeUnionCases(Array.toList cases) + } | _ -> ufailwith st "u_tycon_repr" and u_tycon_objmodel_data st = let x1, x2, x3 = u_tup3 u_tycon_objmodel_kind u_vrefs u_rfield_table st + { fsobjmodel_cases = Construct.MakeUnionCases [] - fsobjmodel_kind=x1 - fsobjmodel_vslots=x2 - fsobjmodel_rfields=x3 + fsobjmodel_kind = x1 + fsobjmodel_vslots = x2 + fsobjmodel_rfields = x3 } and u_attribs_ext extraf st = u_list_ext extraf u_attrib st + and u_unioncase_spec st = - let a = u_rfield_table st + let a = u_rfield_table st let b = u_ty st // The union case compiled name is now computed from Id field when needed and is not stored in UnionCase record. let _c = u_string st - let d = u_ident st + let d = u_ident st // The XmlDoc is only present in the extended in-memory format. We detect its presence using a marker bit here let xmldoc, e = u_attribs_ext u_xmldoc st let f = u_string st let i = u_access st - { FieldTable=a - ReturnType=b - Id=d - Attribs=e - OwnXmlDoc= defaultArg xmldoc XmlDoc.Empty - OtherXmlDoc = XmlDoc.Empty - XmlDocSig=f - Accessibility=i - OtherRangeOpt=None } + + { + FieldTable = a + ReturnType = b + Id = d + Attribs = e + OwnXmlDoc = defaultArg xmldoc XmlDoc.Empty + OtherXmlDoc = XmlDoc.Empty + XmlDocSig = f + Accessibility = i + OtherRangeOpt = None + } and u_exnc_repr st = let tag = u_byte st + match tag with - | 0 -> u_tcref st |> TExnAbbrevRepr - | 1 -> u_ILTypeRef st |> TExnAsmRepr + | 0 -> u_tcref st |> TExnAbbrevRepr + | 1 -> u_ILTypeRef st |> TExnAsmRepr | 2 -> u_rfield_table st |> TExnFresh | 3 -> TExnNone | _ -> ufailwith st "u_exnc_repr" @@ -2298,108 +3090,119 @@ and u_recdfield_spec st = let e2 = u_attribs st let f = u_string st let g = u_access st - { rfield_mutable=a - rfield_volatile=b - rfield_type=c1 - rfield_static=c2 - rfield_secret=c2b - rfield_const=c3 - rfield_id=d - rfield_pattribs=e1 - rfield_fattribs=e2 - rfield_xmldoc= defaultArg xmldoc XmlDoc.Empty - rfield_otherxmldoc = XmlDoc.Empty - rfield_xmldocsig=f - rfield_access=g - rfield_name_generated = d.idRange.IsSynthetic - rfield_other_range = None } - -and u_rfield_table st = Construct.MakeRecdFieldsTable (u_list u_recdfield_spec st) + + { + rfield_mutable = a + rfield_volatile = b + rfield_type = c1 + rfield_static = c2 + rfield_secret = c2b + rfield_const = c3 + rfield_id = d + rfield_pattribs = e1 + rfield_fattribs = e2 + rfield_xmldoc = defaultArg xmldoc XmlDoc.Empty + rfield_otherxmldoc = XmlDoc.Empty + rfield_xmldocsig = f + rfield_access = g + rfield_name_generated = d.idRange.IsSynthetic + rfield_other_range = None + } + +and u_rfield_table st = + Construct.MakeRecdFieldsTable(u_list u_recdfield_spec st) and u_entity_spec_data st : Entity = let x1, x2a, x2b, x2c, x3, (x4a, x4b), x6, x7f, x8, x9, _x10, x10b, x11, x12, x13, x14, x15 = - u_tup17 - u_tyar_specs - u_string - (u_option u_string) - u_range - (u_option u_pubpath) - (u_tup2 u_access u_access) - u_attribs - u_tycon_repr - (u_option u_ty) - u_tcaug - u_string - u_kind - u_int64 - (u_option u_cpath ) - (u_lazy u_modul_typ) - u_exnc_repr - (u_used_space1 u_xmldoc) - st + u_tup17 + u_tyar_specs + u_string + (u_option u_string) + u_range + (u_option u_pubpath) + (u_tup2 u_access u_access) + u_attribs + u_tycon_repr + (u_option u_ty) + u_tcaug + u_string + u_kind + u_int64 + (u_option u_cpath) + (u_lazy u_modul_typ) + u_exnc_repr + (u_used_space1 u_xmldoc) + st // We use a bit that was unused in the F# 2.0 format to indicate two possible representations in the F# 3.0 tycon_repr format let x7 = x7f (x11 &&& EntityFlags.ReservedBitForPickleFormatTyconReprFlag <> 0L) let x11 = x11 &&& ~~~EntityFlags.ReservedBitForPickleFormatTyconReprFlag - { entity_typars=LazyWithContext.NotLazy x1 - entity_stamp=newStamp() - entity_logical_name=x2a - entity_range=x2c - entity_pubpath=x3 - entity_attribs=x6 - entity_tycon_repr=x7 - entity_tycon_tcaug=x9 - entity_flags=EntityFlags x11 - entity_cpath=x12 - entity_modul_type=MaybeLazy.Lazy x13 - entity_il_repr_cache=newCache() - entity_opt_data= - match x2b, x10b, x15, x8, x4a, x4b, x14 with - | None, TyparKind.Type, None, None, TAccess [], TAccess [], TExnNone -> None - | _ -> - Some { Entity.NewEmptyEntityOptData() with - entity_compiled_name = x2b - entity_kind = x10b - entity_xmldoc= defaultArg x15 XmlDoc.Empty - entity_xmldocsig = System.String.Empty - entity_tycon_abbrev = x8 - entity_accessibility = x4a - entity_tycon_repr_accessibility = x4b - entity_exn_info = x14 } + { + entity_typars = LazyWithContext.NotLazy x1 + entity_stamp = newStamp () + entity_logical_name = x2a + entity_range = x2c + entity_pubpath = x3 + entity_attribs = x6 + entity_tycon_repr = x7 + entity_tycon_tcaug = x9 + entity_flags = EntityFlags x11 + entity_cpath = x12 + entity_modul_type = MaybeLazy.Lazy x13 + entity_il_repr_cache = newCache () + entity_opt_data = + match x2b, x10b, x15, x8, x4a, x4b, x14 with + | None, TyparKind.Type, None, None, TAccess [], TAccess [], TExnNone -> None + | _ -> + Some + { Entity.NewEmptyEntityOptData() with + entity_compiled_name = x2b + entity_kind = x10b + entity_xmldoc = defaultArg x15 XmlDoc.Empty + entity_xmldocsig = System.String.Empty + entity_tycon_abbrev = x8 + entity_accessibility = x4a + entity_tycon_repr_accessibility = x4b + entity_exn_info = x14 + } } and u_tcaug st = let a1, a2, a3, b2, c, d, e, g, _space = - u_tup9 - (u_option (u_tup2 u_vref u_vref)) - (u_option u_vref) - (u_option (u_tup3 u_vref u_vref u_vref)) - (u_option (u_tup2 u_vref u_vref)) - (u_list (u_tup2 u_string u_vref)) - (u_list (u_tup3 u_ty u_bool u_dummy_range)) - (u_option u_ty) - u_bool - (u_space 1) - st - {tcaug_compare=a1 - tcaug_compare_withc=a2 - tcaug_hash_and_equals_withc=a3 |> Option.map (fun (v1, v2, v3) -> (v1, v2, v3, None)) - tcaug_equals=b2 - // only used for code generation and checking - hence don't care about the values when reading back in - tcaug_hasObjectGetHashCode=false - tcaug_adhoc_list= ResizeArray<_>(c |> List.map (fun (_, vref) -> (false, vref))) - tcaug_adhoc=NameMultiMap.ofList c - tcaug_interfaces=d - tcaug_super=e - // pickled type definitions are always closed (i.e. no more intrinsic members allowed) - tcaug_closed=true - tcaug_abstract=g} + u_tup9 + (u_option (u_tup2 u_vref u_vref)) + (u_option u_vref) + (u_option (u_tup3 u_vref u_vref u_vref)) + (u_option (u_tup2 u_vref u_vref)) + (u_list (u_tup2 u_string u_vref)) + (u_list (u_tup3 u_ty u_bool u_dummy_range)) + (u_option u_ty) + u_bool + (u_space 1) + st + + { + tcaug_compare = a1 + tcaug_compare_withc = a2 + tcaug_hash_and_equals_withc = a3 |> Option.map (fun (v1, v2, v3) -> (v1, v2, v3, None)) + tcaug_equals = b2 + // only used for code generation and checking - hence don't care about the values when reading back in + tcaug_hasObjectGetHashCode = false + tcaug_adhoc_list = ResizeArray<_>(c |> List.map (fun (_, vref) -> (false, vref))) + tcaug_adhoc = NameMultiMap.ofList c + tcaug_interfaces = d + tcaug_super = e + // pickled type definitions are always closed (i.e. no more intrinsic members allowed) + tcaug_closed = true + tcaug_abstract = g + } and u_entity_spec st = u_osgn_decl st.ientities u_entity_spec_data st and u_parentref st = let tag = u_byte st + match tag with | 0 -> ParentNone | 1 -> u_tcref st |> Parent @@ -2407,32 +3210,39 @@ and u_parentref st = and u_attribkind st = let tag = u_byte st + match tag with | 0 -> u_ILMethodRef st |> ILAttrib - | 1 -> u_vref st |> FSAttrib + | 1 -> u_vref st |> FSAttrib | _ -> ufailwith st "u_attribkind" and u_attrib st : Attrib = - let a, b, c, d, e, f = u_tup6 u_tcref u_attribkind (u_list u_attrib_expr) (u_list u_attrib_arg) u_bool u_dummy_range st - Attrib(a, b, c, d, e, None, f) // AttributeTargets are not preserved + let a, b, c, d, e, f = + u_tup6 u_tcref u_attribkind (u_list u_attrib_expr) (u_list u_attrib_arg) u_bool u_dummy_range st + + Attrib(a, b, c, d, e, None, f) // AttributeTargets are not preserved and u_attrib_expr st = let a, b = u_tup2 u_expr u_expr st AttribExpr(a, b) -and u_attrib_arg st = +and u_attrib_arg st = let a, b, c, d = u_tup4 u_string u_ty u_bool u_attrib_expr st AttribNamedArg(a, b, c, d) and u_member_info st : ValMemberInfo = let x2, x3, x4, x5 = u_tup4 u_tcref u_MemberFlags (u_list u_slotsig) u_bool st - { ApparentEnclosingEntity=x2 - MemberFlags=x3 - ImplementedSlotSigs=x4 - IsImplemented=x5 } + + { + ApparentEnclosingEntity = x2 + MemberFlags = x3 + ImplementedSlotSigs = x4 + IsImplemented = x5 + } and u_tycon_objmodel_kind st = let tag = u_byte st + match tag with | 0 -> TFSharpClass | 1 -> TFSharpInterface @@ -2448,129 +3258,181 @@ and u_vrefFlags st = | 0 -> NormalValUse | 1 -> CtorValUsedAsSuperInit | 2 -> CtorValUsedAsSelfInit - | 3 -> PossibleConstrainedCall (u_ty st) + | 3 -> PossibleConstrainedCall(u_ty st) | 4 -> VSlotDirectCall | _ -> ufailwith st "u_vrefFlags" and u_ValData st = let x1, x1z, x1a, x2, x4, x8, x9, x10, x12, x13, x13b, x14, x15 = - u_tup13 - u_string - (u_option u_string) - u_ranges - u_ty - u_int64 - (u_option u_member_info) - u_attribs - (u_option u_ValReprInfo) - u_string - u_access - u_parentref - (u_option u_const) - (u_used_space1 u_xmldoc) - st + u_tup13 + u_string + (u_option u_string) + u_ranges + u_ty + u_int64 + (u_option u_member_info) + u_attribs + (u_option u_ValReprInfo) + u_string + u_access + u_parentref + (u_option u_const) + (u_used_space1 u_xmldoc) + st - { val_logical_name = x1 - val_range = (match x1a with None -> range0 | Some(a, _) -> a) - val_type = x2 - val_stamp = newStamp() - val_flags = ValFlags x4 - val_opt_data = - match x1z, x1a, x10, x14, x13, x15, x8, x13b, x12, x9 with - | None, None, None, None, TAccess [], None, None, ParentNone, "", [] -> None - | _ -> - Some { val_compiled_name = x1z - val_other_range = (match x1a with None -> None | Some(_, b) -> Some(b, true)) - val_defn = None - val_repr_info = x10 - val_repr_info_for_display = None - arg_repr_info_for_display = None - val_const = x14 - val_access = x13 - val_xmldoc = defaultArg x15 XmlDoc.Empty - val_other_xmldoc = None - val_member_info = x8 - val_declaring_entity = x13b - val_xmldocsig = x12 - val_attribs = x9 } + { + val_logical_name = x1 + val_range = + (match x1a with + | None -> range0 + | Some(a, _) -> a) + val_type = x2 + val_stamp = newStamp () + val_flags = ValFlags x4 + val_opt_data = + match x1z, x1a, x10, x14, x13, x15, x8, x13b, x12, x9 with + | None, None, None, None, TAccess [], None, None, ParentNone, "", [] -> None + | _ -> + Some + { + val_compiled_name = x1z + val_other_range = + (match x1a with + | None -> None + | Some(_, b) -> Some(b, true)) + val_defn = None + val_repr_info = x10 + val_repr_info_for_display = None + arg_repr_info_for_display = None + val_const = x14 + val_access = x13 + val_xmldoc = defaultArg x15 XmlDoc.Empty + val_other_xmldoc = None + val_member_info = x8 + val_declaring_entity = x13b + val_xmldocsig = x12 + val_attribs = x9 + } } and u_Val st = u_osgn_decl st.ivals u_ValData st - and u_modul_typ st = - let x1, x3, x5 = - u_tup3 - u_istype - (u_qlist u_Val) - (u_qlist u_entity_spec) st + let x1, x3, x5 = u_tup3 u_istype (u_qlist u_Val) (u_qlist u_entity_spec) st ModuleOrNamespaceType(x1, x3, x5) - //--------------------------------------------------------------------------- // Pickle/unpickle for F# expressions (for optimization data) //--------------------------------------------------------------------------- and p_const x st = match x with - | Const.Bool x -> p_byte 0 st; p_bool x st - | Const.SByte x -> p_byte 1 st; p_int8 x st - | Const.Byte x -> p_byte 2 st; p_uint8 x st - | Const.Int16 x -> p_byte 3 st; p_int16 x st - | Const.UInt16 x -> p_byte 4 st; p_uint16 x st - | Const.Int32 x -> p_byte 5 st; p_int32 x st - | Const.UInt32 x -> p_byte 6 st; p_uint32 x st - | Const.Int64 x -> p_byte 7 st; p_int64 x st - | Const.UInt64 x -> p_byte 8 st; p_uint64 x st - | Const.IntPtr x -> p_byte 9 st; p_int64 x st - | Const.UIntPtr x -> p_byte 10 st; p_uint64 x st - | Const.Single x -> p_byte 11 st; p_single x st - | Const.Double x -> p_byte 12 st; p_int64 (bits_of_float x) st - | Const.Char c -> p_byte 13 st; p_char c st - | Const.String s -> p_byte 14 st; p_string s st - | Const.Unit -> p_byte 15 st - | Const.Zero -> p_byte 16 st - | Const.Decimal s -> p_byte 17 st; p_array p_int32 (System.Decimal.GetBits s) st + | Const.Bool x -> + p_byte 0 st + p_bool x st + | Const.SByte x -> + p_byte 1 st + p_int8 x st + | Const.Byte x -> + p_byte 2 st + p_uint8 x st + | Const.Int16 x -> + p_byte 3 st + p_int16 x st + | Const.UInt16 x -> + p_byte 4 st + p_uint16 x st + | Const.Int32 x -> + p_byte 5 st + p_int32 x st + | Const.UInt32 x -> + p_byte 6 st + p_uint32 x st + | Const.Int64 x -> + p_byte 7 st + p_int64 x st + | Const.UInt64 x -> + p_byte 8 st + p_uint64 x st + | Const.IntPtr x -> + p_byte 9 st + p_int64 x st + | Const.UIntPtr x -> + p_byte 10 st + p_uint64 x st + | Const.Single x -> + p_byte 11 st + p_single x st + | Const.Double x -> + p_byte 12 st + p_int64 (bits_of_float x) st + | Const.Char c -> + p_byte 13 st + p_char c st + | Const.String s -> + p_byte 14 st + p_string s st + | Const.Unit -> p_byte 15 st + | Const.Zero -> p_byte 16 st + | Const.Decimal s -> + p_byte 17 st + p_array p_int32 (System.Decimal.GetBits s) st and u_const st = let tag = u_byte st + match tag with - | 0 -> u_bool st |> Const.Bool - | 1 -> u_int8 st |> Const.SByte - | 2 -> u_uint8 st |> Const.Byte - | 3 -> u_int16 st |> Const.Int16 - | 4 -> u_uint16 st |> Const.UInt16 - | 5 -> u_int32 st |> Const.Int32 - | 6 -> u_uint32 st |> Const.UInt32 - | 7 -> u_int64 st |> Const.Int64 - | 8 -> u_uint64 st |> Const.UInt64 - | 9 -> u_int64 st |> Const.IntPtr - | 10 -> u_uint64 st |> Const.UIntPtr - | 11 -> u_single st |> Const.Single - | 12 -> u_int64 st |> float_of_bits |> Const.Double - | 13 -> u_char st |> Const.Char - | 14 -> u_string st |> Const.String + | 0 -> u_bool st |> Const.Bool + | 1 -> u_int8 st |> Const.SByte + | 2 -> u_uint8 st |> Const.Byte + | 3 -> u_int16 st |> Const.Int16 + | 4 -> u_uint16 st |> Const.UInt16 + | 5 -> u_int32 st |> Const.Int32 + | 6 -> u_uint32 st |> Const.UInt32 + | 7 -> u_int64 st |> Const.Int64 + | 8 -> u_uint64 st |> Const.UInt64 + | 9 -> u_int64 st |> Const.IntPtr + | 10 -> u_uint64 st |> Const.UIntPtr + | 11 -> u_single st |> Const.Single + | 12 -> u_int64 st |> float_of_bits |> Const.Double + | 13 -> u_char st |> Const.Char + | 14 -> u_string st |> Const.String | 15 -> Const.Unit | 16 -> Const.Zero | 17 -> u_array u_int32 st |> (System.Decimal >> Const.Decimal) | _ -> ufailwith st "u_const" - and p_dtree x st = match x with - | TDSwitch (a, b, c, d) -> p_byte 0 st; p_tup4 p_expr (p_list p_dtree_case) (p_option p_dtree) p_dummy_range (a, b, c, d) st - | TDSuccess (a, b) -> p_byte 1 st; p_tup2 p_Exprs p_int (a, b) st - | TDBind (a, b) -> p_byte 2 st; p_tup2 p_bind p_dtree (a, b) st + | TDSwitch(a, b, c, d) -> + p_byte 0 st + p_tup4 p_expr (p_list p_dtree_case) (p_option p_dtree) p_dummy_range (a, b, c, d) st + | TDSuccess(a, b) -> + p_byte 1 st + p_tup2 p_Exprs p_int (a, b) st + | TDBind(a, b) -> + p_byte 2 st + p_tup2 p_bind p_dtree (a, b) st -and p_dtree_case (TCase(a, b)) st = p_tup2 p_dtree_discrim p_dtree (a, b) st +and p_dtree_case (TCase(a, b)) st = + p_tup2 p_dtree_discrim p_dtree (a, b) st and p_dtree_discrim x st = match x with - | DecisionTreeTest.UnionCase (ucref, tinst) -> p_byte 0 st; p_tup2 p_ucref p_tys (ucref, tinst) st - | DecisionTreeTest.Const c -> p_byte 1 st; p_const c st - | DecisionTreeTest.IsNull -> p_byte 2 st - | DecisionTreeTest.IsInst (srcTy, tgtTy) -> p_byte 3 st; p_ty srcTy st; p_ty tgtTy st - | DecisionTreeTest.ArrayLength (n, ty) -> p_byte 4 st; p_tup2 p_int p_ty (n, ty) st + | DecisionTreeTest.UnionCase(ucref, tinst) -> + p_byte 0 st + p_tup2 p_ucref p_tys (ucref, tinst) st + | DecisionTreeTest.Const c -> + p_byte 1 st + p_const c st + | DecisionTreeTest.IsNull -> p_byte 2 st + | DecisionTreeTest.IsInst(srcTy, tgtTy) -> + p_byte 3 st + p_ty srcTy st + p_ty tgtTy st + | DecisionTreeTest.ArrayLength(n, ty) -> + p_byte 4 st + p_tup2 p_int p_ty (n, ty) st | DecisionTreeTest.ActivePatternCase _ -> pfailwith st "DecisionTreeTest.ActivePatternCase: only used during pattern match compilation" | DecisionTreeTest.Error _ -> pfailwith st "DecisionTreeTest.Error: only used during pattern match compilation" @@ -2578,7 +3440,13 @@ and p_target (TTarget(a, b, _)) st = p_tup2 p_Vals p_expr (a, b) st and p_bind (TBind(a, b, _)) st = p_tup2 p_Val p_expr (a, b) st and p_lval_op_kind x st = - p_byte (match x with LAddrOf _ -> 0 | LByrefGet -> 1 | LSet -> 2 | LByrefSet -> 3) st + p_byte + (match x with + | LAddrOf _ -> 0 + | LByrefGet -> 1 + | LSet -> 2 + | LByrefSet -> 3) + st and p_recdInfo x st = match x with @@ -2587,29 +3455,40 @@ and p_recdInfo x st = and u_dtree st = let tag = u_byte st + match tag with | 0 -> - let a,b,c,d = u_tup4 u_expr (u_list u_dtree_case) (u_option u_dtree) u_dummy_range st + let a, b, c, d = + u_tup4 u_expr (u_list u_dtree_case) (u_option u_dtree) u_dummy_range st + TDSwitch(a, b, c, d) | 1 -> u_tup2 u_Exprs u_int st |> TDSuccess | 2 -> u_tup2 u_bind u_dtree st |> TDBind | _ -> ufailwith st "u_dtree" -and u_dtree_case st = let a, b = u_tup2 u_dtree_discrim u_dtree st in (TCase(a, b)) +and u_dtree_case st = + let a, b = u_tup2 u_dtree_discrim u_dtree st + TCase(a, b) and u_dtree_discrim st = let tag = u_byte st + match tag with | 0 -> u_tup2 u_ucref u_tys st |> DecisionTreeTest.UnionCase - | 1 -> u_const st |> DecisionTreeTest.Const - | 2 -> DecisionTreeTest.IsNull - | 3 -> u_tup2 u_ty u_ty st |> DecisionTreeTest.IsInst - | 4 -> u_tup2 u_int u_ty st |> DecisionTreeTest.ArrayLength + | 1 -> u_const st |> DecisionTreeTest.Const + | 2 -> DecisionTreeTest.IsNull + | 3 -> u_tup2 u_ty u_ty st |> DecisionTreeTest.IsInst + | 4 -> u_tup2 u_int u_ty st |> DecisionTreeTest.ArrayLength | _ -> ufailwith st "u_dtree_discrim" -and u_target st = let a, b = u_tup2 u_Vals u_expr st in (TTarget(a, b, None)) +and u_target st = + let a, b = u_tup2 u_Vals u_expr st + TTarget(a, b, None) -and u_bind st = let a = u_Val st in let b = u_expr st in TBind(a, b, DebugPointAtBinding.NoneAtSticky) +and u_bind st = + let a = u_Val st + let b = u_expr st + TBind(a, b, DebugPointAtBinding.NoneAtSticky) and u_lval_op_kind st = match u_byte st with @@ -2619,255 +3498,434 @@ and u_lval_op_kind st = | 3 -> LByrefSet | _ -> ufailwith st "uval_op_kind" - and p_op x st = match x with - | TOp.UnionCase c -> p_byte 0 st; p_ucref c st - | TOp.ExnConstr c -> p_byte 1 st; p_tcref "op" c st - | TOp.Tuple tupInfo -> - if evalTupInfoIsStruct tupInfo then - p_byte 29 st - else - p_byte 2 st - | TOp.Recd (a, b) -> p_byte 3 st; p_tup2 p_recdInfo (p_tcref "recd op") (a, b) st - | TOp.ValFieldSet a -> p_byte 4 st; p_rfref a st - | TOp.ValFieldGet a -> p_byte 5 st; p_rfref a st - | TOp.UnionCaseTagGet a -> p_byte 6 st; p_tcref "cnstr op" a st - | TOp.UnionCaseFieldGet (a, b) -> p_byte 7 st; p_tup2 p_ucref p_int (a, b) st - | TOp.UnionCaseFieldSet (a, b) -> p_byte 8 st; p_tup2 p_ucref p_int (a, b) st - | TOp.ExnFieldGet (a, b) -> p_byte 9 st; p_tup2 (p_tcref "exn op") p_int (a, b) st - | TOp.ExnFieldSet (a, b) -> p_byte 10 st; p_tup2 (p_tcref "exn op") p_int (a, b) st - | TOp.TupleFieldGet (tupInfo, a) -> - if evalTupInfoIsStruct tupInfo then - p_byte 30 st; p_int a st - else - p_byte 11 st; p_int a st - | TOp.ILAsm (a, b) -> p_byte 12 st; p_tup2 (p_list p_ILInstr) p_tys (a, b) st - | TOp.RefAddrGet _ -> p_byte 13 st - | TOp.UnionCaseProof a -> p_byte 14 st; p_ucref a st - | TOp.Coerce -> p_byte 15 st - | TOp.TraitCall b -> p_byte 16 st; p_trait b st - | TOp.LValueOp (a, b) -> p_byte 17 st; p_tup2 p_lval_op_kind (p_vref "lval") (a, b) st - | TOp.ILCall (a1, a2, a3, a4, a5, a7, a8, a9, b, c, d) - -> p_byte 18 st; p_tup11 p_bool p_bool p_bool p_bool p_vrefFlags p_bool p_bool p_ILMethodRef p_tys p_tys p_tys (a1, a2, a3, a4, a5, a7, a8, a9, b, c, d) st - | TOp.Array -> p_byte 19 st - | TOp.While _ -> p_byte 20 st - | TOp.IntegerForLoop (_, _, dir) -> p_byte 21 st; p_int (match dir with FSharpForLoopUp -> 0 | CSharpForLoopUp -> 1 | FSharpForLoopDown -> 2) st - | TOp.Bytes bytes -> p_byte 22 st; p_bytes bytes st - | TOp.TryWith _ -> p_byte 23 st - | TOp.TryFinally _ -> p_byte 24 st - | TOp.ValFieldGetAddr (a, _) -> p_byte 25 st; p_rfref a st - | TOp.UInt16s arr -> p_byte 26 st; p_array p_uint16 arr st - | TOp.Reraise -> p_byte 27 st - | TOp.UnionCaseFieldGetAddr (a, b, _) -> p_byte 28 st; p_tup2 p_ucref p_int (a, b) st - // Note tag byte 29 is taken for struct tuples, see above - // Note tag byte 30 is taken for struct tuples, see above + | TOp.UnionCase c -> + p_byte 0 st + p_ucref c st + | TOp.ExnConstr c -> + p_byte 1 st + p_tcref "op" c st + | TOp.Tuple tupInfo -> + if evalTupInfoIsStruct tupInfo then + p_byte 29 st + else + p_byte 2 st + | TOp.Recd(a, b) -> + p_byte 3 st + p_tup2 p_recdInfo (p_tcref "recd op") (a, b) st + | TOp.ValFieldSet a -> + p_byte 4 st + p_rfref a st + | TOp.ValFieldGet a -> + p_byte 5 st + p_rfref a st + | TOp.UnionCaseTagGet a -> + p_byte 6 st + p_tcref "cnstr op" a st + | TOp.UnionCaseFieldGet(a, b) -> + p_byte 7 st + p_tup2 p_ucref p_int (a, b) st + | TOp.UnionCaseFieldSet(a, b) -> + p_byte 8 st + p_tup2 p_ucref p_int (a, b) st + | TOp.ExnFieldGet(a, b) -> + p_byte 9 st + p_tup2 (p_tcref "exn op") p_int (a, b) st + | TOp.ExnFieldSet(a, b) -> + p_byte 10 st + p_tup2 (p_tcref "exn op") p_int (a, b) st + | TOp.TupleFieldGet(tupInfo, a) -> + if evalTupInfoIsStruct tupInfo then + p_byte 30 st + p_int a st + else + p_byte 11 st + p_int a st + | TOp.ILAsm(a, b) -> + p_byte 12 st + p_tup2 (p_list p_ILInstr) p_tys (a, b) st + | TOp.RefAddrGet _ -> p_byte 13 st + | TOp.UnionCaseProof a -> + p_byte 14 st + p_ucref a st + | TOp.Coerce -> p_byte 15 st + | TOp.TraitCall b -> + p_byte 16 st + p_trait b st + | TOp.LValueOp(a, b) -> + p_byte 17 st + p_tup2 p_lval_op_kind (p_vref "lval") (a, b) st + | TOp.ILCall(a1, a2, a3, a4, a5, a7, a8, a9, b, c, d) -> + p_byte 18 st + + p_tup11 + p_bool + p_bool + p_bool + p_bool + p_vrefFlags + p_bool + p_bool + p_ILMethodRef + p_tys + p_tys + p_tys + (a1, a2, a3, a4, a5, a7, a8, a9, b, c, d) + st + | TOp.Array -> p_byte 19 st + | TOp.While _ -> p_byte 20 st + | TOp.IntegerForLoop(_, _, dir) -> + p_byte 21 st + + p_int + (match dir with + | FSharpForLoopUp -> 0 + | CSharpForLoopUp -> 1 + | FSharpForLoopDown -> 2) + st + | TOp.Bytes bytes -> + p_byte 22 st + p_bytes bytes st + | TOp.TryWith _ -> p_byte 23 st + | TOp.TryFinally _ -> p_byte 24 st + | TOp.ValFieldGetAddr(a, _) -> + p_byte 25 st + p_rfref a st + | TOp.UInt16s arr -> + p_byte 26 st + p_array p_uint16 arr st + | TOp.Reraise -> p_byte 27 st + | TOp.UnionCaseFieldGetAddr(a, b, _) -> + p_byte 28 st + p_tup2 p_ucref p_int (a, b) st + // Note tag byte 29 is taken for struct tuples, see above + // Note tag byte 30 is taken for struct tuples, see above (* 29: TOp.Tuple when evalTupInfoIsStruct tupInfo = true *) (* 30: TOp.TupleFieldGet when evalTupInfoIsStruct tupInfo = true *) - | TOp.AnonRecd info -> p_byte 31 st; p_anonInfo info st - | TOp.AnonRecdGet (info, n) -> p_byte 32 st; p_anonInfo info st; p_int n st - | TOp.Goto _ | TOp.Label _ | TOp.Return -> failwith "unexpected backend construct in pickled TAST" + | TOp.AnonRecd info -> + p_byte 31 st + p_anonInfo info st + | TOp.AnonRecdGet(info, n) -> + p_byte 32 st + p_anonInfo info st + p_int n st + | TOp.Goto _ + | TOp.Label _ + | TOp.Return -> failwith "unexpected backend construct in pickled TAST" and u_op st = let tag = u_byte st + match tag with - | 0 -> let a = u_ucref st - TOp.UnionCase a - | 1 -> let a = u_tcref st - TOp.ExnConstr a + | 0 -> + let a = u_ucref st + TOp.UnionCase a + | 1 -> + let a = u_tcref st + TOp.ExnConstr a | 2 -> TOp.Tuple tupInfoRef - | 3 -> let b = u_tcref st - TOp.Recd (RecdExpr, b) - | 4 -> let a = u_rfref st - TOp.ValFieldSet a - | 5 -> let a = u_rfref st - TOp.ValFieldGet a - | 6 -> let a = u_tcref st - TOp.UnionCaseTagGet a - | 7 -> let a = u_ucref st - let b = u_int st - TOp.UnionCaseFieldGet (a, b) - | 8 -> let a = u_ucref st - let b = u_int st - TOp.UnionCaseFieldSet (a, b) - | 9 -> let a = u_tcref st - let b = u_int st - TOp.ExnFieldGet (a, b) - | 10 -> let a = u_tcref st - let b = u_int st - TOp.ExnFieldSet (a, b) - | 11 -> let a = u_int st - TOp.TupleFieldGet (tupInfoRef, a) - | 12 -> let a = (u_list u_ILInstr) st - let b = u_tys st - TOp.ILAsm (a, b) + | 3 -> + let b = u_tcref st + TOp.Recd(RecdExpr, b) + | 4 -> + let a = u_rfref st + TOp.ValFieldSet a + | 5 -> + let a = u_rfref st + TOp.ValFieldGet a + | 6 -> + let a = u_tcref st + TOp.UnionCaseTagGet a + | 7 -> + let a = u_ucref st + let b = u_int st + TOp.UnionCaseFieldGet(a, b) + | 8 -> + let a = u_ucref st + let b = u_int st + TOp.UnionCaseFieldSet(a, b) + | 9 -> + let a = u_tcref st + let b = u_int st + TOp.ExnFieldGet(a, b) + | 10 -> + let a = u_tcref st + let b = u_int st + TOp.ExnFieldSet(a, b) + | 11 -> + let a = u_int st + TOp.TupleFieldGet(tupInfoRef, a) + | 12 -> + let a = (u_list u_ILInstr) st + let b = u_tys st + TOp.ILAsm(a, b) | 13 -> TOp.RefAddrGet false // ok to set the 'readonly' flag on these operands to false on re-read since the flag is only used for typechecking purposes - | 14 -> let a = u_ucref st - TOp.UnionCaseProof a + | 14 -> + let a = u_ucref st + TOp.UnionCaseProof a | 15 -> TOp.Coerce - | 16 -> let a = u_trait st - TOp.TraitCall a - | 17 -> let a = u_lval_op_kind st - let b = u_vref st - TOp.LValueOp (a, b) - | 18 -> let a1, a2, a3, a4, a5, a7, a8, a9 = (u_tup8 u_bool u_bool u_bool u_bool u_vrefFlags u_bool u_bool u_ILMethodRef) st - let b = u_tys st - let c = u_tys st - let d = u_tys st - TOp.ILCall (a1, a2, a3, a4, a5, a7, a8, a9, b, c, d) + | 16 -> + let a = u_trait st + TOp.TraitCall a + | 17 -> + let a = u_lval_op_kind st + let b = u_vref st + TOp.LValueOp(a, b) + | 18 -> + let a1, a2, a3, a4, a5, a7, a8, a9 = + (u_tup8 u_bool u_bool u_bool u_bool u_vrefFlags u_bool u_bool u_ILMethodRef) st + + let b = u_tys st + let c = u_tys st + let d = u_tys st + TOp.ILCall(a1, a2, a3, a4, a5, a7, a8, a9, b, c, d) | 19 -> TOp.Array - | 20 -> TOp.While (DebugPointAtWhile.No, NoSpecialWhileLoopMarker) - | 21 -> let dir = match u_int st with 0 -> FSharpForLoopUp | 1 -> CSharpForLoopUp | 2 -> FSharpForLoopDown | _ -> failwith "unknown for loop" - TOp.IntegerForLoop (DebugPointAtFor.No, DebugPointAtInOrTo.No, dir) - | 22 -> TOp.Bytes (u_bytes st) - | 23 -> TOp.TryWith (DebugPointAtTry.No, DebugPointAtWith.No) - | 24 -> TOp.TryFinally (DebugPointAtTry.No, DebugPointAtFinally.No) - | 25 -> let a = u_rfref st - TOp.ValFieldGetAddr (a, false) - | 26 -> TOp.UInt16s (u_array u_uint16 st) + | 20 -> TOp.While(DebugPointAtWhile.No, NoSpecialWhileLoopMarker) + | 21 -> + let dir = + match u_int st with + | 0 -> FSharpForLoopUp + | 1 -> CSharpForLoopUp + | 2 -> FSharpForLoopDown + | _ -> failwith "unknown for loop" + + TOp.IntegerForLoop(DebugPointAtFor.No, DebugPointAtInOrTo.No, dir) + | 22 -> TOp.Bytes(u_bytes st) + | 23 -> TOp.TryWith(DebugPointAtTry.No, DebugPointAtWith.No) + | 24 -> TOp.TryFinally(DebugPointAtTry.No, DebugPointAtFinally.No) + | 25 -> + let a = u_rfref st + TOp.ValFieldGetAddr(a, false) + | 26 -> TOp.UInt16s(u_array u_uint16 st) | 27 -> TOp.Reraise - | 28 -> let a = u_ucref st - let b = u_int st - TOp.UnionCaseFieldGetAddr (a, b, false) + | 28 -> + let a = u_ucref st + let b = u_int st + TOp.UnionCaseFieldGetAddr(a, b, false) | 29 -> TOp.Tuple tupInfoStruct - | 30 -> let a = u_int st - TOp.TupleFieldGet (tupInfoStruct, a) - | 31 -> let info = u_anonInfo st - TOp.AnonRecd info - | 32 -> let info = u_anonInfo st - let n = u_int st - TOp.AnonRecdGet (info, n) + | 30 -> + let a = u_int st + TOp.TupleFieldGet(tupInfoStruct, a) + | 31 -> + let info = u_anonInfo st + TOp.AnonRecd info + | 32 -> + let info = u_anonInfo st + let n = u_int st + TOp.AnonRecdGet(info, n) | _ -> ufailwith st "u_op" and p_expr expr st = match expr with | Expr.Link e -> p_expr e.Value st - | Expr.Const (x, m, ty) -> p_byte 0 st; p_tup3 p_const p_dummy_range p_ty (x, m, ty) st - | Expr.Val (a, b, m) -> p_byte 1 st; p_tup3 (p_vref "val") p_vrefFlags p_dummy_range (a, b, m) st - | Expr.Op (a, b, c, d) -> p_byte 2 st; p_tup4 p_op p_tys p_Exprs p_dummy_range (a, b, c, d) st - | Expr.Sequential (a, b, c, d) -> p_byte 3 st; p_tup4 p_expr p_expr p_int p_dummy_range (a, b, (match c with NormalSeq -> 0 | ThenDoSeq -> 1), d) st - | Expr.Lambda (_, a1, b0, b1, c, d, e) -> p_byte 4 st; p_tup6 (p_option p_Val) (p_option p_Val) p_Vals p_expr p_dummy_range p_ty (a1, b0, b1, c, d, e) st - | Expr.TyLambda (_, b, c, d, e) -> p_byte 5 st; p_tup4 p_tyar_specs p_expr p_dummy_range p_ty (b, c, d, e) st - | Expr.App (a1, a2, b, c, d) -> p_byte 6 st; p_tup5 p_expr p_ty p_tys p_Exprs p_dummy_range (a1, a2, b, c, d) st - | Expr.LetRec (a, b, c, _) -> p_byte 7 st; p_tup3 p_binds p_expr p_dummy_range (a, b, c) st - | Expr.Let (a, b, c, _) -> p_byte 8 st; p_tup3 p_bind p_expr p_dummy_range (a, b, c) st - | Expr.Match (_, a, b, c, d, e) -> p_byte 9 st; p_tup5 p_dummy_range p_dtree p_targets p_dummy_range p_ty (a, b, c, d, e) st - | Expr.Obj (_, b, c, d, e, f, g) -> p_byte 10 st; p_tup6 p_ty (p_option p_Val) p_expr p_methods p_intfs p_dummy_range (b, c, d, e, f, g) st - | Expr.StaticOptimization (a, b, c, d) -> p_byte 11 st; p_tup4 p_constraints p_expr p_expr p_dummy_range (a, b, c, d) st - | Expr.TyChoose (a, b, c) -> p_byte 12 st; p_tup3 p_tyar_specs p_expr p_dummy_range (a, b, c) st - | Expr.Quote (ast, _, _, m, ty) -> p_byte 13 st; p_tup3 p_expr p_dummy_range p_ty (ast, m, ty) st - | Expr.WitnessArg (traitInfo, m) -> p_byte 14 st; p_trait traitInfo st; p_dummy_range m st - | Expr.DebugPoint (_, innerExpr) -> p_expr innerExpr st + | Expr.Const(x, m, ty) -> + p_byte 0 st + p_tup3 p_const p_dummy_range p_ty (x, m, ty) st + | Expr.Val(a, b, m) -> + p_byte 1 st + p_tup3 (p_vref "val") p_vrefFlags p_dummy_range (a, b, m) st + | Expr.Op(a, b, c, d) -> + p_byte 2 st + p_tup4 p_op p_tys p_Exprs p_dummy_range (a, b, c, d) st + | Expr.Sequential(a, b, c, d) -> + p_byte 3 st + + p_tup4 + p_expr + p_expr + p_int + p_dummy_range + (a, + b, + (match c with + | NormalSeq -> 0 + | ThenDoSeq -> 1), + d) + st + | Expr.Lambda(_, a1, b0, b1, c, d, e) -> + p_byte 4 st + p_tup6 (p_option p_Val) (p_option p_Val) p_Vals p_expr p_dummy_range p_ty (a1, b0, b1, c, d, e) st + | Expr.TyLambda(_, b, c, d, e) -> + p_byte 5 st + p_tup4 p_tyar_specs p_expr p_dummy_range p_ty (b, c, d, e) st + | Expr.App(a1, a2, b, c, d) -> + p_byte 6 st + p_tup5 p_expr p_ty p_tys p_Exprs p_dummy_range (a1, a2, b, c, d) st + | Expr.LetRec(a, b, c, _) -> + p_byte 7 st + p_tup3 p_binds p_expr p_dummy_range (a, b, c) st + | Expr.Let(a, b, c, _) -> + p_byte 8 st + p_tup3 p_bind p_expr p_dummy_range (a, b, c) st + | Expr.Match(_, a, b, c, d, e) -> + p_byte 9 st + p_tup5 p_dummy_range p_dtree p_targets p_dummy_range p_ty (a, b, c, d, e) st + | Expr.Obj(_, b, c, d, e, f, g) -> + p_byte 10 st + p_tup6 p_ty (p_option p_Val) p_expr p_methods p_intfs p_dummy_range (b, c, d, e, f, g) st + | Expr.StaticOptimization(a, b, c, d) -> + p_byte 11 st + p_tup4 p_constraints p_expr p_expr p_dummy_range (a, b, c, d) st + | Expr.TyChoose(a, b, c) -> + p_byte 12 st + p_tup3 p_tyar_specs p_expr p_dummy_range (a, b, c) st + | Expr.Quote(ast, _, _, m, ty) -> + p_byte 13 st + p_tup3 p_expr p_dummy_range p_ty (ast, m, ty) st + | Expr.WitnessArg(traitInfo, m) -> + p_byte 14 st + p_trait traitInfo st + p_dummy_range m st + | Expr.DebugPoint(_, innerExpr) -> p_expr innerExpr st and u_expr st = let tag = u_byte st + match tag with - | 0 -> let a = u_const st - let b = u_dummy_range st - let c = u_ty st - Expr.Const (a, b, c) - | 1 -> let a = u_vref st - let b = u_vrefFlags st - let c = u_dummy_range st - Expr.Val (a, b, c) - | 2 -> let a = u_op st - let b = u_tys st - let c = u_Exprs st - let d = u_dummy_range st - Expr.Op (a, b, c, d) - | 3 -> let a = u_expr st - let b = u_expr st - let c = u_int st - let d = u_dummy_range st - let dir = match c with 0 -> NormalSeq | 1 -> ThenDoSeq | _ -> ufailwith st "specialSeqFlag" - Expr.Sequential (a, b, dir, d) - | 4 -> let a0 = u_option u_Val st - let b0 = u_option u_Val st - let b1 = u_Vals st - let c = u_expr st - let d = u_dummy_range st - let e = u_ty st - Expr.Lambda (newUnique(), a0, b0, b1, c, d, e) - | 5 -> let b = u_tyar_specs st - let c = u_expr st - let d = u_dummy_range st - let e = u_ty st - Expr.TyLambda (newUnique(), b, c, d, e) - | 6 -> let a1 = u_expr st - let a2 = u_ty st - let b = u_tys st - let c = u_Exprs st - let d = u_dummy_range st - Expr.App (a1, a2, b, c, d) - | 7 -> let a = u_binds st - let b = u_expr st - let c = u_dummy_range st - Expr.LetRec (a, b, c, Construct.NewFreeVarsCache()) - | 8 -> let a = u_bind st - let b = u_expr st - let c = u_dummy_range st - Expr.Let (a, b, c, Construct.NewFreeVarsCache()) - | 9 -> let a = u_dummy_range st - let b = u_dtree st - let c = u_targets st - let d = u_dummy_range st - let e = u_ty st - Expr.Match (DebugPointAtBinding.NoneAtSticky, a, b, c, d, e) - | 10 -> let b = u_ty st - let c = (u_option u_Val) st - let d = u_expr st - let e = u_methods st - let f = u_intfs st - let g = u_dummy_range st - Expr.Obj (newUnique(), b, c, d, e, f, g) - | 11 -> let a = u_constraints st - let b = u_expr st - let c = u_expr st - let d = u_dummy_range st - Expr.StaticOptimization (a, b, c, d) - | 12 -> let a = u_tyar_specs st - let b = u_expr st - let c = u_dummy_range st - Expr.TyChoose (a, b, c) - | 13 -> let b = u_expr st - let c = u_dummy_range st - let d = u_ty st - Expr.Quote (b, ref None, false, c, d) // isFromQueryExpression=false + | 0 -> + let a = u_const st + let b = u_dummy_range st + let c = u_ty st + Expr.Const(a, b, c) + | 1 -> + let a = u_vref st + let b = u_vrefFlags st + let c = u_dummy_range st + Expr.Val(a, b, c) + | 2 -> + let a = u_op st + let b = u_tys st + let c = u_Exprs st + let d = u_dummy_range st + Expr.Op(a, b, c, d) + | 3 -> + let a = u_expr st + let b = u_expr st + let c = u_int st + let d = u_dummy_range st + + let dir = + match c with + | 0 -> NormalSeq + | 1 -> ThenDoSeq + | _ -> ufailwith st "specialSeqFlag" + + Expr.Sequential(a, b, dir, d) + | 4 -> + let a0 = u_option u_Val st + let b0 = u_option u_Val st + let b1 = u_Vals st + let c = u_expr st + let d = u_dummy_range st + let e = u_ty st + Expr.Lambda(newUnique (), a0, b0, b1, c, d, e) + | 5 -> + let b = u_tyar_specs st + let c = u_expr st + let d = u_dummy_range st + let e = u_ty st + Expr.TyLambda(newUnique (), b, c, d, e) + | 6 -> + let a1 = u_expr st + let a2 = u_ty st + let b = u_tys st + let c = u_Exprs st + let d = u_dummy_range st + Expr.App(a1, a2, b, c, d) + | 7 -> + let a = u_binds st + let b = u_expr st + let c = u_dummy_range st + Expr.LetRec(a, b, c, Construct.NewFreeVarsCache()) + | 8 -> + let a = u_bind st + let b = u_expr st + let c = u_dummy_range st + Expr.Let(a, b, c, Construct.NewFreeVarsCache()) + | 9 -> + let a = u_dummy_range st + let b = u_dtree st + let c = u_targets st + let d = u_dummy_range st + let e = u_ty st + Expr.Match(DebugPointAtBinding.NoneAtSticky, a, b, c, d, e) + | 10 -> + let b = u_ty st + let c = (u_option u_Val) st + let d = u_expr st + let e = u_methods st + let f = u_intfs st + let g = u_dummy_range st + Expr.Obj(newUnique (), b, c, d, e, f, g) + | 11 -> + let a = u_constraints st + let b = u_expr st + let c = u_expr st + let d = u_dummy_range st + Expr.StaticOptimization(a, b, c, d) + | 12 -> + let a = u_tyar_specs st + let b = u_expr st + let c = u_dummy_range st + Expr.TyChoose(a, b, c) + | 13 -> + let b = u_expr st + let c = u_dummy_range st + let d = u_ty st + Expr.Quote(b, ref None, false, c, d) // isFromQueryExpression=false | 14 -> let traitInfo = u_trait st let m = u_dummy_range st - Expr.WitnessArg (traitInfo, m) + Expr.WitnessArg(traitInfo, m) | _ -> ufailwith st "u_expr" and p_static_optimization_constraint x st = match x with - | TTyconEqualsTycon (a, b) -> p_byte 0 st; p_tup2 p_ty p_ty (a, b) st - | TTyconIsStruct a -> p_byte 1 st; p_ty a st + | TTyconEqualsTycon(a, b) -> + p_byte 0 st + p_tup2 p_ty p_ty (a, b) st + | TTyconIsStruct a -> + p_byte 1 st + p_ty a st + +and p_slotparam (TSlotParam(a, b, c, d, e, f)) st = + p_tup6 (p_option p_string) p_ty p_bool p_bool p_bool p_attribs (a, b, c, d, e, f) st + +and p_slotsig (TSlotSig(a, b, c, d, e, f)) st = + p_tup6 p_string p_ty p_tyar_specs p_tyar_specs (p_list (p_list p_slotparam)) (p_option p_ty) (a, b, c, d, e, f) st + +and p_method (TObjExprMethod(a, b, c, d, e, f)) st = + p_tup6 p_slotsig p_attribs p_tyar_specs (p_list p_Vals) p_expr p_dummy_range (a, b, c, d, e, f) st -and p_slotparam (TSlotParam (a, b, c, d, e, f)) st = p_tup6 (p_option p_string) p_ty p_bool p_bool p_bool p_attribs (a, b, c, d, e, f) st -and p_slotsig (TSlotSig (a, b, c, d, e, f)) st = p_tup6 p_string p_ty p_tyar_specs p_tyar_specs (p_list (p_list p_slotparam)) (p_option p_ty) (a, b, c, d, e, f) st -and p_method (TObjExprMethod (a, b, c, d, e, f)) st = p_tup6 p_slotsig p_attribs p_tyar_specs (p_list p_Vals) p_expr p_dummy_range (a, b, c, d, e, f) st and p_methods x st = p_list p_method x st and p_intf x st = p_tup2 p_ty p_methods x st and p_intfs x st = p_list p_intf x st and u_static_optimization_constraint st = let tag = u_byte st + match tag with | 0 -> u_tup2 u_ty u_ty st |> TTyconEqualsTycon - | 1 -> u_ty st |> TTyconIsStruct + | 1 -> u_ty st |> TTyconIsStruct | _ -> ufailwith st "u_static_optimization_constraint" and u_slotparam st = - let a, b, c, d, e, f = u_tup6 (u_option u_string) u_ty u_bool u_bool u_bool u_attribs st + let a, b, c, d, e, f = + u_tup6 (u_option u_string) u_ty u_bool u_bool u_bool u_attribs st + TSlotParam(a, b, c, d, e, f) and u_slotsig st = - let a, b, c, d, e, f = u_tup6 u_string u_ty u_tyar_specs u_tyar_specs (u_list (u_list u_slotparam)) (u_option u_ty) st + let a, b, c, d, e, f = + u_tup6 u_string u_ty u_tyar_specs u_tyar_specs (u_list (u_list u_slotparam)) (u_option u_ty) st + TSlotSig(a, b, c, d, e, f) and u_method st = - let a, b, c, d, e, f = u_tup6 u_slotsig u_attribs u_tyar_specs (u_list u_Vals) u_expr u_dummy_range st + let a, b, c, d, e, f = + u_tup6 u_slotsig u_attribs u_tyar_specs (u_list u_Vals) u_expr u_dummy_range st + TObjExprMethod(a, b, c, d, e, f) and u_methods st = u_list u_method st @@ -2905,5 +3963,11 @@ let pickleCcuInfo (minfo: PickledCcuInfo) st = let unpickleModuleOrNamespace st = u_entity_spec st let unpickleCcuInfo st = - let a, b, c, _space = u_tup4 unpickleModuleOrNamespace u_string u_bool (u_space 3) st - { mspec=a; compileTimeWorkingDir=b; usesQuotations=c } + let a, b, c, _space = + u_tup4 unpickleModuleOrNamespace u_string u_bool (u_space 3) st + + { + mspec = a + compileTimeWorkingDir = b + usesQuotations = c + } diff --git a/src/Compiler/Utilities/FileSystem.fs b/src/Compiler/Utilities/FileSystem.fs index 81d6113cc18..ce2488cd0aa 100644 --- a/src/Compiler/Utilities/FileSystem.fs +++ b/src/Compiler/Utilities/FileSystem.fs @@ -427,17 +427,17 @@ 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 - !! Path.GetFileName(path) + !!Path.GetFileName(path) let fileNameWithoutExtensionWithValidate (validate: bool) path = if validate then checkPathForIllegalChars path - !! Path.GetFileNameWithoutExtension(path) + !!Path.GetFileNameWithoutExtension(path) let fileNameWithoutExtension path = !! fileNameWithoutExtensionWithValidate true path @@ -705,8 +705,7 @@ type DefaultFileSystem() as this = 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 @@ -824,7 +823,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/sr.fs b/src/Compiler/Utilities/sr.fs index 10a615846e3..968525e931e 100644 --- a/src/Compiler/Utilities/sr.fs +++ b/src/Compiler/Utilities/sr.fs @@ -14,9 +14,7 @@ module internal SR = let GetString (name: string) = let s = - resources - .Force() - .GetString(name, System.Globalization.CultureInfo.CurrentUICulture) + resources.Force().GetString(name, System.Globalization.CultureInfo.CurrentUICulture) #if DEBUG if isNull s then System.Diagnostics.Debug.Assert(false, sprintf "**RESOURCE ERROR**: Resource token %s does not exist!" name) diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 74894da5d02..7d64601c303 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -172,6 +172,11 @@ Dostupná přetížení:\n{0} + + The constraints 'comparison' and 'delegate' are inconsistent + The constraints 'comparison' and 'delegate' are inconsistent + + '{0}' does not support the type '{1}', because the latter lacks the required (real or built-in) member '{2}' {0} nepodporuje typ {1}, protože tento typ postrádá požadovaný (skutečný nebo vestavěný) člen {2} @@ -212,6 +217,11 @@ The constraints 'null' and 'not null' are inconsistent + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + Argument at index {0} doesn't match Argument na indexu {0} neodpovídá diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 77409615867..67f4270377e 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -172,6 +172,11 @@ Verfügbare Überladungen:\n{0} + + The constraints 'comparison' and 'delegate' are inconsistent + The constraints 'comparison' and 'delegate' are inconsistent + + '{0}' does not support the type '{1}', because the latter lacks the required (real or built-in) member '{2}' "{0}" unterstützt den Typ "{1}" nicht, da letzteres nicht das erforderliche (echte oder integrierte) Element "{2}" aufweist. @@ -212,6 +217,11 @@ The constraints 'null' and 'not null' are inconsistent + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + Argument at index {0} doesn't match Das Argument bei Index {0} stimmt nicht überein. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 9f042384d39..9478e3d2c55 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -172,6 +172,11 @@ Sobrecargas disponibles:\n{0} + + The constraints 'comparison' and 'delegate' are inconsistent + The constraints 'comparison' and 'delegate' are inconsistent + + '{0}' does not support the type '{1}', because the latter lacks the required (real or built-in) member '{2}' '{0}' no admite el tipo '{1}', porque a este último le falta el '{2}' de miembro necesario (real o integrado) @@ -212,6 +217,11 @@ The constraints 'null' and 'not null' are inconsistent + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + Argument at index {0} doesn't match El argumento del índice {0} no coincide. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 621286a8e21..57fade5d250 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -172,6 +172,11 @@ Surcharges disponibles :\n{0} + + The constraints 'comparison' and 'delegate' are inconsistent + The constraints 'comparison' and 'delegate' are inconsistent + + '{0}' does not support the type '{1}', because the latter lacks the required (real or built-in) member '{2}' '{0}' ne prend pas en charge le type '{1}', car ce dernier n'a pas le membre requis (réel ou intégré) '{2}' @@ -212,6 +217,11 @@ The constraints 'null' and 'not null' are inconsistent + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + Argument at index {0} doesn't match L'argument à l'index {0} ne correspond pas diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 1d7bdf56aa0..14d670e8455 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -172,6 +172,11 @@ Overload disponibili:\n{0} + + The constraints 'comparison' and 'delegate' are inconsistent + The constraints 'comparison' and 'delegate' are inconsistent + + '{0}' does not support the type '{1}', because the latter lacks the required (real or built-in) member '{2}' '{0}' non supporta il tipo '{1}', perché in quest'ultimo manca il membro '{2}' richiesto (reale o predefinito) @@ -212,6 +217,11 @@ The constraints 'null' and 'not null' are inconsistent + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + Argument at index {0} doesn't match L'argomento alla posizione di indice {0} non corrisponde diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index c928a51da3e..78acb0fd944 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -172,6 +172,11 @@ 使用可能なオーバーロード:\n{0} + + The constraints 'comparison' and 'delegate' are inconsistent + The constraints 'comparison' and 'delegate' are inconsistent + + '{0}' does not support the type '{1}', because the latter lacks the required (real or built-in) member '{2}' 型 '{1}' には必要な (実数または組み込み) メンバー '{2}' がないため、'{0}' ではサポートされません @@ -212,6 +217,11 @@ The constraints 'null' and 'not null' are inconsistent + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + Argument at index {0} doesn't match インデックス {0} の引数が一致しません diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index aaff373fcda..604ac431e4a 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -172,6 +172,11 @@ 사용 가능한 오버로드:\n{0} + + The constraints 'comparison' and 'delegate' are inconsistent + The constraints 'comparison' and 'delegate' are inconsistent + + '{0}' does not support the type '{1}', because the latter lacks the required (real or built-in) member '{2}' '{1}' 형식에는 필수(실제 또는 기본 제공) 멤버 '{2}'이(가) 없기 때문에 '{0}'이(가) 이 형식을 지원하지 않습니다. @@ -212,6 +217,11 @@ The constraints 'null' and 'not null' are inconsistent + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + Argument at index {0} doesn't match 인덱스 {0}의 인수가 일치하지 않습니다. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index f886e72e8f8..fdee3d82f7d 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -172,6 +172,11 @@ Dostępne przeciążenia:\n{0} + + The constraints 'comparison' and 'delegate' are inconsistent + The constraints 'comparison' and 'delegate' are inconsistent + + '{0}' does not support the type '{1}', because the latter lacks the required (real or built-in) member '{2}' Element „{0}” nie obsługuje typu „{1}”, ponieważ ten drugi nie ma wymaganej (rzeczywistej lub wbudowanej) składowej „{2}” @@ -212,6 +217,11 @@ The constraints 'null' and 'not null' are inconsistent + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + Argument at index {0} doesn't match Argument pod indeksem {0} nie jest zgodny diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 69082574676..2f86c57d960 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -172,6 +172,11 @@ Sobrecargas disponíveis:\n{0} + + The constraints 'comparison' and 'delegate' are inconsistent + The constraints 'comparison' and 'delegate' are inconsistent + + '{0}' does not support the type '{1}', because the latter lacks the required (real or built-in) member '{2}' "{0}" não dá suporte ao tipo "{1}", pois o último não tem o membro necessário (real ou interno) "{2}: @@ -212,6 +217,11 @@ The constraints 'null' and 'not null' are inconsistent + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + Argument at index {0} doesn't match O argumento no índice {0} não corresponde diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index df0d5f9770a..fefd5255a0b 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -172,6 +172,11 @@ Доступные перегрузки:\n{0} + + The constraints 'comparison' and 'delegate' are inconsistent + The constraints 'comparison' and 'delegate' are inconsistent + + '{0}' does not support the type '{1}', because the latter lacks the required (real or built-in) member '{2}' '{0}' не поддерживает тип '{1}', поскольку у последнего отсутствует необходимый (реальный или встроенный) член '{2}' @@ -212,6 +217,11 @@ The constraints 'null' and 'not null' are inconsistent + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + Argument at index {0} doesn't match Аргумент в индексе {0} не соответствует diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 77568593137..5325f0ab09f 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -172,6 +172,11 @@ Kullanılabilir aşırı yüklemeler:\n{0} + + The constraints 'comparison' and 'delegate' are inconsistent + The constraints 'comparison' and 'delegate' are inconsistent + + '{0}' does not support the type '{1}', because the latter lacks the required (real or built-in) member '{2}' '{0}', gerekli (gerçek veya yerleşik) '{2}' üyesine sahip olmadığından '{1}' türünü desteklemiyor @@ -212,6 +217,11 @@ The constraints 'null' and 'not null' are inconsistent + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + Argument at index {0} doesn't match {0} dizinindeki bağımsız değişken eşleşmiyor diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 59532dc06d8..2e8b957d810 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -172,6 +172,11 @@ 可用重载:\n{0} + + The constraints 'comparison' and 'delegate' are inconsistent + The constraints 'comparison' and 'delegate' are inconsistent + + '{0}' does not support the type '{1}', because the latter lacks the required (real or built-in) member '{2}' “{0}”不支持类型“{1}”,因为后者缺少所需的(实际或内置)成员“{2}” @@ -212,6 +217,11 @@ The constraints 'null' and 'not null' are inconsistent + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + Argument at index {0} doesn't match 索引 {0} 处的参数不匹配 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 2274eb373c8..f0924b3d30f 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -172,6 +172,11 @@ 可用的多載:\n{0} + + The constraints 'comparison' and 'delegate' are inconsistent + The constraints 'comparison' and 'delegate' are inconsistent + + '{0}' does not support the type '{1}', because the latter lacks the required (real or built-in) member '{2}' '{0}' 不支援類型 '{1}',因為後者缺少必要的 (實際或內建) 成員 '{2}' @@ -212,6 +217,11 @@ The constraints 'null' and 'not null' are inconsistent + + The constraints 'struct' and 'null' are inconsistent + The constraints 'struct' and 'null' are inconsistent + + Argument at index {0} doesn't match 位於索引 {0} 的引數不相符 diff --git a/src/FSharp.Build/FSharpEmbedResXSource.fs b/src/FSharp.Build/FSharpEmbedResXSource.fs index 8a26386cf47..219ae5a4f2c 100644 --- a/src/FSharp.Build/FSharpEmbedResXSource.fs +++ b/src/FSharp.Build/FSharpEmbedResXSource.fs @@ -72,8 +72,7 @@ module internal {1} = printMessage "Generating code for target framework %s" _targetFramework let sb = - StringBuilder() - .AppendLine(String.Format(boilerplate, namespaceName, moduleName, justFileName)) + StringBuilder().AppendLine(String.Format(boilerplate, namespaceName, moduleName, justFileName)) if generateGetObject then sb.AppendLine(boilerplateGetObject) |> ignore @@ -103,9 +102,7 @@ module internal {1} = "_" + name let commentBody = - XElement(xname "summary", docComment) - .ToString() - .Split([| "\r\n"; "\r"; "\n" |], StringSplitOptions.None) + XElement(xname "summary", docComment).ToString().Split([| "\r\n"; "\r"; "\n" |], StringSplitOptions.None) |> Array.fold (fun (sb: StringBuilder) line -> sb.AppendLine(" /// " + line)) (StringBuilder()) // add the resource let accessorBody = diff --git a/src/FSharp.Build/Fsi.fs b/src/FSharp.Build/Fsi.fs index dc362420db0..a8ad12d1b2c 100644 --- a/src/FSharp.Build/Fsi.fs +++ b/src/FSharp.Build/Fsi.fs @@ -112,9 +112,7 @@ type public Fsi() as this = let warningsAsErrorsArray = match warningsAsErrors with | Null -> [| "76" |] - | NonNull warningsAsErrors -> - (warningsAsErrors + " 76 ") - .Split([| ' '; ';'; ',' |], StringSplitOptions.RemoveEmptyEntries) + | NonNull warningsAsErrors -> (warningsAsErrors + " 76 ").Split([| ' '; ';'; ',' |], StringSplitOptions.RemoveEmptyEntries) builder.AppendSwitchesIfNotNull("--warnaserror:", warningsAsErrorsArray, ",") diff --git a/src/FSharp.Core/array.fs b/src/FSharp.Core/array.fs index 63df73e5014..27c6d6426b6 100644 --- a/src/FSharp.Core/array.fs +++ b/src/FSharp.Core/array.fs @@ -1934,7 +1934,7 @@ module Array = let valuesArray = Seq.toArray values if valuesArray.Length = 0 then - source + source.Clone() :?> 'T array else let length = source.Length + valuesArray.Length let result = Microsoft.FSharp.Primitives.Basics.Array.zeroCreateUnchecked length diff --git a/src/FSharp.Core/array.fsi b/src/FSharp.Core/array.fsi index 6e76dbc32c6..151081c300c 100644 --- a/src/FSharp.Core/array.fsi +++ b/src/FSharp.Core/array.fsi @@ -3080,7 +3080,7 @@ module Array = /// The values to insert. /// The input array. /// - /// The result array. + /// A new array (even if values is empty). /// /// Thrown when index is below 0 or greater than source.Length. /// diff --git a/src/FSharp.Core/async.fs b/src/FSharp.Core/async.fs index 2b117be0b16..170b30cce0f 100644 --- a/src/FSharp.Core/async.fs +++ b/src/FSharp.Core/async.fs @@ -235,8 +235,7 @@ type TrampolineHolder() = // This should be the only call to Thread.Start in this library. We must always install a trampoline. member this.StartThreadWithTrampoline(f: unit -> AsyncReturn) = - Thread(getThreadStartCallbackForStartThreadWithTrampoline (this), IsBackground = true) - .Start(f |> box) + Thread(getThreadStartCallbackForStartThreadWithTrampoline (this), IsBackground = true).Start(f |> box) AsyncReturn.Fake() @@ -1741,13 +1740,8 @@ type Async = /// StartWithContinuations, except the exception continuation is given an ExceptionDispatchInfo static member StartWithContinuationsUsingDispatchInfo - ( - computation: Async<'T>, - continuation, - exceptionContinuation, - cancellationContinuation, - ?cancellationToken - ) : unit = + (computation: Async<'T>, continuation, exceptionContinuation, cancellationContinuation, ?cancellationToken) + : unit = let cancellationToken = defaultArg cancellationToken defaultCancellationTokenSource.Token @@ -1759,13 +1753,8 @@ type Async = cancellationContinuation static member StartWithContinuations - ( - computation: Async<'T>, - continuation, - exceptionContinuation, - cancellationContinuation, - ?cancellationToken - ) : unit = + (computation: Async<'T>, continuation, exceptionContinuation, cancellationContinuation, ?cancellationToken) + : unit = Async.StartWithContinuationsUsingDispatchInfo( computation, continuation, @@ -1939,11 +1928,8 @@ type Async = /// it happens the child computation will be cancelled. The resulting async doesn't support cancellation /// directly, rather the underlying computation must fill the result if cancellation occurs. static member AwaitAndBindChildResult - ( - innerCTS: CancellationTokenSource, - resultCell: ResultCell>, - millisecondsTimeout - ) : Async<'T> = + (innerCTS: CancellationTokenSource, resultCell: ResultCell>, millisecondsTimeout) + : Async<'T> = match millisecondsTimeout with | None | Some -1 -> resultCell |> Async.AwaitAndBindResult_NoDirectCancelOrTimeout diff --git a/src/FSharp.Core/map.fs b/src/FSharp.Core/map.fs index b46bd9d357d..4eeed1465a1 100644 --- a/src/FSharp.Core/map.fs +++ b/src/FSharp.Core/map.fs @@ -1001,13 +1001,7 @@ type Map<[] 'Key, [ let txt1 = LanguagePrimitives.anyToStringShowingNull h1 let txt2 = LanguagePrimitives.anyToStringShowingNull h2 diff --git a/src/FSharp.Core/quotations.fs b/src/FSharp.Core/quotations.fs index 2f90f7a48ee..ea8b17d6f26 100644 --- a/src/FSharp.Core/quotations.fs +++ b/src/FSharp.Core/quotations.fs @@ -2531,13 +2531,8 @@ type Expr with mkStaticMethodCallW (methodInfo, methodInfoWithWitnesses, List.length witnesses, witnesses @ arguments) static member CallWithWitnesses - ( - obj: Expr, - methodInfo: MethodInfo, - methodInfoWithWitnesses: MethodInfo, - witnesses, - arguments - ) = + (obj: Expr, methodInfo: MethodInfo, methodInfoWithWitnesses: MethodInfo, witnesses, arguments) + = checkNonNull "methodInfo" methodInfo checkNonNull "methodInfoWithWitnesses" methodInfoWithWitnesses mkInstanceMethodCallW (obj, methodInfo, methodInfoWithWitnesses, List.length witnesses, witnesses @ arguments) diff --git a/src/FSharp.Core/reflect.fs b/src/FSharp.Core/reflect.fs index 32811ae604c..e0742b3dd06 100644 --- a/src/FSharp.Core/reflect.fs +++ b/src/FSharp.Core/reflect.fs @@ -1336,8 +1336,7 @@ type FSharpValue = static member PreComputeTupleConstructor(tupleType: Type) = checkTupleType ("tupleType", tupleType) - (compileTupleConstructor tupleEncField getTupleConstructorMethod tupleType) - .Invoke + (compileTupleConstructor tupleEncField getTupleConstructorMethod tupleType).Invoke static member PreComputeTupleConstructorInfo(tupleType: Type) = checkTupleType ("tupleType", tupleType) @@ -1445,10 +1444,8 @@ module FSharpReflectionExtensions = FSharpValue.GetRecordFields(record, bindingFlags) static member PreComputeRecordReader - ( - recordType: Type, - ?allowAccessToPrivateRepresentation - ) : (obj -> objnull array) = + (recordType: Type, ?allowAccessToPrivateRepresentation) + : (obj -> objnull array) = let bindingFlags = getBindingFlags allowAccessToPrivateRepresentation FSharpValue.PreComputeRecordReader(recordType, bindingFlags) @@ -1481,18 +1478,14 @@ module FSharpReflectionExtensions = FSharpValue.GetUnionFields(value, unionType, bindingFlags) static member PreComputeUnionTagReader - ( - unionType: Type, - ?allowAccessToPrivateRepresentation - ) : (objnull -> int) = + (unionType: Type, ?allowAccessToPrivateRepresentation) + : (objnull -> int) = let bindingFlags = getBindingFlags allowAccessToPrivateRepresentation FSharpValue.PreComputeUnionTagReader(unionType, bindingFlags) static member PreComputeUnionReader - ( - unionCase: UnionCaseInfo, - ?allowAccessToPrivateRepresentation - ) : (objnull -> objnull array) = + (unionCase: UnionCaseInfo, ?allowAccessToPrivateRepresentation) + : (objnull -> objnull array) = let bindingFlags = getBindingFlags allowAccessToPrivateRepresentation FSharpValue.PreComputeUnionReader(unionCase, bindingFlags) diff --git a/src/FSharp.Core/seq.fs b/src/FSharp.Core/seq.fs index 35adcdda557..20fcdefb159 100644 --- a/src/FSharp.Core/seq.fs +++ b/src/FSharp.Core/seq.fs @@ -478,8 +478,7 @@ module Internal = static member Bind(g: Generator<'T>, cont) = match g with | :? GenerateThen<'T> as g -> - GenerateThen<_> - .Bind(g.Generator, (fun () -> GenerateThen<_>.Bind(g.Cont(), cont))) + GenerateThen<_>.Bind(g.Generator, (fun () -> GenerateThen<_>.Bind(g.Cont(), cont))) | g -> (new GenerateThen<'T>(g, cont) :> Generator<'T>) let bindG g cont = @@ -854,7 +853,7 @@ module Seq = seq { use e = source.GetEnumerator() - for x in count .. - 1 .. 1 do + for x in count .. -1 .. 1 do if not (e.MoveNext()) then invalidOpFmt "{0}: tried to take {1} {2} past the end of the seq. Use Seq.truncate to get {3} or less elements" diff --git a/src/FSharp.Core/set.fs b/src/FSharp.Core/set.fs index 85fc718c461..f6ac7f99490 100644 --- a/src/FSharp.Core/set.fs +++ b/src/FSharp.Core/set.fs @@ -990,13 +990,7 @@ type Set<[] 'T when 'T: comparison>(comparer: IComparer<' let txt1 = LanguagePrimitives.anyToStringShowingNull h1 let txt2 = LanguagePrimitives.anyToStringShowingNull h2 - StringBuilder() - .Append("set [") - .Append(txt1) - .Append("; ") - .Append(txt2) - .Append("]") - .ToString() + StringBuilder().Append("set [").Append(txt1).Append("; ").Append(txt2).Append("]").ToString() | [ h1; h2; h3 ] -> let txt1 = LanguagePrimitives.anyToStringShowingNull h1 let txt2 = LanguagePrimitives.anyToStringShowingNull h2 diff --git a/src/FSharp.DependencyManager.Nuget/FSDependencyManager.txt b/src/FSharp.DependencyManager.Nuget/FSDependencyManager.txt index e70d2691151..6eb22c00f7a 100644 --- a/src/FSharp.DependencyManager.Nuget/FSDependencyManager.txt +++ b/src/FSharp.DependencyManager.Nuget/FSDependencyManager.txt @@ -9,4 +9,5 @@ highestVersion,"with the highest version" sourceDirectoryDoesntExist,"The source directory '%s' not found" timedoutResolvingPackages,"Timed out resolving packages, process: '%s' '%s'" invalidTimeoutValue,"Invalid value for timeout '%s', valid values: none, -1 and integer milliseconds to wait" -missingTimeoutValue,"Missing value for timeout" \ No newline at end of file +missingTimeoutValue,"Missing value for timeout" +invalidBooleanValue,"Invalid value for boolean '%s', valid values: true or false" \ No newline at end of file diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs index 553c97dc60f..f25d31a1ba7 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs @@ -11,6 +11,7 @@ type PackageReference = Version: string RestoreSources: string Script: string + UsePackageTargets: bool } module internal ProjectFile = diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs index 6b9d33ff663..ecfe86109aa 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs @@ -95,9 +95,7 @@ module internal Utilities = let getResolutionsFromFile resolutionsFile = let lines = try - File - .ReadAllText(resolutionsFile) - .Split([| '\r'; '\n' |], StringSplitOptions.None) + File.ReadAllText(resolutionsFile).Split([| '\r'; '\n' |], StringSplitOptions.None) |> Array.filter (String.IsNullOrEmpty >> not) with _ -> [||] diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs index fe0433f71cf..a1ff3c900bb 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs @@ -55,16 +55,30 @@ module FSharpDependencyManager = Version = ver RestoreSources = src Script = script + UsePackageTargets = usePackageTargets } = p + let usePackageTargets = + match usePackageTargets with + | false -> "ExcludeAssets='build;buildTransitive;buildMultitargeting'" + | true -> "" + seq { match not (String.IsNullOrEmpty(inc)), not (String.IsNullOrEmpty(ver)), not (String.IsNullOrEmpty(script)) with - | true, true, false -> yield sprintf @" " inc ver + | true, true, false -> + yield sprintf @" " inc ver usePackageTargets | true, true, true -> - yield sprintf @" " inc ver script - | true, false, false -> yield sprintf @" " inc - | true, false, true -> yield sprintf @" " inc script + yield + sprintf + @" " + inc + ver + script + usePackageTargets + | true, false, false -> yield sprintf @" " inc usePackageTargets + | true, false, true -> + yield sprintf @" " inc script usePackageTargets | _ -> () match not (String.IsNullOrEmpty(src)) with @@ -96,6 +110,7 @@ module FSharpDependencyManager = Version = "*" RestoreSources = "" Script = "" + UsePackageTargets = false } match options with @@ -114,11 +129,20 @@ module FSharpDependencyManager = let setVersion v = Some { current with Version = v } + let setUsePackageTargets v = + Some { current with UsePackageTargets = v } + match opt with | Some "include", Some v -> addInclude v |> parsePackageReferenceOption' rest implicitArgumentCount | Some "include", None -> raise (ArgumentException(SR.requiresAValue ("Include"))) | Some "version", Some v -> setVersion v |> parsePackageReferenceOption' rest implicitArgumentCount | Some "version", None -> setVersion "*" |> parsePackageReferenceOption' rest implicitArgumentCount + | Some "usepackagetargets", v -> + match v with + | Some v when v.ToLowerInvariant() = "true" -> setUsePackageTargets true + | Some v when v.ToLowerInvariant() = "false" -> setUsePackageTargets false + | _ -> raise (ArgumentException(SR.invalidBooleanValue ("usepackagetargets"))) + |> parsePackageReferenceOption' rest implicitArgumentCount | Some "restoresources", Some v -> Some { current with @@ -199,12 +223,8 @@ module FSharpDependencyManager = |> (fun l -> l, binLogPath, timeout) let computeHashForResolutionInputs - ( - scriptExt: string, - directiveLines: (string * string) seq, - targetFrameworkMoniker: string, - runtimeIdentifier: string - ) : string option = + (scriptExt: string, directiveLines: (string * string) seq, targetFrameworkMoniker: string, runtimeIdentifier: string) + : string option = let packageReferences, _, _ = directiveLines |> List.ofSeq |> parsePackageDirective scriptExt @@ -212,12 +232,12 @@ module FSharpDependencyManager = let referencesHaveWildCardVersion = // Verify to see if the developer specified a wildcard version. If they did then caching is not possible let hasWildCardVersion p = - // Todo: named record please let { Include = package Version = ver RestoreSources = _ Script = _ + UsePackageTargets = _ } = p diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.cs.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.cs.xlf index 800c2e40248..1df52699df6 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.cs.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.cs.xlf @@ -12,6 +12,11 @@ s nejvyšší verzí + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Neplatná hodnota pro časový limit {0}. Platné hodnoty: none, -1 a celočíselný počet milisekund, po které se má počkat diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.de.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.de.xlf index f3762130515..bb2ec8665b4 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.de.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.de.xlf @@ -12,6 +12,11 @@ mit der höchsten Version + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Ungültiger Wert für Timeout "{0}", gültige Werte: keine, -1 und ganzzahlige Millisekundenwerte für die Wartezeit diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.es.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.es.xlf index 2851c230dab..e9ee6650268 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.es.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.es.xlf @@ -12,6 +12,11 @@ con la última versión + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Valor de tiempo de espera "{0}" no válido. Valores válidos: ninguno, -1 y un número entero de milisegundos de espera diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.fr.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.fr.xlf index 8ab1dccc35f..60c4bb10953 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.fr.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.fr.xlf @@ -12,6 +12,11 @@ avec la version la plus récente + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Valeur non valide pour le délai d'expiration : '{0}'. Valeurs valides : aucune valeur, -1 ou un nombre entier pour le délai d'attente en millisecondes diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.it.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.it.xlf index c605c4af3ba..260e4879994 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.it.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.it.xlf @@ -12,6 +12,11 @@ con la versione massima + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Valore non valido per il timeout '{0}'. I valori validi sono: nessuno, -1 e numeri interi per i millisecondi di attesa diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ja.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ja.xlf index 2e19d06a10f..63bb78e5411 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ja.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ja.xlf @@ -12,6 +12,11 @@ 最新バージョン + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait タイムアウト '{0}' の値が無効です。有効な値: なし、-1、および整数 (待機するミリ秒) diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ko.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ko.xlf index 01d252b6243..2390149fd84 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ko.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ko.xlf @@ -12,6 +12,11 @@ 최상위 버전으로 + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait 시간 제한 '{0}'의 값이 잘못되었습니다. 유효한 값: 없음, -1 및 정수 대기 시간(밀리초) diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pl.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pl.xlf index 4ae0d2e448e..19b971eb1eb 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pl.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pl.xlf @@ -12,6 +12,11 @@ z najwyższą wersją + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Nieprawidłowa wartość limitu czasu „{0}”; prawidłowe wartości: none, -1 i liczba całkowita określająca liczbę milisekund oczekiwania 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 7e8409fd8d7..fe73e35d112 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pt-BR.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pt-BR.xlf @@ -12,6 +12,11 @@ com a versão mais recente + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Valor inválido para o tempo limite '{0}'. Valores válidos: none,-1 e milissegundos inteiros de espera diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ru.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ru.xlf index dafbfb8243d..c7f602855d5 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ru.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ru.xlf @@ -12,6 +12,11 @@ с наивысшей версией + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Недопустимое значение времени ожидания "{0}". Допустимые значения: none, –1 и integer, мс ожидания. diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.tr.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.tr.xlf index 312793af714..585ac4950e4 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.tr.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.tr.xlf @@ -12,6 +12,11 @@ en yüksek sürümle + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Zaman aşımı için '{0}' değeri geçersiz, geçerli değerler: none, -1 ve tamsayı milisaniye cinsinden bekleme süresi 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 7e04d921b0a..2192ad1c9df 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hans.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hans.xlf @@ -12,6 +12,11 @@ 具有最高版本 + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait 超时 "{0}" 的值无效,有效值: none、-1 和要等待的毫秒数(整数) 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 d82293b0cf2..f7911a29659 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hant.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hant.xlf @@ -12,6 +12,11 @@ 具有最高版本 + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait 逾時 '{0}' 值無效,有效的值: 無、-1 和要等候的整數毫秒 diff --git a/tests/EndToEndBuildTests/Directory.Build.props b/tests/EndToEndBuildTests/Directory.Build.props index 7537d3adc6e..4a8f0153de0 100644 --- a/tests/EndToEndBuildTests/Directory.Build.props +++ b/tests/EndToEndBuildTests/Directory.Build.props @@ -5,6 +5,7 @@ LatestMajor + diff --git a/tests/EndToEndBuildTests/EndToEndBuildTests.cmd b/tests/EndToEndBuildTests/EndToEndBuildTests.cmd index eba1498af91..7613f487e35 100644 --- a/tests/EndToEndBuildTests/EndToEndBuildTests.cmd +++ b/tests/EndToEndBuildTests/EndToEndBuildTests.cmd @@ -27,9 +27,9 @@ echo %__scriptpath%BasicProvider\TestBasicProvider.cmd -c %configuration% call %__scriptpath%BasicProvider\TestBasicProvider.cmd -c %configuration% if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure -rem echo %__scriptpath%ComboProvider\TestComboProvider.cmd -c %configuration% -rem call %__scriptpath%ComboProvider\TestComboProvider.cmd -c %configuration% -rem if ERRORLEVEL 1 echo Error: TestComboProvider failed && goto :failure +echo %__scriptpath%ComboProvider\TestComboProvider.cmd -c %configuration% +call %__scriptpath%ComboProvider\TestComboProvider.cmd -c %configuration% +if ERRORLEVEL 1 echo Error: TestComboProvider failed && goto :failure :success endlocal 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 a28d6175642..c7c2cf72eca 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs @@ -100,7 +100,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargets01_fs`` compilation = compilation - |> withLangVersion90 + |> withLangVersionPreview |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -136,7 +136,7 @@ module CustomAttributes_AttributeUsage = let ``E_AttributeTargetIsField01_fs`` compilation = compilation |> withOptions ["--nowarn:25"] - |> withLangVersion90 + |> withLangVersionPreview |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -189,7 +189,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetIsMethod02_fs`` compilation = compilation - |> withLangVersion90 + |> withLangVersionPreview |> withOptions ["--nowarn:25"] |> verifyCompile |> shouldFail @@ -220,7 +220,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetIsMethod03_fs`` compilation = compilation - |> withLangVersion90 + |> withLangVersionPreview |> withOptions ["--nowarn:25"] |> verifyCompile |> shouldFail @@ -338,7 +338,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetIsStruct_fs`` compilation = compilation - |> withLangVersion90 + |> withLangVersionPreview |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -368,7 +368,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetIsClass_fs`` compilation = compilation - |> withLangVersion90 + |> withLangVersionPreview |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -389,7 +389,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetIsClass01_fs`` compilation = compilation - |> withLangVersion90 + |> withLangVersionPreview |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -487,7 +487,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetIsField03_fs`` compilation = compilation - |> withLangVersion90 + |> withLangVersionPreview |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -507,7 +507,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetIsProperty01_fs`` compilation = compilation - |> withLangVersion90 + |> withLangVersionPreview |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -527,7 +527,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetIsCtor01_fs`` compilation = compilation - |> withLangVersion90 + |> withLangVersionPreview |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -564,7 +564,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetIsEnum01_fs`` compilation = compilation - |> withLangVersion90 + |> withLangVersionPreview |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -601,7 +601,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetsIsDelegate01_fs`` compilation = compilation - |> withLangVersion90 + |> withLangVersionPreview |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -650,7 +650,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = [] let ``E_AttributeTargetIsInterface_fs`` compilation = compilation - |> withLangVersion90 + |> withLangVersionPreview |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -672,7 +672,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = [] let ``E_AttributeTargetIsClass02_fs`` compilation = compilation - |> withLangVersion90 + |> withLangVersionPreview |> verifyCompile |> shouldFail |> withDiagnostics [ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/DelegateTypes/DelegateDefinition.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/DelegateTypes/DelegateDefinition.fs index b14bc83ce3f..1f4462fa6d3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/DelegateTypes/DelegateDefinition.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/DelegateTypes/DelegateDefinition.fs @@ -46,3 +46,25 @@ namespace FSharpTest """ |> compile |> shouldSucceed + + [] + let ``Delegate with optional parameter`` () = + FSharp """open System.Runtime.CompilerServices +type A = delegate of [] ?a: int -> unit +let f = fun (a: int option) -> defaultArg a 100 |> printf "line: %d" +let a = A f +a.Invoke()""" + |> compileExeAndRun + |> shouldSucceed + |> verifyOutput "line: 5" + + [] + let ``Delegate with struct optional parameter`` () = + FSharp """type A = delegate of [] ?a: int -> unit +let f = fun (a: int voption) -> defaultValueArg a 100 |> printf "line: %d" +let a = A f +a.Invoke(5)""" + |> withLangVersionPreview + |> compileExeAndRun + |> shouldSucceed + |> verifyOutput "line: 5" diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs index 693833ef4b8..1b68505ab1e 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs @@ -773,13 +773,6 @@ namespace N |> compile |> shouldFail |> withResults [ - { Error = Warning 3569 - Range = { StartLine = 21 - StartColumn = 27 - EndLine = 21 - EndColumn = 35 } - Message = - "The member or function 'instType' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } { Error = Warning 3569 Range = { StartLine = 17 StartColumn = 32 @@ -787,6 +780,13 @@ namespace N EndColumn = 77 } Message = "The member or function 'instType' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } + { Error = Warning 3569 + Range = { StartLine = 21 + StartColumn = 27 + EndLine = 21 + EndColumn = 35 } + Message = + "The member or function 'instType' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } ] [] @@ -1769,3 +1769,72 @@ module M = |> withLangVersion80 |> compile |> shouldSucceed + + [] + let ``Warn successfully in Array-mapped recursive call`` () = + """ +namespace N + +module M = + + type Value = + { Code: string } + + [] + let rec fooArray (values: Value[], code: string) = + match values with + | [||] -> seq { code } + | values -> + let replicatedValues = + values + |> Array.map (fun value -> fooArray (values, value.Code)) + replicatedValues |> Seq.concat + """ + |> FSharp + |> withLangVersion80 + |> compile + |> shouldFail + |> withResults [ + { Error = Warning 3569 + Range = { StartLine = 16 + StartColumn = 20 + EndLine = 16 + EndColumn = 74 } + Message = + "The member or function 'fooArray' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } + ] + + [] + let ``Warn successfully in Seq-mapped recursive call`` () = + """ +namespace N + +module M = + + type Value = + { Code: string } + + [] + let rec fooSeq (values: Value[], code: string) = + match values with + | [||] -> seq { code } + | values -> + let replicatedValues = + values + |> Seq.map (fun value -> fooSeq (values, value.Code)) + |> Seq.toArray + replicatedValues |> Seq.concat + """ + |> FSharp + |> withLangVersion80 + |> compile + |> shouldFail + |> withResults [ + { Error = Warning 3569 + Range = { StartLine = 16 + StartColumn = 42 + EndLine = 16 + EndColumn = 48 } + Message = + "The member or function 'fooSeq' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } + ] diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs index bb95ba7a6a1..ced7e02fdca 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs @@ -150,10 +150,8 @@ let doNotWarnOnDowncastRepeatedNestedNullable(o:objnull) = o :? list<((AB | null |> shouldFail |> withDiagnostics [ Error 3264, Line 4, Col 39, Line 4, Col 47, "Nullness warning: Downcasting from 'objnull' into 'AB' can introduce unexpected null values. Cast to 'AB|null' instead or handle the null before downcasting." - Error 3261, Line 5, Col 42, Line 5, Col 59, "Nullness warning: The types 'obj' and 'AB | null' do not have compatible nullability." Error 3060, Line 5, Col 42, Line 5, Col 59, "This type test or downcast will erase the provided type 'AB | null' to the type 'AB'" Error 3060, Line 6, Col 41, Line 6, Col 55, "This type test or downcast will erase the provided type 'AB | null' to the type 'AB'" - Error 3261, Line 7, Col 51, Line 7, Col 97, "Nullness warning: The types 'obj' and 'AB | null array | null list | null' do not have compatible nullability." Error 3060, Line 7, Col 51, Line 7, Col 97, "This type test or downcast will erase the provided type 'List | null' to the type 'List'"] @@ -1381,6 +1379,20 @@ dict["ok"] <- 42 |> typeCheckWithStrictNullness |> shouldSucceed +[ 'T")>] +[] +[ unbox<'T>")>] +[ 'T")>] +[] +let ``Unsafe cast should not insist on not null constraint``(castOp:string) = + + FSharp $"""module MyLibrary +let test<'T> () = + let t = obj() + {castOp}""" + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed [] diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs index c549cc09aa2..486b68c7d2b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs @@ -132,9 +132,34 @@ let ``DefaultValueBug when checknulls is disabled`` compilation = [] let ``With new nullness syntax nullness enabled`` compilation = compilation - |> withVersionAndCheckNulls ("preview",true) + |> withVersionAndCheckNulls ("preview",true) |> verifyBaseline +// https://github.com/dotnet/fsharp/issues/18288 +[] +let ``Inference problem limit regression previewNullness`` compilation = + compilation + |> withVersionAndCheckNulls ("preview",true) + |> withNoWarn 475 // The constraints 'struct' and 'null' are inconsistent + |> typecheck + |> shouldSucceed + +[] +let ``Inference problem limit regression previewNoNullness`` compilation = + compilation + |> withVersionAndCheckNulls ("preview",false) + |> withNoWarn 475 // The constraints 'struct' and 'null' are inconsistent + |> typecheck + |> shouldSucceed + +[] +let ``Inference problem limit regression v8`` compilation = + compilation + |> withVersionAndCheckNulls ("8.0",false) + |> withNoWarn 475 // The constraints 'struct' and 'null' are inconsistent + |> typecheck + |> shouldSucceed + [] diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/inference-problem-size-explosion.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/inference-problem-size-explosion.fs new file mode 100644 index 00000000000..e40f8177094 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/inference-problem-size-explosion.fs @@ -0,0 +1,42 @@ +module M + +type ToSeq = + static member inline Invoke (source: 'FldT) : seq<'T> = + let inline call (mthd: ^M, input1: ^I) = ((^M or ^I) : (static member ToSeq : _*_ -> _) input1, mthd) + call (Unchecked.defaultof, source) + + static member inline ToSeq (x: 'Foldable , _: ToSeq) = (^Foldable: (static member ToSeq : _ -> _) x) + static member inline ToSeq (_: 'T when 'T: null and 'T: struct, _: ToSeq) = () + +type Append = + static member inline Append (x: 'AltT , y: 'AltT , _: obj ) = (^AltT : (static member Append : _*_ -> _) x, y) : 'AltT + static member inline Append (_: ^t when ^t: null and ^t: struct, _, _: obj ) = () + static member inline Append (x: Result<_,_> , y , _: Append) = match x, y with Ok _, _ -> x | Error x, Error y -> Error (x + y) | _, _ -> y + + static member inline Invoke (x: 'AltT) (y: 'AltT) : 'AltT = + let inline call (mthd: ^M, input1: ^I, input2: ^I) = ((^M or ^I) : (static member Append : _*_*_ -> _) input1, input2, mthd) + call (Unchecked.defaultof, x, y) + + static member inline Append (x: 'R -> 'AltT , y , _: Append) = fun r -> Append.Invoke (x r) (y r) + +type Choice = + static member inline Choice (x: ref<'RAltT>, _: obj) = + let t = ToSeq.Invoke x.Value + use e = t.GetEnumerator () + e.MoveNext() |> ignore + let mutable res = e.Current + while e.MoveNext() do res <- Append.Invoke res e.Current + res + + static member inline Choice (x: ref<'FAltT> , _: Choice) = (^FAltT : (static member Choice : _ -> _) x.Value) : 'AltT + static member inline Choice (_: ref< ^t> when ^t: null and ^t: struct, _: Choice) = () + + static member inline Invoke (x: 'FAltT) : 'AltT = + let inline call (mthd: ^M, input1: ^I) = ((^M or ^I) : (static member Choice : _*_ -> _) (ref input1, mthd)) + call (Unchecked.defaultof, x) + +[] +type WrappedSeqE<'s> = WrappedSeqE of 's seq with static member ToSeq (WrappedSeqE x) = x + +let v1 = [Ok 1; Error "a" ] +let v2 = Choice.Invoke (WrappedSeqE v1) \ No newline at end of file diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs index d085005d9ac..ecf5b81d97b 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs @@ -513,3 +513,21 @@ let add (col:IServiceCollection) = let _value,diag = script.Eval(code) Assert.Empty(diag) + [] + [] + [] + [] + [] + member _.``Eval script with usepackagetargets options``(code, shouldSucceed, error) = + use script = new FSharpScript() + let result, errors = script.Eval(code) + match shouldSucceed with + | true -> + Assert.Empty(errors) + match result with + | Ok(_) -> () + | Error(ex) -> Assert.True(false, "expected no failures") + | false -> + Assert.NotEmpty(errors) + Assert.Equal(1, errors.Length) + Assert.Equal(error, errors.[0].ToString()) diff --git a/tests/FSharp.Compiler.Service.Tests/Common.fs b/tests/FSharp.Compiler.Service.Tests/Common.fs index 8ccb19b0f85..b9f780fd506 100644 --- a/tests/FSharp.Compiler.Service.Tests/Common.fs +++ b/tests/FSharp.Compiler.Service.Tests/Common.fs @@ -484,5 +484,5 @@ let createProjectOptions fileSources extraArgs = let fileName = changeExtension (getTemporaryFileNameInDirectory tempDir) ".fs" FileSystem.OpenFileForWriteShim(fileName).Write(fileSource) fileName |] - let args = [| yield! extraArgs; yield! mkProjectCommandLineArgs (dllName, []) |] + let args = [| yield! mkProjectCommandLineArgs (dllName, []); yield! extraArgs |] { checker.GetProjectOptionsFromCommandLineArgs (projFileName, args) with SourceFiles = sourceFiles } diff --git a/tests/FSharp.Compiler.Service.Tests/ExprTests.fs b/tests/FSharp.Compiler.Service.Tests/ExprTests.fs index 7a594db1e38..71de89dfd42 100644 --- a/tests/FSharp.Compiler.Service.Tests/ExprTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ExprTests.fs @@ -3525,3 +3525,30 @@ let ``Test NoWarn HashDirective`` () = printfn "ProjectForNoWarnHashDirective error: <<<%s>>>" e.Message wholeProjectResults.Diagnostics.Length |> shouldEqual 0 + +let private sourceForParseError = """ +module N.M +#nowarn 0xy +() +""" + +[] +let ``RegressionTestForMissingParseError(TransparentCompiler)`` () = + let options = createProjectOptions [sourceForParseError] [] + let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=CompilerAssertHelpers.UseTransparentCompiler) + let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate + wholeProjectResults.Diagnostics.Length |> shouldEqual 1 + wholeProjectResults.Diagnostics.[0].ErrorNumber |> shouldEqual 1156 + wholeProjectResults.Diagnostics.[0].Range.StartLine |> shouldEqual 3 + +[] +let ``RegressionTestForDuplicateParseError(BackgroundCompiler)`` () = + let options = createProjectOptions [sourceForParseError] [] + let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=CompilerAssertHelpers.UseTransparentCompiler) + let sourceName = options.SourceFiles[0] + let _wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate + let _, checkResults = exprChecker.GetBackgroundCheckResultsForFileInProject(sourceName, options) |> Async.RunImmediate + checkResults.Diagnostics.Length |> shouldEqual 1 + checkResults.Diagnostics.[0].ErrorNumber |> shouldEqual 1156 + checkResults.Diagnostics.[0].Range.StartLine |> shouldEqual 3 + 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 1836a6673c1..f89f7a406be 100755 --- 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 @@ -2066,7 +2066,7 @@ FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.CodeAnalysi FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.CodeAnalysis.FSharpSymbolUse[] GetUsesOfSymbolInFile(FSharp.Compiler.Symbols.FSharpSymbol, Microsoft.FSharp.Core.FSharpOption`1[System.Threading.CancellationToken]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Diagnostics.FSharpDiagnostic[] Diagnostics FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Diagnostics.FSharpDiagnostic[] get_Diagnostics() -FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.DeclarationListInfo GetDeclarationListInfo(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults], Int32, System.String, FSharp.Compiler.EditorServices.PartialLongName, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.EditorServices.AssemblySymbol]]], Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Text.Position,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.EditorServices.CompletionContext]]]) +FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.DeclarationListInfo GetDeclarationListInfo(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults], Int32, System.String, FSharp.Compiler.EditorServices.PartialLongName, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.EditorServices.AssemblySymbol]]], Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Text.Position,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.EditorServices.CompletionContext]]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.FindDeclResult GetDeclarationLocation(Int32, Int32, System.String, Microsoft.FSharp.Collections.FSharpList`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.MethodGroup GetMethods(Int32, Int32, System.String, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.String]]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.SemanticClassificationItem[] GetSemanticClassification(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) @@ -2079,7 +2079,7 @@ FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Symbols.FSh FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Symbols.FSharpOpenDeclaration[] get_OpenDeclarations() FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Text.Range[] GetFormatSpecifierLocations() FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.CodeAnalysis.FSharpSymbolUse] GetSymbolUsesAtLocation(Int32, Int32, System.String, Microsoft.FSharp.Collections.FSharpList`1[System.String]) -FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Collections.FSharpList`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.CodeAnalysis.FSharpSymbolUse]] GetDeclarationListSymbols(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults], Int32, System.String, FSharp.Compiler.EditorServices.PartialLongName, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.EditorServices.AssemblySymbol]]]) +FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Collections.FSharpList`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.CodeAnalysis.FSharpSymbolUse]] GetDeclarationListSymbols(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults], Int32, System.String, FSharp.Compiler.EditorServices.PartialLongName, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.EditorServices.AssemblySymbol]]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpSymbolUse] GetSymbolUseAtLocation(Int32, Int32, System.String, Microsoft.FSharp.Collections.FSharpList`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Symbols.FSharpDisplayContext] GetDisplayContextForPos(FSharp.Compiler.Text.Position) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Symbols.FSharpImplementationFileContents] ImplementationFile @@ -2136,8 +2136,8 @@ FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileAnswer]] ParseAndCheckFileInProject(System.String, FSharpProjectSnapshot, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileAnswer]] ParseAndCheckFileInProject(System.String, Int32, FSharp.Compiler.Text.ISourceText, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults]] GetBackgroundCheckResultsForFileInProject(System.String, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) -FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpProjectOptions,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectOptionsFromScript(System.String, FSharp.Compiler.Text.ISourceText, Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) -FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.ProjectSnapshot+FSharpProjectSnapshot,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectSnapshotFromScript(System.String, FSharp.Compiler.Text.ISourceTextNew, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) +FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpProjectOptions,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectOptionsFromScript(System.String, FSharp.Compiler.Text.ISourceText, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) +FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.ProjectSnapshot+FSharpProjectSnapshot,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectSnapshotFromScript(System.String, FSharp.Compiler.Text.ISourceTextNew, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Diagnostics.FSharpDiagnostic[],Microsoft.FSharp.Core.FSharpOption`1[System.Exception]]] Compile(System.String[], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Text.Range,FSharp.Compiler.Text.Range][]] MatchBraces(System.String, FSharp.Compiler.Text.ISourceText, FSharp.Compiler.CodeAnalysis.FSharpParsingOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Text.Range,FSharp.Compiler.Text.Range][]] MatchBraces(System.String, System.String, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) @@ -2830,12 +2830,20 @@ FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 GetHashCod FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 Tag FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 get_Tag() FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: System.String ToString() +FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] DiagnosticId +FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] UrlFormat +FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_DiagnosticId() +FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_UrlFormat() FSharp.Compiler.Diagnostics.ExtendedData+ExpressionIsAFunctionExtendedData: FSharp.Compiler.Symbols.FSharpType ActualType FSharp.Compiler.Diagnostics.ExtendedData+ExpressionIsAFunctionExtendedData: FSharp.Compiler.Symbols.FSharpType get_ActualType() FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField ImplementationField FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField SignatureField FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField get_ImplementationField() FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField get_SignatureField() +FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] DiagnosticId +FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] UrlFormat +FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_DiagnosticId() +FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_UrlFormat() FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: DiagnosticContextInfo ContextInfo FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: DiagnosticContextInfo get_ContextInfo() FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpDisplayContext DisplayContext @@ -2851,21 +2859,13 @@ FSharp.Compiler.Diagnostics.ExtendedData+ValueNotContainedDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+DefinitionsInSigAndImplNotCompatibleAbbreviationsDifferExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo +FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ExpressionIsAFunctionExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+IFSharpDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ValueNotContainedDiagnosticExtendedData -FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] DiagnosticId -FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] UrlFormat -FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_DiagnosticId() -FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_UrlFormat() -FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] DiagnosticId -FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] UrlFormat -FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_DiagnosticId() -FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_UrlFormat() -FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData FSharp.Compiler.Diagnostics.FSharpDiagnostic: FSharp.Compiler.Diagnostics.FSharpDiagnostic Create(FSharp.Compiler.Diagnostics.FSharpDiagnosticSeverity, System.String, Int32, FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.Diagnostics.FSharpDiagnostic: FSharp.Compiler.Diagnostics.FSharpDiagnosticSeverity Severity FSharp.Compiler.Diagnostics.FSharpDiagnostic: FSharp.Compiler.Diagnostics.FSharpDiagnosticSeverity get_Severity() @@ -3047,7 +3047,9 @@ FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: FSharp.Compiler 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_spacesBeforeEnclosingDefinition() FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Int32 get_spacesBeforeOverrideKeyword() +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Int32 spacesBeforeEnclosingDefinition FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Int32 spacesBeforeOverrideKeyword FSharp.Compiler.EditorServices.CompletionContext+OpenDeclaration: Boolean get_isOpenType() FSharp.Compiler.EditorServices.CompletionContext+OpenDeclaration: Boolean isOpenType @@ -3102,7 +3104,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.EditorServices.MethodOverrideCompletionContext, FSharp.Compiler.Text.Range, Int32, Boolean, Boolean) +FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewMethodOverride(FSharp.Compiler.EditorServices.MethodOverrideCompletionContext, FSharp.Compiler.Text.Range, Int32, Boolean, Boolean, Int32) 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) 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 fabaa710607..f89f7a406be 100755 --- 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 @@ -2066,7 +2066,7 @@ FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.CodeAnalysi FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.CodeAnalysis.FSharpSymbolUse[] GetUsesOfSymbolInFile(FSharp.Compiler.Symbols.FSharpSymbol, Microsoft.FSharp.Core.FSharpOption`1[System.Threading.CancellationToken]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Diagnostics.FSharpDiagnostic[] Diagnostics FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Diagnostics.FSharpDiagnostic[] get_Diagnostics() -FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.DeclarationListInfo GetDeclarationListInfo(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults], Int32, System.String, FSharp.Compiler.EditorServices.PartialLongName, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.EditorServices.AssemblySymbol]]], Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Text.Position,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.EditorServices.CompletionContext]]]) +FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.DeclarationListInfo GetDeclarationListInfo(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults], Int32, System.String, FSharp.Compiler.EditorServices.PartialLongName, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.EditorServices.AssemblySymbol]]], Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Text.Position,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.EditorServices.CompletionContext]]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.FindDeclResult GetDeclarationLocation(Int32, Int32, System.String, Microsoft.FSharp.Collections.FSharpList`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.MethodGroup GetMethods(Int32, Int32, System.String, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.String]]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.SemanticClassificationItem[] GetSemanticClassification(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) @@ -2079,7 +2079,7 @@ FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Symbols.FSh FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Symbols.FSharpOpenDeclaration[] get_OpenDeclarations() FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Text.Range[] GetFormatSpecifierLocations() FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.CodeAnalysis.FSharpSymbolUse] GetSymbolUsesAtLocation(Int32, Int32, System.String, Microsoft.FSharp.Collections.FSharpList`1[System.String]) -FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Collections.FSharpList`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.CodeAnalysis.FSharpSymbolUse]] GetDeclarationListSymbols(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults], Int32, System.String, FSharp.Compiler.EditorServices.PartialLongName, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.EditorServices.AssemblySymbol]]]) +FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Collections.FSharpList`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.CodeAnalysis.FSharpSymbolUse]] GetDeclarationListSymbols(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults], Int32, System.String, FSharp.Compiler.EditorServices.PartialLongName, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.EditorServices.AssemblySymbol]]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpSymbolUse] GetSymbolUseAtLocation(Int32, Int32, System.String, Microsoft.FSharp.Collections.FSharpList`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Symbols.FSharpDisplayContext] GetDisplayContextForPos(FSharp.Compiler.Text.Position) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Symbols.FSharpImplementationFileContents] ImplementationFile @@ -2136,8 +2136,8 @@ FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileAnswer]] ParseAndCheckFileInProject(System.String, FSharpProjectSnapshot, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileAnswer]] ParseAndCheckFileInProject(System.String, Int32, FSharp.Compiler.Text.ISourceText, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults]] GetBackgroundCheckResultsForFileInProject(System.String, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) -FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpProjectOptions,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectOptionsFromScript(System.String, FSharp.Compiler.Text.ISourceText, Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) -FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.ProjectSnapshot+FSharpProjectSnapshot,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectSnapshotFromScript(System.String, FSharp.Compiler.Text.ISourceTextNew, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) +FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpProjectOptions,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectOptionsFromScript(System.String, FSharp.Compiler.Text.ISourceText, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) +FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.ProjectSnapshot+FSharpProjectSnapshot,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectSnapshotFromScript(System.String, FSharp.Compiler.Text.ISourceTextNew, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Diagnostics.FSharpDiagnostic[],Microsoft.FSharp.Core.FSharpOption`1[System.Exception]]] Compile(System.String[], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Text.Range,FSharp.Compiler.Text.Range][]] MatchBraces(System.String, FSharp.Compiler.Text.ISourceText, FSharp.Compiler.CodeAnalysis.FSharpParsingOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Text.Range,FSharp.Compiler.Text.Range][]] MatchBraces(System.String, System.String, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) @@ -2830,12 +2830,20 @@ FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 GetHashCod FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 Tag FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 get_Tag() FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: System.String ToString() +FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] DiagnosticId +FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] UrlFormat +FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_DiagnosticId() +FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_UrlFormat() FSharp.Compiler.Diagnostics.ExtendedData+ExpressionIsAFunctionExtendedData: FSharp.Compiler.Symbols.FSharpType ActualType FSharp.Compiler.Diagnostics.ExtendedData+ExpressionIsAFunctionExtendedData: FSharp.Compiler.Symbols.FSharpType get_ActualType() FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField ImplementationField FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField SignatureField FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField get_ImplementationField() FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField get_SignatureField() +FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] DiagnosticId +FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] UrlFormat +FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_DiagnosticId() +FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_UrlFormat() FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: DiagnosticContextInfo ContextInfo FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: DiagnosticContextInfo get_ContextInfo() FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpDisplayContext DisplayContext @@ -2851,22 +2859,13 @@ FSharp.Compiler.Diagnostics.ExtendedData+ValueNotContainedDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+DefinitionsInSigAndImplNotCompatibleAbbreviationsDifferExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo +FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ExpressionIsAFunctionExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+IFSharpDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ValueNotContainedDiagnosticExtendedData -FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] DiagnosticId -FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] UrlFormat -FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_DiagnosticId() -FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_UrlFormat() -FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData -FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] DiagnosticId -FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] UrlFormat -FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_DiagnosticId() -FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_UrlFormat() -FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData FSharp.Compiler.Diagnostics.FSharpDiagnostic: FSharp.Compiler.Diagnostics.FSharpDiagnostic Create(FSharp.Compiler.Diagnostics.FSharpDiagnosticSeverity, System.String, Int32, FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.Diagnostics.FSharpDiagnostic: FSharp.Compiler.Diagnostics.FSharpDiagnosticSeverity Severity FSharp.Compiler.Diagnostics.FSharpDiagnostic: FSharp.Compiler.Diagnostics.FSharpDiagnosticSeverity get_Severity() @@ -3048,7 +3047,9 @@ FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: FSharp.Compiler 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_spacesBeforeEnclosingDefinition() FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Int32 get_spacesBeforeOverrideKeyword() +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Int32 spacesBeforeEnclosingDefinition FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Int32 spacesBeforeOverrideKeyword FSharp.Compiler.EditorServices.CompletionContext+OpenDeclaration: Boolean get_isOpenType() FSharp.Compiler.EditorServices.CompletionContext+OpenDeclaration: Boolean isOpenType @@ -3103,7 +3104,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.EditorServices.MethodOverrideCompletionContext, FSharp.Compiler.Text.Range, Int32, Boolean, Boolean) +FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewMethodOverride(FSharp.Compiler.EditorServices.MethodOverrideCompletionContext, FSharp.Compiler.Text.Range, Int32, Boolean, Boolean, Int32) 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) diff --git a/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs b/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs index 71bffac7974..0e12a33fe2f 100644 --- a/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs @@ -1,5 +1,7 @@ module FSharp.Compiler.Service.Tests.ProjectAnalysisTests +open System.Threading.Tasks + #nowarn "57" // Experimental stuff let runningOnMono = try System.Type.GetType("Mono.Runtime") <> null with e -> false @@ -128,8 +130,20 @@ module ClearLanguageServiceRootCachesTest = let weakTcImports = test () checker.InvalidateConfiguration Project1.options checker.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients() - GC.Collect() - System.Threading.SpinWait.SpinUntil(fun () -> not weakTcImports.IsAlive) + + task { + GC.Collect() + GC.WaitForPendingFinalizers() + // Try collecting many times, because GC has some problems, especially on Linux. + // See for example: https://github.com/dotnet/runtime/discussions/108081 + let mutable attempt = 1 + while weakTcImports.IsAlive && attempt < 10 do + GC.Collect() + GC.WaitForPendingFinalizers() + attempt <- attempt + 1 + do! Task.Delay(attempt * 1000) + Assert.False weakTcImports.IsAlive + } [] let ``Test Project1 should have protected FullName and TryFullName return same results`` () = diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule2.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule2.fs index 5c5afc3c234..b0532b8929f 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule2.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule2.fs @@ -1679,4 +1679,10 @@ type ArrayModule2() = // empty list & out of bounds Assert.AreEqual([0; 0], Array.insertManyAt 0 [0; 0] [||]) CheckThrowsArgumentException (fun () -> Array.insertManyAt -1 [0; 0] [|1|] |> ignore) - CheckThrowsArgumentException (fun () -> Array.insertManyAt 2 [0; 0] [|1|] |> ignore) \ No newline at end of file + CheckThrowsArgumentException (fun () -> Array.insertManyAt 2 [0; 0] [|1|] |> ignore) + + // Do not return the original array when inserting an empty array + let originalArr = [| 1; 2; 3 |] + let insertionEmptyResultArr = Array.insertManyAt 3 [| |] originalArr + insertionEmptyResultArr[0] <- 3 + Assert.AreEqual([| 1; 2; 3 |], originalArr) \ No newline at end of file diff --git a/tests/FSharp.Test.Utilities/ILChecker.fs b/tests/FSharp.Test.Utilities/ILChecker.fs index b47ae4409f0..69b5d6c6c6a 100644 --- a/tests/FSharp.Test.Utilities/ILChecker.fs +++ b/tests/FSharp.Test.Utilities/ILChecker.fs @@ -11,7 +11,7 @@ open TestFramework [] module ILChecker = - let config = initializeSuite () + let config = initialConfig let private exec exe args = let arguments = args |> String.concat " " diff --git a/tests/FSharp.Test.Utilities/ILVerifierModule.fs b/tests/FSharp.Test.Utilities/ILVerifierModule.fs index 8610476f217..799af017e6a 100644 --- a/tests/FSharp.Test.Utilities/ILVerifierModule.fs +++ b/tests/FSharp.Test.Utilities/ILVerifierModule.fs @@ -8,7 +8,7 @@ open TestFramework [] module ILVerifierModule = - let config = initializeSuite () + let config = initialConfig let fsharpCoreReference = $"--reference \"{typeof.Assembly.Location}\"" diff --git a/tests/FSharp.Test.Utilities/TestFramework.fs b/tests/FSharp.Test.Utilities/TestFramework.fs index 06b454005c2..768203aa887 100644 --- a/tests/FSharp.Test.Utilities/TestFramework.fs +++ b/tests/FSharp.Test.Utilities/TestFramework.fs @@ -410,7 +410,7 @@ let logConfig (cfg: TestConfig) = log "FSCOREDLLPATH = %s" cfg.FSCOREDLLPATH log "FSI = %s" cfg.FSI #if NETCOREAPP - log "DotNetExe =%s" cfg.DotNetExe + log "DotNetExe = %s" cfg.DotNetExe log "DOTNET_MULTILEVEL_LOOKUP = %s" cfg.DotNetMultiLevelLookup log "DOTNET_ROOT = %s" cfg.DotNetRoot #else @@ -447,7 +447,7 @@ let envVars () = |> Seq.map (fun d -> d.Key :?> string, d.Value :?> string) |> Map.ofSeq -let initializeSuite () = +let initialConfig = #if DEBUG let configurationName = "Debug" @@ -461,15 +461,9 @@ let initializeSuite () = let usedEnvVars = c.EnvironmentVariables |> Map.add "FSC" c.FSC { c with EnvironmentVariables = usedEnvVars } - logConfig cfg - cfg - -let suiteHelpers = lazy (initializeSuite ()) - let testConfig sourceDir (relativePathToTestFixture: string) = - let cfg = suiteHelpers.Value let testFixtureFullPath = Path.GetFullPath(sourceDir ++ relativePathToTestFixture) let tempTestDir = @@ -478,11 +472,10 @@ let testConfig sourceDir (relativePathToTestFixture: string) = .FullName copyDirectory testFixtureFullPath tempTestDir true - { cfg with Directory = tempTestDir } + { initialConfig with Directory = tempTestDir } let createConfigWithEmptyDirectory() = - let cfg = suiteHelpers.Value - { cfg with Directory = createTemporaryDirectory().FullName } + { initialConfig with Directory = createTemporaryDirectory().FullName } type RedirectToType = | Overwrite of FilePath diff --git a/tests/FSharp.Test.Utilities/Utilities.fs b/tests/FSharp.Test.Utilities/Utilities.fs index fec1da0895c..06667fadfaf 100644 --- a/tests/FSharp.Test.Utilities/Utilities.fs +++ b/tests/FSharp.Test.Utilities/Utilities.fs @@ -138,7 +138,7 @@ module Utilities = [] module public TargetFrameworkUtil = - let private config = TestFramework.initializeSuite () + let private config = initialConfig // Do a one time dotnet sdk build to compute the proper set of reference assemblies to pass to the compiler let private projectFile = """ diff --git a/tests/FSharp.Test.Utilities/XunitHelpers.fs b/tests/FSharp.Test.Utilities/XunitHelpers.fs index ce4d47b9635..cf7ecf3b2cf 100644 --- a/tests/FSharp.Test.Utilities/XunitHelpers.fs +++ b/tests/FSharp.Test.Utilities/XunitHelpers.fs @@ -21,28 +21,7 @@ open OpenTelemetry.Trace [] type RunTestCasesInSequenceAttribute() = inherit Attribute() -#if !XUNIT_EXTRAS -/// Installs console support for parallel test runs and conditionally enables optional xUnit customizations. -type FSharpXunitFramework(sink: IMessageSink) = - inherit XunitTestFramework(sink) - do - // Because xUnit v2 lacks assembly fixture, the next best place to ensure things get called - // right at the start of the test run is here in the constructor. - // This gets executed once per test assembly. - MessageSink.sinkWriter |> ignore - TestConsole.install() -#if !NETCOREAPP - AssemblyResolver.addResolver () -#endif - - interface IDisposable with - member _.Dispose() = - match Environment.GetEnvironmentVariable("FSHARP_RETAIN_TESTBUILDS") with - | null -> cleanUpTemporaryDirectoryOfThisTestRun () - | _ -> () - base.Dispose() - -#else +#if XUNIT_EXTRAS // To use xUnit means to customize it. The following abomination adds 2 features: // - Capturing full console output individually for each test case, viewable in Test Explorer as test stdout. @@ -56,7 +35,7 @@ type ConsoleCapturingTestRunner(test, messageBus, testClass, constructorArgument override this.InvokeTestAsync (aggregator: ExceptionAggregator) = task { use capture = new TestConsole.ExecutionCapture() - use _ = Activity.start test.DisplayName [ ] + use _ = Activity.startNoTags test.DisplayName let! executionTime = this.BaseInvokeTestMethodAsync aggregator let output = seq { @@ -141,44 +120,55 @@ type CustomTheoryTestCase = base.Initialize() testCase.TestMethod <- TestCaseCustomizations.rewriteTestMethod testCase +#endif + /// `XunitTestFramework` providing parallel console support and conditionally enabling optional xUnit customizations. type FSharpXunitFramework(sink: IMessageSink) = inherit XunitTestFramework(sink) - do - // Because xUnit v2 lacks assembly fixture, the next best place to ensure things get called - // right at the start of the test run is here in the constructor. - // This gets executed once per test assembly. - log "FSharpXunitFramework with XUNIT_EXTRAS installing TestConsole redirection" - TestConsole.install() - -#if !NETCOREAPP - AssemblyResolver.addResolver () -#endif - - let traceProvider = - Sdk.CreateTracerProviderBuilder() - .AddSource(ActivityNames.FscSourceName) - .SetResourceBuilder( - ResourceBuilder.CreateDefault().AddService(serviceName="F#", serviceVersion = "1.0.0")) - .AddOtlpExporter() - .Build() - - interface IDisposable with - member _.Dispose() = - cleanUpTemporaryDirectoryOfThisTestRun () - traceProvider.ForceFlush() |> ignore - traceProvider.Dispose() - base.Dispose() - // Group test run under single activity, to make traces more readable. - // Otherwise this overriden method is not necessary and can be removed. - override this.CreateExecutor (assemblyName) = + override this.CreateExecutor (assemblyName) = { new XunitTestFrameworkExecutor(assemblyName, this.SourceInformationProvider, this.DiagnosticMessageSink) with - override _.RunTestCases(testCases, executionMessageSink, executionOptions) = - use _ = Activity.start $"{assemblyName.Name} {Runtime.InteropServices.RuntimeInformation.FrameworkDescription}" [] - base.RunTestCases(testCases, executionMessageSink, executionOptions) + + // Because xUnit v2 lacks assembly fixture, this is a good place to ensure things get called right at the start of the test run. + // This gets executed once per test assembly. + override x.RunTestCases(testCases, executionMessageSink, executionOptions) = + + #if !NETCOREAPP + // We need AssemblyResolver already here, because OpenTelemetry loads some assemblies dynamically. + AssemblyResolver.addResolver () + #endif + + // Configure OpenTelemetry export. Traces can be viewed in Jaeger or other compatible tools. + use tracerProvider = + OpenTelemetry.Sdk.CreateTracerProviderBuilder() + .AddSource(ActivityNames.FscSourceName) + .ConfigureResource(fun r -> r.AddService("F#") |> ignore) + .AddOtlpExporter(fun o -> + // Empirical values to ensure no traces are lost and no significant delay at the end of test run. + o.TimeoutMilliseconds <- 200 + o.BatchExportProcessorOptions.MaxQueueSize <- 16384 + o.BatchExportProcessorOptions.ScheduledDelayMilliseconds <- 100 + ) + .Build() + + logConfig initialConfig + log "Installing TestConsole redirection" + TestConsole.install() + + begin + use _ = Activity.startNoTags $"RunTests_{assemblyName.Name} {Runtime.InteropServices.RuntimeInformation.FrameworkDescription}" + // We can't just call base.RunTestCases here, because it's implementation is async void. + use runner = new XunitTestAssemblyRunner (x.TestAssembly, testCases, x.DiagnosticMessageSink, executionMessageSink, executionOptions) + runner.RunAsync().Wait() + end + + tracerProvider.ForceFlush() |> ignore + + cleanUpTemporaryDirectoryOfThisTestRun () } +#if XUNIT_EXTRAS + // Rewrites discovered test cases to support extra parallelization and capturing console as test output. override this.CreateDiscoverer (assemblyInfo) = { new XunitTestFrameworkDiscoverer(assemblyInfo, this.SourceInformationProvider, this.DiagnosticMessageSink) with override _.FindTestsForType (testClass, includeSourceInformation, messageBus, options) = diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl index 4f429d04961..4466d718308 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl @@ -21,9 +21,9 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.Hosted.CompilerHelpers::fscCompile([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver, string, string[])][offset 0x00000082][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.Hosted.CompilerHelpers::fscCompile([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver, string, string[])][offset 0x0000008B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+MagicAssemblyResolution::ResolveAssemblyCore([FSharp.Compiler.Service]Internal.Utilities.Library.CompilationThreadToken, [FSharp.Compiler.Service]FSharp.Compiler.Text.Range, [FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, [FSharp.Compiler.Service]FSharp.Compiler.CompilerImports+TcImports, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiDynamicCompiler, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiConsoleOutput, string)][offset 0x00000015][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo@3516-802::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001E5][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo@3502-805::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001E5][found Char] Unexpected type on the stack. [IL]: Error [UnmanagedPointer]: : FSharp.Compiler.Interactive.Shell+Utilities+pointerToNativeInt@110::Invoke(object)][offset 0x00000007] Unmanaged pointers are not a verifiable type. -[IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+dataTipOfReferences@2205::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000084][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+dataTipOfReferences@2225::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000084][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-509::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000032][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-509::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x0000003B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-509::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000082][found Char] Unexpected type on the stack. @@ -37,8 +37,8 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+getOptionArgList@307::Invoke([FSharp.Compiler.Service]FSharp.Compiler.CompilerOptions+CompilerOption, string)][offset 0x0000003E][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+getSwitch@325::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+attempt@373::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)][offset 0x00000E9F][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1865@1865::Invoke(int32)][offset 0x00000030][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1865@1865::Invoke(int32)][offset 0x00000039][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1845@1845::Invoke(int32)][offset 0x00000030][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1845@1845::Invoke(int32)][offset 0x00000039][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x0000062B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x00000634][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.PatternMatchCompilation::isProblematicClause([FSharp.Compiler.Service]FSharp.Compiler.PatternMatchCompilation+MatchClause)][offset 0x00000065][found Byte] Unexpected type on the stack. @@ -55,7 +55,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILPdbWriter+pushShadowedLocals@959::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000232][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadUntaggedIdx([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.BinaryConstants+TableName, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+ILMetadataReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, int32&)][offset 0x0000000D][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::openMetadataReader(string, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+BinaryFile, int32, [S.P.CoreLib]System.Tuple`8,bool,bool,bool,bool,bool,System.Tuple`5,bool,int32,int32,int32>>, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+PEReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, bool)][offset 0x00000799][found Boolean] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+rowKindSize@4453::Invoke([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+RowKind)][offset 0x00000128][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+rowKindSize@4445::Invoke([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+RowKind)][offset 0x00000128][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000CD][found Char] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl index 2ec0116a1af..d5617f6de03 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl @@ -28,13 +28,13 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.Hosted.CompilerHelpers::fscCompile([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver, string, string[])][offset 0x0000008B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+FsiStdinSyphon::GetLine(string, int32)][offset 0x00000039][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+MagicAssemblyResolution::ResolveAssemblyCore([FSharp.Compiler.Service]Internal.Utilities.Library.CompilationThreadToken, [FSharp.Compiler.Service]FSharp.Compiler.Text.Range, [FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, [FSharp.Compiler.Service]FSharp.Compiler.CompilerImports+TcImports, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiDynamicCompiler, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiConsoleOutput, string)][offset 0x00000015][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo@3516-802::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001E5][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo@3502-805::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001E5][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+FsiInteractionProcessor::CompletionsForPartialLID([FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiDynamicCompilerState, string)][offset 0x0000001B][found Char] Unexpected type on the stack. [IL]: Error [UnmanagedPointer]: : FSharp.Compiler.Interactive.Shell+Utilities+pointerToNativeInt@110::Invoke(object)][offset 0x00000007] Unmanaged pointers are not a verifiable type. -[IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+dataTipOfReferences@2205::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000084][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+dataTipOfReferences@2225::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000084][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseMemberFunctionAndValues@176::Invoke([FSharp.Compiler.Service]FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue)][offset 0x00000059][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseEntity@218::GenerateNext([S.P.CoreLib]System.Collections.Generic.IEnumerable`1&)][offset 0x000000DA][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1423-6::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x00000605][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1424-6::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x00000605][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-509::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000032][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-509::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x0000003B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-509::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000082][found Char] Unexpected type on the stack. @@ -53,8 +53,8 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+attempt@373::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)][offset 0x00000E9F][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+processArg@333::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)][offset 0x0000004D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+ResponseFile+parseLine@239::Invoke(string)][offset 0x00000031][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1865@1865::Invoke(int32)][offset 0x00000030][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1865@1865::Invoke(int32)][offset 0x00000039][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1845@1845::Invoke(int32)][offset 0x00000030][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1845@1845::Invoke(int32)][offset 0x00000039][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+line@560-1::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x0000062B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x00000634][found Char] Unexpected type on the stack. @@ -75,13 +75,13 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILPdbWriter+pushShadowedLocals@959::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000232][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadUntaggedIdx([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.BinaryConstants+TableName, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+ILMetadataReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, int32&)][offset 0x0000000D][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::openMetadataReader(string, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+BinaryFile, int32, [S.P.CoreLib]System.Tuple`8,bool,bool,bool,bool,bool,System.Tuple`5,bool,int32,int32,int32>>, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+PEReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, bool)][offset 0x00000799][found Boolean] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+rowKindSize@4453::Invoke([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+RowKind)][offset 0x00000128][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+rowKindSize@4445::Invoke([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+RowKind)][offset 0x00000128][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.NativeRes+VersionHelper::TryParse(string, bool, uint16, bool, [S.P.CoreLib]System.Version&)][offset 0x0000003D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL+parseNamed@5291::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>, int32, int32)][offset 0x00000087][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.Collections.Utils::shortPath(string)][offset 0x00000015][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment+probePathForDotnetHost@322::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000028][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment+probePathForDotnetHost@316::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000028][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.SimulatedMSBuildReferenceResolver+Pipe #6 input at line 68@68::FSharp.Compiler.CodeAnalysis.ILegacyReferenceResolver.Resolve([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyResolutionEnvironment, [S.P.CoreLib]System.Tuple`2[], string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>)][offset 0x0000034D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000CD][found Char] Unexpected type on the stack. [IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@558::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl index 48210dddd5c..9e78cdedccd 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl @@ -21,15 +21,15 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.Hosted.CompilerHelpers::fscCompile([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver, string, string[])][offset 0x00000082][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.Hosted.CompilerHelpers::fscCompile([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver, string, string[])][offset 0x0000008B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+MagicAssemblyResolution::ResolveAssemblyCore([FSharp.Compiler.Service]Internal.Utilities.Library.CompilationThreadToken, [FSharp.Compiler.Service]FSharp.Compiler.Text.Range, [FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, [FSharp.Compiler.Service]FSharp.Compiler.CompilerImports+TcImports, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiDynamicCompiler, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiConsoleOutput, string)][offset 0x00000015][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo@3516-846::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001C7][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+GetReferenceResolutionStructuredToolTipText@2205::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000076][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo@3502-849::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001C7][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+GetReferenceResolutionStructuredToolTipText@2225::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000076][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000032][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x0000003B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000064][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x0000006D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000076][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@301-1::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@301-1::Invoke(string)][offset 0x00000014][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@291-1::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@291-1::Invoke(string)][offset 0x00000014][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.StaticLinking+TypeForwarding::followTypeForwardForILTypeRef([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.IL+ILTypeRef)][offset 0x00000010][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::getCompilerOption([FSharp.Compiler.Service]FSharp.Compiler.CompilerOptions+CompilerOption, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1)][offset 0x000000A7][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::parseOption@266(string)][offset 0x0000000B][found Char] Unexpected type on the stack. @@ -39,12 +39,12 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::attempt@372([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)][offset 0x00000A99][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::AddPathMapping([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnderflow]: : FSharp.Compiler.CompilerOptions::DoWithColor([System.Console]System.ConsoleColor, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2)][offset 0x0000005E] Stack underflow. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1865::Invoke(int32)][offset 0x00000031][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1865::Invoke(int32)][offset 0x0000003A][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1845::Invoke(int32)][offset 0x00000031][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1845::Invoke(int32)][offset 0x0000003A][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x0000059C][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x000005A5][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000011][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1890-1'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>'] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000012][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1890'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,T0>'] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000011][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1873-1'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>'] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000012][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1873'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,T0>'] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.PatternMatchCompilation::isProblematicClause([FSharp.Compiler.Service]FSharp.Compiler.PatternMatchCompilation+MatchClause)][offset 0x00000040][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.PatternMatchCompilation::.cctor()][offset 0x0000000B][found Boolean] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.TypeProviders::ValidateExpectedName([FSharp.Compiler.Service]FSharp.Compiler.Text.Range, string[], string, [FSharp.Compiler.Service]FSharp.Compiler.Tainted`1)][offset 0x000000A8][found Char] Unexpected type on the stack. @@ -74,7 +74,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadNestedRowUncached([FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1>, int32)][offset 0x00000038][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadNestedRowUncached([FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1>, int32)][offset 0x00000058][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadGenericParamConstraintIdx([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+ILMetadataReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, int32)][offset 0x00000025][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::rowKindSize$cont@4454(bool, bool, bool, bool[], bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x000000E5][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::rowKindSize$cont@4446(bool, bool, bool, bool[], bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x000000E5][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::openMetadataReader(string, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+BinaryFile, int32, [S.P.CoreLib]System.Tuple`8,bool,bool,bool,bool,bool,System.Tuple`5,bool,int32,int32,int32>>, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+PEReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, bool)][offset 0x000006BF][found Boolean] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadInterfaceImpls@2263-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadGenericParamConstraints@2328-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl index 2df2cf0fbd9..87b09e193a5 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl @@ -28,20 +28,20 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.Hosted.CompilerHelpers::fscCompile([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver, string, string[])][offset 0x0000008B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+FsiStdinSyphon::GetLine(string, int32)][offset 0x00000032][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+MagicAssemblyResolution::ResolveAssemblyCore([FSharp.Compiler.Service]Internal.Utilities.Library.CompilationThreadToken, [FSharp.Compiler.Service]FSharp.Compiler.Text.Range, [FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, [FSharp.Compiler.Service]FSharp.Compiler.CompilerImports+TcImports, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiDynamicCompiler, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiConsoleOutput, string)][offset 0x00000015][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo@3516-846::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001C7][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo@3502-849::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001C7][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+FsiInteractionProcessor::CompletionsForPartialLID([FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiDynamicCompilerState, string)][offset 0x00000024][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+GetReferenceResolutionStructuredToolTipText@2205::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000076][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+GetReferenceResolutionStructuredToolTipText@2225::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000076][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseMemberFunctionAndValues@176::Invoke([FSharp.Compiler.Service]FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue)][offset 0x0000002B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseEntity@218::GenerateNext([S.P.CoreLib]System.Collections.Generic.IEnumerable`1&)][offset 0x000000BB][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1423-11::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x00000620][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1424-11::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x00000620][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000032][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x0000003B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000064][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x0000006D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000076][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$Symbols+fullName@2495-3::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000030][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@301-1::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@301-1::Invoke(string)][offset 0x00000014][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@291-1::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@291-1::Invoke(string)][offset 0x00000014][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CreateILModule+MainModuleBuilder::ConvertProductVersionToILVersionInfo(string)][offset 0x00000010][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.StaticLinking+TypeForwarding::followTypeForwardForILTypeRef([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.IL+ILTypeRef)][offset 0x00000010][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::getCompilerOption([FSharp.Compiler.Service]FSharp.Compiler.CompilerOptions+CompilerOption, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1)][offset 0x000000A7][found Char] Unexpected type on the stack. @@ -55,14 +55,14 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::subSystemVersionSwitch$cont@656([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, string, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnderflow]: : FSharp.Compiler.CompilerOptions::DoWithColor([System.Console]System.ConsoleColor, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2)][offset 0x0000005E] Stack underflow. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+ResponseFile+parseLine@239::Invoke(string)][offset 0x00000026][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1865::Invoke(int32)][offset 0x00000031][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1865::Invoke(int32)][offset 0x0000003A][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1845::Invoke(int32)][offset 0x00000031][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1845::Invoke(int32)][offset 0x0000003A][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+TcConfig-TryResolveLibWithDirectories@558-1::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000021][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+TcConfig-TryResolveLibWithDirectories@558-1::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000003B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x0000059C][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x000005A5][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000011][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1890-1'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>'] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000012][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1890'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,T0>'] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000011][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1873-1'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>'] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000012][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1873'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,T0>'] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.PatternMatchCompilation::isProblematicClause([FSharp.Compiler.Service]FSharp.Compiler.PatternMatchCompilation+MatchClause)][offset 0x00000040][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.PatternMatchCompilation::.cctor()][offset 0x0000000B][found Boolean] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.NicePrint+TastDefinitionPrinting+meths@2092-3::Invoke([FSharp.Compiler.Service]FSharp.Compiler.Infos+MethInfo)][offset 0x000000B3][found Char] Unexpected type on the stack. @@ -95,7 +95,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadNestedRowUncached([FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1>, int32)][offset 0x00000038][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadNestedRowUncached([FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1>, int32)][offset 0x00000058][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadGenericParamConstraintIdx([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+ILMetadataReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, int32)][offset 0x00000025][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::rowKindSize$cont@4454(bool, bool, bool, bool[], bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x000000E5][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::rowKindSize$cont@4446(bool, bool, bool, bool[], bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x000000E5][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::openMetadataReader(string, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+BinaryFile, int32, [S.P.CoreLib]System.Tuple`8,bool,bool,bool,bool,bool,System.Tuple`5,bool,int32,int32,int32>>, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+PEReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, bool)][offset 0x000006BF][found Boolean] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadInterfaceImpls@2263-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadGenericParamConstraints@2328-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. @@ -108,7 +108,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseNamed@5290(uint8[], [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>, int32, int32)][offset 0x0000007E][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.Collections.Utils::shortPath(string)][offset 0x00000016][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment::probePathForDotnetHost@321([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000002A][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment::probePathForDotnetHost@315([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000002A][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.SimulatedMSBuildReferenceResolver+SimulatedMSBuildResolver@68::FSharp.Compiler.CodeAnalysis.ILegacyReferenceResolver.Resolve([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyResolutionEnvironment, [S.P.CoreLib]System.Tuple`2[], string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>)][offset 0x000002F5][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000B6][found Char] Unexpected type on the stack. [IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@558::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. diff --git a/tests/fsharp/core/printing/output.1000.stdout.bsl b/tests/fsharp/core/printing/output.1000.stdout.bsl index 1d5c0fcbae2..e2f3a8d57c8 100644 --- a/tests/fsharp/core/printing/output.1000.stdout.bsl +++ b/tests/fsharp/core/printing/output.1000.stdout.bsl @@ -2787,7 +2787,7 @@ val ShortName: string = "hi" > val list2: int list = [1] module FSI_0319. - A8a951db8294f99e95ae1d276a7ddaefd93d1548e6bf749bdeae55d2649682b3 + Ee54a783c1b4e3fe8e3c42c5a10c384669fed24c7ffbdacfc9698816f925f337 {"ImmutableField0":6} type R1 = diff --git a/tests/fsharp/core/printing/output.200.stdout.bsl b/tests/fsharp/core/printing/output.200.stdout.bsl index 52926a6c17a..a707919336b 100644 --- a/tests/fsharp/core/printing/output.200.stdout.bsl +++ b/tests/fsharp/core/printing/output.200.stdout.bsl @@ -2032,7 +2032,7 @@ val ShortName: string = "hi" > val list2: int list = [1] module FSI_0319. - A8a951db8294f99e95ae1d276a7ddaefd93d1548e6bf749bdeae55d2649682b3 + Ee54a783c1b4e3fe8e3c42c5a10c384669fed24c7ffbdacfc9698816f925f337 {"ImmutableField0":6} type R1 = diff --git a/tests/fsharp/core/printing/output.multiemit.stdout.bsl b/tests/fsharp/core/printing/output.multiemit.stdout.bsl index 2933f92f8b5..9cdf63bcc36 100644 --- a/tests/fsharp/core/printing/output.multiemit.stdout.bsl +++ b/tests/fsharp/core/printing/output.multiemit.stdout.bsl @@ -6334,7 +6334,7 @@ val ShortName: string = "hi" > val list2: int list = [1] module FSI_0318. - A8a951db8294f99e95ae1d276a7ddaefd93d1548e6bf749bdeae55d2649682b3 + Ee54a783c1b4e3fe8e3c42c5a10c384669fed24c7ffbdacfc9698816f925f337 {"ImmutableField0":6} type R1 = diff --git a/tests/fsharp/core/printing/output.off.stdout.bsl b/tests/fsharp/core/printing/output.off.stdout.bsl index 66ff18c8fb9..5806de4d312 100644 --- a/tests/fsharp/core/printing/output.off.stdout.bsl +++ b/tests/fsharp/core/printing/output.off.stdout.bsl @@ -1801,7 +1801,7 @@ val ShortName: string = "hi" > val list2: int list module FSI_0319. - A8a951db8294f99e95ae1d276a7ddaefd93d1548e6bf749bdeae55d2649682b3 + Ee54a783c1b4e3fe8e3c42c5a10c384669fed24c7ffbdacfc9698816f925f337 {"ImmutableField0":6} type R1 = diff --git a/tests/fsharp/core/printing/output.stdout.bsl b/tests/fsharp/core/printing/output.stdout.bsl index 2933f92f8b5..9cdf63bcc36 100644 --- a/tests/fsharp/core/printing/output.stdout.bsl +++ b/tests/fsharp/core/printing/output.stdout.bsl @@ -6334,7 +6334,7 @@ val ShortName: string = "hi" > val list2: int list = [1] module FSI_0318. - A8a951db8294f99e95ae1d276a7ddaefd93d1548e6bf749bdeae55d2649682b3 + Ee54a783c1b4e3fe8e3c42c5a10c384669fed24c7ffbdacfc9698816f925f337 {"ImmutableField0":6} type R1 = diff --git a/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/E_CallerFilePath.fs b/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/E_CallerFilePath.fs index d6e160d39af..05277194dae 100644 --- a/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/E_CallerFilePath.fs +++ b/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/E_CallerFilePath.fs @@ -1,6 +1,6 @@ -//'CallerFilePath' must be applied to an argument of type 'string', but has been applied to an argument of type 'int' -//'CallerFilePath' can only be applied to optional arguments -//'CallerFilePath' can only be applied to optional arguments +//'CallerFilePath' must be applied to an argument of type 'string', but has been applied to an argument of type 'int' +//'CallerFilePath' can only be applied to optional arguments +//'CallerFilePath' can only be applied to optional arguments namespace Test open System.Runtime.CompilerServices diff --git a/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/E_CallerLineNumber.fs b/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/E_CallerLineNumber.fs index 1d66da69961..0ea6504f070 100644 --- a/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/E_CallerLineNumber.fs +++ b/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/E_CallerLineNumber.fs @@ -1,6 +1,6 @@ -//'CallerLineNumber' must be applied to an argument of type 'int', but has been applied to an argument of type 'string' -//'CallerLineNumber' can only be applied to optional arguments -//'CallerLineNumber' can only be applied to optional arguments +//'CallerLineNumber' must be applied to an argument of type 'int', but has been applied to an argument of type 'string' +//'CallerLineNumber' can only be applied to optional arguments +//'CallerLineNumber' can only be applied to optional arguments namespace Test open System.Runtime.CompilerServices diff --git a/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/E_CallerMemberName.fs b/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/E_CallerMemberName.fs index 9749e1e1508..c25f4bbd229 100644 --- a/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/E_CallerMemberName.fs +++ b/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/E_CallerMemberName.fs @@ -1,6 +1,6 @@ -//'CallerMemberName' must be applied to an argument of type 'string', but has been applied to an argument of type 'int' -//'CallerMemberName' can only be applied to optional arguments -//'CallerMemberName' can only be applied to optional arguments +//'CallerMemberName' must be applied to an argument of type 'string', but has been applied to an argument of type 'int' +//'CallerMemberName' can only be applied to optional arguments +//'CallerMemberName' can only be applied to optional arguments namespace Test open System.Runtime.CompilerServices diff --git a/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/E_MultipleAttrs.fs b/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/E_MultipleAttrs.fs index fda49ca239f..96bd7ee575f 100644 --- a/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/E_MultipleAttrs.fs +++ b/tests/fsharpqa/Source/Conformance/SpecialAttributesAndTypes/Imported/CallerInfo/E_MultipleAttrs.fs @@ -1,7 +1,7 @@ -//'CallerFilePath' must be applied to an argument of type 'string', but has been applied to an argument of type 'int' -//'CallerFilePath' must be applied to an argument of type 'string', but has been applied to an argument of type 'int' -//'CallerLineNumber' must be applied to an argument of type 'int', but has been applied to an argument of type 'string' -//'CallerLineNumber' must be applied to an argument of type 'int', but has been applied to an argument of type 'string' +//'CallerFilePath' must be applied to an argument of type 'string', but has been applied to an argument of type 'int' +//'CallerFilePath' must be applied to an argument of type 'string', but has been applied to an argument of type 'int' +//'CallerLineNumber' must be applied to an argument of type 'int', but has been applied to an argument of type 'string' +//'CallerLineNumber' must be applied to an argument of type 'int', but has been applied to an argument of type 'string' namespace Test diff --git a/tests/scripts/scriptlib.fsx b/tests/scripts/scriptlib.fsx index ea1a5a63737..3f93a93b82c 100644 --- a/tests/scripts/scriptlib.fsx +++ b/tests/scripts/scriptlib.fsx @@ -10,14 +10,6 @@ open System.IO open System.Text open System.Diagnostics -module MessageSink = - let sinkWriter = -#if DEBUG - Console.Out -#else - TextWriter.Null -#endif - [] module Scripting = @@ -85,7 +77,7 @@ module Scripting = if Directory.Exists output then Directory.Delete(output, true) - let log format = fprintfn MessageSink.sinkWriter format + let log format = printfn format type FilePath = string diff --git a/tests/service/data/TestTP/ProvidedTypes.fs b/tests/service/data/TestTP/ProvidedTypes.fs index 50dd53a55a4..1df9d3139d1 100644 --- a/tests/service/data/TestTP/ProvidedTypes.fs +++ b/tests/service/data/TestTP/ProvidedTypes.fs @@ -8907,6 +8907,7 @@ namespace ProviderImplementation.ProvidedTypes let enqueueReferencedAssemblies(asm: Assembly) = do sourceAssembliesQueue.Add (fun () -> [| for referencedAssemblyName in asm.GetReferencedAssemblies() do + if not (sourceAssembliesTable_.ContainsKey referencedAssemblyName.Name) then let referencedAssembly = try Assembly.Load(referencedAssemblyName) with _ -> null if not (isNull referencedAssembly) then yield referencedAssembly |]) @@ -8920,12 +8921,12 @@ namespace ProviderImplementation.ProvidedTypes for q in qs do for asm in q() do let simpleName = asm.GetName().Name - if not (sourceAssembliesTable_.ContainsKey(simpleName)) then - sourceAssembliesTable_[simpleName] <- asm + sourceAssembliesTable_.GetOrAdd(simpleName, fun k -> sourceAssemblies_.Add asm // Find the transitive closure of all referenced assemblies enqueueReferencedAssemblies asm - + asm + ) |> ignore sourceAssemblies_ /// When translating quotations, Expr.Var's are translated to new variable respecting reference equality. diff --git a/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs b/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs index 2b194fe27fd..c39e608a4d1 100644 --- a/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs +++ b/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs @@ -128,10 +128,7 @@ module internal ClassificationDefinitions = ] let setIsDarkBackground () = - isDarkBackground <- - VSColorTheme - .GetThemedColor(EnvironmentColors.ToolWindowBackgroundColorKey) - .GetBrightness() < 0.5f + isDarkBackground <- VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowBackgroundColorKey).GetBrightness() < 0.5f let setColors _ = diff --git a/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs b/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs index afdb990489b..fa17d938f10 100644 --- a/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs +++ b/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs @@ -149,12 +149,8 @@ type internal FSharpClassificationService [] () = member _.AddLexicalClassifications(_: SourceText, _: TextSpan, _: List, _: CancellationToken) = () member _.AddSyntacticClassificationsAsync - ( - document: Document, - textSpan: TextSpan, - result: List, - cancellationToken: CancellationToken - ) = + (document: Document, textSpan: TextSpan, result: List, cancellationToken: CancellationToken) + = cancellableTask { use _logBlock = Logger.LogBlock(LogEditorFunctionId.Classification_Syntactic) @@ -201,12 +197,8 @@ type internal FSharpClassificationService [] () = |> CancellableTask.startAsTask cancellationToken member _.AddSemanticClassificationsAsync - ( - document: Document, - textSpan: TextSpan, - result: List, - cancellationToken: CancellationToken - ) = + (document: Document, textSpan: TextSpan, result: List, cancellationToken: CancellationToken) + = cancellableTask { use _logBlock = Logger.LogBlock(LogEditorFunctionId.Classification_Semantic) diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs b/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs index ca85c9621fe..1805428b8d7 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs @@ -123,14 +123,8 @@ type internal ImplementInterfaceCodeFixProvider [] () = | None -> [ stubChange ] let getSuggestions - ( - sourceText: SourceText, - results: FSharpCheckFileResults, - state: InterfaceState, - displayContext, - entity, - indentSize - ) = + (sourceText: SourceText, results: FSharpCheckFileResults, state: InterfaceState, displayContext, entity, indentSize) + = if InterfaceStubGenerator.HasNoInterfaceMember entity then CancellableTask.singleton Seq.empty else diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/MakeOuterBindingRecursive.fs b/vsintegration/src/FSharp.Editor/CodeFixes/MakeOuterBindingRecursive.fs index 0d52dbdfa86..267832a1aff 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/MakeOuterBindingRecursive.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/MakeOuterBindingRecursive.fs @@ -34,9 +34,7 @@ type internal MakeOuterBindingRecursiveCodeFixProvider [] |> ValueOption.ofOption |> ValueOption.map (fun bindingRange -> RoslynHelpers.FSharpRangeToTextSpan(sourceText, bindingRange)) |> ValueOption.filter (fun bindingSpan -> - sourceText - .GetSubText(bindingSpan) - .ContentEquals(sourceText.GetSubText context.Span)) + sourceText.GetSubText(bindingSpan).ContentEquals(sourceText.GetSubText context.Span)) |> ValueOption.map (fun bindingSpan -> let title = String.Format(SR.MakeOuterBindingRecursive(), sourceText.GetSubText(bindingSpan).ToString()) diff --git a/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs b/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs index 7fb2e008368..e87fda21539 100644 --- a/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs +++ b/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs @@ -108,10 +108,7 @@ type internal XmlDocCommandFilter(wpfTextView: IWpfTextView, filePath: string, w paramNames |> List.iter (fun p -> - toInsert - .AppendLine() - .Append(' ', indent) - .Append(sprintf "/// " p) + toInsert.AppendLine().Append(' ', indent).Append(sprintf "/// " p) |> ignore) let _newSS = diff --git a/vsintegration/src/FSharp.Editor/Common/AssemblyInfo.fs b/vsintegration/src/FSharp.Editor/Common/AssemblyInfo.fs index 73e984f934f..124f3de404c 100644 --- a/vsintegration/src/FSharp.Editor/Common/AssemblyInfo.fs +++ b/vsintegration/src/FSharp.Editor/Common/AssemblyInfo.fs @@ -8,6 +8,4 @@ open Microsoft.VisualStudio.Shell // This adds $PackageFolder$ to the directories probed for assemblies to load. // The attribute is inexplicably class-targeted, hence the dummy class. [] -type private BindingPathForUIResources = - class - end +type private BindingPathForUIResources = class end diff --git a/vsintegration/src/FSharp.Editor/Common/CodeAnalysisExtensions.fs b/vsintegration/src/FSharp.Editor/Common/CodeAnalysisExtensions.fs index 4776a963a5c..e0b29c8f9f1 100644 --- a/vsintegration/src/FSharp.Editor/Common/CodeAnalysisExtensions.fs +++ b/vsintegration/src/FSharp.Editor/Common/CodeAnalysisExtensions.fs @@ -9,17 +9,11 @@ type Project with /// Returns the projectIds of all projects within the same solution that directly reference this project member this.GetDependentProjectIds() = - this.Solution - .GetProjectDependencyGraph() - .GetProjectsThatDirectlyDependOnThisProject - this.Id + this.Solution.GetProjectDependencyGraph().GetProjectsThatDirectlyDependOnThisProject this.Id /// Returns all projects within the same solution that directly reference this project. member this.GetDependentProjects() = - this.Solution - .GetProjectDependencyGraph() - .GetProjectsThatDirectlyDependOnThisProject - this.Id + this.Solution.GetProjectDependencyGraph().GetProjectsThatDirectlyDependOnThisProject this.Id |> Seq.map this.Solution.GetProject /// Returns the ProjectIds of all of the projects that this project directly or transitively depends on diff --git a/vsintegration/src/FSharp.Editor/Common/Extensions.fs b/vsintegration/src/FSharp.Editor/Common/Extensions.fs index 5b154deab73..3483c9c583e 100644 --- a/vsintegration/src/FSharp.Editor/Common/Extensions.fs +++ b/vsintegration/src/FSharp.Editor/Common/Extensions.fs @@ -7,9 +7,15 @@ open System open System.IO open System.Collections.Immutable open System.Collections.Generic +open System.Runtime.InteropServices open System.Threading open System.Threading.Tasks +open Microsoft.VisualStudio +open Microsoft.VisualStudio.Shell +open Microsoft.VisualStudio.Shell.Interop +open Microsoft.VisualStudio.TextManager.Interop + open Microsoft.CodeAnalysis open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.Host @@ -19,6 +25,10 @@ open FSharp.Compiler.Syntax open FSharp.Compiler.Text open Microsoft.VisualStudio.FSharp.Editor +open Microsoft.VisualStudio.Editor +open Microsoft.VisualStudio.Text.Editor +open Microsoft.VisualStudio +open Microsoft.VisualStudio.OLE.Interop type private FSharpGlyph = FSharp.Compiler.EditorServices.FSharpGlyph type private FSharpRoslynGlyph = Microsoft.CodeAnalysis.ExternalAccess.FSharp.FSharpGlyph @@ -59,6 +69,56 @@ type Project with member this.IsFSharp = this.Language = LanguageNames.FSharp +type TextViewEventsHandler + ( + onChangeCaretHandler: (IVsTextView * int * int -> unit) option, + onKillFocus: (IVsTextView -> unit) option, + onSetFocus: (IVsTextView -> unit) option + ) = + interface IVsTextViewEvents with + member this.OnChangeCaretLine(view: IVsTextView, newline: int, oldline: int) = + onChangeCaretHandler + |> Option.iter (fun handler -> handler (view, newline, oldline)) + + member this.OnChangeScrollInfo + (_view: IVsTextView, _iBar: int, _iMinUnit: int, _iMaxUnits: int, _iVisibleUnits: int, _iFirstVisibleUnit: int) + = + () + + member this.OnKillFocus(view: IVsTextView) = + onKillFocus |> Option.iter (fun handler -> handler (view)) + + member this.OnSetBuffer(_view: IVsTextView, _buffer: IVsTextLines) = () + + member this.OnSetFocus(view: IVsTextView) = + onSetFocus |> Option.iter (fun handler -> handler (view)) + +type ConnectionPointSubscription = System.IDisposable option + +// Usage example: +// If a handler is None, to not handle that event +// let subscription = subscribeToTextViewEvents (textView, onChangeCaretHandler, onKillFocus, OnSetFocus) +// Unsubscribe using subscription.Dispose() +let subscribeToTextViewEvents (textView: IVsTextView, onChangeCaretHandler, onKillFocus, OnSetFocus) : ConnectionPointSubscription = + let handler = TextViewEventsHandler(onChangeCaretHandler, onKillFocus, OnSetFocus) + + match textView with + | :? IConnectionPointContainer as cpContainer -> + let riid = typeof.GUID + let mutable cookie = 0u + + match cpContainer.FindConnectionPoint(ref riid) with + | null -> None + | cp -> + Some( + cp.Advise(handler, &cookie) + + { new IDisposable with + member _.Dispose() = cp.Unadvise(cookie) + } + ) + | _ -> None + type Document with member this.TryGetLanguageService<'T when 'T :> ILanguageService>() = @@ -69,6 +129,32 @@ type Document with | null -> None | languageServices -> languageServices.GetService<'T>() |> Some + member this.TryGetIVsTextView() : IVsTextView option = + match ServiceProvider.GlobalProvider.GetService(typeof) with + | :? IVsTextManager as textManager -> + // Grab IVsRunningDocumentTable + match ServiceProvider.GlobalProvider.GetService(typeof) with + | :? IVsRunningDocumentTable as rdt -> + match rdt.FindAndLockDocument(uint32 _VSRDTFLAGS.RDT_NoLock, this.FilePath) with + | hr, _, _, docData, _ when ErrorHandler.Succeeded(hr) && docData <> IntPtr.Zero -> + match Marshal.GetObjectForIUnknown docData with + | :? IVsTextBuffer as ivsTextBuffer -> + match textManager.GetActiveView(1, ivsTextBuffer) with + | hr, vsTextView when ErrorHandler.Succeeded(hr) -> Some vsTextView + | _ -> None + | _ -> None + | _ -> None + | _ -> None + | _ -> None + + member this.TryGetTextViewAndCaretPos() : (IVsTextView * Position) option = + match this.TryGetIVsTextView() with + | Some textView -> + match textView.GetCaretPos() with + | hr, line, column when ErrorHandler.Succeeded(hr) -> Some(textView, Position.fromZ line column) + | _ -> None + | None -> None + member this.IsFSharpScript = isScriptFile this.FilePath member this.IsFSharpSignatureFile = isSignatureFile this.FilePath @@ -208,11 +294,7 @@ module private SourceText = type SourceText with member this.ToFSharpSourceText() = - SourceText.weakTable.GetValue( - this, - Runtime.CompilerServices.ConditionalWeakTable<_, _> - .CreateValueCallback(SourceText.create) - ) + SourceText.weakTable.GetValue(this, Runtime.CompilerServices.ConditionalWeakTable<_, _>.CreateValueCallback(SourceText.create)) type NavigationItem with diff --git a/vsintegration/src/FSharp.Editor/Common/Logging.fs b/vsintegration/src/FSharp.Editor/Common/Logging.fs index cf531c65384..b0f56df3234 100644 --- a/vsintegration/src/FSharp.Editor/Common/Logging.fs +++ b/vsintegration/src/FSharp.Editor/Common/Logging.fs @@ -156,11 +156,7 @@ module Activity = OpenTelemetry.Sdk .CreateTracerProviderBuilder() .AddSource(ActivityNames.FscSourceName) - .SetResourceBuilder( - ResourceBuilder - .CreateDefault() - .AddService(serviceName = "F#", serviceVersion = "1.0.0") - ) + .SetResourceBuilder(ResourceBuilder.CreateDefault().AddService(serviceName = "F#", serviceVersion = "1.0.0")) .AddOtlpExporter() .Build() diff --git a/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs b/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs index f43c53b2c0e..de1ed80a03c 100644 --- a/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs +++ b/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs @@ -71,8 +71,7 @@ type internal FSharpCompletionProvider // * let xs = [1..10] <<---- Don't commit autocomplete! (same for arrays) static let noCommitOnSpaceRules = let noCommitChars = - [| ' '; '='; ','; '.'; '<'; '>'; '('; ')'; '!'; ':'; '['; ']'; '|' |] - .ToImmutableArray() + [| ' '; '='; ','; '.'; '<'; '>'; '('; ')'; '!'; ':'; '['; ']'; '|' |].ToImmutableArray() CompletionItemRules.Default.WithCommitCharacterRules( ImmutableArray.Create(CharacterSetModificationRule.Create(CharacterSetModificationKind.Remove, noCommitChars)) @@ -150,7 +149,8 @@ type internal FSharpCompletionProvider ( document: Document, caretPosition: int, - getAllSymbols: FSharpCheckFileResults -> AssemblySymbol array + getAllSymbols: FSharpCheckFileResults -> AssemblySymbol array, + genBodyForOverriddenMeth: bool ) = cancellableTask { @@ -189,7 +189,8 @@ type internal FSharpCompletionProvider line, partialName, getAllSymbols, - (completionContextPos, completionContext) + (completionContextPos, completionContext), + genBodyForOverriddenMeth ) let results = List() @@ -201,9 +202,7 @@ type internal FSharpCompletionProvider if n <> 0 then n else - n <- - (CompletionUtils.getKindPriority x.Kind) - .CompareTo(CompletionUtils.getKindPriority y.Kind) + n <- (CompletionUtils.getKindPriority x.Kind).CompareTo(CompletionUtils.getKindPriority y.Kind) if n <> 0 then n @@ -353,7 +352,15 @@ type internal FSharpCompletionProvider else Array.empty - let! results = FSharpCompletionProvider.ProvideCompletionsAsyncAux(context.Document, context.Position, getAllSymbols) + let genBodyForOverriddenMeth = settings.IntelliSense.GenerateBodyForOverriddenMethod + + let! results = + FSharpCompletionProvider.ProvideCompletionsAsyncAux( + context.Document, + context.Position, + getAllSymbols, + genBodyForOverriddenMeth + ) context.AddItems results @@ -361,11 +368,8 @@ type internal FSharpCompletionProvider |> CancellableTask.startAsTask context.CancellationToken override _.GetDescriptionAsync - ( - document: Document, - completionItem: Completion.CompletionItem, - _cancellationToken: CancellationToken - ) : Task = + (document: Document, completionItem: Completion.CompletionItem, _cancellationToken: CancellationToken) + : Task = match completionItem.Properties.TryGetValue IndexPropName with | true, completionItemIndexStr when int completionItemIndexStr >= declarationItems.Length -> @@ -485,9 +489,6 @@ type internal FSharpCompletionProvider let changedText = finalSourceText.ToString(changedSpan) - return - CompletionChange - .Create(TextChange(fullChangingSpan, changedText)) - .WithNewPosition(Nullable(changedSpan.End)) + return CompletionChange.Create(TextChange(fullChangingSpan, changedText)).WithNewPosition(Nullable(changedSpan.End)) } |> CancellableTask.start cancellationToken diff --git a/vsintegration/src/FSharp.Editor/Completion/CompletionService.fs b/vsintegration/src/FSharp.Editor/Completion/CompletionService.fs index 13f7e3d3b30..450d8ed67ac 100644 --- a/vsintegration/src/FSharp.Editor/Completion/CompletionService.fs +++ b/vsintegration/src/FSharp.Editor/Completion/CompletionService.fs @@ -18,9 +18,7 @@ type internal FSharpCompletionService inherit FSharpCompletionServiceWithProviders(workspace) let projectInfoManager = - workspace.Services - .GetRequiredService() - .FSharpProjectOptionsManager + workspace.Services.GetRequiredService().FSharpProjectOptionsManager let builtInProviders = ImmutableArray.Create( @@ -38,10 +36,7 @@ type internal FSharpCompletionService | NewlineOnCompleteWord -> EnterKeyRule.AfterFullyTypedWord | AlwaysNewline -> EnterKeyRule.Always - CompletionRules.Default - .WithDismissIfEmpty(true) - .WithDismissIfLastCharacterDeleted(true) - .WithDefaultEnterKeyRule(enterKeyRule) + CompletionRules.Default.WithDismissIfEmpty(true).WithDismissIfLastCharacterDeleted(true).WithDefaultEnterKeyRule(enterKeyRule) /// Indicates the text span to be replaced by a committed completion list item. override _.GetDefaultCompletionListSpan(sourceText, caretIndex) = diff --git a/vsintegration/src/FSharp.Editor/Completion/CompletionUtils.fs b/vsintegration/src/FSharp.Editor/Completion/CompletionUtils.fs index 679caede1fd..1bb5958418c 100644 --- a/vsintegration/src/FSharp.Editor/Completion/CompletionUtils.fs +++ b/vsintegration/src/FSharp.Editor/Completion/CompletionUtils.fs @@ -148,16 +148,8 @@ module internal CompletionUtils = /// Indicates the text span to be replaced by a committed completion list item. let getDefaultCompletionListSpan - ( - sourceText: SourceText, - caretIndex, - documentId, - filePath, - defines, - langVersion, - strictIndentation, - ct: CancellationToken - ) = + (sourceText: SourceText, caretIndex, documentId, filePath, defines, langVersion, strictIndentation, ct: CancellationToken) + = // Gets connected identifier-part characters backward and forward from caret. let getIdentifierChars () = diff --git a/vsintegration/src/FSharp.Editor/Debugging/BreakpointResolutionService.fs b/vsintegration/src/FSharp.Editor/Debugging/BreakpointResolutionService.fs index 56ad5a26518..425dba181b4 100644 --- a/vsintegration/src/FSharp.Editor/Debugging/BreakpointResolutionService.fs +++ b/vsintegration/src/FSharp.Editor/Debugging/BreakpointResolutionService.fs @@ -48,11 +48,8 @@ type internal FSharpBreakpointResolutionService [] () = interface IFSharpBreakpointResolutionService with member _.ResolveBreakpointAsync - ( - document: Document, - textSpan: TextSpan, - cancellationToken: CancellationToken - ) : Task = + (document: Document, textSpan: TextSpan, cancellationToken: CancellationToken) + : Task = cancellableTask { let! range = FSharpBreakpointResolutionService.GetBreakpointLocation(document, textSpan) diff --git a/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs b/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs index 493750c06ec..3d815f92343 100644 --- a/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs +++ b/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs @@ -50,11 +50,8 @@ type internal FSharpLanguageDebugInfoService [] () = Task.FromResult(Unchecked.defaultof) member _.GetDataTipInfoAsync - ( - document: Document, - position: int, - cancellationToken: CancellationToken - ) : Task = + (document: Document, position: int, cancellationToken: CancellationToken) + : Task = cancellableTask { let defines, langVersion, strictIndentation = document.GetFsharpParsingOptions() diff --git a/vsintegration/src/FSharp.Editor/DocComments/XMLDocumentation.fs b/vsintegration/src/FSharp.Editor/DocComments/XMLDocumentation.fs index 3c708b8ab17..10db9697b56 100644 --- a/vsintegration/src/FSharp.Editor/DocComments/XMLDocumentation.fs +++ b/vsintegration/src/FSharp.Editor/DocComments/XMLDocumentation.fs @@ -281,9 +281,7 @@ module internal XmlDocumentation = collector.Add TaggedText.space WriteNodes collector (p.Nodes()) - type VsThreadToken() = - class - end + type VsThreadToken() = class end let vsToken = VsThreadToken() @@ -334,15 +332,8 @@ module internal XmlDocumentation = interface IDocumentationBuilder with /// Append the given processed XML formatted into the string builder override _.AppendDocumentationFromProcessedXML - ( - xmlCollector, - exnCollector, - processedXml, - showExceptions, - showParameters, - showRemarks, - paramName - ) = + (xmlCollector, exnCollector, processedXml, showExceptions, showParameters, showRemarks, paramName) + = match XmlDocReader.TryCreate processedXml with | Some xmlDocReader -> match paramName with @@ -449,12 +440,8 @@ module internal XmlDocumentation = } let BuildSingleTipText - ( - documentationProvider: IDocumentationBuilder, - dataTipElement: ToolTipElement, - limits: LineLimits, - showRemarks: bool - ) = + (documentationProvider: IDocumentationBuilder, dataTipElement: ToolTipElement, limits: LineLimits, showRemarks: bool) + = let { LineLimit = lineLimit diff --git a/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs b/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs index 7947b2dec99..972f64ad6b3 100644 --- a/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs +++ b/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs @@ -110,12 +110,8 @@ type internal FSharpDocumentHighlightsService [] () = interface IFSharpDocumentHighlightsService with member _.GetDocumentHighlightsAsync - ( - document, - position, - _documentsToSearch, - cancellationToken - ) : Task> = + (document, position, _documentsToSearch, cancellationToken) + : Task> = cancellableTask { let! spans = FSharpDocumentHighlightsService.GetDocumentHighlights(document, position) diff --git a/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs b/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs index bab1460f14a..d874656c176 100644 --- a/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs +++ b/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs @@ -23,13 +23,8 @@ open FSharp.Compiler.Tokenization type internal FSharpIndentationService [] () = static member IndentShouldFollow - ( - documentId: DocumentId, - sourceText: SourceText, - filePath: string, - position: int, - parsingOptions: FSharpParsingOptions - ) = + (documentId: DocumentId, sourceText: SourceText, filePath: string, position: int, parsingOptions: FSharpParsingOptions) + = let lastTokenOpt = let defines = CompilerEnvironment.GetConditionalDefinesForEditing parsingOptions diff --git a/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs b/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs index 867377cc335..f0712cb8e21 100644 --- a/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs +++ b/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs @@ -88,8 +88,7 @@ type InlineParameterNameHints(parseResults: FSharpParseFileResults) = symbol.HasAttribute() let getSourceTextAtRange (sourceText: SourceText) (range: range) = - (RoslynHelpers.FSharpRangeToTextSpan(sourceText, range) |> sourceText.GetSubText) - .ToString() + (RoslynHelpers.FSharpRangeToTextSpan(sourceText, range) |> sourceText.GetSubText).ToString() let isMemberOrFunctionOrValueValidForHint (symbol: FSharpMemberOrFunctionOrValue) (symbolUse: FSharpSymbolUse) = diff --git a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs index c51db3021cf..edf31e68a57 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs @@ -16,6 +16,13 @@ open System.Threading open Microsoft.VisualStudio.FSharp.Interactive.Session open System.Runtime.CompilerServices open CancellableTasks +open Microsoft.VisualStudio.FSharp.Editor.Extensions +open System.Windows +open Microsoft.VisualStudio +open FSharp.Compiler.Text +open Microsoft.VisualStudio.TextManager.Interop + +#nowarn "57" [] module private FSharpProjectOptionsHelpers = @@ -118,7 +125,7 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = ConcurrentDictionary() let singleFileCache = - ConcurrentDictionary() + ConcurrentDictionary() // This is used to not constantly emit the same compilation. let weakPEReferences = ConditionalWeakTable() @@ -198,15 +205,29 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = | false, _ -> let! sourceText = document.GetTextAsync(ct) - let! scriptProjectOptions, _ = - checker.GetProjectOptionsFromScript( - document.FilePath, - sourceText.ToFSharpSourceText(), - previewEnabled = SessionsProperties.fsiPreview, - assumeDotNetFramework = not SessionsProperties.fsiUseNetCore, - userOpName = userOpName - ) + let getProjectOptionsFromScript textViewAndCaret = + match textViewAndCaret with + | None -> + checker.GetProjectOptionsFromScript( + document.FilePath, + sourceText.ToFSharpSourceText(), + previewEnabled = SessionsProperties.fsiPreview, + assumeDotNetFramework = not SessionsProperties.fsiUseNetCore, + userOpName = userOpName + ) + + | Some(_, caret) -> + checker.GetProjectOptionsFromScript( + document.FilePath, + sourceText.ToFSharpSourceText(), + caret, + previewEnabled = SessionsProperties.fsiPreview, + assumeDotNetFramework = not SessionsProperties.fsiUseNetCore, + userOpName = userOpName + ) + let textViewAndCaret = document.TryGetTextViewAndCaretPos() + let! scriptProjectOptions, _ = getProjectOptionsFromScript textViewAndCaret let project = document.Project let otherOptions = @@ -243,13 +264,46 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = let parsingOptions, _ = checker.GetParsingOptionsFromProjectOptions(projectOptions) - singleFileCache.[document.Id] <- (document.Project, fileStamp, parsingOptions, projectOptions) + let updateProjectOptions () = + async { + let! scriptProjectOptions, _ = getProjectOptionsFromScript None + + checker.NotifyFileChanged(document.FilePath, scriptProjectOptions) + |> Async.Start + } + |> Async.Start + + let onChangeCaretHandler (_, _newline: int, _oldline: int) = updateProjectOptions () + let onKillFocus (_) = updateProjectOptions () + let onSetFocus (_) = updateProjectOptions () + + let addToCacheAndSubscribe value = + match value with + | projectId, fileStamp, parsingOptions, projectOptions, _ -> + let subscription = + match textViewAndCaret with + | Some(textView, _) -> + subscribeToTextViewEvents (textView, (Some onChangeCaretHandler), (Some onKillFocus), (Some onSetFocus)) + | None -> None + + (projectId, fileStamp, parsingOptions, projectOptions, subscription) + + singleFileCache.AddOrUpdate( + document.Id, // The key to the cache + (fun _ value -> addToCacheAndSubscribe value), // Function to add the cached value if the key does not exist + (fun _ _ value -> value), // Function to update the value if the key exists + (document.Project, fileStamp, parsingOptions, projectOptions, None) // The value to add or update + ) + |> ignore return ValueSome(parsingOptions, projectOptions) - | true, (oldProject, oldFileStamp, parsingOptions, projectOptions) -> + | true, (oldProject, oldFileStamp, parsingOptions, projectOptions, _) -> if fileStamp <> oldFileStamp || isProjectInvalidated document.Project oldProject ct then - singleFileCache.TryRemove(document.Id) |> ignore + match singleFileCache.TryRemove(document.Id) with + | true, (_, _, _, _, Some subscription) -> subscription.Dispose() + | _ -> () + return! tryComputeOptionsBySingleScriptOrFile document userOpName else return ValueSome(parsingOptions, projectOptions) @@ -460,9 +514,10 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = legacyProjectSites.TryRemove(projectId) |> ignore | FSharpProjectOptionsMessage.ClearSingleFileOptionsCache(documentId) -> match singleFileCache.TryRemove(documentId) with - | true, (_, _, _, projectOptions) -> + | true, (_, _, _, projectOptions, subscription) -> lastSuccessfulCompilations.TryRemove(documentId.ProjectId) |> ignore checker.ClearCache([ projectOptions ]) + subscription |> Option.iter (fun handler -> handler.Dispose()) | _ -> () } diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index 55cd1b622b3..5cc9cec2943 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -375,14 +375,10 @@ type internal FSharpPackage() as this = this.ComponentModel.DefaultExportProvider.GetExport() let optionsManager = - workspace.Services - .GetService() - .FSharpProjectOptionsManager + workspace.Services.GetService().FSharpProjectOptionsManager let metadataAsSource = - this.ComponentModel.DefaultExportProvider - .GetExport() - .Value + this.ComponentModel.DefaultExportProvider.GetExport().Value let! solution = this.GetServiceAsync(typeof) let solution = solution :?> IVsSolution @@ -440,9 +436,7 @@ type internal FSharpLanguageService(package: FSharpPackage) = let workspace = package.ComponentModel.GetService() let solutionAnalysis = - workspace.Services - .GetService() - .Advanced.SolutionBackgroundAnalysis + workspace.Services.GetService().Advanced.SolutionBackgroundAnalysis globalOptions.SetBackgroundAnalysisScope(openFilesOnly = not solutionAnalysis) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs index af619dad278..bf04e9a8a2d 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs @@ -18,9 +18,7 @@ type internal FSharpMiscellaneousFileService ConcurrentDictionary>(StringComparer.OrdinalIgnoreCase) let optionsManager = - workspace.Services - .GetRequiredService() - .FSharpProjectOptionsManager + workspace.Services.GetRequiredService().FSharpProjectOptionsManager static let createSourceCodeKind (filePath: string) = if isScriptFile filePath then diff --git a/vsintegration/src/FSharp.Editor/LanguageService/Tokenizer.fs b/vsintegration/src/FSharp.Editor/LanguageService/Tokenizer.fs index bc025402485..83f6532b8ad 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/Tokenizer.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/Tokenizer.fs @@ -508,12 +508,8 @@ module internal Tokenizer = | _ -> ClassificationTypeNames.Text let private scanSourceLine - ( - sourceTokenizer: FSharpSourceTokenizer, - textLine: TextLine, - lineContents: string, - lexState: FSharpTokenizerLexState - ) : SourceLineData = + (sourceTokenizer: FSharpSourceTokenizer, textLine: TextLine, lineContents: string, lexState: FSharpTokenizerLexState) + : SourceLineData = let colorMap = Array.create textLine.Span.Length ClassificationTypeNames.Text let lineTokenizer = sourceTokenizer.CreateLineTokenizer(lineContents) let tokens = ResizeArray() diff --git a/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs b/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs index 6c3b04f1844..1c09806d0ca 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs @@ -347,11 +347,8 @@ module private CheckerExtensions = } member checker.ParseAndCheckDocumentUsingTransparentCompiler - ( - document: Document, - options: FSharpProjectOptions, - userOpName: string - ) = + (document: Document, options: FSharpProjectOptions, userOpName: string) + = cancellableTask { checker.TransparentCompiler.SetCacheSizeFactor(document.Project.TransparentCompilerCacheFactor) @@ -368,12 +365,8 @@ module private CheckerExtensions = /// Parse and check the source text from the Roslyn document with possible stale results. member checker.ParseAndCheckDocumentWithPossibleStaleResults - ( - document: Document, - options: FSharpProjectOptions, - allowStaleResults: bool, - userOpName: string - ) = + (document: Document, options: FSharpProjectOptions, allowStaleResults: bool, userOpName: string) + = cancellableTask { let! ct = CancellableTask.getCancellationToken () @@ -439,12 +432,8 @@ module private CheckerExtensions = /// Parse and check the source text from the Roslyn document. member checker.ParseAndCheckDocument - ( - document: Document, - options: FSharpProjectOptions, - userOpName: string, - ?allowStaleResults: bool - ) = + (document: Document, options: FSharpProjectOptions, userOpName: string, ?allowStaleResults: bool) + = cancellableTask { if checker.UsesTransparentCompiler then diff --git a/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs b/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs index 429b21ce64a..921d82650f1 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs @@ -83,13 +83,8 @@ module FSharpFindUsagesService = } let findReferencedSymbolsAsync - ( - document: Document, - position: int, - context: IFSharpFindUsagesContext, - allReferences: bool, - userOp: string - ) : CancellableTask = + (document: Document, position: int, context: IFSharpFindUsagesContext, allReferences: bool, userOp: string) + : CancellableTask = cancellableTask { let! cancellationToken = CancellableTask.getCancellationToken () let! sourceText = document.GetTextAsync(cancellationToken) diff --git a/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs b/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs index 69a97e9732f..94615461dc1 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs @@ -645,11 +645,8 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) = } member this.NavigateToExternalDeclaration - ( - targetSymbolUse: FSharpSymbolUse, - metadataReferences: seq, - cancellationToken: CancellationToken - ) = + (targetSymbolUse: FSharpSymbolUse, metadataReferences: seq, cancellationToken: CancellationToken) + = let textOpt = match targetSymbolUse.Symbol with @@ -892,9 +889,7 @@ type FSharpCrossLanguageSymbolNavigationService() = let workspace = componentModel.GetService() let metadataAsSource = - componentModel.DefaultExportProvider - .GetExport() - .Value + componentModel.DefaultExportProvider.GetExport().Value let tryFindFieldByName (name: string) (e: FSharpEntity) = let fields = @@ -1060,11 +1055,8 @@ type FSharpCrossLanguageSymbolNavigationService() = interface IFSharpCrossLanguageSymbolNavigationService with member _.TryGetNavigableLocationAsync - ( - assemblyName: string, - documentationCommentId: string, - cancellationToken: CancellationToken - ) : Task = + (assemblyName: string, documentationCommentId: string, cancellationToken: CancellationToken) + : Task = let path = FSharpCrossLanguageSymbolNavigationService.DocCommentIdToPath documentationCommentId diff --git a/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs b/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs index 60ca208a2a0..546b00e1b16 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs @@ -189,13 +189,8 @@ type internal FSharpNavigateToSearchService interface IFSharpNavigateToSearchService with member _.SearchProjectAsync - ( - project, - _priorityDocuments, - searchPattern, - kinds, - cancellationToken - ) : Task> = + (project, _priorityDocuments, searchPattern, kinds, cancellationToken) + : Task> = cancellableTask { let tryMatch = createMatcherFor searchPattern diff --git a/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs b/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs index ef67e6482ba..efc068386ca 100644 --- a/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs +++ b/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs @@ -24,6 +24,7 @@ type IntelliSenseOptions = ShowAfterCharIsDeleted: bool IncludeSymbolsFromUnopenedNamespacesOrModules: bool EnterKeySetting: EnterKeySetting + GenerateBodyForOverriddenMethod: bool } static member Default = @@ -32,6 +33,7 @@ type IntelliSenseOptions = ShowAfterCharIsDeleted = false IncludeSymbolsFromUnopenedNamespacesOrModules = false EnterKeySetting = EnterKeySetting.NeverNewline + GenerateBodyForOverriddenMethod = true } [] diff --git a/vsintegration/src/FSharp.Editor/QuickInfo/Views.fs b/vsintegration/src/FSharp.Editor/QuickInfo/Views.fs index ec42d190c15..146c7d7dfcb 100644 --- a/vsintegration/src/FSharp.Editor/QuickInfo/Views.fs +++ b/vsintegration/src/FSharp.Editor/QuickInfo/Views.fs @@ -64,13 +64,8 @@ module internal QuickInfoViewProvider = let encloseRuns runs : obj = ClassifiedTextElement(runs |> List.rev) let provideContent - ( - imageId: ImageId option, - description: TaggedText list, - documentation: TaggedText list, - navigation: FSharpNavigation, - getTooltip - ) = + (imageId: ImageId option, description: TaggedText list, documentation: TaggedText list, navigation: FSharpNavigation, getTooltip) + = let encloseText text = let rec loop text runs stack = diff --git a/vsintegration/src/FSharp.LanguageService/BackgroundRequests.fs b/vsintegration/src/FSharp.LanguageService/BackgroundRequests.fs index 4f6a3922118..c92e4e99586 100644 --- a/vsintegration/src/FSharp.LanguageService/BackgroundRequests.fs +++ b/vsintegration/src/FSharp.LanguageService/BackgroundRequests.fs @@ -98,7 +98,7 @@ type internal FSharpLanguageServiceBackgroundRequests_DEPRECATED lazy // This portion is executed on the language service thread let timestamp = if source=null then System.DateTime(2000,1,1) else source.OpenedTime // source is null in unit tests let checker = getInteractiveChecker() - let checkOptions, _diagnostics = checker.GetProjectOptionsFromScript(fileName, FSharp.Compiler.Text.SourceText.ofString sourceText, SessionsProperties.fsiPreview, timestamp, [| |]) |> Async.RunImmediate + let checkOptions, _diagnostics = checker.GetProjectOptionsFromScript(fileName, FSharp.Compiler.Text.SourceText.ofString sourceText, previewEnabled=SessionsProperties.fsiPreview, loadedTimeStamp=timestamp, otherFlags=[| |]) |> Async.RunImmediate let referencedProjectFileNames = [| |] let projectSite = ProjectSitesAndFiles.CreateProjectSiteForScript(fileName, referencedProjectFileNames, checkOptions) { ProjectSite = projectSite diff --git a/vsintegration/src/FSharp.UIResources/IntelliSenseOptionControl.xaml b/vsintegration/src/FSharp.UIResources/IntelliSenseOptionControl.xaml index dbb7b6bb8fc..ecd097b2941 100644 --- a/vsintegration/src/FSharp.UIResources/IntelliSenseOptionControl.xaml +++ b/vsintegration/src/FSharp.UIResources/IntelliSenseOptionControl.xaml @@ -1,16 +1,18 @@ - + - + @@ -19,21 +21,32 @@ - - - + + + - + + - - - + + + diff --git a/vsintegration/src/FSharp.UIResources/Strings.Designer.cs b/vsintegration/src/FSharp.UIResources/Strings.Designer.cs index e0244a62086..b6087aa8952 100644 --- a/vsintegration/src/FSharp.UIResources/Strings.Designer.cs +++ b/vsintegration/src/FSharp.UIResources/Strings.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 // //------------------------------------------------------------------------------ @@ -13,12 +13,12 @@ namespace Microsoft.VisualStudio.FSharp.UIResources { /// - /// A strongly-typed resource class, for looking up localized strings, etc. + /// 一个强类型的资源类,用于查找本地化的字符串等。 /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] @@ -33,7 +33,7 @@ internal Strings() { } /// - /// Returns the cached ResourceManager instance used by this class. + /// 返回此类使用的缓存的 ResourceManager 实例。 /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] public static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ internal Strings() { } /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] public static global::System.Globalization.CultureInfo Culture { @@ -61,7 +61,7 @@ internal Strings() { } /// - /// Looks up a localized string similar to Additional performance telemetry (experimental). + /// 查找类似 Additional performance telemetry (experimental) 的本地化字符串。 /// public static string AdditionalTelemetry { get { @@ -70,7 +70,7 @@ public static string AdditionalTelemetry { } /// - /// Looks up a localized string similar to Always place open statements at the top level. + /// 查找类似 Always place open statements at the top level 的本地化字符串。 /// public static string Always_place_opens_at_top_level { get { @@ -79,7 +79,7 @@ public static string Always_place_opens_at_top_level { } /// - /// Looks up a localized string similar to Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart). + /// 查找类似 Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) 的本地化字符串。 /// public static string Analyze_full_solution_on_background { get { @@ -88,7 +88,7 @@ public static string Analyze_full_solution_on_background { } /// - /// Looks up a localized string similar to Background analysis. + /// 查找类似 Background analysis 的本地化字符串。 /// public static string Background_analysis { get { @@ -97,7 +97,7 @@ public static string Background_analysis { } /// - /// Looks up a localized string similar to Block Structure Guides. + /// 查找类似 Block Structure Guides 的本地化字符串。 /// public static string Block_Structure { get { @@ -106,7 +106,7 @@ public static string Block_Structure { } /// - /// Looks up a localized string similar to Code Fixes. + /// 查找类似 Code Fixes 的本地化字符串。 /// public static string Code_Fixes { get { @@ -115,7 +115,7 @@ public static string Code_Fixes { } /// - /// Looks up a localized string similar to Completion Lists. + /// 查找类似 Completion Lists 的本地化字符串。 /// public static string Completion_Lists { get { @@ -124,7 +124,7 @@ public static string Completion_Lists { } /// - /// Looks up a localized string similar to D_ash underline. + /// 查找类似 D_ash underline 的本地化字符串。 /// public static string Dash_underline { get { @@ -133,7 +133,7 @@ public static string Dash_underline { } /// - /// Looks up a localized string similar to Diagnostics. + /// 查找类似 Diagnostics 的本地化字符串。 /// public static string Diagnostics { get { @@ -142,7 +142,7 @@ public static string Diagnostics { } /// - /// Looks up a localized string similar to D_ot underline. + /// 查找类似 D_ot underline 的本地化字符串。 /// public static string Dot_underline { get { @@ -151,7 +151,7 @@ public static string Dot_underline { } /// - /// Looks up a localized string similar to Keep background symbol keys. + /// 查找类似 Keep background symbol keys 的本地化字符串。 /// public static string Enable_Background_ItemKeyStore_And_Semantic_Classification { get { @@ -160,7 +160,7 @@ public static string Enable_Background_ItemKeyStore_And_Semantic_Classification } /// - /// Looks up a localized string similar to Enable fast find references & rename (experimental). + /// 查找类似 Enable fast find references & rename (experimental) 的本地化字符串。 /// public static string Enable_Fast_Find_References { get { @@ -169,7 +169,7 @@ public static string Enable_Fast_Find_References { } /// - /// Looks up a localized string similar to _Enable in-memory cross project references. + /// 查找类似 _Enable in-memory cross project references 的本地化字符串。 /// public static string Enable_in_memory_cross_project_references { get { @@ -178,7 +178,7 @@ public static string Enable_in_memory_cross_project_references { } /// - /// Looks up a localized string similar to Use live (unsaved) buffers for analysis (restart required). + /// 查找类似 Use live (unsaved) buffers for analysis (restart required) 的本地化字符串。 /// public static string Enable_Live_Buffers { get { @@ -187,7 +187,7 @@ public static string Enable_Live_Buffers { } /// - /// Looks up a localized string similar to Enable parallel reference resolution. + /// 查找类似 Enable parallel reference resolution 的本地化字符串。 /// public static string Enable_Parallel_Reference_Resolution { get { @@ -196,7 +196,7 @@ public static string Enable_Parallel_Reference_Resolution { } /// - /// Looks up a localized string similar to Enable partial type checking. + /// 查找类似 Enable partial type checking 的本地化字符串。 /// public static string Enable_partial_type_checking { get { @@ -205,7 +205,7 @@ public static string Enable_partial_type_checking { } /// - /// Looks up a localized string similar to Enable stale data for IntelliSense features. + /// 查找类似 Enable stale data for IntelliSense features 的本地化字符串。 /// public static string Enable_Stale_IntelliSense_Results { get { @@ -214,7 +214,7 @@ public static string Enable_Stale_IntelliSense_Results { } /// - /// Looks up a localized string similar to Always add new line on enter. + /// 查找类似 Always add new line on enter 的本地化字符串。 /// public static string Enter_key_always { get { @@ -223,7 +223,7 @@ public static string Enter_key_always { } /// - /// Looks up a localized string similar to Never add new line on enter. + /// 查找类似 Never add new line on enter 的本地化字符串。 /// public static string Enter_key_never { get { @@ -232,7 +232,7 @@ public static string Enter_key_never { } /// - /// Looks up a localized string similar to Only add new line on enter after end of fully typed word. + /// 查找类似 Only add new line on enter after end of fully typed word 的本地化字符串。 /// public static string Enter_key_only { get { @@ -241,7 +241,7 @@ public static string Enter_key_only { } /// - /// Looks up a localized string similar to Enter key behavior. + /// 查找类似 Enter key behavior 的本地化字符串。 /// public static string Enter_Key_Rule { get { @@ -250,7 +250,7 @@ public static string Enter_Key_Rule { } /// - /// Looks up a localized string similar to Find References Performance Options. + /// 查找类似 Find References Performance Options 的本地化字符串。 /// public static string Find_References_Performance { get { @@ -259,7 +259,7 @@ public static string Find_References_Performance { } /// - /// Looks up a localized string similar to Re-format indentation on paste (Experimental). + /// 查找类似 Re-format indentation on paste (Experimental) 的本地化字符串。 /// public static string Format_on_paste { get { @@ -268,7 +268,7 @@ public static string Format_on_paste { } /// - /// Looks up a localized string similar to Formatting. + /// 查找类似 Formatting 的本地化字符串。 /// public static string Formatting { get { @@ -277,7 +277,16 @@ public static string Formatting { } /// - /// Looks up a localized string similar to Inline Hints. + /// 查找类似 Generate default implementation body for overrided method 的本地化字符串。 + /// + public static string Generate_Body_For_Overridden_Method { + get { + return ResourceManager.GetString("Generate_Body_For_Overridden_Method", resourceCulture); + } + } + + /// + /// 查找类似 Inline Hints 的本地化字符串。 /// public static string Inline_Hints { get { @@ -286,7 +295,7 @@ public static string Inline_Hints { } /// - /// Looks up a localized string similar to IntelliSense Performance Options. + /// 查找类似 IntelliSense Performance Options 的本地化字符串。 /// public static string IntelliSense_Performance { get { @@ -295,7 +304,7 @@ public static string IntelliSense_Performance { } /// - /// Looks up a localized string similar to Keep all background intermediate resolutions (increases memory usage). + /// 查找类似 Keep all background intermediate resolutions (increases memory usage) 的本地化字符串。 /// public static string Keep_All_Background_Resolutions { get { @@ -304,7 +313,7 @@ public static string Keep_All_Background_Resolutions { } /// - /// Looks up a localized string similar to Keep all background symbol uses (increases memory usage). + /// 查找类似 Keep all background symbol uses (increases memory usage) 的本地化字符串。 /// public static string Keep_All_Background_Symbol_Uses { get { @@ -313,7 +322,7 @@ public static string Keep_All_Background_Symbol_Uses { } /// - /// Looks up a localized string similar to Performance. + /// 查找类似 Performance 的本地化字符串。 /// public static string Language_Service_Performance { get { @@ -322,7 +331,7 @@ public static string Language_Service_Performance { } /// - /// Looks up a localized string similar to Language service settings (advanced). + /// 查找类似 Language service settings (advanced) 的本地化字符串。 /// public static string Language_Service_Settings { get { @@ -331,7 +340,7 @@ public static string Language_Service_Settings { } /// - /// Looks up a localized string similar to Live Buffers. + /// 查找类似 Live Buffers 的本地化字符串。 /// public static string LiveBuffers { get { @@ -340,7 +349,7 @@ public static string LiveBuffers { } /// - /// Looks up a localized string similar to Navigation links. + /// 查找类似 Navigation links 的本地化字符串。 /// public static string Navigation_links { get { @@ -349,7 +358,7 @@ public static string Navigation_links { } /// - /// Looks up a localized string similar to Outlining. + /// 查找类似 Outlining 的本地化字符串。 /// public static string Outlining { get { @@ -358,7 +367,7 @@ public static string Outlining { } /// - /// Looks up a localized string similar to Parallelization (requires restart). + /// 查找类似 Parallelization (requires restart) 的本地化字符串。 /// public static string Parallelization { get { @@ -367,7 +376,7 @@ public static string Parallelization { } /// - /// Looks up a localized string similar to Preferred description width in characters. + /// 查找类似 Preferred description width in characters 的本地化字符串。 /// public static string Preferred_description_width_in_characters { get { @@ -376,7 +385,7 @@ public static string Preferred_description_width_in_characters { } /// - /// Looks up a localized string similar to F# Project and Caching Performance Options. + /// 查找类似 F# Project and Caching Performance Options 的本地化字符串。 /// public static string Project_Performance { get { @@ -385,7 +394,7 @@ public static string Project_Performance { } /// - /// Looks up a localized string similar to Remove unnecessary parentheses (experimental, might affect typing performance). + /// 查找类似 Remove unnecessary parentheses (experimental, might affect typing performance) 的本地化字符串。 /// public static string Remove_parens_code_fix { get { @@ -394,7 +403,7 @@ public static string Remove_parens_code_fix { } /// - /// Looks up a localized string similar to Send additional performance telemetry. + /// 查找类似 Send additional performance telemetry 的本地化字符串。 /// public static string Send_Additional_Telemetry { get { @@ -403,7 +412,7 @@ public static string Send_Additional_Telemetry { } /// - /// Looks up a localized string similar to Show s_ymbols in unopened namespaces. + /// 查找类似 Show s_ymbols in unopened namespaces 的本地化字符串。 /// public static string Show_all_symbols { get { @@ -412,7 +421,7 @@ public static string Show_all_symbols { } /// - /// Looks up a localized string similar to Show completion list after a character is _deleted. + /// 查找类似 Show completion list after a character is _deleted 的本地化字符串。 /// public static string Show_completion_list_after_a_character_is_deleted { get { @@ -421,7 +430,7 @@ public static string Show_completion_list_after_a_character_is_deleted { } /// - /// Looks up a localized string similar to _Show completion list after a character is typed. + /// 查找类似 _Show completion list after a character is typed 的本地化字符串。 /// public static string Show_completion_list_after_a_character_is_typed { get { @@ -430,7 +439,7 @@ public static string Show_completion_list_after_a_character_is_typed { } /// - /// Looks up a localized string similar to Show structure guidelines for F# code. + /// 查找类似 Show structure guidelines for F# code 的本地化字符串。 /// public static string Show_guides { get { @@ -439,7 +448,7 @@ public static string Show_guides { } /// - /// Looks up a localized string similar to Display inline parameter name hints (preview). + /// 查找类似 Display inline parameter name hints (preview) 的本地化字符串。 /// public static string Show_Inline_Parameter_Name_Hints { get { @@ -448,7 +457,7 @@ public static string Show_Inline_Parameter_Name_Hints { } /// - /// Looks up a localized string similar to Display inline type hints (preview). + /// 查找类似 Display inline type hints (preview) 的本地化字符串。 /// public static string Show_Inline_Type_Hints { get { @@ -457,7 +466,7 @@ public static string Show_Inline_Type_Hints { } /// - /// Looks up a localized string similar to S_how navigation links as. + /// 查找类似 S_how navigation links as 的本地化字符串。 /// public static string Show_navigation_links_as { get { @@ -466,7 +475,7 @@ public static string Show_navigation_links_as { } /// - /// Looks up a localized string similar to Show outlining and collapsible nodes for F# code. + /// 查找类似 Show outlining and collapsible nodes for F# code 的本地化字符串。 /// public static string Show_Outlining { get { @@ -475,7 +484,7 @@ public static string Show_Outlining { } /// - /// Looks up a localized string similar to Show remarks in Quick Info. + /// 查找类似 Show remarks in Quick Info 的本地化字符串。 /// public static string Show_remarks_in_Quick_Info { get { @@ -484,7 +493,7 @@ public static string Show_remarks_in_Quick_Info { } /// - /// Looks up a localized string similar to Display return type hints (preview). + /// 查找类似 Display return type hints (preview) 的本地化字符串。 /// public static string Show_Return_Type_Hints { get { @@ -493,7 +502,7 @@ public static string Show_Return_Type_Hints { } /// - /// Looks up a localized string similar to Simplify names (remove unnecessary qualifiers). + /// 查找类似 Simplify names (remove unnecessary qualifiers) 的本地化字符串。 /// public static string Simplify_name_code_fix { get { @@ -502,7 +511,7 @@ public static string Simplify_name_code_fix { } /// - /// Looks up a localized string similar to _Solid underline. + /// 查找类似 _Solid underline 的本地化字符串。 /// public static string Solid_underline { get { @@ -511,7 +520,7 @@ public static string Solid_underline { } /// - /// Looks up a localized string similar to Suggest names for unresolved identifiers. + /// 查找类似 Suggest names for unresolved identifiers 的本地化字符串。 /// public static string Suggest_names_for_errors_code_fix { get { @@ -520,7 +529,7 @@ public static string Suggest_names_for_errors_code_fix { } /// - /// Looks up a localized string similar to Text hover. + /// 查找类似 Text hover 的本地化字符串。 /// public static string Text_hover { get { @@ -529,7 +538,7 @@ public static string Text_hover { } /// - /// Looks up a localized string similar to Time until stale results are used (in milliseconds). + /// 查找类似 Time until stale results are used (in milliseconds) 的本地化字符串。 /// public static string Time_until_stale_completion { get { @@ -538,7 +547,7 @@ public static string Time_until_stale_completion { } /// - /// Looks up a localized string similar to In-memory cross-project references store project-level data in memory to allow IDE features to work across projects.. + /// 查找类似 In-memory cross-project references store project-level data in memory to allow IDE features to work across projects. 的本地化字符串。 /// public static string Tooltip_in_memory_cross_project_references { get { @@ -547,7 +556,7 @@ public static string Tooltip_in_memory_cross_project_references { } /// - /// Looks up a localized string similar to Format signature to the given width by adding line breaks conforming with F# syntax rules. . + /// 查找类似 Format signature to the given width by adding line breaks conforming with F# syntax rules. 的本地化字符串。 /// public static string Tooltip_preferred_description_width_in_characters { get { @@ -556,7 +565,7 @@ public static string Tooltip_preferred_description_width_in_characters { } /// - /// Looks up a localized string similar to Transparent Compiler Cache Factor. + /// 查找类似 Transparent Compiler Cache Factor 的本地化字符串。 /// public static string Transparent_Compiler_Cache_Factor { get { @@ -565,7 +574,7 @@ public static string Transparent_Compiler_Cache_Factor { } /// - /// Looks up a localized string similar to Higher number means more memory will be used for caching. Changing the value wipes cache.. + /// 查找类似 Higher number means more memory will be used for caching. Changing the value wipes cache. 的本地化字符串。 /// public static string Transparent_Compiler_Cache_Factor_Tooltip { get { @@ -574,7 +583,7 @@ public static string Transparent_Compiler_Cache_Factor_Tooltip { } /// - /// Looks up a localized string similar to Create new project snapshots from existing ones. + /// 查找类似 Create new project snapshots from existing ones 的本地化字符串。 /// public static string Transparent_Compiler_Snapshot_Reuse { get { @@ -583,7 +592,7 @@ public static string Transparent_Compiler_Snapshot_Reuse { } /// - /// Looks up a localized string similar to Transparent Compiler (experimental). + /// 查找类似 Transparent Compiler (experimental) 的本地化字符串。 /// public static string TransparentCompiler { get { @@ -592,7 +601,7 @@ public static string TransparentCompiler { } /// - /// Looks up a localized string similar to WARNING! Transparent Compiler does not yet support all features and can cause crashes or give incorrect results.. + /// 查找类似 WARNING! Transparent Compiler does not yet support all features and can cause crashes or give incorrect results. 的本地化字符串。 /// public static string TransparentCompiler_Disclaimer1 { get { @@ -601,7 +610,7 @@ public static string TransparentCompiler_Disclaimer1 { } /// - /// Looks up a localized string similar to Use at your own risk!. + /// 查找类似 Use at your own risk! 的本地化字符串。 /// public static string TransparentCompiler_Disclaimer2 { get { @@ -610,7 +619,7 @@ public static string TransparentCompiler_Disclaimer2 { } /// - /// Looks up a localized string similar to By checking this you also opt-in for additional performance telemetry. + /// 查找类似 By checking this you also opt-in for additional performance telemetry 的本地化字符串。 /// public static string TransparentCompiler_Disclaimer3 { get { @@ -619,7 +628,7 @@ public static string TransparentCompiler_Disclaimer3 { } /// - /// Looks up a localized string similar to Analyze and suggest fixes for unused values. + /// 查找类似 Analyze and suggest fixes for unused values 的本地化字符串。 /// public static string Unused_declaration_code_fix { get { @@ -628,7 +637,7 @@ public static string Unused_declaration_code_fix { } /// - /// Looks up a localized string similar to Remove unused open statements. + /// 查找类似 Remove unused open statements 的本地化字符串。 /// public static string Unused_opens_code_fix { get { @@ -637,7 +646,7 @@ public static string Unused_opens_code_fix { } /// - /// Looks up a localized string similar to Use Transparent Compiler (restart required). + /// 查找类似 Use Transparent Compiler (restart required) 的本地化字符串。 /// public static string Use_Transparent_Compiler { get { diff --git a/vsintegration/src/FSharp.UIResources/Strings.resx b/vsintegration/src/FSharp.UIResources/Strings.resx index 61b3bab1750..00c8cb82360 100644 --- a/vsintegration/src/FSharp.UIResources/Strings.resx +++ b/vsintegration/src/FSharp.UIResources/Strings.resx @@ -312,4 +312,7 @@ By checking this you also opt-in for additional performance telemetry + + Generate default implementation body for overridden method + \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf index 0c938e3f447..9d7aae398d5 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf @@ -52,6 +52,11 @@ Formátování + + Generate default implementation body for overridden method + Generate default implementation body for overridden method + + Inline Hints Vložené nápovědy diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf index 99bac691cac..fc8fa182849 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf @@ -52,6 +52,11 @@ Formatierung + + Generate default implementation body for overridden method + Generate default implementation body for overridden method + + Inline Hints Inlinehinweise diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf index 5ae03505500..2d0d091cfad 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf @@ -52,6 +52,11 @@ Formato + + Generate default implementation body for overridden method + Generate default implementation body for overridden method + + Inline Hints Sugerencias insertadas diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf index 283e9d5d0f8..e1f1ecca5c1 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf @@ -52,6 +52,11 @@ Mise en forme + + Generate default implementation body for overridden method + Generate default implementation body for overridden method + + Inline Hints Indicateurs inline diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf index 9c534e8f8dd..816c3395e06 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf @@ -52,6 +52,11 @@ Formattazione + + Generate default implementation body for overridden method + Generate default implementation body for overridden method + + Inline Hints Suggerimenti inline diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf index 0e0bb91c628..5247c0cc870 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf @@ -52,6 +52,11 @@ 書式設定 + + Generate default implementation body for overridden method + Generate default implementation body for overridden method + + Inline Hints インラインのヒント diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf index 0d92ba2bb3a..421c91f4c38 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf @@ -52,6 +52,11 @@ 서식 + + Generate default implementation body for overridden method + Generate default implementation body for overridden method + + Inline Hints 인라인 힌트 diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf index 16ab9bfc3a1..9e31b9d72e6 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf @@ -52,6 +52,11 @@ Formatowanie + + Generate default implementation body for overridden method + Generate default implementation body for overridden method + + Inline Hints Wskazówki w tekście diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf index 82976646315..28c59366359 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf @@ -52,6 +52,11 @@ Formatação + + Generate default implementation body for overridden method + Generate default implementation body for overridden method + + Inline Hints Dicas Embutidas diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf index 737584669c1..143cd4e4bed 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf @@ -52,6 +52,11 @@ Форматирование + + Generate default implementation body for overridden method + Generate default implementation body for overridden method + + Inline Hints Встроенные подсказки diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf index d6763de0ed5..cf9ba4b6834 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf @@ -52,6 +52,11 @@ Biçimlendirme + + Generate default implementation body for overridden method + Generate default implementation body for overridden method + + Inline Hints Satır İçi İpuçları diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf index 917893a6b9c..2a43ae60eb2 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf @@ -52,6 +52,11 @@ 格式设置 + + Generate default implementation body for overridden method + Generate default implementation body for overridden method + + Inline Hints 内联提示 diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf index 0eeef704704..9b1459d5e43 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf @@ -52,6 +52,11 @@ 格式化 + + Generate default implementation body for overridden method + Generate default implementation body for overridden method + + Inline Hints 內嵌提示 diff --git a/vsintegration/tests/FSharp.Editor.Tests/BreakpointResolutionServiceTests.fs b/vsintegration/tests/FSharp.Editor.Tests/BreakpointResolutionServiceTests.fs index 403b342ff5b..de8b3c28ccd 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/BreakpointResolutionServiceTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/BreakpointResolutionServiceTests.fs @@ -69,9 +69,7 @@ let main argv = | ValueNone -> Assert.True(expectedResolution.IsNone, "BreakpointResolutionService failed to resolve breakpoint position") | ValueSome(actualResolutionRange) -> let actualResolution = - sourceText - .GetSubText(RoslynHelpers.FSharpRangeToTextSpan(sourceText, actualResolutionRange)) - .ToString() + sourceText.GetSubText(RoslynHelpers.FSharpRangeToTextSpan(sourceText, actualResolutionRange)).ToString() Assert.True( expectedResolution.IsSome, diff --git a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs index b9b95bc44ac..224849a59e2 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs @@ -398,7 +398,7 @@ let _ = ", " match () with - | () when box x :? int + | () when (box x :? int) -> () | _ -> () " @@ -1830,6 +1830,8 @@ in x f ((+) x y) z " + "(Gen.map f << Gen.map g) (Gen.constant x)", "(Gen.map f << Gen.map g) (Gen.constant x)" + // TypeApp "id (id)", "id id" @@ -1890,6 +1892,7 @@ in x """(id "x").Length""", """(id "x").Length""" """(3L.ToString("x")).Length""", """(3L.ToString "x").Length""" "~~TypedResults.Ok(maybe.Value)", "~~TypedResults.Ok(maybe.Value)" + "bg.lighten(0.2).hexa ()", "bg.lighten(0.2).hexa ()" // DotLambda "[{| A = x |}] |> List.map (_.A)", "[{| A = x |}] |> List.map _.A" diff --git a/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs b/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs index d8e92581f10..4377253d1ad 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs @@ -34,7 +34,7 @@ module CompletionProviderTests = let results = let task = - FSharpCompletionProvider.ProvideCompletionsAsyncAux(document, caretPosition, (fun _ -> [||])) + FSharpCompletionProvider.ProvideCompletionsAsyncAux(document, caretPosition, (fun _ -> [||]), false) |> CancellableTask.start CancellationToken.None task.Result |> Seq.map (fun result -> result.DisplayText) @@ -82,7 +82,7 @@ module CompletionProviderTests = let actual = let task = - FSharpCompletionProvider.ProvideCompletionsAsyncAux(document, caretPosition, (fun _ -> [||])) + FSharpCompletionProvider.ProvideCompletionsAsyncAux(document, caretPosition, (fun _ -> [||]), false) |> CancellableTask.start CancellationToken.None task.Result @@ -102,6 +102,40 @@ module CompletionProviderTests = let VerifyCompletionListExactly (fileContents: string, marker: string, expected: string list) = VerifyCompletionListExactlyWithOptions(fileContents, marker, expected, [||]) + /// Verify completion code. Only verify the expected completion items + let VerifyCompletionCode (genBodyForOverriddenMeth, fileContents: string, marker: string, expected: Map) = + let getNameInCode (item: CompletionItem) = + match item.Properties.TryGetValue "NameInCode" with + | true, x -> x + | _ -> item.DisplayText + + let caretPosition = fileContents.IndexOf(marker) + marker.Length + + let document = + RoslynTestHelpers.CreateSolution(fileContents, extraFSharpProjectOtherOptions = [||]) + |> RoslynTestHelpers.GetSingleDocument + + let actual = + let task = + FSharpCompletionProvider.ProvideCompletionsAsyncAux(document, caretPosition, (fun _ -> [||]), genBodyForOverriddenMeth) + |> CancellableTask.start CancellationToken.None + + task.Result + |> Seq.toList + |> List.choose (fun x -> + if expected.ContainsKey x.DisplayText then + Some(x.DisplayText, getNameInCode x) + else + None) + |> Map.ofList + + if actual <> expected then + failwithf + "Expected:\n%s,\nbut was:\n%s\nactual with DisplayText:\n%s" + (String.Join("\n", expected.Values |> Seq.map (sprintf "\"%s\""))) + (String.Join("\n", actual.Values |> Seq.map (sprintf "\"%s\""))) + (String.Join("\n", actual |> Seq.map (fun (KeyValue(fst, snd)) -> sprintf "%s => %s" fst snd))) + let VerifyNoCompletionList (fileContents: string, marker: string) = VerifyCompletionListExactly(fileContents, marker, []) @@ -2095,3 +2129,50 @@ Ops.() VerifyCompletionList(fileContents, "Ops.Foo.(", [], [ "|>>"; "(|>>)" ]) VerifyCompletionList(fileContents, "Ops.(", [], [ "|>>"; "(|>>)" ]) + + [] + let ``Check code generation for completion to overridable slots`` () = + let fileContents = + """ +let _ = + { new System.IO.Stream() with + member x. + } +""" + + let nl = Environment.NewLine + + let toCheckCompletionItems = + [ + "CanRead with get (): bool" + "Position with get (): int64 and set (value: int64)" + "ToString (): string" + ] + + VerifyCompletionCode( + true, + fileContents, + "member x.", + List.zip + toCheckCompletionItems + [ + $"CanRead{nl} with get (): bool = raise (System.NotImplementedException())" + $"Position{nl} with get (): int64 = raise (System.NotImplementedException()){nl} and set (value: int64) = raise (System.NotImplementedException())" + $"ToString (): string = {nl} base.ToString()" + ] + |> Map.ofList + ) + + VerifyCompletionCode( + false, + fileContents, + "member x.", + List.zip + toCheckCompletionItems + [ + $"CanRead{nl} with get (): bool = " + $"Position{nl} with get (): int64 = {nl} and set (value: int64) = " + $"ToString (): string = {nl} " + ] + |> Map.ofList + ) diff --git a/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs b/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs index 27db356ec4b..51efbb4fcf2 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs @@ -62,11 +62,8 @@ type DocumentDiagnosticAnalyzerTests() = |> Assert.shouldBeEqualWith expectedEnd "Error end positions should match" member private this.VerifyDiagnosticBetweenMarkers - ( - fileContents: string, - expectedMessage: string, - expectedSeverity: DiagnosticSeverity - ) = + (fileContents: string, expectedMessage: string, expectedSeverity: DiagnosticSeverity) + = let errors = this.getDiagnostics fileContents |> Seq.filter (fun e -> e.Severity = expectedSeverity) @@ -92,11 +89,8 @@ type DocumentDiagnosticAnalyzerTests() = |> Assert.shouldBeEqualWith expectedEnd "Error end positions should match" member private this.VerifyDiagnosticBetweenMarkers_HACK_PLEASE_REFER_TO_COMMENT_INSIDE - ( - fileContents: string, - expectedMessage: string, - expectedSeverity: DiagnosticSeverity - ) = + (fileContents: string, expectedMessage: string, expectedSeverity: DiagnosticSeverity) + = // TODO: once workaround (https://github.com/dotnet/fsharp/pull/15982) will not be needed, this should be reverted back to normal method (see PR) let errors = this.getDiagnostics fileContents @@ -127,11 +121,8 @@ type DocumentDiagnosticAnalyzerTests() = this.VerifyDiagnosticBetweenMarkers_HACK_PLEASE_REFER_TO_COMMENT_INSIDE(fileContents, expectedMessage, DiagnosticSeverity.Error) member private this.VerifyErrorAtMarker_HACK_PLEASE_REFER_TO_COMMENT_INSIDE - ( - fileContents: string, - expectedMarker: string, - ?expectedMessage: string - ) = + (fileContents: string, expectedMarker: string, ?expectedMessage: string) + = let errors = this.getDiagnostics fileContents |> Seq.filter (fun e -> e.Severity = DiagnosticSeverity.Error) diff --git a/vsintegration/tests/FSharp.Editor.Tests/FindReferencesTests.fs b/vsintegration/tests/FSharp.Editor.Tests/FindReferencesTests.fs index 4a10dacc6c6..1fc73fe81aa 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/FindReferencesTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/FindReferencesTests.fs @@ -73,9 +73,7 @@ module FindReferences = solution.TryGetDocumentFromPath documentPath |> ValueOption.defaultWith (fun _ -> failwith "Document not found") - findUsagesService - .FindReferencesAsync(document, getPositionOf "funcParam" documentPath, context) - .Wait() + findUsagesService.FindReferencesAsync(document, getPositionOf "funcParam" documentPath, context).Wait() // We cannot easily inspect what exactly was found here, but that should be verified // in FSharp.Compiler.ComponentTests.FSharpChecker.FindReferences @@ -96,9 +94,7 @@ module FindReferences = solution.TryGetDocumentFromPath documentPath |> ValueOption.defaultWith (fun _ -> failwith "Document not found") - findUsagesService - .FindReferencesAsync(document, getPositionOf "funcParam" documentPath, context) - .Wait() + findUsagesService.FindReferencesAsync(document, getPositionOf "funcParam" documentPath, context).Wait() if foundDefinitions.Count <> 1 then failwith $"Expected 1 definition but found {foundDefinitions.Count}" @@ -118,9 +114,7 @@ module FindReferences = solution.TryGetDocumentFromPath documentPath |> ValueOption.defaultWith (fun _ -> failwith "Document not found") - findUsagesService - .FindReferencesAsync(document, getPositionOf "sharedFunc" documentPath, context) - .Wait() + findUsagesService.FindReferencesAsync(document, getPositionOf "sharedFunc" documentPath, context).Wait() if foundDefinitions.Count <> 1 then failwith $"Expected 1 definition but found {foundDefinitions.Count}" @@ -159,9 +153,7 @@ module FindReferences = solution2.TryGetDocumentFromPath documentPath |> ValueOption.defaultWith (fun _ -> failwith "Document not found") - findUsagesService - .FindReferencesAsync(document, getPositionOf operator documentPath, context) - .Wait() + findUsagesService.FindReferencesAsync(document, getPositionOf operator documentPath, context).Wait() // We cannot easily inspect what exactly was found here, but that should be verified // in FSharp.Compiler.ComponentTests.FSharpChecker.FindReferences diff --git a/vsintegration/tests/FSharp.Editor.Tests/FsxCompletionProviderTests.fs b/vsintegration/tests/FSharp.Editor.Tests/FsxCompletionProviderTests.fs index 1b633c973d0..eac0c3f6e52 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/FsxCompletionProviderTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/FsxCompletionProviderTests.fs @@ -32,7 +32,7 @@ type Worker() = let actual = let x = - FSharpCompletionProvider.ProvideCompletionsAsyncAux(document, caretPosition, (fun _ -> [||])) + FSharpCompletionProvider.ProvideCompletionsAsyncAux(document, caretPosition, (fun _ -> [||]), false) |> CancellableTask.start CancellationToken.None x.Result diff --git a/vsintegration/tests/FSharp.Editor.Tests/GoToDefinitionServiceTests.fs b/vsintegration/tests/FSharp.Editor.Tests/GoToDefinitionServiceTests.fs index cc6bdbae43c..d0e4b5efad1 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/GoToDefinitionServiceTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/GoToDefinitionServiceTests.fs @@ -17,13 +17,8 @@ module GoToDefinitionServiceTests = let userOpName = "GoToDefinitionServiceTests" let private findDefinition - ( - document: Document, - sourceText: SourceText, - position: int, - defines: string list, - langVersion: string option - ) : range option = + (document: Document, sourceText: SourceText, position: int, defines: string list, langVersion: string option) + : range option = maybe { let textLine = sourceText.Lines.GetLineFromPosition position let textLinePos = sourceText.Lines.GetLinePosition position diff --git a/vsintegration/tests/FSharp.Editor.Tests/Helpers/RoslynHelpers.fs b/vsintegration/tests/FSharp.Editor.Tests/Helpers/RoslynHelpers.fs index ca113f72bf3..85ad11c6e2e 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/Helpers/RoslynHelpers.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/Helpers/RoslynHelpers.fs @@ -67,9 +67,7 @@ module MefHelpers = let configuration = CompositionConfiguration.Create(catalog) - RuntimeComposition - .CreateRuntimeComposition(configuration) - .CreateExportProviderFactory() + RuntimeComposition.CreateRuntimeComposition(configuration).CreateExportProviderFactory() let createExportProvider () = exportProviderFactory.CreateExportProvider() diff --git a/vsintegration/tests/FSharp.Editor.Tests/NavigateToSearchServiceTests.fs b/vsintegration/tests/FSharp.Editor.Tests/NavigateToSearchServiceTests.fs index 549441d8bb3..08816ea6191 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/NavigateToSearchServiceTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/NavigateToSearchServiceTests.fs @@ -41,9 +41,7 @@ module HeyHo = let navigateToSearch pattern = let service: IFSharpNavigateToSearchService = provider.GetExportedValue() - service - .SearchProjectAsync(project, [] |> Seq.toImmutableArray, pattern, service.KindsProvided, CancellationToken.None) - .Result + service.SearchProjectAsync(project, [] |> Seq.toImmutableArray, pattern, service.KindsProvided, CancellationToken.None).Result let assertResultsContain pattern expected = navigateToSearch pattern diff --git a/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs b/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs index f85ee51a6c8..398ece88fa3 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs @@ -45,9 +45,7 @@ module SignatureHelpProvider = |> CancellableTask.runSynchronously ct let paramInfoLocations = - parseResults - .FindParameterLocations(Position.fromZ caretLinePos.Line caretLineColumn) - .Value + parseResults.FindParameterLocations(Position.fromZ caretLinePos.Line caretLineColumn).Value let triggered = FSharpSignatureHelpProvider.ProvideMethodsAsyncAux( diff --git a/vsintegration/tests/FSharp.Editor.Tests/SyntacticColorizationServiceTests.fs b/vsintegration/tests/FSharp.Editor.Tests/SyntacticColorizationServiceTests.fs index 35c5306d8ff..04ab8dd2448 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/SyntacticColorizationServiceTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/SyntacticColorizationServiceTests.fs @@ -13,13 +13,8 @@ open FSharp.Test type SyntacticClassificationServiceTests() = member private this.ExtractMarkerData - ( - fileContents: string, - marker: string, - defines: string list, - langVersion: string option, - isScriptFile: Option - ) = + (fileContents: string, marker: string, defines: string list, langVersion: string option, isScriptFile: Option) + = let textSpan = TextSpan(0, fileContents.Length) let fileName = @@ -49,14 +44,8 @@ type SyntacticClassificationServiceTests() = (tokens, markerPosition) member private this.VerifyColorizerAtStartOfMarker - ( - fileContents: string, - marker: string, - defines: string list, - classificationType: string, - ?isScriptFile: bool, - ?langVersion: string - ) = + (fileContents: string, marker: string, defines: string list, classificationType: string, ?isScriptFile: bool, ?langVersion: string) + = let langVersion = langVersion |> Option.orElse (Some "preview") let (tokens, markerPosition) = @@ -69,14 +58,8 @@ type SyntacticClassificationServiceTests() = |> Assert.shouldBeEqualWith classificationType "Classification data doesn't match for start of marker" member private this.VerifyColorizerAtEndOfMarker - ( - fileContents: string, - marker: string, - defines: string list, - classificationType: string, - ?isScriptFile: bool, - ?langVersion: string - ) = + (fileContents: string, marker: string, defines: string list, classificationType: string, ?isScriptFile: bool, ?langVersion: string) + = let langVersion = langVersion |> Option.orElse (Some "preview") let (tokens, markerPosition) = diff --git a/vsintegration/tests/Salsa/salsa.fs b/vsintegration/tests/Salsa/salsa.fs index 6ac626f9fcb..1730bd7ec93 100644 --- a/vsintegration/tests/Salsa/salsa.fs +++ b/vsintegration/tests/Salsa/salsa.fs @@ -1110,7 +1110,7 @@ module internal Salsa = member file.GetFileName() = fileName member file.GetProjectOptionsOfScript() = - project.Solution.Vs.LanguageService.FSharpChecker.GetProjectOptionsFromScript(fileName, FSharp.Compiler.Text.SourceText.ofString file.CombinedLines, false, System.DateTime(2000,1,1), [| |]) + project.Solution.Vs.LanguageService.FSharpChecker.GetProjectOptionsFromScript(fileName, FSharp.Compiler.Text.SourceText.ofString file.CombinedLines, previewEnabled=false, loadedTimeStamp=System.DateTime(2000,1,1), otherFlags=[| |]) |> Async.RunImmediate |> fst // drop diagnostics