From 55d736b7b42e8bae16b9a15ea7755fbcfaed2910 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Thu, 27 Mar 2025 09:30:09 +0100 Subject: [PATCH 1/3] Remove a bunch of files from fantomas ignore (#18407) * Remove a bunch of files from fantomas ignore * see what happens - bunch of IFDEFs related to nullness removed to enable more fantomas * nowarn specific nullness when proto builds f.c.s and fsharpbuild --- .fantomasignore | 51 ----- Directory.Build.props | 2 +- FSharp.Profiles.props | 28 +-- src/Compiler/AbstractIL/il.fs | 144 ++++++++------ src/Compiler/AbstractIL/ilreflect.fs | 2 +- src/Compiler/AbstractIL/ilwrite.fs | 6 +- .../AssemblyResolveHandler.fsi | 2 +- .../DependencyManager/DependencyProvider.fs | 63 ++---- .../DependencyManager/DependencyProvider.fsi | 7 +- .../NativeDllResolveHandler.fsi | 2 +- src/Compiler/Driver/CompilerImports.fs | 181 ++++++++---------- src/Compiler/FSharp.Compiler.Service.fsproj | 5 +- src/Compiler/Facilities/AsyncMemoize.fs | 181 +++++++++++------- src/Compiler/Facilities/AsyncMemoize.fsi | 9 +- src/Compiler/Symbols/SymbolHelpers.fs | 2 - src/Compiler/TypedTree/QuotationPickler.fs | 6 +- src/Compiler/TypedTree/TypeProviders.fs | 63 +----- src/Compiler/TypedTree/TypeProviders.fsi | 94 +++------ src/Compiler/TypedTree/TypedTreeOps.fs | 13 +- src/Compiler/TypedTree/tainted.fs | 5 - src/Compiler/TypedTree/tainted.fsi | 8 +- src/Compiler/Utilities/Activity.fs | 19 +- src/Compiler/Utilities/Activity.fsi | 6 +- src/Compiler/Utilities/Cancellable.fsi | 9 +- src/Compiler/Utilities/HashMultiMap.fs | 6 +- src/Compiler/Utilities/HashMultiMap.fsi | 10 +- src/Compiler/Utilities/LruCache.fs | 12 +- src/Compiler/Utilities/LruCache.fsi | 9 +- src/Compiler/Utilities/NullnessShims.fs | 57 ++---- src/Compiler/Utilities/illib.fs | 80 ++++---- src/Compiler/Utilities/illib.fsi | 61 ++---- src/Compiler/Utilities/lib.fsi | 7 +- src/Compiler/Utilities/sformat.fs | 21 +- src/FSharp.Build/FSharp.Build.fsproj | 6 +- src/FSharp.Build/FSharpCommandLineBuilder.fs | 13 +- src/FSharp.Build/FSharpEmbedResourceText.fs | 7 +- src/FSharp.Core/array.fs | 35 ++-- src/FSharp.Core/fslib-extra-pervasives.fs | 14 +- src/FSharp.Core/local.fs | 5 +- src/FSharp.Core/option.fs | 40 +--- src/FSharp.Core/option.fsi | 32 +--- src/FSharp.Core/prim-types-prelude.fs | 4 - src/FSharp.Core/prim-types-prelude.fsi | 4 - src/FSharp.Core/prim-types.fs | 28 +-- src/FSharp.Core/prim-types.fsi | 32 +--- src/FSharp.Core/resumable.fs | 45 ++--- src/FSharp.Core/tasks.fs | 78 +++----- src/FSharp.Core/tasks.fsi | 2 +- src/fsi/console.fs | 8 +- ...y_FSharp.Compiler.Service_Debug_net9.0.bsl | 4 +- ....Compiler.Service_Debug_netstandard2.0.bsl | 8 +- ...FSharp.Compiler.Service_Release_net9.0.bsl | 2 +- ...ompiler.Service_Release_netstandard2.0.bsl | 8 +- ...erify_FSharp.Core_Debug_netstandard2.0.bsl | 4 +- ...erify_FSharp.Core_Debug_netstandard2.1.bsl | 4 +- ...ify_FSharp.Core_Release_netstandard2.0.bsl | 4 +- ...ify_FSharp.Core_Release_netstandard2.1.bsl | 4 +- 57 files changed, 567 insertions(+), 995 deletions(-) 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..fbb9c8332c7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -62,7 +62,7 @@ since it's a non-arcade and non-sourcebuild scenario --> $(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/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/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/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..75c03890c7d 100644 --- a/src/Compiler/FSharp.Compiler.Service.fsproj +++ b/src/Compiler/FSharp.Compiler.Service.fsproj @@ -15,7 +15,7 @@ FSharp.Compiler.Service true $(DefineConstants);COMPILER - true + enable $(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..a8a4d5b143f 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,7 +179,8 @@ 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" @@ -164,11 +189,12 @@ type internal AsyncMemoize<'TKey, 'TVersion, 'TValue when 'TKey: equality and 'T 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/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/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..33dd6c2757c 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 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/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..d8f4a46eb25 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 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 exception /// @@ -5812,21 +5792,13 @@ namespace Microsoft.FSharp.Core /// The possibly nullable value. /// The same value as in the input. [] - #if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT val inline nonNull : value: 'T | null -> 'T when 'T : not null and 'T : not struct - #else - val inline nonNull : value: 'T -> 'T - #endif /// When used in a pattern forgets 'nullness' of the value without any runtime check. This is an unsafe operation, as null check is being skipped and null value can be returned. /// The value to retype from ('T | null) to 'T . /// The non-null value. [] - #if !BUILDING_WITH_LKG && !NO_NULLCHECKING_LIB_SUPPORT val inline (|NonNullQuick|) : value: 'T | null -> 'T when 'T : not null and 'T : not struct - #else - val inline (|NonNullQuick|) : value: 'T -> 'T - #endif /// A module of comparison and equality operators that are statically resolved, but which are not fully generic and do not make structural comparison. Opening this /// module may make code that relies on structural or generic comparison no longer compile. diff --git a/src/FSharp.Core/resumable.fs b/src/FSharp.Core/resumable.fs index 1488ab220cf..9e24b64bffc 100644 --- a/src/FSharp.Core/resumable.fs +++ b/src/FSharp.Core/resumable.fs @@ -131,11 +131,8 @@ module ResumableCode = /// Note that this requires that the first step has no result. /// This prevents constructs like `task { return 1; return 2; }`. let CombineDynamic - ( - sm: byref>, - code1: ResumableCode<'Data, unit>, - code2: ResumableCode<'Data, 'T> - ) : bool = + (sm: byref>, code1: ResumableCode<'Data, unit>, code2: ResumableCode<'Data, 'T>) + : bool = if code1.Invoke(&sm) then code2.Invoke(&sm) else @@ -170,11 +167,8 @@ module ResumableCode = CombineDynamic(&sm, code1, code2)) let rec WhileDynamic - ( - sm: byref>, - condition: unit -> bool, - body: ResumableCode<'Data, unit> - ) : bool = + (sm: byref>, condition: unit -> bool, body: ResumableCode<'Data, unit>) + : bool = if condition () then if body.Invoke(&sm) then WhileDynamic(&sm, condition, body) @@ -207,10 +201,8 @@ module ResumableCode = /// Builds a step that executes the body while the condition predicate is true. let inline While - ( - [] condition: unit -> bool, - body: ResumableCode<'Data, unit> - ) : ResumableCode<'Data, unit> = + ([] condition: unit -> bool, body: ResumableCode<'Data, unit>) + : ResumableCode<'Data, unit> = ResumableCode<'Data, unit>(fun sm -> if __useResumableCode then //-- RESUMABLE CODE START @@ -252,10 +244,8 @@ module ResumableCode = /// Wraps a step in a try/with. This catches exceptions both in the evaluation of the function /// to retrieve the step, and in the continuation of the step (if any). let inline TryWith - ( - body: ResumableCode<'Data, 'T>, - catch: exn -> ResumableCode<'Data, 'T> - ) : ResumableCode<'Data, 'T> = + (body: ResumableCode<'Data, 'T>, catch: exn -> ResumableCode<'Data, 'T>) + : ResumableCode<'Data, 'T> = ResumableCode<'Data, 'T>(fun sm -> if __useResumableCode then //-- RESUMABLE CODE START @@ -283,11 +273,8 @@ module ResumableCode = TryWithDynamic(&sm, body, catch)) let rec TryFinallyCompensateDynamic - ( - sm: byref>, - mf: ResumptionFunc<'Data>, - savedExn: exn option - ) : bool = + (sm: byref>, mf: ResumptionFunc<'Data>, savedExn: exn option) + : bool = let mutable fin = false fin <- mf.Invoke(&sm) @@ -362,10 +349,8 @@ module ResumableCode = /// Wraps a step in a try/finally. This catches exceptions both in the evaluation of the function /// to retrieve the step, and in the continuation of the step (if any). let inline TryFinallyAsync - ( - body: ResumableCode<'Data, 'T>, - compensation: ResumableCode<'Data, unit> - ) : ResumableCode<'Data, 'T> = + (body: ResumableCode<'Data, 'T>, compensation: ResumableCode<'Data, unit>) + : ResumableCode<'Data, 'T> = ResumableCode<'Data, 'T>(fun sm -> if __useResumableCode then //-- RESUMABLE CODE START @@ -396,10 +381,8 @@ module ResumableCode = TryFinallyAsyncDynamic(&sm, body, compensation)) let inline Using - ( - resource: 'Resource, - body: 'Resource -> ResumableCode<'Data, 'T> - ) : ResumableCode<'Data, 'T> when 'Resource :> IDisposable|null = + (resource: 'Resource, body: 'Resource -> ResumableCode<'Data, 'T>) + : ResumableCode<'Data, 'T> when 'Resource :> IDisposable | null = // A using statement is just a try/finally with the finally block disposing if non-null. TryFinally( ResumableCode<'Data, 'T>(fun sm -> (body resource).Invoke(&sm)), diff --git a/src/FSharp.Core/tasks.fs b/src/FSharp.Core/tasks.fs index dfe7f4ba624..687bae5af85 100644 --- a/src/FSharp.Core/tasks.fs +++ b/src/FSharp.Core/tasks.fs @@ -58,36 +58,28 @@ type TaskBuilderBase() = /// Note that this requires that the first step has no result. /// This prevents constructs like `task { return 1; return 2; }`. member inline _.Combine - ( - task1: TaskCode<'TOverall, unit>, - task2: TaskCode<'TOverall, 'T> - ) : TaskCode<'TOverall, 'T> = + (task1: TaskCode<'TOverall, unit>, task2: TaskCode<'TOverall, 'T>) + : TaskCode<'TOverall, 'T> = ResumableCode.Combine(task1, task2) /// Builds a step that executes the body while the condition predicate is true. member inline _.While - ( - [] condition: unit -> bool, - body: TaskCode<'TOverall, unit> - ) : TaskCode<'TOverall, unit> = + ([] condition: unit -> bool, body: TaskCode<'TOverall, unit>) + : TaskCode<'TOverall, unit> = ResumableCode.While(condition, body) /// Wraps a step in a try/with. This catches exceptions both in the evaluation of the function /// to retrieve the step, and in the continuation of the step (if any). member inline _.TryWith - ( - body: TaskCode<'TOverall, 'T>, - catch: exn -> TaskCode<'TOverall, 'T> - ) : TaskCode<'TOverall, 'T> = + (body: TaskCode<'TOverall, 'T>, catch: exn -> TaskCode<'TOverall, 'T>) + : TaskCode<'TOverall, 'T> = ResumableCode.TryWith(body, catch) /// Wraps a step in a try/finally. This catches exceptions both in the evaluation of the function /// to retrieve the step, and in the continuation of the step (if any). member inline _.TryFinally - ( - body: TaskCode<'TOverall, 'T>, - [] compensation: unit -> unit - ) : TaskCode<'TOverall, 'T> = + (body: TaskCode<'TOverall, 'T>, [] compensation: unit -> unit) + : TaskCode<'TOverall, 'T> = ResumableCode.TryFinally( body, ResumableCode<_, _>(fun _sm -> @@ -100,10 +92,8 @@ type TaskBuilderBase() = #if NETSTANDARD2_1 member inline internal this.TryFinallyAsync - ( - body: TaskCode<'TOverall, 'T>, - compensation: unit -> ValueTask - ) : TaskCode<'TOverall, 'T> = + (body: TaskCode<'TOverall, 'T>, compensation: unit -> ValueTask) + : TaskCode<'TOverall, 'T> = ResumableCode.TryFinallyAsync( body, ResumableCode<_, _>(fun sm -> @@ -138,11 +128,9 @@ type TaskBuilderBase() = false) ) - member inline this.Using<'Resource, 'TOverall, 'T when 'Resource :> IAsyncDisposable|null> - ( - resource: 'Resource, - body: 'Resource -> TaskCode<'TOverall, 'T> - ) : TaskCode<'TOverall, 'T> = + member inline this.Using<'Resource, 'TOverall, 'T when 'Resource :> IAsyncDisposable | null> + (resource: 'Resource, body: 'Resource -> TaskCode<'TOverall, 'T>) + : TaskCode<'TOverall, 'T> = this.TryFinallyAsync( (fun sm -> (body resource).Invoke(&sm)), (fun () -> @@ -310,11 +298,8 @@ module LowPriority = and ^Awaiter :> ICriticalNotifyCompletion and ^Awaiter: (member get_IsCompleted: unit -> bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> - ( - sm: byref<_>, - task: ^TaskLike, - continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>) - ) : bool = + (sm: byref<_>, task: ^TaskLike, continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>)) + : bool = let mutable awaiter = (^TaskLike: (member GetAwaiter: unit -> ^Awaiter) (task)) @@ -337,10 +322,8 @@ module LowPriority = and ^Awaiter :> ICriticalNotifyCompletion and ^Awaiter: (member get_IsCompleted: unit -> bool) and ^Awaiter: (member GetResult: unit -> 'TResult1)> - ( - task: ^TaskLike, - continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>) - ) : TaskCode<'TOverall, 'TResult2> = + (task: ^TaskLike, continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>)) + : TaskCode<'TOverall, 'TResult2> = TaskCode<'TOverall, _>(fun sm -> if __useResumableCode then @@ -382,11 +365,9 @@ module LowPriority = this.Bind(task, this.Return) - member inline _.Using<'Resource, 'TOverall, 'T when 'Resource :> IDisposable|null> - ( - resource: 'Resource, - body: 'Resource -> TaskCode<'TOverall, 'T> - ) = + member inline _.Using<'Resource, 'TOverall, 'T when 'Resource :> IDisposable | null> + (resource: 'Resource, body: 'Resource -> TaskCode<'TOverall, 'T>) + = ResumableCode.Using(resource, body) module HighPriority = @@ -394,11 +375,8 @@ module HighPriority = type TaskBuilderBase with static member BindDynamic - ( - sm: byref<_>, - task: Task<'TResult1>, - continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>) - ) : bool = + (sm: byref<_>, task: Task<'TResult1>, continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>)) + : bool = let mutable awaiter = task.GetAwaiter() let cont = @@ -415,10 +393,8 @@ module HighPriority = false member inline _.Bind - ( - task: Task<'TResult1>, - continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>) - ) : TaskCode<'TOverall, 'TResult2> = + (task: Task<'TResult1>, continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>)) + : TaskCode<'TOverall, 'TResult2> = TaskCode<'TOverall, _>(fun sm -> if __useResumableCode then @@ -455,10 +431,8 @@ module MediumPriority = type TaskBuilderBase with member inline this.Bind - ( - computation: Async<'TResult1>, - continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>) - ) : TaskCode<'TOverall, 'TResult2> = + (computation: Async<'TResult1>, continuation: ('TResult1 -> TaskCode<'TOverall, 'TResult2>)) + : TaskCode<'TOverall, 'TResult2> = this.Bind(Async.StartImmediateAsTask computation, continuation) member inline this.ReturnFrom(computation: Async<'T>) : TaskCode<'T, 'T> = diff --git a/src/FSharp.Core/tasks.fsi b/src/FSharp.Core/tasks.fsi index c626cb4bb7b..e6c801351a1 100644 --- a/src/FSharp.Core/tasks.fsi +++ b/src/FSharp.Core/tasks.fsi @@ -237,7 +237,7 @@ module LowPriority = /// member inline Using: resource: 'Resource * body: ('Resource -> TaskCode<'TOverall, 'T>) -> TaskCode<'TOverall, 'T> - when 'Resource :> IDisposable|null + when 'Resource :> IDisposable | null /// /// Contains medium-priority overloads for the `task` computation expression builder. diff --git a/src/fsi/console.fs b/src/fsi/console.fs index d644180d384..1d495d0cd48 100644 --- a/src/fsi/console.fs +++ b/src/fsi/console.fs @@ -30,14 +30,14 @@ type internal History() = list.Clear() current <- -1 - member _.Add (line: string | null) = - match line with + member _.Add(line: string | null) = + match line with | null | "" -> () | _ -> list.Add(line) - member _.AddLast (line: string | null) = - match line with + member _.AddLast(line: string | null) = + match line with | null | "" -> () | _ -> diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl index 4466d718308..69842b9e059 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl @@ -50,7 +50,7 @@ [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.Syntax.PrettyNaming::.cctor()][offset 0x00001220][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.Syntax.PrettyNaming::.cctor()][offset 0x00001229][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryWriter::writeILMetadataAndCode(bool, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.IL+ILVersionInfo, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.IL+ILGlobals, bool, bool, bool, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, [S.P.CoreLib]System.Collections.Generic.IEnumerable`1, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.IL+ILModuleDef, int32, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2)][offset 0x0000063F][found Boolean] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryWriter+bigness@3406::Invoke(int32)][offset 0x00000007][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryWriter+bigness@3402::Invoke(int32)][offset 0x00000007][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILPdbWriter+PortablePdbGenerator::serializeDocumentName(string)][offset 0x00000090][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILPdbWriter+pushShadowedLocals@959::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000232][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadUntaggedIdx([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.BinaryConstants+TableName, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+ILMetadataReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, int32&)][offset 0x0000000D][found Byte] Unexpected type on the stack. @@ -70,4 +70,4 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.IO.FileSystemUtils::trimQuotes(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.IO.FileSystemUtils::trimQuotes(string)][offset 0x00000014][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.Library.String::lowerCaseFirstChar(string)][offset 0x0000003F][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : Internal.Utilities.Library.Array+loop@276-4::Invoke(int32)][offset 0x00000012][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : Internal.Utilities.Library.Array+loop@275-4::Invoke(int32)][offset 0x00000012][found Byte] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl index d5617f6de03..6e41547cd11 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl @@ -55,7 +55,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+ResponseFile+parseLine@239::Invoke(string)][offset 0x00000031][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1845@1845::Invoke(int32)][offset 0x00000030][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1845@1845::Invoke(int32)][offset 0x00000039][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+line@560-1::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+line@570-1::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x0000062B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x00000634][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.PatternMatchCompilation::isProblematicClause([FSharp.Compiler.Service]FSharp.Compiler.PatternMatchCompilation+MatchClause)][offset 0x00000065][found Byte] Unexpected type on the stack. @@ -70,7 +70,7 @@ [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.Syntax.PrettyNaming::.cctor()][offset 0x00001220][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.Syntax.PrettyNaming::.cctor()][offset 0x00001229][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryWriter::writeILMetadataAndCode(bool, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.IL+ILVersionInfo, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.IL+ILGlobals, bool, bool, bool, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, [S.P.CoreLib]System.Collections.Generic.IEnumerable`1, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.IL+ILModuleDef, int32, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2)][offset 0x0000063F][found Boolean] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryWriter+bigness@3406::Invoke(int32)][offset 0x00000007][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryWriter+bigness@3402::Invoke(int32)][offset 0x00000007][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILPdbWriter+PortablePdbGenerator::serializeDocumentName(string)][offset 0x00000090][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILPdbWriter+pushShadowedLocals@959::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000232][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadUntaggedIdx([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.BinaryConstants+TableName, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+ILMetadataReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, int32&)][offset 0x0000000D][found Byte] Unexpected type on the stack. @@ -79,7 +79,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.NativeRes+VersionHelper::TryParse(string, bool, uint16, bool, [S.P.CoreLib]System.Version&)][offset 0x0000003D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL+parseNamed@5291::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>, int32, int32)][offset 0x00000087][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL+parseNamed@5311::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>, int32, int32)][offset 0x00000087][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.Collections.Utils::shortPath(string)][offset 0x00000015][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment+probePathForDotnetHost@316::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000028][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.SimulatedMSBuildReferenceResolver+Pipe #6 input at line 68@68::FSharp.Compiler.CodeAnalysis.ILegacyReferenceResolver.Resolve([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyResolutionEnvironment, [S.P.CoreLib]System.Tuple`2[], string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>)][offset 0x0000034D][found Char] Unexpected type on the stack. @@ -95,4 +95,4 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.IO.FileSystemUtils::trimQuotes(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.IO.FileSystemUtils::trimQuotes(string)][offset 0x00000014][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.Library.String::lowerCaseFirstChar(string)][offset 0x0000003F][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : Internal.Utilities.Library.Array+loop@276-4::Invoke(int32)][offset 0x00000012][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : Internal.Utilities.Library.Array+loop@275-4::Invoke(int32)][offset 0x00000012][found Byte] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl index 9e78cdedccd..4e7b5396676 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl @@ -96,4 +96,4 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.IO.FileSystemUtils::trimQuotes(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.IO.FileSystemUtils::trimQuotes(string)][offset 0x00000014][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.Library.String::lowerCaseFirstChar(string)][offset 0x0000003A][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : Internal.Utilities.Library.Array::loop@275-3(bool[], int32)][offset 0x00000008][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : Internal.Utilities.Library.Array::loop@274-3(bool[], int32)][offset 0x00000008][found Byte] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl index 87b09e193a5..431d4e5512a 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl @@ -57,8 +57,8 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+ResponseFile+parseLine@239::Invoke(string)][offset 0x00000026][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1845::Invoke(int32)][offset 0x00000031][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1845::Invoke(int32)][offset 0x0000003A][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+TcConfig-TryResolveLibWithDirectories@558-1::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000021][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+TcConfig-TryResolveLibWithDirectories@558-1::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000003B][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+TcConfig-TryResolveLibWithDirectories@568-1::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000021][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+TcConfig-TryResolveLibWithDirectories@568-1::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000003B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x0000059C][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x000005A5][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000011][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1873-1'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>'] Unexpected type on the stack. @@ -106,7 +106,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.NativeRes+VersionHelper::TryParse(string, bool, uint16, bool, [S.P.CoreLib]System.Version&)][offset 0x00000026][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseNamed@5290(uint8[], [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>, int32, int32)][offset 0x0000007E][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseNamed@5310(uint8[], [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>, int32, int32)][offset 0x0000007E][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.Collections.Utils::shortPath(string)][offset 0x00000016][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment::probePathForDotnetHost@315([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000002A][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.SimulatedMSBuildReferenceResolver+SimulatedMSBuildResolver@68::FSharp.Compiler.CodeAnalysis.ILegacyReferenceResolver.Resolve([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyResolutionEnvironment, [S.P.CoreLib]System.Tuple`2[], string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>)][offset 0x000002F5][found Char] Unexpected type on the stack. @@ -122,4 +122,4 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.IO.FileSystemUtils::trimQuotes(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.IO.FileSystemUtils::trimQuotes(string)][offset 0x00000014][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.Library.String::lowerCaseFirstChar(string)][offset 0x0000003A][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : Internal.Utilities.Library.Array::loop@275-3(bool[], int32)][offset 0x00000008][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : Internal.Utilities.Library.Array::loop@274-3(bool[], int32)][offset 0x00000008][found Byte] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Core_Debug_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Core_Debug_netstandard2.0.bsl index 2e94b26033c..4e6bca186fd 100644 --- a/tests/ILVerify/ilverify_FSharp.Core_Debug_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Core_Debug_netstandard2.0.bsl @@ -1,8 +1,8 @@ [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel::Choose([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, !!0[])][offset 0x000000A0][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel::Filter([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, !!0[])][offset 0x00000029][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel::Partition([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, !!0[])][offset 0x00000038][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel+Pipe #2 input at line 2241@2245-1::Invoke(int32, [System.Threading.Tasks.Parallel]System.Threading.Tasks.ParallelLoopState, int32)][offset 0x00000030][found Boolean] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel+Pipe #2 input at line 2571@2575-1::Invoke(int32, [System.Threading.Tasks.Parallel]System.Threading.Tasks.ParallelLoopState, int32)][offset 0x00000022][found Boolean] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel+Pipe #2 input at line 2238@2242-1::Invoke(int32, [System.Threading.Tasks.Parallel]System.Threading.Tasks.ParallelLoopState, int32)][offset 0x00000030][found Boolean] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel+Pipe #2 input at line 2568@2572-1::Invoke(int32, [System.Threading.Tasks.Parallel]System.Threading.Tasks.ParallelLoopState, int32)][offset 0x00000022][found Boolean] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Core.StringModule::Map([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, string)][offset 0x00000020][found Short] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Core.StringModule::Map([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, string)][offset 0x00000031][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Core.StringModule::MapIndexed([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, string)][offset 0x00000029][found Short] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Core_Debug_netstandard2.1.bsl b/tests/ILVerify/ilverify_FSharp.Core_Debug_netstandard2.1.bsl index 2e94b26033c..4e6bca186fd 100644 --- a/tests/ILVerify/ilverify_FSharp.Core_Debug_netstandard2.1.bsl +++ b/tests/ILVerify/ilverify_FSharp.Core_Debug_netstandard2.1.bsl @@ -1,8 +1,8 @@ [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel::Choose([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, !!0[])][offset 0x000000A0][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel::Filter([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, !!0[])][offset 0x00000029][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel::Partition([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, !!0[])][offset 0x00000038][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel+Pipe #2 input at line 2241@2245-1::Invoke(int32, [System.Threading.Tasks.Parallel]System.Threading.Tasks.ParallelLoopState, int32)][offset 0x00000030][found Boolean] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel+Pipe #2 input at line 2571@2575-1::Invoke(int32, [System.Threading.Tasks.Parallel]System.Threading.Tasks.ParallelLoopState, int32)][offset 0x00000022][found Boolean] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel+Pipe #2 input at line 2238@2242-1::Invoke(int32, [System.Threading.Tasks.Parallel]System.Threading.Tasks.ParallelLoopState, int32)][offset 0x00000030][found Boolean] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel+Pipe #2 input at line 2568@2572-1::Invoke(int32, [System.Threading.Tasks.Parallel]System.Threading.Tasks.ParallelLoopState, int32)][offset 0x00000022][found Boolean] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Core.StringModule::Map([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, string)][offset 0x00000020][found Short] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Core.StringModule::Map([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, string)][offset 0x00000031][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Core.StringModule::MapIndexed([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, string)][offset 0x00000029][found Short] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Core_Release_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Core_Release_netstandard2.0.bsl index 4bc36bdc008..6ab50914fdd 100644 --- a/tests/ILVerify/ilverify_FSharp.Core_Release_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Core_Release_netstandard2.0.bsl @@ -1,8 +1,8 @@ [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel::Choose([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, !!0[])][offset 0x00000081][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel::Filter([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, !!0[])][offset 0x00000029][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel::Partition([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, !!0[])][offset 0x00000038][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel+Choose@2245-2::Invoke(int32, [System.Threading.Tasks.Parallel]System.Threading.Tasks.ParallelLoopState, int32)][offset 0x00000030][found Boolean] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel+countAndCollectTrueItems@2575-1::Invoke(int32, [System.Threading.Tasks.Parallel]System.Threading.Tasks.ParallelLoopState, int32)][offset 0x00000022][found Boolean] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel+Choose@2242-2::Invoke(int32, [System.Threading.Tasks.Parallel]System.Threading.Tasks.ParallelLoopState, int32)][offset 0x00000030][found Boolean] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel+countAndCollectTrueItems@2572-1::Invoke(int32, [System.Threading.Tasks.Parallel]System.Threading.Tasks.ParallelLoopState, int32)][offset 0x00000022][found Boolean] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Core.StringModule::Map([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, string)][offset 0x0000001E][found Short] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Core.StringModule::Map([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, string)][offset 0x0000002D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Core.StringModule::MapIndexed([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, string)][offset 0x00000029][found Short] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Core_Release_netstandard2.1.bsl b/tests/ILVerify/ilverify_FSharp.Core_Release_netstandard2.1.bsl index 4bc36bdc008..6ab50914fdd 100644 --- a/tests/ILVerify/ilverify_FSharp.Core_Release_netstandard2.1.bsl +++ b/tests/ILVerify/ilverify_FSharp.Core_Release_netstandard2.1.bsl @@ -1,8 +1,8 @@ [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel::Choose([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, !!0[])][offset 0x00000081][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel::Filter([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, !!0[])][offset 0x00000029][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel::Partition([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, !!0[])][offset 0x00000038][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel+Choose@2245-2::Invoke(int32, [System.Threading.Tasks.Parallel]System.Threading.Tasks.ParallelLoopState, int32)][offset 0x00000030][found Boolean] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel+countAndCollectTrueItems@2575-1::Invoke(int32, [System.Threading.Tasks.Parallel]System.Threading.Tasks.ParallelLoopState, int32)][offset 0x00000022][found Boolean] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel+Choose@2242-2::Invoke(int32, [System.Threading.Tasks.Parallel]System.Threading.Tasks.ParallelLoopState, int32)][offset 0x00000030][found Boolean] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : Microsoft.FSharp.Collections.ArrayModule+Parallel+countAndCollectTrueItems@2572-1::Invoke(int32, [System.Threading.Tasks.Parallel]System.Threading.Tasks.ParallelLoopState, int32)][offset 0x00000022][found Boolean] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Core.StringModule::Map([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, string)][offset 0x0000001E][found Short] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Core.StringModule::Map([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, string)][offset 0x0000002D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Microsoft.FSharp.Core.StringModule::MapIndexed([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, string)][offset 0x00000029][found Short] Unexpected type on the stack. From a3181c4c8e5a286a38f986a79024a74bfc650fb5 Mon Sep 17 00:00:00 2001 From: Maxime Mangel Date: Thu, 27 Mar 2025 12:06:05 +0100 Subject: [PATCH 2/3] Fix `fcs.fs` link (#18419) --- docs/reusing-typechecking-results.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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...) From af2ebfa79eb026c92dc28974608ddfa06cba3964 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Thu, 27 Mar 2025 15:02:40 +0100 Subject: [PATCH 3/3] Re-enable unused bindings detection (#18420) * reenable unused binding detection * fantomas * vsintegration/tests - ignored unused bindings in selected test projects --- Directory.Build.props | 5 ----- FSharp.sln | 1 + FSharpBuild.Directory.Build.props | 3 ++- .../Checking/Expressions/CheckExpressions.fs | 4 ++-- .../Expressions/CheckSequenceExpressions.fs | 4 ++-- src/Compiler/Checking/TailCallChecks.fs | 2 +- src/Compiler/Checking/infos.fs | 4 ++-- src/Compiler/CodeGen/EraseUnions.fs | 1 - src/Compiler/Driver/CompilerDiagnostics.fs | 2 +- src/Compiler/FSharp.Compiler.Service.fsproj | 8 +------ src/Compiler/Facilities/AsyncMemoize.fs | 2 +- src/Compiler/Service/TransparentCompiler.fs | 2 +- src/Compiler/SyntaxTree/LexerStore.fs | 2 -- src/Compiler/SyntaxTree/SyntaxTreeOps.fs | 6 ++--- src/Compiler/TypedTree/TypedTreeOps.fs | 4 ++-- .../CreateFSharpManifestResourceName.fs | 2 +- src/FSharp.Build/FSharpEmbedResourceText.fs | 8 +++---- src/FSharp.Build/Fsc.fs | 5 +---- src/FSharp.Build/Fsi.fs | 3 --- src/FSharp.Build/MapSourceRoots.fs | 2 +- .../FSharp.DependencyManager.Nuget.fsproj | 1 - .../MapSourceRootsTests.fs | 2 ++ .../DependencyManagerInteractiveTests.fs | 21 ++++-------------- .../FSharpScriptTests.fs | 22 +++++++++---------- .../AssemblyReaderShim.fs | 2 +- tests/FSharp.Compiler.Service.Tests/Common.fs | 8 +++---- .../FSharp.Compiler.Service.Tests.fsproj | 1 + .../FSharpExprPatternsTests.fs | 4 ++-- .../GeneratedCodeSymbolsTests.fs | 12 +++++----- .../ModuleReaderCancellationTests.fs | 17 +++++--------- .../ProjectAnalysisTests.fs | 11 +++++----- .../FSharp.Compiler.Service.Tests/Symbols.fs | 10 ++++----- .../TooltipTests.fs | 7 +++--- .../FSharp.Core.UnitTests.fsproj | 1 + tests/service/data/TestTP/TestTP.fs | 2 ++ .../src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj | 2 +- ...myProviderForLanguageServiceTesting.fsproj | 2 +- .../tests/Salsa/VisualFSharp.Salsa.fsproj | 2 +- .../UnitTests/VisualFSharp.UnitTests.fsproj | 2 +- 39 files changed, 83 insertions(+), 116 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index fbb9c8332c7..141c85ff4d2 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -10,11 +10,6 @@ $(DotNetBuildSourceOnly) - - - $(NoWarn);FS0064;FS1182 - - $(NoWarn);1204 $(NoWarn);NU5125 - $(NoWarn);64;1182;1204 - $(OtherFlags) --warnaserror-:1182 + $(NoWarn);64;1204 FSharp.Compiler.Service true $(DefineConstants);COMPILER @@ -26,11 +25,6 @@ $(FSharpNetCoreProductTargetFramework);$(TargetFrameworks) $(DefineConstants);FSHARPCORE_USE_PACKAGE $(OtherFlags) --extraoptimizationloops:1 - - - - $(OtherFlags) --nowarn:1182 - $(OtherFlags) --warnon:3218 diff --git a/src/Compiler/Facilities/AsyncMemoize.fs b/src/Compiler/Facilities/AsyncMemoize.fs index a8a4d5b143f..ac52eaf8607 100644 --- a/src/Compiler/Facilities/AsyncMemoize.fs +++ b/src/Compiler/Facilities/AsyncMemoize.fs @@ -183,7 +183,7 @@ 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 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/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/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index 33dd6c2757c..21c9783713e 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -9241,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 @@ -9260,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/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/FSharpEmbedResourceText.fs b/src/FSharp.Build/FSharpEmbedResourceText.fs index d8f4a46eb25..1c5ffbfb68b 100644 --- a/src/FSharp.Build/FSharpEmbedResourceText.fs +++ b/src/FSharp.Build/FSharpEmbedResourceText.fs @@ -447,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) @@ -511,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 @@ -589,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 @@ -598,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.DependencyManager.Nuget/FSharp.DependencyManager.Nuget.fsproj b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Nuget.fsproj index 4700c172f52..96e318d282c 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Nuget.fsproj +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Nuget.fsproj @@ -8,7 +8,6 @@ FSharp.DependencyManager.Nuget true $(DefineConstants);COMPILER - $(OtherFlags) --warnon:1182 true Debug;Release diff --git a/tests/FSharp.Build.UnitTests/MapSourceRootsTests.fs b/tests/FSharp.Build.UnitTests/MapSourceRootsTests.fs index bdefa03d96a..ec590e52e42 100644 --- a/tests/FSharp.Build.UnitTests/MapSourceRootsTests.fs +++ b/tests/FSharp.Build.UnitTests/MapSourceRootsTests.fs @@ -9,6 +9,8 @@ open Xunit open System.Collections.Generic open FSharp.Test +#nowarn "1182" //Unused arguments + type MockEngine() = member val Errors = ResizeArray() with get member val Warnings = ResizeArray() with get diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs index 7f320fea23f..3e6b7b27e43 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs @@ -39,8 +39,6 @@ type DependencyManagerInteractiveTests() = let getErrors ((_value: Result), (errors: FSharpDiagnostic[])) = errors - let ignoreValue = getValue >> ignore - [] member _.``SmokeTest - #r nuget``() = let text = """ @@ -58,7 +56,7 @@ type DependencyManagerInteractiveTests() = #r @"nuget:System.Collections.Immutable.DoesNotExist, version=1.5.0" 0""" use script = new scriptHost() - let opt, errors = script.Eval(text) + let _opt, errors = script.Eval(text) Assert.Equal(errors.Length, 1) (* @@ -152,8 +150,6 @@ type DependencyManagerInteractiveTests() = [] member _.``Multiple Instances of DependencyProvider should be isolated``() = - - let assemblyProbingPaths () = Seq.empty let nativeProbingRoots () = Seq.empty use dp1 = new DependencyProvider(NativeResolutionProbe(nativeProbingRoots), false) @@ -282,7 +278,6 @@ TorchSharp.Tensor.LongTensor.From([| 0L .. 100L |]).Device | ErrorReportType.Warning -> printfn "PackageManagementWarning %d : %s" code message ResolvingErrorReport (report) - let mutable resolverPackageRoots = Seq.empty let mutable resolverPackageRoots = Seq.empty let mutable resolverReferences = Seq.empty @@ -383,11 +378,9 @@ printfn ""%A"" result ResolvingErrorReport (report) let mutable resolverPackageRoots = Seq.empty - let mutable resolverPackageRoots = Seq.empty let mutable resolverReferences = Seq.empty let nativeProbingRoots () = resolverPackageRoots - let assemblyPaths () = resolverReferences // Restore packages, Get Reference dll paths and package roots let result = @@ -526,10 +519,7 @@ x |> Seq.iter(fun r -> ResolvingErrorReport (report) let mutable resolverPackageRoots = Seq.empty - let mutable resolverReferences = Seq.empty - let nativeProbingRoots () = resolverPackageRoots - let assemblyProbingPaths () = resolverReferences // Restore packages, Get Reference dll paths and package roots let result = @@ -552,10 +542,7 @@ x |> Seq.iter(fun r -> ResolvingErrorReport (report) let mutable resolverPackageRoots = Seq.empty - let mutable resolverReferences = Seq.empty - let nativeProbingRoots () = resolverPackageRoots - let assemblyProbingPaths () = resolverReferences // Restore packages, Get Reference dll paths and package roots let result = @@ -740,7 +727,7 @@ x |> Seq.iter(fun r -> use script = new FSharpScript(quiet = false, langVersion = LangVersion.V47) use capture = new TestConsole.ExecutionCapture() - let opt = script.Eval("#help") |> getValue + let _opt = script.Eval("#help") |> getValue let output = capture.OutText @@ -772,7 +759,7 @@ x |> Seq.iter(fun r -> use script = new FSharpScript(quiet = false, langVersion = LangVersion.Preview) use capture = new TestConsole.ExecutionCapture() - let opt = script.Eval("#help") |> getValue + let _opt = script.Eval("#help") |> getValue let output = capture.OutText @@ -871,7 +858,7 @@ x |> Seq.iter(fun r -> let idm = dp.TryFindDependencyManagerByKey(Seq.empty, "", reportError, "nuget") // Resolve and cache the results won't time out - let result = dp.Resolve(idm, ".fsx", [|"r", "FSharp.Data,3.3.3"; "r", "timeout=10000"|], reportError, "net9.0", null, "", "", "", -1) // Wait forever + let _result = dp.Resolve(idm, ".fsx", [|"r", "FSharp.Data,3.3.3"; "r", "timeout=10000"|], reportError, "net9.0", null, "", "", "", -1) // Wait forever // Clear the results foundCorrectError <- false diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs index ecf5b81d97b..207cde1074f 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs @@ -71,7 +71,7 @@ x let ce = new ControlledExecution(true) ce.Run(fun () -> use script = new FSharpScript() - let result, errors = + let result, _errors = script.Eval(""" open System let x = 1 + 2 @@ -178,7 +178,7 @@ System.Configuration.ConfigurationManager.AppSettings.Item "Environment" <- "LOC Assert.Empty(errors) match result with | Ok(_) -> () - | Error(ex) -> Assert.True(true, "expected no failures") + | Error _ -> Assert.True(true, "expected no failures") [] [] // No argument @@ -186,7 +186,7 @@ System.Configuration.ConfigurationManager.AppSettings.Item "Environment" <- "LOC [] // whitespace only argument member _.``Script with #i syntax errors fail``(code, error0) = use script = new FSharpScript() - let result, errors = script.Eval(code) + let _result, errors = script.Eval(code) Assert.NotEmpty(errors) Assert.Equal(errors.[0].ToString(), error0) @@ -196,7 +196,7 @@ System.Configuration.ConfigurationManager.AppSettings.Item "Environment" <- "LOC "input.fsx (1,1)-(1,3) interactive warning Invalid directive '#i '")>] member _.``Script with more #i syntax errors fail``(code, error0, error1) = use script = new FSharpScript() - let result, errors = script.Eval(code) + let _result, errors = script.Eval(code) Assert.NotEmpty(errors) Assert.Equal(errors.Length, 2) Assert.Equal(error0, errors.[0].ToString()) @@ -207,7 +207,7 @@ System.Configuration.ConfigurationManager.AppSettings.Item "Environment" <- "LOC "input.fsx (1,1)-(1,42) interactive error #i is not supported by the registered PackageManagers")>] member _.``Script with #i and no package manager specified``(code, error0) = use script = new FSharpScript() - let result, errors = script.Eval(code) + let _result, errors = script.Eval(code) Assert.NotEmpty(errors) Assert.Equal(errors.Length, 1) Assert.Equal(errors.[0].ToString(), error0) @@ -217,7 +217,7 @@ System.Configuration.ConfigurationManager.AppSettings.Item "Environment" <- "LOC "input.fsx (1,1)-(1,15) interactive error Invalid URI: The format of the URI could not be determined.")>] member _.``Script with #i and forgot to add quotes``(code, error) = use script = new FSharpScript() - let result, errors = script.Eval(code) + let _result, errors = script.Eval(code) Assert.NotEmpty(errors) Assert.Equal(1, errors.Length) Assert.Equal(error, errors.[0].ToString()) @@ -227,7 +227,7 @@ System.Configuration.ConfigurationManager.AppSettings.Item "Environment" <- "LOC let path = Path.GetTempPath() let code = sprintf "#i @\"nuget:%s\" " path use script = new FSharpScript() - let result, errors = script.Eval(code) + let _result, errors = script.Eval(code) Assert.Empty(errors) Assert.Equal(0, errors.Length) @@ -239,7 +239,7 @@ System.Configuration.ConfigurationManager.AppSettings.Item "Environment" <- "LOC let code = sprintf "#i @\"nuget:%s\"" path let error = sprintf "interactive error The source directory '%s' not found" path use script = new FSharpScript() - let result, errors = script.Eval(code) + let _result, errors = script.Eval(code) Assert.NotEmpty(errors) Assert.Equal(1, errors.Length) Assert.True(errors.[0].ToString().EndsWith(error)) @@ -308,7 +308,7 @@ printfn "{@"%A"}" result member _.``Eval script with invalid PackageName should fail immediately``() = use capture = new TestConsole.ExecutionCapture() use script = new FSharpScript(additionalArgs=[| |]) - let result, errors = script.Eval("""#r "nuget:FSharp.Really.Not.A.Package" """) + let _result, errors = script.Eval("""#r "nuget:FSharp.Really.Not.A.Package" """) let lines = capture.OutText.Split([| Environment.NewLine |], StringSplitOptions.None) let found = lines |> Seq.exists (fun line -> line.Contains("error NU1101:") && line.Contains("FSharp.Really.Not.A.Package")) @@ -320,7 +320,7 @@ printfn "{@"%A"}" result member _.``Eval script with invalid PackageName should fail immediately and resolve one time only``() = use capture = new TestConsole.ExecutionCapture() use script = new FSharpScript(additionalArgs=[| |]) - let result, errors = + let _result, errors = script.Eval(""" #r "nuget:FSharp.Really.Not.A.Package" #r "nuget:FSharp.Really.Not.Another.Package" @@ -526,7 +526,7 @@ let add (col:IServiceCollection) = Assert.Empty(errors) match result with | Ok(_) -> () - | Error(ex) -> Assert.True(false, "expected no failures") + | Error _ -> Assert.True(false, "expected no failures") | false -> Assert.NotEmpty(errors) Assert.Equal(1, errors.Length) diff --git a/tests/FSharp.Compiler.Service.Tests/AssemblyReaderShim.fs b/tests/FSharp.Compiler.Service.Tests/AssemblyReaderShim.fs index 9e19b32834f..63d8ee1c284 100644 --- a/tests/FSharp.Compiler.Service.Tests/AssemblyReaderShim.fs +++ b/tests/FSharp.Compiler.Service.Tests/AssemblyReaderShim.fs @@ -20,6 +20,6 @@ module M let x = 123 """ - let fileName, options = mkTestFileAndOptions source [| |] + let fileName, options = mkTestFileAndOptions [| |] checker.ParseAndCheckFileInProject(fileName, 0, SourceText.ofString source, options) |> Async.RunImmediate |> ignore gotRequest |> Assert.True diff --git a/tests/FSharp.Compiler.Service.Tests/Common.fs b/tests/FSharp.Compiler.Service.Tests/Common.fs index b9f780fd506..5ad61b29ef9 100644 --- a/tests/FSharp.Compiler.Service.Tests/Common.fs +++ b/tests/FSharp.Compiler.Service.Tests/Common.fs @@ -129,7 +129,7 @@ let mkProjectCommandLineArgsForScript (dllName, fileNames) = |] #endif -let mkTestFileAndOptions source additionalArgs = +let mkTestFileAndOptions additionalArgs = let fileName = Path.ChangeExtension(getTemporaryFileName (), ".fs") let project = getTemporaryFileName () let dllName = Path.ChangeExtension(project, ".dll") @@ -193,7 +193,7 @@ let parseSourceCode (name: string, code: string) = let filePath = Path.Combine(location, name) let dllPath = Path.Combine(location, name + ".dll") let args = mkProjectCommandLineArgs(dllPath, [filePath]) - let options, errors = checker.GetParsingOptionsFromCommandLineArgs(List.ofArray args) + let options, _errors = checker.GetParsingOptionsFromCommandLineArgs(List.ofArray args) let parseResults = checker.ParseFile(filePath, SourceText.ofString code, options) |> Async.RunImmediate parseResults.ParseTree @@ -203,7 +203,7 @@ let matchBraces (name: string, code: string) = let filePath = Path.Combine(location, name + ".fs") let dllPath = Path.Combine(location, name + ".dll") let args = mkProjectCommandLineArgs(dllPath, [filePath]) - let options, errors = checker.GetParsingOptionsFromCommandLineArgs(List.ofArray args) + let options, _errors = checker.GetParsingOptionsFromCommandLineArgs(List.ofArray args) let braces = checker.MatchBraces(filePath, SourceText.ofString code, options) |> Async.RunImmediate braces @@ -265,7 +265,7 @@ let attribsOfSymbol (symbol: FSharpSymbol) = if v.IsStatic then yield "static" if v.IsLiteral then yield sprintf "%A" v.LiteralValue.Value if v.IsAnonRecordField then - let info, tys, i = v.AnonRecordFieldDetails + let info, _tys, i = v.AnonRecordFieldDetails yield "anon(" + string i + ", [" + info.Assembly.QualifiedName + "/" + String.concat "+" info.EnclosingCompiledTypeNames + "/" + info.CompiledName + "]" + String.concat "," info.SortedFieldNames + ")" diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj index 57ce88d8f02..16e9df837ee 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj @@ -5,6 +5,7 @@ net472;$(FSharpNetCoreProductTargetFramework) $(FSharpNetCoreProductTargetFramework) true + $(NoWarn);1182 true xunit diff --git a/tests/FSharp.Compiler.Service.Tests/FSharpExprPatternsTests.fs b/tests/FSharp.Compiler.Service.Tests/FSharpExprPatternsTests.fs index abc6bbc9de4..0c5c9fc3305 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharpExprPatternsTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/FSharpExprPatternsTests.fs @@ -25,7 +25,7 @@ module TASTCollecting = | Application (funcExpr, _typeArgs, argExprs) -> visitExpr handler funcExpr visitExprs handler argExprs - | Call (objExprOpt, memberOrFunc, _typeArgs1, _typeArgs2, argExprs) -> + | Call (objExprOpt, _memberOrFunc, _typeArgs1, _typeArgs2, argExprs) -> visitObjArg handler objExprOpt visitExprs handler argExprs | Coerce (_targetType, inpExpr) -> visitExpr handler inpExpr @@ -132,7 +132,7 @@ let testPatterns handler source = Map.tryFind fileName files |> async.Return let projectOptions = - let _, projectOptions = mkTestFileAndOptions "" Array.empty + let _, projectOptions = mkTestFileAndOptions Array.empty { projectOptions with SourceFiles = [| "A.fs" |] diff --git a/tests/FSharp.Compiler.Service.Tests/GeneratedCodeSymbolsTests.fs b/tests/FSharp.Compiler.Service.Tests/GeneratedCodeSymbolsTests.fs index 5fac752952c..6e9a64d0191 100644 --- a/tests/FSharp.Compiler.Service.Tests/GeneratedCodeSymbolsTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/GeneratedCodeSymbolsTests.fs @@ -22,10 +22,10 @@ type T () = for implFile in wholeProjectResults.AssemblyContents.ImplementationFiles do for decl in implFile.Declarations do match decl with - | FSharpImplementationFileDeclaration.Entity(e,ds) -> + | FSharpImplementationFileDeclaration.Entity(_e,ds) -> for d in ds do match d with - | FSharpImplementationFileDeclaration.MemberOrFunctionOrValue (mfv, args, body) -> + | FSharpImplementationFileDeclaration.MemberOrFunctionOrValue (mfv, _args, _body) -> yield mfv | _ -> () | _ -> () @@ -51,10 +51,10 @@ type T = A | B for implFile in wholeProjectResults.AssemblyContents.ImplementationFiles do for decl in implFile.Declarations do match decl with - | FSharpImplementationFileDeclaration.Entity(e,ds) -> + | FSharpImplementationFileDeclaration.Entity(_e,ds) -> for d in ds do match d with - | FSharpImplementationFileDeclaration.MemberOrFunctionOrValue (mfv, args, body) -> + | FSharpImplementationFileDeclaration.MemberOrFunctionOrValue (mfv, _args, _body) -> yield mfv | _ -> () | _ -> () @@ -84,10 +84,10 @@ type T = for implFile in wholeProjectResults.AssemblyContents.ImplementationFiles do for decl in implFile.Declarations do match decl with - | FSharpImplementationFileDeclaration.Entity(e,ds) -> + | FSharpImplementationFileDeclaration.Entity(_e,ds) -> for d in ds do match d with - | FSharpImplementationFileDeclaration.MemberOrFunctionOrValue (mfv, args, body) -> + | FSharpImplementationFileDeclaration.MemberOrFunctionOrValue (mfv, _args, _body) -> yield mfv | _ -> () | _ -> () diff --git a/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs b/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs index 981c4dda14b..f307586cd5c 100644 --- a/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs @@ -102,13 +102,6 @@ type PreTypeDefData = CancelOnImport: bool } member this.TypeDef = - let name = - match this.Namespace with - | [] -> this.Name - | ns -> - let ns = ns |> String.concat "." - $"{ns}.{this.Name}" - let methodsDefs = if this.HasCtor then let mkCtor = runCancelFirstTime (fun _ -> [| ModuleReader.mkCtor () |]) @@ -191,7 +184,7 @@ let ``Type defs 01 - assembly import`` () = let getPreTypeDefs typeData = runCancelFirstTime (fun _ -> createPreTypeDefs typeData) let typeDefs = getPreTypeDefs [ { Name = "T"; Namespace = []; HasCtor = false; CancelOnImport = false } ] - let path, options = mkTestFileAndOptions source [||] + let path, options = mkTestFileAndOptions [||] let options = referenceReaderProject typeDefs false options // First request, should be cancelled inside getPreTypeDefs @@ -217,7 +210,7 @@ let ``Type defs 02 - assembly import`` () = let source = source1 let typeDefs = fun _ -> createPreTypeDefs [ { Name = "T"; Namespace = ["Ns"]; HasCtor = false; CancelOnImport = true } ] - let path, options = mkTestFileAndOptions source [||] + let path, options = mkTestFileAndOptions [||] let options = referenceReaderProject typeDefs false options parseAndCheck path source options |> ignore @@ -235,7 +228,7 @@ let ``Type defs 03 - type import`` () = let source = source2 let typeDefs = fun _ -> createPreTypeDefs [ { Name = "T"; Namespace = ["Ns1"; "Ns2"]; HasCtor = false; CancelOnImport = true } ] - let path, options = mkTestFileAndOptions source [||] + let path, options = mkTestFileAndOptions [||] let options = referenceReaderProject typeDefs false options // First request, should be cancelled inside GetTypeDef @@ -260,7 +253,7 @@ let ``Type defs 04 - ctor import`` () = let source = source1 let typeDefs = fun _ -> createPreTypeDefs [ { Name = "T"; Namespace = []; HasCtor = true; CancelOnImport = false } ] - let path, options = mkTestFileAndOptions source [||] + let path, options = mkTestFileAndOptions [||] let options = referenceReaderProject typeDefs false options // First request, should be cancelled inside ILMethodDefs @@ -282,7 +275,7 @@ let ``Module def 01 - assembly import`` () = let getPreTypeDefs typeData = fun _ -> createPreTypeDefs typeData let typeDefs = getPreTypeDefs [ { Name = "T"; Namespace = []; HasCtor = false; CancelOnImport = false } ] - let path, options = mkTestFileAndOptions source [||] + let path, options = mkTestFileAndOptions [||] let options = referenceReaderProject typeDefs true options // First request, should be cancelled inside getPreTypeDefs diff --git a/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs b/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs index 0e12a33fe2f..cef9b119c77 100644 --- a/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs @@ -3,6 +3,7 @@ open System.Threading.Tasks #nowarn "57" // Experimental stuff +#nowarn "1182" //Lot of unused results are stored in a binding, since those tests are checking how internal caching works when changes are being applied let runningOnMono = try System.Type.GetType("Mono.Runtime") <> null with e -> false @@ -5460,7 +5461,7 @@ type A(i:int) = [] let ``#4030, Incremental builder creation warnings 1`` () = let source = "module M" - let fileName, options = mkTestFileAndOptions source [||] + let fileName, options = mkTestFileAndOptions [||] let _, checkResults = parseAndCheckFile fileName source options checkResults.Diagnostics |> Array.map (fun e -> e.Severity = FSharpDiagnosticSeverity.Error) |> shouldEqual [||] @@ -5468,7 +5469,7 @@ let ``#4030, Incremental builder creation warnings 1`` () = [] let ``#4030, Incremental builder creation warnings 2`` () = let source = "module M" - let fileName, options = mkTestFileAndOptions source [| "--times" |] + let fileName, options = mkTestFileAndOptions [| "--times" |] let _, checkResults = parseAndCheckFile fileName source options checkResults.Diagnostics |> Array.map (fun e -> e.Severity = FSharpDiagnosticSeverity.Error) |> shouldEqual [| false |] @@ -5476,7 +5477,7 @@ let ``#4030, Incremental builder creation warnings 2`` () = [] let ``#4030, Incremental builder creation warnings 3`` () = let source = "module M" - let fileName, options = mkTestFileAndOptions source [| "--times"; "--nowarn:75" |] + let fileName, options = mkTestFileAndOptions [| "--times"; "--nowarn:75" |] let _, checkResults = parseAndCheckFile fileName source options checkResults.Diagnostics |> Array.map (fun e -> e.Severity = FSharpDiagnosticSeverity.Error) |> shouldEqual [||] @@ -5484,7 +5485,7 @@ let ``#4030, Incremental builder creation warnings 3`` () = [] let ``#4030, Incremental builder creation warnings 4`` () = let source = "module M" - let fileName, options = mkTestFileAndOptions source [| "--times"; "--warnaserror:75" |] + let fileName, options = mkTestFileAndOptions [| "--times"; "--warnaserror:75" |] let _, checkResults = parseAndCheckFile fileName source options checkResults.Diagnostics |> Array.map (fun e -> e.Severity = FSharpDiagnosticSeverity.Error) |> shouldEqual [| true |] @@ -5492,7 +5493,7 @@ let ``#4030, Incremental builder creation warnings 4`` () = [] let ``#4030, Incremental builder creation warnings 5`` () = let source = "module M" - let fileName, options = mkTestFileAndOptions source [| "--times"; "--warnaserror-:75"; "--warnaserror" |] + let fileName, options = mkTestFileAndOptions [| "--times"; "--warnaserror-:75"; "--warnaserror" |] let _, checkResults = parseAndCheckFile fileName source options checkResults.Diagnostics |> Array.map (fun e -> e.Severity = FSharpDiagnosticSeverity.Error) |> shouldEqual [| false |] diff --git a/tests/FSharp.Compiler.Service.Tests/Symbols.fs b/tests/FSharp.Compiler.Service.Tests/Symbols.fs index 25617ca1235..181cbfe40af 100644 --- a/tests/FSharp.Compiler.Service.Tests/Symbols.fs +++ b/tests/FSharp.Compiler.Service.Tests/Symbols.fs @@ -30,7 +30,7 @@ match "foo" with """ let getCaseUsages source line = - let fileName, options = mkTestFileAndOptions source [| |] + let fileName, options = mkTestFileAndOptions [| |] let _, checkResults = parseAndCheckFile fileName source options checkResults.GetAllUsesOfAllSymbolsInFile() @@ -201,7 +201,7 @@ module Mod1 = module Mod2 = let func2 () = () """ - let fileName, options = mkTestFileAndOptions source [| |] + let fileName, options = mkTestFileAndOptions [| |] let _, checkResults = parseAndCheckFile fileName source options let mod1 = checkResults.PartialAssemblySignature.FindEntityByPath ["Ns1"; "Mod1"] |> Option.get @@ -221,7 +221,7 @@ let val1 = 1 module Mod2 = let func2 () = () """ - let fileName, options = mkTestFileAndOptions source [| |] + let fileName, options = mkTestFileAndOptions [| |] let _, checkResults = parseAndCheckFile fileName source options let mod1 = checkResults.PartialAssemblySignature.FindEntityByPath ["Mod1"] |> Option.get @@ -247,7 +247,7 @@ type FooAttribute() = [] let x = 123 """ - let fileName, options = mkTestFileAndOptions source [| "--noconditionalerasure" |] + let fileName, options = mkTestFileAndOptions [| "--noconditionalerasure" |] let _, checkResults = parseAndCheckFile fileName source options checkResults.GetAllUsesOfAllSymbolsInFile() @@ -370,7 +370,7 @@ type I<'T> = let _, checkResults = getParseAndCheckResults """ [1] |> ignore """ - let symbolUses = checkResults.GetAllUsesOfAllSymbolsInFile() + let _symbolUses = checkResults.GetAllUsesOfAllSymbolsInFile() () [] diff --git a/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs b/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs index 0b30a5a61e8..cbc82c6922e 100644 --- a/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs @@ -26,7 +26,7 @@ let testXmlDocFallbackToSigFileWhileInImplFile sigSource implSource line colAtEn let documentSource fileName = Map.tryFind fileName files |> async.Return let projectOptions = - let _, projectOptions = mkTestFileAndOptions "" Array.empty + let _, projectOptions = mkTestFileAndOptions Array.empty { projectOptions with SourceFiles = [| "A.fsi"; "A.fs" |] } @@ -274,7 +274,7 @@ let testToolTipSquashing source line colAtEndOfNames lineText names tokenTag = let documentSource fileName = Map.tryFind fileName files |> async.Return let projectOptions = - let _, projectOptions = mkTestFileAndOptions "" Array.empty + let _, projectOptions = mkTestFileAndOptions Array.empty { projectOptions with SourceFiles = [| "A.fs" |] } @@ -394,7 +394,6 @@ c.Abc let getCheckResults source options = let fileName, options = mkTestFileAndOptions - source options let _, checkResults = parseAndCheckFile fileName source options checkResults @@ -455,7 +454,7 @@ let exists() = System.IO.Path.Exists(null:string) let checkResults = getCheckResults source [|"--checknulls+";"--langversion:preview"|] checkResults.GetToolTip(2, 36, "let exists() = System.IO.Path.Exists(null:string)", [ "Exists" ], FSharpTokenTag.Identifier) |> assertAndExtractTooltip - |> fun (text,xml,remarks) -> + |> fun (text,xml,_remarks) -> text |> Assert.shouldBeEquivalentTo "System.IO.Path.Exists([] path: string | null) : bool" match xml with | FSharpXmlDoc.FromXmlFile (_dll,sigPath) -> sigPath |> Assert.shouldBeEquivalentTo "M:System.IO.Path.Exists(System.String)" diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj index 3e6bbbd282d..f5737066162 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj @@ -12,6 +12,7 @@ $(FSCoreUnitTestsPackageVersion) true preview + $(NoWarn);1182 true xunit diff --git a/tests/service/data/TestTP/TestTP.fs b/tests/service/data/TestTP/TestTP.fs index 4e7bf9dd092..062e1b8510d 100644 --- a/tests/service/data/TestTP/TestTP.fs +++ b/tests/service/data/TestTP/TestTP.fs @@ -5,6 +5,8 @@ open Microsoft.FSharp.Core.CompilerServices open System.Reflection open FSharp.Quotations +#nowarn "1182" // Lot of unused "args","x","y","c" around this test file + module Helper = let doNothing() = () let doNothingOneArg(x:int) = () diff --git a/vsintegration/src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj b/vsintegration/src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj index 68cc5c4de2e..21305e52a5d 100644 --- a/vsintegration/src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj +++ b/vsintegration/src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj @@ -4,7 +4,7 @@ Library - $(NoWarn);47;75 + $(NoWarn);47;75;1182 true $(OtherFlags) --subsystemversion:6.00 false diff --git a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fsproj b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fsproj index edf4b8a41e5..ae81965ef4c 100644 --- a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fsproj +++ b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fsproj @@ -5,7 +5,7 @@ net472 true - $(OtherFlags) --nowarn:3390 --nowarn:3218 + $(OtherFlags) --nowarn:3390 --nowarn:3218 --nowarn:1182 diff --git a/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj b/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj index 353e08336a6..4e556083776 100644 --- a/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj +++ b/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj @@ -4,7 +4,7 @@ Library - $(NoWarn);44;45;47;52;58;75 + $(NoWarn);44;45;47;52;58;75;1182 true true false diff --git a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj index 2a764378864..4020cfd750d 100644 --- a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj +++ b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj @@ -6,7 +6,7 @@ net472 x86 Library - $(NoWarn);44;58;75;3005 + $(NoWarn);44;58;75;3005;1182 true true true