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/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 8f6f1eee176..47927f1f370 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -1,7 +1,7 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
{
"name": "F#",
- "image": "mcr.microsoft.com/dotnet/sdk:9.0.200",
+ "image": "mcr.microsoft.com/dotnet/sdk:9.0.202",
"features": {
"ghcr.io/devcontainers/features/common-utils:2.5.2": {},
"ghcr.io/devcontainers/features/git:1.3.2": {},
diff --git a/.fantomasignore b/.fantomasignore
index bae15e0668b..c2677d44fa4 100644
--- a/.fantomasignore
+++ b/.fantomasignore
@@ -40,19 +40,6 @@ src/Compiler/Checking/SignatureConformance.fs
src/Compiler/Checking/TypeHierarchy.fs
src/Compiler/Checking/TypeRelations.fs
-# nullness-related problems
-src/Compiler/Utilities/lib.fsi
-src/Compiler/Utilities/Cancellable.fsi
-src/FSharp.Core/tasks.fsi
-src/FSharp.Core/tasks.fs
-src/FSharp.Core/resumable.fs
-src/Compiler/DependencyManager/DependencyProvider.fs
-src/FSharp.Core/fslib-extra-pervasives.fs
-src/FSharp.Core/fslib-extra-pervasives.fsi
-
-# Incorrectly formatted: https://github.com/dotnet/fsharp/pull/14645/commits/49443a67ea8a17670c8a7c80c8bdf91f82231e91 or https://github.com/fsprojects/fantomas/issues/2733
-# This CompilerImports.fs behavior is not fixed yet, following up in https://github.com/fsprojects/fantomas/issues/2733
-src/Compiler/Driver/CompilerImports.fs
# The following files were formatted, but the "format, --check" loop is not stable.
# Fantomas formats them, but still thinks they need formatting
src/Compiler/Optimize/DetupleArgs.fs
@@ -96,45 +83,6 @@ src/FSharp.Core/printf.fs
src/FSharp.Core/Query.fs
src/FSharp.Core/seqcore.fs
-
-# fsharp (to investigate)
-
-**/TypeProviders.fsi
-**/tainted.fsi
-
-# uses nullness features
-
-**/DependencyProvider.fsi
-src/FSharp.Core/array.fs
-src/FSharp.Core/option.fsi
-src/FSharp.Core/option.fs
-src/fsi/console.fs
-src/FSharp.Build/FSharpCommandLineBuilder.fs
-
-src/Compiler/Utilities/Activity.fs
-src/Compiler/Utilities/sformat.fs
-src/Compiler/Utilities/illib.fsi
-src/Compiler/Utilities/illib.fs
-
-
-src/Compiler/Utilities/NullnessShims.fs
-src/Compiler/Utilities/DependencyGraph.fs
-src/Compiler/Utilities/LruCache.fsi
-src/Compiler/Utilities/LruCache.fs
-src/Compiler/Utilities/HashMultiMap.fsi
-src/Compiler/Utilities/HashMultiMap.fs
-src/Compiler/Facilities/AsyncMemoize.fsi
-src/Compiler/Facilities/AsyncMemoize.fs
-src/Compiler/AbstractIL/il.fs
-src/Compiler/SyntaxTree/LexerStore.fs
-
-src/Compiler/Driver/GraphChecking/Graph.fsi
-src/Compiler/Driver/GraphChecking/Graph.fs
-
-src/FSharp.Compiler.LanguageServer/Common/LifecycleManager.fs
-src/Compiler/DependencyManager/NativeDllResolveHandler.fsi
-src/Compiler/DependencyManager/AssemblyResolveHandler.fsi
-
# Fantomas limitations on implementation files (to investigate)
src/Compiler/AbstractIL/ilwrite.fs
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/Directory.Build.props b/Directory.Build.props
index c4f2bff9287..141c85ff4d2 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -10,11 +10,6 @@
$(DotNetBuildSourceOnly)
-
-
- $(NoWarn);FS0064;FS1182
-
-
$(ArtifactsDir)/bin/fslex/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/$(RuntimeIdentifier)/fslex.dll
$(ArtifactsDir)/bin/fsyacc/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/$(RuntimeIdentifier)/fsyacc.dll
- NO_CHECKNULLS;BUILDING_WITH_LKG;NO_NULLCHECKING_LIB_SUPPORT;$(DefineConstants)
+ BUILDING_WITH_LKG;$(DefineConstants)
diff --git a/FSharp.Profiles.props b/FSharp.Profiles.props
index 186875ad357..35a907b2e6f 100644
--- a/FSharp.Profiles.props
+++ b/FSharp.Profiles.props
@@ -1,41 +1,15 @@
-
-
-
- false
-
-
-
-
- false
-
- false
- NO_CHECKNULLS;BUILDING_WITH_LKG;NO_NULLCHECKING_LIB_SUPPORT;$(DefineConstants)
- false
+ BUILDING_WITH_LKG;$(DefineConstants)
preview
-
- false
-
-
-
- enable
-
-
-
-
- $(NoWarn);3271
- NO_CHECKNULLS;$(DefineConstants)
-
-
diff --git a/FSharp.sln b/FSharp.sln
index fdf3b68cdef..094d4302e5c 100644
--- a/FSharp.sln
+++ b/FSharp.sln
@@ -106,6 +106,7 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Benchmarks"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D58BFE8B-7C85-4D3B-B5F3-9A7BB90FF1EE}"
ProjectSection(SolutionItems) = preProject
+ src\Compiler\default.win32manifest = src\Compiler\default.win32manifest
src\Compiler\FSComp.txt = src\Compiler\FSComp.txt
src\Compiler\FSCompCheck.fsx = src\Compiler\FSCompCheck.fsx
EndProjectSection
diff --git a/FSharpBuild.Directory.Build.props b/FSharpBuild.Directory.Build.props
index 148d9c95116..1b7ecd6fa27 100644
--- a/FSharpBuild.Directory.Build.props
+++ b/FSharpBuild.Directory.Build.props
@@ -27,7 +27,8 @@
$(ArtifactsDir)\SymStore
$(ArtifactsDir)\Bootstrap
4.4.0
- 1182;0025;$(WarningsAsErrors)
+ $(WarnOn);1182
+ 0025;$(WarningsAsErrors)
$(OtherFlags) --nowarn:3384
$(OtherFlags) --times --nowarn:75
$(OtherFlags) $(AdditionalFscCmdFlags)
diff --git a/NuGet.config b/NuGet.config
index d30d1402844..944ae5b686e 100644
--- a/NuGet.config
+++ b/NuGet.config
@@ -8,7 +8,7 @@
-
+
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 5f722b11a12..f40ab0428ed 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))
@@ -18,6 +19,7 @@
* 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))
@@ -27,10 +29,10 @@
* 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)
+* Use a more accurate range for CE Combine methods. [PR #18394](https://github.com/dotnet/fsharp/pull/18394)
### 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))
diff --git a/docs/release-notes/.VisualStudio/17.14.md b/docs/release-notes/.VisualStudio/17.14.md
index db5d628bb0c..f9b710ea122 100644
--- a/docs/release-notes/.VisualStudio/17.14.md
+++ b/docs/release-notes/.VisualStudio/17.14.md
@@ -1,4 +1,5 @@
### 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)
diff --git a/docs/reusing-typechecking-results.md b/docs/reusing-typechecking-results.md
index 247e26f21dd..9eedc036ab0 100644
--- a/docs/reusing-typechecking-results.md
+++ b/docs/reusing-typechecking-results.md
@@ -25,7 +25,7 @@ Here are some assumptions I am coming with after tinkering with the topic and in
### Premise 1: current compiler design
-The heart of the compiler, [fsc.fs](src\Compiler\Driver\fsc.fs), is split into 6 phases (`main1` - `main6`). The code is designed to pass minimum information between phases, using the `Args` structure, which is essentially a data bag. The first phase takes info from the program arguments.
+The heart of the compiler, [fsc.fs](../src/Compiler/Driver/fsc.fs), is split into 6 phases (`main1` - `main6`). The code is designed to pass minimum information between phases, using the `Args` structure, which is essentially a data bag. The first phase takes info from the program arguments.
```fsharp
main1 (...args...)
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index d01cf73cceb..a3b61734d48 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -1,32 +1,32 @@
-
+
https://github.com/dotnet/source-build-reference-packages
- 27dfbb8d8a0344d845948109a5a1f0d9c7f17fa9
+ 6968f7059f4418e985febe704a3b1320f9e5887d
-
+
https://github.com/dotnet/msbuild
- a4ef1e90fef9b56473708b7d308f982c7c9f46d9
+ 0ca03f84b7848ce9d7d3e5d1f68c5e090efa4f30
-
+
https://github.com/dotnet/msbuild
- a4ef1e90fef9b56473708b7d308f982c7c9f46d9
+ 0ca03f84b7848ce9d7d3e5d1f68c5e090efa4f30
-
+
https://github.com/dotnet/msbuild
- a4ef1e90fef9b56473708b7d308f982c7c9f46d9
+ 0ca03f84b7848ce9d7d3e5d1f68c5e090efa4f30
-
+
https://github.com/dotnet/msbuild
- a4ef1e90fef9b56473708b7d308f982c7c9f46d9
+ 0ca03f84b7848ce9d7d3e5d1f68c5e090efa4f30
-
+
https://github.com/dotnet/msbuild
- a4ef1e90fef9b56473708b7d308f982c7c9f46d9
+ 0ca03f84b7848ce9d7d3e5d1f68c5e090efa4f30
https://github.com/dotnet/runtime
diff --git a/eng/Versions.props b/eng/Versions.props
index f4b5ae88140..5ce287e802b 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -71,21 +71,29 @@
$(VersionPrefix).0
+
+
+ 4.6.1
+ 4.6.2
+ 6.1.1
+
+
+
+ 4.6.0
+ 4.5.5
+ 6.1.0
+
8.0.0
- 4.6.0
$(SystemPackageVersionVersion)
$(SystemPackageVersionVersion)
$(SystemPackageVersionVersion)
$(SystemPackageVersionVersion)
- 4.5.5
- 4.6.0
4.7.0
$(SystemPackageVersionVersion)
- 6.1.0
$(SystemPackageVersionVersion)
1.6.0
@@ -94,7 +102,7 @@
17.10.40152
17.10.526-pre-g1b474069f5
17.10.41
- 17.13.20
+ 17.13.22
$(RoslynVersion)
$(RoslynVersion)
@@ -130,9 +138,9 @@
15.0.25123-Dev15Preview
- 17.13.20
- 17.13.20
- 17.13.20
+ 17.13.22
+ 17.13.22
+ 17.13.22
$(VisualStudioEditorPackagesVersion)
diff --git a/global.json b/global.json
index 3883eb9db41..eca327e814a 100644
--- a/global.json
+++ b/global.json
@@ -1,10 +1,10 @@
{
"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": [
diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs
index 33a46ff0a23..d0770b414ed 100644
--- a/src/Compiler/AbstractIL/il.fs
+++ b/src/Compiler/AbstractIL/il.fs
@@ -170,11 +170,8 @@ let splitTypeNameRight nm =
// --------------------------------------------------------------------
/// This is used to store event, property and field maps.
-type LazyOrderedMultiMap<'Key, 'Data when 'Key: equality
-#if !NO_CHECKNULLS
- and 'Key:not null
-#endif
- >(keyf: 'Data -> 'Key, lazyItems: InterruptibleLazy<'Data list>) =
+type LazyOrderedMultiMap<'Key, 'Data when 'Key: equality and 'Key: not null>(keyf: 'Data -> 'Key, lazyItems: InterruptibleLazy<'Data list>)
+ =
let quickMap =
lazyItems
@@ -519,7 +516,11 @@ type ILAssemblyRef(data) =
let retargetable = aname.Flags = AssemblyNameFlags.Retargetable
- let name = match aname.Name with | null -> aname.FullName | name -> name
+ let name =
+ match aname.Name with
+ | null -> aname.FullName
+ | name -> name
+
ILAssemblyRef.Create(name, None, publicKey, retargetable, version, locale)
member aref.QualifiedName =
@@ -1862,7 +1863,7 @@ type ILGenericParameterDef =
Name: string
Constraints: ILTypes
Variance: ILGenericVariance
- HasReferenceTypeConstraint: bool
+ HasReferenceTypeConstraint: bool
HasNotNullableValueTypeConstraint: bool
HasDefaultConstructorConstraint: bool
HasAllowsRefStruct: bool
@@ -1910,7 +1911,11 @@ let inline conditionalAdd condition flagToAdd source =
let NoMetadataIdx = -1
type InterfaceImpl =
- { Idx: int; Type: ILType; mutable CustomAttrsStored: ILAttributesStored }
+ {
+ Idx: int
+ Type: ILType
+ mutable CustomAttrsStored: ILAttributesStored
+ }
member x.CustomAttrs =
match x.CustomAttrsStored with
@@ -1919,12 +1924,16 @@ type InterfaceImpl =
x.CustomAttrsStored <- ILAttributesStored.Given res
res
| ILAttributesStored.Given attrs -> attrs
-
- static member Create(ilType: ILType, customAttrsStored: ILAttributesStored) =
- { Idx = NoMetadataIdx; Type = ilType; CustomAttrsStored = customAttrsStored }
- static member Create(ilType: ILType) = InterfaceImpl.Create(ilType, emptyILCustomAttrsStored)
+ static member Create(ilType: ILType, customAttrsStored: ILAttributesStored) =
+ {
+ Idx = NoMetadataIdx
+ Type = ilType
+ CustomAttrsStored = customAttrsStored
+ }
+ static member Create(ilType: ILType) =
+ InterfaceImpl.Create(ilType, emptyILCustomAttrsStored)
[]
type ILMethodDef
@@ -2575,17 +2584,15 @@ type ILTypeDefAdditionalFlags =
| CanContainExtensionMethods = 1024
let internal typeKindFlags =
- ILTypeDefAdditionalFlags.Class |||
- ILTypeDefAdditionalFlags.ValueType |||
- ILTypeDefAdditionalFlags.Interface |||
- ILTypeDefAdditionalFlags.Enum |||
- ILTypeDefAdditionalFlags.Delegate
+ ILTypeDefAdditionalFlags.Class
+ ||| ILTypeDefAdditionalFlags.ValueType
+ ||| ILTypeDefAdditionalFlags.Interface
+ ||| ILTypeDefAdditionalFlags.Enum
+ ||| ILTypeDefAdditionalFlags.Delegate
-let inline internal resetTypeKind flags =
- flags &&& ~~~typeKindFlags
+let inline internal resetTypeKind flags = flags &&& ~~~typeKindFlags
-let (|HasFlag|_|) (flag: ILTypeDefAdditionalFlags) flags =
- flags &&& flag = flag
+let (|HasFlag|_|) (flag: ILTypeDefAdditionalFlags) flags = flags &&& flag = flag
let inline typeKindByNames extendsName typeName =
match extendsName with
@@ -2676,21 +2683,24 @@ type ILTypeDef
let hasFlag flag = additionalFlags &&& flag = flag
- new(name,
- attributes,
- layout,
- implements,
- genericParams,
- extends,
- methods,
- nestedTypes,
- fields,
- methodImpls,
- events,
- properties,
- additionalFlags,
- securityDecls,
- customAttrs) =
+ new
+ (
+ name,
+ attributes,
+ layout,
+ implements,
+ genericParams,
+ extends,
+ methods,
+ nestedTypes,
+ fields,
+ methodImpls,
+ events,
+ properties,
+ additionalFlags,
+ securityDecls,
+ customAttrs
+ ) =
ILTypeDef(
name,
attributes,
@@ -2710,23 +2720,27 @@ type ILTypeDef
NoMetadataIdx
)
- new(name,
- attributes,
- layout,
- implements,
- genericParams,
- extends,
- methods,
- nestedTypes,
- fields,
- methodImpls,
- events,
- properties,
- securityDecls,
- customAttrs) =
+ new
+ (
+ name,
+ attributes,
+ layout,
+ implements,
+ genericParams,
+ extends,
+ methods,
+ nestedTypes,
+ fields,
+ methodImpls,
+ events,
+ properties,
+ securityDecls,
+ customAttrs
+ ) =
let additionalFlags =
- ILTypeDefAdditionalFlags.CanContainExtensionMethods |||
- typeKindOfFlags name extends (int attributes)
+ ILTypeDefAdditionalFlags.CanContainExtensionMethods
+ ||| typeKindOfFlags name extends (int attributes)
+
ILTypeDef(
name,
attributes,
@@ -2955,10 +2969,10 @@ and [] ILPreTypeDef =
and [] ILPreTypeDefImpl(nameSpace: string list, name: string, metadataIndex: int32, storage: ILTypeDefStored) =
let stored =
lazy
- match storage with
- | ILTypeDefStored.Given td -> td
- | ILTypeDefStored.Computed f -> f ()
- | ILTypeDefStored.Reader f -> f metadataIndex
+ match storage with
+ | ILTypeDefStored.Given td -> td
+ | ILTypeDefStored.Computed f -> f ()
+ | ILTypeDefStored.Reader f -> f metadataIndex
interface ILPreTypeDef with
member _.Namespace = nameSpace
@@ -4248,25 +4262,31 @@ let mkILStorageCtorWithParamNames (preblock: ILInstr list, ty, extraParams, flds
| Some x -> I_seqpoint x
| None -> ()
yield! preblock
- for (n, (_pnm, nm, fieldTy,_attrs)) in List.indexed flds do
+ for (n, (_pnm, nm, fieldTy, _attrs)) in List.indexed flds do
mkLdarg0
mkLdarg (uint16 (n + 1))
mkNormalStfld (mkILFieldSpecInTy (ty, nm, fieldTy))
]
let body = mkMethodBody (false, [], 2, nonBranchingInstrsToCode code, tag, imports)
- let fieldParams =
+
+ let fieldParams =
[
- for (pnm,_,ty,attrs) in flds do
+ for (pnm, _, ty, attrs) in flds do
let ilParam = mkILParamNamed (pnm, ty)
+
let ilParam =
match attrs with
| [] -> ilParam
- | attrs -> {ilParam with CustomAttrsStored = storeILCustomAttrs (mkILCustomAttrs attrs ) }
+ | attrs ->
+ { ilParam with
+ CustomAttrsStored = storeILCustomAttrs (mkILCustomAttrs attrs)
+ }
+
yield ilParam
- ]
+ ]
- mkILCtor (access, fieldParams @ extraParams , body)
+ mkILCtor (access, fieldParams @ extraParams, body)
let mkILSimpleStorageCtorWithParamNames (baseTySpec, ty, extraParams, flds, access, tag, imports) =
let preblock =
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..ca309e95875 100644
--- a/src/Compiler/AbstractIL/ilreflect.fs
+++ b/src/Compiler/AbstractIL/ilreflect.fs
@@ -164,7 +164,7 @@ type TypeBuilder with
printfn "typeBuilder%d.CreateType()" (abs <| hash typB)
//Buggy annotation in ns20, will not be fixed.
-#if NETSTANDARD && !NO_CHECKNULLS
+#if NETSTANDARD
!!(typB.CreateTypeInfo()) :> Type
#else
typB.CreateTypeInfo() :> Type
@@ -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/AbstractIL/ilwrite.fs b/src/Compiler/AbstractIL/ilwrite.fs
index 2cb9bb01a1b..1d5111daa50 100644
--- a/src/Compiler/AbstractIL/ilwrite.fs
+++ b/src/Compiler/AbstractIL/ilwrite.fs
@@ -362,11 +362,7 @@ let envForOverrideSpec (ospec: ILOverridesSpec) = { EnclosingTyparCount=ospec.De
//---------------------------------------------------------------------
[]
-type MetadataTable<'T
-#if !NO_CHECKNULLS
- when 'T:not null
-#endif
- > =
+type MetadataTable<'T when 'T:not null> =
{ name: string
dict: Dictionary<'T, int> // given a row, find its entry number
mutable rows: ResizeArray<'T> }
diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs
index 22b603d211a..fc804ab5e34 100644
--- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs
+++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs
@@ -1612,6 +1612,12 @@ let rec TryTranslateComputationExpression
// "cexpr; cexpr" is treated as builder.Combine(cexpr1, cexpr1)
let m1 = rangeForCombine innerComp1
+ let combineDelayRange =
+ match innerComp2 with
+ | SynExpr.YieldOrReturn(trivia = yieldOrReturn) -> yieldOrReturn.YieldOrReturnKeyword
+ | SynExpr.YieldOrReturnFrom(trivia = yieldOrReturnFrom) -> yieldOrReturnFrom.YieldOrReturnFromKeyword
+ | expr -> expr.Range
+
if
isNil (
TryFindIntrinsicOrExtensionMethInfo
@@ -1624,7 +1630,8 @@ let rec TryTranslateComputationExpression
ceenv.builderTy
)
then
- error (Error(FSComp.SR.tcRequireBuilderMethod ("Combine"), m))
+
+ error (Error(FSComp.SR.tcRequireBuilderMethod "Combine", combineDelayRange))
if
isNil (
@@ -1638,7 +1645,7 @@ let rec TryTranslateComputationExpression
ceenv.builderTy
)
then
- error (Error(FSComp.SR.tcRequireBuilderMethod ("Delay"), m))
+ error (Error(FSComp.SR.tcRequireBuilderMethod "Delay", combineDelayRange))
let combineCall =
mkSynCall
@@ -3083,9 +3090,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 f1e6960cc21..7f1d22f0dd2 100644
--- a/src/Compiler/Checking/Expressions/CheckExpressions.fs
+++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs
@@ -813,7 +813,7 @@ let TcConst (cenv: cenv) (overallTy: TType) m env synConst =
warning(Error(FSComp.SR.tcImplicitMeasureFollowingSlash(), m))
let factor1 = ms1 |> Option.defaultValue (SynMeasure.One Range.Zero)
Measure.Prod(tcMeasure factor1, Measure.Inv (tcMeasure ms2), ms.Range)
- | SynMeasure.Divide(measure1 = ms1; measure2 = ms2; range= m) ->
+ | SynMeasure.Divide(measure1 = ms1; measure2 = ms2) ->
let factor1 = ms1 |> Option.defaultValue (SynMeasure.One Range.Zero)
Measure.Prod(tcMeasure factor1, Measure.Inv (tcMeasure ms2), ms.Range)
| SynMeasure.Seq(mss, _) -> ProdMeasures (List.map tcMeasure mss)
@@ -10686,7 +10686,7 @@ and TcMatchClauses cenv inputTy (resultTy: OverallTy) env tpenv clauses =
resultList,tpEnv
and TcMatchClause cenv inputTy (resultTy: OverallTy) env isFirst tpenv synMatchClause =
- let (SynMatchClause(synPat, synWhenExprOpt, synResultExpr, patm, spTgt, trivia)) = synMatchClause
+ let (SynMatchClause(synPat, synWhenExprOpt, synResultExpr, patm, spTgt, _trivia)) = synMatchClause
let isTrueMatchClause =
if synMatchClause.IsTrueMatchClause then
diff --git a/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs b/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs
index 3c5f136d284..499ed2ca914 100644
--- a/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs
+++ b/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs
@@ -270,7 +270,7 @@ let TcSequenceExpression (cenv: TcFileState) env tpenv comp (overallTy: OverallT
let tclauses, tpenv =
(tpenv, clauses)
- ||> List.mapFold (fun tpenv (SynMatchClause(pat, cond, innerComp, _, sp, trivia) as clause) ->
+ ||> List.mapFold (fun tpenv (SynMatchClause(pat, cond, innerComp, _, sp, _trivia) as clause) ->
let isTrueMatchClause =
if clause.IsTrueMatchClause then
TcTrueMatchClause.Yes
@@ -319,7 +319,7 @@ let TcSequenceExpression (cenv: TcFileState) env tpenv comp (overallTy: OverallT
// Compile the pattern twice, once as a filter with all succeeding targets returning "1", and once as a proper catch block.
let clauses, tpenv =
(tpenv, withList)
- ||> List.mapFold (fun tpenv (SynMatchClause(pat, cond, innerComp, m, sp, trivia) as clause) ->
+ ||> List.mapFold (fun tpenv (SynMatchClause(pat, cond, innerComp, m, sp, _trivia) as clause) ->
let isTrueMatchClause =
if clause.IsTrueMatchClause then
TcTrueMatchClause.Yes
diff --git a/src/Compiler/Checking/TailCallChecks.fs b/src/Compiler/Checking/TailCallChecks.fs
index a7ea9ad802a..eba18dbeb4d 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(op = TOp.IntegerForLoop _) -> checkTailCall insideSubBindingOrTry expr1
+ | _ -> ()
+
+ checkTailCall insideSubBindingOrTry expr2
| _ -> ()
checkTailCall false bodyExpr
diff --git a/src/Compiler/Checking/infos.fs b/src/Compiler/Checking/infos.fs
index 8dcc5dc8ac1..81c777c3685 100644
--- a/src/Compiler/Checking/infos.fs
+++ b/src/Compiler/Checking/infos.fs
@@ -1438,10 +1438,10 @@ type MethInfo =
match retTy with
| Some retTy -> isTyparTy g retTy
| None -> false
- | MethInfoWithModifiedReturnType(_,retTy) -> false
+ | MethInfoWithModifiedReturnType _ -> false
| DefaultStructCtor _ -> false
#if !NO_TYPEPROVIDERS
- | ProvidedMeth(amap, mi, _, m) -> false
+ | ProvidedMeth _ -> false
#endif
/// Get the ParamData objects for the parameters of a MethInfo
diff --git a/src/Compiler/CodeGen/EraseUnions.fs b/src/Compiler/CodeGen/EraseUnions.fs
index e841010c837..3d5e9e4ec91 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)
@@ -1209,7 +1211,6 @@ let convAlternativeDef
let basicCtorFields =
basicFields
|> List.map (fun fdef ->
- let existingAttrs = fdef.CustomAttrs.AsArray()
let nullableAttr = getFieldsNullability g fdef |> Option.toList
fdef.Name, fdef.FieldType, nullableAttr)
@@ -1255,12 +1256,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 791fed38a3d..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)
@@ -5936,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)
@@ -6464,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
=
@@ -6613,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 =
[
@@ -6660,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 =
@@ -6699,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
@@ -6754,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)
@@ -8564,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()
@@ -8742,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)
@@ -9173,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
@@ -10181,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
@@ -10274,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()
@@ -12208,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)
@@ -12228,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)
@@ -12255,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/AssemblyResolveHandler.fsi b/src/Compiler/DependencyManager/AssemblyResolveHandler.fsi
index e1c0b2574e3..354eb07efd6 100644
--- a/src/Compiler/DependencyManager/AssemblyResolveHandler.fsi
+++ b/src/Compiler/DependencyManager/AssemblyResolveHandler.fsi
@@ -12,7 +12,7 @@ type AssemblyResolutionProbe = delegate of Unit -> seq
type AssemblyResolveHandler =
/// Construct a new DependencyProvider
- new: assemblyProbingPaths: AssemblyResolutionProbe|null -> AssemblyResolveHandler
+ new: assemblyProbingPaths: AssemblyResolutionProbe | null -> AssemblyResolveHandler
/// Construct a new DependencyProvider
internal new: assemblyProbingPaths: AssemblyResolutionProbe option -> AssemblyResolveHandler
diff --git a/src/Compiler/DependencyManager/DependencyProvider.fs b/src/Compiler/DependencyManager/DependencyProvider.fs
index 6e641af607b..a94e296d465 100644
--- a/src/Compiler/DependencyManager/DependencyProvider.fs
+++ b/src/Compiler/DependencyManager/DependencyProvider.fs
@@ -123,9 +123,6 @@ type IResolveDependenciesResult =
/// #I @"c:\somepath\to\packages\1.1.1\ResolvedPackage"
abstract Roots: seq
-#if NO_CHECKNULLS
-[]
-#endif
type IDependencyManagerProvider =
abstract Name: string
abstract Key: string
@@ -334,42 +331,36 @@ type ReflectionDependencyManagerProvider
member _.StdOut =
match getInstanceProperty (result.GetType()) "StdOut" with
| None -> [||]
- | Some p -> !! p.GetValue(result) :?> string[]
+ | Some p -> !!p.GetValue(result) :?> string[]
/// The resolution error log (* process stderror *)
member _.StdError =
match getInstanceProperty (result.GetType()) "StdError" with
| None -> [||]
- | Some p -> !! p.GetValue(result) :?> string[]
+ | Some p -> !!p.GetValue(result) :?> string[]
/// The resolution paths
member _.Resolutions =
match getInstanceProperty> (result.GetType()) "Resolutions" with
| None -> Seq.empty
- | Some p -> !! p.GetValue(result) :?> seq
+ | Some p -> !!p.GetValue(result) :?> seq
/// The source code file paths
member _.SourceFiles =
match getInstanceProperty> (result.GetType()) "SourceFiles" with
| None -> Seq.empty
- | Some p -> !! p.GetValue(result) :?> seq
+ | Some p -> !!p.GetValue(result) :?> seq
/// The roots to package directories
member _.Roots =
match getInstanceProperty> (result.GetType()) "Roots" with
| None -> Seq.empty
- | Some p -> !! p.GetValue(result) :?> seq
+ | Some p -> !!p.GetValue(result) :?> seq
}
static member MakeResultFromFields
- (
- success: bool,
- stdOut: string[],
- stdError: string[],
- resolutions: seq,
- sourceFiles: seq,
- roots: seq
- ) =
+ (success: bool, stdOut: string[], stdError: string[], resolutions: seq, sourceFiles: seq, roots: seq)
+ =
{ new IResolveDependenciesResult with
/// Succeeded?
member _.Success = success
@@ -409,16 +400,8 @@ type ReflectionDependencyManagerProvider
/// Resolve the dependencies for the given arguments
member _.ResolveDependencies
- (
- scriptDir,
- mainScriptName,
- scriptName,
- scriptExt,
- packageManagerTextLines,
- tfm,
- rid,
- timeout
- ) : IResolveDependenciesResult =
+ (scriptDir, mainScriptName, scriptName, scriptExt, packageManagerTextLines, tfm, rid, timeout)
+ : IResolveDependenciesResult =
// The ResolveDependencies method, has two signatures, the original signature in the variable resolveDeps and the updated signature resolveDepsEx
// the resolve method can return values in two different tuples:
// (bool * string list * string list * string list)
@@ -564,7 +547,7 @@ type DependencyProvider
new() = new DependencyProvider(None, None, true)
/// Returns a formatted help messages for registered dependencymanagers for the host to present
- member _.GetRegisteredDependencyManagerHelpText(compilerTools, outputDir : string | null, errorReport) =
+ member _.GetRegisteredDependencyManagerHelpText(compilerTools, outputDir: string | null, errorReport) =
[|
let managers =
RegisteredDependencyManagers compilerTools (Option.ofString outputDir) errorReport
@@ -575,7 +558,7 @@ type DependencyProvider
|]
/// Clear the DependencyManager results caches
- member _.ClearResultsCache(compilerTools, outputDir : string | null, errorReport) =
+ member _.ClearResultsCache(compilerTools, outputDir: string | null, errorReport) =
let managers =
RegisteredDependencyManagers compilerTools (Option.ofString outputDir) errorReport
@@ -584,12 +567,8 @@ type DependencyProvider
/// Returns a formatted error message for the host to present
member _.CreatePackageManagerUnknownError
- (
- compilerTools: seq,
- outputDir: string,
- packageManagerKey: string,
- reportError: ResolvingErrorReport
- ) =
+ (compilerTools: seq, outputDir: string, packageManagerKey: string, reportError: ResolvingErrorReport)
+ =
let registeredKeys =
String.Join(
", ",
@@ -602,12 +581,8 @@ type DependencyProvider
/// Fetch a dependencymanager that supports a specific key
member this.TryFindDependencyManagerInPath
- (
- compilerTools: seq,
- outputDir: string,
- reportError: ResolvingErrorReport,
- path: string
- ) : string | null * IDependencyManagerProvider | null =
+ (compilerTools: seq, outputDir: string, reportError: ResolvingErrorReport, path: string)
+ : string | null * IDependencyManagerProvider | null =
try
if path.Contains ":" && not (Path.IsPathRooted path) then
let managers =
@@ -632,12 +607,8 @@ type DependencyProvider
/// Fetch a dependencymanager that supports a specific key
member _.TryFindDependencyManagerByKey
- (
- compilerTools: seq,
- outputDir: string,
- reportError: ResolvingErrorReport,
- key: string
- ) : IDependencyManagerProvider | null =
+ (compilerTools: seq, outputDir: string, reportError: ResolvingErrorReport, key: string)
+ : IDependencyManagerProvider | null =
try
RegisteredDependencyManagers compilerTools (Option.ofString outputDir) reportError
|> Map.tryFind key
diff --git a/src/Compiler/DependencyManager/DependencyProvider.fsi b/src/Compiler/DependencyManager/DependencyProvider.fsi
index aa1bd27d5b7..1fe1c400525 100644
--- a/src/Compiler/DependencyManager/DependencyProvider.fsi
+++ b/src/Compiler/DependencyManager/DependencyProvider.fsi
@@ -39,9 +39,6 @@ type IResolveDependenciesResult =
abstract Roots: seq
/// Wraps access to a DependencyManager implementation
-#if NO_CHECKNULLS
-[]
-#endif
type IDependencyManagerProvider =
/// Name of the dependency manager
@@ -123,7 +120,7 @@ type DependencyProvider =
packageManagerTextLines: (string * string) seq *
reportError: ResolvingErrorReport *
executionTfm: string *
- [] executionRid: string MaybeNull*
+ [] executionRid: string MaybeNull *
[] implicitIncludeDir: string *
[] mainScriptName: string *
[] fileName: string *
@@ -138,4 +135,4 @@ type DependencyProvider =
/// TryFindDependencyManagerInPath - given a #r "key:sometext" go and find a DependencyManager that satisfies the key
member TryFindDependencyManagerInPath:
compilerTools: string seq * outputDir: string * reportError: ResolvingErrorReport * path: string ->
- string | null * IDependencyManagerProvider | null
\ No newline at end of file
+ string | null * IDependencyManagerProvider | null
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/DependencyManager/NativeDllResolveHandler.fsi b/src/Compiler/DependencyManager/NativeDllResolveHandler.fsi
index 9d2961aa94e..e9d623df7bd 100644
--- a/src/Compiler/DependencyManager/NativeDllResolveHandler.fsi
+++ b/src/Compiler/DependencyManager/NativeDllResolveHandler.fsi
@@ -12,7 +12,7 @@ type NativeResolutionProbe = delegate of Unit -> seq
type NativeDllResolveHandler =
/// Construct a new NativeDllResolveHandler
- new: nativeProbingRoots: NativeResolutionProbe|null -> NativeDllResolveHandler
+ new: nativeProbingRoots: NativeResolutionProbe | null -> NativeDllResolveHandler
/// Construct a new NativeDllResolveHandler
internal new: nativeProbingRoots: NativeResolutionProbe option -> NativeDllResolveHandler
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..68813e69a83 100644
--- a/src/Compiler/Driver/CompilerDiagnostics.fs
+++ b/src/Compiler/Driver/CompilerDiagnostics.fs
@@ -678,7 +678,7 @@ type Exception with
showNullnessAnnotations = Some true
}
- let t1, t2, _cxs = NicePrint.minimalStringsOfTwoTypes denv ty1 ty2
+ let t1, _t2, _cxs = NicePrint.minimalStringsOfTwoTypes denv ty1 ty2
os.Append(ConstraintSolverNullnessWarningEquivWithTypesE().Format t1) |> ignore
@@ -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/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs
index ae14ee51157..4ab1ca3d7e4 100644
--- a/src/Compiler/Driver/CompilerImports.fs
+++ b/src/Compiler/Driver/CompilerImports.fs
@@ -94,20 +94,22 @@ let GetSignatureDataResourceName (r: ILResource) =
failwith "unreachable"
let GetResourceNameAndSignatureDataFuncs (resources: ILResource list) =
- [ for r in resources do
- if IsSignatureDataResource r then
- let readerA, ccuName = GetSignatureDataResourceName r
-
- let readerB =
- resources |> List.tryPick (fun rB ->
- if IsSignatureDataResourceB rB then
- let readerB, ccuNameB = GetSignatureDataResourceName rB
- if ccuName = ccuNameB then
- Some readerB
- else None
- else None)
+ [
+ for r in resources do
+ if IsSignatureDataResource r then
+ let readerA, ccuName = GetSignatureDataResourceName r
+
+ let readerB =
+ resources
+ |> List.tryPick (fun rB ->
+ if IsSignatureDataResourceB rB then
+ let readerB, ccuNameB = GetSignatureDataResourceName rB
+ if ccuName = ccuNameB then Some readerB else None
+ else
+ None)
- ccuName, (readerA, readerB) ]
+ ccuName, (readerA, readerB)
+ ]
let GetOptimizationDataResourceName (r: ILResource) =
if r.Name.StartsWithOrdinal FSharpOptimizationDataResourceName then
@@ -124,19 +126,22 @@ let GetOptimizationDataResourceName (r: ILResource) =
failwith $"GetOptimizationDataResourceName - {r.Name}"
let GetResourceNameAndOptimizationDataFuncs (resources: ILResource list) =
- [ for r in resources do
- if IsOptimizationDataResource r then
- let readerA, ccuName = GetOptimizationDataResourceName r
-
- let readerB =
- resources |> List.tryPick (fun rB ->
- if IsOptimizationDataResourceB rB then
- let readerB, ccuNameB = GetOptimizationDataResourceName rB
- if ccuName = ccuNameB then
- Some readerB
- else None
- else None)
- ccuName, (readerA, readerB) ]
+ [
+ for r in resources do
+ if IsOptimizationDataResource r then
+ let readerA, ccuName = GetOptimizationDataResourceName r
+
+ let readerB =
+ resources
+ |> List.tryPick (fun rB ->
+ if IsOptimizationDataResourceB rB then
+ let readerB, ccuNameB = GetOptimizationDataResourceName rB
+ if ccuName = ccuNameB then Some readerB else None
+ else
+ None)
+
+ ccuName, (readerA, readerB)
+ ]
let IsReflectedDefinitionsResource (r: ILResource) =
r.Name.StartsWithOrdinal(QuotationPickler.SerializedReflectedDefinitionsResourceNameBase)
@@ -163,7 +168,7 @@ let PickleToResource inMem file (g: TcGlobals) compress scope rName rNameB p x =
let byteStorage = ByteStorage.FromByteArray(bytes)
let byteStorageB =
- if inMem then
+ if inMem then
ByteStorage.FromMemoryAndCopy(bytesB.AsMemory(), useBackingMemoryMappedFile = true)
else
ByteStorage.FromByteArray(bytesB.AsMemory().ToArray())
@@ -478,27 +483,28 @@ let isHashRReference (r: range) =
&& not (equals r rangeCmdArgs)
&& FileSystem.IsPathRootedShim r.FileName
-let IsNetModule (fileName:string) =
+let IsNetModule (fileName: string) =
let ext = Path.GetExtension fileName
String.Compare(ext, ".netmodule", StringComparison.OrdinalIgnoreCase) = 0
-let IsDLL (fileName:string) =
+let IsDLL (fileName: string) =
let ext = Path.GetExtension fileName
String.Compare(ext, ".dll", StringComparison.OrdinalIgnoreCase) = 0
-let IsExe (fileName:string) =
+let IsExe (fileName: string) =
let ext = Path.GetExtension fileName
String.Compare(ext, ".exe", StringComparison.OrdinalIgnoreCase) = 0
-let addConstraintSources(ia: ImportedAssembly) =
+let addConstraintSources (ia: ImportedAssembly) =
let contents = ia.FSharpViewOfMetadata.Contents
+
let addCxsToMember name (v: Val) =
for typar in fst v.GeneralizedType do
for cx in typar.Constraints do
match cx with
- | TyparConstraint.MayResolveMember(TTrait(source=source), _) ->
- source.Value <- Some name
+ | TyparConstraint.MayResolveMember(TTrait(source = source), _) -> source.Value <- Some name
| _ -> ()
+
let rec addCxsToModule name (m: ModuleOrNamespaceType) =
for e in m.ModuleAndNamespaceDefinitions do
if e.IsModuleOrNamespace then
@@ -506,8 +512,12 @@ let addConstraintSources(ia: ImportedAssembly) =
if String.length name > 0 then name + "." + e.DisplayName
elif e.IsModule then e.DisplayName
else ""
+
addCxsToModule mname e.ModuleOrNamespaceType
- for memb in m.AllValsAndMembers do addCxsToMember (name + "." + memb.LogicalName) memb
+
+ for memb in m.AllValsAndMembers do
+ addCxsToMember (name + "." + memb.LogicalName) memb
+
addCxsToModule "" contents.ModuleOrNamespaceType
type TcConfig with
@@ -541,7 +551,7 @@ type TcConfig with
yield! tcConfig.GetSearchPathsForLibraryFiles()
if isHashRReference m then
- !! Path.GetDirectoryName(m.FileName)
+ !!Path.GetDirectoryName(m.FileName)
}
let resolved = TryResolveFileUsingPaths(searchPaths, m, nm)
@@ -629,12 +639,8 @@ type TcConfig with
//
// NOTE!! if mode=ReportErrors then this method must not raise exceptions. It must just report the errors and recover
static member TryResolveLibsUsingMSBuildRules
- (
- tcConfig: TcConfig,
- originalReferences: AssemblyReference list,
- errorAndWarningRange: range,
- mode: ResolveAssemblyReferenceMode
- ) : AssemblyResolution list * UnresolvedAssemblyReference list =
+ (tcConfig: TcConfig, originalReferences: AssemblyReference list, errorAndWarningRange: range, mode: ResolveAssemblyReferenceMode)
+ : AssemblyResolution list * UnresolvedAssemblyReference list =
use _ = UseBuildPhase BuildPhase.Parameter
@@ -798,11 +804,8 @@ type TcAssemblyResolutions(tcConfig: TcConfig, results: AssemblyResolution list,
originalReferenceToResolution.TryFind nm
static member ResolveAssemblyReferences
- (
- tcConfig: TcConfig,
- assemblyList: AssemblyReference list,
- knownUnresolved: UnresolvedAssemblyReference list
- ) : TcAssemblyResolutions =
+ (tcConfig: TcConfig, assemblyList: AssemblyReference list, knownUnresolved: UnresolvedAssemblyReference list)
+ : TcAssemblyResolutions =
let resolved, unresolved =
if tcConfig.useSimpleResolution then
let resolutions =
@@ -899,7 +902,7 @@ type TcAssemblyResolutions(tcConfig: TcConfig, results: AssemblyResolution list,
let addedText =
"\nIf you want to debug this right now, attach a debugger, and put a breakpoint in 'CompileOps.fs' near the text '!itFailed', and you can re-step through the assembly resolution logic."
- for UnresolvedAssemblyReference (referenceText, _ranges) in unresolved do
+ for UnresolvedAssemblyReference(referenceText, _ranges) in unresolved do
if referenceText.Contains("mscorlib") then
Debug.Assert(false, sprintf "whoops, did not resolve mscorlib: '%s'%s" referenceText addedText)
itFailed <- true
@@ -989,7 +992,7 @@ type RawFSharpAssemblyDataBackedByFileOnDisk(ilModule: ILModuleDef, ilAssemblyRe
let sigDataReaders =
if sigDataReaders.IsEmpty && List.contains ilShortAssemName externalSigAndOptData then
- let sigFileName = !! Path.ChangeExtension(fileName, "sigdata")
+ let sigFileName = !!Path.ChangeExtension(fileName, "sigdata")
if not (FileSystem.FileExistsShim sigFileName) then
error (Error(FSComp.SR.buildExpectedSigdataFile (FileSystem.GetFullPathShim sigFileName), m))
@@ -1014,7 +1017,7 @@ type RawFSharpAssemblyDataBackedByFileOnDisk(ilModule: ILModuleDef, ilAssemblyRe
// Look for optimization data in a file
let optDataReaders =
if optDataReaders.IsEmpty && List.contains ilShortAssemName externalSigAndOptData then
- let optDataFile = !! Path.ChangeExtension(fileName, "optdata")
+ let optDataFile = !!Path.ChangeExtension(fileName, "optdata")
if not (FileSystem.FileExistsShim optDataFile) then
error (
@@ -1097,11 +1100,7 @@ type RawFSharpAssemblyData(ilModule: ILModuleDef, ilAssemblyRefs) =
[]
type TcImportsSafeDisposal
- (
- tciLock: TcImportsLock,
- disposeActions: ResizeArray unit>,
- disposeTypeProviderActions: ResizeArray unit>
- ) =
+ (tciLock: TcImportsLock, disposeActions: ResizeArray unit>, disposeTypeProviderActions: ResizeArray unit>) =
let mutable isDisposed = false
@@ -1194,7 +1193,7 @@ type TcImportsWeakFacade(tciLock: TcImportsLock, tcImportsWeak: WeakReference
match tcImports.Base with
- | Some (baseTcImports: TcImports) -> Some baseTcImports.Weak
+ | Some(baseTcImports: TcImports) -> Some baseTcImports.Weak
| _ -> None
| _ -> None
@@ -1218,11 +1217,11 @@ and [] TcImports
initialResolutions: TcAssemblyResolutions,
importsBase: TcImports option,
dependencyProviderOpt: DependencyProvider option
- )
+ )
#if !NO_TYPEPROVIDERS
as this
#endif
- =
+ =
let tciLock = TcImportsLock()
@@ -1298,7 +1297,7 @@ and [] TcImports
if publicOnly then
match e.TypeReprInfo with
| TILObjectRepr data ->
- let (TILObjectReprData (_, _, tyDef)) = data
+ let (TILObjectReprData(_, _, tyDef)) = data
tyDef.Access = ILTypeDefAccess.Public
| _ -> false
else
@@ -1433,14 +1432,14 @@ and [] TcImports
CheckDisposed()
match tcImports.FindCcuInfo(ctok, m, assemblyName, lookupOnly) with
- | ResolvedImportedAssembly (importedAssembly, _) -> ResolvedCcu(importedAssembly.FSharpViewOfMetadata)
- | UnresolvedImportedAssembly (assemblyName, _) -> UnresolvedCcu assemblyName
+ | ResolvedImportedAssembly(importedAssembly, _) -> ResolvedCcu(importedAssembly.FSharpViewOfMetadata)
+ | UnresolvedImportedAssembly(assemblyName, _) -> UnresolvedCcu assemblyName
member tcImports.FindCcuFromAssemblyRef(ctok, m, assemblyRef: ILAssemblyRef) =
CheckDisposed()
match tcImports.FindCcuInfo(ctok, m, assemblyRef.Name, lookupOnly = false) with
- | ResolvedImportedAssembly (importedAssembly, _) -> ResolvedCcu(importedAssembly.FSharpViewOfMetadata)
+ | ResolvedImportedAssembly(importedAssembly, _) -> ResolvedCcu(importedAssembly.FSharpViewOfMetadata)
| UnresolvedImportedAssembly _ -> UnresolvedCcu(assemblyRef.QualifiedName)
member tcImports.TryFindXmlDocumentationInfo(assemblyName: string) =
@@ -1562,7 +1561,7 @@ and [] TcImports
member _.RecordGeneratedTypeRoot root =
tciLock.AcquireLock(fun tcitok ->
// checking if given ProviderGeneratedType was already recorded before (probably for another set of static parameters)
- let (ProviderGeneratedType (_, ilTyRef, _)) = root
+ let (ProviderGeneratedType(_, ilTyRef, _)) = root
let index =
RequireTcImportsLock(tcitok, generatedTypeRoots)
@@ -1810,7 +1809,7 @@ and [] TcImports
| TNoRepr -> TProvidedNamespaceRepr(typeProviderEnvironment, [ provider ])
// Add to the existing list of extensions
- | TProvidedNamespaceRepr (resolutionFolder, prior) as repr ->
+ | TProvidedNamespaceRepr(resolutionFolder, prior) as repr ->
if not (prior |> List.exists (fun r -> Tainted.EqTainted r provider)) then
TProvidedNamespaceRepr(resolutionFolder, provider :: prior)
else
@@ -1860,7 +1859,7 @@ and [] TcImports
|> Option.get
// MSDN: this method causes the file to be opened and closed, but the assembly is not added to this domain
let name = AssemblyName.GetAssemblyName(resolution.resolvedPath)
- !! name.Version
+ !!name.Version
// Note, this only captures systemRuntimeContainsTypeRef (which captures tcImportsWeak, using name tcImports)
let systemRuntimeContainsType =
@@ -1869,8 +1868,7 @@ and [] TcImports
// The name of this captured value must not change, see comments on TcImportsWeakFacade above
assert (nameof (tcImports) = "tcImports")
- let mutable systemRuntimeContainsTypeRef =
- tcImports.SystemRuntimeContainsType
+ let mutable systemRuntimeContainsTypeRef = tcImports.SystemRuntimeContainsType
// When the tcImports is disposed the systemRuntimeContainsTypeRef thunk is replaced
// with one raising an exception.
@@ -1961,7 +1959,7 @@ and [] TcImports
match providers with
| [] ->
- let typeName = !! typeof.FullName
+ let typeName = !!typeof.FullName
warning (Error(FSComp.SR.etHostingAssemblyFoundWithoutHosts (fileNameOfRuntimeAssembly, typeName), m))
| _ ->
@@ -2122,7 +2120,7 @@ and [] TcImports
let minfo: PickledCcuInfo = data.RawData
let mspec = minfo.mspec
-
+
if mspec.DisplayName = "FSharp.Core" then
updateSeqTypeIsPrefix mspec
@@ -2167,7 +2165,7 @@ and [] TcImports
InterruptibleLazy(fun _ ->
match Map.tryFind ccuName optDatas with
| None -> None
- | Some (readerA, readerB) ->
+ | Some(readerA, readerB) ->
let data =
GetOptimizationData(fileName, ilScopeRef, ilModule.TryGetILModuleDef(), readerA, readerB)
@@ -2182,8 +2180,8 @@ and [] TcImports
if ccuThunk.IsUnresolvedReference then
ccuThunks.Add(ccuThunk, (fun () -> fixupThunk () |> ignore)))
- Some(fixupThunk ())
- )
+ Some(fixupThunk ()))
+
let ccuinfo =
{
FSharpViewOfMetadata = ccu
@@ -2250,10 +2248,8 @@ and [] TcImports
// NOTE: When used in the Language Service this can cause the transitive checking of projects. Hence it must be cancellable.
member tcImports.TryRegisterAndPrepareToImportReferencedDll
- (
- ctok,
- r: AssemblyResolution
- ) : Async<(_ * (unit -> AvailableImportedAssembly list)) option> =
+ (ctok, r: AssemblyResolution)
+ : Async<(_ * (unit -> AvailableImportedAssembly list)) option> =
async {
CheckDisposed()
let m = r.originalReference.Range
@@ -2349,9 +2345,11 @@ and [] TcImports
let _dllinfos, phase2s = results |> Array.choose id |> List.ofArray |> List.unzip
fixupOrphanCcus ()
let ccuinfos = List.collect (fun phase2 -> phase2 ()) phase2s
+
if importsBase.IsSome then
importsBase.Value.CcuTable.Values |> Seq.iter addConstraintSources
ccuTable.Values |> Seq.iter addConstraintSources
+
return ccuinfos
}
@@ -2374,7 +2372,7 @@ and [] TcImports
)
match foundFile with
- | OkResult (warns, res) ->
+ | OkResult(warns, res) ->
ReportWarnings warns
tcImports.RegisterAndImportReferencedAssemblies(ctok, res)
@@ -2382,7 +2380,7 @@ and [] TcImports
|> ignore
true
- | ErrorResult (_warns, _err) ->
+ | ErrorResult(_warns, _err) ->
// Throw away warnings and errors - this is speculative loading
false
@@ -2418,11 +2416,8 @@ and [] TcImports
|> Option.map (fun r -> r.resolvedPath))
member _.TryResolveAssemblyReference
- (
- ctok,
- assemblyReference: AssemblyReference,
- mode: ResolveAssemblyReferenceMode
- ) : OperationResult =
+ (ctok, assemblyReference: AssemblyReference, mode: ResolveAssemblyReferenceMode)
+ : OperationResult =
tciLock.AcquireLock(fun tcitok ->
let tcConfig = tcConfigP.Get ctok
@@ -2462,8 +2457,7 @@ and [] TcImports
| [], [] ->
// Note, if mode=ResolveAssemblyReferenceMode.Speculative and the resolution failed then TryResolveLibsUsingMSBuildRules returns
// the empty list and we convert the failure into an AssemblyNotResolved here.
- ErrorD(AssemblyNotResolved(assemblyReference.Text, assemblyReference.Range))
- )
+ ErrorD(AssemblyNotResolved(assemblyReference.Text, assemblyReference.Range)))
member tcImports.ResolveAssemblyReference(ctok, assemblyReference, mode) : AssemblyResolution list =
CommitOperationResult(tcImports.TryResolveAssemblyReference(ctok, assemblyReference, mode))
@@ -2507,7 +2501,7 @@ and [] TcImports
let primaryScopeRef =
match primaryAssem with
- | [ ResolvedImportedAssembly (ccu, _) ] -> ccu.FSharpViewOfMetadata.ILScopeRef
+ | [ ResolvedImportedAssembly(ccu, _) ] -> ccu.FSharpViewOfMetadata.ILScopeRef
| _ -> failwith "primaryScopeRef - unexpected"
let resolvedAssemblies = tcResolutions.GetAssemblyResolutions()
@@ -2568,7 +2562,7 @@ and [] TcImports
match resolvedAssemblyRef with
| Some coreLibraryResolution ->
match! frameworkTcImports.RegisterAndImportReferencedAssemblies(ctok, [ coreLibraryResolution ]) with
- | [ ResolvedImportedAssembly (fslibCcuInfo, _) ] ->
+ | [ ResolvedImportedAssembly(fslibCcuInfo, _) ] ->
return fslibCcuInfo.FSharpViewOfMetadata, fslibCcuInfo.ILScopeRef
| _ ->
return
@@ -2633,17 +2627,12 @@ and [] TcImports
knownUnresolved
|> List.map (function
- | UnresolvedAssemblyReference (file, originalReferences) -> file, originalReferences)
+ | UnresolvedAssemblyReference(file, originalReferences) -> file, originalReferences)
|> List.iter reportAssemblyNotResolved
static member BuildNonFrameworkTcImports
- (
- tcConfigP: TcConfigProvider,
- baseTcImports,
- nonFrameworkReferences,
- knownUnresolved,
- dependencyProvider
- ) =
+ (tcConfigP: TcConfigProvider, baseTcImports, nonFrameworkReferences, knownUnresolved, dependencyProvider)
+ =
async {
let ctok = CompilationThreadToken()
@@ -2700,8 +2689,8 @@ let RequireReferences (ctok, tcImports: TcImports, tcEnv, thisAssemblyName, reso
let asms =
ccuinfos
|> List.map (function
- | ResolvedImportedAssembly (asm, m) -> asm, m
- | UnresolvedImportedAssembly (assemblyName, m) -> error (Error(FSComp.SR.buildCouldNotResolveAssembly (assemblyName), m)))
+ | ResolvedImportedAssembly(asm, m) -> asm, m
+ | UnresolvedImportedAssembly(assemblyName, m) -> error (Error(FSComp.SR.buildCouldNotResolveAssembly (assemblyName), m)))
let g = tcImports.GetTcGlobals()
let amap = tcImports.GetImportMap()
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/FSharp.Compiler.Service.fsproj b/src/Compiler/FSharp.Compiler.Service.fsproj
index 59c316483af..30d3d918fde 100644
--- a/src/Compiler/FSharp.Compiler.Service.fsproj
+++ b/src/Compiler/FSharp.Compiler.Service.fsproj
@@ -10,12 +10,11 @@
$(NoWarn);75
$(NoWarn);1204
$(NoWarn);NU5125
- $(NoWarn);64;1182;1204
- $(OtherFlags) --warnaserror-:1182
+ $(NoWarn);64;1204
FSharp.Compiler.Service
true
$(DefineConstants);COMPILER
- true
+ enable
- $(FSharpNetCoreProductDefaultTargetFramework);$(TargetFrameworks)
+ $(FSharpNetCoreProductTargetFramework);$(TargetFrameworks)
$(DefineConstants);FSHARPCORE_USE_PACKAGE
$(OtherFlags) --extraoptimizationloops:1
-
-
-
- $(OtherFlags) --nowarn:1182
-
$(OtherFlags) --warnon:3218
$(OtherFlags) --warnon:3390
+
+ $(OtherFlags) --nowarn:3261
+
$(OtherFlags) --generate-filter-blocks
true
diff --git a/src/Compiler/Facilities/AsyncMemoize.fs b/src/Compiler/Facilities/AsyncMemoize.fs
index ec2ff8def2a..ac52eaf8607 100644
--- a/src/Compiler/Facilities/AsyncMemoize.fs
+++ b/src/Compiler/Facilities/AsyncMemoize.fs
@@ -21,17 +21,21 @@ type AsyncLazyState<'t> =
/// When cacheException is false, subsequent requests will restart the computation after an exceptional result.
type AsyncLazy<'t> private (initial: AsyncLazyState<'t>, cancelUnawaited: bool, cacheException: bool) =
- let stateUpdateSync = obj()
+ let stateUpdateSync = obj ()
let mutable state = initial
// This should remain the only function that mutates the state.
let withStateUpdate f =
- lock stateUpdateSync <| fun () ->
+ lock stateUpdateSync
+ <| fun () ->
let next, result = f state
state <- next
result
- let updateState f = withStateUpdate <| fun prev -> f prev, ()
- let cancelIfUnawaited cancelUnawaited = function
+ let updateState f =
+ withStateUpdate <| fun prev -> f prev, ()
+
+ let cancelIfUnawaited cancelUnawaited =
+ function
| Running(computation, _, cts, 0) when cancelUnawaited ->
// To keep state updates fast we don't actually wait for the work to cancel.
// This means single execution is not strictly enforced.
@@ -39,7 +43,8 @@ type AsyncLazy<'t> private (initial: AsyncLazyState<'t>, cancelUnawaited: bool,
Initial computation
| state -> state
- let afterRequest = function
+ let afterRequest =
+ function
| Running(c, work, cts, count) -> Running(c, work, cts, count - 1) |> cancelIfUnawaited cancelUnawaited
| state -> state // Nothing more to do if state already transitioned.
@@ -49,37 +54,42 @@ type AsyncLazy<'t> private (initial: AsyncLazyState<'t>, cancelUnawaited: bool,
let! ct = Async.CancellationToken
// Using ContinueWith with a CancellationToken allows detaching from the running 'work' task.
// If the current async workflow is canceled, the 'work' task will continue running independently.
- do! work.ContinueWith(ignore>, ct) |> Async.AwaitTask
- with :? TaskCanceledException -> ()
+ do! work.ContinueWith(ignore>, ct) |> Async.AwaitTask
+ with :? TaskCanceledException ->
+ ()
// If we're here it means there was no cancellation and the 'work' task has completed.
return! work |> Async.AwaitTask
}
let onComplete (t: Task<'t>) =
- updateState <| function
- | Running (computation, _, _, _) ->
- try Completed t.Result with exn -> if cacheException then Faulted exn else Initial computation
+ updateState
+ <| function
+ | Running(computation, _, _, _) ->
+ try
+ Completed t.Result
+ with exn ->
+ if cacheException then Faulted exn else Initial computation
| state -> state
+
t.Result
- let request = function
+ let request =
+ function
| Initial computation ->
let cts = new CancellationTokenSource()
+
let work =
- Async.StartAsTask(computation, cancellationToken = cts.Token)
+ Async
+ .StartAsTask(computation, cancellationToken = cts.Token)
.ContinueWith(onComplete, TaskContinuationOptions.NotOnCanceled)
- Running (computation, work, cts, 1),
- detachable work
- | Running (c, work, cts, count) ->
- Running (c, work, cts, count + 1),
- detachable work
- | Completed result as state ->
- state, async { return result }
- | Faulted exn as state ->
- state, async { return raise exn }
+
+ Running(computation, work, cts, 1), detachable work
+ | Running(c, work, cts, count) -> Running(c, work, cts, count + 1), detachable work
+ | Completed result as state -> state, async { return result }
+ | Faulted exn as state -> state, async { return raise exn }
// computation will deallocate after state transition to Completed ot Faulted.
- new (computation, ?cancelUnawaited: bool, ?cacheException) =
+ new(computation, ?cancelUnawaited: bool, ?cacheException) =
AsyncLazy(Initial computation, defaultArg cancelUnawaited true, defaultArg cacheException true)
member _.Request() =
@@ -104,7 +114,7 @@ module internal Utils =
/// Return file name with one directory above it
let shortPath (path: string) =
- let dirPath = Path.GetDirectoryName(path) |> Option.ofObj |> Option.defaultValue ""
+ let dirPath = !!Path.GetDirectoryName(path)
let dir =
dirPath.Split Path.DirectorySeparatorChar
@@ -126,7 +136,21 @@ type internal JobEvent =
| Strengthened
| Failed
| Cleared
- static member AllEvents = [Requested; Started; Restarted; Finished; Canceled; Evicted; Collected; Weakened; Strengthened; Failed; Cleared]
+
+ static member AllEvents =
+ [
+ Requested
+ Started
+ Restarted
+ Finished
+ Canceled
+ Evicted
+ Collected
+ Weakened
+ Strengthened
+ Failed
+ Cleared
+ ]
type internal ICacheKey<'TKey, 'TVersion> =
// TODO Key should probably be renamed to Identifier
@@ -155,20 +179,22 @@ type private KeyData<'TKey, 'TVersion> =
type Job<'t> = AsyncLazy * CapturingDiagnosticsLogger>
[]
-type internal AsyncMemoize<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'TVersion: equality and 'TKey:not null and 'TVersion:not null>
+type internal AsyncMemoize<'TKey, 'TVersion, 'TValue
+ when 'TKey: equality and 'TVersion: equality and 'TKey: not null and 'TVersion: not null>
(?keepStrongly, ?keepWeakly, ?name: string, ?cancelUnawaitedJobs: bool, ?cancelDuplicateRunningJobs: bool) =
- let name = defaultArg name "N/A"
+ let _name = defaultArg name "N/A"
let cancelUnawaitedJobs = defaultArg cancelUnawaitedJobs true
let cancelDuplicateRunningJobs = defaultArg cancelDuplicateRunningJobs false
let event = Event<_>()
- let eventCounts = [for j in JobEvent.AllEvents -> j, ref 0] |> dict
+ let eventCounts = [ for j in JobEvent.AllEvents -> j, ref 0 ] |> dict
let mutable hits = 0
let mutable duration = 0L
- let keyTuple (keyData: KeyData<_, _>) = keyData.Label, keyData.Key, keyData.Version
+ let keyTuple (keyData: KeyData<_, _>) =
+ keyData.Label, keyData.Key, keyData.Version
let logK (eventType: JobEvent) key =
Interlocked.Increment(eventCounts[eventType]) |> ignore
@@ -186,7 +212,8 @@ type internal AsyncMemoize<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'T
| CacheEvent.Collected -> logK JobEvent.Collected
| CacheEvent.Weakened -> logK JobEvent.Weakened
| CacheEvent.Strengthened -> logK JobEvent.Strengthened
- | CacheEvent.Cleared -> logK JobEvent.Cleared))
+ | CacheEvent.Cleared -> logK JobEvent.Cleared)
+ )
member _.Get(key: ICacheKey<_, _>, computation) =
let key =
@@ -197,36 +224,42 @@ type internal AsyncMemoize<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'T
}
let wrappedComputation =
- Async.TryCancelled( async {
- let sw = Stopwatch.StartNew()
- log Started key
- let logger = CapturingDiagnosticsLogger "cache"
- SetThreadDiagnosticsLoggerNoUnwind logger
-
- match! computation |> Async.Catch with
- | Choice1Of2 result ->
- log Finished key
- Interlocked.Add(&duration, sw.ElapsedMilliseconds) |> ignore
- return Result.Ok result, logger
- | Choice2Of2 exn ->
- log Failed key
- return Result.Error exn, logger
- }, fun _ -> log Canceled key)
+ Async.TryCancelled(
+ async {
+ let sw = Stopwatch.StartNew()
+ log Started key
+ let logger = CapturingDiagnosticsLogger "cache"
+ SetThreadDiagnosticsLoggerNoUnwind logger
+
+ match! computation |> Async.Catch with
+ | Choice1Of2 result ->
+ log Finished key
+ Interlocked.Add(&duration, sw.ElapsedMilliseconds) |> ignore
+ return Result.Ok result, logger
+ | Choice2Of2 exn ->
+ log Failed key
+ return Result.Error exn, logger
+ },
+ fun _ -> log Canceled key
+ )
let getOrAdd () =
let cached, otherVersions = cache.GetAll(key.Key, key.Version)
- let countHit v = Interlocked.Increment &hits |> ignore; v
+ let countHit v =
+ Interlocked.Increment &hits |> ignore
+ v
+
let cacheSetNewJob () =
- let job = Job(wrappedComputation, cancelUnawaited = cancelUnawaitedJobs, cacheException = false)
+ let job =
+ Job(wrappedComputation, cancelUnawaited = cancelUnawaitedJobs, cacheException = false)
+
cache.Set(key.Key, key.Version, key.Label, job)
job
otherVersions,
- cached
- |> Option.map countHit
- |> Option.defaultWith cacheSetNewJob
+ cached |> Option.map countHit |> Option.defaultWith cacheSetNewJob
async {
let otherVersions, job = lock cache getOrAdd
@@ -240,15 +273,15 @@ type internal AsyncMemoize<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'T
let! result, logger = job.Request()
logger.CommitDelayedDiagnostics DiagnosticsThreadStatics.DiagnosticsLogger
+
match result with
- | Ok result ->
- return result
- | Error exn ->
- return raise exn
+ | Ok result -> return result
+ | Error exn -> return raise exn
}
member _.TryGet(key: 'TKey, predicate: 'TVersion -> bool) : 'TValue option =
- lock cache <| fun () ->
+ lock cache
+ <| fun () ->
cache.GetAll(key)
|> Seq.tryPick (fun (version, job) ->
match predicate version, job.TryResult with
@@ -257,7 +290,8 @@ type internal AsyncMemoize<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'T
member _.Clear() = lock cache cache.Clear
- member _.Clear predicate = lock cache <| fun () -> cache.Clear predicate
+ member _.Clear predicate =
+ lock cache <| fun () -> cache.Clear predicate
member val Event = event.Publish
@@ -267,26 +301,39 @@ type internal AsyncMemoize<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'T
member this.DebuggerDisplay =
- let cachedJobs = cache.GetValues() |> Seq.map (fun (_,_,job) -> job)
+ let cachedJobs = cache.GetValues() |> Seq.map (fun (_, _, job) -> job)
- let jobStateName = function
- | Initial _ -> nameof Initial
- | Running _ -> nameof Running
- | Completed _ -> nameof Completed
- | Faulted _ -> nameof Faulted
+ let jobStateName =
+ function
+ | Initial _ -> nameof Initial
+ | Running _ -> nameof Running
+ | Completed _ -> nameof Completed
+ | Faulted _ -> nameof Faulted
let valueStats = cachedJobs |> Seq.countBy (_.State >> jobStateName) |> Map
- let getStat key = valueStats.TryFind key |> Option.defaultValue 0
+
+ let getStat key =
+ valueStats.TryFind key |> Option.defaultValue 0
let running =
let count = getStat "Running"
- if count > 0 then $" Running {count}" else ""
+ if count > 0 then $" Running {count}" else ""
let finished = eventCounts[Finished].Value
- let avgDuration = if finished = 0 then "" else $"| Avg: %.0f{float duration / float finished} ms"
+
+ let avgDuration =
+ if finished = 0 then
+ ""
+ else
+ $"| Avg: %.0f{float duration / float finished} ms"
let requests = eventCounts[Requested].Value
- let hitRatio = if requests = 0 then "" else $" (%.0f{float hits / (float (requests)) * 100.0} %%)"
+
+ let hitRatio =
+ if requests = 0 then
+ ""
+ else
+ $" (%.0f{float hits / (float (requests)) * 100.0} %%)"
let faulted = getStat "Faulted"
let failed = eventCounts[Failed].Value
@@ -295,9 +342,11 @@ type internal AsyncMemoize<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'T
seq {
if faulted + failed > 0 then
" (_!_) "
+
for j in eventCounts.Keys do
let count = eventCounts[j].Value
if count > 0 then $"| {j}: {count}" else ""
+
$"| hits: {hits}{hitRatio} "
}
|> String.concat ""
@@ -317,4 +366,4 @@ type internal AsyncMemoizeDisabled<'TKey, 'TVersion, 'TValue when 'TKey: equalit
Interlocked.Increment &requests |> ignore
computation
- member _.DebuggerDisplay = $"(disabled) requests: {requests}"
\ No newline at end of file
+ member _.DebuggerDisplay = $"(disabled) requests: {requests}"
diff --git a/src/Compiler/Facilities/AsyncMemoize.fsi b/src/Compiler/Facilities/AsyncMemoize.fsi
index 6b9ffb4f433..1014dfc6874 100644
--- a/src/Compiler/Facilities/AsyncMemoize.fsi
+++ b/src/Compiler/Facilities/AsyncMemoize.fsi
@@ -42,7 +42,8 @@ type Extensions =
///
/// Strongly holds at most one result per key.
///
-type internal AsyncMemoize<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'TVersion: equality and 'TKey:not null and 'TVersion:not null> =
+type internal AsyncMemoize<'TKey, 'TVersion, 'TValue
+ when 'TKey: equality and 'TVersion: equality and 'TKey: not null and 'TVersion: not null> =
/// Maximum number of strongly held results to keep in the cache
/// Maximum number of weakly held results to keep in the cache
@@ -50,7 +51,11 @@ type internal AsyncMemoize<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'T
/// Cancels a job when all the awaiting requests are canceled. If set to false, unawaited job will run to completion and it's result will be cached.
/// If true, when a job is started, all other jobs with the same key will be canceled.
new:
- ?keepStrongly: int * ?keepWeakly: int * ?name: string * ?cancelUnawaitedJobs: bool * ?cancelDuplicateRunningJobs: bool ->
+ ?keepStrongly: int *
+ ?keepWeakly: int *
+ ?name: string *
+ ?cancelUnawaitedJobs: bool *
+ ?cancelDuplicateRunningJobs: bool ->
AsyncMemoize<'TKey, 'TVersion, 'TValue>
member Clear: unit -> unit
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/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 329fd21c63d..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
@@ -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 8cb27875075..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 + ")"
@@ -2042,15 +2042,8 @@ type internal TypeCheckInfo
/// Get the auto-complete items at a location
member _.GetDeclarations
- (
- parseResultsOpt,
- line,
- lineStr,
- partialName,
- completionContextAtPos,
- getAllEntities,
- genBodyForOverriddenMeth
- ) =
+ (parseResultsOpt, line, lineStr, partialName, completionContextAtPos, getAllEntities, genBodyForOverriddenMeth)
+ =
let isSigFile = SourceFileImpl.IsSignatureFile mainInputFileName
DiagnosticsScope.Protect
@@ -3109,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
@@ -3204,7 +3191,7 @@ module internal ParseAndCheckFile =
ApplyMetaCommandsFromInputToTcConfig(
tcConfig,
parsedMainInput,
- !! Path.GetDirectoryName(mainInputFileName),
+ !!Path.GetDirectoryName(mainInputFileName),
tcImports.DependencyProvider
)
|> ignore
@@ -3255,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
@@ -3383,15 +3370,8 @@ type FSharpCheckFileResults
/// Intellisense autocompletions
member _.GetDeclarationListInfo
- (
- parsedFileResults,
- line,
- lineText,
- partialName,
- ?getAllEntities,
- ?completionContextAtPos,
- ?genBodyForOverriddenMeth
- ) =
+ (parsedFileResults, line, lineText, partialName, ?getAllEntities, ?completionContextAtPos, ?genBodyForOverriddenMeth)
+ =
let getAllEntities = defaultArg getAllEntities (fun () -> [])
let genBodyForOverriddenMeth = defaultArg genBodyForOverriddenMeth true
@@ -3638,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
@@ -4006,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/FSharpProjectSnapshot.fs b/src/Compiler/Service/FSharpProjectSnapshot.fs
index f7d2786d244..91a6efd472a 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
@@ -727,13 +730,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 deda0a607b7..ff112a7977c 100644
--- a/src/Compiler/Service/FSharpWorkspaceState.fs
+++ b/src/Compiler/Service/FSharpWorkspaceState.fs
@@ -150,10 +150,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,
@@ -176,10 +174,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,
@@ -201,9 +197,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) =
@@ -438,7 +430,7 @@ type FSharpWorkspaceProjects internal (depGraph: IThreadSafeDependencyGraph<_, _
Activity.start
"Projects.Update"
[
- Activity.Tags.project, !! projectIdentifier.ToString()
+ Activity.Tags.project, !!projectIdentifier.ToString()
"sourceFiles", newSourceFiles |> String.concat "; "
]
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 374f648947a..f5b15936902 100644
--- a/src/Compiler/Service/ServiceParsedInputOps.fs
+++ b/src/Compiler/Service/ServiceParsedInputOps.fs
@@ -1520,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
diff --git a/src/Compiler/Service/TransparentCompiler.fs b/src/Compiler/Service/TransparentCompiler.fs
index d3f89bbd989..12f864ec54d 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
@@ -1751,11 +1752,8 @@ type internal TransparentCompiler
)
let TryGetRecentCheckResultsForFile
- (
- fileName: string,
- projectSnapshot: FSharpProjectSnapshot,
- userOpName: string
- ) : (FSharpParseFileResults * FSharpCheckFileResults) option =
+ (fileName: string, projectSnapshot: FSharpProjectSnapshot, userOpName: string)
+ : (FSharpParseFileResults * FSharpCheckFileResults) option =
ignore userOpName
let cacheKey =
@@ -1872,7 +1870,7 @@ type internal TransparentCompiler
}
)
- let ComputeAssemblyData (projectSnapshot: ProjectSnapshot) fileName =
+ let ComputeAssemblyData (projectSnapshot: ProjectSnapshot) _fileName =
caches.AssemblyData.Get(
projectSnapshot.SignatureKey,
async {
@@ -1887,11 +1885,11 @@ type internal TransparentCompiler
try
- let availableOnDiskModifiedTime =
- if FileSystem.FileExistsShim fileName then
- Some <| FileSystem.GetLastWriteTimeShim fileName
- else
- None
+ //let availableOnDiskModifiedTime =
+ // if FileSystem.FileExistsShim fileName then
+ // Some <| FileSystem.GetLastWriteTimeShim fileName
+ // else
+ // None
// TODO: This kinda works, but the problem is that in order to switch a project to "in-memory" mode
// - some file needs to be edited (this triggers a re-check, but LastModifiedTimeOnDisk won't change)
@@ -2111,14 +2109,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
@@ -2272,13 +2264,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
@@ -2301,19 +2288,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)
@@ -2323,11 +2304,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)
@@ -2335,12 +2313,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
@@ -2355,6 +2329,7 @@ type internal TransparentCompiler
(
fileName: string,
sourceText: ISourceText,
+ caret: Position option,
previewEnabled: bool option,
loadedTimeStamp: DateTime option,
otherFlags: string array option,
@@ -2372,6 +2347,7 @@ type internal TransparentCompiler
bc.GetProjectSnapshotFromScript(
fileName,
SourceTextNew.ofISourceText sourceText,
+ caret,
DocumentSource.FileSystem,
previewEnabled,
loadedTimeStamp,
@@ -2392,6 +2368,7 @@ type internal TransparentCompiler
(
fileName: string,
sourceText: ISourceTextNew,
+ _caret: Position option,
documentSource: DocumentSource,
previewEnabled: bool option,
loadedTimeStamp: DateTime option,
@@ -2535,11 +2512,8 @@ type internal TransparentCompiler
}
member this.GetSemanticClassificationForFile
- (
- fileName: string,
- options: FSharpProjectOptions,
- userOpName: string
- ) : Async =
+ (fileName: string, options: FSharpProjectOptions, userOpName: string)
+ : Async =
async {
ignore userOpName
@@ -2561,13 +2535,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)
@@ -2596,29 +2565,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/Symbols/SymbolHelpers.fs b/src/Compiler/Symbols/SymbolHelpers.fs
index 1fedee2968a..116e9ba95b7 100644
--- a/src/Compiler/Symbols/SymbolHelpers.fs
+++ b/src/Compiler/Symbols/SymbolHelpers.fs
@@ -406,12 +406,10 @@ module internal SymbolHelpers =
//| _ -> false
member x.Equals(item1, item2) =
-#if !NO_CHECKNULLS
match item1,item2 with
| null,null -> true
| null,_ | _,null -> false
| item1,item2 ->
-#endif
// This may explore assemblies that are not in the reference set.
// In this case just bail out and assume items are not equal
protectAssemblyExploration false (fun () ->
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/LexerStore.fs b/src/Compiler/SyntaxTree/LexerStore.fs
index 711e9530cd9..2914d944c20 100644
--- a/src/Compiler/SyntaxTree/LexerStore.fs
+++ b/src/Compiler/SyntaxTree/LexerStore.fs
@@ -32,8 +32,6 @@ let private tryGetStoreData<'T when 'T: not null> (lexbuf: Lexbuf) key =
| true, data -> Some(data :?> 'T)
| _ -> None
-let private setStoreData (lexbuf: Lexbuf) key data = lexbuf.BufferLocalStore[key] <- data
-
//------------------------------------------------------------------------
// A SynArgNameGenerator for the current file, used by the parser
//------------------------------------------------------------------------
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/SyntaxTreeOps.fs b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs
index ffb9bd65647..6633dab2408 100644
--- a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs
+++ b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs
@@ -1024,9 +1024,9 @@ let parsedHashDirectiveArgumentsNoCheck (input: ParsedHashDirectiveArgument list
(function
| ParsedHashDirectiveArgument.String(s, _, _) -> s
| ParsedHashDirectiveArgument.SourceIdentifier(_, v, _) -> v
- | ParsedHashDirectiveArgument.Int32(n, m) -> string n
- | ParsedHashDirectiveArgument.Ident(ident, m) -> ident.idText
- | ParsedHashDirectiveArgument.LongIdent(ident, m) -> longIdentToString ident)
+ | ParsedHashDirectiveArgument.Int32(n, _) -> string n
+ | ParsedHashDirectiveArgument.Ident(ident, _) -> ident.idText
+ | ParsedHashDirectiveArgument.LongIdent(ident, _) -> longIdentToString ident)
input
let parsedHashDirectiveStringArguments (input: ParsedHashDirectiveArgument list) (_langVersion: LanguageVersion) =
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/QuotationPickler.fs b/src/Compiler/TypedTree/QuotationPickler.fs
index f2a58203ec6..de18b73e5c0 100644
--- a/src/Compiler/TypedTree/QuotationPickler.fs
+++ b/src/Compiler/TypedTree/QuotationPickler.fs
@@ -249,11 +249,7 @@ let PickleBufferCapacity = 100000
module SimplePickle =
- type Table<'T
-#if !NO_CHECKNULLS
- when 'T:not null
-#endif
- > =
+ type Table<'T when 'T:not null> =
{ tbl: HashMultiMap<'T, int> // This should be "Dictionary"
mutable rows: 'T list
mutable count: int }
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/TypeProviders.fs b/src/Compiler/TypedTree/TypeProviders.fs
index 42caa723619..425e31ea453 100644
--- a/src/Compiler/TypedTree/TypeProviders.fs
+++ b/src/Compiler/TypedTree/TypeProviders.fs
@@ -220,13 +220,8 @@ let TryTypeMemberArray (st: Tainted<_>, fullName, memberName, m, f) =
[||]
/// Try to access a member on a provided type, catching and reporting errors and checking the result is non-null,
-#if NO_CHECKNULLS
-let TryTypeMemberNonNull<'T, 'U when 'U : null and 'U : not struct>(st: Tainted<'T>, fullName, memberName, m, recover: 'U, (f: 'T -> 'U)) : Tainted<'U> =
- match TryTypeMember(st, fullName, memberName, m, recover, f) with
-#else
let TryTypeMemberNonNull<'T, 'U when 'U : not null and 'U : not struct>(st: Tainted<'T>, fullName, memberName, m, recover: 'U, (f: 'T -> 'U | null)) : Tainted<'U> =
match TryTypeMember<'T, 'U | null>(st, fullName, memberName, m, withNull recover, f) with
-#endif
| Tainted.Null ->
errorR(Error(FSComp.SR.etUnexpectedNullFromProvidedTypeMember(fullName, memberName), m))
st.PApplyNoFailure(fun _ -> recover)
@@ -339,9 +334,6 @@ type ProvidedTypeContext =
))
[]
-#if NO_CHECKNULLS
-[]
-#endif
type ProvidedType (x: Type, ctxt: ProvidedTypeContext) =
inherit ProvidedMemberInfo(x, ctxt)
@@ -506,9 +498,6 @@ type ProvidedType (x: Type, ctxt: ProvidedTypeContext) =
static member TaintedEquals (pt1: Tainted, pt2: Tainted) =
Tainted.EqTainted (pt1.PApplyNoFailure(fun st -> st.Handle)) (pt2.PApplyNoFailure(fun st -> st.Handle))
-#if NO_CHECKNULLS
-[]
-#endif
type IProvidedCustomAttributeProvider =
abstract GetDefinitionLocationAttribute : provider: ITypeProvider -> (string MaybeNull * int * int) option
@@ -569,9 +558,6 @@ type ProvidedCustomAttributeProvider (attributes :ITypeProvider -> seq Seq.toArray
[]
-#if NO_CHECKNULLS
-[]
-#endif
type ProvidedMemberInfo (x: MemberInfo, ctxt) =
let provide () = ProvidedCustomAttributeProvider (fun _ -> x.CustomAttributes) :> IProvidedCustomAttributeProvider
@@ -594,9 +580,6 @@ type ProvidedMemberInfo (x: MemberInfo, ctxt) =
provide().GetAttributeConstructorArgs (provider, attribName)
[]
-#if NO_CHECKNULLS
-[]
-#endif
type ProvidedParameterInfo (x: ParameterInfo, ctxt) =
let provide () = ProvidedCustomAttributeProvider (fun _ -> x.CustomAttributes) :> IProvidedCustomAttributeProvider
@@ -645,9 +628,6 @@ type ProvidedParameterInfo (x: ParameterInfo, ctxt) =
override _.GetHashCode() = assert false; x.GetHashCode()
[]
-#if NO_CHECKNULLS
-[]
-#endif
type ProvidedAssembly (x: Assembly) =
member _.GetName() = x.GetName()
@@ -665,9 +645,6 @@ type ProvidedAssembly (x: Assembly) =
override _.GetHashCode() = assert false; x.GetHashCode()
[]
-#if NO_CHECKNULLS
-[]
-#endif
type ProvidedMethodBase (x: MethodBase, ctxt) =
inherit ProvidedMemberInfo(x, ctxt)
@@ -762,9 +739,6 @@ type ProvidedMethodBase (x: MethodBase, ctxt) =
[]
-#if NO_CHECKNULLS
-[]
-#endif
type ProvidedFieldInfo (x: FieldInfo, ctxt) =
inherit ProvidedMemberInfo(x, ctxt)
@@ -812,9 +786,6 @@ type ProvidedFieldInfo (x: FieldInfo, ctxt) =
Tainted.EqTainted (pt1.PApplyNoFailure(fun st -> st.Handle)) (pt2.PApplyNoFailure(fun st -> st.Handle))
[]
-#if NO_CHECKNULLS
-[]
-#endif
type ProvidedMethodInfo (x: MethodInfo, ctxt) =
inherit ProvidedMethodBase(x, ctxt)
@@ -841,9 +812,6 @@ type ProvidedMethodInfo (x: MethodInfo, ctxt) =
override _.GetHashCode() = assert false; x.GetHashCode()
[]
-#if NO_CHECKNULLS
-[]
-#endif
type ProvidedPropertyInfo (x: PropertyInfo, ctxt) =
inherit ProvidedMemberInfo(x, ctxt)
@@ -885,9 +853,6 @@ type ProvidedPropertyInfo (x: PropertyInfo, ctxt) =
Tainted.EqTainted (pt1.PApplyNoFailure(fun st -> st.Handle)) (pt2.PApplyNoFailure(fun st -> st.Handle))
[]
-#if NO_CHECKNULLS
-[]
-#endif
type ProvidedEventInfo (x: EventInfo, ctxt) =
inherit ProvidedMemberInfo(x, ctxt)
@@ -923,9 +888,6 @@ type ProvidedEventInfo (x: EventInfo, ctxt) =
Tainted.EqTainted (pt1.PApplyNoFailure(fun st -> st.Handle)) (pt2.PApplyNoFailure(fun st -> st.Handle))
[]
-#if NO_CHECKNULLS
-[]
-#endif
type ProvidedConstructorInfo (x: ConstructorInfo, ctxt) =
inherit ProvidedMethodBase(x, ctxt)
@@ -967,11 +929,8 @@ type ProvidedExprType =
| ProvidedIfThenElseExpr of ProvidedExpr * ProvidedExpr * ProvidedExpr
| ProvidedVarExpr of ProvidedVar
-#if NO_CHECKNULLS
-[]
-#else
+
[]
-#endif
type ProvidedExpr (x: Expr, ctxt) =
member _.Type = x.Type |> ProvidedType.CreateNonNull ctxt
@@ -1043,11 +1002,7 @@ type ProvidedExpr (x: Expr, ctxt) =
override _.GetHashCode() = x.GetHashCode()
-#if NO_CHECKNULLS
-[]
-#else
[]
-#endif
type ProvidedVar (x: Var, ctxt) =
member _.Type = x.Type |> ProvidedType.CreateNonNull ctxt
member _.Name = x.Name
@@ -1097,11 +1052,9 @@ let ValidateExpectedName m expectedPath expectedName (st: Tainted)
if name <> expectedName then
raise (TypeProviderError(FSComp.SR.etProvidedTypeHasUnexpectedName(expectedName, name), st.TypeProviderDesignation, m))
-#if NO_CHECKNULLS
- let namespaceName = TryTypeMember(st, name, "Namespace", m, "", fun st -> st.Namespace) |> unmarshal
-#else
- let namespaceName = TryTypeMember<_, string | null>(st, name, "Namespace", m, "", fun st -> st.Namespace) |> unmarshal // TODO NULLNESS: why is this explicit instantiation needed?
-#endif
+
+ let namespaceName = TryTypeMember(st, name, "Namespace", m, ("":_|null), fun st -> st.Namespace) |> unmarshal
+
let rec declaringTypes (st: Tainted) accu =
match TryTypeMember(st, name, "DeclaringType", m, null, fun st -> st.DeclaringType) with
@@ -1124,11 +1077,7 @@ let ValidateProvidedTypeAfterStaticInstantiation(m, st: Tainted, e
// Do all the calling into st up front with recovery
let fullName, namespaceName, usedMembers =
let name = CheckAndComputeProvidedNameProperty(m, st, (fun st -> st.Name), "Name")
-#if NO_CHECKNULLS
- let namespaceName = TryTypeMember(st, name, "Namespace", m, FSComp.SR.invalidNamespaceForProvidedType(), fun st -> st.Namespace) |> unmarshal
-#else
let namespaceName = TryTypeMember<_, string | null>(st, name, "Namespace", m, FSComp.SR.invalidNamespaceForProvidedType(), fun st -> st.Namespace) |> unmarshal
-#endif
let fullName = TryTypeMemberNonNull(st, name, "FullName", m, FSComp.SR.invalidFullNameForProvidedType(), fun st -> st.FullName) |> unmarshal
ValidateExpectedName m expectedPath expectedName st
// Must be able to call (GetMethods|GetEvents|GetProperties|GetNestedTypes|GetConstructors)(bindingFlags).
@@ -1233,11 +1182,7 @@ let ValidateProvidedTypeDefinition(m, st: Tainted, expectedPath: s
// Validate the Name, Namespace and FullName properties
let name = CheckAndComputeProvidedNameProperty(m, st, (fun st -> st.Name), "Name")
-#if NO_CHECKNULLS
- let _namespaceName = TryTypeMember(st, name, "Namespace", m, FSComp.SR.invalidNamespaceForProvidedType(), fun st -> st.Namespace) |> unmarshal
-#else
let _namespaceName = TryTypeMember<_, string | null>(st, name, "Namespace", m, FSComp.SR.invalidNamespaceForProvidedType(), fun st -> st.Namespace) |> unmarshal
-#endif
let _fullname = TryTypeMemberNonNull(st, name, "FullName", m, FSComp.SR.invalidFullNameForProvidedType(), fun st -> st.FullName) |> unmarshal
ValidateExpectedName m expectedPath expectedName st
diff --git a/src/Compiler/TypedTree/TypeProviders.fsi b/src/Compiler/TypedTree/TypeProviders.fsi
index b8ec2158ea4..c29f091be78 100755
--- a/src/Compiler/TypedTree/TypeProviders.fsi
+++ b/src/Compiler/TypedTree/TypeProviders.fsi
@@ -15,7 +15,7 @@ open FSharp.Compiler.AbstractIL.IL
open FSharp.Compiler.Text
type TypeProviderDesignation = TypeProviderDesignation of string
-type 'a ProvidedArray= ('a[]) MaybeNull
+type 'a ProvidedArray = ('a[]) MaybeNull
/// Raised when a type provider has thrown an exception.
exception ProvidedTypeResolution of range * exn
@@ -92,10 +92,7 @@ type ProvidedTypeContext =
/// Map the TyconRef objects, if any
member RemapTyconRefs: (obj -> obj) -> ProvidedTypeContext
-[]
-#if NO_CHECKNULLS
-[]
-#endif
+[]
type ProvidedType =
inherit ProvidedMemberInfo
@@ -209,9 +206,6 @@ type ProvidedType =
static member TaintedEquals: Tainted * Tainted -> bool
-#if NO_CHECKNULLS
-[]
-#endif
type IProvidedCustomAttributeProvider =
abstract GetHasTypeProviderEditorHideMethodsAttribute: provider: ITypeProvider -> bool
@@ -221,12 +215,9 @@ type IProvidedCustomAttributeProvider =
abstract GetAttributeConstructorArgs:
provider: ITypeProvider * attribName: string -> (obj option list * (string * obj option) list) option
-
-[]
-#if NO_CHECKNULLS
-[]
-#endif
-type ProvidedAssembly =
+
+[]
+type ProvidedAssembly =
member GetName: unit -> System.Reflection.AssemblyName
member FullName: string
@@ -235,23 +226,17 @@ type ProvidedAssembly =
member Handle: System.Reflection.Assembly
-[]
-#if NO_CHECKNULLS
-[]
-#endif
-type ProvidedMemberInfo =
+[]
+type ProvidedMemberInfo =
member Name: string
member DeclaringType: ProvidedType MaybeNull
- interface IProvidedCustomAttributeProvider
+ interface IProvidedCustomAttributeProvider
-[]
-#if NO_CHECKNULLS
-[]
-#endif
-type ProvidedMethodBase =
+[]
+type ProvidedMethodBase =
inherit ProvidedMemberInfo
member IsGenericMethod: bool
@@ -286,11 +271,8 @@ type ProvidedMethodBase =
static member TaintedEquals: Tainted * Tainted -> bool
-[]
-#if NO_CHECKNULLS
-[]
-#endif
-type ProvidedMethodInfo =
+[]
+type ProvidedMethodInfo =
inherit ProvidedMethodBase
@@ -298,11 +280,8 @@ type ProvidedMethodInfo =
member MetadataToken: int
-[]
-#if NO_CHECKNULLS
-[]
-#endif
-type ProvidedParameterInfo =
+[]
+type ProvidedParameterInfo =
member Name: string
@@ -320,11 +299,8 @@ type ProvidedParameterInfo =
interface IProvidedCustomAttributeProvider
-[]
-#if NO_CHECKNULLS
-[]
-#endif
-type ProvidedFieldInfo =
+[]
+type ProvidedFieldInfo =
inherit ProvidedMemberInfo
@@ -352,11 +328,8 @@ type ProvidedFieldInfo =
static member TaintedEquals: Tainted * Tainted -> bool
-[]
-#if NO_CHECKNULLS
-[]
-#endif
-type ProvidedPropertyInfo =
+[]
+type ProvidedPropertyInfo =
inherit ProvidedMemberInfo
@@ -376,11 +349,8 @@ type ProvidedPropertyInfo =
static member TaintedEquals: Tainted * Tainted -> bool
-[]
-#if NO_CHECKNULLS
-[]
-#endif
-type ProvidedEventInfo =
+[]
+type ProvidedEventInfo =
inherit ProvidedMemberInfo
@@ -394,11 +364,8 @@ type ProvidedEventInfo =
static member TaintedEquals: Tainted * Tainted -> bool
-[]
-#if NO_CHECKNULLS
-[]
-#endif
-type ProvidedConstructorInfo =
+[]
+type ProvidedConstructorInfo =
inherit ProvidedMethodBase
type ProvidedExprType =
@@ -442,11 +409,8 @@ type ProvidedExprType =
| ProvidedIfThenElseExpr of ProvidedExpr * ProvidedExpr * ProvidedExpr
| ProvidedVarExpr of ProvidedVar
-
-[