From d04e586b2710d4e6b72a518f2fd4b23885b82ac2 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Sun, 23 Mar 2025 14:34:25 -0700 Subject: [PATCH 1/2] Update fantomas --- .config/dotnet-tools.json | 4 +- src/Compiler/AbstractIL/ilnativeres.fs | 56 +++--- src/Compiler/AbstractIL/ilread.fs | 12 +- src/Compiler/AbstractIL/ilreflect.fs | 13 +- src/Compiler/AbstractIL/ilsupp.fs | 6 +- .../CheckComputationExpressions.fs | 4 +- src/Compiler/CodeGen/EraseUnions.fs | 28 +-- src/Compiler/CodeGen/IlxGen.fs | 162 +++++++----------- src/Compiler/CodeGen/IlxGenSupport.fs | 15 +- .../AssemblyResolveHandler.fs | 13 +- .../NativeDllResolveHandler.fs | 11 +- src/Compiler/Driver/CompilerConfig.fs | 8 +- src/Compiler/Driver/CompilerDiagnostics.fs | 10 +- src/Compiler/Driver/CompilerOptions.fs | 4 +- src/Compiler/Driver/CreateILModule.fs | 2 +- src/Compiler/Driver/FxResolver.fs | 15 +- src/Compiler/Driver/OptimizeInputs.fs | 27 +-- src/Compiler/Driver/ParseAndCheckInputs.fs | 102 +++++------ src/Compiler/Driver/ScriptClosure.fs | 21 +-- src/Compiler/Driver/StaticLinking.fs | 9 +- src/Compiler/Driver/fsc.fs | 24 +-- src/Compiler/Facilities/CompilerLocation.fs | 28 ++- src/Compiler/Facilities/DiagnosticsLogger.fs | 3 +- .../SimulatedMSBuildReferenceResolver.fs | 6 +- src/Compiler/Facilities/prim-lexing.fs | 13 +- src/Compiler/Interactive/fsi.fs | 54 ++---- src/Compiler/Service/BackgroundCompiler.fs | 149 ++++------------ src/Compiler/Service/FSharpCheckerResults.fs | 45 ++--- src/Compiler/Service/FSharpProjectSnapshot.fs | 32 ++-- src/Compiler/Service/FSharpWorkspaceState.fs | 20 +-- .../Service/SemanticClassification.fs | 8 +- .../Service/ServiceInterfaceStubGenerator.fs | 2 +- src/Compiler/Service/ServiceLexing.fs | 13 +- src/Compiler/Service/ServiceParseTreeWalk.fs | 8 +- src/Compiler/Service/ServiceParsedInputOps.fs | 7 +- src/Compiler/Service/TransparentCompiler.fs | 100 +++-------- src/Compiler/Service/TransparentCompiler.fsi | 7 +- src/Compiler/Service/service.fs | 29 +--- src/Compiler/Symbols/FSharpDiagnostic.fsi | 4 +- src/Compiler/SyntaxTree/LexHelpers.fs | 13 +- src/Compiler/SyntaxTree/ParseHelpers.fs | 20 +-- src/Compiler/SyntaxTree/UnicodeLexing.fs | 9 +- src/Compiler/TypedTree/TcGlobals.fsi | 5 +- src/Compiler/Utilities/FileSystem.fs | 11 +- src/Compiler/Utilities/sr.fs | 4 +- src/FSharp.Build/FSharpEmbedResXSource.fs | 7 +- src/FSharp.Build/Fsi.fs | 4 +- src/FSharp.Core/async.fs | 28 +-- src/FSharp.Core/map.fs | 8 +- src/FSharp.Core/quotations.fs | 9 +- src/FSharp.Core/reflect.fs | 21 +-- src/FSharp.Core/seq.fs | 5 +- src/FSharp.Core/set.fs | 8 +- .../FSharp.DependencyManager.Utilities.fs | 4 +- .../FSharp.DependencyManager.fs | 8 +- ...y_FSharp.Compiler.Service_Debug_net9.0.bsl | 10 +- ....Compiler.Service_Debug_netstandard2.0.bsl | 12 +- ...FSharp.Compiler.Service_Release_net9.0.bsl | 18 +- ...ompiler.Service_Release_netstandard2.0.bsl | 20 +-- 59 files changed, 431 insertions(+), 867 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 34ccbbf8056..3b266c03b4c 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -45,7 +45,7 @@ "rollForward": true }, "fantomas": { - "version": "6.2.3", + "version": "7.0.1", "commands": [ "fantomas" ], @@ -59,4 +59,4 @@ "rollForward": false } } -} +} \ No newline at end of file diff --git a/src/Compiler/AbstractIL/ilnativeres.fs b/src/Compiler/AbstractIL/ilnativeres.fs index 62961613b3f..2eb03ab674e 100644 --- a/src/Compiler/AbstractIL/ilnativeres.fs +++ b/src/Compiler/AbstractIL/ilnativeres.fs @@ -83,7 +83,7 @@ type CvtResFile() = pAdditional.DataSize <- cbData pAdditional.pstringType <- CvtResFile.ReadStringOrID reader pAdditional.pstringName <- CvtResFile.ReadStringOrID reader - stream.Position <- stream.Position + 3L &&& ~~~ 3L + stream.Position <- stream.Position + 3L &&& ~~~3L pAdditional.DataVersion <- reader.ReadUInt32() pAdditional.MemoryFlags <- reader.ReadUInt16() pAdditional.LanguageId <- reader.ReadUInt16() @@ -91,7 +91,7 @@ type CvtResFile() = pAdditional.Characteristics <- reader.ReadUInt32() pAdditional.data <- Array.zeroCreate (int pAdditional.DataSize) reader.Read(pAdditional.data, 0, pAdditional.data.Length) |> ignore - stream.Position <- stream.Position + 3L &&& ~~~ 3L + stream.Position <- stream.Position + 3L &&& ~~~3L if pAdditional.pstringType.theString = Unchecked.defaultof<_> @@ -174,6 +174,7 @@ type SectionCharacteristics = type ResourceSection() = new(sectionBytes: byte[], relocations: uint32[]) as this = (ResourceSection()) + then Debug.Assert(sectionBytes :> obj <> Unchecked.defaultof<_>) Debug.Assert(relocations :> obj <> Unchecked.defaultof<_>) @@ -374,13 +375,8 @@ type VersionHelper() = /// /// True when parsing succeeds completely (i.e. every character in the string was consumed), false otherwise. static member private TryParse - ( - s: string, - allowWildcard: bool, - maxValue: uint16, - allowPartialParse: bool, - [] version: byref - ) = + (s: string, allowWildcard: bool, maxValue: uint16, allowPartialParse: bool, [] version: byref) + = Debug.Assert(not allowWildcard || maxValue < UInt16.MaxValue) if String.IsNullOrWhiteSpace s then @@ -520,20 +516,24 @@ type VersionResourceSerializer() = member val private _isDll = Unchecked.defaultof with get, set - new(isDll: bool, - comments: string, - companyName: string, - fileDescription: string, - fileVersion: string, - internalName: string, - legalCopyright: string, - legalTrademark: string, - originalFileName: string, - productName: string, - productVersion: string, - assemblyVersion: Version) as this = + new + ( + isDll: bool, + comments: string, + companyName: string, + fileDescription: string, + fileVersion: string, + internalName: string, + legalCopyright: string, + legalTrademark: string, + originalFileName: string, + productName: string, + productVersion: string, + assemblyVersion: Version + ) as this = VersionResourceSerializer() + then this._isDll <- isDll this._commentsContents <- comments @@ -620,7 +620,7 @@ type VersionResourceSerializer() = static member private PadKeyLen(cb: int) = VersionResourceSerializer.PadToDword(cb + 3 * sizeof) - 3 * sizeof - static member private PadToDword(cb: int) = cb + 3 &&& ~~~ 3 + static member private PadToDword(cb: int) = cb + 3 &&& ~~~3 static member val private HDRSIZE = (int (3 * sizeof)) with get, set @@ -667,7 +667,7 @@ type VersionResourceSerializer() = let mutable (sum: int) = 0 for verString in this.GetVerStrings() do - sum <- sum + 3 &&& ~~~ 3 + sum <- sum + 3 &&& ~~~3 sum <- sum + VersionResourceSerializer.SizeofVerString(verString.Key, verString.Value) sum @@ -801,7 +801,7 @@ type VersionResourceSerializer() = for entry in this.GetVerStrings() do let mutable writerPos = writer.BaseStream.Position - writer.Write(Array.zeroCreate (int ((writerPos + 3L) &&& ~~~ 3L - writerPos)): byte[]) + writer.Write(Array.zeroCreate (int ((writerPos + 3L) &&& ~~~3L - writerPos)): byte[]) Debug.Assert(entry.Value <> Unchecked.defaultof<_>) VersionResourceSerializer.WriteVersionString(entry, writer) @@ -861,7 +861,7 @@ type Win32ResourceConversions() = let mutable (i: uint16) = 0us while (i < count) do - resStream.Position <- resStream.Position + 3L &&& ~~~ 3L + resStream.Position <- resStream.Position + 3L &&& ~~~3L resWriter.Write iconDirEntries[(int i)].dwBytesInRes resWriter.Write 0x00000020u resWriter.Write 0xFFFFus @@ -878,7 +878,7 @@ type Win32ResourceConversions() = i <- i + 1us let mutable (RT_GROUP_ICON: WORD) = (RT_ICON + 11us) - resStream.Position <- resStream.Position + 3L &&& ~~~ 3L + resStream.Position <- resStream.Position + 3L &&& ~~~3L resWriter.Write(uint32 (3 * sizeof + int count * 14)) resWriter.Write 0x00000020u resWriter.Write 0xFFFFus @@ -933,7 +933,7 @@ type Win32ResourceConversions() = let comments = (defaultArg comments) Unchecked.defaultof<_> let companyName = (defaultArg companyName) Unchecked.defaultof<_> let mutable resWriter = new BinaryWriter(resStream, Encoding.Unicode) - resStream.Position <- resStream.Position + 3L &&& ~~~ 3L + resStream.Position <- resStream.Position + 3L &&& ~~~3L let mutable (RT_VERSION: DWORD) = 16u let mutable ver = @@ -970,7 +970,7 @@ type Win32ResourceConversions() = Debug.Assert(resStream.Position - startPos = int64 dataSize + int64 headerSize) static member AppendManifestToResourceStream(resStream: Stream, manifestStream: Stream, isDll: bool) = - resStream.Position <- resStream.Position + 3L &&& ~~~ 3L (* ERROR UnknownPrefixOperator "~" *) + resStream.Position <- resStream.Position + 3L &&& ~~~3L (* ERROR UnknownPrefixOperator "~" *) let mutable (RT_MANIFEST: WORD) = 24us let mutable resWriter = new BinaryWriter(resStream) resWriter.Write(uint32 manifestStream.Length) diff --git a/src/Compiler/AbstractIL/ilread.fs b/src/Compiler/AbstractIL/ilread.fs index 14af625419b..4f280f8ad29 100644 --- a/src/Compiler/AbstractIL/ilread.fs +++ b/src/Compiler/AbstractIL/ilread.fs @@ -4180,16 +4180,8 @@ and seekReadTopExportedTypes (ctxt: ILMetadataReader) = // Note, pectxtEager and pevEager must not be captured by the results of this function let openMetadataReader - ( - fileName, - mdfile: BinaryFile, - metadataPhysLoc, - peinfo, - pectxtEager: PEReader, - pevEager, - pectxtCaptured, - reduceMemoryUsage - ) = + (fileName, mdfile: BinaryFile, metadataPhysLoc, peinfo, pectxtEager: PEReader, pevEager, pectxtCaptured, reduceMemoryUsage) + = let mdv = mdfile.GetView() let magic = seekReadUInt16AsInt32 mdv metadataPhysLoc diff --git a/src/Compiler/AbstractIL/ilreflect.fs b/src/Compiler/AbstractIL/ilreflect.fs index 45c0652c59d..6151c28b8f0 100644 --- a/src/Compiler/AbstractIL/ilreflect.fs +++ b/src/Compiler/AbstractIL/ilreflect.fs @@ -290,10 +290,7 @@ type OpCode with member opcode.RefEmitName = match opcode.Name with | null -> "" - | name -> - (string (Char.ToUpper(name[0])) + name[1..]) - .Replace(".", "_") - .Replace("_i4", "_I4") + | name -> (string (Char.ToUpper(name[0])) + name[1..]).Replace(".", "_").Replace("_i4", "_I4") type ILGenerator with @@ -713,7 +710,7 @@ let rec convTypeSpec cenv emEnv preferCreated (tspec: ILTypeSpec) = and convTypeAux cenv emEnv preferCreated ty = match ty with - | ILType.Void -> !! Type.GetType("System.Void") + | ILType.Void -> !!Type.GetType("System.Void") | ILType.Array(shape, eltType) -> let baseT = convTypeAux cenv emEnv preferCreated eltType let nDims = shape.Rank @@ -1491,7 +1488,7 @@ let rec emitInstr cenv (modB: ModuleBuilder) emEnv (ilG: ILGenerator) instr = ilG.EmitAndLog(OpCodes.Ldelema, convType cenv emEnv ty) else let arrayTy = convType cenv emEnv (ILType.Array(shape, ty)) - let elemTy = !! arrayTy.GetElementType() + let elemTy = !!arrayTy.GetElementType() let argTys = Array.create shape.Rank typeof let retTy = elemTy.MakeByRefType() @@ -1517,7 +1514,7 @@ let rec emitInstr cenv (modB: ModuleBuilder) emEnv (ilG: ILGenerator) instr = ilG.EmitAndLog(OpCodes.Stelem, convType cenv emEnv ty) else let arrayTy = convType cenv emEnv (ILType.Array(shape, ty)) - let elemTy = !! arrayTy.GetElementType() + let elemTy = !!arrayTy.GetElementType() let meth = modB.GetArrayMethodAndLog( @@ -2497,7 +2494,7 @@ let mkDynamicAssemblyAndModule (assemblyName: string, optimize, collectible) = let daType = typeof let daCtor = - !! daType.GetConstructor([| typeof |]) + !!daType.GetConstructor([| typeof |]) let daBuilder = CustomAttributeBuilder( diff --git a/src/Compiler/AbstractIL/ilsupp.fs b/src/Compiler/AbstractIL/ilsupp.fs index 513d14d9f51..cd30137faaf 100644 --- a/src/Compiler/AbstractIL/ilsupp.fs +++ b/src/Compiler/AbstractIL/ilsupp.fs @@ -653,8 +653,7 @@ let unlinkResource (ulLinkedResourceBaseRVA: int32) (pbLinkedResource: byte[]) = for i = 0 to (nResNodes - 1) do size <- size - + pResNodes[i] - .Save(ulLinkedResourceBaseRVA, pbLinkedResource, Unchecked.defaultof, 0) + + pResNodes[i].Save(ulLinkedResourceBaseRVA, pbLinkedResource, Unchecked.defaultof, 0) let pResBuffer = Bytes.zeroCreate size @@ -670,7 +669,6 @@ let unlinkResource (ulLinkedResourceBaseRVA: int32) (pbLinkedResource: byte[]) = for i = 0 to (nResNodes - 1) do resBufferOffset <- resBufferOffset - + pResNodes[i] - .Save(ulLinkedResourceBaseRVA, pbLinkedResource, pResBuffer, resBufferOffset) + + pResNodes[i].Save(ulLinkedResourceBaseRVA, pbLinkedResource, pResBuffer, resBufferOffset) pResBuffer diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index 22b603d211a..52cb3c0d61a 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -3083,9 +3083,7 @@ let TcComputationExpression (cenv: TcFileState) env (overallTy: OverallTy) tpenv TranslateComputationExpression ceenv CompExprTranslationPass.Initial hasCustomOperations (LazyWithContext.NotLazy([], env)) comp id let mDelayOrQuoteOrRun = - mBuilderVal - .NoteSourceConstruct(NotedSourceConstruct.DelayOrQuoteOrRun) - .MakeSynthetic() + mBuilderVal.NoteSourceConstruct(NotedSourceConstruct.DelayOrQuoteOrRun).MakeSynthetic() // Add a call to 'Delay' if the method is present let delayedExpr = diff --git a/src/Compiler/CodeGen/EraseUnions.fs b/src/Compiler/CodeGen/EraseUnions.fs index e841010c837..18eaed4be6f 100644 --- a/src/Compiler/CodeGen/EraseUnions.fs +++ b/src/Compiler/CodeGen/EraseUnions.fs @@ -742,12 +742,14 @@ let mkMethodsAndPropertiesForFields basicProps, basicMethods let convAlternativeDef - (addMethodGeneratedAttrs, - addPropertyGeneratedAttrs, - addPropertyNeverAttrs, - addFieldGeneratedAttrs, - addFieldNeverAttrs, - mkDebuggerTypeProxyAttribute) + ( + addMethodGeneratedAttrs, + addPropertyGeneratedAttrs, + addPropertyNeverAttrs, + addFieldGeneratedAttrs, + addFieldNeverAttrs, + mkDebuggerTypeProxyAttribute + ) (g: TcGlobals) num (td: ILTypeDef) @@ -1255,12 +1257,14 @@ let convAlternativeDef baseMakerMeths, baseMakerProps, altUniqObjMeths, typeDefs, altDebugTypeDefs, altNullaryFields let mkClassUnionDef - (addMethodGeneratedAttrs, - addPropertyGeneratedAttrs, - addPropertyNeverAttrs, - addFieldGeneratedAttrs: ILFieldDef -> ILFieldDef, - addFieldNeverAttrs: ILFieldDef -> ILFieldDef, - mkDebuggerTypeProxyAttribute) + ( + addMethodGeneratedAttrs, + addPropertyGeneratedAttrs, + addPropertyNeverAttrs, + addFieldGeneratedAttrs: ILFieldDef -> ILFieldDef, + addFieldNeverAttrs: ILFieldDef -> ILFieldDef, + mkDebuggerTypeProxyAttribute + ) (g: TcGlobals) tref (td: ILTypeDef) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 791fed38a3d..1be3b7be3a2 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -1510,18 +1510,7 @@ let GetMethodSpecForMemberVal cenv (memberInfo: ValMemberInfo) (vref: ValRef) = /// Determine how a top-level value is represented, when representing as a field, by computing an ILFieldSpec let ComputeFieldSpecForVal - ( - optIntraAssemblyInfo: IlxGenIntraAssemblyInfo option, - isInteractive, - g, - ilTyForProperty, - vspec: Val, - nm, - m, - cloc, - ilTy, - ilGetterMethRef - ) = + (optIntraAssemblyInfo: IlxGenIntraAssemblyInfo option, isInteractive, g, ilTyForProperty, vspec: Val, nm, m, cloc, ilTy, ilGetterMethRef) = assert vspec.IsCompiledAsTopLevel let generate () = @@ -1615,14 +1604,8 @@ let IsFSharpValCompiledAsMethod g (v: Val) = /// method (possibly and instance method). Otherwise it gets represented as a /// static field and property. let ComputeStorageForValWithValReprInfo - ( - cenv, - optIntraAssemblyInfo: IlxGenIntraAssemblyInfo option, - isInteractive, - optShadowLocal, - vref: ValRef, - cloc - ) = + (cenv, optIntraAssemblyInfo: IlxGenIntraAssemblyInfo option, isInteractive, optShadowLocal, vref: ValRef, cloc) + = if isUnitTy cenv.g vref.Type @@ -2420,9 +2403,7 @@ and AssemblyBuilder(cenv: cenv, anonTypeTable: AnonTypeGenerationTable) as mgbuf anonTypeTable.GrabExtraBindingsToGenerate() member _.AddTypeDef(tref: ILTypeRef, tdef, eliminateIfEmpty, addAtEnd, tdefDiscards) = - gtdefs - .FindNestedTypeDefsBuilder(tref.Enclosing) - .AddTypeDef(tdef, eliminateIfEmpty, addAtEnd, tdefDiscards) + gtdefs.FindNestedTypeDefsBuilder(tref.Enclosing).AddTypeDef(tdef, eliminateIfEmpty, addAtEnd, tdefDiscards) member _.FindNestedTypeDefBuilder(tref: ILTypeRef) = gtdefs.FindNestedTypeDefBuilder(tref) @@ -5936,11 +5917,7 @@ and renameMethodDef nameOfOverridingMethod (mdef: ILMethodDef) = mdef.With(name = nameOfOverridingMethod) and fixupMethodImplFlags (mdef: ILMethodDef) = - mdef - .WithAccess(ILMemberAccess.Private) - .WithHideBySig() - .WithFinal(true) - .WithNewSlot + mdef.WithAccess(ILMemberAccess.Private).WithHideBySig().WithFinal(true).WithNewSlot and fixupStaticAbstractSlotFlags (mdef: ILMethodDef) = mdef.WithHideBySig(true) @@ -6464,15 +6441,17 @@ and GenSequenceExpr cenv (cgbuf: CodeGenBuffer) eenvouter - (nextEnumeratorValRef: ValRef, - pcvref: ValRef, - currvref: ValRef, - stateVars, - generateNextExpr, - closeExpr, - checkCloseExpr: Expr, - seqElemTy, - m) + ( + nextEnumeratorValRef: ValRef, + pcvref: ValRef, + currvref: ValRef, + stateVars, + generateNextExpr, + closeExpr, + checkCloseExpr: Expr, + seqElemTy, + m + ) sequel = @@ -6613,8 +6592,7 @@ and GenSequenceExpr |> AddNonUserCompilerGeneratedAttribs g let ilCtorBody = - mkILSimpleStorageCtor(Some ilCloBaseTy.TypeSpec, ilCloTyInner, [], [], ILMemberAccess.Assembly, None, eenvouter.imports) - .MethodBody + mkILSimpleStorageCtor(Some ilCloBaseTy.TypeSpec, ilCloTyInner, [], [], ILMemberAccess.Assembly, None, eenvouter.imports).MethodBody let cloMethods = [ @@ -6660,18 +6638,19 @@ and GenSequenceExpr /// Generate the class for a closure type definition and GenClosureTypeDefs cenv - (tref: ILTypeRef, - ilGenParams, - attrs, - ilCloAllFreeVars, - ilCloLambdas, - ilCtorBody, - mdefs, - mimpls, - ext, - ilIntfTys, - cloSpec: IlxClosureSpec option) - = + ( + tref: ILTypeRef, + ilGenParams, + attrs, + ilCloAllFreeVars, + ilCloLambdas, + ilCtorBody, + mdefs, + mimpls, + ext, + ilIntfTys, + cloSpec: IlxClosureSpec option + ) = let g = cenv.g let cloInfo = @@ -6699,8 +6678,7 @@ and GenClosureTypeDefs let cctor = mkILClassCtor (MethodBody.IL(notlazy ilCode)) let ilFieldDef = - mkILStaticField(fspec.Name, fspec.FormalType, None, None, ILMemberAccess.Assembly) - .WithInitOnly(true) + mkILStaticField(fspec.Name, fspec.FormalType, None, None, ILMemberAccess.Assembly).WithInitOnly(true) (cctor :: mdefs), [ ilFieldDef ] else @@ -6754,9 +6732,7 @@ and GenStaticDelegateClosureTypeDefs // Remove the redundant constructor. tdefs |> List.map (fun td -> - td - .WithAbstract(true) - .With(methods = mkILMethodsFromArray (td.Methods.AsArray() |> Array.filter (fun m -> not m.IsConstructor)))) + td.WithAbstract(true).With(methods = mkILMethodsFromArray (td.Methods.AsArray() |> Array.filter (fun m -> not m.IsConstructor)))) and GenGenericParams cenv eenv tps = tps |> DropErasedTypars |> List.map (GenGenericParam cenv eenv) @@ -8564,8 +8540,7 @@ and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt = let ilMethodBody = MethodBody.IL(ilLazyCode) - (mkILStaticMethod ([], ilGetterMethSpec.Name, access, [], mkILReturn ilTy, ilMethodBody)) - .WithSpecialName + (mkILStaticMethod ([], ilGetterMethSpec.Name, access, [], mkILReturn ilTy, ilMethodBody)).WithSpecialName |> AddNonUserCompilerGeneratedAttribs g CountMethodDef() @@ -8742,8 +8717,7 @@ and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt = let body = mkMethodBody (true, [], 2, nonBranchingInstrsToCode [ mkNormalLdsfld fspec ], None, eenv.imports) - mkILStaticMethod([], ilGetterMethRef.Name, access, [], mkILReturn fty, body) - .WithSpecialName + mkILStaticMethod([], ilGetterMethRef.Name, access, [], mkILReturn fty, body).WithSpecialName cgbuf.mgbuf.AddMethodDef(ilTypeRefForProperty, getterMethod) @@ -9173,26 +9147,27 @@ and GenMethodForBinding cenv mgbuf eenv - (v: Val, - mspec, - hasWitnessEntry, - generateWitnessArgs, - access, - ctps, - mtps, - witnessInfos, - curriedArgInfos, - paramInfos, - argTys, - retInfo, - valReprInfo, - ctorThisValOpt, - baseValOpt, - methLambdaTypars, - methLambdaVars, - methLambdaBody, - returnTy) - = + ( + v: Val, + mspec, + hasWitnessEntry, + generateWitnessArgs, + access, + ctps, + mtps, + witnessInfos, + curriedArgInfos, + paramInfos, + argTys, + retInfo, + valReprInfo, + ctorThisValOpt, + baseValOpt, + methLambdaTypars, + methLambdaVars, + methLambdaBody, + returnTy + ) = let g = cenv.g let m = v.Range @@ -10181,18 +10156,8 @@ and CreatePermissionSets cenv eenv (securityAttributes: Attrib list) = /// Generate a static class at the given cloc and GenTypeDefForCompLoc - ( - cenv, - eenv, - mgbuf: AssemblyBuilder, - cloc, - hidden, - accessibility: Accessibility, - attribs, - initTrigger, - eliminateIfEmpty, - addAtEnd - ) = + (cenv, eenv, mgbuf: AssemblyBuilder, cloc, hidden, accessibility: Accessibility, attribs, initTrigger, eliminateIfEmpty, addAtEnd) + = let g = cenv.g let tref = TypeRefForCompLoc cloc @@ -10274,8 +10239,7 @@ and CodeGenInitMethod cenv (cgbuf: CodeGenBuffer) eenv tref (codeGenInitFunc: Co let ilReturn = mkILReturn ILType.Void let method = - (mkILNonGenericStaticMethod (eenv.staticInitializationName, access, [], ilReturn, ilBody)) - .WithSpecialName + (mkILNonGenericStaticMethod (eenv.staticInitializationName, access, [], ilReturn, ilBody)).WithSpecialName cgbuf.mgbuf.AddMethodDef(tref, method) CountMethodDef() @@ -12208,14 +12172,14 @@ let LookupGeneratedValue (cenv: cenv) (ctxt: ExecutionContext) eenv (v: Val) = if hasLiteralAttr then let staticTy = ctxt.LookupTypeRef fspec.DeclaringTypeRef // Checked: This FieldInfo (FieldBuilder) supports GetValue(). - (!! staticTy.GetField(fspec.Name)).GetValue(null: obj MaybeNull) + (!!staticTy.GetField(fspec.Name)).GetValue(null: obj MaybeNull) else let staticTy = ctxt.LookupTypeRef ilContainerTy.TypeRef // We can't call .Invoke on the ILMethodRef's MethodInfo, // because it is the MethodBuilder and that does not support Invoke. // Rather, we look for the getter MethodInfo from the built type and .Invoke on that. let methInfo = - !! staticTy.GetMethod(ilGetterMethRef.Name, BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic) + !!staticTy.GetMethod(ilGetterMethRef.Name, BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic) methInfo.Invoke(null, null) @@ -12228,7 +12192,7 @@ let LookupGeneratedValue (cenv: cenv) (ctxt: ExecutionContext) eenv (v: Val) = // because it is the MethodBuilder and that does not support Invoke. // Rather, we look for the getter MethodInfo from the built type and .Invoke on that. let methInfo = - !! staticTy.GetMethod(ilGetterMethSpec.Name, BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic) + !!staticTy.GetMethod(ilGetterMethSpec.Name, BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic) methInfo.Invoke(null, null) @@ -12255,14 +12219,14 @@ let SetGeneratedValue (ctxt: ExecutionContext) eenv isForced (v: Val) (value: ob let staticTy = ctxt.LookupTypeRef fspec.DeclaringTypeRef let fieldInfo = - !! staticTy.GetField(fspec.Name, BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic) + !!staticTy.GetField(fspec.Name, BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic) fieldInfo.SetValue(null, value) else let staticTy = ctxt.LookupTypeRef ilSetterMethRef.DeclaringTypeRef let methInfo = - !! staticTy.GetMethod(ilSetterMethRef.Name, BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic) + !!staticTy.GetMethod(ilSetterMethRef.Name, BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic) methInfo.Invoke(null, [| value |]) |> ignore | _ -> () diff --git a/src/Compiler/CodeGen/IlxGenSupport.fs b/src/Compiler/CodeGen/IlxGenSupport.fs index 2583e93fe79..0799dbde60a 100644 --- a/src/Compiler/CodeGen/IlxGenSupport.fs +++ b/src/Compiler/CodeGen/IlxGenSupport.fs @@ -83,12 +83,8 @@ let getFieldMemberAccess = | EncapsulatedProperties -> ILMemberAccess.Private let mkLocalPrivateAttributeWithPropertyConstructors - ( - g: TcGlobals, - name: string, - attrProperties: (string * ILType) list option, - codegenStyle: AttrDataGenerationStyle - ) = + (g: TcGlobals, name: string, attrProperties: (string * ILType) list option, codegenStyle: AttrDataGenerationStyle) + = let ilTypeRef = mkILTyRef (ILScopeRef.Local, name) let ilTy = mkILFormalNamedTy ILBoxity.AsObject ilTypeRef [] @@ -227,8 +223,7 @@ let mkLocalPrivateInt32Enum (g: TcGlobals, tref: ILTypeRef, values: (string * in |> Array.map (fun (name, value) -> mkILStaticLiteralField (name, ilType, ILFieldInit.Int32 value, None, ILMemberAccess.Public)) |> Array.append [| - (mkILInstanceField ("value__", g.ilg.typ_Int32, None, ILMemberAccess.Public)) - .WithSpecialName(true) + (mkILInstanceField ("value__", g.ilg.typ_Int32, None, ILMemberAccess.Public)).WithSpecialName(true) |] |> Array.toList @@ -290,9 +285,7 @@ let GetDynamicallyAccessedMemberTypes (g: TcGlobals) = ("Interfaces", 8192) |] - (mkLocalPrivateInt32Enum (g, tref, values)) - .WithSerializable(true) - .WithSealed(true)) + (mkLocalPrivateInt32Enum (g, tref, values)).WithSerializable(true).WithSealed(true)) ) ILType.Value(mkILNonGenericTySpec (tref)) diff --git a/src/Compiler/DependencyManager/AssemblyResolveHandler.fs b/src/Compiler/DependencyManager/AssemblyResolveHandler.fs index 1f20caa392e..75f8797341d 100644 --- a/src/Compiler/DependencyManager/AssemblyResolveHandler.fs +++ b/src/Compiler/DependencyManager/AssemblyResolveHandler.fs @@ -15,25 +15,24 @@ type AssemblyResolutionProbe = delegate of Unit -> seq /// Type that encapsulates AssemblyResolveHandler for managed packages type AssemblyResolveHandlerCoreclr(assemblyProbingPaths: AssemblyResolutionProbe option) as this = let loadContextType = - !! Type.GetType("System.Runtime.Loader.AssemblyLoadContext, System.Runtime.Loader", false) + !!Type.GetType("System.Runtime.Loader.AssemblyLoadContext, System.Runtime.Loader", false) let loadFromAssemblyPathMethod = - !! loadContextType.GetMethod("LoadFromAssemblyPath", [| typeof |]) + !!loadContextType.GetMethod("LoadFromAssemblyPath", [| typeof |]) - let eventInfo = !! loadContextType.GetEvent("Resolving") + let eventInfo = !!loadContextType.GetEvent("Resolving") let handler, defaultAssemblyLoadContext = let ti = typeof let gmi = - !! ti.GetMethod("ResolveAssemblyNetStandard", BindingFlags.Instance ||| BindingFlags.NonPublic) + !!ti.GetMethod("ResolveAssemblyNetStandard", BindingFlags.Instance ||| BindingFlags.NonPublic) let mi = gmi.MakeGenericMethod(loadContextType) let del = Delegate.CreateDelegate(!!eventInfo.EventHandlerType, this, mi) let prop = - (!! loadContextType.GetProperty("Default", BindingFlags.Static ||| BindingFlags.Public)) - .GetValue(null, null) + (!!loadContextType.GetProperty("Default", BindingFlags.Static ||| BindingFlags.Public)).GetValue(null, null) del, prop @@ -41,7 +40,7 @@ type AssemblyResolveHandlerCoreclr(assemblyProbingPaths: AssemblyResolutionProbe member _.ResolveAssemblyNetStandard (ctxt: 'T) (assemblyName: AssemblyName) : Assembly = let loadAssembly path = - !! loadFromAssemblyPathMethod.Invoke(ctxt, [| path |]) :?> Assembly + !!loadFromAssemblyPathMethod.Invoke(ctxt, [| path |]) :?> Assembly let assemblyPaths = match assemblyProbingPaths with diff --git a/src/Compiler/DependencyManager/NativeDllResolveHandler.fs b/src/Compiler/DependencyManager/NativeDllResolveHandler.fs index 3c6bbe0a900..058dbedd0b7 100644 --- a/src/Compiler/DependencyManager/NativeDllResolveHandler.fs +++ b/src/Compiler/DependencyManager/NativeDllResolveHandler.fs @@ -72,9 +72,9 @@ type internal NativeDllResolveHandlerCoreClr(nativeProbingRoots: NativeResolutio let nativeLibraryTryLoad = let nativeLibraryType: Type = - !! Type.GetType("System.Runtime.InteropServices.NativeLibrary, System.Runtime.InteropServices", false) + !!Type.GetType("System.Runtime.InteropServices.NativeLibrary, System.Runtime.InteropServices", false) - !! nativeLibraryType.GetMethod("TryLoad", [| typeof; typeof.MakeByRefType() |]) + !!nativeLibraryType.GetMethod("TryLoad", [| typeof; typeof.MakeByRefType() |]) let loadNativeLibrary path = let arguments = [| path :> obj; IntPtr.Zero :> obj |] @@ -157,13 +157,12 @@ type internal NativeDllResolveHandlerCoreClr(nativeProbingRoots: NativeResolutio // netstandard 2.1 has this property, unfortunately we don't build with that yet //public event Func ResolvingUnmanagedDll let assemblyLoadContextType: Type = - !! Type.GetType("System.Runtime.Loader.AssemblyLoadContext, System.Runtime.Loader", false) + !!Type.GetType("System.Runtime.Loader.AssemblyLoadContext, System.Runtime.Loader", false) let eventInfo, handler, defaultAssemblyLoadContext = - !! assemblyLoadContextType.GetEvent("ResolvingUnmanagedDll"), + !!assemblyLoadContextType.GetEvent("ResolvingUnmanagedDll"), Func resolveUnmanagedDll, - (!! assemblyLoadContextType.GetProperty("Default", BindingFlags.Static ||| BindingFlags.Public)) - .GetValue(null, null) + (!!assemblyLoadContextType.GetProperty("Default", BindingFlags.Static ||| BindingFlags.Public)).GetValue(null, null) do eventInfo.AddEventHandler(defaultAssemblyLoadContext, handler) diff --git a/src/Compiler/Driver/CompilerConfig.fs b/src/Compiler/Driver/CompilerConfig.fs index cf875be4959..cccbcb15810 100644 --- a/src/Compiler/Driver/CompilerConfig.fs +++ b/src/Compiler/Driver/CompilerConfig.fs @@ -218,7 +218,7 @@ type VersionFlag = else use fs = FileSystem.OpenFileForReadShim(s) use is = new StreamReader(fs) - !! is.ReadLine() + !!is.ReadLine() | VersionNone -> "0.0.0.0" /// Represents a reference to an assembly. May be backed by a real assembly on disk, or a cross-project @@ -680,7 +680,7 @@ type TcConfigBuilder = yield! (tcConfigB.referencedDLLs - |> Seq.map (fun ref -> !! Path.GetDirectoryName(ref.Text))) + |> Seq.map (fun ref -> !!Path.GetDirectoryName(ref.Text))) tcConfigB.implicitIncludeDir } @@ -1203,7 +1203,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = ComputeMakePathAbsolute data.implicitIncludeDir primaryAssemblyFilename try - let clrRoot = Some(!! Path.GetDirectoryName(FileSystem.GetFullPathShim fileName)) + let clrRoot = Some(!!Path.GetDirectoryName(FileSystem.GetFullPathShim fileName)) clrRoot, data.legacyReferenceResolver.Impl.HighestInstalledNetFrameworkVersion() with e -> // We no longer expect the above to fail but leaving this just in case @@ -1504,7 +1504,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = /// 'framework' reference set that is potentially shared across multiple compilations. member tcConfig.IsSystemAssembly(fileName: string) = try - let dirName = !! Path.GetDirectoryName(fileName) + let dirName = !!Path.GetDirectoryName(fileName) let baseName = FileSystemUtils.fileNameWithoutExtension fileName FileSystem.FileExistsShim fileName diff --git a/src/Compiler/Driver/CompilerDiagnostics.fs b/src/Compiler/Driver/CompilerDiagnostics.fs index 7124c5ce1ac..9eb56d1cc54 100644 --- a/src/Compiler/Driver/CompilerDiagnostics.fs +++ b/src/Compiler/Driver/CompilerDiagnostics.fs @@ -721,10 +721,7 @@ type Exception with os.AppendString(SeeAlsoE().Format(stringOfRange m2)) | ConstraintSolverMissingConstraint(denv, tpr, tpc, m, m2) -> - os.AppendString( - ConstraintSolverMissingConstraintE() - .Format(NicePrint.stringOfTyparConstraint denv (tpr, tpc)) - ) + os.AppendString(ConstraintSolverMissingConstraintE().Format(NicePrint.stringOfTyparConstraint denv (tpr, tpc))) if m.StartLine <> m2.StartLine then os.AppendString(SeeAlsoE().Format(stringOfRange m)) @@ -1525,10 +1522,7 @@ type Exception with foundInContext |> ignore // suppress unused variable warning in RELEASE #endif let fix (s: string) = - s - .Replace(SR.GetString("FixKeyword"), "") - .Replace(SR.GetString("FixSymbol"), "") - .Replace(SR.GetString("FixReplace"), "") + s.Replace(SR.GetString("FixKeyword"), "").Replace(SR.GetString("FixSymbol"), "").Replace(SR.GetString("FixReplace"), "") let tokenNames = ctxt.ShiftTokens diff --git a/src/Compiler/Driver/CompilerOptions.fs b/src/Compiler/Driver/CompilerOptions.fs index 7c4c81efd40..cdeda6b6566 100644 --- a/src/Compiler/Driver/CompilerOptions.fs +++ b/src/Compiler/Driver/CompilerOptions.fs @@ -248,7 +248,7 @@ module ResponseFile = let data = seq { while not reader.EndOfStream do - !! reader.ReadLine() + !!reader.ReadLine() } |> Seq.choose parseLine |> List.ofSeq @@ -701,7 +701,7 @@ let SetEmbedAllSourceSwitch (tcConfigB: TcConfigBuilder) switch = tcConfigB.embedAllSource <- false let setOutFileName tcConfigB (path: string) = - let outputDir = !! Path.GetDirectoryName(path) + let outputDir = !!Path.GetDirectoryName(path) tcConfigB.outputDir <- Some outputDir tcConfigB.outputFile <- Some path diff --git a/src/Compiler/Driver/CreateILModule.fs b/src/Compiler/Driver/CreateILModule.fs index 5ed836631d7..6c7dfeb31b6 100644 --- a/src/Compiler/Driver/CreateILModule.fs +++ b/src/Compiler/Driver/CreateILModule.fs @@ -523,7 +523,7 @@ module MainModuleBuilder = $"%d{fileVersionInfo.Major}.%d{fileVersionInfo.Minor}.%d{fileVersionInfo.Build}.%d{fileVersionInfo.Revision}") ("ProductVersion", productVersionString) match tcConfig.outputFile with - | Some f -> ("OriginalFilename", !! Path.GetFileName(f)) + | Some f -> ("OriginalFilename", !!Path.GetFileName(f)) | None -> () yield! FindAttribute "Comments" "System.Reflection.AssemblyDescriptionAttribute" yield! FindAttribute "FileDescription" "System.Reflection.AssemblyTitleAttribute" diff --git a/src/Compiler/Driver/FxResolver.fs b/src/Compiler/Driver/FxResolver.fs index dfeff2cabf3..5f55f6abe97 100644 --- a/src/Compiler/Driver/FxResolver.fs +++ b/src/Compiler/Driver/FxResolver.fs @@ -98,13 +98,9 @@ type internal FxResolver p.WaitForExit() #if DEBUG if workingDir.IsSome then - FileSystem - .OpenFileForWriteShim(Path.Combine(workingDir.Value, "StandardOutput.txt")) - .WriteAllLines(outputList) + FileSystem.OpenFileForWriteShim(Path.Combine(workingDir.Value, "StandardOutput.txt")).WriteAllLines(outputList) - FileSystem - .OpenFileForWriteShim(Path.Combine(workingDir.Value, "StandardError.txt")) - .WriteAllLines(errorsList) + FileSystem.OpenFileForWriteShim(Path.Combine(workingDir.Value, "StandardError.txt")).WriteAllLines(errorsList) #endif p.ExitCode, outputList.ToArray(), errorsList.ToArray() else @@ -284,10 +280,7 @@ type internal FxResolver try let asm = typeof>.Assembly - if - (!!asm.FullName) - .StartsWith("System.ValueTuple", StringComparison.OrdinalIgnoreCase) - then + if (!!asm.FullName).StartsWith("System.ValueTuple", StringComparison.OrdinalIgnoreCase) then Some asm.Location else let valueTuplePath = @@ -498,7 +491,7 @@ type internal FxResolver try if FileSystem.FileExistsShim(reference) then // Reference is a path to a file on disk - !! Path.GetFileNameWithoutExtension(reference), reference + !!Path.GetFileNameWithoutExtension(reference), reference else // Reference is a SimpleAssembly name reference, frameworkPathFromSimpleName reference diff --git a/src/Compiler/Driver/OptimizeInputs.fs b/src/Compiler/Driver/OptimizeInputs.fs index 36eae5734ce..c79af5b33bc 100644 --- a/src/Compiler/Driver/OptimizeInputs.fs +++ b/src/Compiler/Driver/OptimizeInputs.fs @@ -28,9 +28,7 @@ let PrintWholeAssemblyImplementation (tcConfig: TcConfig) outfile header expr = let fileName = outfile + ".terms" use f = - FileSystem - .OpenFileForWriteShim(fileName + "-" + string showTermFileCount + "-" + header, FileMode.Create) - .GetWriter() + FileSystem.OpenFileForWriteShim(fileName + "-" + string showTermFileCount + "-" + header, FileMode.Create).GetWriter() showTermFileCount <- showTermFileCount + 1 LayoutRender.outL f (Display.squashTo 192 (DebugPrint.implFilesL expr)) @@ -306,17 +304,8 @@ let optimizeFilesSequentially optEnv (phases: PhaseInfo[]) implFiles = results, optEnvFirstLoop let ApplyAllOptimizations - ( - tcConfig: TcConfig, - tcGlobals, - tcVal, - outfile, - importMap, - isIncrementalFragment, - optEnv, - ccu: CcuThunk, - implFiles - ) = + (tcConfig: TcConfig, tcGlobals, tcVal, outfile, importMap, isIncrementalFragment, optEnv, ccu: CcuThunk, implFiles) + = // NOTE: optEnv - threads through // // Always optimize once - the results of this step give the x-module optimization @@ -562,15 +551,7 @@ let CreateIlxAssemblyGenerator (_tcConfig: TcConfig, tcImports: TcImports, tcGlo ilxGenerator let GenerateIlxCode - ( - ilxBackend, - isInteractiveItExpr, - tcConfig: TcConfig, - topAttrs: TopAttribs, - optimizedImpls, - fragName, - ilxGenerator: IlxAssemblyGenerator - ) = + (ilxBackend, isInteractiveItExpr, tcConfig: TcConfig, topAttrs: TopAttribs, optimizedImpls, fragName, ilxGenerator: IlxAssemblyGenerator) = let mainMethodInfo = if diff --git a/src/Compiler/Driver/ParseAndCheckInputs.fs b/src/Compiler/Driver/ParseAndCheckInputs.fs index 975bfeef66f..6b7171b5697 100644 --- a/src/Compiler/Driver/ParseAndCheckInputs.fs +++ b/src/Compiler/Driver/ParseAndCheckInputs.fs @@ -352,7 +352,7 @@ type ModuleNamesDict = Map> /// Checks if a module name is already given and deduplicates the name if needed. let DeduplicateModuleName (moduleNamesDict: ModuleNamesDict) (fileName: string) (qualNameOfFile: QualifiedNameOfFile) = - let path = !! Path.GetDirectoryName(fileName) + let path = !!Path.GetDirectoryName(fileName) let path = if FileSystem.IsPathRootedShim path then @@ -433,7 +433,7 @@ let ParseInput "ParseAndCheckFile.parseFile" [| Activity.Tags.fileName, fileName - Activity.Tags.buildPhase, !! BuildPhase.Parse.ToString() + Activity.Tags.buildPhase, !!BuildPhase.Parse.ToString() Activity.Tags.userOpName, userOpName |> Option.defaultValue "" |] @@ -703,15 +703,8 @@ let checkInputFile (tcConfig: TcConfig) fileName = error (Error(FSComp.SR.buildInvalidSourceFileExtension (SanitizeFileName fileName tcConfig.implicitIncludeDir), rangeStartup)) let parseInputStreamAux - ( - tcConfig: TcConfig, - lexResourceManager, - fileName, - isLastCompiland, - diagnosticsLogger, - retryLocked, - stream: Stream - ) = + (tcConfig: TcConfig, lexResourceManager, fileName, isLastCompiland, diagnosticsLogger, retryLocked, stream: Stream) + = use reader = stream.GetReader(tcConfig.inputCodePage, retryLocked) // Set up the LexBuffer for the file @@ -722,14 +715,8 @@ let parseInputStreamAux ParseOneInputLexbuf(tcConfig, lexResourceManager, lexbuf, fileName, isLastCompiland, diagnosticsLogger) let parseInputSourceTextAux - ( - tcConfig: TcConfig, - lexResourceManager, - fileName, - isLastCompiland, - diagnosticsLogger, - sourceText: ISourceText - ) = + (tcConfig: TcConfig, lexResourceManager, fileName, isLastCompiland, diagnosticsLogger, sourceText: ISourceText) + = // Set up the LexBuffer for the file let lexbuf = UnicodeLexing.SourceTextAsLexbuf(not tcConfig.compilingFSharpCore, tcConfig.langVersion, tcConfig.strictIndentation, sourceText) @@ -751,15 +738,8 @@ let parseInputFileAux (tcConfig: TcConfig, lexResourceManager, fileName, isLastC /// Parse an input from stream let ParseOneInputStream - ( - tcConfig: TcConfig, - lexResourceManager, - fileName, - isLastCompiland, - diagnosticsLogger, - retryLocked, - stream: Stream - ) = + (tcConfig: TcConfig, lexResourceManager, fileName, isLastCompiland, diagnosticsLogger, retryLocked, stream: Stream) + = try parseInputStreamAux (tcConfig, lexResourceManager, fileName, isLastCompiland, diagnosticsLogger, retryLocked, stream) with RecoverableException exn -> @@ -768,14 +748,8 @@ let ParseOneInputStream /// Parse an input from source text let ParseOneInputSourceText - ( - tcConfig: TcConfig, - lexResourceManager, - fileName, - isLastCompiland, - diagnosticsLogger, - sourceText: ISourceText - ) = + (tcConfig: TcConfig, lexResourceManager, fileName, isLastCompiland, diagnosticsLogger, sourceText: ISourceText) + = try parseInputSourceTextAux (tcConfig, lexResourceManager, fileName, isLastCompiland, diagnosticsLogger, sourceText) with RecoverableException exn -> @@ -862,9 +836,11 @@ let ParseInputFiles (tcConfig: TcConfig, lexResourceManager, sourceFiles, diagno tcConfig.exiter.Exit 1 let ProcessMetaCommandsFromInput - (nowarnF: 'state -> range * string -> 'state, - hashReferenceF: 'state -> range * string * Directive -> 'state, - loadSourceF: 'state -> range * string -> unit) + ( + nowarnF: 'state -> range * string -> 'state, + hashReferenceF: 'state -> range * string * Directive -> 'state, + loadSourceF: 'state -> range * string -> unit + ) (tcConfig: TcConfigBuilder, inp: ParsedInput, pathOfMetaCommandSource, state0) = @@ -1520,16 +1496,18 @@ type NodeToTypeCheck = /// a callback functions that takes a `TcState` and will add the checked result to it. let CheckOneInputWithCallback (node: NodeToTypeCheck) - ((checkForErrors, - tcConfig: TcConfig, - tcImports: TcImports, - tcGlobals, - prefixPathOpt, - tcSink, - tcState: TcState, - input: ParsedInput, - _skipImplIfSigExists: bool): - (unit -> bool) * TcConfig * TcImports * TcGlobals * LongIdent option * TcResultsSink * TcState * ParsedInput * bool) + ( + (checkForErrors, + tcConfig: TcConfig, + tcImports: TcImports, + tcGlobals, + prefixPathOpt, + tcSink, + tcState: TcState, + input: ParsedInput, + _skipImplIfSigExists: bool): + (unit -> bool) * TcConfig * TcImports * TcGlobals * LongIdent option * TcResultsSink * TcState * ParsedInput * bool + ) : Cancellable> = cancellable { try @@ -1823,16 +1801,18 @@ let TransformDependencyGraph (graph: Graph, filePairs: FilePairMap) = /// Constructs a file dependency graph and type-checks the files in parallel where possible. let CheckMultipleInputsUsingGraphMode - ((ctok, checkForErrors, tcConfig: TcConfig, tcImports: TcImports, tcGlobals, prefixPathOpt, tcState, eagerFormat, inputs): - 'a * - (unit -> bool) * - TcConfig * - TcImports * - TcGlobals * - LongIdent option * - TcState * - (PhasedDiagnostic -> PhasedDiagnostic) * - ParsedInput list) + ( + (ctok, checkForErrors, tcConfig: TcConfig, tcImports: TcImports, tcGlobals, prefixPathOpt, tcState, eagerFormat, inputs): + 'a * + (unit -> bool) * + TcConfig * + TcImports * + TcGlobals * + LongIdent option * + TcState * + (PhasedDiagnostic -> PhasedDiagnostic) * + ParsedInput list + ) : FinalFileResult list * TcState = use cts = new CancellationTokenSource() @@ -1864,9 +1844,7 @@ let CheckMultipleInputsUsingGraphMode graph |> Graph.map (fun idx -> let friendlyFileName = - sourceFiles[idx] - .FileName.Replace(tcConfig.implicitIncludeDir, "") - .TrimStart([| '\\'; '/' |]) + sourceFiles[idx].FileName.Replace(tcConfig.implicitIncludeDir, "").TrimStart([| '\\'; '/' |]) (idx, friendlyFileName)) |> Graph.writeMermaidToFile graphFile) diff --git a/src/Compiler/Driver/ScriptClosure.fs b/src/Compiler/Driver/ScriptClosure.fs index 0e22231abb8..b8acfe76441 100644 --- a/src/Compiler/Driver/ScriptClosure.fs +++ b/src/Compiler/Driver/ScriptClosure.fs @@ -159,7 +159,7 @@ module ScriptPreprocessClosure = reduceMemoryUsage ) = - let projectDir = !! Path.GetDirectoryName(fileName) + let projectDir = !!Path.GetDirectoryName(fileName) let isInteractive = (codeContext = CodeContext.CompilationAndEvaluation) let isInvalidationSupported = (codeContext = CodeContext.Editing) @@ -259,12 +259,8 @@ module ScriptPreprocessClosure = [] let ApplyMetaCommandsFromInputToTcConfigAndGatherNoWarn - ( - tcConfig: TcConfig, - inp: ParsedInput, - pathOfMetaCommandSource, - dependencyProvider - ) = + (tcConfig: TcConfig, inp: ParsedInput, pathOfMetaCommandSource, dependencyProvider) + = let tcConfigB = tcConfig.CloneToBuilder() let mutable nowarns = [] @@ -460,7 +456,7 @@ module ScriptPreprocessClosure = let diagnosticsLogger = CapturingDiagnosticsLogger("FindClosureMetaCommands") use _ = UseDiagnosticsLogger diagnosticsLogger - let pathOfMetaCommandSource = !! Path.GetDirectoryName(fileName) + let pathOfMetaCommandSource = !!Path.GetDirectoryName(fileName) let preSources = tcConfig.GetAvailableLoadedSources() let tcConfigResult, noWarns = @@ -710,13 +706,8 @@ module ScriptPreprocessClosure = /// Given source file fileName, find the full load closure /// Used from fsi.fs and fsc.fs, for #load and command line let GetFullClosureOfScriptFiles - ( - tcConfig: TcConfig, - files: (string * range) list, - codeContext, - lexResourceManager: Lexhelp.LexResourceManager, - dependencyProvider - ) = + (tcConfig: TcConfig, files: (string * range) list, codeContext, lexResourceManager: Lexhelp.LexResourceManager, dependencyProvider) + = let mainFile, _mainFileRange = List.last files diff --git a/src/Compiler/Driver/StaticLinking.fs b/src/Compiler/Driver/StaticLinking.fs index 53916744622..3624ecef9b2 100644 --- a/src/Compiler/Driver/StaticLinking.fs +++ b/src/Compiler/Driver/StaticLinking.fs @@ -104,13 +104,8 @@ let debugStaticLinking = isEnvVarSet "FSHARP_DEBUG_STATIC_LINKING" #endif let StaticLinkILModules - ( - tcConfig: TcConfig, - ilGlobals, - tcImports, - ilxMainModule, - dependentILModules: (CcuThunk option * ILModuleDef) list - ) = + (tcConfig: TcConfig, ilGlobals, tcImports, ilxMainModule, dependentILModules: (CcuThunk option * ILModuleDef) list) + = if isNil dependentILModules then ilxMainModule, id else diff --git a/src/Compiler/Driver/fsc.fs b/src/Compiler/Driver/fsc.fs index 0e26f2db4ac..3518d9d4884 100644 --- a/src/Compiler/Driver/fsc.fs +++ b/src/Compiler/Driver/fsc.fs @@ -139,18 +139,8 @@ let AbortOnError (diagnosticsLogger: DiagnosticsLogger, exiter: Exiter) = exiter.Exit 1 let TypeCheck - ( - ctok, - tcConfig, - tcImports, - tcGlobals, - diagnosticsLogger: DiagnosticsLogger, - assemblyName, - tcEnv0, - openDecls0, - inputs, - exiter: Exiter - ) = + (ctok, tcConfig, tcImports, tcGlobals, diagnosticsLogger: DiagnosticsLogger, assemblyName, tcEnv0, openDecls0, inputs, exiter: Exiter) + = try if isNil inputs then error (Error(FSComp.SR.fscNoImplementationFiles (), rangeStartup)) @@ -346,9 +336,7 @@ module InterfaceFileWriter = if String.IsNullOrEmpty(tcConfig.printSignatureFile) then Console.Out else - FileSystem - .OpenFileForWriteShim(tcConfig.printSignatureFile, FileMode.Create) - .GetWriter() + FileSystem.OpenFileForWriteShim(tcConfig.printSignatureFile, FileMode.Create).GetWriter() writeHeader tcConfig.printSignatureFile os @@ -367,7 +355,7 @@ module InterfaceFileWriter = let writeToSeparateFiles (declaredImpls: CheckedImplFile list) = for CheckedImplFile(qualifiedNameOfFile = name) as impl in declaredImpls do let fileName = - !! Path.ChangeExtension(name.Range.FileName, extensionForFile name.Range.FileName) + !!Path.ChangeExtension(name.Range.FileName, extensionForFile name.Range.FileName) printfn "writing impl file to %s" fileName use os = FileSystem.OpenFileForWriteShim(fileName, FileMode.Create).GetWriter() @@ -388,7 +376,7 @@ module InterfaceFileWriter = // 2) If not, but FSharp.Core.dll exists beside the compiler binaries, it will copy it to output directory. // 3) If not, it will produce an error. let CopyFSharpCore (outFile: string, referencedDlls: AssemblyReference list) = - let outDir = !! Path.GetDirectoryName(outFile) + let outDir = !!Path.GetDirectoryName(outFile) let fsharpCoreAssemblyName = GetFSharpCoreLibraryName() + ".dll" let fsharpCoreDestinationPath = Path.Combine(outDir, fsharpCoreAssemblyName) @@ -408,7 +396,7 @@ let CopyFSharpCore (outFile: string, referencedDlls: AssemblyReference list) = | Some referencedFsharpCoreDll -> copyFileIfDifferent referencedFsharpCoreDll.Text fsharpCoreDestinationPath | None -> let executionLocation = Assembly.GetExecutingAssembly().Location - let compilerLocation = !! Path.GetDirectoryName(executionLocation) + let compilerLocation = !!Path.GetDirectoryName(executionLocation) let compilerFsharpCoreDllPath = Path.Combine(compilerLocation, fsharpCoreAssemblyName) diff --git a/src/Compiler/Facilities/CompilerLocation.fs b/src/Compiler/Facilities/CompilerLocation.fs index 2e9137fc75d..7d902aefc27 100644 --- a/src/Compiler/Facilities/CompilerLocation.fs +++ b/src/Compiler/Facilities/CompilerLocation.fs @@ -14,9 +14,7 @@ open Internal.Utilities.Library module internal FSharpEnvironment = - type private TypeInThisAssembly = - class - end + type private TypeInThisAssembly = class end /// The F# version reported in the banner let FSharpBannerVersion = @@ -90,7 +88,7 @@ module internal FSharpEnvironment = let fallback () = let d = Assembly.GetExecutingAssembly() - Some(!! Path.GetDirectoryName(d.Location)) + Some(!!Path.GetDirectoryName(d.Location)) match tryCurrentDomain () with | None -> fallback () @@ -171,12 +169,8 @@ module internal FSharpEnvironment = } let getTypeProviderAssembly - ( - runTimeAssemblyFileName: string, - designTimeAssemblyName: string, - compilerToolPaths: string list, - raiseError - ) = + (runTimeAssemblyFileName: string, designTimeAssemblyName: string, compilerToolPaths: string list, raiseError) + = // Find and load the designer assembly for the type provider component. // We look in the directories stepping up from the location of the runtime assembly. let loadFromLocation designTimeAssemblyPath = @@ -213,7 +207,7 @@ module internal FSharpEnvironment = | Some res -> loadFromLocation res | None -> // The search failed, just load from the first location and report an error - let runTimeAssemblyPath = !! Path.GetDirectoryName(runTimeAssemblyFileName) + let runTimeAssemblyPath = !!Path.GetDirectoryName(runTimeAssemblyFileName) loadFromLocation (Path.Combine(runTimeAssemblyPath, designTimeAssemblyName)) if designTimeAssemblyName.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) then @@ -224,7 +218,7 @@ module internal FSharpEnvironment = // design-time DLLs specified using "x.DesignTIme, Version= ..." long assembly names and GAC loads. // These kind of design-time assembly specifications are no longer used to our knowledge so that comparison is basically legacy // and will always succeed. - let name = AssemblyName(!! Path.GetFileNameWithoutExtension(designTimeAssemblyName)) + let name = AssemblyName(!!Path.GetFileNameWithoutExtension(designTimeAssemblyName)) if name.FullName.Equals(name.Name, StringComparison.OrdinalIgnoreCase) then let designTimeFileName = designTimeAssemblyName + ".dll" @@ -276,7 +270,7 @@ module internal FSharpEnvironment = // Must be alongside the location of FSharp.CompilerService.dll let getDefaultFsiLibraryLocation () = - Path.Combine(!! Path.GetDirectoryName(getFSharpCompilerLocation ()), fsiLibraryName + ".dll") + Path.Combine(!!Path.GetDirectoryName(getFSharpCompilerLocation ()), fsiLibraryName + ".dll") let isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) @@ -355,12 +349,12 @@ module internal FSharpEnvironment = [| match getDotnetHostPath (), getDotnetGlobalHostPath () with | Some hostPath, Some globalHostPath -> - yield !! Path.GetDirectoryName(hostPath) + yield !!Path.GetDirectoryName(hostPath) if isDotnetMultilevelLookup && hostPath <> globalHostPath then - yield !! Path.GetDirectoryName(globalHostPath) - | Some hostPath, None -> yield !! Path.GetDirectoryName(hostPath) - | None, Some globalHostPath -> yield !! Path.GetDirectoryName(globalHostPath) + yield !!Path.GetDirectoryName(globalHostPath) + | Some hostPath, None -> yield !!Path.GetDirectoryName(hostPath) + | None, Some globalHostPath -> yield !!Path.GetDirectoryName(globalHostPath) | None, None -> () |] diff --git a/src/Compiler/Facilities/DiagnosticsLogger.fs b/src/Compiler/Facilities/DiagnosticsLogger.fs index e5869fe04b2..eb96a5f6e0b 100644 --- a/src/Compiler/Facilities/DiagnosticsLogger.fs +++ b/src/Compiler/Facilities/DiagnosticsLogger.fs @@ -435,8 +435,7 @@ module DiagnosticsLoggerExtensions = try if not tryAndDetectDev15 then let preserveStackTrace = - !!typeof - .GetMethod("InternalPreserveStackTrace", BindingFlags.Instance ||| BindingFlags.NonPublic) + !!typeof.GetMethod("InternalPreserveStackTrace", BindingFlags.Instance ||| BindingFlags.NonPublic) preserveStackTrace.Invoke(exn, null) |> ignore with _ -> diff --git a/src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs b/src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs index c9f84390367..dc0e30cac72 100644 --- a/src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs +++ b/src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs @@ -82,7 +82,7 @@ let private SimulatedMSBuildResolver = if Environment.OSVersion.Platform = PlatformID.Win32NT then let PF = match Environment.GetEnvironmentVariable("ProgramFiles(x86)") with - | null -> !! Environment.GetEnvironmentVariable("ProgramFiles") // if PFx86 is null, then we are 32-bit and just get PF + | null -> !!Environment.GetEnvironmentVariable("ProgramFiles") // if PFx86 is null, then we are 32-bit and just get PF | s -> s PF + @"\Reference Assemblies\Microsoft\Framework\.NETFramework" @@ -150,7 +150,7 @@ let private SimulatedMSBuildResolver = let fscoreDir0 = let PF = match Environment.GetEnvironmentVariable("ProgramFiles(x86)") with - | null -> !! Environment.GetEnvironmentVariable("ProgramFiles") + | null -> !!Environment.GetEnvironmentVariable("ProgramFiles") | s -> s PF @@ -198,7 +198,7 @@ let private SimulatedMSBuildResolver = let netFx = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() let gac = - Path.Combine(!! Path.GetDirectoryName(Path.GetDirectoryName(netFx.TrimEnd('\\'))), "assembly") + Path.Combine(!!Path.GetDirectoryName(Path.GetDirectoryName(netFx.TrimEnd('\\'))), "assembly") match n.Version, n.GetPublicKeyToken() with | null, _ diff --git a/src/Compiler/Facilities/prim-lexing.fs b/src/Compiler/Facilities/prim-lexing.fs index c305052587c..381e11eaa3a 100644 --- a/src/Compiler/Facilities/prim-lexing.fs +++ b/src/Compiler/Facilities/prim-lexing.fs @@ -192,7 +192,7 @@ module SourceTextNew = member _.GetChecksum() = // TODO: something better... - !! sourceText.ToString() + !!sourceText.ToString() |> Md5Hasher.hashString |> fun byteArray -> ImmutableArray.Create(byteArray, 0, byteArray.Length) } @@ -356,12 +356,8 @@ and [] internal LexBuffer<'Char> FSharp.Compiler.DiagnosticsLogger.checkLanguageFeatureAndRecover langVersion featureId range static member FromFunction - ( - reportLibraryOnlyFeatures, - langVersion, - strictIndentation, - f: 'Char[] * int * int -> int - ) : LexBuffer<'Char> = + (reportLibraryOnlyFeatures, langVersion, strictIndentation, f: 'Char[] * int * int -> int) + : LexBuffer<'Char> = let extension = Array.zeroCreate 4096 let filler (lexBuffer: LexBuffer<'Char>) = @@ -385,8 +381,7 @@ and [] internal LexBuffer<'Char> static member FromArray(reportLibraryOnlyFeatures, langVersion, strictIndentation, s: 'Char[]) : LexBuffer<'Char> = let buffer = Array.copy s - LexBuffer<'Char> - .FromArrayNoCopy(reportLibraryOnlyFeatures, langVersion, strictIndentation, buffer) + LexBuffer<'Char>.FromArrayNoCopy(reportLibraryOnlyFeatures, langVersion, strictIndentation, buffer) // Important: This method takes ownership of the array static member FromChars(reportLibraryOnlyFeatures, langVersion, strictIndentation, arr: char[]) = diff --git a/src/Compiler/Interactive/fsi.fs b/src/Compiler/Interactive/fsi.fs index eaba5aa6582..78d5cb94dcd 100644 --- a/src/Compiler/Interactive/fsi.fs +++ b/src/Compiler/Interactive/fsi.fs @@ -128,7 +128,7 @@ module internal Utilities = } else let specialized = typedefof>.MakeGenericType [| ty |] - !! Activator.CreateInstance(specialized) :?> IAnyToLayoutCall + !!Activator.CreateInstance(specialized) :?> IAnyToLayoutCall let callStaticMethod (ty: Type) name args = ty.InvokeMember( @@ -395,7 +395,7 @@ type ILMultiInMemoryAssemblyEmitEnv and convTypeAux ty = match ty with - | ILType.Void -> !! Type.GetType("System.Void") + | ILType.Void -> !!Type.GetType("System.Void") | ILType.Array(shape, eltType) -> let baseT = convTypeAux eltType @@ -442,7 +442,7 @@ type ILMultiInMemoryAssemblyEmitEnv let ltref = mkRefForNestedILTypeDef ILScopeRef.Local (enc, tdef) let tref = mkRefForNestedILTypeDef ilScopeRef (enc, tdef) let key = tref.BasicQualifiedName - let typ = !! asm.GetType(key) + let typ = !!asm.GetType(key) //printfn "Adding %s --> %s" key typ.FullName let rtref = rescopeILTypeRef dynamicCcuScopeRef tref typeMap.Add(ltref, (typ, tref)) @@ -1581,7 +1581,7 @@ let rec ConvReflectionTypeToILType (reflectionTy: Type) = let elementOrItemTref = if reflectionTy.HasElementType then - !! reflectionTy.GetElementType() + !!reflectionTy.GetElementType() else reflectionTy |> ConvReflectionTypeToILTypeRef @@ -1904,7 +1904,7 @@ type internal FsiDynamicCompiler if edef.ArgCount = 0 then yield (fun () -> - let typ = !! asm.GetType(edef.DeclaringTypeRef.BasicQualifiedName) + let typ = !!asm.GetType(edef.DeclaringTypeRef.BasicQualifiedName) try ignore ( @@ -2438,14 +2438,8 @@ type internal FsiDynamicCompiler /// Evaluate the given definitions and produce a new interactive state. member _.EvalParsedDefinitions - ( - ctok, - diagnosticsLogger: DiagnosticsLogger, - istate, - showTypes, - isInteractiveItExpr, - defs: SynModuleDecl list - ) = + (ctok, diagnosticsLogger: DiagnosticsLogger, istate, showTypes, isInteractiveItExpr, defs: SynModuleDecl list) + = let fileName = stdinMockFileName let m = @@ -2681,12 +2675,8 @@ type internal FsiDynamicCompiler member _.HasDelayedDependencyManagerText = hasDelayedDependencyManagerText member fsiDynamicCompiler.ProcessDelayedDependencyManagerText - ( - ctok, - istate: FsiDynamicCompilerState, - lexResourceManager, - diagnosticsLogger - ) = + (ctok, istate: FsiDynamicCompilerState, lexResourceManager, diagnosticsLogger) + = if not hasDelayedDependencyManagerText then istate else @@ -2828,12 +2818,8 @@ type internal FsiDynamicCompiler /// Scrape #r, #I and package manager commands from a #load member fsiDynamicCompiler.ProcessMetaCommandsFromParsedInputAsInteractiveCommands - ( - ctok, - istate: FsiDynamicCompilerState, - sourceFile, - input - ) = + (ctok, istate: FsiDynamicCompilerState, sourceFile, input) + = WithImplicitHome (tcConfigB, directoryName sourceFile) (fun () -> ProcessMetaCommandsFromInput ((fun st (m, nm) -> @@ -2845,7 +2831,7 @@ type internal FsiDynamicCompiler st), (fun _ _ -> ())) - (tcConfigB, input, !! Path.GetDirectoryName(sourceFile), istate)) + (tcConfigB, input, !!Path.GetDirectoryName(sourceFile), istate)) member fsiDynamicCompiler.EvalSourceFiles(ctok, istate, m, sourceFiles, lexResourceManager, diagnosticsLogger: DiagnosticsLogger) = let tcConfig = TcConfig.Create(tcConfigB, validate = false) @@ -4468,11 +4454,8 @@ let internal SpawnThread name f = th.Start() let internal SpawnInteractiveServer - ( - fsi: FsiEvaluationSessionHostConfig, - fsiOptions: FsiCommandLineOptions, - fsiConsoleOutput: FsiConsoleOutput - ) = + (fsi: FsiEvaluationSessionHostConfig, fsiOptions: FsiCommandLineOptions, fsiConsoleOutput: FsiConsoleOutput) + = //printf "Spawning fsi server on channel '%s'" !fsiServerName; SpawnThread "ServerThread" (fun () -> use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID @@ -4486,11 +4469,8 @@ let internal SpawnInteractiveServer /// /// This gives us a last chance to catch an abort on the main execution thread. let internal DriveFsiEventLoop - ( - fsi: FsiEvaluationSessionHostConfig, - fsiInterruptController: FsiInterruptController, - fsiConsoleOutput: FsiConsoleOutput - ) = + (fsi: FsiEvaluationSessionHostConfig, fsiInterruptController: FsiInterruptController, fsiConsoleOutput: FsiConsoleOutput) + = if progress then fprintfn fsiConsoleOutput.Out "GUI thread runLoop" @@ -4770,7 +4750,7 @@ type FsiEvaluationSession let makeNestedException (userExn: #Exception) = // clone userExn -- make userExn the inner exception, to retain the stacktrace on raise let arguments = [| userExn.Message :> obj; userExn :> obj |] - !! Activator.CreateInstance(userExn.GetType(), arguments) :?> Exception + !!Activator.CreateInstance(userExn.GetType(), arguments) :?> Exception let commitResult res = match res with diff --git a/src/Compiler/Service/BackgroundCompiler.fs b/src/Compiler/Service/BackgroundCompiler.fs index 329fd21c63d..c55da121cdc 100644 --- a/src/Compiler/Service/BackgroundCompiler.fs +++ b/src/Compiler/Service/BackgroundCompiler.fs @@ -578,14 +578,8 @@ type internal BackgroundCompiler res) member _.ParseFile - ( - fileName: string, - sourceText: ISourceText, - options: FSharpParsingOptions, - cache: bool, - flatErrors: bool, - userOpName: string - ) = + (fileName: string, sourceText: ISourceText, options: FSharpParsingOptions, cache: bool, flatErrors: bool, userOpName: string) + = async { use _ = Activity.start @@ -781,14 +775,8 @@ type internal BackgroundCompiler /// Type-check the result obtained by parsing, but only if the antecedent type checking context is available. member bc.CheckFileInProjectAllowingStaleCachedResults - ( - parseResults: FSharpParseFileResults, - fileName, - fileVersion, - sourceText: ISourceText, - options, - userOpName - ) = + (parseResults: FSharpParseFileResults, fileName, fileVersion, sourceText: ISourceText, options, userOpName) + = async { use _ = Activity.start @@ -841,14 +829,8 @@ type internal BackgroundCompiler /// Type-check the result obtained by parsing. Force the evaluation of the antecedent type checking context if needed. member bc.CheckFileInProject - ( - parseResults: FSharpParseFileResults, - fileName, - fileVersion, - sourceText: ISourceText, - options, - userOpName - ) = + (parseResults: FSharpParseFileResults, fileName, fileVersion, sourceText: ISourceText, options, userOpName) + = async { use _ = Activity.start @@ -890,13 +872,8 @@ type internal BackgroundCompiler /// Parses and checks the source file and returns untyped AST and check results. member bc.ParseAndCheckFileInProject - ( - fileName: string, - fileVersion, - sourceText: ISourceText, - options: FSharpProjectOptions, - userOpName - ) = + (fileName: string, fileVersion, sourceText: ISourceText, options: FSharpProjectOptions, userOpName) + = async { use _ = Activity.start @@ -1090,13 +1067,8 @@ type internal BackgroundCompiler } member _.FindReferencesInFile - ( - fileName: string, - options: FSharpProjectOptions, - symbol: FSharpSymbol, - canInvalidateProject: bool, - userOpName: string - ) = + (fileName: string, options: FSharpProjectOptions, symbol: FSharpSymbol, canInvalidateProject: bool, userOpName: string) + = async { use _ = Activity.start @@ -1150,12 +1122,8 @@ type internal BackgroundCompiler /// Try to get recent approximate type check results for a file. member _.TryGetRecentCheckResultsForFile - ( - fileName: string, - options: FSharpProjectOptions, - sourceText: ISourceText option, - _userOpName: string - ) = + (fileName: string, options: FSharpProjectOptions, sourceText: ISourceText option, _userOpName: string) + = use _ = Activity.start "BackgroundCompiler.GetSemanticClassificationForFile" @@ -1539,13 +1507,8 @@ type internal BackgroundCompiler member _.FileParsed: IEvent = self.FileParsed member _.FindReferencesInFile - ( - fileName: string, - options: FSharpProjectOptions, - symbol: FSharpSymbol, - canInvalidateProject: bool, - userOpName: string - ) : Async> = + (fileName: string, options: FSharpProjectOptions, symbol: FSharpSymbol, canInvalidateProject: bool, userOpName: string) + : Async> = self.FindReferencesInFile(fileName, options, symbol, canInvalidateProject, userOpName) member this.FindReferencesInFile(fileName, projectSnapshot, symbol, userOpName) = @@ -1557,36 +1520,23 @@ type internal BackgroundCompiler self.GetAssemblyData(options, userOpName) member _.GetAssemblyData - ( - projectSnapshot: FSharpProjectSnapshot, - _fileName: string, - userOpName: string - ) : Async = + (projectSnapshot: FSharpProjectSnapshot, _fileName: string, userOpName: string) + : Async = self.GetAssemblyData(projectSnapshot.ToOptions(), userOpName) member _.GetBackgroundCheckResultsForFileInProject - ( - fileName: string, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, options: FSharpProjectOptions, userOpName: string) + : Async = self.GetBackgroundCheckResultsForFileInProject(fileName, options, userOpName) member _.GetBackgroundParseResultsForFileInProject - ( - fileName: string, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, options: FSharpProjectOptions, userOpName: string) + : Async = self.GetBackgroundParseResultsForFileInProject(fileName, options, userOpName) member _.GetCachedCheckFileResult - ( - builder: IncrementalBuilder, - fileName: string, - sourceText: ISourceText, - options: FSharpProjectOptions - ) : Async<(FSharpParseFileResults * FSharpCheckFileResults) option> = + (builder: IncrementalBuilder, fileName: string, sourceText: ISourceText, options: FSharpProjectOptions) + : Async<(FSharpParseFileResults * FSharpCheckFileResults) option> = self.GetCachedCheckFileResult(builder, fileName, sourceText, options) member _.GetProjectOptionsFromScript @@ -1653,19 +1603,13 @@ type internal BackgroundCompiler } member _.GetSemanticClassificationForFile - ( - fileName: string, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, options: FSharpProjectOptions, userOpName: string) + : Async = self.GetSemanticClassificationForFile(fileName, options, userOpName) member _.GetSemanticClassificationForFile - ( - fileName: string, - snapshot: FSharpProjectSnapshot, - userOpName: string - ) : Async = + (fileName: string, snapshot: FSharpProjectSnapshot, userOpName: string) + : Async = self.GetSemanticClassificationForFile(fileName, snapshot.ToOptions(), userOpName) member _.InvalidateConfiguration(options: FSharpProjectOptions, userOpName: string) : unit = @@ -1682,21 +1626,13 @@ type internal BackgroundCompiler self.NotifyProjectCleaned(options, userOpName) member _.ParseAndCheckFileInProject - ( - fileName: string, - fileVersion: int, - sourceText: ISourceText, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, fileVersion: int, sourceText: ISourceText, options: FSharpProjectOptions, userOpName: string) + : Async = self.ParseAndCheckFileInProject(fileName, fileVersion, sourceText, options, userOpName) member _.ParseAndCheckFileInProject - ( - fileName: string, - projectSnapshot: FSharpProjectSnapshot, - userOpName: string - ) : Async = + (fileName: string, projectSnapshot: FSharpProjectSnapshot, userOpName: string) + : Async = async { let fileSnapshot = projectSnapshot.ProjectSnapshot.SourceFiles @@ -1715,14 +1651,8 @@ type internal BackgroundCompiler self.ParseAndCheckProject(projectSnapshot.ToOptions(), userOpName) member _.ParseFile - ( - fileName: string, - sourceText: ISourceText, - options: FSharpParsingOptions, - cache: bool, - flatErrors: bool, - userOpName: string - ) = + (fileName: string, sourceText: ISourceText, options: FSharpParsingOptions, cache: bool, flatErrors: bool, userOpName: string) + = self.ParseFile(fileName, sourceText, options, cache, flatErrors, userOpName) member _.ParseFile(fileName: string, projectSnapshot: FSharpProjectSnapshot, userOpName: string) = @@ -1733,18 +1663,11 @@ type internal BackgroundCompiler member _.ProjectChecked: IEvent = self.ProjectChecked member _.TryGetRecentCheckResultsForFile - ( - fileName: string, - options: FSharpProjectOptions, - sourceText: ISourceText option, - userOpName: string - ) : (FSharpParseFileResults * FSharpCheckFileResults * SourceTextHash) option = + (fileName: string, options: FSharpProjectOptions, sourceText: ISourceText option, userOpName: string) + : (FSharpParseFileResults * FSharpCheckFileResults * SourceTextHash) option = self.TryGetRecentCheckResultsForFile(fileName, options, sourceText, userOpName) member _.TryGetRecentCheckResultsForFile - ( - fileName: string, - projectSnapshot: FSharpProjectSnapshot, - userOpName: string - ) : (FSharpParseFileResults * FSharpCheckFileResults) option = + (fileName: string, projectSnapshot: FSharpProjectSnapshot, userOpName: string) + : (FSharpParseFileResults * FSharpCheckFileResults) option = self.TryGetRecentCheckResultsForFile(fileName, projectSnapshot, userOpName) diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index 8cb27875075..c4b65045b6b 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -188,7 +188,7 @@ and FSharpProjectOptions = && options1.ReferencedProjects = options2.ReferencedProjects && options1.LoadTime = options2.LoadTime - member po.ProjectDirectory = !! Path.GetDirectoryName(po.ProjectFileName) + member po.ProjectDirectory = !!Path.GetDirectoryName(po.ProjectFileName) override this.ToString() = "FSharpProjectOptions(" + this.ProjectFileName + ")" @@ -2042,15 +2042,8 @@ type internal TypeCheckInfo /// Get the auto-complete items at a location member _.GetDeclarations - ( - parseResultsOpt, - line, - lineStr, - partialName, - completionContextAtPos, - getAllEntities, - genBodyForOverriddenMeth - ) = + (parseResultsOpt, line, lineStr, partialName, completionContextAtPos, getAllEntities, genBodyForOverriddenMeth) + = let isSigFile = SourceFileImpl.IsSignatureFile mainInputFileName DiagnosticsScope.Protect @@ -3109,14 +3102,8 @@ module internal ParseAndCheckFile = errHandler.CollectedDiagnostics(None), parseResult, errHandler.AnyErrors let ApplyLoadClosure - ( - tcConfig, - parsedMainInput, - mainInputFileName: string, - loadClosure: LoadClosure option, - tcImports: TcImports, - backgroundDiagnostics - ) = + (tcConfig, parsedMainInput, mainInputFileName: string, loadClosure: LoadClosure option, tcImports: TcImports, backgroundDiagnostics) + = // If additional references were brought in by the preprocessor then we need to process them match loadClosure with @@ -3204,7 +3191,7 @@ module internal ParseAndCheckFile = ApplyMetaCommandsFromInputToTcConfig( tcConfig, parsedMainInput, - !! Path.GetDirectoryName(mainInputFileName), + !!Path.GetDirectoryName(mainInputFileName), tcImports.DependencyProvider ) |> ignore @@ -3255,7 +3242,7 @@ module internal ParseAndCheckFile = // Apply nowarns to tcConfig (may generate errors, so ensure diagnosticsLogger is installed) let tcConfig = - ApplyNoWarnsToTcConfig(tcConfig, parsedMainInput, !! Path.GetDirectoryName(mainInputFileName)) + ApplyNoWarnsToTcConfig(tcConfig, parsedMainInput, !!Path.GetDirectoryName(mainInputFileName)) // update the error handler with the modified tcConfig errHandler.DiagnosticOptions <- tcConfig.diagnosticsOptions @@ -3383,15 +3370,8 @@ type FSharpCheckFileResults /// Intellisense autocompletions member _.GetDeclarationListInfo - ( - parsedFileResults, - line, - lineText, - partialName, - ?getAllEntities, - ?completionContextAtPos, - ?genBodyForOverriddenMeth - ) = + (parsedFileResults, line, lineText, partialName, ?getAllEntities, ?completionContextAtPos, ?genBodyForOverriddenMeth) + = let getAllEntities = defaultArg getAllEntities (fun () -> []) let genBodyForOverriddenMeth = defaultArg genBodyForOverriddenMeth true @@ -3638,12 +3618,7 @@ type FSharpCheckFileResults FSharpCheckFileResults(fileName, creationErrors, None, [||], None, keepAssemblyContents) static member JoinErrors - ( - isIncompleteTypeCheckEnvironment, - creationErrors: FSharpDiagnostic[], - parseErrors: FSharpDiagnostic[], - tcErrors: FSharpDiagnostic[] - ) = + (isIncompleteTypeCheckEnvironment, creationErrors: FSharpDiagnostic[], parseErrors: FSharpDiagnostic[], tcErrors: FSharpDiagnostic[]) = [| yield! creationErrors yield! parseErrors diff --git a/src/Compiler/Service/FSharpProjectSnapshot.fs b/src/Compiler/Service/FSharpProjectSnapshot.fs index 030d070a375..8ca44143037 100644 --- a/src/Compiler/Service/FSharpProjectSnapshot.fs +++ b/src/Compiler/Service/FSharpProjectSnapshot.fs @@ -436,15 +436,18 @@ and [] Proj ((projectFileName, outputFileNameValue.Value |> Option.defaultValue "") |> FSharpProjectIdentifier) - new(projectFileName: string, - outputFileName: string option, - referencesOnDisk: string seq, - otherOptions: string seq, - ?isIncompleteTypeCheckEnvironment: bool, - ?useScriptResolutionRules: bool, - ?loadTime: DateTime, - ?stamp: int64, - ?projectId: string) = + new + ( + projectFileName: string, + outputFileName: string option, + referencesOnDisk: string seq, + otherOptions: string seq, + ?isIncompleteTypeCheckEnvironment: bool, + ?useScriptResolutionRules: bool, + ?loadTime: DateTime, + ?stamp: int64, + ?projectId: string + ) = let referencesOnDisk = referencesOnDisk @@ -469,7 +472,7 @@ and [] Proj projectId = projectId ) - member val ProjectDirectory = !! Path.GetDirectoryName(projectFileName) + member val ProjectDirectory = !!Path.GetDirectoryName(projectFileName) member _.OutputFileName = outputFileNameValue.Value member _.Identifier = identifier.Value member _.Version = fullHash.Value @@ -726,13 +729,8 @@ and [] FSha ) static member FromOptions - ( - options: FSharpProjectOptions, - fileName: string, - fileVersion: int, - sourceText: ISourceText, - documentSource: DocumentSource - ) = + (options: FSharpProjectOptions, fileName: string, fileVersion: int, sourceText: ISourceText, documentSource: DocumentSource) + = let getFileSnapshot _ fName = if fName = fileName then diff --git a/src/Compiler/Service/FSharpWorkspaceState.fs b/src/Compiler/Service/FSharpWorkspaceState.fs index cc3d3d8524d..b7a3a70dd89 100644 --- a/src/Compiler/Service/FSharpWorkspaceState.fs +++ b/src/Compiler/Service/FSharpWorkspaceState.fs @@ -148,10 +148,8 @@ module internal WorkspaceDependencyGraphExtensions = [] static member AddProjectWithoutFiles - ( - this: GraphBuilder<_, _, (ProjectConfig * FSharpProjectSnapshot seq), _>, - computeProjectWithoutFiles - ) = + (this: GraphBuilder<_, _, (ProjectConfig * FSharpProjectSnapshot seq), _>, computeProjectWithoutFiles) + = this.AddDependentNode( WorkspaceNodeKey.ProjectWithoutFiles this.State, computeProjectWithoutFiles >> WorkspaceNodeValue.ProjectWithoutFiles, @@ -174,10 +172,8 @@ module internal WorkspaceDependencyGraphExtensions = [] static member AddProjectSnapshot - ( - this: GraphBuilder<_, _, (ProjectWithoutFiles * FSharpFileSnapshot seq), _>, - computeProjectSnapshot - ) = + (this: GraphBuilder<_, _, (ProjectWithoutFiles * FSharpFileSnapshot seq), _>, computeProjectSnapshot) + = this.AddDependentNode( WorkspaceNodeKey.ProjectSnapshot this.State, @@ -199,9 +195,7 @@ module internal WorkspaceDependencyGraphExtensions = [] static member GetProjectSnapshot(this: IDependencyGraph<_, _>, project) = - this - .GetValue(WorkspaceNodeKey.ProjectSnapshot project) - .Unpack(WorkspaceNode.projectSnapshot) + this.GetValue(WorkspaceNodeKey.ProjectSnapshot project).Unpack(WorkspaceNode.projectSnapshot) [] static member GetProjectReferencesOf(this: IDependencyGraph<_, _>, project) = @@ -212,9 +206,7 @@ module internal WorkspaceDependencyGraphExtensions = [] static member GetProjectsThatReference(this: IDependencyGraph<_, _>, dllPath) = - this - .GetDependentsOf(WorkspaceNodeKey.ReferenceOnDisk dllPath) - .UnpackMany(WorkspaceNode.projectConfigKey) + this.GetDependentsOf(WorkspaceNodeKey.ReferenceOnDisk dllPath).UnpackMany(WorkspaceNode.projectConfigKey) [] static member GetProjectsContaining(this: IDependencyGraph<_, _>, file) = diff --git a/src/Compiler/Service/SemanticClassification.fs b/src/Compiler/Service/SemanticClassification.fs index 3de24222311..f384cabebdc 100644 --- a/src/Compiler/Service/SemanticClassification.fs +++ b/src/Compiler/Service/SemanticClassification.fs @@ -135,12 +135,8 @@ module TcResolutionsExtensions = type TcResolutions with member sResolutions.GetSemanticClassification - ( - g: TcGlobals, - amap: ImportMap, - formatSpecifierLocations: (range * int)[], - range: range option - ) : SemanticClassificationItem[] = + (g: TcGlobals, amap: ImportMap, formatSpecifierLocations: (range * int)[], range: range option) + : SemanticClassificationItem[] = DiagnosticsScope.Protect range0 (fun () -> diff --git a/src/Compiler/Service/ServiceInterfaceStubGenerator.fs b/src/Compiler/Service/ServiceInterfaceStubGenerator.fs index fb3e8dfbecc..94051957876 100644 --- a/src/Compiler/Service/ServiceInterfaceStubGenerator.fs +++ b/src/Compiler/Service/ServiceInterfaceStubGenerator.fs @@ -41,7 +41,7 @@ module internal CodeGenerationUtils = member _.Unindent i = indentWriter.Indent <- max 0 (indentWriter.Indent - i) - member _.Dump() = !! indentWriter.InnerWriter.ToString() + member _.Dump() = !!indentWriter.InnerWriter.ToString() interface IDisposable with member _.Dispose() = diff --git a/src/Compiler/Service/ServiceLexing.fs b/src/Compiler/Service/ServiceLexing.fs index 083bae1d6d8..8e97816290f 100644 --- a/src/Compiler/Service/ServiceLexing.fs +++ b/src/Compiler/Service/ServiceLexing.fs @@ -1920,17 +1920,8 @@ module FSharpLexerImpl = type FSharpLexer = static member Tokenize - ( - text: ISourceText, - tokenCallback, - ?langVersion, - ?strictIndentation, - ?filePath: string, - ?conditionalDefines, - ?flags, - ?pathMap, - ?ct - ) = + (text: ISourceText, tokenCallback, ?langVersion, ?strictIndentation, ?filePath: string, ?conditionalDefines, ?flags, ?pathMap, ?ct) + = let langVersion = defaultArg langVersion "latestmajor" |> LanguageVersion let flags = defaultArg flags FSharpLexerFlags.Default ignore filePath // can be removed at later point diff --git a/src/Compiler/Service/ServiceParseTreeWalk.fs b/src/Compiler/Service/ServiceParseTreeWalk.fs index b55844e51ae..659f4c4bc60 100644 --- a/src/Compiler/Service/ServiceParseTreeWalk.fs +++ b/src/Compiler/Service/ServiceParseTreeWalk.fs @@ -56,12 +56,8 @@ type SyntaxVisitorBase<'T>() = 'T option default _.VisitExpr - ( - path: SyntaxVisitorPath, - traverseSynExpr: SynExpr -> 'T option, - defaultTraverse: SynExpr -> 'T option, - synExpr: SynExpr - ) = + (path: SyntaxVisitorPath, traverseSynExpr: SynExpr -> 'T option, defaultTraverse: SynExpr -> 'T option, synExpr: SynExpr) + = ignore (path, traverseSynExpr, defaultTraverse, synExpr) None diff --git a/src/Compiler/Service/ServiceParsedInputOps.fs b/src/Compiler/Service/ServiceParsedInputOps.fs index 374f648947a..f5b15936902 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fs +++ b/src/Compiler/Service/ServiceParsedInputOps.fs @@ -1520,11 +1520,8 @@ module ParsedInput = | _ -> None member _.VisitBinding - ( - path, - defaultTraverse, - (SynBinding(headPat = headPat; trivia = trivia; returnInfo = returnInfo) as synBinding) - ) = + (path, defaultTraverse, (SynBinding(headPat = headPat; trivia = trivia; returnInfo = returnInfo) as synBinding)) + = let isOverrideOrMember leadingKeyword = match leadingKeyword with diff --git a/src/Compiler/Service/TransparentCompiler.fs b/src/Compiler/Service/TransparentCompiler.fs index 3b411028328..9c16357d2d7 100644 --- a/src/Compiler/Service/TransparentCompiler.fs +++ b/src/Compiler/Service/TransparentCompiler.fs @@ -907,7 +907,7 @@ type internal TransparentCompiler { new IXmlDocumentationInfoLoader with /// Try to load xml documentation associated with an assembly by the same file path with the extension ".xml". member _.TryLoad(assemblyFileName) = - let xmlFileName = !! Path.ChangeExtension(assemblyFileName, ".xml") + let xmlFileName = !!Path.ChangeExtension(assemblyFileName, ".xml") // REVIEW: File IO - Will eventually need to change this to use a file system interface of some sort. XmlDocumentationInfo.TryCreateFromFile(xmlFileName) @@ -1393,7 +1393,7 @@ type internal TransparentCompiler // Apply nowarns to tcConfig (may generate errors, so ensure diagnosticsLogger is installed) let tcConfig = - ApplyNoWarnsToTcConfig(tcConfig, parsedMainInput, !! Path.GetDirectoryName(mainInputFileName)) + ApplyNoWarnsToTcConfig(tcConfig, parsedMainInput, !!Path.GetDirectoryName(mainInputFileName)) let diagnosticsLogger = errHandler.DiagnosticsLogger @@ -1751,11 +1751,8 @@ type internal TransparentCompiler ) let TryGetRecentCheckResultsForFile - ( - fileName: string, - projectSnapshot: FSharpProjectSnapshot, - userOpName: string - ) : (FSharpParseFileResults * FSharpCheckFileResults) option = + (fileName: string, projectSnapshot: FSharpProjectSnapshot, userOpName: string) + : (FSharpParseFileResults * FSharpCheckFileResults) option = ignore userOpName let cacheKey = @@ -2098,14 +2095,8 @@ type internal TransparentCompiler } member _.ParseFileWithoutProject - ( - fileName: string, - sourceText: ISourceText, - options: FSharpParsingOptions, - cache: bool, - flatErrors: bool, - userOpName: string - ) : Async = + (fileName: string, sourceText: ISourceText, options: FSharpParsingOptions, cache: bool, flatErrors: bool, userOpName: string) + : Async = let parseFileAsync = async { let! ct = Async.CancellationToken @@ -2259,13 +2250,8 @@ type internal TransparentCompiler member _.ProjectChecked = projectChecked.Publish member this.FindReferencesInFile - ( - fileName: string, - options: FSharpProjectOptions, - symbol: FSharpSymbol, - canInvalidateProject: bool, - userOpName: string - ) : Async> = + (fileName: string, options: FSharpProjectOptions, symbol: FSharpSymbol, canInvalidateProject: bool, userOpName: string) + : Async> = async { ignore canInvalidateProject @@ -2288,19 +2274,13 @@ type internal TransparentCompiler } member this.GetAssemblyData - ( - projectSnapshot: FSharpProjectSnapshot, - fileName, - userOpName: string - ) : Async = + (projectSnapshot: FSharpProjectSnapshot, fileName, userOpName: string) + : Async = this.GetAssemblyData(projectSnapshot.ProjectSnapshot, fileName, userOpName) member this.GetBackgroundCheckResultsForFileInProject - ( - fileName: string, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, options: FSharpProjectOptions, userOpName: string) + : Async = async { let! snapshot = FSharpProjectSnapshot.FromOptions(options, documentSource) @@ -2310,11 +2290,8 @@ type internal TransparentCompiler } member this.GetBackgroundParseResultsForFileInProject - ( - fileName: string, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, options: FSharpProjectOptions, userOpName: string) + : Async = async { let! snapshot = FSharpProjectSnapshot.FromOptions(options, documentSource) @@ -2322,12 +2299,8 @@ type internal TransparentCompiler } member this.GetCachedCheckFileResult - ( - builder: IncrementalBuilder, - fileName: string, - sourceText: ISourceText, - options: FSharpProjectOptions - ) : Async<(FSharpParseFileResults * FSharpCheckFileResults) option> = + (builder: IncrementalBuilder, fileName: string, sourceText: ISourceText, options: FSharpProjectOptions) + : Async<(FSharpParseFileResults * FSharpCheckFileResults) option> = async { ignore builder @@ -2522,11 +2495,8 @@ type internal TransparentCompiler } member this.GetSemanticClassificationForFile - ( - fileName: string, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, options: FSharpProjectOptions, userOpName: string) + : Async = async { ignore userOpName @@ -2548,13 +2518,8 @@ type internal TransparentCompiler backgroundCompiler.NotifyProjectCleaned(options, userOpName) member this.ParseAndCheckFileInProject - ( - fileName: string, - fileVersion: int, - sourceText: ISourceText, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, fileVersion: int, sourceText: ISourceText, options: FSharpProjectOptions, userOpName: string) + : Async = async { let! snapshot = FSharpProjectSnapshot.FromOptions(options, fileName, fileVersion, sourceText, documentSource) @@ -2583,29 +2548,16 @@ type internal TransparentCompiler this.ParseFile(fileName, projectSnapshot.ProjectSnapshot, userOpName) member this.ParseFile - ( - fileName: string, - sourceText: ISourceText, - options: FSharpParsingOptions, - cache: bool, - flatErrors: bool, - userOpName: string - ) : Async = + (fileName: string, sourceText: ISourceText, options: FSharpParsingOptions, cache: bool, flatErrors: bool, userOpName: string) + : Async = this.ParseFileWithoutProject(fileName, sourceText, options, cache, flatErrors, userOpName) member this.TryGetRecentCheckResultsForFile - ( - fileName: string, - options: FSharpProjectOptions, - sourceText: ISourceText option, - userOpName: string - ) : (FSharpParseFileResults * FSharpCheckFileResults * SourceTextHash) option = + (fileName: string, options: FSharpProjectOptions, sourceText: ISourceText option, userOpName: string) + : (FSharpParseFileResults * FSharpCheckFileResults * SourceTextHash) option = backgroundCompiler.TryGetRecentCheckResultsForFile(fileName, options, sourceText, userOpName) member this.TryGetRecentCheckResultsForFile - ( - fileName: string, - projectSnapshot: FSharpProjectSnapshot, - userOpName: string - ) : (FSharpParseFileResults * FSharpCheckFileResults) option = + (fileName: string, projectSnapshot: FSharpProjectSnapshot, userOpName: string) + : (FSharpParseFileResults * FSharpCheckFileResults) option = TryGetRecentCheckResultsForFile(fileName, projectSnapshot, userOpName) diff --git a/src/Compiler/Service/TransparentCompiler.fsi b/src/Compiler/Service/TransparentCompiler.fsi index 93df10b29e2..8703df0fe7f 100644 --- a/src/Compiler/Service/TransparentCompiler.fsi +++ b/src/Compiler/Service/TransparentCompiler.fsi @@ -156,8 +156,11 @@ type internal CompilerCaches = member ParseAndCheckAllFilesInProject: AsyncMemoizeDisabled member ParseAndCheckFileInProject: - AsyncMemoize<(string * FSharpProjectIdentifier), string * string, (FSharpParseFileResults * - FSharpCheckFileAnswer)> + AsyncMemoize< + (string * FSharpProjectIdentifier), + string * string, + (FSharpParseFileResults * FSharpCheckFileAnswer) + > member ParseAndCheckProject: AsyncMemoize diff --git a/src/Compiler/Service/service.fs b/src/Compiler/Service/service.fs index 4835b784bf8..7c499e41f0c 100644 --- a/src/Compiler/Service/service.fs +++ b/src/Compiler/Service/service.fs @@ -389,14 +389,8 @@ type FSharpChecker /// Typecheck a source code file, returning a handle to the results of the /// parse including the reconstructed types in the file. member _.CheckFileInProjectAllowingStaleCachedResults - ( - parseResults: FSharpParseFileResults, - fileName: string, - fileVersion: int, - source: string, - options: FSharpProjectOptions, - ?userOpName: string - ) = + (parseResults: FSharpParseFileResults, fileName: string, fileVersion: int, source: string, options: FSharpProjectOptions, ?userOpName: string) + = let userOpName = defaultArg userOpName "Unknown" backgroundCompiler.CheckFileInProjectAllowingStaleCachedResults( @@ -426,13 +420,8 @@ type FSharpChecker /// Typecheck a source code file, returning a handle to the results of the /// parse including the reconstructed types in the file. member _.ParseAndCheckFileInProject - ( - fileName: string, - fileVersion: int, - sourceText: ISourceText, - options: FSharpProjectOptions, - ?userOpName: string - ) = + (fileName: string, fileVersion: int, sourceText: ISourceText, options: FSharpProjectOptions, ?userOpName: string) + = let userOpName = defaultArg userOpName "Unknown" backgroundCompiler.ParseAndCheckFileInProject(fileName, fileVersion, sourceText, options, userOpName) @@ -453,14 +442,8 @@ type FSharpChecker backgroundCompiler.ParseAndCheckProject(projectSnapshot, userOpName) member _.FindBackgroundReferencesInFile - ( - fileName: string, - options: FSharpProjectOptions, - symbol: FSharpSymbol, - ?canInvalidateProject: bool, - ?fastCheck: bool, - ?userOpName: string - ) = + (fileName: string, options: FSharpProjectOptions, symbol: FSharpSymbol, ?canInvalidateProject: bool, ?fastCheck: bool, ?userOpName: string) + = let canInvalidateProject = defaultArg canInvalidateProject true let userOpName = defaultArg userOpName "Unknown" diff --git a/src/Compiler/Symbols/FSharpDiagnostic.fsi b/src/Compiler/Symbols/FSharpDiagnostic.fsi index 8c79ee95232..0118cc41cf3 100644 --- a/src/Compiler/Symbols/FSharpDiagnostic.fsi +++ b/src/Compiler/Symbols/FSharpDiagnostic.fsi @@ -46,9 +46,7 @@ module public ExtendedData = /// Contextually-relevant data to each particular diagnostic [] - type public IFSharpDiagnosticExtendedData = - interface - end + type public IFSharpDiagnosticExtendedData = interface end /// Additional data for diagnostics about obsolete attributes. [] diff --git a/src/Compiler/SyntaxTree/LexHelpers.fs b/src/Compiler/SyntaxTree/LexHelpers.fs index f7f090a6b00..faf85ad811d 100644 --- a/src/Compiler/SyntaxTree/LexHelpers.fs +++ b/src/Compiler/SyntaxTree/LexHelpers.fs @@ -77,15 +77,8 @@ type LongUnicodeLexResult = | Invalid let mkLexargs - ( - conditionalDefines, - indentationSyntaxStatus, - resourceManager, - ifdefStack, - diagnosticsLogger, - pathMap: PathMap, - applyLineDirectives - ) = + (conditionalDefines, indentationSyntaxStatus, resourceManager, ifdefStack, diagnosticsLogger, pathMap: PathMap, applyLineDirectives) + = { conditionalDefines = conditionalDefines ifdefStack = ifdefStack @@ -499,7 +492,7 @@ module Keywords = else PathMap.applyDir args.pathMap dirname |> fun dir -> KEYWORD_STRING(s, dir) - | "__SOURCE_FILE__" -> KEYWORD_STRING(s, !! System.IO.Path.GetFileName(FileIndex.fileOfFileIndex lexbuf.StartPos.FileIndex)) + | "__SOURCE_FILE__" -> KEYWORD_STRING(s, !!System.IO.Path.GetFileName(FileIndex.fileOfFileIndex lexbuf.StartPos.FileIndex)) | "__LINE__" -> KEYWORD_STRING(s, string lexbuf.StartPos.Line) | _ -> IdentifierToken args lexbuf s diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index 1c0428eb835..a8a8724f58b 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -275,15 +275,8 @@ let mkSynMemberDefnGetSet let xmlDoc = grabXmlDocAtRangeStart (parseState, attrs, rangeStart) let tryMkSynMemberDefnMember - ( - mOptInline: range option, - optAttrs: SynAttributeList list, - (bindingPat, mBindLhs), - optReturnType, - mEquals, - expr, - mExpr - ) : (SynMemberDefn * Ident option) option = + (mOptInline: range option, optAttrs: SynAttributeList list, (bindingPat, mBindLhs), optReturnType, mEquals, expr, mExpr) + : (SynMemberDefn * Ident option) option = let optInline = Option.isSome opt_inline || Option.isSome mOptInline // optional attributes are only applied to getters and setters // the "top level" attrs will be applied to both @@ -810,13 +803,8 @@ let checkEndOfFileError t = type BindingSet = BindingSetPreAttrs of range * bool * bool * (SynAttributes -> SynAccess option -> SynAttributes * SynBinding list) * range let mkClassMemberLocalBindings - ( - isStatic, - initialRangeOpt, - attrs, - vis, - BindingSetPreAttrs(_, isRec, isUse, declsPreAttrs, bindingSetRange) - ) = + (isStatic, initialRangeOpt, attrs, vis, BindingSetPreAttrs(_, isRec, isUse, declsPreAttrs, bindingSetRange)) + = let ignoredFreeAttrs, decls = declsPreAttrs attrs vis let mWhole = diff --git a/src/Compiler/SyntaxTree/UnicodeLexing.fs b/src/Compiler/SyntaxTree/UnicodeLexing.fs index 5a2d4393ee7..abb3d0e3d83 100644 --- a/src/Compiler/SyntaxTree/UnicodeLexing.fs +++ b/src/Compiler/SyntaxTree/UnicodeLexing.fs @@ -9,16 +9,13 @@ open Internal.Utilities.Text.Lexing type Lexbuf = LexBuffer let StringAsLexbuf (reportLibraryOnlyFeatures, langVersion, strictIndentation, s: string) = - LexBuffer - .FromChars(reportLibraryOnlyFeatures, langVersion, strictIndentation, s.ToCharArray()) + LexBuffer.FromChars(reportLibraryOnlyFeatures, langVersion, strictIndentation, s.ToCharArray()) let FunctionAsLexbuf (reportLibraryOnlyFeatures, langVersion, strictIndentation, bufferFiller) = - LexBuffer - .FromFunction(reportLibraryOnlyFeatures, langVersion, strictIndentation, bufferFiller) + LexBuffer.FromFunction(reportLibraryOnlyFeatures, langVersion, strictIndentation, bufferFiller) let SourceTextAsLexbuf (reportLibraryOnlyFeatures, langVersion, strictIndentation, sourceText) = - LexBuffer - .FromSourceText(reportLibraryOnlyFeatures, langVersion, strictIndentation, sourceText) + LexBuffer.FromSourceText(reportLibraryOnlyFeatures, langVersion, strictIndentation, sourceText) let StreamReaderAsLexbuf (reportLibraryOnlyFeatures, langVersion, strictIndentation, reader: StreamReader) = let mutable isFinished = false diff --git a/src/Compiler/TypedTree/TcGlobals.fsi b/src/Compiler/TypedTree/TcGlobals.fsi index b172536d4f0..b8c3610ef91 100644 --- a/src/Compiler/TypedTree/TcGlobals.fsi +++ b/src/Compiler/TypedTree/TcGlobals.fsi @@ -835,7 +835,10 @@ type internal TcGlobals = member knownFSharpCoreModules: System.Collections.Generic.IDictionary member knownIntrinsics: - System.Collections.Concurrent.ConcurrentDictionary<(string * string option * string * int), FSharp.Compiler.TypedTree.ValRef> + System.Collections.Concurrent.ConcurrentDictionary< + (string * string option * string * int), + FSharp.Compiler.TypedTree.ValRef + > member knownWithNull: FSharp.Compiler.TypedTree.Nullness diff --git a/src/Compiler/Utilities/FileSystem.fs b/src/Compiler/Utilities/FileSystem.fs index 81d6113cc18..ce2488cd0aa 100644 --- a/src/Compiler/Utilities/FileSystem.fs +++ b/src/Compiler/Utilities/FileSystem.fs @@ -427,17 +427,17 @@ module internal FileSystemUtils = if not (hasExtensionWithValidate false path) then raise (ArgumentException("chopExtension")) // message has to be precisely this, for OCaml compatibility, and no argument name can be set - Path.Combine(!! Path.GetDirectoryName(path), !! Path.GetFileNameWithoutExtension(path)) + Path.Combine(!!Path.GetDirectoryName(path), !!Path.GetFileNameWithoutExtension(path)) let fileNameOfPath path = checkPathForIllegalChars path - !! Path.GetFileName(path) + !!Path.GetFileName(path) let fileNameWithoutExtensionWithValidate (validate: bool) path = if validate then checkPathForIllegalChars path - !! Path.GetFileNameWithoutExtension(path) + !!Path.GetFileNameWithoutExtension(path) let fileNameWithoutExtension path = !! fileNameWithoutExtensionWithValidate true path @@ -705,8 +705,7 @@ type DefaultFileSystem() as this = abstract ChangeExtensionShim: path: string * extension: string -> string - default _.ChangeExtensionShim(path: string, extension: string) : string = - !! Path.ChangeExtension(path, extension) + default _.ChangeExtensionShim(path: string, extension: string) : string = !!Path.ChangeExtension(path, extension) interface IFileSystem with member _.AssemblyLoader = this.AssemblyLoader @@ -824,7 +823,7 @@ module public StreamExtensions = use sr = new StreamReader(s, encoding, true) while not <| sr.EndOfStream do - yield !! sr.ReadLine() + yield !!sr.ReadLine() } member s.ReadAllLines(?encoding: Encoding) : string array = diff --git a/src/Compiler/Utilities/sr.fs b/src/Compiler/Utilities/sr.fs index 10a615846e3..968525e931e 100644 --- a/src/Compiler/Utilities/sr.fs +++ b/src/Compiler/Utilities/sr.fs @@ -14,9 +14,7 @@ module internal SR = let GetString (name: string) = let s = - resources - .Force() - .GetString(name, System.Globalization.CultureInfo.CurrentUICulture) + resources.Force().GetString(name, System.Globalization.CultureInfo.CurrentUICulture) #if DEBUG if isNull s then System.Diagnostics.Debug.Assert(false, sprintf "**RESOURCE ERROR**: Resource token %s does not exist!" name) diff --git a/src/FSharp.Build/FSharpEmbedResXSource.fs b/src/FSharp.Build/FSharpEmbedResXSource.fs index 8a26386cf47..219ae5a4f2c 100644 --- a/src/FSharp.Build/FSharpEmbedResXSource.fs +++ b/src/FSharp.Build/FSharpEmbedResXSource.fs @@ -72,8 +72,7 @@ module internal {1} = printMessage "Generating code for target framework %s" _targetFramework let sb = - StringBuilder() - .AppendLine(String.Format(boilerplate, namespaceName, moduleName, justFileName)) + StringBuilder().AppendLine(String.Format(boilerplate, namespaceName, moduleName, justFileName)) if generateGetObject then sb.AppendLine(boilerplateGetObject) |> ignore @@ -103,9 +102,7 @@ module internal {1} = "_" + name let commentBody = - XElement(xname "summary", docComment) - .ToString() - .Split([| "\r\n"; "\r"; "\n" |], StringSplitOptions.None) + XElement(xname "summary", docComment).ToString().Split([| "\r\n"; "\r"; "\n" |], StringSplitOptions.None) |> Array.fold (fun (sb: StringBuilder) line -> sb.AppendLine(" /// " + line)) (StringBuilder()) // add the resource let accessorBody = diff --git a/src/FSharp.Build/Fsi.fs b/src/FSharp.Build/Fsi.fs index dc362420db0..a8ad12d1b2c 100644 --- a/src/FSharp.Build/Fsi.fs +++ b/src/FSharp.Build/Fsi.fs @@ -112,9 +112,7 @@ type public Fsi() as this = let warningsAsErrorsArray = match warningsAsErrors with | Null -> [| "76" |] - | NonNull warningsAsErrors -> - (warningsAsErrors + " 76 ") - .Split([| ' '; ';'; ',' |], StringSplitOptions.RemoveEmptyEntries) + | NonNull warningsAsErrors -> (warningsAsErrors + " 76 ").Split([| ' '; ';'; ',' |], StringSplitOptions.RemoveEmptyEntries) builder.AppendSwitchesIfNotNull("--warnaserror:", warningsAsErrorsArray, ",") diff --git a/src/FSharp.Core/async.fs b/src/FSharp.Core/async.fs index 2b117be0b16..170b30cce0f 100644 --- a/src/FSharp.Core/async.fs +++ b/src/FSharp.Core/async.fs @@ -235,8 +235,7 @@ type TrampolineHolder() = // This should be the only call to Thread.Start in this library. We must always install a trampoline. member this.StartThreadWithTrampoline(f: unit -> AsyncReturn) = - Thread(getThreadStartCallbackForStartThreadWithTrampoline (this), IsBackground = true) - .Start(f |> box) + Thread(getThreadStartCallbackForStartThreadWithTrampoline (this), IsBackground = true).Start(f |> box) AsyncReturn.Fake() @@ -1741,13 +1740,8 @@ type Async = /// StartWithContinuations, except the exception continuation is given an ExceptionDispatchInfo static member StartWithContinuationsUsingDispatchInfo - ( - computation: Async<'T>, - continuation, - exceptionContinuation, - cancellationContinuation, - ?cancellationToken - ) : unit = + (computation: Async<'T>, continuation, exceptionContinuation, cancellationContinuation, ?cancellationToken) + : unit = let cancellationToken = defaultArg cancellationToken defaultCancellationTokenSource.Token @@ -1759,13 +1753,8 @@ type Async = cancellationContinuation static member StartWithContinuations - ( - computation: Async<'T>, - continuation, - exceptionContinuation, - cancellationContinuation, - ?cancellationToken - ) : unit = + (computation: Async<'T>, continuation, exceptionContinuation, cancellationContinuation, ?cancellationToken) + : unit = Async.StartWithContinuationsUsingDispatchInfo( computation, continuation, @@ -1939,11 +1928,8 @@ type Async = /// it happens the child computation will be cancelled. The resulting async doesn't support cancellation /// directly, rather the underlying computation must fill the result if cancellation occurs. static member AwaitAndBindChildResult - ( - innerCTS: CancellationTokenSource, - resultCell: ResultCell>, - millisecondsTimeout - ) : Async<'T> = + (innerCTS: CancellationTokenSource, resultCell: ResultCell>, millisecondsTimeout) + : Async<'T> = match millisecondsTimeout with | None | Some -1 -> resultCell |> Async.AwaitAndBindResult_NoDirectCancelOrTimeout diff --git a/src/FSharp.Core/map.fs b/src/FSharp.Core/map.fs index b46bd9d357d..4eeed1465a1 100644 --- a/src/FSharp.Core/map.fs +++ b/src/FSharp.Core/map.fs @@ -1001,13 +1001,7 @@ type Map<[] 'Key, [ let txt1 = LanguagePrimitives.anyToStringShowingNull h1 let txt2 = LanguagePrimitives.anyToStringShowingNull h2 diff --git a/src/FSharp.Core/quotations.fs b/src/FSharp.Core/quotations.fs index 2f90f7a48ee..ea8b17d6f26 100644 --- a/src/FSharp.Core/quotations.fs +++ b/src/FSharp.Core/quotations.fs @@ -2531,13 +2531,8 @@ type Expr with mkStaticMethodCallW (methodInfo, methodInfoWithWitnesses, List.length witnesses, witnesses @ arguments) static member CallWithWitnesses - ( - obj: Expr, - methodInfo: MethodInfo, - methodInfoWithWitnesses: MethodInfo, - witnesses, - arguments - ) = + (obj: Expr, methodInfo: MethodInfo, methodInfoWithWitnesses: MethodInfo, witnesses, arguments) + = checkNonNull "methodInfo" methodInfo checkNonNull "methodInfoWithWitnesses" methodInfoWithWitnesses mkInstanceMethodCallW (obj, methodInfo, methodInfoWithWitnesses, List.length witnesses, witnesses @ arguments) diff --git a/src/FSharp.Core/reflect.fs b/src/FSharp.Core/reflect.fs index 32811ae604c..e0742b3dd06 100644 --- a/src/FSharp.Core/reflect.fs +++ b/src/FSharp.Core/reflect.fs @@ -1336,8 +1336,7 @@ type FSharpValue = static member PreComputeTupleConstructor(tupleType: Type) = checkTupleType ("tupleType", tupleType) - (compileTupleConstructor tupleEncField getTupleConstructorMethod tupleType) - .Invoke + (compileTupleConstructor tupleEncField getTupleConstructorMethod tupleType).Invoke static member PreComputeTupleConstructorInfo(tupleType: Type) = checkTupleType ("tupleType", tupleType) @@ -1445,10 +1444,8 @@ module FSharpReflectionExtensions = FSharpValue.GetRecordFields(record, bindingFlags) static member PreComputeRecordReader - ( - recordType: Type, - ?allowAccessToPrivateRepresentation - ) : (obj -> objnull array) = + (recordType: Type, ?allowAccessToPrivateRepresentation) + : (obj -> objnull array) = let bindingFlags = getBindingFlags allowAccessToPrivateRepresentation FSharpValue.PreComputeRecordReader(recordType, bindingFlags) @@ -1481,18 +1478,14 @@ module FSharpReflectionExtensions = FSharpValue.GetUnionFields(value, unionType, bindingFlags) static member PreComputeUnionTagReader - ( - unionType: Type, - ?allowAccessToPrivateRepresentation - ) : (objnull -> int) = + (unionType: Type, ?allowAccessToPrivateRepresentation) + : (objnull -> int) = let bindingFlags = getBindingFlags allowAccessToPrivateRepresentation FSharpValue.PreComputeUnionTagReader(unionType, bindingFlags) static member PreComputeUnionReader - ( - unionCase: UnionCaseInfo, - ?allowAccessToPrivateRepresentation - ) : (objnull -> objnull array) = + (unionCase: UnionCaseInfo, ?allowAccessToPrivateRepresentation) + : (objnull -> objnull array) = let bindingFlags = getBindingFlags allowAccessToPrivateRepresentation FSharpValue.PreComputeUnionReader(unionCase, bindingFlags) diff --git a/src/FSharp.Core/seq.fs b/src/FSharp.Core/seq.fs index 35adcdda557..20fcdefb159 100644 --- a/src/FSharp.Core/seq.fs +++ b/src/FSharp.Core/seq.fs @@ -478,8 +478,7 @@ module Internal = static member Bind(g: Generator<'T>, cont) = match g with | :? GenerateThen<'T> as g -> - GenerateThen<_> - .Bind(g.Generator, (fun () -> GenerateThen<_>.Bind(g.Cont(), cont))) + GenerateThen<_>.Bind(g.Generator, (fun () -> GenerateThen<_>.Bind(g.Cont(), cont))) | g -> (new GenerateThen<'T>(g, cont) :> Generator<'T>) let bindG g cont = @@ -854,7 +853,7 @@ module Seq = seq { use e = source.GetEnumerator() - for x in count .. - 1 .. 1 do + for x in count .. -1 .. 1 do if not (e.MoveNext()) then invalidOpFmt "{0}: tried to take {1} {2} past the end of the seq. Use Seq.truncate to get {3} or less elements" diff --git a/src/FSharp.Core/set.fs b/src/FSharp.Core/set.fs index 85fc718c461..f6ac7f99490 100644 --- a/src/FSharp.Core/set.fs +++ b/src/FSharp.Core/set.fs @@ -990,13 +990,7 @@ type Set<[] 'T when 'T: comparison>(comparer: IComparer<' let txt1 = LanguagePrimitives.anyToStringShowingNull h1 let txt2 = LanguagePrimitives.anyToStringShowingNull h2 - StringBuilder() - .Append("set [") - .Append(txt1) - .Append("; ") - .Append(txt2) - .Append("]") - .ToString() + StringBuilder().Append("set [").Append(txt1).Append("; ").Append(txt2).Append("]").ToString() | [ h1; h2; h3 ] -> let txt1 = LanguagePrimitives.anyToStringShowingNull h1 let txt2 = LanguagePrimitives.anyToStringShowingNull h2 diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs index 6b9d33ff663..ecfe86109aa 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs @@ -95,9 +95,7 @@ module internal Utilities = let getResolutionsFromFile resolutionsFile = let lines = try - File - .ReadAllText(resolutionsFile) - .Split([| '\r'; '\n' |], StringSplitOptions.None) + File.ReadAllText(resolutionsFile).Split([| '\r'; '\n' |], StringSplitOptions.None) |> Array.filter (String.IsNullOrEmpty >> not) with _ -> [||] diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs index fe0433f71cf..f900c87fb84 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs @@ -199,12 +199,8 @@ module FSharpDependencyManager = |> (fun l -> l, binLogPath, timeout) let computeHashForResolutionInputs - ( - scriptExt: string, - directiveLines: (string * string) seq, - targetFrameworkMoniker: string, - runtimeIdentifier: string - ) : string option = + (scriptExt: string, directiveLines: (string * string) seq, targetFrameworkMoniker: string, runtimeIdentifier: string) + : string option = let packageReferences, _, _ = directiveLines |> List.ofSeq |> parsePackageDirective scriptExt 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 4af8105d488..4466d718308 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl @@ -21,9 +21,9 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.Hosted.CompilerHelpers::fscCompile([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver, string, string[])][offset 0x00000082][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.Hosted.CompilerHelpers::fscCompile([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver, string, string[])][offset 0x0000008B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+MagicAssemblyResolution::ResolveAssemblyCore([FSharp.Compiler.Service]Internal.Utilities.Library.CompilationThreadToken, [FSharp.Compiler.Service]FSharp.Compiler.Text.Range, [FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, [FSharp.Compiler.Service]FSharp.Compiler.CompilerImports+TcImports, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiDynamicCompiler, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiConsoleOutput, string)][offset 0x00000015][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo@3516-805::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001E5][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo@3502-805::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001E5][found Char] Unexpected type on the stack. [IL]: Error [UnmanagedPointer]: : FSharp.Compiler.Interactive.Shell+Utilities+pointerToNativeInt@110::Invoke(object)][offset 0x00000007] Unmanaged pointers are not a verifiable type. -[IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+dataTipOfReferences@2232::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000084][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+dataTipOfReferences@2225::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000084][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-509::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000032][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-509::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x0000003B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-509::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000082][found Char] Unexpected type on the stack. @@ -37,8 +37,8 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+getOptionArgList@307::Invoke([FSharp.Compiler.Service]FSharp.Compiler.CompilerOptions+CompilerOption, string)][offset 0x0000003E][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+getSwitch@325::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+attempt@373::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)][offset 0x00000E9F][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1865@1865::Invoke(int32)][offset 0x00000030][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1865@1865::Invoke(int32)][offset 0x00000039][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1845@1845::Invoke(int32)][offset 0x00000030][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1845@1845::Invoke(int32)][offset 0x00000039][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x0000062B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x00000634][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.PatternMatchCompilation::isProblematicClause([FSharp.Compiler.Service]FSharp.Compiler.PatternMatchCompilation+MatchClause)][offset 0x00000065][found Byte] Unexpected type on the stack. @@ -55,7 +55,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILPdbWriter+pushShadowedLocals@959::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000232][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadUntaggedIdx([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.BinaryConstants+TableName, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+ILMetadataReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, int32&)][offset 0x0000000D][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::openMetadataReader(string, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+BinaryFile, int32, [S.P.CoreLib]System.Tuple`8,bool,bool,bool,bool,bool,System.Tuple`5,bool,int32,int32,int32>>, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+PEReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, bool)][offset 0x00000799][found Boolean] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+rowKindSize@4453::Invoke([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+RowKind)][offset 0x00000128][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+rowKindSize@4445::Invoke([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+RowKind)][offset 0x00000128][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000CD][found Char] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl index b1d1c8b57d8..d5617f6de03 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl @@ -28,10 +28,10 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.Hosted.CompilerHelpers::fscCompile([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver, string, string[])][offset 0x0000008B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+FsiStdinSyphon::GetLine(string, int32)][offset 0x00000039][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+MagicAssemblyResolution::ResolveAssemblyCore([FSharp.Compiler.Service]Internal.Utilities.Library.CompilationThreadToken, [FSharp.Compiler.Service]FSharp.Compiler.Text.Range, [FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, [FSharp.Compiler.Service]FSharp.Compiler.CompilerImports+TcImports, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiDynamicCompiler, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiConsoleOutput, string)][offset 0x00000015][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo@3516-805::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001E5][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo@3502-805::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001E5][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+FsiInteractionProcessor::CompletionsForPartialLID([FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiDynamicCompilerState, string)][offset 0x0000001B][found Char] Unexpected type on the stack. [IL]: Error [UnmanagedPointer]: : FSharp.Compiler.Interactive.Shell+Utilities+pointerToNativeInt@110::Invoke(object)][offset 0x00000007] Unmanaged pointers are not a verifiable type. -[IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+dataTipOfReferences@2232::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000084][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+dataTipOfReferences@2225::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000084][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseMemberFunctionAndValues@176::Invoke([FSharp.Compiler.Service]FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue)][offset 0x00000059][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseEntity@218::GenerateNext([S.P.CoreLib]System.Collections.Generic.IEnumerable`1&)][offset 0x000000DA][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1424-6::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x00000605][found Char] Unexpected type on the stack. @@ -53,8 +53,8 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+attempt@373::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)][offset 0x00000E9F][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+processArg@333::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)][offset 0x0000004D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+ResponseFile+parseLine@239::Invoke(string)][offset 0x00000031][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1865@1865::Invoke(int32)][offset 0x00000030][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1865@1865::Invoke(int32)][offset 0x00000039][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1845@1845::Invoke(int32)][offset 0x00000030][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+Pipe #1 stage #1 at line 1845@1845::Invoke(int32)][offset 0x00000039][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+line@560-1::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x0000062B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x00000634][found Char] Unexpected type on the stack. @@ -75,13 +75,13 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILPdbWriter+pushShadowedLocals@959::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000232][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadUntaggedIdx([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.BinaryConstants+TableName, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+ILMetadataReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, int32&)][offset 0x0000000D][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::openMetadataReader(string, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+BinaryFile, int32, [S.P.CoreLib]System.Tuple`8,bool,bool,bool,bool,bool,System.Tuple`5,bool,int32,int32,int32>>, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+PEReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, bool)][offset 0x00000799][found Boolean] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+rowKindSize@4453::Invoke([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+RowKind)][offset 0x00000128][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+rowKindSize@4445::Invoke([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+RowKind)][offset 0x00000128][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.NativeRes+VersionHelper::TryParse(string, bool, uint16, bool, [S.P.CoreLib]System.Version&)][offset 0x0000003D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL+parseNamed@5291::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>, int32, int32)][offset 0x00000087][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.Collections.Utils::shortPath(string)][offset 0x00000015][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment+probePathForDotnetHost@322::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000028][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment+probePathForDotnetHost@316::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000028][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.SimulatedMSBuildReferenceResolver+Pipe #6 input at line 68@68::FSharp.Compiler.CodeAnalysis.ILegacyReferenceResolver.Resolve([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyResolutionEnvironment, [S.P.CoreLib]System.Tuple`2[], string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>)][offset 0x0000034D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000CD][found Char] Unexpected type on the stack. [IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@558::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl index 6a9770727aa..9e78cdedccd 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl @@ -21,15 +21,15 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.Hosted.CompilerHelpers::fscCompile([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver, string, string[])][offset 0x00000082][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.Hosted.CompilerHelpers::fscCompile([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver, string, string[])][offset 0x0000008B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+MagicAssemblyResolution::ResolveAssemblyCore([FSharp.Compiler.Service]Internal.Utilities.Library.CompilationThreadToken, [FSharp.Compiler.Service]FSharp.Compiler.Text.Range, [FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, [FSharp.Compiler.Service]FSharp.Compiler.CompilerImports+TcImports, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiDynamicCompiler, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiConsoleOutput, string)][offset 0x00000015][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo@3516-849::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001C7][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+GetReferenceResolutionStructuredToolTipText@2232::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000076][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo@3502-849::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001C7][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+GetReferenceResolutionStructuredToolTipText@2225::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000076][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000032][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x0000003B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000064][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x0000006D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000076][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@301-1::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@301-1::Invoke(string)][offset 0x00000014][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@291-1::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@291-1::Invoke(string)][offset 0x00000014][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.StaticLinking+TypeForwarding::followTypeForwardForILTypeRef([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.IL+ILTypeRef)][offset 0x00000010][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::getCompilerOption([FSharp.Compiler.Service]FSharp.Compiler.CompilerOptions+CompilerOption, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1)][offset 0x000000A7][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::parseOption@266(string)][offset 0x0000000B][found Char] Unexpected type on the stack. @@ -39,12 +39,12 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::attempt@372([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)][offset 0x00000A99][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::AddPathMapping([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnderflow]: : FSharp.Compiler.CompilerOptions::DoWithColor([System.Console]System.ConsoleColor, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2)][offset 0x0000005E] Stack underflow. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1865::Invoke(int32)][offset 0x00000031][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1865::Invoke(int32)][offset 0x0000003A][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1845::Invoke(int32)][offset 0x00000031][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1845::Invoke(int32)][offset 0x0000003A][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x0000059C][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x000005A5][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000011][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1890-1'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>'] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000012][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1890'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,T0>'] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000011][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1873-1'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>'] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000012][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1873'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,T0>'] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.PatternMatchCompilation::isProblematicClause([FSharp.Compiler.Service]FSharp.Compiler.PatternMatchCompilation+MatchClause)][offset 0x00000040][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.PatternMatchCompilation::.cctor()][offset 0x0000000B][found Boolean] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.TypeProviders::ValidateExpectedName([FSharp.Compiler.Service]FSharp.Compiler.Text.Range, string[], string, [FSharp.Compiler.Service]FSharp.Compiler.Tainted`1)][offset 0x000000A8][found Char] Unexpected type on the stack. @@ -74,7 +74,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadNestedRowUncached([FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1>, int32)][offset 0x00000038][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadNestedRowUncached([FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1>, int32)][offset 0x00000058][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadGenericParamConstraintIdx([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+ILMetadataReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, int32)][offset 0x00000025][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::rowKindSize$cont@4454(bool, bool, bool, bool[], bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x000000E5][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::rowKindSize$cont@4446(bool, bool, bool, bool[], bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x000000E5][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::openMetadataReader(string, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+BinaryFile, int32, [S.P.CoreLib]System.Tuple`8,bool,bool,bool,bool,bool,System.Tuple`5,bool,int32,int32,int32>>, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+PEReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, bool)][offset 0x000006BF][found Boolean] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadInterfaceImpls@2263-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadGenericParamConstraints@2328-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl index 1e77ef2af8b..87b09e193a5 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl @@ -28,9 +28,9 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.Hosted.CompilerHelpers::fscCompile([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver, string, string[])][offset 0x0000008B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+FsiStdinSyphon::GetLine(string, int32)][offset 0x00000032][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+MagicAssemblyResolution::ResolveAssemblyCore([FSharp.Compiler.Service]Internal.Utilities.Library.CompilationThreadToken, [FSharp.Compiler.Service]FSharp.Compiler.Text.Range, [FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, [FSharp.Compiler.Service]FSharp.Compiler.CompilerImports+TcImports, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiDynamicCompiler, [FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiConsoleOutput, string)][offset 0x00000015][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo@3516-849::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001C7][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+clo@3502-849::Invoke([S.P.CoreLib]System.Tuple`3)][offset 0x000001C7][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.Interactive.Shell+FsiInteractionProcessor::CompletionsForPartialLID([FSharp.Compiler.Service]FSharp.Compiler.Interactive.Shell+FsiDynamicCompilerState, string)][offset 0x00000024][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+GetReferenceResolutionStructuredToolTipText@2232::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000076][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+GetReferenceResolutionStructuredToolTipText@2225::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000076][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseMemberFunctionAndValues@176::Invoke([FSharp.Compiler.Service]FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue)][offset 0x0000002B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseEntity@218::GenerateNext([S.P.CoreLib]System.Collections.Generic.IEnumerable`1&)][offset 0x000000BB][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1424-11::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x00000620][found Char] Unexpected type on the stack. @@ -40,8 +40,8 @@ [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x0000006D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000076][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$Symbols+fullName@2495-3::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000030][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@301-1::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@301-1::Invoke(string)][offset 0x00000014][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@291-1::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@291-1::Invoke(string)][offset 0x00000014][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CreateILModule+MainModuleBuilder::ConvertProductVersionToILVersionInfo(string)][offset 0x00000010][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.StaticLinking+TypeForwarding::followTypeForwardForILTypeRef([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.IL+ILTypeRef)][offset 0x00000010][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::getCompilerOption([FSharp.Compiler.Service]FSharp.Compiler.CompilerOptions+CompilerOption, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1)][offset 0x000000A7][found Char] Unexpected type on the stack. @@ -55,14 +55,14 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions::subSystemVersionSwitch$cont@656([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, string, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnderflow]: : FSharp.Compiler.CompilerOptions::DoWithColor([System.Console]System.ConsoleColor, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2)][offset 0x0000005E] Stack underflow. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerOptions+ResponseFile+parseLine@239::Invoke(string)][offset 0x00000026][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1865::Invoke(int32)][offset 0x00000031][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1865::Invoke(int32)][offset 0x0000003A][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1845::Invoke(int32)][offset 0x00000031][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1845::Invoke(int32)][offset 0x0000003A][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+TcConfig-TryResolveLibWithDirectories@558-1::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000021][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+TcConfig-TryResolveLibWithDirectories@558-1::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000003B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x0000059C][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x000005A5][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000011][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1890-1'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>'] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000012][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1890'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,T0>'] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000011][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1873-1'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>'] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000012][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1873'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,T0>'] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.PatternMatchCompilation::isProblematicClause([FSharp.Compiler.Service]FSharp.Compiler.PatternMatchCompilation+MatchClause)][offset 0x00000040][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.PatternMatchCompilation::.cctor()][offset 0x0000000B][found Boolean] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.NicePrint+TastDefinitionPrinting+meths@2092-3::Invoke([FSharp.Compiler.Service]FSharp.Compiler.Infos+MethInfo)][offset 0x000000B3][found Char] Unexpected type on the stack. @@ -95,7 +95,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadNestedRowUncached([FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1>, int32)][offset 0x00000038][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadNestedRowUncached([FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1>, int32)][offset 0x00000058][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadGenericParamConstraintIdx([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+ILMetadataReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, int32)][offset 0x00000025][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::rowKindSize$cont@4454(bool, bool, bool, bool[], bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x000000E5][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::rowKindSize$cont@4446(bool, bool, bool, bool[], bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x000000E5][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::openMetadataReader(string, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+BinaryFile, int32, [S.P.CoreLib]System.Tuple`8,bool,bool,bool,bool,bool,System.Tuple`5,bool,int32,int32,int32>>, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+PEReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, bool)][offset 0x000006BF][found Boolean] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadInterfaceImpls@2263-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadGenericParamConstraints@2328-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. @@ -108,7 +108,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseNamed@5290(uint8[], [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>, int32, int32)][offset 0x0000007E][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.Collections.Utils::shortPath(string)][offset 0x00000016][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment::probePathForDotnetHost@321([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000002A][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment::probePathForDotnetHost@315([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000002A][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.SimulatedMSBuildReferenceResolver+SimulatedMSBuildResolver@68::FSharp.Compiler.CodeAnalysis.ILegacyReferenceResolver.Resolve([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyResolutionEnvironment, [S.P.CoreLib]System.Tuple`2[], string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>)][offset 0x000002F5][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000B6][found Char] Unexpected type on the stack. [IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@558::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. From 2a2a6000723bd6061851debc02b25a39711b8210 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Sun, 23 Mar 2025 14:53:38 -0700 Subject: [PATCH 2/2] Update fantomas - vsintegration --- .../ClassificationDefinitions.fs | 5 +--- .../Classification/ClassificationService.fs | 16 +++------- .../CodeFixes/ImplementInterface.fs | 10 ++----- .../CodeFixes/MakeOuterBindingRecursive.fs | 4 +-- .../Commands/XmlDocCommandService.fs | 5 +--- .../src/FSharp.Editor/Common/AssemblyInfo.fs | 4 +-- .../Common/CodeAnalysisExtensions.fs | 10 ++----- .../src/FSharp.Editor/Common/Extensions.fs | 6 +--- .../src/FSharp.Editor/Common/Logging.fs | 6 +--- .../Completion/CompletionProvider.fs | 19 ++++-------- .../Completion/CompletionService.fs | 9 ++---- .../Completion/CompletionUtils.fs | 12 ++------ .../Debugging/BreakpointResolutionService.fs | 7 ++--- .../Debugging/LanguageDebugInfoService.fs | 7 ++--- .../DocComments/XMLDocumentation.fs | 23 ++++----------- .../DocumentHighlightsService.fs | 8 ++--- .../Formatting/IndentationService.fs | 9 ++---- .../Hints/InlineParameterNameHints.fs | 3 +- .../LanguageService/LanguageService.fs | 12 ++------ .../LanguageService/SingleFileWorkspaceMap.fs | 4 +-- .../LanguageService/Tokenizer.fs | 8 ++--- .../LanguageService/WorkspaceExtensions.fs | 23 ++++----------- .../Navigation/FindUsagesService.fs | 9 ++---- .../Navigation/GoToDefinition.fs | 18 ++++-------- .../Navigation/NavigateToSearchService.fs | 9 ++---- .../src/FSharp.Editor/QuickInfo/Views.fs | 9 ++---- .../BreakpointResolutionServiceTests.fs | 4 +-- .../DocumentDiagnosticAnalyzerTests.fs | 21 ++++---------- .../FindReferencesTests.fs | 16 +++------- .../GoToDefinitionServiceTests.fs | 9 ++---- .../Helpers/RoslynHelpers.fs | 4 +-- .../NavigateToSearchServiceTests.fs | 4 +-- .../SignatureHelpProviderTests.fs | 4 +-- .../SyntacticColorizationServiceTests.fs | 29 ++++--------------- 34 files changed, 82 insertions(+), 264 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs b/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs index 2b194fe27fd..c39e608a4d1 100644 --- a/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs +++ b/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs @@ -128,10 +128,7 @@ module internal ClassificationDefinitions = ] let setIsDarkBackground () = - isDarkBackground <- - VSColorTheme - .GetThemedColor(EnvironmentColors.ToolWindowBackgroundColorKey) - .GetBrightness() < 0.5f + isDarkBackground <- VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowBackgroundColorKey).GetBrightness() < 0.5f let setColors _ = diff --git a/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs b/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs index afdb990489b..fa17d938f10 100644 --- a/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs +++ b/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs @@ -149,12 +149,8 @@ type internal FSharpClassificationService [] () = member _.AddLexicalClassifications(_: SourceText, _: TextSpan, _: List, _: CancellationToken) = () member _.AddSyntacticClassificationsAsync - ( - document: Document, - textSpan: TextSpan, - result: List, - cancellationToken: CancellationToken - ) = + (document: Document, textSpan: TextSpan, result: List, cancellationToken: CancellationToken) + = cancellableTask { use _logBlock = Logger.LogBlock(LogEditorFunctionId.Classification_Syntactic) @@ -201,12 +197,8 @@ type internal FSharpClassificationService [] () = |> CancellableTask.startAsTask cancellationToken member _.AddSemanticClassificationsAsync - ( - document: Document, - textSpan: TextSpan, - result: List, - cancellationToken: CancellationToken - ) = + (document: Document, textSpan: TextSpan, result: List, cancellationToken: CancellationToken) + = cancellableTask { use _logBlock = Logger.LogBlock(LogEditorFunctionId.Classification_Semantic) diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs b/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs index ca85c9621fe..1805428b8d7 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs @@ -123,14 +123,8 @@ type internal ImplementInterfaceCodeFixProvider [] () = | None -> [ stubChange ] let getSuggestions - ( - sourceText: SourceText, - results: FSharpCheckFileResults, - state: InterfaceState, - displayContext, - entity, - indentSize - ) = + (sourceText: SourceText, results: FSharpCheckFileResults, state: InterfaceState, displayContext, entity, indentSize) + = if InterfaceStubGenerator.HasNoInterfaceMember entity then CancellableTask.singleton Seq.empty else diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/MakeOuterBindingRecursive.fs b/vsintegration/src/FSharp.Editor/CodeFixes/MakeOuterBindingRecursive.fs index 0d52dbdfa86..267832a1aff 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/MakeOuterBindingRecursive.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/MakeOuterBindingRecursive.fs @@ -34,9 +34,7 @@ type internal MakeOuterBindingRecursiveCodeFixProvider [] |> ValueOption.ofOption |> ValueOption.map (fun bindingRange -> RoslynHelpers.FSharpRangeToTextSpan(sourceText, bindingRange)) |> ValueOption.filter (fun bindingSpan -> - sourceText - .GetSubText(bindingSpan) - .ContentEquals(sourceText.GetSubText context.Span)) + sourceText.GetSubText(bindingSpan).ContentEquals(sourceText.GetSubText context.Span)) |> ValueOption.map (fun bindingSpan -> let title = String.Format(SR.MakeOuterBindingRecursive(), sourceText.GetSubText(bindingSpan).ToString()) diff --git a/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs b/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs index 7fb2e008368..e87fda21539 100644 --- a/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs +++ b/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs @@ -108,10 +108,7 @@ type internal XmlDocCommandFilter(wpfTextView: IWpfTextView, filePath: string, w paramNames |> List.iter (fun p -> - toInsert - .AppendLine() - .Append(' ', indent) - .Append(sprintf "/// " p) + toInsert.AppendLine().Append(' ', indent).Append(sprintf "/// " p) |> ignore) let _newSS = diff --git a/vsintegration/src/FSharp.Editor/Common/AssemblyInfo.fs b/vsintegration/src/FSharp.Editor/Common/AssemblyInfo.fs index 73e984f934f..124f3de404c 100644 --- a/vsintegration/src/FSharp.Editor/Common/AssemblyInfo.fs +++ b/vsintegration/src/FSharp.Editor/Common/AssemblyInfo.fs @@ -8,6 +8,4 @@ open Microsoft.VisualStudio.Shell // This adds $PackageFolder$ to the directories probed for assemblies to load. // The attribute is inexplicably class-targeted, hence the dummy class. [] -type private BindingPathForUIResources = - class - end +type private BindingPathForUIResources = class end diff --git a/vsintegration/src/FSharp.Editor/Common/CodeAnalysisExtensions.fs b/vsintegration/src/FSharp.Editor/Common/CodeAnalysisExtensions.fs index 4776a963a5c..e0b29c8f9f1 100644 --- a/vsintegration/src/FSharp.Editor/Common/CodeAnalysisExtensions.fs +++ b/vsintegration/src/FSharp.Editor/Common/CodeAnalysisExtensions.fs @@ -9,17 +9,11 @@ type Project with /// Returns the projectIds of all projects within the same solution that directly reference this project member this.GetDependentProjectIds() = - this.Solution - .GetProjectDependencyGraph() - .GetProjectsThatDirectlyDependOnThisProject - this.Id + this.Solution.GetProjectDependencyGraph().GetProjectsThatDirectlyDependOnThisProject this.Id /// Returns all projects within the same solution that directly reference this project. member this.GetDependentProjects() = - this.Solution - .GetProjectDependencyGraph() - .GetProjectsThatDirectlyDependOnThisProject - this.Id + this.Solution.GetProjectDependencyGraph().GetProjectsThatDirectlyDependOnThisProject this.Id |> Seq.map this.Solution.GetProject /// Returns the ProjectIds of all of the projects that this project directly or transitively depends on diff --git a/vsintegration/src/FSharp.Editor/Common/Extensions.fs b/vsintegration/src/FSharp.Editor/Common/Extensions.fs index 5b154deab73..23012fa64e2 100644 --- a/vsintegration/src/FSharp.Editor/Common/Extensions.fs +++ b/vsintegration/src/FSharp.Editor/Common/Extensions.fs @@ -208,11 +208,7 @@ module private SourceText = type SourceText with member this.ToFSharpSourceText() = - SourceText.weakTable.GetValue( - this, - Runtime.CompilerServices.ConditionalWeakTable<_, _> - .CreateValueCallback(SourceText.create) - ) + SourceText.weakTable.GetValue(this, Runtime.CompilerServices.ConditionalWeakTable<_, _>.CreateValueCallback(SourceText.create)) type NavigationItem with diff --git a/vsintegration/src/FSharp.Editor/Common/Logging.fs b/vsintegration/src/FSharp.Editor/Common/Logging.fs index cf531c65384..b0f56df3234 100644 --- a/vsintegration/src/FSharp.Editor/Common/Logging.fs +++ b/vsintegration/src/FSharp.Editor/Common/Logging.fs @@ -156,11 +156,7 @@ module Activity = OpenTelemetry.Sdk .CreateTracerProviderBuilder() .AddSource(ActivityNames.FscSourceName) - .SetResourceBuilder( - ResourceBuilder - .CreateDefault() - .AddService(serviceName = "F#", serviceVersion = "1.0.0") - ) + .SetResourceBuilder(ResourceBuilder.CreateDefault().AddService(serviceName = "F#", serviceVersion = "1.0.0")) .AddOtlpExporter() .Build() diff --git a/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs b/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs index 2c583555cb3..de1ed80a03c 100644 --- a/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs +++ b/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs @@ -71,8 +71,7 @@ type internal FSharpCompletionProvider // * let xs = [1..10] <<---- Don't commit autocomplete! (same for arrays) static let noCommitOnSpaceRules = let noCommitChars = - [| ' '; '='; ','; '.'; '<'; '>'; '('; ')'; '!'; ':'; '['; ']'; '|' |] - .ToImmutableArray() + [| ' '; '='; ','; '.'; '<'; '>'; '('; ')'; '!'; ':'; '['; ']'; '|' |].ToImmutableArray() CompletionItemRules.Default.WithCommitCharacterRules( ImmutableArray.Create(CharacterSetModificationRule.Create(CharacterSetModificationKind.Remove, noCommitChars)) @@ -203,9 +202,7 @@ type internal FSharpCompletionProvider if n <> 0 then n else - n <- - (CompletionUtils.getKindPriority x.Kind) - .CompareTo(CompletionUtils.getKindPriority y.Kind) + n <- (CompletionUtils.getKindPriority x.Kind).CompareTo(CompletionUtils.getKindPriority y.Kind) if n <> 0 then n @@ -371,11 +368,8 @@ type internal FSharpCompletionProvider |> CancellableTask.startAsTask context.CancellationToken override _.GetDescriptionAsync - ( - document: Document, - completionItem: Completion.CompletionItem, - _cancellationToken: CancellationToken - ) : Task = + (document: Document, completionItem: Completion.CompletionItem, _cancellationToken: CancellationToken) + : Task = match completionItem.Properties.TryGetValue IndexPropName with | true, completionItemIndexStr when int completionItemIndexStr >= declarationItems.Length -> @@ -495,9 +489,6 @@ type internal FSharpCompletionProvider let changedText = finalSourceText.ToString(changedSpan) - return - CompletionChange - .Create(TextChange(fullChangingSpan, changedText)) - .WithNewPosition(Nullable(changedSpan.End)) + return CompletionChange.Create(TextChange(fullChangingSpan, changedText)).WithNewPosition(Nullable(changedSpan.End)) } |> CancellableTask.start cancellationToken diff --git a/vsintegration/src/FSharp.Editor/Completion/CompletionService.fs b/vsintegration/src/FSharp.Editor/Completion/CompletionService.fs index 13f7e3d3b30..450d8ed67ac 100644 --- a/vsintegration/src/FSharp.Editor/Completion/CompletionService.fs +++ b/vsintegration/src/FSharp.Editor/Completion/CompletionService.fs @@ -18,9 +18,7 @@ type internal FSharpCompletionService inherit FSharpCompletionServiceWithProviders(workspace) let projectInfoManager = - workspace.Services - .GetRequiredService() - .FSharpProjectOptionsManager + workspace.Services.GetRequiredService().FSharpProjectOptionsManager let builtInProviders = ImmutableArray.Create( @@ -38,10 +36,7 @@ type internal FSharpCompletionService | NewlineOnCompleteWord -> EnterKeyRule.AfterFullyTypedWord | AlwaysNewline -> EnterKeyRule.Always - CompletionRules.Default - .WithDismissIfEmpty(true) - .WithDismissIfLastCharacterDeleted(true) - .WithDefaultEnterKeyRule(enterKeyRule) + CompletionRules.Default.WithDismissIfEmpty(true).WithDismissIfLastCharacterDeleted(true).WithDefaultEnterKeyRule(enterKeyRule) /// Indicates the text span to be replaced by a committed completion list item. override _.GetDefaultCompletionListSpan(sourceText, caretIndex) = diff --git a/vsintegration/src/FSharp.Editor/Completion/CompletionUtils.fs b/vsintegration/src/FSharp.Editor/Completion/CompletionUtils.fs index 679caede1fd..1bb5958418c 100644 --- a/vsintegration/src/FSharp.Editor/Completion/CompletionUtils.fs +++ b/vsintegration/src/FSharp.Editor/Completion/CompletionUtils.fs @@ -148,16 +148,8 @@ module internal CompletionUtils = /// Indicates the text span to be replaced by a committed completion list item. let getDefaultCompletionListSpan - ( - sourceText: SourceText, - caretIndex, - documentId, - filePath, - defines, - langVersion, - strictIndentation, - ct: CancellationToken - ) = + (sourceText: SourceText, caretIndex, documentId, filePath, defines, langVersion, strictIndentation, ct: CancellationToken) + = // Gets connected identifier-part characters backward and forward from caret. let getIdentifierChars () = diff --git a/vsintegration/src/FSharp.Editor/Debugging/BreakpointResolutionService.fs b/vsintegration/src/FSharp.Editor/Debugging/BreakpointResolutionService.fs index 56ad5a26518..425dba181b4 100644 --- a/vsintegration/src/FSharp.Editor/Debugging/BreakpointResolutionService.fs +++ b/vsintegration/src/FSharp.Editor/Debugging/BreakpointResolutionService.fs @@ -48,11 +48,8 @@ type internal FSharpBreakpointResolutionService [] () = interface IFSharpBreakpointResolutionService with member _.ResolveBreakpointAsync - ( - document: Document, - textSpan: TextSpan, - cancellationToken: CancellationToken - ) : Task = + (document: Document, textSpan: TextSpan, cancellationToken: CancellationToken) + : Task = cancellableTask { let! range = FSharpBreakpointResolutionService.GetBreakpointLocation(document, textSpan) diff --git a/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs b/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs index 493750c06ec..3d815f92343 100644 --- a/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs +++ b/vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs @@ -50,11 +50,8 @@ type internal FSharpLanguageDebugInfoService [] () = Task.FromResult(Unchecked.defaultof) member _.GetDataTipInfoAsync - ( - document: Document, - position: int, - cancellationToken: CancellationToken - ) : Task = + (document: Document, position: int, cancellationToken: CancellationToken) + : Task = cancellableTask { let defines, langVersion, strictIndentation = document.GetFsharpParsingOptions() diff --git a/vsintegration/src/FSharp.Editor/DocComments/XMLDocumentation.fs b/vsintegration/src/FSharp.Editor/DocComments/XMLDocumentation.fs index 3c708b8ab17..10db9697b56 100644 --- a/vsintegration/src/FSharp.Editor/DocComments/XMLDocumentation.fs +++ b/vsintegration/src/FSharp.Editor/DocComments/XMLDocumentation.fs @@ -281,9 +281,7 @@ module internal XmlDocumentation = collector.Add TaggedText.space WriteNodes collector (p.Nodes()) - type VsThreadToken() = - class - end + type VsThreadToken() = class end let vsToken = VsThreadToken() @@ -334,15 +332,8 @@ module internal XmlDocumentation = interface IDocumentationBuilder with /// Append the given processed XML formatted into the string builder override _.AppendDocumentationFromProcessedXML - ( - xmlCollector, - exnCollector, - processedXml, - showExceptions, - showParameters, - showRemarks, - paramName - ) = + (xmlCollector, exnCollector, processedXml, showExceptions, showParameters, showRemarks, paramName) + = match XmlDocReader.TryCreate processedXml with | Some xmlDocReader -> match paramName with @@ -449,12 +440,8 @@ module internal XmlDocumentation = } let BuildSingleTipText - ( - documentationProvider: IDocumentationBuilder, - dataTipElement: ToolTipElement, - limits: LineLimits, - showRemarks: bool - ) = + (documentationProvider: IDocumentationBuilder, dataTipElement: ToolTipElement, limits: LineLimits, showRemarks: bool) + = let { LineLimit = lineLimit diff --git a/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs b/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs index 7947b2dec99..972f64ad6b3 100644 --- a/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs +++ b/vsintegration/src/FSharp.Editor/DocumentHighlights/DocumentHighlightsService.fs @@ -110,12 +110,8 @@ type internal FSharpDocumentHighlightsService [] () = interface IFSharpDocumentHighlightsService with member _.GetDocumentHighlightsAsync - ( - document, - position, - _documentsToSearch, - cancellationToken - ) : Task> = + (document, position, _documentsToSearch, cancellationToken) + : Task> = cancellableTask { let! spans = FSharpDocumentHighlightsService.GetDocumentHighlights(document, position) diff --git a/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs b/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs index bab1460f14a..d874656c176 100644 --- a/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs +++ b/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs @@ -23,13 +23,8 @@ open FSharp.Compiler.Tokenization type internal FSharpIndentationService [] () = static member IndentShouldFollow - ( - documentId: DocumentId, - sourceText: SourceText, - filePath: string, - position: int, - parsingOptions: FSharpParsingOptions - ) = + (documentId: DocumentId, sourceText: SourceText, filePath: string, position: int, parsingOptions: FSharpParsingOptions) + = let lastTokenOpt = let defines = CompilerEnvironment.GetConditionalDefinesForEditing parsingOptions diff --git a/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs b/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs index 867377cc335..f0712cb8e21 100644 --- a/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs +++ b/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs @@ -88,8 +88,7 @@ type InlineParameterNameHints(parseResults: FSharpParseFileResults) = symbol.HasAttribute() let getSourceTextAtRange (sourceText: SourceText) (range: range) = - (RoslynHelpers.FSharpRangeToTextSpan(sourceText, range) |> sourceText.GetSubText) - .ToString() + (RoslynHelpers.FSharpRangeToTextSpan(sourceText, range) |> sourceText.GetSubText).ToString() let isMemberOrFunctionOrValueValidForHint (symbol: FSharpMemberOrFunctionOrValue) (symbolUse: FSharpSymbolUse) = diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index 55cd1b622b3..5cc9cec2943 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -375,14 +375,10 @@ type internal FSharpPackage() as this = this.ComponentModel.DefaultExportProvider.GetExport() let optionsManager = - workspace.Services - .GetService() - .FSharpProjectOptionsManager + workspace.Services.GetService().FSharpProjectOptionsManager let metadataAsSource = - this.ComponentModel.DefaultExportProvider - .GetExport() - .Value + this.ComponentModel.DefaultExportProvider.GetExport().Value let! solution = this.GetServiceAsync(typeof) let solution = solution :?> IVsSolution @@ -440,9 +436,7 @@ type internal FSharpLanguageService(package: FSharpPackage) = let workspace = package.ComponentModel.GetService() let solutionAnalysis = - workspace.Services - .GetService() - .Advanced.SolutionBackgroundAnalysis + workspace.Services.GetService().Advanced.SolutionBackgroundAnalysis globalOptions.SetBackgroundAnalysisScope(openFilesOnly = not solutionAnalysis) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs index af619dad278..bf04e9a8a2d 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs @@ -18,9 +18,7 @@ type internal FSharpMiscellaneousFileService ConcurrentDictionary>(StringComparer.OrdinalIgnoreCase) let optionsManager = - workspace.Services - .GetRequiredService() - .FSharpProjectOptionsManager + workspace.Services.GetRequiredService().FSharpProjectOptionsManager static let createSourceCodeKind (filePath: string) = if isScriptFile filePath then diff --git a/vsintegration/src/FSharp.Editor/LanguageService/Tokenizer.fs b/vsintegration/src/FSharp.Editor/LanguageService/Tokenizer.fs index bc025402485..83f6532b8ad 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/Tokenizer.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/Tokenizer.fs @@ -508,12 +508,8 @@ module internal Tokenizer = | _ -> ClassificationTypeNames.Text let private scanSourceLine - ( - sourceTokenizer: FSharpSourceTokenizer, - textLine: TextLine, - lineContents: string, - lexState: FSharpTokenizerLexState - ) : SourceLineData = + (sourceTokenizer: FSharpSourceTokenizer, textLine: TextLine, lineContents: string, lexState: FSharpTokenizerLexState) + : SourceLineData = let colorMap = Array.create textLine.Span.Length ClassificationTypeNames.Text let lineTokenizer = sourceTokenizer.CreateLineTokenizer(lineContents) let tokens = ResizeArray() diff --git a/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs b/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs index 6c3b04f1844..1c09806d0ca 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs @@ -347,11 +347,8 @@ module private CheckerExtensions = } member checker.ParseAndCheckDocumentUsingTransparentCompiler - ( - document: Document, - options: FSharpProjectOptions, - userOpName: string - ) = + (document: Document, options: FSharpProjectOptions, userOpName: string) + = cancellableTask { checker.TransparentCompiler.SetCacheSizeFactor(document.Project.TransparentCompilerCacheFactor) @@ -368,12 +365,8 @@ module private CheckerExtensions = /// Parse and check the source text from the Roslyn document with possible stale results. member checker.ParseAndCheckDocumentWithPossibleStaleResults - ( - document: Document, - options: FSharpProjectOptions, - allowStaleResults: bool, - userOpName: string - ) = + (document: Document, options: FSharpProjectOptions, allowStaleResults: bool, userOpName: string) + = cancellableTask { let! ct = CancellableTask.getCancellationToken () @@ -439,12 +432,8 @@ module private CheckerExtensions = /// Parse and check the source text from the Roslyn document. member checker.ParseAndCheckDocument - ( - document: Document, - options: FSharpProjectOptions, - userOpName: string, - ?allowStaleResults: bool - ) = + (document: Document, options: FSharpProjectOptions, userOpName: string, ?allowStaleResults: bool) + = cancellableTask { if checker.UsesTransparentCompiler then diff --git a/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs b/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs index 429b21ce64a..921d82650f1 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs @@ -83,13 +83,8 @@ module FSharpFindUsagesService = } let findReferencedSymbolsAsync - ( - document: Document, - position: int, - context: IFSharpFindUsagesContext, - allReferences: bool, - userOp: string - ) : CancellableTask = + (document: Document, position: int, context: IFSharpFindUsagesContext, allReferences: bool, userOp: string) + : CancellableTask = cancellableTask { let! cancellationToken = CancellableTask.getCancellationToken () let! sourceText = document.GetTextAsync(cancellationToken) diff --git a/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs b/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs index 69a97e9732f..94615461dc1 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs @@ -645,11 +645,8 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) = } member this.NavigateToExternalDeclaration - ( - targetSymbolUse: FSharpSymbolUse, - metadataReferences: seq, - cancellationToken: CancellationToken - ) = + (targetSymbolUse: FSharpSymbolUse, metadataReferences: seq, cancellationToken: CancellationToken) + = let textOpt = match targetSymbolUse.Symbol with @@ -892,9 +889,7 @@ type FSharpCrossLanguageSymbolNavigationService() = let workspace = componentModel.GetService() let metadataAsSource = - componentModel.DefaultExportProvider - .GetExport() - .Value + componentModel.DefaultExportProvider.GetExport().Value let tryFindFieldByName (name: string) (e: FSharpEntity) = let fields = @@ -1060,11 +1055,8 @@ type FSharpCrossLanguageSymbolNavigationService() = interface IFSharpCrossLanguageSymbolNavigationService with member _.TryGetNavigableLocationAsync - ( - assemblyName: string, - documentationCommentId: string, - cancellationToken: CancellationToken - ) : Task = + (assemblyName: string, documentationCommentId: string, cancellationToken: CancellationToken) + : Task = let path = FSharpCrossLanguageSymbolNavigationService.DocCommentIdToPath documentationCommentId diff --git a/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs b/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs index 60ca208a2a0..546b00e1b16 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs @@ -189,13 +189,8 @@ type internal FSharpNavigateToSearchService interface IFSharpNavigateToSearchService with member _.SearchProjectAsync - ( - project, - _priorityDocuments, - searchPattern, - kinds, - cancellationToken - ) : Task> = + (project, _priorityDocuments, searchPattern, kinds, cancellationToken) + : Task> = cancellableTask { let tryMatch = createMatcherFor searchPattern diff --git a/vsintegration/src/FSharp.Editor/QuickInfo/Views.fs b/vsintegration/src/FSharp.Editor/QuickInfo/Views.fs index ec42d190c15..146c7d7dfcb 100644 --- a/vsintegration/src/FSharp.Editor/QuickInfo/Views.fs +++ b/vsintegration/src/FSharp.Editor/QuickInfo/Views.fs @@ -64,13 +64,8 @@ module internal QuickInfoViewProvider = let encloseRuns runs : obj = ClassifiedTextElement(runs |> List.rev) let provideContent - ( - imageId: ImageId option, - description: TaggedText list, - documentation: TaggedText list, - navigation: FSharpNavigation, - getTooltip - ) = + (imageId: ImageId option, description: TaggedText list, documentation: TaggedText list, navigation: FSharpNavigation, getTooltip) + = let encloseText text = let rec loop text runs stack = diff --git a/vsintegration/tests/FSharp.Editor.Tests/BreakpointResolutionServiceTests.fs b/vsintegration/tests/FSharp.Editor.Tests/BreakpointResolutionServiceTests.fs index 403b342ff5b..de8b3c28ccd 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/BreakpointResolutionServiceTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/BreakpointResolutionServiceTests.fs @@ -69,9 +69,7 @@ let main argv = | ValueNone -> Assert.True(expectedResolution.IsNone, "BreakpointResolutionService failed to resolve breakpoint position") | ValueSome(actualResolutionRange) -> let actualResolution = - sourceText - .GetSubText(RoslynHelpers.FSharpRangeToTextSpan(sourceText, actualResolutionRange)) - .ToString() + sourceText.GetSubText(RoslynHelpers.FSharpRangeToTextSpan(sourceText, actualResolutionRange)).ToString() Assert.True( expectedResolution.IsSome, diff --git a/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs b/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs index 27db356ec4b..51efbb4fcf2 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/DocumentDiagnosticAnalyzerTests.fs @@ -62,11 +62,8 @@ type DocumentDiagnosticAnalyzerTests() = |> Assert.shouldBeEqualWith expectedEnd "Error end positions should match" member private this.VerifyDiagnosticBetweenMarkers - ( - fileContents: string, - expectedMessage: string, - expectedSeverity: DiagnosticSeverity - ) = + (fileContents: string, expectedMessage: string, expectedSeverity: DiagnosticSeverity) + = let errors = this.getDiagnostics fileContents |> Seq.filter (fun e -> e.Severity = expectedSeverity) @@ -92,11 +89,8 @@ type DocumentDiagnosticAnalyzerTests() = |> Assert.shouldBeEqualWith expectedEnd "Error end positions should match" member private this.VerifyDiagnosticBetweenMarkers_HACK_PLEASE_REFER_TO_COMMENT_INSIDE - ( - fileContents: string, - expectedMessage: string, - expectedSeverity: DiagnosticSeverity - ) = + (fileContents: string, expectedMessage: string, expectedSeverity: DiagnosticSeverity) + = // TODO: once workaround (https://github.com/dotnet/fsharp/pull/15982) will not be needed, this should be reverted back to normal method (see PR) let errors = this.getDiagnostics fileContents @@ -127,11 +121,8 @@ type DocumentDiagnosticAnalyzerTests() = this.VerifyDiagnosticBetweenMarkers_HACK_PLEASE_REFER_TO_COMMENT_INSIDE(fileContents, expectedMessage, DiagnosticSeverity.Error) member private this.VerifyErrorAtMarker_HACK_PLEASE_REFER_TO_COMMENT_INSIDE - ( - fileContents: string, - expectedMarker: string, - ?expectedMessage: string - ) = + (fileContents: string, expectedMarker: string, ?expectedMessage: string) + = let errors = this.getDiagnostics fileContents |> Seq.filter (fun e -> e.Severity = DiagnosticSeverity.Error) diff --git a/vsintegration/tests/FSharp.Editor.Tests/FindReferencesTests.fs b/vsintegration/tests/FSharp.Editor.Tests/FindReferencesTests.fs index 4a10dacc6c6..1fc73fe81aa 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/FindReferencesTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/FindReferencesTests.fs @@ -73,9 +73,7 @@ module FindReferences = solution.TryGetDocumentFromPath documentPath |> ValueOption.defaultWith (fun _ -> failwith "Document not found") - findUsagesService - .FindReferencesAsync(document, getPositionOf "funcParam" documentPath, context) - .Wait() + findUsagesService.FindReferencesAsync(document, getPositionOf "funcParam" documentPath, context).Wait() // We cannot easily inspect what exactly was found here, but that should be verified // in FSharp.Compiler.ComponentTests.FSharpChecker.FindReferences @@ -96,9 +94,7 @@ module FindReferences = solution.TryGetDocumentFromPath documentPath |> ValueOption.defaultWith (fun _ -> failwith "Document not found") - findUsagesService - .FindReferencesAsync(document, getPositionOf "funcParam" documentPath, context) - .Wait() + findUsagesService.FindReferencesAsync(document, getPositionOf "funcParam" documentPath, context).Wait() if foundDefinitions.Count <> 1 then failwith $"Expected 1 definition but found {foundDefinitions.Count}" @@ -118,9 +114,7 @@ module FindReferences = solution.TryGetDocumentFromPath documentPath |> ValueOption.defaultWith (fun _ -> failwith "Document not found") - findUsagesService - .FindReferencesAsync(document, getPositionOf "sharedFunc" documentPath, context) - .Wait() + findUsagesService.FindReferencesAsync(document, getPositionOf "sharedFunc" documentPath, context).Wait() if foundDefinitions.Count <> 1 then failwith $"Expected 1 definition but found {foundDefinitions.Count}" @@ -159,9 +153,7 @@ module FindReferences = solution2.TryGetDocumentFromPath documentPath |> ValueOption.defaultWith (fun _ -> failwith "Document not found") - findUsagesService - .FindReferencesAsync(document, getPositionOf operator documentPath, context) - .Wait() + findUsagesService.FindReferencesAsync(document, getPositionOf operator documentPath, context).Wait() // We cannot easily inspect what exactly was found here, but that should be verified // in FSharp.Compiler.ComponentTests.FSharpChecker.FindReferences diff --git a/vsintegration/tests/FSharp.Editor.Tests/GoToDefinitionServiceTests.fs b/vsintegration/tests/FSharp.Editor.Tests/GoToDefinitionServiceTests.fs index cc6bdbae43c..d0e4b5efad1 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/GoToDefinitionServiceTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/GoToDefinitionServiceTests.fs @@ -17,13 +17,8 @@ module GoToDefinitionServiceTests = let userOpName = "GoToDefinitionServiceTests" let private findDefinition - ( - document: Document, - sourceText: SourceText, - position: int, - defines: string list, - langVersion: string option - ) : range option = + (document: Document, sourceText: SourceText, position: int, defines: string list, langVersion: string option) + : range option = maybe { let textLine = sourceText.Lines.GetLineFromPosition position let textLinePos = sourceText.Lines.GetLinePosition position diff --git a/vsintegration/tests/FSharp.Editor.Tests/Helpers/RoslynHelpers.fs b/vsintegration/tests/FSharp.Editor.Tests/Helpers/RoslynHelpers.fs index ca113f72bf3..85ad11c6e2e 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/Helpers/RoslynHelpers.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/Helpers/RoslynHelpers.fs @@ -67,9 +67,7 @@ module MefHelpers = let configuration = CompositionConfiguration.Create(catalog) - RuntimeComposition - .CreateRuntimeComposition(configuration) - .CreateExportProviderFactory() + RuntimeComposition.CreateRuntimeComposition(configuration).CreateExportProviderFactory() let createExportProvider () = exportProviderFactory.CreateExportProvider() diff --git a/vsintegration/tests/FSharp.Editor.Tests/NavigateToSearchServiceTests.fs b/vsintegration/tests/FSharp.Editor.Tests/NavigateToSearchServiceTests.fs index 549441d8bb3..08816ea6191 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/NavigateToSearchServiceTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/NavigateToSearchServiceTests.fs @@ -41,9 +41,7 @@ module HeyHo = let navigateToSearch pattern = let service: IFSharpNavigateToSearchService = provider.GetExportedValue() - service - .SearchProjectAsync(project, [] |> Seq.toImmutableArray, pattern, service.KindsProvided, CancellationToken.None) - .Result + service.SearchProjectAsync(project, [] |> Seq.toImmutableArray, pattern, service.KindsProvided, CancellationToken.None).Result let assertResultsContain pattern expected = navigateToSearch pattern diff --git a/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs b/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs index f85ee51a6c8..398ece88fa3 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/SignatureHelpProviderTests.fs @@ -45,9 +45,7 @@ module SignatureHelpProvider = |> CancellableTask.runSynchronously ct let paramInfoLocations = - parseResults - .FindParameterLocations(Position.fromZ caretLinePos.Line caretLineColumn) - .Value + parseResults.FindParameterLocations(Position.fromZ caretLinePos.Line caretLineColumn).Value let triggered = FSharpSignatureHelpProvider.ProvideMethodsAsyncAux( diff --git a/vsintegration/tests/FSharp.Editor.Tests/SyntacticColorizationServiceTests.fs b/vsintegration/tests/FSharp.Editor.Tests/SyntacticColorizationServiceTests.fs index 35c5306d8ff..04ab8dd2448 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/SyntacticColorizationServiceTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/SyntacticColorizationServiceTests.fs @@ -13,13 +13,8 @@ open FSharp.Test type SyntacticClassificationServiceTests() = member private this.ExtractMarkerData - ( - fileContents: string, - marker: string, - defines: string list, - langVersion: string option, - isScriptFile: Option - ) = + (fileContents: string, marker: string, defines: string list, langVersion: string option, isScriptFile: Option) + = let textSpan = TextSpan(0, fileContents.Length) let fileName = @@ -49,14 +44,8 @@ type SyntacticClassificationServiceTests() = (tokens, markerPosition) member private this.VerifyColorizerAtStartOfMarker - ( - fileContents: string, - marker: string, - defines: string list, - classificationType: string, - ?isScriptFile: bool, - ?langVersion: string - ) = + (fileContents: string, marker: string, defines: string list, classificationType: string, ?isScriptFile: bool, ?langVersion: string) + = let langVersion = langVersion |> Option.orElse (Some "preview") let (tokens, markerPosition) = @@ -69,14 +58,8 @@ type SyntacticClassificationServiceTests() = |> Assert.shouldBeEqualWith classificationType "Classification data doesn't match for start of marker" member private this.VerifyColorizerAtEndOfMarker - ( - fileContents: string, - marker: string, - defines: string list, - classificationType: string, - ?isScriptFile: bool, - ?langVersion: string - ) = + (fileContents: string, marker: string, defines: string list, classificationType: string, ?isScriptFile: bool, ?langVersion: string) + = let langVersion = langVersion |> Option.orElse (Some "preview") let (tokens, markerPosition) =