diff --git a/.fantomasignore b/.fantomasignore
index f5798fbdf00..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,44 +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/Compiler/DependencyManager/NativeDllResolveHandler.fsi
-src/Compiler/DependencyManager/AssemblyResolveHandler.fsi
-
# Fantomas limitations on implementation files (to investigate)
src/Compiler/AbstractIL/ilwrite.fs
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/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/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/ilreflect.fs b/src/Compiler/AbstractIL/ilreflect.fs
index 6151c28b8f0..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
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/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 20e9bec8945..eba18dbeb4d 100644
--- a/src/Compiler/Checking/TailCallChecks.fs
+++ b/src/Compiler/Checking/TailCallChecks.fs
@@ -794,7 +794,7 @@ let CheckModuleBinding cenv (isRec: bool) (TBind _ as bind) =
| Expr.Op(args = exprs) -> exprs |> Seq.iter (checkTailCall insideSubBindingOrTry)
| Expr.Sequential(expr1 = expr1; expr2 = expr2) ->
match expr1 with
- | Expr.Op(args = exprs; op = TOp.IntegerForLoop _) -> checkTailCall insideSubBindingOrTry expr1
+ | Expr.Op(op = TOp.IntegerForLoop _) -> checkTailCall insideSubBindingOrTry expr1
| _ -> ()
checkTailCall insideSubBindingOrTry expr2
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 18eaed4be6f..3d5e9e4ec91 100644
--- a/src/Compiler/CodeGen/EraseUnions.fs
+++ b/src/Compiler/CodeGen/EraseUnions.fs
@@ -1211,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)
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.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/CompilerDiagnostics.fs b/src/Compiler/Driver/CompilerDiagnostics.fs
index 9eb56d1cc54..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
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/FSharp.Compiler.Service.fsproj b/src/Compiler/FSharp.Compiler.Service.fsproj
index ca08c3f63d9..74e59954e8f 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
-
- $(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 991c8359312..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)
+ 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,38 +224,44 @@ 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 {
+ async {
let otherVersions, job = lock cache getOrAdd
log Requested key
@@ -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/Service/TransparentCompiler.fs b/src/Compiler/Service/TransparentCompiler.fs
index 39560cb3b6b..4385ca4f1e3 100644
--- a/src/Compiler/Service/TransparentCompiler.fs
+++ b/src/Compiler/Service/TransparentCompiler.fs
@@ -2355,7 +2355,7 @@ type internal TransparentCompiler
(
fileName: string,
sourceText: ISourceTextNew,
- caret: Position option,
+ _caret: Position option,
documentSource: DocumentSource,
previewEnabled: bool option,
loadedTimeStamp: DateTime option,
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/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/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/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/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
-
-[]
-#if NO_CHECKNULLS
-[]
-#endif
+
+[]
type ProvidedExpr =
member Type: ProvidedType
@@ -456,10 +420,7 @@ type ProvidedExpr =
member GetExprType: unit -> ProvidedExprType option
-[]
-#if NO_CHECKNULLS
-[]
-#endif
+[]
type ProvidedVar =
member Type: ProvidedType
@@ -481,7 +442,10 @@ val ValidateProvidedTypeAfterStaticInstantiation:
/// to check the type name is as expected (this function is called by the caller of TryApplyProvidedType
/// after other checks are made).
val TryApplyProvidedType:
- typeBeforeArguments: Tainted * optGeneratedTypePath: string list option * staticArgs: objnull[] * range ->
+ typeBeforeArguments: Tainted *
+ optGeneratedTypePath: string list option *
+ staticArgs: objnull[] *
+ range ->
(Tainted * (unit -> unit)) option
/// Try to apply a provided method to the given static arguments.
diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs
index e5e330759dc..21c9783713e 100644
--- a/src/Compiler/TypedTree/TypedTreeOps.fs
+++ b/src/Compiler/TypedTree/TypedTreeOps.fs
@@ -39,17 +39,11 @@ let RemapExprStackGuardDepth = GetEnvInteger "FSHARP_RemapExpr" 50
let FoldExprStackGuardDepth = GetEnvInteger "FSHARP_FoldExpr" 50
let inline compareBy (x: 'T MaybeNull) (y: 'T MaybeNull) ([]func: 'T -> 'K) =
-#if NO_CHECKNULLS
- compare (func x) (func y)
-#else
match x,y with
| null,null -> 0
| null,_ -> -1
| _,null -> 1
| x,y -> compare (func !!x) (func !!y)
-#endif
-
-
//---------------------------------------------------------------------------
// Basic data structures
@@ -3576,12 +3570,7 @@ let TryFindLocalizedFSharpStringAttribute g nm attrs =
match TryFindFSharpAttribute g nm attrs with
| Some(Attrib(_, _, [ AttribStringArg b ], namedArgs, _, _, _)) ->
match namedArgs with
- | ExtractAttribNamedArg "Localize" (AttribBoolArg true) ->
- #if PROTO || BUILDING_WITH_LKG
- Some b
- #else
- FSComp.SR.GetTextOpt(b)
- #endif
+ | ExtractAttribNamedArg "Localize" (AttribBoolArg true) -> FSComp.SR.GetTextOpt(b)
| _ -> Some b
| _ -> None
@@ -9252,7 +9241,7 @@ let GetDisallowedNullness (g:TcGlobals) (ty:TType) =
| None -> []
| Some t -> hasWithNullAnyWhere t withNull
- | TType_app (tcr, tinst, nullnessOrig) ->
+ | TType_app (tcr, tinst, _) ->
let tyArgs = tinst |> List.collect (fun t -> hasWithNullAnyWhere t false)
match alreadyWrappedInOuterWithNull, tcr.TypeAbbrev with
@@ -9271,7 +9260,7 @@ let GetDisallowedNullness (g:TcGlobals) (ty:TType) =
let inner = tupTypes |> List.collect (fun t -> hasWithNullAnyWhere t false)
if alreadyWrappedInOuterWithNull then ty :: inner else inner
- | TType_anon (anon,tys) ->
+ | TType_anon (tys=tys) ->
let inner = tys |> List.collect (fun t -> hasWithNullAnyWhere t false)
if alreadyWrappedInOuterWithNull then ty :: inner else inner
| TType_fun (d, r, _) ->
diff --git a/src/Compiler/TypedTree/tainted.fs b/src/Compiler/TypedTree/tainted.fs
index 76a0ba131e4..8b3561aaaa3 100644
--- a/src/Compiler/TypedTree/tainted.fs
+++ b/src/Compiler/TypedTree/tainted.fs
@@ -171,13 +171,8 @@ type internal Tainted<'T> (context: TaintedContext, value: 'T) =
module internal Tainted =
-#if NO_CHECKNULLS
- let (|Null|NonNull|) (p:Tainted<'T>) : Choice> when 'T : null and 'T : not struct =
- if p.PUntaintNoFailure isNull then Null else NonNull (p.PApplyNoFailure id)
-#else
let (|Null|NonNull|) (p:Tainted<'T | null>) : Choice> when 'T : not null and 'T : not struct =
if p.PUntaintNoFailure isNull then Null else NonNull (p.PApplyNoFailure nonNull)
-#endif
let Eq (p:Tainted<'T>) (v:'T) = p.PUntaintNoFailure (fun pv -> pv = v)
diff --git a/src/Compiler/TypedTree/tainted.fsi b/src/Compiler/TypedTree/tainted.fsi
index d066eefd3b2..b75c8c43a5b 100644
--- a/src/Compiler/TypedTree/tainted.fsi
+++ b/src/Compiler/TypedTree/tainted.fsi
@@ -81,7 +81,7 @@ type internal Tainted<'T> =
member PApplyArray: ('T -> 'U[] MaybeNull) * string * range: range -> Tainted<'U>[]
/// Apply an operation that returns an array. Filter the array. Unwrap array. Any exception will be attributed to the type provider with an error located at the given range. String is method name of thing-returning-array, to diagnostically attribute if it is null
- member PApplyFilteredArray: ('T -> 'U[] MaybeNull) * ('U -> bool) *string * range: range -> Tainted<'U>[]
+ member PApplyFilteredArray: ('T -> 'U[] MaybeNull) * ('U -> bool) * string * range: range -> Tainted<'U>[]
/// Apply an operation that returns an option. Unwrap option. Any exception will be attributed to the type provider with an error located at the given range
member PApplyOption: ('T -> 'U option) * range: range -> Tainted<'U> option
@@ -104,11 +104,7 @@ type internal Tainted<'T> =
module internal Tainted =
/// Test whether the tainted value is null
-#if NO_CHECKNULLS
- val (|Null|NonNull|) : Tainted<'T MaybeNull> -> Choice> when 'T : null and 'T : not struct
-#else
- val (|Null|NonNull|) : Tainted<'T MaybeNull> -> Choice> when 'T : not null and 'T : not struct
-#endif
+ val (|Null|NonNull|): Tainted<'T MaybeNull> -> Choice> when 'T: not null and 'T: not struct
/// Test whether the tainted value equals given value.
/// Failure in call to equality operation will be blamed on type provider of first operand
diff --git a/src/Compiler/Utilities/Activity.fs b/src/Compiler/Utilities/Activity.fs
index 2d204864f69..121b52cf07f 100644
--- a/src/Compiler/Utilities/Activity.fs
+++ b/src/Compiler/Utilities/Activity.fs
@@ -9,7 +9,6 @@ open System.Text
open Internal.Utilities.Library
open System.Collections.Generic
-
module ActivityNames =
[]
let FscSourceName = "fsc"
@@ -90,18 +89,18 @@ module internal Activity =
let private activitySource = new ActivitySource(ActivityNames.FscSourceName)
- let start (name: string) (tags: (string * string) seq) : IDisposable MaybeNull =
+ let start (name: string) (tags: (string * string) seq) : ActivityDisposable =
let activity = activitySource.CreateActivity(name, ActivityKind.Internal)
match activity with
- | null -> activity
+ | null -> activity
| activity ->
for key, value in tags do
activity.AddTag(key, value) |> ignore
activity.Start()
- let startNoTags (name: string) : IDisposable MaybeNull = activitySource.StartActivity name
+ let startNoTags (name: string) : ActivityDisposable = activitySource.StartActivity name
let addEventWithTags name (tags: (string * objnull) seq) =
match Activity.Current with
@@ -128,7 +127,7 @@ module internal Activity =
let private profiledSource = new ActivitySource(ActivityNames.ProfiledSourceName)
- let startAndMeasureEnvironmentStats (name: string) : IDisposable MaybeNull = profiledSource.StartActivity(name)
+ let startAndMeasureEnvironmentStats (name: string) : ActivityDisposable = profiledSource.StartActivity(name)
type private GCStats = int[]
@@ -210,7 +209,11 @@ module internal Activity =
match o with
| null -> ""
| o ->
- let mutable txtVal = match o.ToString() with | null -> "" | s -> s
+ let mutable txtVal =
+ match o.ToString() with
+ | null -> ""
+ | s -> s
+
let hasComma = txtVal.IndexOf(',') > -1
let hasQuote = txtVal.IndexOf('"') > -1
@@ -243,7 +246,7 @@ module internal Activity =
sb.ToString()
- let addCsvFileListener (pathToFile:string) =
+ let addCsvFileListener (pathToFile: string) =
if pathToFile |> File.Exists |> not then
File.WriteAllLines(
pathToFile,
@@ -265,7 +268,7 @@ module internal Activity =
let l =
new ActivityListener(
- ShouldListenTo = (fun a ->ActivityNames.AllRelevantNames |> Array.contains a.Name),
+ ShouldListenTo = (fun a -> ActivityNames.AllRelevantNames |> Array.contains a.Name),
Sample = (fun _ -> ActivitySamplingResult.AllData),
ActivityStopped = (fun a -> msgQueue.Post(createCsvRow a))
)
diff --git a/src/Compiler/Utilities/Activity.fsi b/src/Compiler/Utilities/Activity.fsi
index 041b2998765..773c7528869 100644
--- a/src/Compiler/Utilities/Activity.fsi
+++ b/src/Compiler/Utilities/Activity.fsi
@@ -40,16 +40,16 @@ module internal Activity =
module Events =
val cacheHit: string
- val startNoTags: name: string -> IDisposable MaybeNull
+ val startNoTags: name: string -> ActivityDisposable
- val start: name: string -> tags: (string * string) seq -> IDisposable MaybeNull
+ val start: name: string -> tags: (string * string) seq -> ActivityDisposable
val addEvent: name: string -> unit
val addEventWithTags: name: string -> tags: (string * objnull) seq -> unit
module Profiling =
- val startAndMeasureEnvironmentStats: name: string -> IDisposable MaybeNull
+ val startAndMeasureEnvironmentStats: name: string -> ActivityDisposable
val addConsoleListener: unit -> IDisposable
module CsvExport =
diff --git a/src/Compiler/Utilities/Cancellable.fsi b/src/Compiler/Utilities/Cancellable.fsi
index e74404c7eec..0d82faa68cb 100644
--- a/src/Compiler/Utilities/Cancellable.fsi
+++ b/src/Compiler/Utilities/Cancellable.fsi
@@ -68,12 +68,9 @@ type internal CancellableBuilder =
comp: Cancellable<'T> * [] handler: (exn -> Cancellable<'T>) -> Cancellable<'T>
member inline Using:
- resource: 'Resource MaybeNull * [] comp: ('Resource MaybeNull -> Cancellable<'T>) -> Cancellable<'T>
- when 'Resource :> IDisposable
- and 'Resource:not struct
-#if !(NO_CHECKNULLS || BUILDING_WITH_LKG)
- and 'Resource:not null
-#endif
+ resource: 'Resource MaybeNull * [] comp: ('Resource MaybeNull -> Cancellable<'T>) ->
+ Cancellable<'T>
+ when 'Resource :> IDisposable and 'Resource: not struct and 'Resource: not null
member inline Zero: unit -> Cancellable
diff --git a/src/Compiler/Utilities/HashMultiMap.fs b/src/Compiler/Utilities/HashMultiMap.fs
index c0fc897121d..2688869136e 100644
--- a/src/Compiler/Utilities/HashMultiMap.fs
+++ b/src/Compiler/Utilities/HashMultiMap.fs
@@ -8,11 +8,7 @@ open System.Collections.Concurrent
// Each entry in the HashMultiMap dictionary has at least one entry. Under normal usage each entry has _only_
// one entry. So use two hash tables: one for the main entries and one for the overflow.
[]
-type internal HashMultiMap<'Key, 'Value
-#if !NO_CHECKNULLS
- when 'Key:not null
-#endif
- >(size: int, comparer: IEqualityComparer<'Key>, ?useConcurrentDictionary: bool) =
+type internal HashMultiMap<'Key, 'Value when 'Key: not null>(size: int, comparer: IEqualityComparer<'Key>, ?useConcurrentDictionary: bool) =
let comparer = comparer
diff --git a/src/Compiler/Utilities/HashMultiMap.fsi b/src/Compiler/Utilities/HashMultiMap.fsi
index 6a4ba2ce119..475f9db558d 100644
--- a/src/Compiler/Utilities/HashMultiMap.fsi
+++ b/src/Compiler/Utilities/HashMultiMap.fsi
@@ -7,11 +7,7 @@ open System.Collections.Generic
/// Hash tables, by default based on F# structural "hash" and (=) functions.
/// The table may map a single key to multiple bindings.
[]
-type internal HashMultiMap<'Key, 'Value
-#if !NO_CHECKNULLS
- when 'Key:not null
-#endif
- > =
+type internal HashMultiMap<'Key, 'Value when 'Key: not null> =
/// Create a new empty mutable HashMultiMap with the given key hash/equality functions.
new: comparer: IEqualityComparer<'Key> * ?useConcurrentDictionary: bool -> HashMultiMap<'Key, 'Value>
@@ -20,7 +16,9 @@ type internal HashMultiMap<'Key, 'Value
new: size: int * comparer: IEqualityComparer<'Key> * ?useConcurrentDictionary: bool -> HashMultiMap<'Key, 'Value>
/// Build a map that contains the bindings of the given IEnumerable.
- new: entries: seq<'Key * 'Value> * comparer: IEqualityComparer<'Key> * ?useConcurrentDictionary: bool -> HashMultiMap<'Key, 'Value>
+ new:
+ entries: seq<'Key * 'Value> * comparer: IEqualityComparer<'Key> * ?useConcurrentDictionary: bool ->
+ HashMultiMap<'Key, 'Value>
/// Make a shallow copy of the collection.
member Copy: unit -> HashMultiMap<'Key, 'Value>
diff --git a/src/Compiler/Utilities/LruCache.fs b/src/Compiler/Utilities/LruCache.fs
index 92f73885eb7..942b9acfc34 100644
--- a/src/Compiler/Utilities/LruCache.fs
+++ b/src/Compiler/Utilities/LruCache.fs
@@ -23,12 +23,8 @@ type internal ValueLink<'T when 'T: not struct> =
| Weak of WeakReference<'T>
[]
-type internal LruCache<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'TVersion: equality and 'TValue: not struct
-#if !NO_CHECKNULLS
- and 'TKey:not null
- and 'TVersion:not null
-#endif
- >
+type internal LruCache<'TKey, 'TVersion, 'TValue
+ when 'TKey: equality and 'TVersion: equality and 'TValue: not struct and 'TKey: not null and 'TVersion: not null>
(keepStrongly, ?keepWeakly, ?requiredToKeep, ?event) =
let keepWeakly = defaultArg keepWeakly 100
@@ -72,7 +68,7 @@ type internal LruCache<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'TVers
let mutable node = weakList.Last
while weakList.Count > keepWeakly && node <> null do
- let notNullNode = !! node
+ let notNullNode = !!node
let previous = notNullNode.Previous
let key, version, label, _ = notNullNode.Value
weakList.Remove notNullNode
@@ -90,7 +86,7 @@ type internal LruCache<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'TVers
let mutable anythingWeakened = false
while strongList.Count > keepStrongly && node <> null do
- let notNullNode = !! node
+ let notNullNode = !!node
let previous = notNullNode.Previous
match notNullNode.Value with
diff --git a/src/Compiler/Utilities/LruCache.fsi b/src/Compiler/Utilities/LruCache.fsi
index 5979304f163..0d6b9c2e750 100644
--- a/src/Compiler/Utilities/LruCache.fsi
+++ b/src/Compiler/Utilities/LruCache.fsi
@@ -12,13 +12,8 @@ type internal CacheEvent =
///
/// It's also versioned, meaning each key can have multiple versions and only the latest one is kept strongly.
/// Older versions are kept weakly and can be collected by GC.
-type internal LruCache<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'TVersion: equality and 'TValue: not struct
-#if !NO_CHECKNULLS
- and 'TKey:not null
- and 'TVersion:not null
-#endif
- > =
-
+type internal LruCache<'TKey, 'TVersion, 'TValue
+ when 'TKey: equality and 'TVersion: equality and 'TValue: not struct 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
/// A predicate that determines if a value should be kept strongly (no matter what)
diff --git a/src/Compiler/Utilities/NullnessShims.fs b/src/Compiler/Utilities/NullnessShims.fs
index ee801610255..848bf650e98 100644
--- a/src/Compiler/Utilities/NullnessShims.fs
+++ b/src/Compiler/Utilities/NullnessShims.fs
@@ -7,44 +7,6 @@ module internal NullnessShims =
let inline isNotNull (x: 'T) = not (isNull x)
-#if NO_CHECKNULLS || BUILDING_WITH_LKG
- type 'T MaybeNull when 'T: not struct = 'T
- type objnull = obj
-
- let inline (^) (a: 'a) ([] b: 'a -> 'b) : 'b =
- match a with
- | null -> Unchecked.defaultof<'b>
- | _ -> b a
-
- let inline (|NonNullQuick|) (x: 'T MaybeNull) =
- match x with
- | null -> raise (NullReferenceException())
- | v -> v
-
- let inline nonNull<'T when 'T:not struct and 'T:null> (x: 'T MaybeNull ) =
- match x with
- | null -> raise (NullReferenceException())
- | v -> v
-
- let inline (|Null|NonNull|) (x: 'T MaybeNull) : Choice =
- match x with
- | null -> Null
- | v -> NonNull v
-
- let inline nullArgCheck paramName (x: 'T MaybeNull) =
- if isNull (box x) then raise (ArgumentNullException(paramName))
- else x
-
- let inline (!!) x = x
-
- let inline defaultIfNull defaultValue arg = match arg with | null -> defaultValue | _ -> arg
-
- let inline nullSafeEquality (x: MaybeNull<'T>) (y: MaybeNull<'T>) ([]nonNullEqualityFunc:'T->'T->bool) =
- match box x, box y with
- | null, null -> true
- | null,_ | _, null -> false
- | _,_ -> nonNullEqualityFunc x y
-#else
type 'T MaybeNull when 'T: not null and 'T: not struct = 'T | null
let inline (^) (a: 'a | null) ([] b: 'a -> 'b) : ('b | null) =
@@ -52,16 +14,20 @@ module internal NullnessShims =
| Null -> null
| NonNull v -> b v
- let inline (!!) (x:'T | null) = Unchecked.nonNull x
+ let inline (!!) (x: 'T | null) = Unchecked.nonNull x
- let inline nullSafeEquality (x: MaybeNull<'T>) (y: MaybeNull<'T>) ([]nonNullEqualityFunc:'T->'T->bool) =
+ let inline nullSafeEquality (x: MaybeNull<'T>) (y: MaybeNull<'T>) ([] nonNullEqualityFunc: 'T -> 'T -> bool) =
match x, y with
| null, null -> true
- | null,_ | _, null -> false
+ | null, _
+ | _, null -> false
| x, y -> nonNullEqualityFunc !!x !!y
-#endif
-
+#if BUILDING_WITH_LKG
+ type ActivityDisposable = System.IDisposable
+#else
+ type ActivityDisposable = System.IDisposable | null
+#endif
#if NET5_0_OR_GREATER
// Argument type for overriding System.Object.Equals(arg)
@@ -71,10 +37,9 @@ module internal NullnessShims =
type objEqualsArg = obj
#endif
-
- []
+ []
let inline (|NonEmptyString|_|) (x: string MaybeNull) =
match x with
| null -> ValueNone
| "" -> ValueNone
- | v -> ValueSome v
\ No newline at end of file
+ | v -> ValueSome v
diff --git a/src/Compiler/Utilities/illib.fs b/src/Compiler/Utilities/illib.fs
index 0f68d92a429..470d7402e07 100644
--- a/src/Compiler/Utilities/illib.fs
+++ b/src/Compiler/Utilities/illib.fs
@@ -17,8 +17,7 @@ type InterruptibleLazy<'T> private (value, valueFactory: unit -> 'T) =
[]
// TODO nullness - this is boxed to obj because of an attribute targets bug fixed in main, but not yet shipped (needs shipped 8.0.400)
- let mutable valueFactory : objnull = valueFactory
-
+ let mutable valueFactory: objnull = valueFactory
let mutable value = value
@@ -104,7 +103,7 @@ module internal PervasiveAutoOpens =
member inline x.EndsWithOrdinalIgnoreCase value =
x.EndsWith(value, StringComparison.OrdinalIgnoreCase)
- member inline x.IndexOfOrdinal (value:string) =
+ member inline x.IndexOfOrdinal(value: string) =
x.IndexOf(value, StringComparison.Ordinal)
member inline x.IndexOfOrdinal(value, startIndex) =
@@ -154,8 +153,8 @@ module internal PervasiveAutoOpens =
type DelayInitArrayMap<'T, 'TDictKey, 'TDictValue>(f: unit -> 'T[]) =
let syncObj = obj ()
- let mutable arrayStore : _ array MaybeNull = null
- let mutable dictStore : _ MaybeNull = null
+ let mutable arrayStore: _ array MaybeNull = null
+ let mutable dictStore: _ MaybeNull = null
let mutable func = f
@@ -206,12 +205,12 @@ module Order =
member _.Compare(x, xx) = compare (p !!x) (p !!xx)
}
- let orderOn (p:'T->'U) (pxOrder: IComparer<'U>) =
+ let orderOn (p: 'T -> 'U) (pxOrder: IComparer<'U>) =
{ new IComparer<'T> with
member _.Compare(x, xx) = pxOrder.Compare(p !!x, p !!xx)
}
- let toFunction (pxOrder: IComparer<'U>) (x:'U) (y:'U) = pxOrder.Compare(x, y)
+ let toFunction (pxOrder: IComparer<'U>) (x: 'U) (y: 'U) = pxOrder.Compare(x, y)
//-------------------------------------------------------------------------
// Library: arrays, lists, options, resizearrays
@@ -242,7 +241,7 @@ module Array =
let order (eltOrder: IComparer<'T>) =
{ new IComparer<'T array> with
member _.Compare(xs, ys) =
- let xs,ys = nullArgCheck "xs" xs, nullArgCheck "ys" ys
+ let xs, ys = nullArgCheck "xs" xs, nullArgCheck "ys" ys
let c = compare xs.Length ys.Length
if c <> 0 then
@@ -412,8 +411,8 @@ module Option =
with _ ->
None
-module internal ValueTuple =
- let inline map1Of2 ([]f) struct(a1, a2) = struct(f a1, a2)
+module internal ValueTuple =
+ let inline map1Of2 ([] f) struct (a1, a2) = struct (f a1, a2)
module List =
@@ -539,7 +538,8 @@ module List =
let order (eltOrder: IComparer<'T>) =
{ new IComparer<'T list> with
member _.Compare(xs, ys) =
- let xs,ys = nullArgCheck "xs" xs, nullArgCheck "ys" ys
+ let xs, ys = nullArgCheck "xs" xs, nullArgCheck "ys" ys
+
let rec loop xs ys =
match xs, ys with
| [], [] -> 0
@@ -642,21 +642,22 @@ module List =
| Some x -> x :: l
| _ -> l
-
[]
- let rec private vMapFoldWithAcc<'T, 'State, 'Result> (mapping: 'State -> 'T -> struct('Result * 'State)) state list acc : struct('Result list * 'State) =
+ let rec private vMapFoldWithAcc<'T, 'State, 'Result>
+ (mapping: 'State -> 'T -> struct ('Result * 'State))
+ state
+ list
+ acc
+ : struct ('Result list * 'State) =
match list with
| [] -> acc, state
- | [h] ->
- mapping state h
- |> ValueTuple.map1Of2 (fun x -> x::acc)
+ | [ h ] -> mapping state h |> ValueTuple.map1Of2 (fun x -> x :: acc)
| h :: t ->
- let struct(mappedHead, stateHead) = mapping state h
+ let struct (mappedHead, stateHead) = mapping state h
vMapFoldWithAcc mapping stateHead t (mappedHead :: acc)
- let vMapFold<'T, 'State, 'Result> (mapping: 'State -> 'T -> struct('Result * 'State)) state list : struct('Result list * 'State) =
- vMapFoldWithAcc mapping state list []
- |> ValueTuple.map1Of2 List.rev
+ let vMapFold<'T, 'State, 'Result> (mapping: 'State -> 'T -> struct ('Result * 'State)) state list : struct ('Result list * 'State) =
+ vMapFoldWithAcc mapping state list [] |> ValueTuple.map1Of2 List.rev
module ResizeArray =
@@ -796,13 +797,11 @@ module String =
elif (!!value).StartsWithOrdinal pattern then Some()
else None
- let (|Contains|_|) (pattern:string) (value:string|null) =
- match value with
+ let (|Contains|_|) (pattern: string) (value: string | null) =
+ match value with
| null -> None
| value when String.IsNullOrWhiteSpace value -> None
- | value ->
- if value.Contains pattern then Some()
- else None
+ | value -> if value.Contains pattern then Some() else None
let getLines (str: string) =
use reader = new StringReader(str)
@@ -854,9 +853,7 @@ module Lazy =
// Single threaded execution and mutual exclusion
/// Represents a permission active at this point in execution
-type ExecutionToken =
- interface
- end
+type ExecutionToken = interface end
/// Represents a token that indicates execution on the compilation thread, i.e.
/// - we have full access to the (partially mutable) TAST and TcImports data structures
@@ -941,11 +938,7 @@ module ResultOrException =
| Exception _err -> f ()
/// Generates unique stamps
-type UniqueStampGenerator<'T when 'T: equality
-#if !NO_CHECKNULLS
- and 'T:not null
-#endif
- >() =
+type UniqueStampGenerator<'T when 'T: equality and 'T: not null>() =
let encodeTable = ConcurrentDictionary<'T, Lazy>(HashIdentity.Structural)
let mutable nItems = -1
@@ -957,11 +950,7 @@ type UniqueStampGenerator<'T when 'T: equality
member _.Table = encodeTable.Keys
/// memoize tables (all entries cached, never collected)
-type MemoizationTable<'T, 'U
-#if !NO_CHECKNULLS
- when 'T:not null
-#endif
- >(compute: 'T -> 'U, keyComparer: IEqualityComparer<'T>, ?canMemoize) =
+type MemoizationTable<'T, 'U when 'T: not null>(compute: 'T -> 'U, keyComparer: IEqualityComparer<'T>, ?canMemoize) =
let table = new ConcurrentDictionary<'T, Lazy<'U>>(keyComparer)
let computeFunc = Func<_, _>(fun key -> lazy (compute key))
@@ -977,11 +966,7 @@ type MemoizationTable<'T, 'U
compute x
/// A thread-safe lookup table which is assigning an auto-increment stamp with each insert
-type internal StampedDictionary<'T, 'U
-#if !NO_CHECKNULLS
- when 'T:not null
-#endif
- >(keyComparer: IEqualityComparer<'T>) =
+type internal StampedDictionary<'T, 'U when 'T: not null>(keyComparer: IEqualityComparer<'T>) =
let table = new ConcurrentDictionary<'T, Lazy>(keyComparer)
let mutable count = -1
@@ -1307,12 +1292,13 @@ module MultiMap =
let initBy f xs : MultiMap<_, _> =
xs |> Seq.groupBy f |> Seq.map (fun (k, v) -> (k, List.ofSeq v)) |> Map.ofSeq
- let ofList (xs: ('a * 'b) list) : MultiMap<'a,'b> =
+ let ofList (xs: ('a * 'b) list) : MultiMap<'a, 'b> =
(Map.empty, xs)
||> List.fold (fun m (k, v) ->
- m |> Map.change k (function
- | None -> Some [v]
- | Some vs -> Some (v :: vs)))
+ m
+ |> Map.change k (function
+ | None -> Some [ v ]
+ | Some vs -> Some(v :: vs)))
|> Map.map (fun _ values -> List.rev values)
type LayeredMap<'Key, 'Value when 'Key: comparison> = Map<'Key, 'Value>
diff --git a/src/Compiler/Utilities/illib.fsi b/src/Compiler/Utilities/illib.fsi
index bd9d330cfe4..e2fba355366 100644
--- a/src/Compiler/Utilities/illib.fsi
+++ b/src/Compiler/Utilities/illib.fsi
@@ -86,18 +86,9 @@ type DelayInitArrayMap<'T, 'TDictKey, 'TDictValue> =
module internal Order =
- val orderBy: p: ('T -> 'U) -> IComparer<'T>
- when 'U: comparison
-#if !NO_CHECKNULLS
- and 'T:not null
- and 'T:not struct
-#endif
+ val orderBy: p: ('T -> 'U) -> IComparer<'T> when 'U: comparison and 'T: not null and 'T: not struct
- val orderOn: p: ('T -> 'U) -> pxOrder: IComparer<'U> -> IComparer<'T>
-#if !NO_CHECKNULLS
- when 'T:not null
- and 'T:not struct
-#endif
+ val orderOn: p: ('T -> 'U) -> pxOrder: IComparer<'U> -> IComparer<'T> when 'T: not null and 'T: not struct
val toFunction: pxOrder: IComparer<'U> -> x: 'U -> y: 'U -> int
@@ -230,7 +221,11 @@ module internal List =
val prependIfSome: x: 'a option -> l: 'a list -> 'a list
- val vMapFold<'T,'State,'Result> : mapping:('State -> 'T -> struct('Result * 'State)) -> state:'State -> list:'T list -> struct('Result list * 'State)
+ val vMapFold<'T, 'State, 'Result> :
+ mapping: ('State -> 'T -> struct ('Result * 'State)) ->
+ state: 'State ->
+ list: 'T list ->
+ struct ('Result list * 'State)
module internal ResizeArray =
@@ -284,7 +279,7 @@ module internal String =
val (|StartsWith|_|): pattern: string -> value: string -> unit option
- val (|Contains|_|): pattern: string -> value: string|null -> unit option
+ val (|Contains|_|): pattern: string -> value: string | null -> unit option
val getLines: str: string -> string[]
@@ -306,9 +301,7 @@ module internal Lazy =
val force: x: Lazy<'T> -> 'T
/// Represents a permission active at this point in execution
-type internal ExecutionToken =
- interface
- end
+type internal ExecutionToken = interface end
/// Represents a token that indicates execution on the compilation thread, i.e.
/// - we have full access to the (partially mutable) TAST and TcImports data structures
@@ -381,11 +374,7 @@ module internal ResultOrException =
val otherwise: f: (unit -> ResultOrException<'a>) -> x: ResultOrException<'a> -> ResultOrException<'a>
/// Generates unique stamps
-type internal UniqueStampGenerator<'T when 'T: equality
-#if !NO_CHECKNULLS
- and 'T:not null
-#endif
- > =
+type internal UniqueStampGenerator<'T when 'T: equality and 'T: not null> =
new: unit -> UniqueStampGenerator<'T>
@@ -394,11 +383,7 @@ type internal UniqueStampGenerator<'T when 'T: equality
member Table: ICollection<'T>
/// Memoize tables (all entries cached, never collected unless whole table is collected)
-type internal MemoizationTable<'T, 'U
-#if !NO_CHECKNULLS
- when 'T:not null
-#endif
- > =
+type internal MemoizationTable<'T, 'U when 'T: not null> =
new:
compute: ('T -> 'U) * keyComparer: IEqualityComparer<'T> * ?canMemoize: ('T -> bool) -> MemoizationTable<'T, 'U>
@@ -406,11 +391,7 @@ type internal MemoizationTable<'T, 'U
member Apply: x: 'T -> 'U
/// A thread-safe lookup table which is assigning an auto-increment stamp with each insert
-type internal StampedDictionary<'T, 'U
-#if !NO_CHECKNULLS
- when 'T:not null
-#endif
- > =
+type internal StampedDictionary<'T, 'U when 'T: not null> =
new: keyComparer: IEqualityComparer<'T> -> StampedDictionary<'T, 'U>
@@ -443,10 +424,10 @@ type internal LazyWithContext<'T, 'ctxt> =
/// Intern tables to save space.
module internal Tables =
- val memoize: f: ('a -> 'b) -> ('a -> 'b)
- when 'a: equality
-#if !NO_CHECKNULLS && NET8_0_OR_GREATER
- and 'a:not null
+#if NET8_0_OR_GREATER
+ val memoize: f: ('a -> 'b) -> ('a -> 'b) when 'a: equality and 'a: not null
+#else
+ val memoize: f: ('a -> 'b) -> ('a -> 'b) when 'a: equality
#endif
/// Interface that defines methods for comparing objects using partial equality relation
@@ -456,11 +437,9 @@ type internal IPartialEqualityComparer<'T> =
/// Interface that defines methods for comparing objects using partial equality relation
module internal IPartialEqualityComparer =
- val On: f: ('a -> 'b) -> c: IPartialEqualityComparer<'b> -> IPartialEqualityComparer<'a>
-#if !NO_CHECKNULLS
- when 'a:not null
- and 'a:not struct
-#endif
+ val On:
+ f: ('a -> 'b) -> c: IPartialEqualityComparer<'b> -> IPartialEqualityComparer<'a>
+ when 'a: not null and 'a: not struct
/// Like Seq.distinctBy but only filters out duplicates for some of the elements
val partialDistinctBy: per: IPartialEqualityComparer<'T> -> seq: 'T list -> 'T list
@@ -574,7 +553,7 @@ module internal MultiMap =
val initBy: f: ('a -> 'b) -> xs: seq<'a> -> MultiMap<'b, 'a> when 'b: comparison
- val ofList: xs: ('a * 'b) list -> MultiMap<'a,'b> when 'a: comparison
+ val ofList: xs: ('a * 'b) list -> MultiMap<'a, 'b> when 'a: comparison
type internal LayeredMap<'Key, 'Value when 'Key: comparison> = Map<'Key, 'Value>
diff --git a/src/Compiler/Utilities/lib.fsi b/src/Compiler/Utilities/lib.fsi
index ea0669bdf4a..1dfd610d55a 100644
--- a/src/Compiler/Utilities/lib.fsi
+++ b/src/Compiler/Utilities/lib.fsi
@@ -263,12 +263,7 @@ type DisposablesTracker =
new: unit -> DisposablesTracker
/// Register some items to dispose
- member Register: i:'a MaybeNull -> unit
- when 'a:>System.IDisposable
-#if !(NO_CHECKNULLS || BUILDING_WITH_LKG)
- and 'a:not null
-#endif
- and 'a:not struct
+ member Register: i: 'a MaybeNull -> unit when 'a :> System.IDisposable and 'a: not struct and 'a: not null
interface System.IDisposable
diff --git a/src/Compiler/Utilities/sformat.fs b/src/Compiler/Utilities/sformat.fs
index f6fc27b1e51..6ba5b68c462 100644
--- a/src/Compiler/Utilities/sformat.fs
+++ b/src/Compiler/Utilities/sformat.fs
@@ -122,13 +122,6 @@ type IEnvironment =
abstract MaxColumns: int
abstract MaxRows: int
-#if NO_CHECKNULLS
-[]
-module NullShim =
- // Shim to match nullness checking library support in preview
- let inline (|Null|NonNull|) (x: 'T) : Choice = match x with null -> Null | v -> NonNull v
-#endif
-
[]
module TaggedText =
let mkTag tag text = TaggedText(tag, text)
@@ -575,6 +568,7 @@ module ReflectUtils =
let GetValueInfo bindingFlags (x: 'a, ty: Type) (* x could be null *) =
let obj = (box x)
+
match obj with
| Null ->
let isNullaryUnion =
@@ -594,8 +588,7 @@ module ReflectUtils =
UnitValue
else
NullValue
- | NonNull obj ->
- GetValueInfoOfObject bindingFlags obj
+ | NonNull obj -> GetValueInfoOfObject bindingFlags obj
module Display =
open ReflectUtils
@@ -1014,6 +1007,7 @@ module Display =
and objL showMode depthLim prec (x: objnull, ty: Type) =
let info = Value.GetValueInfo bindingFlags (x, ty)
+
try
if depthLim <= 0 || exceededPrintSize () then
wordL (tagPunctuation "...")
@@ -1034,9 +1028,11 @@ module Display =
Some(wordL (tagText (x.ToString())))
else
// Try the StructuredFormatDisplayAttribute extensibility attribute
- match ty.GetCustomAttributes (typeof, true) with
- | Null | [| |] -> None
- | NonNull res -> structuredFormatObjectL showMode ty depthLim (res[0] :?> StructuredFormatDisplayAttribute) x
+ match ty.GetCustomAttributes(typeof, true) with
+ | Null
+ | [||] -> None
+ | NonNull res ->
+ structuredFormatObjectL showMode ty depthLim (res[0] :?> StructuredFormatDisplayAttribute) x
#if COMPILER
// This is the PrintIntercepts extensibility point currently revealed by fsi.exe's AddPrinter
@@ -1069,6 +1065,7 @@ module Display =
// Format an object that has a layout specified by StructuredFormatAttribute
and structuredFormatObjectL showMode ty depthLim (attr: StructuredFormatDisplayAttribute) (obj: obj) =
let txt = attr.Value
+
if isNull (box txt) || txt.Length <= 1 then
None
else
diff --git a/src/FSharp.Build/CreateFSharpManifestResourceName.fs b/src/FSharp.Build/CreateFSharpManifestResourceName.fs
index a19c9fada32..c39f7ae3da0 100644
--- a/src/FSharp.Build/CreateFSharpManifestResourceName.fs
+++ b/src/FSharp.Build/CreateFSharpManifestResourceName.fs
@@ -18,7 +18,7 @@ type CreateFSharpManifestResourceName public () =
linkFileName: string,
rootNamespace: string, // may be null
dependentUponFileName: string, // may be null
- binaryStream: Stream // may be null
+ _binaryStream: Stream // may be null
) : string =
// The Visual CSharp and XBuild CSharp toolchains transform resource names like this:
diff --git a/src/FSharp.Build/FSharp.Build.fsproj b/src/FSharp.Build/FSharp.Build.fsproj
index 3c392ef1158..8f2fd4f5951 100644
--- a/src/FSharp.Build/FSharp.Build.fsproj
+++ b/src/FSharp.Build/FSharp.Build.fsproj
@@ -9,11 +9,13 @@
FSharp.Build
$(NoWarn);75
true
- true
+ enable
$(DefineConstants);LOCALIZATION_FSBUILD
$(NoWarn);NU1701;FS0075
+
+ $(OtherFlags) --nowarn:3261
true
- 7.0
+ 9
Debug;Release;Proto
diff --git a/src/FSharp.Build/FSharpCommandLineBuilder.fs b/src/FSharp.Build/FSharpCommandLineBuilder.fs
index 51d7b12f1b7..a708f94fe87 100644
--- a/src/FSharp.Build/FSharpCommandLineBuilder.fs
+++ b/src/FSharp.Build/FSharpCommandLineBuilder.fs
@@ -15,21 +15,10 @@ do ()
// Shim to match nullness checking library support in preview
[]
module Utils =
-#if NO_CHECKNULLS
- /// Match on the nullness of an argument.
- let inline (|Null|NonNull|) (x: 'T) : Choice =
- match x with
- | null -> Null
- | v -> NonNull v
/// Indicates that a type may be null. 'MaybeNull' used internally in the F# compiler as unchecked
/// replacement for 'string?' for example for future FS-1060.
- type MaybeNull<'T when 'T : null> = 'T
-#else
- /// Indicates that a type may be null. 'MaybeNull' used internally in the F# compiler as unchecked
- /// replacement for 'string?' for example for future FS-1060.
- type MaybeNull<'T when 'T : not null and 'T : not struct> = 'T | null
-#endif
+ type MaybeNull<'T when 'T: not null and 'T: not struct> = 'T | null
type FSharpCommandLineBuilder() =
diff --git a/src/FSharp.Build/FSharpEmbedResourceText.fs b/src/FSharp.Build/FSharpEmbedResourceText.fs
index 3e3c79f82ee..1c5ffbfb68b 100644
--- a/src/FSharp.Build/FSharpEmbedResourceText.fs
+++ b/src/FSharp.Build/FSharpEmbedResourceText.fs
@@ -270,6 +270,9 @@ open Microsoft.FSharp.Collections
open Printf
#nowarn ""3262"" // The call to Option.ofObj below is applied in multiple compilation modes for GetString, sometimes the value is typed as a non-nullable string
+#if BUILDING_WITH_LKG
+#nowarn ""3261"" // Nullness warnings can happen due to LKG not having latest fixes
+#endif
"
let StringBoilerPlate fileName =
@@ -319,7 +322,7 @@ open Printf
// PERF: this technique is a bit slow (e.g. in simple cases, like 'sprintf ""%x""')
mkFunctionValue tys (fun inp -> impl rty inp)
- #if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT
+ #if !NULLABLE
static let capture1 (fmt:string) i args ty (go: obj list -> System.Type -> int -> obj) : obj =
#else
static let capture1 (fmt:string) i args ty (go: objnull list -> System.Type -> int -> obj) : obj =
@@ -345,7 +348,7 @@ open Printf
if i >= len || (fmt.[i] = '%' && i+1 >= len) then
let b = new System.Text.StringBuilder()
b.AppendFormat(messageString, [| for x in List.rev args -> x |]) |> ignore
- #if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT
+ #if !NULLABLE
box(b.ToString())
#else
box(b.ToString()) |> Unchecked.nonNull
@@ -444,7 +447,7 @@ open Printf
let lines =
File.ReadAllLines(fileName)
|> Array.mapi (fun i s -> i, s) // keep line numbers
- |> Array.filter (fun (i, s) -> not (s.StartsWith "#")) // filter out comments
+ |> Array.filter (fun (_i, s) -> not (s.StartsWith "#")) // filter out comments
printMessage "Parsing %s" fileName
let stringInfos = lines |> Array.map (fun (i, s) -> ParseLine fileName i s)
@@ -508,7 +511,7 @@ open Printf
printMessage "Generating resource methods for %s" outFileName
// gen each resource method
stringInfos
- |> Seq.iter (fun (lineNum, (optErrNum, ident), str, holes, netFormatString) ->
+ |> Seq.iter (fun (lineNum, (optErrNum, ident), str, holes, _netFormatString) ->
let formalArgs = new System.Text.StringBuilder()
let actualArgs = new System.Text.StringBuilder()
let mutable firstTime = true
@@ -586,7 +589,7 @@ open Printf
fprintfn outSignature " static member RunStartupValidation: unit -> unit"
stringInfos
- |> Seq.iter (fun (lineNum, (optErrNum, ident), str, holes, netFormatString) ->
+ |> Seq.iter (fun (_lineNum, (_optErrNum, ident), _str, _holes, _netFormatString) ->
fprintfn out " ignore(GetString(\"%s\"))" ident)
fprintfn out " ()" // in case there are 0 strings, we need the generated code to parse
@@ -595,7 +598,7 @@ open Printf
xd.LoadXml(xmlBoilerPlateString)
stringInfos
- |> Seq.iter (fun (lineNum, (optErrNum, ident), str, holes, netFormatString) ->
+ |> Seq.iter (fun (_lineNum, (_optErrNum, ident), _str, _holes, netFormatString) ->
let xn = xd.CreateElement("data")
xn.SetAttribute("name", ident) |> ignore
xn.SetAttribute("xml:space", "preserve") |> ignore
diff --git a/src/FSharp.Build/Fsc.fs b/src/FSharp.Build/Fsc.fs
index ccbece545d5..3cce873e722 100644
--- a/src/FSharp.Build/Fsc.fs
+++ b/src/FSharp.Build/Fsc.fs
@@ -69,7 +69,6 @@ type public Fsc() as this =
let mutable tailcalls: bool = true
let mutable targetProfile: string MaybeNull = null
let mutable targetType: string MaybeNull = null
- let mutable toolExe: string = "fsc.exe"
let defaultToolPath =
let locationOfThisDll =
@@ -733,8 +732,6 @@ type public Fsc() as this =
match host with
| null -> base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands)
| _ ->
- let sources = sources |> Array.map (fun i -> i.ItemSpec)
-
let invokeCompiler baseCallDelegate =
try
let ret =
@@ -765,7 +762,7 @@ type public Fsc() as this =
->
fsc.Log.LogError(tie.InnerException.Message, [||])
-1
- | e -> reraise ()
+ | _ -> reraise ()
let baseCallDelegate =
Func(fun () -> fsc.BaseExecuteTool(pathToTool, responseFileCommands, commandLineCommands))
diff --git a/src/FSharp.Build/Fsi.fs b/src/FSharp.Build/Fsi.fs
index a8ad12d1b2c..88a6dbf3adb 100644
--- a/src/FSharp.Build/Fsi.fs
+++ b/src/FSharp.Build/Fsi.fs
@@ -37,15 +37,12 @@ type public Fsi() as this =
let mutable provideCommandLineArgs = false
let mutable references: ITaskItem[] = [||]
let mutable referencePath: string MaybeNull = null
- let mutable resources: ITaskItem[] = [||]
let mutable skipCompilerExecution = false
let mutable sources: ITaskItem[] = [||]
let mutable loadSources: ITaskItem[] = [||]
let mutable useSources: ITaskItem[] = [||]
let mutable tailcalls: bool = true
let mutable targetProfile: string MaybeNull = null
- let mutable targetType: string MaybeNull = null
- let mutable toolExe: string = "fsi.exe"
let mutable toolPath: string =
let locationOfThisDll =
diff --git a/src/FSharp.Build/MapSourceRoots.fs b/src/FSharp.Build/MapSourceRoots.fs
index c2131209dad..8ea92c02197 100644
--- a/src/FSharp.Build/MapSourceRoots.fs
+++ b/src/FSharp.Build/MapSourceRoots.fs
@@ -130,7 +130,7 @@ type MapSourceRoots() =
for root in mappedSourceRoots do
match root.GetMetadata SourceControl with
- | HasValue v when isSourceControlled -> mapNestedRootIfEmpty root
+ | HasValue _ when isSourceControlled -> mapNestedRootIfEmpty root
| NullOrEmpty when not isSourceControlled -> mapNestedRootIfEmpty root
| _ -> ()
diff --git a/src/FSharp.Core/array.fs b/src/FSharp.Core/array.fs
index 27c6d6426b6..ca88e22465d 100644
--- a/src/FSharp.Core/array.fs
+++ b/src/FSharp.Core/array.fs
@@ -836,21 +836,13 @@ module Array =
count
-#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT
- let private createMask<'a>
- (f: 'a -> bool)
- (src: 'a array)
- (maskArrayOut: byref)
- (leftoverMaskOut: byref)
- =
-#else
let private createMask<'a>
(f: 'a -> bool)
(src: array<'a>)
(maskArrayOut: byref | null>)
(leftoverMaskOut: byref)
=
-#endif
+
let maskArrayLength = src.Length / 0x20
// null when there are less than 32 items in src array.
@@ -1040,11 +1032,8 @@ module Array =
dstIdx
-#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT
- let private filterViaMask (maskArray: uint32 array) (leftoverMask: uint32) (count: int) (src: _ array) =
-#else
let private filterViaMask (maskArray: uint32 array | null) (leftoverMask: uint32) (count: int) (src: _ array) =
-#endif
+
let dst = Microsoft.FSharp.Primitives.Basics.Array.zeroCreateUnchecked count
let mutable dstIdx = 0
@@ -2196,14 +2185,20 @@ module Array =
[]
let tryFindIndex predicate (array: _ array) =
let i = tryFindIndexAux predicate array
- if i.HasValue then Some (int (i.GetValueOrDefault()))
- else None
+
+ if i.HasValue then
+ Some(int (i.GetValueOrDefault()))
+ else
+ None
[]
let tryFind predicate (array: _ array) =
let i = tryFindIndexAux predicate array
- if i.HasValue then Some array[int (i.GetValueOrDefault())]
- else None
+
+ if i.HasValue then
+ Some array[int (i.GetValueOrDefault())]
+ else
+ None
[]
let tryPick chooser (array: _ array) =
@@ -2222,8 +2217,10 @@ module Array =
pState.Break())
)
- if pResult.LowestBreakIteration.HasValue then allChosen[int (pResult.LowestBreakIteration.GetValueOrDefault())]
- else None
+ if pResult.LowestBreakIteration.HasValue then
+ allChosen[int (pResult.LowestBreakIteration.GetValueOrDefault())]
+ else
+ None
[]
let choose chooser (array: 'T array) =
diff --git a/src/FSharp.Core/fslib-extra-pervasives.fs b/src/FSharp.Core/fslib-extra-pervasives.fs
index c0b0bc05a04..07a03675937 100644
--- a/src/FSharp.Core/fslib-extra-pervasives.fs
+++ b/src/FSharp.Core/fslib-extra-pervasives.fs
@@ -347,21 +347,15 @@ open Microsoft.FSharp.Quotations
/// Represents the product of two measure expressions when returned as a generic argument of a provided type.
[]
-type MeasureProduct<'Measure1, 'Measure2>() =
- class
- end
+type MeasureProduct<'Measure1, 'Measure2>() = class end
/// Represents the inverse of a measure expressions when returned as a generic argument of a provided type.
[]
-type MeasureInverse<'Measure> =
- class
- end
+type MeasureInverse<'Measure> = class end
/// Represents the '1' measure expression when returned as a generic argument of a provided type.
[]
-type MeasureOne =
- class
- end
+type MeasureOne = class end
[]
type TypeProviderAttribute() =
@@ -473,7 +467,7 @@ type IProvidedNamespace =
abstract GetTypes: unit -> Type array
- abstract ResolveTypeName: typeName: string -> (Type|null)
+ abstract ResolveTypeName: typeName: string -> (Type | null)
type ITypeProvider =
inherit System.IDisposable
diff --git a/src/FSharp.Core/local.fs b/src/FSharp.Core/local.fs
index 206ccf4ee3d..a1c9c2fa644 100644
--- a/src/FSharp.Core/local.fs
+++ b/src/FSharp.Core/local.fs
@@ -1090,11 +1090,8 @@ module internal Array =
if array.Length > 1 then
Array.Sort<_>(array, fastComparerForArraySort())
-#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT
- let stableSortWithKeysAndComparer (cFast:IComparer<'Key>) (c:IComparer<'Key>) (array:'T array) (keys: 'Key array) =
-#else
let stableSortWithKeysAndComparer (cFast:IComparer<'Key> | null) (c:IComparer<'Key>) (array:array<'T>) (keys:array<'Key>) =
-#endif
+
// 'places' is an array or integers storing the permutation performed by the sort
let len = array.Length
let places = zeroCreateUnchecked len
diff --git a/src/FSharp.Core/option.fs b/src/FSharp.Core/option.fs
index 1b29141df64..ea5da774d87 100644
--- a/src/FSharp.Core/option.fs
+++ b/src/FSharp.Core/option.fs
@@ -148,35 +148,21 @@ module Option =
[]
let inline ofNullable (value: System.Nullable<'T>) =
if value.HasValue then
- Some (value.GetValueOrDefault())
+ Some(value.GetValueOrDefault())
else
None
-#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT
[]
- let inline ofObj value =
+ let inline ofObj (value: 'T | null) : 'T option when 'T: not struct and 'T: not null =
match value with
| null -> None
| _ -> Some value
[]
- let inline toObj value =
+ let inline toObj (value: 'T option) : 'T | null when 'T: not struct =
match value with
| None -> null
| Some x -> x
-#else
- []
- let inline ofObj (value: 'T | null) : 'T option when 'T: not struct and 'T : not null =
- match value with
- | null -> None
- | _ -> Some value
-
- []
- let inline toObj (value: 'T option) : 'T | null when 'T: not struct (* and 'T : not null *) =
- match value with
- | None -> null
- | Some x -> x
-#endif
[]
let inline ofValueOption (voption: 'T voption) =
@@ -338,35 +324,21 @@ module ValueOption =
[]
let inline ofNullable (value: System.Nullable<'T>) =
if value.HasValue then
- ValueSome (value.GetValueOrDefault())
+ ValueSome(value.GetValueOrDefault())
else
ValueNone
-#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT
[]
- let inline ofObj value =
- match value with
- | null -> ValueNone
- | _ -> ValueSome value
-
- []
- let inline toObj value =
- match value with
- | ValueNone -> null
- | ValueSome x -> x
-#else
- []
- let inline ofObj (value: 'T | null) : 'T voption when 'T: not struct and 'T : not null =
+ let inline ofObj (value: 'T | null) : 'T voption when 'T: not struct and 'T: not null =
match value with
| null -> ValueNone
| _ -> ValueSome value
[]
- let inline toObj (value : 'T voption) : 'T | null when 'T: not struct (* and 'T : not null *) =
+ let inline toObj (value: 'T voption) : 'T | null when 'T: not struct =
match value with
| ValueNone -> null
| ValueSome x -> x
-#endif
[]
let inline ofOption (option: 'T option) =
diff --git a/src/FSharp.Core/option.fsi b/src/FSharp.Core/option.fsi
index 57adb485cb4..db381aec8ad 100644
--- a/src/FSharp.Core/option.fsi
+++ b/src/FSharp.Core/option.fsi
@@ -440,13 +440,8 @@ module Option =
///
///
[]
-#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT
- val inline ofObj: value: 'T -> 'T option when 'T : null
-#else
- // TODO NULLNESS: assess this change - is it a breaking change?
- []
- val inline ofObj: value: 'T | null -> 'T option when 'T : not null and 'T : not struct
-#endif
+ []
+ val inline ofObj: value: 'T | null -> 'T option when 'T: not null and 'T: not struct
/// Convert an option to a potentially null value.
///
@@ -461,12 +456,7 @@ module Option =
///
///
[]
-#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT
- val inline toObj: value: 'T option -> 'T when 'T : null
-#else
- // TODO NULLNESS: assess this change - is it a breaking change?
- val inline toObj: value: 'T option -> 'T | null when 'T : not struct (* and 'T : not null *)
-#endif
+ val inline toObj: value: 'T option -> 'T | null when 'T: not struct
/// Convert a value option to an option.
///
@@ -929,13 +919,8 @@ module ValueOption =
///
///
[]
-#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT
- val inline ofObj: value: 'T -> 'T voption when 'T : null
-#else
- // TODO NULLNESS: assess this change - is it a breaking change?
- []
- val inline ofObj: value: 'T | null -> 'T voption when 'T : not struct and 'T : not null
-#endif
+ []
+ val inline ofObj: value: 'T | null -> 'T voption when 'T: not struct and 'T: not null
/// Convert an option to a potentially null value.
///
@@ -950,12 +935,7 @@ module ValueOption =
///
///
[]
-#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT
- val inline toObj: value: 'T voption -> 'T when 'T : null
-#else
- // TODO NULLNESS: assess this change - is it a breaking change?
- val inline toObj: value: 'T voption -> 'T | null when 'T : not struct (* and 'T : not null *)
-#endif
+ val inline toObj: value: 'T voption -> 'T | null when 'T: not struct
/// Convert an option to a value option.
///
diff --git a/src/FSharp.Core/prim-types-prelude.fs b/src/FSharp.Core/prim-types-prelude.fs
index 12ed91cfba2..f8797339628 100644
--- a/src/FSharp.Core/prim-types-prelude.fs
+++ b/src/FSharp.Core/prim-types-prelude.fs
@@ -6,11 +6,7 @@ namespace Microsoft.FSharp.Core
// Basic type abbreviations
type obj = System.Object
-#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT
- type objnull = obj
-#else
type objnull = obj | null
-#endif
type exn = System.Exception
type nativeint = System.IntPtr
type unativeint = System.UIntPtr
diff --git a/src/FSharp.Core/prim-types-prelude.fsi b/src/FSharp.Core/prim-types-prelude.fsi
index 8cc0515350d..a32ccdbf105 100644
--- a/src/FSharp.Core/prim-types-prelude.fsi
+++ b/src/FSharp.Core/prim-types-prelude.fsi
@@ -22,11 +22,7 @@ namespace Microsoft.FSharp.Core
/// With the 'nullable reference types' feature, this is an alias to 'obj | null'.
///
/// Basic Types
-#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT
- type objnull = obj
-#else
type objnull = obj | null
-#endif
/// An abbreviation for the CLI type .
///
diff --git a/src/FSharp.Core/prim-types.fs b/src/FSharp.Core/prim-types.fs
index 4f4849eb849..d9a7e41bf55 100644
--- a/src/FSharp.Core/prim-types.fs
+++ b/src/FSharp.Core/prim-types.fs
@@ -739,11 +739,8 @@ namespace Microsoft.FSharp.Core
let inline TypeTestFast<'T>(source: objnull) =
//assert not(TypeInfo<'T>.TypeInfo = TypeNullnessSemantics_NullTrueValue)
notnullPrim(isinstPrim<'T>(source))
-#if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT
+
let Dispose<'T when 'T :> IDisposable >(resource:'T|null) =
-#else
- let Dispose<'T when 'T :> IDisposable >(resource:'T) =
-#endif
match box resource with
| null -> ()
| _ -> resource.Dispose()
@@ -4419,8 +4416,6 @@ namespace Microsoft.FSharp.Core
| null -> false
| _ -> true
-#if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT
-
[]
let inline isNullV (value : Nullable<'T>) = not value.HasValue
@@ -4473,13 +4468,6 @@ namespace Microsoft.FSharp.Core
match value with
| null -> raise (new ArgumentNullException(argumentName))
| _ -> (# "" value : 'T #)
-#else
- []
- let inline (|Null|NonNull|) (value : 'T) : Choice when 'T : null and 'T : not struct =
- match value with
- | null -> Null ()
- | _ -> NonNull (# "" value : 'T #)
-#endif
[]
let inline raise (exn: exn) =
@@ -4573,7 +4561,6 @@ namespace Microsoft.FSharp.Core
[]
let defaultValueArg arg defaultValue = match arg with ValueNone -> defaultValue | ValueSome v -> v
-#if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT
[]
let inline defaultIfNull defaultValue (arg: 'T | null when 'T : not null and 'T : not struct) =
match arg with null -> defaultValue | _ -> (# "" arg : 'T #)
@@ -4581,7 +4568,6 @@ namespace Microsoft.FSharp.Core
[]
let inline defaultIfNullV defaultValue (arg: Nullable<'T>) =
if arg.HasValue then arg.Value else defaultValue
-#endif
[]
let inline (~-) (n: ^T) : ^T =
@@ -5527,24 +5513,12 @@ namespace Microsoft.FSharp.Core
[]
let inline hash x = GenericHash x
- #if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT
-
[]
let inline nonNull (x: 'T | null when 'T : not null and 'T : not struct) : 'T = (# "" x : 'T #)
[]
let inline (|NonNullQuick|) (value : 'T | null when 'T : not null and 'T : not struct) = nonNull value
- #else
-
- []
- let inline nonNull (x: 'T ) : 'T = x
-
- []
- let inline (|NonNullQuick|) (value) = nonNull value
-
- #endif
-
module Checked =
let inline (+) (x: ^T) (y: ^U) : ^V =
diff --git a/src/FSharp.Core/prim-types.fsi b/src/FSharp.Core/prim-types.fsi
index c56fe5375e4..7c2f171a600 100644
--- a/src/FSharp.Core/prim-types.fsi
+++ b/src/FSharp.Core/prim-types.fsi
@@ -1391,11 +1391,8 @@ namespace Microsoft.FSharp.Core
val inline FastGenericComparer<'T> : System.Collections.Generic.IComparer<'T> when 'T: comparison
/// Make an F# comparer object for the given type, where it can be null if System.Collections.Generic.Comparer<'T>.Default
-#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT
- val internal FastGenericComparerCanBeNull<'T> : System.Collections.Generic.IComparer<'T> when 'T : comparison
-#else
val internal FastGenericComparerCanBeNull<'T> : System.Collections.Generic.IComparer<'T> | null when 'T : comparison
-#endif
+
/// Make an F# hash/equality object for the given type
val inline FastGenericEqualityComparer<'T> : System.Collections.Generic.IEqualityComparer<'T> when 'T: equality
@@ -1796,11 +1793,8 @@ namespace Microsoft.FSharp.Core
/// A compiler intrinsic for the efficient compilation of sequence expressions
[]
-#if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT
val Dispose<'T when 'T :> System.IDisposable> : resource: 'T|null -> unit
-#else
- val Dispose<'T when 'T :> System.IDisposable> : resource: 'T -> unit
-#endif
+
/// A compiler intrinsic for checking initialization soundness of recursive bindings
[]
@@ -3206,7 +3200,6 @@ namespace Microsoft.FSharp.Core
///
val inline (<|||): func: ('T1 -> 'T2 -> 'T3 -> 'U) -> arg1: 'T1 * arg2: 'T2 * arg3: 'T3 -> 'U
-#if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT
/// Used to specify a default value for a nullable reference argument in the implementation of a function
/// The default value of the argument.
/// A nullable value representing the argument.
@@ -3220,7 +3213,6 @@ namespace Microsoft.FSharp.Core
/// The argument value. If it is null, the defaultValue is returned.
[]
val inline defaultIfNullV : defaultValue:'T -> arg:Nullable<'T> -> 'T
-#endif
/// Used to specify a default value for an optional argument in the implementation of a function
///
@@ -3519,7 +3511,6 @@ namespace Microsoft.FSharp.Core
[]
val inline isNull: value: 'T -> bool when 'T: null
-#if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT
/// Determines whether the given value is null.
/// The value to check.
/// A choice indicating whether the value is null or not-null.
@@ -3554,13 +3545,6 @@ namespace Microsoft.FSharp.Core
/// True when value is null, false otherwise.
[]
val inline isNullV : value:Nullable<'T> -> bool
-#else
- /// Determines whether the given value is null.
- /// The value to check.
- /// A choice indicating whether the value is null or not-null.
- []
- val inline (|Null|NonNull|) : value: 'T -> Choice when 'T : null and 'T : not struct
-#endif
/// Determines whether the given value is not null.
///
@@ -3570,7 +3554,6 @@ namespace Microsoft.FSharp.Core
[]
val inline internal isNotNull: value:'T -> bool when 'T : null
-#if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT
/// Get the null value for a value type.
/// In a future revision of nullness support this may be unified with 'null'.
/// The null value for a value type.
@@ -3603,7 +3586,6 @@ namespace Microsoft.FSharp.Core
/// System.Nullable wrapper of the input argument.
[]
val inline withNullV : value:'T -> Nullable<'T>
-#endif
/// Throw a exception.
///
@@ -3669,7 +3651,6 @@ namespace Microsoft.FSharp.Core
[]
val inline nullArg: argumentName: string -> 'T
-#if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT
/// Throw a System.ArgumentNullException if the given value is null exception
///
/// The argument name.
@@ -3677,7 +3658,6 @@ namespace Microsoft.FSharp.Core
/// The result value.
[]
val inline nullArgCheck : argumentName:string -> 'T | null -> 'T when 'T : not null and 'T : not struct
-#endif
/// Throw a