diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 34ccbbf8056..871b8f40a13 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -45,7 +45,7 @@ "rollForward": true }, "fantomas": { - "version": "6.2.3", + "version": "7.0.1", "commands": [ "fantomas" ], diff --git a/.config/service-branch-merge.json b/.config/service-branch-merge.json index 0c9d996e850..49561874be8 100644 --- a/.config/service-branch-merge.json +++ b/.config/service-branch-merge.json @@ -5,6 +5,10 @@ "MergeToBranch": "main", "ExtraSwitches": "-QuietComments" }, + "release/dev17.14": { + "MergeToBranch": "release/dev18.0", + "ExtraSwitches": "-QuietComments" + }, "main": { "MergeToBranch": "release/dev17.14", "ExtraSwitches": "-QuietComments" diff --git a/.gitignore b/.gitignore index 33c9666c14b..6ca107a5779 100644 --- a/.gitignore +++ b/.gitignore @@ -134,4 +134,6 @@ positive.exe /tests/FSharp.Compiler.ComponentTests/FSharpChecker/StandardOutput.txt # ilverify baseline result files -*.bsl.actual \ No newline at end of file +*.bsl.actual +/src/FSharp.DependencyManager.Nuget/StandardError.txt +/src/FSharp.DependencyManager.Nuget/StandardOutput.txt diff --git a/NuGet.config b/NuGet.config index 129a1d964be..944ae5b686e 100644 --- a/NuGet.config +++ b/NuGet.config @@ -8,7 +8,7 @@ - + diff --git a/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md b/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md index 5f722b11a12..c4e4a6a1403 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md @@ -1,4 +1,5 @@ ### Fixed +* Fix missing TailCall warning in TOp.IntegerForLoop ([PR #18399](https://github.com/dotnet/fsharp/pull/18399)) * Fix classification of `nameof` in `nameof<'T>`, `match … with nameof ident -> …`. ([Issue #10026](https://github.com/dotnet/fsharp/issues/10026), [PR #18300](https://github.com/dotnet/fsharp/pull/18300)) * Fix Realsig+ generates nested closures with incorrect Generic ([Issue #17797](https://github.com/dotnet/fsharp/issues/17797), [PR #17877](https://github.com/dotnet/fsharp/pull/17877)) * Fix optimizer internal error for records with static fields ([Issue #18165](https://github.com/dotnet/fsharp/issues/18165), [PR #18280](https://github.com/dotnet/fsharp/pull/18280)) @@ -18,6 +19,7 @@ * Miscellanous parentheses analyzer fixes. ([PR #18350](https://github.com/dotnet/fsharp/pull/18350)) * Fix duplicate parse error reporting for GetBackgroundCheckResultsForFileInProject ([Issue #18379](https://github.com/dotnet/fsharp/issues/18379) [PR #18380](https://github.com/dotnet/fsharp/pull/18380)) * Fix MethodDefNotFound when compiling code invoking delegate with option parameter ([Issue #5171](https://github.com/dotnet/fsharp/issues/5171), [PR #18385](https://github.com/dotnet/fsharp/pull/18385)) +* Fix #r nuget ..." downloads unneeded packages ([Issue #18231](https://github.com/dotnet/fsharp/issues/18231), [PR #18393](https://github.com/dotnet/fsharp/pull/18393)) ### Added * Added missing type constraints in FCS. ([PR #18241](https://github.com/dotnet/fsharp/pull/18241)) @@ -30,7 +32,6 @@ ### Changed - * FSharpCheckFileResults.ProjectContext.ProjectOptions will not be available when using the experimental Transparent Compiler feature. ([PR #18205](https://github.com/dotnet/fsharp/pull/18205)) * Update `Obsolete` attribute checking to account for `DiagnosticId` and `UrlFormat` properties. ([PR #18224](https://github.com/dotnet/fsharp/pull/18224)) * Remove `Cancellable.UsingToken` from tests ([PR #18276](https://github.com/dotnet/fsharp/pull/18276)) diff --git a/docs/release-notes/.VisualStudio/17.14.md b/docs/release-notes/.VisualStudio/17.14.md index db5d628bb0c..f9b710ea122 100644 --- a/docs/release-notes/.VisualStudio/17.14.md +++ b/docs/release-notes/.VisualStudio/17.14.md @@ -1,4 +1,5 @@ ### Fixed +* Fix #r nuget ..." downloads unneeded packages ([Issue #18231](https://github.com/dotnet/fsharp/issues/18231), [PR #18393](https://github.com/dotnet/fsharp/pull/18393)) ### Added * Add a switch to determine whether to generate a default implementation body for overridden method when completing. [PR #18341](https://github.com/dotnet/fsharp/pull/18341) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 61e4ad5b07b..a3b61734d48 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,32 +1,32 @@ - + https://github.com/dotnet/source-build-reference-packages - 27dfbb8d8a0344d845948109a5a1f0d9c7f17fa9 + 6968f7059f4418e985febe704a3b1320f9e5887d - + https://github.com/dotnet/msbuild - 0586a3f904d83c5f77f8407661429caadcbdc5f9 + 0ca03f84b7848ce9d7d3e5d1f68c5e090efa4f30 - + https://github.com/dotnet/msbuild - 0586a3f904d83c5f77f8407661429caadcbdc5f9 + 0ca03f84b7848ce9d7d3e5d1f68c5e090efa4f30 - + https://github.com/dotnet/msbuild - 0586a3f904d83c5f77f8407661429caadcbdc5f9 + 0ca03f84b7848ce9d7d3e5d1f68c5e090efa4f30 - + https://github.com/dotnet/msbuild - 0586a3f904d83c5f77f8407661429caadcbdc5f9 + 0ca03f84b7848ce9d7d3e5d1f68c5e090efa4f30 - + https://github.com/dotnet/msbuild - 0586a3f904d83c5f77f8407661429caadcbdc5f9 + 0ca03f84b7848ce9d7d3e5d1f68c5e090efa4f30 https://github.com/dotnet/runtime diff --git a/eng/Versions.props b/eng/Versions.props index 053f226f517..f3f7d84dc80 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -94,7 +94,7 @@ 17.10.40152 17.10.526-pre-g1b474069f5 17.10.41 - 17.13.21 + 17.13.22 $(RoslynVersion) $(RoslynVersion) @@ -130,9 +130,9 @@ 15.0.25123-Dev15Preview - 17.13.21 - 17.13.21 - 17.13.21 + 17.13.22 + 17.13.22 + 17.13.22 $(VisualStudioEditorPackagesVersion) diff --git a/global.json b/global.json index 3883eb9db41..eca327e814a 100644 --- a/global.json +++ b/global.json @@ -1,10 +1,10 @@ { "sdk": { - "version": "9.0.200", + "version": "9.0.202", "allowPrerelease": true }, "tools": { - "dotnet": "9.0.200", + "dotnet": "9.0.202", "vs": { "version": "17.8", "components": [ diff --git a/src/Compiler/AbstractIL/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/Checking/TailCallChecks.fs b/src/Compiler/Checking/TailCallChecks.fs index a7ea9ad802a..20e9bec8945 100644 --- a/src/Compiler/Checking/TailCallChecks.fs +++ b/src/Compiler/Checking/TailCallChecks.fs @@ -792,7 +792,12 @@ let CheckModuleBinding cenv (isRec: bool) (TBind _ as bind) = // warn for recursive calls in TryWith/TryFinally operations exprs |> Seq.iter (checkTailCall true) | Expr.Op(args = exprs) -> exprs |> Seq.iter (checkTailCall insideSubBindingOrTry) - | Expr.Sequential(expr2 = expr2) -> checkTailCall insideSubBindingOrTry expr2 + | Expr.Sequential(expr1 = expr1; expr2 = expr2) -> + match expr1 with + | Expr.Op(args = exprs; op = TOp.IntegerForLoop _) -> checkTailCall insideSubBindingOrTry expr1 + | _ -> () + + checkTailCall insideSubBindingOrTry expr2 | _ -> () checkTailCall false bodyExpr diff --git a/src/Compiler/CodeGen/EraseUnions.fs b/src/Compiler/CodeGen/EraseUnions.fs index e841010c837..18eaed4be6f 100644 --- a/src/Compiler/CodeGen/EraseUnions.fs +++ b/src/Compiler/CodeGen/EraseUnions.fs @@ -742,12 +742,14 @@ let mkMethodsAndPropertiesForFields basicProps, basicMethods let convAlternativeDef - (addMethodGeneratedAttrs, - addPropertyGeneratedAttrs, - addPropertyNeverAttrs, - addFieldGeneratedAttrs, - addFieldNeverAttrs, - mkDebuggerTypeProxyAttribute) + ( + addMethodGeneratedAttrs, + addPropertyGeneratedAttrs, + addPropertyNeverAttrs, + addFieldGeneratedAttrs, + addFieldNeverAttrs, + mkDebuggerTypeProxyAttribute + ) (g: TcGlobals) num (td: ILTypeDef) @@ -1255,12 +1257,14 @@ let convAlternativeDef baseMakerMeths, baseMakerProps, altUniqObjMeths, typeDefs, altDebugTypeDefs, altNullaryFields let mkClassUnionDef - (addMethodGeneratedAttrs, - addPropertyGeneratedAttrs, - addPropertyNeverAttrs, - addFieldGeneratedAttrs: ILFieldDef -> ILFieldDef, - addFieldNeverAttrs: ILFieldDef -> ILFieldDef, - mkDebuggerTypeProxyAttribute) + ( + addMethodGeneratedAttrs, + addPropertyGeneratedAttrs, + addPropertyNeverAttrs, + addFieldGeneratedAttrs: ILFieldDef -> ILFieldDef, + addFieldNeverAttrs: ILFieldDef -> ILFieldDef, + mkDebuggerTypeProxyAttribute + ) (g: TcGlobals) tref (td: ILTypeDef) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 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..b97b11a8054 100644 --- a/src/Compiler/Driver/ScriptClosure.fs +++ b/src/Compiler/Driver/ScriptClosure.fs @@ -45,6 +45,9 @@ type LoadClosure = /// The resolved package references along with the ranges of the #r positions in each file. PackageReferences: (range * string list)[] + /// The raw package manager lines in the script + PackageManagerLines: Map + /// Whether we're decided to use .NET Framework analysis for this script UseDesktopFramework: bool @@ -82,7 +85,8 @@ type CodeContext = module ScriptPreprocessClosure = /// Represents an input to the closure finding process - type ClosureSource = ClosureSource of fileName: string * referenceRange: range * sourceText: ISourceText * parseRequired: bool + type ClosureSource = + | ClosureSource of fileName: string * referenceRange: range * sourceText: ISourceText * Position option * parseRequired: bool /// Represents an output of the closure finding process type ClosureFile = @@ -159,7 +163,7 @@ module ScriptPreprocessClosure = reduceMemoryUsage ) = - let projectDir = !! Path.GetDirectoryName(fileName) + let projectDir = !!Path.GetDirectoryName(fileName) let isInteractive = (codeContext = CodeContext.CompilationAndEvaluation) let isInvalidationSupported = (codeContext = CodeContext.Editing) @@ -253,18 +257,14 @@ module ScriptPreprocessClosure = | Some(n: int) -> new StreamReader(stream, Encoding.GetEncoding n) let source = reader.ReadToEnd() - [ ClosureSource(fileName, m, SourceText.ofString source, parseRequired) ] + [ ClosureSource(fileName, m, SourceText.ofString source, None, parseRequired) ] with RecoverableException exn -> errorRecovery exn m [] let ApplyMetaCommandsFromInputToTcConfigAndGatherNoWarn - ( - tcConfig: TcConfig, - inp: ParsedInput, - pathOfMetaCommandSource, - dependencyProvider - ) = + (tcConfig: TcConfig, inp: ParsedInput, pathOfMetaCommandSource, dependencyProvider) + = let tcConfigB = tcConfig.CloneToBuilder() let mutable nowarns = [] @@ -313,16 +313,25 @@ module ScriptPreprocessClosure = let packageReferences = Dictionary(HashIdentity.Structural) // Resolve the packages - let rec resolveDependencyManagerSources scriptName = + let rec resolveDependencyManagerSources scriptName (caret: Position option) = + let caretLine = + match caret with + | None -> Int32.MinValue + | Some pos -> pos.Line + + let isEditorCursorInPackageLines (line: PackageManagerLine) = + caretLine >= line.Range.StartLine && caretLine <= line.Range.EndLine + [ if not (loadScripts.Contains scriptName) then for kv in tcConfig.packageManagerLines do let packageManagerKey, packageManagerLines = kv.Key, kv.Value - match packageManagerLines with + match packageManagerLines |> List.filter (not << isEditorCursorInPackageLines) with | [] -> () | packageManagerLine :: _ -> let m = packageManagerLine.Range + let packageManagerLines = packageManagerLines yield! processPackageManagerLines m packageManagerLines scriptName packageManagerKey ] @@ -426,7 +435,7 @@ module ScriptPreprocessClosure = let scriptText = stream.ReadAllText() loadScripts.Add script |> ignore let iSourceText = SourceText.ofString scriptText - yield! processClosureSource (ClosureSource(script, m, iSourceText, true)) + yield! processClosureSource (ClosureSource(script, m, iSourceText, None, true)) else // Send outputs via diagnostics @@ -443,7 +452,7 @@ module ScriptPreprocessClosure = tcConfig <- TcConfig.Create(tcConfigB, validate = false) ] - and processClosureSource (ClosureSource(fileName, m, sourceText, parseRequired)) = + and processClosureSource (ClosureSource(fileName, m, sourceText, caret, parseRequired)) = [ if not (observedSources.HaveSeen(fileName)) then observedSources.SetSeen(fileName) @@ -460,7 +469,7 @@ module ScriptPreprocessClosure = let diagnosticsLogger = CapturingDiagnosticsLogger("FindClosureMetaCommands") use _ = UseDiagnosticsLogger diagnosticsLogger - let pathOfMetaCommandSource = !! Path.GetDirectoryName(fileName) + let pathOfMetaCommandSource = !!Path.GetDirectoryName(fileName) let preSources = tcConfig.GetAvailableLoadedSources() let tcConfigResult, noWarns = @@ -473,7 +482,7 @@ module ScriptPreprocessClosure = tcConfig <- tcConfigResult // We accumulate the tcConfig in order to collect assembly references - yield! resolveDependencyManagerSources fileName + yield! resolveDependencyManagerSources fileName caret let postSources = tcConfig.GetAvailableLoadedSources() @@ -483,7 +492,7 @@ module ScriptPreprocessClosure = else [] - yield! resolveDependencyManagerSources fileName + yield! resolveDependencyManagerSources fileName caret for m, subFile in sources do if IsScript subFile then @@ -540,7 +549,7 @@ module ScriptPreprocessClosure = | _ -> lastClosureFile /// Reduce the full directive closure into LoadClosure - let GetLoadClosure (rootFilename, closureFiles, tcConfig: TcConfig, codeContext, packageReferences, earlierDiagnostics) = + let GetLoadClosure (rootFilename, closureFiles, tcConfig: TcConfig, codeContext, packageReferences, earlierDiagnostics) : LoadClosure = // Mark the last file as isLastCompiland. let closureFiles = @@ -612,23 +621,21 @@ module ScriptPreprocessClosure = // Filter out non-root errors and warnings let allRootDiagnostics = allRootDiagnostics |> List.filter (fst >> isRootRange) - let result: LoadClosure = - { - SourceFiles = List.groupBy fst sourceFiles |> List.map (map2Of2 (List.map snd)) - References = List.groupBy fst references |> List.map (map2Of2 (List.map snd)) - PackageReferences = packageReferences - UseDesktopFramework = (tcConfig.primaryAssembly = PrimaryAssembly.Mscorlib) - SdkDirOverride = tcConfig.sdkDirOverride - UnresolvedReferences = unresolvedReferences - Inputs = sourceInputs - NoWarns = List.groupBy fst globalNoWarns |> List.map (map2Of2 (List.map snd)) - OriginalLoadReferences = tcConfig.loadedSources - ResolutionDiagnostics = resolutionDiagnostics - AllRootFileDiagnostics = allRootDiagnostics - LoadClosureRootFileDiagnostics = loadClosureRootDiagnostics - } - - result + { + SourceFiles = List.groupBy fst sourceFiles |> List.map (map2Of2 (List.map snd)) + References = List.groupBy fst references |> List.map (map2Of2 (List.map snd)) + PackageReferences = packageReferences + PackageManagerLines = tcConfig.packageManagerLines + UseDesktopFramework = (tcConfig.primaryAssembly = PrimaryAssembly.Mscorlib) + SdkDirOverride = tcConfig.sdkDirOverride + UnresolvedReferences = unresolvedReferences + Inputs = sourceInputs + NoWarns = List.groupBy fst globalNoWarns |> List.map (map2Of2 (List.map snd)) + OriginalLoadReferences = tcConfig.loadedSources + ResolutionDiagnostics = resolutionDiagnostics + AllRootFileDiagnostics = allRootDiagnostics + LoadClosureRootFileDiagnostics = loadClosureRootDiagnostics + } /// Given source text, find the full load closure. Used from service.fs, when editing a script file let GetFullClosureOfScriptText @@ -637,6 +644,7 @@ module ScriptPreprocessClosure = defaultFSharpBinariesDir, fileName, sourceText, + caret, codeContext, useSimpleResolution, useFsiAuxLib, @@ -649,7 +657,6 @@ module ScriptPreprocessClosure = reduceMemoryUsage, dependencyProvider ) = - // Resolve the basic references such as FSharp.Core.dll first, before processing any #I directives in the script // // This is tries to mimic the action of running the script in F# Interactive - the initial context for scripting is created @@ -700,7 +707,7 @@ module ScriptPreprocessClosure = reduceMemoryUsage ) - let closureSources = [ ClosureSource(fileName, range0, sourceText, true) ] + let closureSources = [ ClosureSource(fileName, range0, sourceText, caret, true) ] let closureFiles, tcConfig, packageReferences = FindClosureFiles(fileName, closureSources, tcConfig, codeContext, lexResourceManager, dependencyProvider) @@ -710,13 +717,8 @@ module ScriptPreprocessClosure = /// Given source file fileName, find the full load closure /// Used from fsi.fs and fsc.fs, for #load and command line let GetFullClosureOfScriptFiles - ( - tcConfig: TcConfig, - files: (string * range) list, - codeContext, - lexResourceManager: Lexhelp.LexResourceManager, - dependencyProvider - ) = + (tcConfig: TcConfig, files: (string * range) list, codeContext, lexResourceManager: Lexhelp.LexResourceManager, dependencyProvider) + = let mainFile, _mainFileRange = List.last files @@ -742,6 +744,7 @@ type LoadClosure with defaultFSharpBinariesDir, fileName: string, sourceText: ISourceText, + caret: Position option, implicitDefines, useSimpleResolution: bool, useFsiAuxLib, @@ -762,6 +765,7 @@ type LoadClosure with defaultFSharpBinariesDir, fileName, sourceText, + caret, implicitDefines, useSimpleResolution, useFsiAuxLib, diff --git a/src/Compiler/Driver/ScriptClosure.fsi b/src/Compiler/Driver/ScriptClosure.fsi index 6f764b299a9..249885036cd 100644 --- a/src/Compiler/Driver/ScriptClosure.fsi +++ b/src/Compiler/Driver/ScriptClosure.fsi @@ -42,6 +42,9 @@ type LoadClosure = /// The resolved package references along with the ranges of the #r positions in each file. PackageReferences: (range * string list)[] + /// The raw package manager lines in the script + PackageManagerLines: Map + /// Whether we're decided to use .NET Framework analysis for this script UseDesktopFramework: bool @@ -80,6 +83,7 @@ type LoadClosure = defaultFSharpBinariesDir: string * fileName: string * sourceText: ISourceText * + caret: Position option * implicitDefines: CodeContext * useSimpleResolution: bool * useFsiAuxLib: bool * diff --git a/src/Compiler/Driver/StaticLinking.fs b/src/Compiler/Driver/StaticLinking.fs index 53916744622..3624ecef9b2 100644 --- a/src/Compiler/Driver/StaticLinking.fs +++ b/src/Compiler/Driver/StaticLinking.fs @@ -104,13 +104,8 @@ let debugStaticLinking = isEnvVarSet "FSHARP_DEBUG_STATIC_LINKING" #endif let StaticLinkILModules - ( - tcConfig: TcConfig, - ilGlobals, - tcImports, - ilxMainModule, - dependentILModules: (CcuThunk option * ILModuleDef) list - ) = + (tcConfig: TcConfig, ilGlobals, tcImports, ilxMainModule, dependentILModules: (CcuThunk option * ILModuleDef) list) + = if isNil dependentILModules then ilxMainModule, id else diff --git a/src/Compiler/Driver/fsc.fs b/src/Compiler/Driver/fsc.fs index 0e26f2db4ac..3518d9d4884 100644 --- a/src/Compiler/Driver/fsc.fs +++ b/src/Compiler/Driver/fsc.fs @@ -139,18 +139,8 @@ let AbortOnError (diagnosticsLogger: DiagnosticsLogger, exiter: Exiter) = exiter.Exit 1 let TypeCheck - ( - ctok, - tcConfig, - tcImports, - tcGlobals, - diagnosticsLogger: DiagnosticsLogger, - assemblyName, - tcEnv0, - openDecls0, - inputs, - exiter: Exiter - ) = + (ctok, tcConfig, tcImports, tcGlobals, diagnosticsLogger: DiagnosticsLogger, assemblyName, tcEnv0, openDecls0, inputs, exiter: Exiter) + = try if isNil inputs then error (Error(FSComp.SR.fscNoImplementationFiles (), rangeStartup)) @@ -346,9 +336,7 @@ module InterfaceFileWriter = if String.IsNullOrEmpty(tcConfig.printSignatureFile) then Console.Out else - FileSystem - .OpenFileForWriteShim(tcConfig.printSignatureFile, FileMode.Create) - .GetWriter() + FileSystem.OpenFileForWriteShim(tcConfig.printSignatureFile, FileMode.Create).GetWriter() writeHeader tcConfig.printSignatureFile os @@ -367,7 +355,7 @@ module InterfaceFileWriter = let writeToSeparateFiles (declaredImpls: CheckedImplFile list) = for CheckedImplFile(qualifiedNameOfFile = name) as impl in declaredImpls do let fileName = - !! Path.ChangeExtension(name.Range.FileName, extensionForFile name.Range.FileName) + !!Path.ChangeExtension(name.Range.FileName, extensionForFile name.Range.FileName) printfn "writing impl file to %s" fileName use os = FileSystem.OpenFileForWriteShim(fileName, FileMode.Create).GetWriter() @@ -388,7 +376,7 @@ module InterfaceFileWriter = // 2) If not, but FSharp.Core.dll exists beside the compiler binaries, it will copy it to output directory. // 3) If not, it will produce an error. let CopyFSharpCore (outFile: string, referencedDlls: AssemblyReference list) = - let outDir = !! Path.GetDirectoryName(outFile) + let outDir = !!Path.GetDirectoryName(outFile) let fsharpCoreAssemblyName = GetFSharpCoreLibraryName() + ".dll" let fsharpCoreDestinationPath = Path.Combine(outDir, fsharpCoreAssemblyName) @@ -408,7 +396,7 @@ let CopyFSharpCore (outFile: string, referencedDlls: AssemblyReference list) = | Some referencedFsharpCoreDll -> copyFileIfDifferent referencedFsharpCoreDll.Text fsharpCoreDestinationPath | None -> let executionLocation = Assembly.GetExecutingAssembly().Location - let compilerLocation = !! Path.GetDirectoryName(executionLocation) + let compilerLocation = !!Path.GetDirectoryName(executionLocation) let compilerFsharpCoreDllPath = Path.Combine(compilerLocation, fsharpCoreAssemblyName) diff --git a/src/Compiler/Facilities/CompilerLocation.fs b/src/Compiler/Facilities/CompilerLocation.fs index 2e9137fc75d..7d902aefc27 100644 --- a/src/Compiler/Facilities/CompilerLocation.fs +++ b/src/Compiler/Facilities/CompilerLocation.fs @@ -14,9 +14,7 @@ open Internal.Utilities.Library module internal FSharpEnvironment = - type private TypeInThisAssembly = - class - end + type private TypeInThisAssembly = class end /// The F# version reported in the banner let FSharpBannerVersion = @@ -90,7 +88,7 @@ module internal FSharpEnvironment = let fallback () = let d = Assembly.GetExecutingAssembly() - Some(!! Path.GetDirectoryName(d.Location)) + Some(!!Path.GetDirectoryName(d.Location)) match tryCurrentDomain () with | None -> fallback () @@ -171,12 +169,8 @@ module internal FSharpEnvironment = } let getTypeProviderAssembly - ( - runTimeAssemblyFileName: string, - designTimeAssemblyName: string, - compilerToolPaths: string list, - raiseError - ) = + (runTimeAssemblyFileName: string, designTimeAssemblyName: string, compilerToolPaths: string list, raiseError) + = // Find and load the designer assembly for the type provider component. // We look in the directories stepping up from the location of the runtime assembly. let loadFromLocation designTimeAssemblyPath = @@ -213,7 +207,7 @@ module internal FSharpEnvironment = | Some res -> loadFromLocation res | None -> // The search failed, just load from the first location and report an error - let runTimeAssemblyPath = !! Path.GetDirectoryName(runTimeAssemblyFileName) + let runTimeAssemblyPath = !!Path.GetDirectoryName(runTimeAssemblyFileName) loadFromLocation (Path.Combine(runTimeAssemblyPath, designTimeAssemblyName)) if designTimeAssemblyName.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) then @@ -224,7 +218,7 @@ module internal FSharpEnvironment = // design-time DLLs specified using "x.DesignTIme, Version= ..." long assembly names and GAC loads. // These kind of design-time assembly specifications are no longer used to our knowledge so that comparison is basically legacy // and will always succeed. - let name = AssemblyName(!! Path.GetFileNameWithoutExtension(designTimeAssemblyName)) + let name = AssemblyName(!!Path.GetFileNameWithoutExtension(designTimeAssemblyName)) if name.FullName.Equals(name.Name, StringComparison.OrdinalIgnoreCase) then let designTimeFileName = designTimeAssemblyName + ".dll" @@ -276,7 +270,7 @@ module internal FSharpEnvironment = // Must be alongside the location of FSharp.CompilerService.dll let getDefaultFsiLibraryLocation () = - Path.Combine(!! Path.GetDirectoryName(getFSharpCompilerLocation ()), fsiLibraryName + ".dll") + Path.Combine(!!Path.GetDirectoryName(getFSharpCompilerLocation ()), fsiLibraryName + ".dll") let isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) @@ -355,12 +349,12 @@ module internal FSharpEnvironment = [| match getDotnetHostPath (), getDotnetGlobalHostPath () with | Some hostPath, Some globalHostPath -> - yield !! Path.GetDirectoryName(hostPath) + yield !!Path.GetDirectoryName(hostPath) if isDotnetMultilevelLookup && hostPath <> globalHostPath then - yield !! Path.GetDirectoryName(globalHostPath) - | Some hostPath, None -> yield !! Path.GetDirectoryName(hostPath) - | None, Some globalHostPath -> yield !! Path.GetDirectoryName(globalHostPath) + yield !!Path.GetDirectoryName(globalHostPath) + | Some hostPath, None -> yield !!Path.GetDirectoryName(hostPath) + | None, Some globalHostPath -> yield !!Path.GetDirectoryName(globalHostPath) | None, None -> () |] diff --git a/src/Compiler/Facilities/DiagnosticsLogger.fs b/src/Compiler/Facilities/DiagnosticsLogger.fs index e5869fe04b2..eb96a5f6e0b 100644 --- a/src/Compiler/Facilities/DiagnosticsLogger.fs +++ b/src/Compiler/Facilities/DiagnosticsLogger.fs @@ -435,8 +435,7 @@ module DiagnosticsLoggerExtensions = try if not tryAndDetectDev15 then let preserveStackTrace = - !!typeof - .GetMethod("InternalPreserveStackTrace", BindingFlags.Instance ||| BindingFlags.NonPublic) + !!typeof.GetMethod("InternalPreserveStackTrace", BindingFlags.Instance ||| BindingFlags.NonPublic) preserveStackTrace.Invoke(exn, null) |> ignore with _ -> diff --git a/src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs b/src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs index c9f84390367..dc0e30cac72 100644 --- a/src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs +++ b/src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs @@ -82,7 +82,7 @@ let private SimulatedMSBuildResolver = if Environment.OSVersion.Platform = PlatformID.Win32NT then let PF = match Environment.GetEnvironmentVariable("ProgramFiles(x86)") with - | null -> !! Environment.GetEnvironmentVariable("ProgramFiles") // if PFx86 is null, then we are 32-bit and just get PF + | null -> !!Environment.GetEnvironmentVariable("ProgramFiles") // if PFx86 is null, then we are 32-bit and just get PF | s -> s PF + @"\Reference Assemblies\Microsoft\Framework\.NETFramework" @@ -150,7 +150,7 @@ let private SimulatedMSBuildResolver = let fscoreDir0 = let PF = match Environment.GetEnvironmentVariable("ProgramFiles(x86)") with - | null -> !! Environment.GetEnvironmentVariable("ProgramFiles") + | null -> !!Environment.GetEnvironmentVariable("ProgramFiles") | s -> s PF @@ -198,7 +198,7 @@ let private SimulatedMSBuildResolver = let netFx = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() let gac = - Path.Combine(!! Path.GetDirectoryName(Path.GetDirectoryName(netFx.TrimEnd('\\'))), "assembly") + Path.Combine(!!Path.GetDirectoryName(Path.GetDirectoryName(netFx.TrimEnd('\\'))), "assembly") match n.Version, n.GetPublicKeyToken() with | null, _ diff --git a/src/Compiler/Facilities/prim-lexing.fs b/src/Compiler/Facilities/prim-lexing.fs index c305052587c..381e11eaa3a 100644 --- a/src/Compiler/Facilities/prim-lexing.fs +++ b/src/Compiler/Facilities/prim-lexing.fs @@ -192,7 +192,7 @@ module SourceTextNew = member _.GetChecksum() = // TODO: something better... - !! sourceText.ToString() + !!sourceText.ToString() |> Md5Hasher.hashString |> fun byteArray -> ImmutableArray.Create(byteArray, 0, byteArray.Length) } @@ -356,12 +356,8 @@ and [] internal LexBuffer<'Char> FSharp.Compiler.DiagnosticsLogger.checkLanguageFeatureAndRecover langVersion featureId range static member FromFunction - ( - reportLibraryOnlyFeatures, - langVersion, - strictIndentation, - f: 'Char[] * int * int -> int - ) : LexBuffer<'Char> = + (reportLibraryOnlyFeatures, langVersion, strictIndentation, f: 'Char[] * int * int -> int) + : LexBuffer<'Char> = let extension = Array.zeroCreate 4096 let filler (lexBuffer: LexBuffer<'Char>) = @@ -385,8 +381,7 @@ and [] internal LexBuffer<'Char> static member FromArray(reportLibraryOnlyFeatures, langVersion, strictIndentation, s: 'Char[]) : LexBuffer<'Char> = let buffer = Array.copy s - LexBuffer<'Char> - .FromArrayNoCopy(reportLibraryOnlyFeatures, langVersion, strictIndentation, buffer) + LexBuffer<'Char>.FromArrayNoCopy(reportLibraryOnlyFeatures, langVersion, strictIndentation, buffer) // Important: This method takes ownership of the array static member FromChars(reportLibraryOnlyFeatures, langVersion, strictIndentation, arr: char[]) = diff --git a/src/Compiler/Interactive/fsi.fs b/src/Compiler/Interactive/fsi.fs index eaba5aa6582..78d5cb94dcd 100644 --- a/src/Compiler/Interactive/fsi.fs +++ b/src/Compiler/Interactive/fsi.fs @@ -128,7 +128,7 @@ module internal Utilities = } else let specialized = typedefof>.MakeGenericType [| ty |] - !! Activator.CreateInstance(specialized) :?> IAnyToLayoutCall + !!Activator.CreateInstance(specialized) :?> IAnyToLayoutCall let callStaticMethod (ty: Type) name args = ty.InvokeMember( @@ -395,7 +395,7 @@ type ILMultiInMemoryAssemblyEmitEnv and convTypeAux ty = match ty with - | ILType.Void -> !! Type.GetType("System.Void") + | ILType.Void -> !!Type.GetType("System.Void") | ILType.Array(shape, eltType) -> let baseT = convTypeAux eltType @@ -442,7 +442,7 @@ type ILMultiInMemoryAssemblyEmitEnv let ltref = mkRefForNestedILTypeDef ILScopeRef.Local (enc, tdef) let tref = mkRefForNestedILTypeDef ilScopeRef (enc, tdef) let key = tref.BasicQualifiedName - let typ = !! asm.GetType(key) + let typ = !!asm.GetType(key) //printfn "Adding %s --> %s" key typ.FullName let rtref = rescopeILTypeRef dynamicCcuScopeRef tref typeMap.Add(ltref, (typ, tref)) @@ -1581,7 +1581,7 @@ let rec ConvReflectionTypeToILType (reflectionTy: Type) = let elementOrItemTref = if reflectionTy.HasElementType then - !! reflectionTy.GetElementType() + !!reflectionTy.GetElementType() else reflectionTy |> ConvReflectionTypeToILTypeRef @@ -1904,7 +1904,7 @@ type internal FsiDynamicCompiler if edef.ArgCount = 0 then yield (fun () -> - let typ = !! asm.GetType(edef.DeclaringTypeRef.BasicQualifiedName) + let typ = !!asm.GetType(edef.DeclaringTypeRef.BasicQualifiedName) try ignore ( @@ -2438,14 +2438,8 @@ type internal FsiDynamicCompiler /// Evaluate the given definitions and produce a new interactive state. member _.EvalParsedDefinitions - ( - ctok, - diagnosticsLogger: DiagnosticsLogger, - istate, - showTypes, - isInteractiveItExpr, - defs: SynModuleDecl list - ) = + (ctok, diagnosticsLogger: DiagnosticsLogger, istate, showTypes, isInteractiveItExpr, defs: SynModuleDecl list) + = let fileName = stdinMockFileName let m = @@ -2681,12 +2675,8 @@ type internal FsiDynamicCompiler member _.HasDelayedDependencyManagerText = hasDelayedDependencyManagerText member fsiDynamicCompiler.ProcessDelayedDependencyManagerText - ( - ctok, - istate: FsiDynamicCompilerState, - lexResourceManager, - diagnosticsLogger - ) = + (ctok, istate: FsiDynamicCompilerState, lexResourceManager, diagnosticsLogger) + = if not hasDelayedDependencyManagerText then istate else @@ -2828,12 +2818,8 @@ type internal FsiDynamicCompiler /// Scrape #r, #I and package manager commands from a #load member fsiDynamicCompiler.ProcessMetaCommandsFromParsedInputAsInteractiveCommands - ( - ctok, - istate: FsiDynamicCompilerState, - sourceFile, - input - ) = + (ctok, istate: FsiDynamicCompilerState, sourceFile, input) + = WithImplicitHome (tcConfigB, directoryName sourceFile) (fun () -> ProcessMetaCommandsFromInput ((fun st (m, nm) -> @@ -2845,7 +2831,7 @@ type internal FsiDynamicCompiler st), (fun _ _ -> ())) - (tcConfigB, input, !! Path.GetDirectoryName(sourceFile), istate)) + (tcConfigB, input, !!Path.GetDirectoryName(sourceFile), istate)) member fsiDynamicCompiler.EvalSourceFiles(ctok, istate, m, sourceFiles, lexResourceManager, diagnosticsLogger: DiagnosticsLogger) = let tcConfig = TcConfig.Create(tcConfigB, validate = false) @@ -4468,11 +4454,8 @@ let internal SpawnThread name f = th.Start() let internal SpawnInteractiveServer - ( - fsi: FsiEvaluationSessionHostConfig, - fsiOptions: FsiCommandLineOptions, - fsiConsoleOutput: FsiConsoleOutput - ) = + (fsi: FsiEvaluationSessionHostConfig, fsiOptions: FsiCommandLineOptions, fsiConsoleOutput: FsiConsoleOutput) + = //printf "Spawning fsi server on channel '%s'" !fsiServerName; SpawnThread "ServerThread" (fun () -> use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID @@ -4486,11 +4469,8 @@ let internal SpawnInteractiveServer /// /// This gives us a last chance to catch an abort on the main execution thread. let internal DriveFsiEventLoop - ( - fsi: FsiEvaluationSessionHostConfig, - fsiInterruptController: FsiInterruptController, - fsiConsoleOutput: FsiConsoleOutput - ) = + (fsi: FsiEvaluationSessionHostConfig, fsiInterruptController: FsiInterruptController, fsiConsoleOutput: FsiConsoleOutput) + = if progress then fprintfn fsiConsoleOutput.Out "GUI thread runLoop" @@ -4770,7 +4750,7 @@ type FsiEvaluationSession let makeNestedException (userExn: #Exception) = // clone userExn -- make userExn the inner exception, to retain the stacktrace on raise let arguments = [| userExn.Message :> obj; userExn :> obj |] - !! Activator.CreateInstance(userExn.GetType(), arguments) :?> Exception + !!Activator.CreateInstance(userExn.GetType(), arguments) :?> Exception let commitResult res = match res with diff --git a/src/Compiler/Service/BackgroundCompiler.fs b/src/Compiler/Service/BackgroundCompiler.fs index 329fd21c63d..5eb8bd35f99 100644 --- a/src/Compiler/Service/BackgroundCompiler.fs +++ b/src/Compiler/Service/BackgroundCompiler.fs @@ -112,6 +112,7 @@ type internal IBackgroundCompiler = abstract member GetProjectOptionsFromScript: fileName: string * sourceText: ISourceText * + caret: Position option * previewEnabled: bool option * loadedTimeStamp: System.DateTime option * otherFlags: string array option * @@ -126,6 +127,7 @@ type internal IBackgroundCompiler = abstract GetProjectSnapshotFromScript: fileName: string * sourceText: ISourceTextNew * + caret: Position option * documentSource: DocumentSource * previewEnabled: bool option * loadedTimeStamp: System.DateTime option * @@ -578,14 +580,8 @@ type internal BackgroundCompiler res) member _.ParseFile - ( - fileName: string, - sourceText: ISourceText, - options: FSharpParsingOptions, - cache: bool, - flatErrors: bool, - userOpName: string - ) = + (fileName: string, sourceText: ISourceText, options: FSharpParsingOptions, cache: bool, flatErrors: bool, userOpName: string) + = async { use _ = Activity.start @@ -781,14 +777,8 @@ type internal BackgroundCompiler /// Type-check the result obtained by parsing, but only if the antecedent type checking context is available. member bc.CheckFileInProjectAllowingStaleCachedResults - ( - parseResults: FSharpParseFileResults, - fileName, - fileVersion, - sourceText: ISourceText, - options, - userOpName - ) = + (parseResults: FSharpParseFileResults, fileName, fileVersion, sourceText: ISourceText, options, userOpName) + = async { use _ = Activity.start @@ -841,14 +831,8 @@ type internal BackgroundCompiler /// Type-check the result obtained by parsing. Force the evaluation of the antecedent type checking context if needed. member bc.CheckFileInProject - ( - parseResults: FSharpParseFileResults, - fileName, - fileVersion, - sourceText: ISourceText, - options, - userOpName - ) = + (parseResults: FSharpParseFileResults, fileName, fileVersion, sourceText: ISourceText, options, userOpName) + = async { use _ = Activity.start @@ -890,13 +874,8 @@ type internal BackgroundCompiler /// Parses and checks the source file and returns untyped AST and check results. member bc.ParseAndCheckFileInProject - ( - fileName: string, - fileVersion, - sourceText: ISourceText, - options: FSharpProjectOptions, - userOpName - ) = + (fileName: string, fileVersion, sourceText: ISourceText, options: FSharpProjectOptions, userOpName) + = async { use _ = Activity.start @@ -1090,13 +1069,8 @@ type internal BackgroundCompiler } member _.FindReferencesInFile - ( - fileName: string, - options: FSharpProjectOptions, - symbol: FSharpSymbol, - canInvalidateProject: bool, - userOpName: string - ) = + (fileName: string, options: FSharpProjectOptions, symbol: FSharpSymbol, canInvalidateProject: bool, userOpName: string) + = async { use _ = Activity.start @@ -1150,12 +1124,8 @@ type internal BackgroundCompiler /// Try to get recent approximate type check results for a file. member _.TryGetRecentCheckResultsForFile - ( - fileName: string, - options: FSharpProjectOptions, - sourceText: ISourceText option, - _userOpName: string - ) = + (fileName: string, options: FSharpProjectOptions, sourceText: ISourceText option, _userOpName: string) + = use _ = Activity.start "BackgroundCompiler.GetSemanticClassificationForFile" @@ -1308,6 +1278,7 @@ type internal BackgroundCompiler ( fileName, sourceText, + caret, previewEnabled, loadedTimeStamp, otherFlags, @@ -1358,6 +1329,7 @@ type internal BackgroundCompiler FSharpCheckerResultsSettings.defaultFSharpBinariesDir, fileName, sourceText, + caret, CodeContext.Editing, useSimpleResolution, useFsiAuxLib, @@ -1539,13 +1511,8 @@ type internal BackgroundCompiler member _.FileParsed: IEvent = self.FileParsed member _.FindReferencesInFile - ( - fileName: string, - options: FSharpProjectOptions, - symbol: FSharpSymbol, - canInvalidateProject: bool, - userOpName: string - ) : Async> = + (fileName: string, options: FSharpProjectOptions, symbol: FSharpSymbol, canInvalidateProject: bool, userOpName: string) + : Async> = self.FindReferencesInFile(fileName, options, symbol, canInvalidateProject, userOpName) member this.FindReferencesInFile(fileName, projectSnapshot, symbol, userOpName) = @@ -1557,42 +1524,30 @@ type internal BackgroundCompiler self.GetAssemblyData(options, userOpName) member _.GetAssemblyData - ( - projectSnapshot: FSharpProjectSnapshot, - _fileName: string, - userOpName: string - ) : Async = + (projectSnapshot: FSharpProjectSnapshot, _fileName: string, userOpName: string) + : Async = self.GetAssemblyData(projectSnapshot.ToOptions(), userOpName) member _.GetBackgroundCheckResultsForFileInProject - ( - fileName: string, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, options: FSharpProjectOptions, userOpName: string) + : Async = self.GetBackgroundCheckResultsForFileInProject(fileName, options, userOpName) member _.GetBackgroundParseResultsForFileInProject - ( - fileName: string, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, options: FSharpProjectOptions, userOpName: string) + : Async = self.GetBackgroundParseResultsForFileInProject(fileName, options, userOpName) member _.GetCachedCheckFileResult - ( - builder: IncrementalBuilder, - fileName: string, - sourceText: ISourceText, - options: FSharpProjectOptions - ) : Async<(FSharpParseFileResults * FSharpCheckFileResults) option> = + (builder: IncrementalBuilder, fileName: string, sourceText: ISourceText, options: FSharpProjectOptions) + : Async<(FSharpParseFileResults * FSharpCheckFileResults) option> = self.GetCachedCheckFileResult(builder, fileName, sourceText, options) member _.GetProjectOptionsFromScript ( fileName: string, sourceText: ISourceText, + caret: Position option, previewEnabled: bool option, loadedTimeStamp: DateTime option, otherFlags: string array option, @@ -1606,6 +1561,7 @@ type internal BackgroundCompiler self.GetProjectOptionsFromScript( fileName, sourceText, + caret, previewEnabled, loadedTimeStamp, otherFlags, @@ -1621,6 +1577,7 @@ type internal BackgroundCompiler ( fileName: string, sourceText: ISourceTextNew, + caret: Position option, documentSource: DocumentSource, previewEnabled: bool option, loadedTimeStamp: DateTime option, @@ -1637,6 +1594,7 @@ type internal BackgroundCompiler self.GetProjectOptionsFromScript( fileName, sourceText, + caret, previewEnabled, loadedTimeStamp, otherFlags, @@ -1653,19 +1611,13 @@ type internal BackgroundCompiler } member _.GetSemanticClassificationForFile - ( - fileName: string, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, options: FSharpProjectOptions, userOpName: string) + : Async = self.GetSemanticClassificationForFile(fileName, options, userOpName) member _.GetSemanticClassificationForFile - ( - fileName: string, - snapshot: FSharpProjectSnapshot, - userOpName: string - ) : Async = + (fileName: string, snapshot: FSharpProjectSnapshot, userOpName: string) + : Async = self.GetSemanticClassificationForFile(fileName, snapshot.ToOptions(), userOpName) member _.InvalidateConfiguration(options: FSharpProjectOptions, userOpName: string) : unit = @@ -1682,21 +1634,13 @@ type internal BackgroundCompiler self.NotifyProjectCleaned(options, userOpName) member _.ParseAndCheckFileInProject - ( - fileName: string, - fileVersion: int, - sourceText: ISourceText, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, fileVersion: int, sourceText: ISourceText, options: FSharpProjectOptions, userOpName: string) + : Async = self.ParseAndCheckFileInProject(fileName, fileVersion, sourceText, options, userOpName) member _.ParseAndCheckFileInProject - ( - fileName: string, - projectSnapshot: FSharpProjectSnapshot, - userOpName: string - ) : Async = + (fileName: string, projectSnapshot: FSharpProjectSnapshot, userOpName: string) + : Async = async { let fileSnapshot = projectSnapshot.ProjectSnapshot.SourceFiles @@ -1715,14 +1659,8 @@ type internal BackgroundCompiler self.ParseAndCheckProject(projectSnapshot.ToOptions(), userOpName) member _.ParseFile - ( - fileName: string, - sourceText: ISourceText, - options: FSharpParsingOptions, - cache: bool, - flatErrors: bool, - userOpName: string - ) = + (fileName: string, sourceText: ISourceText, options: FSharpParsingOptions, cache: bool, flatErrors: bool, userOpName: string) + = self.ParseFile(fileName, sourceText, options, cache, flatErrors, userOpName) member _.ParseFile(fileName: string, projectSnapshot: FSharpProjectSnapshot, userOpName: string) = @@ -1733,18 +1671,11 @@ type internal BackgroundCompiler member _.ProjectChecked: IEvent = self.ProjectChecked member _.TryGetRecentCheckResultsForFile - ( - fileName: string, - options: FSharpProjectOptions, - sourceText: ISourceText option, - userOpName: string - ) : (FSharpParseFileResults * FSharpCheckFileResults * SourceTextHash) option = + (fileName: string, options: FSharpProjectOptions, sourceText: ISourceText option, userOpName: string) + : (FSharpParseFileResults * FSharpCheckFileResults * SourceTextHash) option = self.TryGetRecentCheckResultsForFile(fileName, options, sourceText, userOpName) member _.TryGetRecentCheckResultsForFile - ( - fileName: string, - projectSnapshot: FSharpProjectSnapshot, - userOpName: string - ) : (FSharpParseFileResults * FSharpCheckFileResults) option = + (fileName: string, projectSnapshot: FSharpProjectSnapshot, userOpName: string) + : (FSharpParseFileResults * FSharpCheckFileResults) option = self.TryGetRecentCheckResultsForFile(fileName, projectSnapshot, userOpName) diff --git a/src/Compiler/Service/BackgroundCompiler.fsi b/src/Compiler/Service/BackgroundCompiler.fsi index d93ece6217b..6192b23e3f9 100644 --- a/src/Compiler/Service/BackgroundCompiler.fsi +++ b/src/Compiler/Service/BackgroundCompiler.fsi @@ -90,6 +90,7 @@ type internal IBackgroundCompiler = abstract GetProjectOptionsFromScript: fileName: string * sourceText: ISourceText * + caret: Position option * previewEnabled: bool option * loadedTimeStamp: System.DateTime option * otherFlags: string array option * @@ -104,6 +105,7 @@ type internal IBackgroundCompiler = abstract GetProjectSnapshotFromScript: fileName: string * sourceText: ISourceTextNew * + caret: Position option * documentSource: DocumentSource * previewEnabled: bool option * loadedTimeStamp: System.DateTime option * diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index 8cb27875075..57d322c81a8 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -188,7 +188,7 @@ and FSharpProjectOptions = && options1.ReferencedProjects = options2.ReferencedProjects && options1.LoadTime = options2.LoadTime - member po.ProjectDirectory = !! Path.GetDirectoryName(po.ProjectFileName) + member po.ProjectDirectory = !!Path.GetDirectoryName(po.ProjectFileName) override this.ToString() = "FSharpProjectOptions(" + this.ProjectFileName + ")" @@ -2042,15 +2042,8 @@ type internal TypeCheckInfo /// Get the auto-complete items at a location member _.GetDeclarations - ( - parseResultsOpt, - line, - lineStr, - partialName, - completionContextAtPos, - getAllEntities, - genBodyForOverriddenMeth - ) = + (parseResultsOpt, line, lineStr, partialName, completionContextAtPos, getAllEntities, genBodyForOverriddenMeth) + = let isSigFile = SourceFileImpl.IsSignatureFile mainInputFileName DiagnosticsScope.Protect @@ -3109,14 +3102,8 @@ module internal ParseAndCheckFile = errHandler.CollectedDiagnostics(None), parseResult, errHandler.AnyErrors let ApplyLoadClosure - ( - tcConfig, - parsedMainInput, - mainInputFileName: string, - loadClosure: LoadClosure option, - tcImports: TcImports, - backgroundDiagnostics - ) = + (tcConfig, parsedMainInput, mainInputFileName: string, loadClosure: LoadClosure option, tcImports: TcImports, backgroundDiagnostics) + = // If additional references were brought in by the preprocessor then we need to process them match loadClosure with @@ -3204,7 +3191,7 @@ module internal ParseAndCheckFile = ApplyMetaCommandsFromInputToTcConfig( tcConfig, parsedMainInput, - !! Path.GetDirectoryName(mainInputFileName), + !!Path.GetDirectoryName(mainInputFileName), tcImports.DependencyProvider ) |> ignore @@ -3255,7 +3242,7 @@ module internal ParseAndCheckFile = // Apply nowarns to tcConfig (may generate errors, so ensure diagnosticsLogger is installed) let tcConfig = - ApplyNoWarnsToTcConfig(tcConfig, parsedMainInput, !! Path.GetDirectoryName(mainInputFileName)) + ApplyNoWarnsToTcConfig(tcConfig, parsedMainInput, !!Path.GetDirectoryName(mainInputFileName)) // update the error handler with the modified tcConfig errHandler.DiagnosticOptions <- tcConfig.diagnosticsOptions @@ -3383,15 +3370,8 @@ type FSharpCheckFileResults /// Intellisense autocompletions member _.GetDeclarationListInfo - ( - parsedFileResults, - line, - lineText, - partialName, - ?getAllEntities, - ?completionContextAtPos, - ?genBodyForOverriddenMeth - ) = + (parsedFileResults, line, lineText, partialName, ?getAllEntities, ?completionContextAtPos, ?genBodyForOverriddenMeth) + = let getAllEntities = defaultArg getAllEntities (fun () -> []) let genBodyForOverriddenMeth = defaultArg genBodyForOverriddenMeth true @@ -3638,12 +3618,7 @@ type FSharpCheckFileResults FSharpCheckFileResults(fileName, creationErrors, None, [||], None, keepAssemblyContents) static member JoinErrors - ( - isIncompleteTypeCheckEnvironment, - creationErrors: FSharpDiagnostic[], - parseErrors: FSharpDiagnostic[], - tcErrors: FSharpDiagnostic[] - ) = + (isIncompleteTypeCheckEnvironment, creationErrors: FSharpDiagnostic[], parseErrors: FSharpDiagnostic[], tcErrors: FSharpDiagnostic[]) = [| yield! creationErrors yield! parseErrors @@ -4006,6 +3981,7 @@ type FsiInteractiveChecker(legacyReferenceResolver, tcConfig: TcConfig, tcGlobal defaultFSharpBinariesDir, fileName, sourceText, + None, CodeContext.Editing, tcConfig.useSimpleResolution, tcConfig.useFsiAuxLib, diff --git a/src/Compiler/Service/FSharpProjectSnapshot.fs b/src/Compiler/Service/FSharpProjectSnapshot.fs index 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..39560cb3b6b 100644 --- a/src/Compiler/Service/TransparentCompiler.fs +++ b/src/Compiler/Service/TransparentCompiler.fs @@ -496,6 +496,7 @@ type internal TransparentCompiler defaultFSharpBinariesDir, fileName, source, + None, CodeContext.Editing, useSimpleResolution, useFsiAuxLib, @@ -907,7 +908,7 @@ type internal TransparentCompiler { new IXmlDocumentationInfoLoader with /// Try to load xml documentation associated with an assembly by the same file path with the extension ".xml". member _.TryLoad(assemblyFileName) = - let xmlFileName = !! Path.ChangeExtension(assemblyFileName, ".xml") + let xmlFileName = !!Path.ChangeExtension(assemblyFileName, ".xml") // REVIEW: File IO - Will eventually need to change this to use a file system interface of some sort. XmlDocumentationInfo.TryCreateFromFile(xmlFileName) @@ -1393,7 +1394,7 @@ type internal TransparentCompiler // Apply nowarns to tcConfig (may generate errors, so ensure diagnosticsLogger is installed) let tcConfig = - ApplyNoWarnsToTcConfig(tcConfig, parsedMainInput, !! Path.GetDirectoryName(mainInputFileName)) + ApplyNoWarnsToTcConfig(tcConfig, parsedMainInput, !!Path.GetDirectoryName(mainInputFileName)) let diagnosticsLogger = errHandler.DiagnosticsLogger @@ -1751,11 +1752,8 @@ type internal TransparentCompiler ) let TryGetRecentCheckResultsForFile - ( - fileName: string, - projectSnapshot: FSharpProjectSnapshot, - userOpName: string - ) : (FSharpParseFileResults * FSharpCheckFileResults) option = + (fileName: string, projectSnapshot: FSharpProjectSnapshot, userOpName: string) + : (FSharpParseFileResults * FSharpCheckFileResults) option = ignore userOpName let cacheKey = @@ -2098,14 +2096,8 @@ type internal TransparentCompiler } member _.ParseFileWithoutProject - ( - fileName: string, - sourceText: ISourceText, - options: FSharpParsingOptions, - cache: bool, - flatErrors: bool, - userOpName: string - ) : Async = + (fileName: string, sourceText: ISourceText, options: FSharpParsingOptions, cache: bool, flatErrors: bool, userOpName: string) + : Async = let parseFileAsync = async { let! ct = Async.CancellationToken @@ -2259,13 +2251,8 @@ type internal TransparentCompiler member _.ProjectChecked = projectChecked.Publish member this.FindReferencesInFile - ( - fileName: string, - options: FSharpProjectOptions, - symbol: FSharpSymbol, - canInvalidateProject: bool, - userOpName: string - ) : Async> = + (fileName: string, options: FSharpProjectOptions, symbol: FSharpSymbol, canInvalidateProject: bool, userOpName: string) + : Async> = async { ignore canInvalidateProject @@ -2288,19 +2275,13 @@ type internal TransparentCompiler } member this.GetAssemblyData - ( - projectSnapshot: FSharpProjectSnapshot, - fileName, - userOpName: string - ) : Async = + (projectSnapshot: FSharpProjectSnapshot, fileName, userOpName: string) + : Async = this.GetAssemblyData(projectSnapshot.ProjectSnapshot, fileName, userOpName) member this.GetBackgroundCheckResultsForFileInProject - ( - fileName: string, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, options: FSharpProjectOptions, userOpName: string) + : Async = async { let! snapshot = FSharpProjectSnapshot.FromOptions(options, documentSource) @@ -2310,11 +2291,8 @@ type internal TransparentCompiler } member this.GetBackgroundParseResultsForFileInProject - ( - fileName: string, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, options: FSharpProjectOptions, userOpName: string) + : Async = async { let! snapshot = FSharpProjectSnapshot.FromOptions(options, documentSource) @@ -2322,12 +2300,8 @@ type internal TransparentCompiler } member this.GetCachedCheckFileResult - ( - builder: IncrementalBuilder, - fileName: string, - sourceText: ISourceText, - options: FSharpProjectOptions - ) : Async<(FSharpParseFileResults * FSharpCheckFileResults) option> = + (builder: IncrementalBuilder, fileName: string, sourceText: ISourceText, options: FSharpProjectOptions) + : Async<(FSharpParseFileResults * FSharpCheckFileResults) option> = async { ignore builder @@ -2342,6 +2316,7 @@ type internal TransparentCompiler ( fileName: string, sourceText: ISourceText, + caret: Position option, previewEnabled: bool option, loadedTimeStamp: DateTime option, otherFlags: string array option, @@ -2359,6 +2334,7 @@ type internal TransparentCompiler bc.GetProjectSnapshotFromScript( fileName, SourceTextNew.ofISourceText sourceText, + caret, DocumentSource.FileSystem, previewEnabled, loadedTimeStamp, @@ -2379,6 +2355,7 @@ type internal TransparentCompiler ( fileName: string, sourceText: ISourceTextNew, + caret: Position option, documentSource: DocumentSource, previewEnabled: bool option, loadedTimeStamp: DateTime option, @@ -2522,11 +2499,8 @@ type internal TransparentCompiler } member this.GetSemanticClassificationForFile - ( - fileName: string, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, options: FSharpProjectOptions, userOpName: string) + : Async = async { ignore userOpName @@ -2548,13 +2522,8 @@ type internal TransparentCompiler backgroundCompiler.NotifyProjectCleaned(options, userOpName) member this.ParseAndCheckFileInProject - ( - fileName: string, - fileVersion: int, - sourceText: ISourceText, - options: FSharpProjectOptions, - userOpName: string - ) : Async = + (fileName: string, fileVersion: int, sourceText: ISourceText, options: FSharpProjectOptions, userOpName: string) + : Async = async { let! snapshot = FSharpProjectSnapshot.FromOptions(options, fileName, fileVersion, sourceText, documentSource) @@ -2583,29 +2552,16 @@ type internal TransparentCompiler this.ParseFile(fileName, projectSnapshot.ProjectSnapshot, userOpName) member this.ParseFile - ( - fileName: string, - sourceText: ISourceText, - options: FSharpParsingOptions, - cache: bool, - flatErrors: bool, - userOpName: string - ) : Async = + (fileName: string, sourceText: ISourceText, options: FSharpParsingOptions, cache: bool, flatErrors: bool, userOpName: string) + : Async = this.ParseFileWithoutProject(fileName, sourceText, options, cache, flatErrors, userOpName) member this.TryGetRecentCheckResultsForFile - ( - fileName: string, - options: FSharpProjectOptions, - sourceText: ISourceText option, - userOpName: string - ) : (FSharpParseFileResults * FSharpCheckFileResults * SourceTextHash) option = + (fileName: string, options: FSharpProjectOptions, sourceText: ISourceText option, userOpName: string) + : (FSharpParseFileResults * FSharpCheckFileResults * SourceTextHash) option = backgroundCompiler.TryGetRecentCheckResultsForFile(fileName, options, sourceText, userOpName) member this.TryGetRecentCheckResultsForFile - ( - fileName: string, - projectSnapshot: FSharpProjectSnapshot, - userOpName: string - ) : (FSharpParseFileResults * FSharpCheckFileResults) option = + (fileName: string, projectSnapshot: FSharpProjectSnapshot, userOpName: string) + : (FSharpParseFileResults * FSharpCheckFileResults) option = TryGetRecentCheckResultsForFile(fileName, projectSnapshot, userOpName) diff --git a/src/Compiler/Service/TransparentCompiler.fsi b/src/Compiler/Service/TransparentCompiler.fsi index 93df10b29e2..8703df0fe7f 100644 --- a/src/Compiler/Service/TransparentCompiler.fsi +++ b/src/Compiler/Service/TransparentCompiler.fsi @@ -156,8 +156,11 @@ type internal CompilerCaches = member ParseAndCheckAllFilesInProject: AsyncMemoizeDisabled member ParseAndCheckFileInProject: - AsyncMemoize<(string * FSharpProjectIdentifier), string * string, (FSharpParseFileResults * - FSharpCheckFileAnswer)> + AsyncMemoize< + (string * FSharpProjectIdentifier), + string * string, + (FSharpParseFileResults * FSharpCheckFileAnswer) + > member ParseAndCheckProject: AsyncMemoize diff --git a/src/Compiler/Service/service.fs b/src/Compiler/Service/service.fs index 4835b784bf8..1e053fde7ff 100644 --- a/src/Compiler/Service/service.fs +++ b/src/Compiler/Service/service.fs @@ -389,14 +389,8 @@ type FSharpChecker /// Typecheck a source code file, returning a handle to the results of the /// parse including the reconstructed types in the file. member _.CheckFileInProjectAllowingStaleCachedResults - ( - parseResults: FSharpParseFileResults, - fileName: string, - fileVersion: int, - source: string, - options: FSharpProjectOptions, - ?userOpName: string - ) = + (parseResults: FSharpParseFileResults, fileName: string, fileVersion: int, source: string, options: FSharpProjectOptions, ?userOpName: string) + = let userOpName = defaultArg userOpName "Unknown" backgroundCompiler.CheckFileInProjectAllowingStaleCachedResults( @@ -426,13 +420,8 @@ type FSharpChecker /// Typecheck a source code file, returning a handle to the results of the /// parse including the reconstructed types in the file. member _.ParseAndCheckFileInProject - ( - fileName: string, - fileVersion: int, - sourceText: ISourceText, - options: FSharpProjectOptions, - ?userOpName: string - ) = + (fileName: string, fileVersion: int, sourceText: ISourceText, options: FSharpProjectOptions, ?userOpName: string) + = let userOpName = defaultArg userOpName "Unknown" backgroundCompiler.ParseAndCheckFileInProject(fileName, fileVersion, sourceText, options, userOpName) @@ -453,14 +442,8 @@ type FSharpChecker backgroundCompiler.ParseAndCheckProject(projectSnapshot, userOpName) member _.FindBackgroundReferencesInFile - ( - fileName: string, - options: FSharpProjectOptions, - symbol: FSharpSymbol, - ?canInvalidateProject: bool, - ?fastCheck: bool, - ?userOpName: string - ) = + (fileName: string, options: FSharpProjectOptions, symbol: FSharpSymbol, ?canInvalidateProject: bool, ?fastCheck: bool, ?userOpName: string) + = let canInvalidateProject = defaultArg canInvalidateProject true let userOpName = defaultArg userOpName "Unknown" @@ -509,6 +492,7 @@ type FSharpChecker ( fileName, source, + ?caret, ?previewEnabled, ?loadedTimeStamp, ?otherFlags, @@ -524,6 +508,7 @@ type FSharpChecker backgroundCompiler.GetProjectOptionsFromScript( fileName, source, + caret, previewEnabled, loadedTimeStamp, otherFlags, @@ -540,6 +525,7 @@ type FSharpChecker ( fileName, source, + ?caret, ?documentSource, ?previewEnabled, ?loadedTimeStamp, @@ -557,6 +543,7 @@ type FSharpChecker backgroundCompiler.GetProjectSnapshotFromScript( fileName, source, + caret, documentSource, previewEnabled, loadedTimeStamp, diff --git a/src/Compiler/Service/service.fsi b/src/Compiler/Service/service.fsi index 58c4a8c1dfb..69ae46b16b5 100644 --- a/src/Compiler/Service/service.fsi +++ b/src/Compiler/Service/service.fsi @@ -226,6 +226,7 @@ type public FSharpChecker = /// /// Used to differentiate between scripts, to consider each script a separate project. Also used in formatted error messages. /// The source for the file. + /// The editor location for the cursor if available. /// Is the preview compiler enabled. /// Indicates when the script was loaded into the editing environment, /// so that an 'unload' and 'reload' action will cause the script to be considered as a new project, @@ -240,6 +241,7 @@ type public FSharpChecker = member GetProjectOptionsFromScript: fileName: string * source: ISourceText * + ?caret: Position * ?previewEnabled: bool * ?loadedTimeStamp: DateTime * ?otherFlags: string[] * @@ -253,6 +255,7 @@ type public FSharpChecker = /// Used to differentiate between scripts, to consider each script a separate project. Also used in formatted error messages. /// The source for the file. + /// The editor location for the cursor if available. /// DocumentSource to load any additional files. /// Is the preview compiler enabled. /// Indicates when the script was loaded into the editing environment, @@ -269,6 +272,7 @@ type public FSharpChecker = member GetProjectSnapshotFromScript: fileName: string * source: ISourceTextNew * + ?caret: Position * ?documentSource: DocumentSource * ?previewEnabled: bool * ?loadedTimeStamp: DateTime * diff --git a/src/Compiler/Symbols/FSharpDiagnostic.fsi b/src/Compiler/Symbols/FSharpDiagnostic.fsi index 8c79ee95232..0118cc41cf3 100644 --- a/src/Compiler/Symbols/FSharpDiagnostic.fsi +++ b/src/Compiler/Symbols/FSharpDiagnostic.fsi @@ -46,9 +46,7 @@ module public ExtendedData = /// Contextually-relevant data to each particular diagnostic [] - type public IFSharpDiagnosticExtendedData = - interface - end + type public IFSharpDiagnosticExtendedData = interface end /// Additional data for diagnostics about obsolete attributes. [] diff --git a/src/Compiler/SyntaxTree/LexHelpers.fs b/src/Compiler/SyntaxTree/LexHelpers.fs index f7f090a6b00..faf85ad811d 100644 --- a/src/Compiler/SyntaxTree/LexHelpers.fs +++ b/src/Compiler/SyntaxTree/LexHelpers.fs @@ -77,15 +77,8 @@ type LongUnicodeLexResult = | Invalid let mkLexargs - ( - conditionalDefines, - indentationSyntaxStatus, - resourceManager, - ifdefStack, - diagnosticsLogger, - pathMap: PathMap, - applyLineDirectives - ) = + (conditionalDefines, indentationSyntaxStatus, resourceManager, ifdefStack, diagnosticsLogger, pathMap: PathMap, applyLineDirectives) + = { conditionalDefines = conditionalDefines ifdefStack = ifdefStack @@ -499,7 +492,7 @@ module Keywords = else PathMap.applyDir args.pathMap dirname |> fun dir -> KEYWORD_STRING(s, dir) - | "__SOURCE_FILE__" -> KEYWORD_STRING(s, !! System.IO.Path.GetFileName(FileIndex.fileOfFileIndex lexbuf.StartPos.FileIndex)) + | "__SOURCE_FILE__" -> KEYWORD_STRING(s, !!System.IO.Path.GetFileName(FileIndex.fileOfFileIndex lexbuf.StartPos.FileIndex)) | "__LINE__" -> KEYWORD_STRING(s, string lexbuf.StartPos.Line) | _ -> IdentifierToken args lexbuf s diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index 1c0428eb835..a8a8724f58b 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -275,15 +275,8 @@ let mkSynMemberDefnGetSet let xmlDoc = grabXmlDocAtRangeStart (parseState, attrs, rangeStart) let tryMkSynMemberDefnMember - ( - mOptInline: range option, - optAttrs: SynAttributeList list, - (bindingPat, mBindLhs), - optReturnType, - mEquals, - expr, - mExpr - ) : (SynMemberDefn * Ident option) option = + (mOptInline: range option, optAttrs: SynAttributeList list, (bindingPat, mBindLhs), optReturnType, mEquals, expr, mExpr) + : (SynMemberDefn * Ident option) option = let optInline = Option.isSome opt_inline || Option.isSome mOptInline // optional attributes are only applied to getters and setters // the "top level" attrs will be applied to both @@ -810,13 +803,8 @@ let checkEndOfFileError t = type BindingSet = BindingSetPreAttrs of range * bool * bool * (SynAttributes -> SynAccess option -> SynAttributes * SynBinding list) * range let mkClassMemberLocalBindings - ( - isStatic, - initialRangeOpt, - attrs, - vis, - BindingSetPreAttrs(_, isRec, isUse, declsPreAttrs, bindingSetRange) - ) = + (isStatic, initialRangeOpt, attrs, vis, BindingSetPreAttrs(_, isRec, isUse, declsPreAttrs, bindingSetRange)) + = let ignoredFreeAttrs, decls = declsPreAttrs attrs vis let mWhole = diff --git a/src/Compiler/SyntaxTree/UnicodeLexing.fs b/src/Compiler/SyntaxTree/UnicodeLexing.fs index 5a2d4393ee7..abb3d0e3d83 100644 --- a/src/Compiler/SyntaxTree/UnicodeLexing.fs +++ b/src/Compiler/SyntaxTree/UnicodeLexing.fs @@ -9,16 +9,13 @@ open Internal.Utilities.Text.Lexing type Lexbuf = LexBuffer let StringAsLexbuf (reportLibraryOnlyFeatures, langVersion, strictIndentation, s: string) = - LexBuffer - .FromChars(reportLibraryOnlyFeatures, langVersion, strictIndentation, s.ToCharArray()) + LexBuffer.FromChars(reportLibraryOnlyFeatures, langVersion, strictIndentation, s.ToCharArray()) let FunctionAsLexbuf (reportLibraryOnlyFeatures, langVersion, strictIndentation, bufferFiller) = - LexBuffer - .FromFunction(reportLibraryOnlyFeatures, langVersion, strictIndentation, bufferFiller) + LexBuffer.FromFunction(reportLibraryOnlyFeatures, langVersion, strictIndentation, bufferFiller) let SourceTextAsLexbuf (reportLibraryOnlyFeatures, langVersion, strictIndentation, sourceText) = - LexBuffer - .FromSourceText(reportLibraryOnlyFeatures, langVersion, strictIndentation, sourceText) + LexBuffer.FromSourceText(reportLibraryOnlyFeatures, langVersion, strictIndentation, sourceText) let StreamReaderAsLexbuf (reportLibraryOnlyFeatures, langVersion, strictIndentation, reader: StreamReader) = let mutable isFinished = false diff --git a/src/Compiler/TypedTree/TcGlobals.fsi b/src/Compiler/TypedTree/TcGlobals.fsi index b172536d4f0..b8c3610ef91 100644 --- a/src/Compiler/TypedTree/TcGlobals.fsi +++ b/src/Compiler/TypedTree/TcGlobals.fsi @@ -835,7 +835,10 @@ type internal TcGlobals = member knownFSharpCoreModules: System.Collections.Generic.IDictionary member knownIntrinsics: - System.Collections.Concurrent.ConcurrentDictionary<(string * string option * string * int), FSharp.Compiler.TypedTree.ValRef> + System.Collections.Concurrent.ConcurrentDictionary< + (string * string option * string * int), + FSharp.Compiler.TypedTree.ValRef + > member knownWithNull: FSharp.Compiler.TypedTree.Nullness diff --git a/src/Compiler/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/FSDependencyManager.txt b/src/FSharp.DependencyManager.Nuget/FSDependencyManager.txt index e70d2691151..6eb22c00f7a 100644 --- a/src/FSharp.DependencyManager.Nuget/FSDependencyManager.txt +++ b/src/FSharp.DependencyManager.Nuget/FSDependencyManager.txt @@ -9,4 +9,5 @@ highestVersion,"with the highest version" sourceDirectoryDoesntExist,"The source directory '%s' not found" timedoutResolvingPackages,"Timed out resolving packages, process: '%s' '%s'" invalidTimeoutValue,"Invalid value for timeout '%s', valid values: none, -1 and integer milliseconds to wait" -missingTimeoutValue,"Missing value for timeout" \ No newline at end of file +missingTimeoutValue,"Missing value for timeout" +invalidBooleanValue,"Invalid value for boolean '%s', valid values: true or false" \ No newline at end of file diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs index 553c97dc60f..f25d31a1ba7 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs @@ -11,6 +11,7 @@ type PackageReference = Version: string RestoreSources: string Script: string + UsePackageTargets: bool } module internal ProjectFile = diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs index 6b9d33ff663..ecfe86109aa 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs @@ -95,9 +95,7 @@ module internal Utilities = let getResolutionsFromFile resolutionsFile = let lines = try - File - .ReadAllText(resolutionsFile) - .Split([| '\r'; '\n' |], StringSplitOptions.None) + File.ReadAllText(resolutionsFile).Split([| '\r'; '\n' |], StringSplitOptions.None) |> Array.filter (String.IsNullOrEmpty >> not) with _ -> [||] diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs index fe0433f71cf..a1ff3c900bb 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs @@ -55,16 +55,30 @@ module FSharpDependencyManager = Version = ver RestoreSources = src Script = script + UsePackageTargets = usePackageTargets } = p + let usePackageTargets = + match usePackageTargets with + | false -> "ExcludeAssets='build;buildTransitive;buildMultitargeting'" + | true -> "" + seq { match not (String.IsNullOrEmpty(inc)), not (String.IsNullOrEmpty(ver)), not (String.IsNullOrEmpty(script)) with - | true, true, false -> yield sprintf @" " inc ver + | true, true, false -> + yield sprintf @" " inc ver usePackageTargets | true, true, true -> - yield sprintf @" " inc ver script - | true, false, false -> yield sprintf @" " inc - | true, false, true -> yield sprintf @" " inc script + yield + sprintf + @" " + inc + ver + script + usePackageTargets + | true, false, false -> yield sprintf @" " inc usePackageTargets + | true, false, true -> + yield sprintf @" " inc script usePackageTargets | _ -> () match not (String.IsNullOrEmpty(src)) with @@ -96,6 +110,7 @@ module FSharpDependencyManager = Version = "*" RestoreSources = "" Script = "" + UsePackageTargets = false } match options with @@ -114,11 +129,20 @@ module FSharpDependencyManager = let setVersion v = Some { current with Version = v } + let setUsePackageTargets v = + Some { current with UsePackageTargets = v } + match opt with | Some "include", Some v -> addInclude v |> parsePackageReferenceOption' rest implicitArgumentCount | Some "include", None -> raise (ArgumentException(SR.requiresAValue ("Include"))) | Some "version", Some v -> setVersion v |> parsePackageReferenceOption' rest implicitArgumentCount | Some "version", None -> setVersion "*" |> parsePackageReferenceOption' rest implicitArgumentCount + | Some "usepackagetargets", v -> + match v with + | Some v when v.ToLowerInvariant() = "true" -> setUsePackageTargets true + | Some v when v.ToLowerInvariant() = "false" -> setUsePackageTargets false + | _ -> raise (ArgumentException(SR.invalidBooleanValue ("usepackagetargets"))) + |> parsePackageReferenceOption' rest implicitArgumentCount | Some "restoresources", Some v -> Some { current with @@ -199,12 +223,8 @@ module FSharpDependencyManager = |> (fun l -> l, binLogPath, timeout) let computeHashForResolutionInputs - ( - scriptExt: string, - directiveLines: (string * string) seq, - targetFrameworkMoniker: string, - runtimeIdentifier: string - ) : string option = + (scriptExt: string, directiveLines: (string * string) seq, targetFrameworkMoniker: string, runtimeIdentifier: string) + : string option = let packageReferences, _, _ = directiveLines |> List.ofSeq |> parsePackageDirective scriptExt @@ -212,12 +232,12 @@ module FSharpDependencyManager = let referencesHaveWildCardVersion = // Verify to see if the developer specified a wildcard version. If they did then caching is not possible let hasWildCardVersion p = - // Todo: named record please let { Include = package Version = ver RestoreSources = _ Script = _ + UsePackageTargets = _ } = p diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.cs.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.cs.xlf index 800c2e40248..1df52699df6 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.cs.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.cs.xlf @@ -12,6 +12,11 @@ s nejvyšší verzí + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Neplatná hodnota pro časový limit {0}. Platné hodnoty: none, -1 a celočíselný počet milisekund, po které se má počkat diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.de.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.de.xlf index f3762130515..bb2ec8665b4 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.de.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.de.xlf @@ -12,6 +12,11 @@ mit der höchsten Version + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Ungültiger Wert für Timeout "{0}", gültige Werte: keine, -1 und ganzzahlige Millisekundenwerte für die Wartezeit diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.es.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.es.xlf index 2851c230dab..e9ee6650268 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.es.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.es.xlf @@ -12,6 +12,11 @@ con la última versión + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Valor de tiempo de espera "{0}" no válido. Valores válidos: ninguno, -1 y un número entero de milisegundos de espera diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.fr.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.fr.xlf index 8ab1dccc35f..60c4bb10953 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.fr.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.fr.xlf @@ -12,6 +12,11 @@ avec la version la plus récente + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Valeur non valide pour le délai d'expiration : '{0}'. Valeurs valides : aucune valeur, -1 ou un nombre entier pour le délai d'attente en millisecondes diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.it.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.it.xlf index c605c4af3ba..260e4879994 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.it.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.it.xlf @@ -12,6 +12,11 @@ con la versione massima + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Valore non valido per il timeout '{0}'. I valori validi sono: nessuno, -1 e numeri interi per i millisecondi di attesa diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ja.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ja.xlf index 2e19d06a10f..63bb78e5411 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ja.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ja.xlf @@ -12,6 +12,11 @@ 最新バージョン + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait タイムアウト '{0}' の値が無効です。有効な値: なし、-1、および整数 (待機するミリ秒) diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ko.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ko.xlf index 01d252b6243..2390149fd84 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ko.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ko.xlf @@ -12,6 +12,11 @@ 최상위 버전으로 + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait 시간 제한 '{0}'의 값이 잘못되었습니다. 유효한 값: 없음, -1 및 정수 대기 시간(밀리초) diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pl.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pl.xlf index 4ae0d2e448e..19b971eb1eb 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pl.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pl.xlf @@ -12,6 +12,11 @@ z najwyższą wersją + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Nieprawidłowa wartość limitu czasu „{0}”; prawidłowe wartości: none, -1 i liczba całkowita określająca liczbę milisekund oczekiwania diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pt-BR.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pt-BR.xlf index 7e8409fd8d7..fe73e35d112 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pt-BR.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.pt-BR.xlf @@ -12,6 +12,11 @@ com a versão mais recente + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Valor inválido para o tempo limite '{0}'. Valores válidos: none,-1 e milissegundos inteiros de espera diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ru.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ru.xlf index dafbfb8243d..c7f602855d5 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ru.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.ru.xlf @@ -12,6 +12,11 @@ с наивысшей версией + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Недопустимое значение времени ожидания "{0}". Допустимые значения: none, –1 и integer, мс ожидания. diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.tr.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.tr.xlf index 312793af714..585ac4950e4 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.tr.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.tr.xlf @@ -12,6 +12,11 @@ en yüksek sürümle + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait Zaman aşımı için '{0}' değeri geçersiz, geçerli değerler: none, -1 ve tamsayı milisaniye cinsinden bekleme süresi diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hans.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hans.xlf index 7e04d921b0a..2192ad1c9df 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hans.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hans.xlf @@ -12,6 +12,11 @@ 具有最高版本 + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait 超时 "{0}" 的值无效,有效值: none、-1 和要等待的毫秒数(整数) diff --git a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hant.xlf b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hant.xlf index d82293b0cf2..f7911a29659 100644 --- a/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hant.xlf +++ b/src/FSharp.DependencyManager.Nuget/xlf/FSDependencyManager.txt.zh-Hant.xlf @@ -12,6 +12,11 @@ 具有最高版本 + + Invalid value for boolean '{0}', valid values: true or false + Invalid value for boolean '{0}', valid values: true or false + + Invalid value for timeout '{0}', valid values: none, -1 and integer milliseconds to wait 逾時 '{0}' 值無效,有效的值: 無、-1 和要等候的整數毫秒 diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs index 693833ef4b8..1b68505ab1e 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs @@ -773,13 +773,6 @@ namespace N |> compile |> shouldFail |> withResults [ - { Error = Warning 3569 - Range = { StartLine = 21 - StartColumn = 27 - EndLine = 21 - EndColumn = 35 } - Message = - "The member or function 'instType' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } { Error = Warning 3569 Range = { StartLine = 17 StartColumn = 32 @@ -787,6 +780,13 @@ namespace N EndColumn = 77 } Message = "The member or function 'instType' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } + { Error = Warning 3569 + Range = { StartLine = 21 + StartColumn = 27 + EndLine = 21 + EndColumn = 35 } + Message = + "The member or function 'instType' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } ] [] @@ -1769,3 +1769,72 @@ module M = |> withLangVersion80 |> compile |> shouldSucceed + + [] + let ``Warn successfully in Array-mapped recursive call`` () = + """ +namespace N + +module M = + + type Value = + { Code: string } + + [] + let rec fooArray (values: Value[], code: string) = + match values with + | [||] -> seq { code } + | values -> + let replicatedValues = + values + |> Array.map (fun value -> fooArray (values, value.Code)) + replicatedValues |> Seq.concat + """ + |> FSharp + |> withLangVersion80 + |> compile + |> shouldFail + |> withResults [ + { Error = Warning 3569 + Range = { StartLine = 16 + StartColumn = 20 + EndLine = 16 + EndColumn = 74 } + Message = + "The member or function 'fooArray' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } + ] + + [] + let ``Warn successfully in Seq-mapped recursive call`` () = + """ +namespace N + +module M = + + type Value = + { Code: string } + + [] + let rec fooSeq (values: Value[], code: string) = + match values with + | [||] -> seq { code } + | values -> + let replicatedValues = + values + |> Seq.map (fun value -> fooSeq (values, value.Code)) + |> Seq.toArray + replicatedValues |> Seq.concat + """ + |> FSharp + |> withLangVersion80 + |> compile + |> shouldFail + |> withResults [ + { Error = Warning 3569 + Range = { StartLine = 16 + StartColumn = 42 + EndLine = 16 + EndColumn = 48 } + Message = + "The member or function 'fooSeq' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } + ] diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs index d085005d9ac..ecf5b81d97b 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs @@ -513,3 +513,21 @@ let add (col:IServiceCollection) = let _value,diag = script.Eval(code) Assert.Empty(diag) + [] + [] + [] + [] + [] + member _.``Eval script with usepackagetargets options``(code, shouldSucceed, error) = + use script = new FSharpScript() + let result, errors = script.Eval(code) + match shouldSucceed with + | true -> + Assert.Empty(errors) + match result with + | Ok(_) -> () + | Error(ex) -> Assert.True(false, "expected no failures") + | false -> + Assert.NotEmpty(errors) + Assert.Equal(1, errors.Length) + Assert.Equal(error, errors.[0].ToString()) diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index 1836a6673c1..f89f7a406be 100755 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl @@ -2066,7 +2066,7 @@ FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.CodeAnalysi FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.CodeAnalysis.FSharpSymbolUse[] GetUsesOfSymbolInFile(FSharp.Compiler.Symbols.FSharpSymbol, Microsoft.FSharp.Core.FSharpOption`1[System.Threading.CancellationToken]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Diagnostics.FSharpDiagnostic[] Diagnostics FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Diagnostics.FSharpDiagnostic[] get_Diagnostics() -FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.DeclarationListInfo GetDeclarationListInfo(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults], Int32, System.String, FSharp.Compiler.EditorServices.PartialLongName, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.EditorServices.AssemblySymbol]]], Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Text.Position,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.EditorServices.CompletionContext]]]) +FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.DeclarationListInfo GetDeclarationListInfo(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults], Int32, System.String, FSharp.Compiler.EditorServices.PartialLongName, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.EditorServices.AssemblySymbol]]], Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[FSharp.Compiler.Text.Position,Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.EditorServices.CompletionContext]]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.FindDeclResult GetDeclarationLocation(Int32, Int32, System.String, Microsoft.FSharp.Collections.FSharpList`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.MethodGroup GetMethods(Int32, Int32, System.String, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.String]]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.EditorServices.SemanticClassificationItem[] GetSemanticClassification(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) @@ -2079,7 +2079,7 @@ FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Symbols.FSh FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Symbols.FSharpOpenDeclaration[] get_OpenDeclarations() FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: FSharp.Compiler.Text.Range[] GetFormatSpecifierLocations() FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.CodeAnalysis.FSharpSymbolUse] GetSymbolUsesAtLocation(Int32, Int32, System.String, Microsoft.FSharp.Collections.FSharpList`1[System.String]) -FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Collections.FSharpList`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.CodeAnalysis.FSharpSymbolUse]] GetDeclarationListSymbols(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults], Int32, System.String, FSharp.Compiler.EditorServices.PartialLongName, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.EditorServices.AssemblySymbol]]]) +FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Collections.FSharpList`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.CodeAnalysis.FSharpSymbolUse]] GetDeclarationListSymbols(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults], Int32, System.String, FSharp.Compiler.EditorServices.PartialLongName, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.EditorServices.AssemblySymbol]]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.FSharpSymbolUse] GetSymbolUseAtLocation(Int32, Int32, System.String, Microsoft.FSharp.Collections.FSharpList`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Symbols.FSharpDisplayContext] GetDisplayContextForPos(FSharp.Compiler.Text.Position) FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Symbols.FSharpImplementationFileContents] ImplementationFile @@ -2136,8 +2136,8 @@ FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileAnswer]] ParseAndCheckFileInProject(System.String, FSharpProjectSnapshot, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileAnswer]] ParseAndCheckFileInProject(System.String, Int32, FSharp.Compiler.Text.ISourceText, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults]] GetBackgroundCheckResultsForFileInProject(System.String, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) -FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpProjectOptions,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectOptionsFromScript(System.String, FSharp.Compiler.Text.ISourceText, Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) -FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.ProjectSnapshot+FSharpProjectSnapshot,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectSnapshotFromScript(System.String, FSharp.Compiler.Text.ISourceTextNew, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) +FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpProjectOptions,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectOptionsFromScript(System.String, FSharp.Compiler.Text.ISourceText, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) +FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.ProjectSnapshot+FSharpProjectSnapshot,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectSnapshotFromScript(System.String, FSharp.Compiler.Text.ISourceTextNew, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Diagnostics.FSharpDiagnostic[],Microsoft.FSharp.Core.FSharpOption`1[System.Exception]]] Compile(System.String[], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Text.Range,FSharp.Compiler.Text.Range][]] MatchBraces(System.String, FSharp.Compiler.Text.ISourceText, FSharp.Compiler.CodeAnalysis.FSharpParsingOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Text.Range,FSharp.Compiler.Text.Range][]] MatchBraces(System.String, System.String, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) @@ -2830,12 +2830,20 @@ FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 GetHashCod FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 Tag FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 get_Tag() FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: System.String ToString() +FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] DiagnosticId +FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] UrlFormat +FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_DiagnosticId() +FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_UrlFormat() FSharp.Compiler.Diagnostics.ExtendedData+ExpressionIsAFunctionExtendedData: FSharp.Compiler.Symbols.FSharpType ActualType FSharp.Compiler.Diagnostics.ExtendedData+ExpressionIsAFunctionExtendedData: FSharp.Compiler.Symbols.FSharpType get_ActualType() FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField ImplementationField FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField SignatureField FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField get_ImplementationField() FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField get_SignatureField() +FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] DiagnosticId +FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] UrlFormat +FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_DiagnosticId() +FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_UrlFormat() FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: DiagnosticContextInfo ContextInfo FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: DiagnosticContextInfo get_ContextInfo() FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpDisplayContext DisplayContext @@ -2851,21 +2859,13 @@ FSharp.Compiler.Diagnostics.ExtendedData+ValueNotContainedDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+DefinitionsInSigAndImplNotCompatibleAbbreviationsDifferExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo +FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ExpressionIsAFunctionExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+IFSharpDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ValueNotContainedDiagnosticExtendedData -FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] DiagnosticId -FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] UrlFormat -FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_DiagnosticId() -FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_UrlFormat() -FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] DiagnosticId -FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] UrlFormat -FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_DiagnosticId() -FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData: Microsoft.FSharp.Core.FSharpOption`1[System.String] get_UrlFormat() -FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ExperimentalExtendedData FSharp.Compiler.Diagnostics.FSharpDiagnostic: FSharp.Compiler.Diagnostics.FSharpDiagnostic Create(FSharp.Compiler.Diagnostics.FSharpDiagnosticSeverity, System.String, Int32, FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.Diagnostics.FSharpDiagnostic: FSharp.Compiler.Diagnostics.FSharpDiagnosticSeverity Severity FSharp.Compiler.Diagnostics.FSharpDiagnostic: FSharp.Compiler.Diagnostics.FSharpDiagnosticSeverity get_Severity() @@ -3047,7 +3047,9 @@ FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: FSharp.Compiler FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: FSharp.Compiler.EditorServices.MethodOverrideCompletionContext get_ctx() FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: FSharp.Compiler.Text.Range enclosingTypeNameRange FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: FSharp.Compiler.Text.Range get_enclosingTypeNameRange() +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Int32 get_spacesBeforeEnclosingDefinition() FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Int32 get_spacesBeforeOverrideKeyword() +FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Int32 spacesBeforeEnclosingDefinition FSharp.Compiler.EditorServices.CompletionContext+MethodOverride: Int32 spacesBeforeOverrideKeyword FSharp.Compiler.EditorServices.CompletionContext+OpenDeclaration: Boolean get_isOpenType() FSharp.Compiler.EditorServices.CompletionContext+OpenDeclaration: Boolean isOpenType @@ -3102,7 +3104,7 @@ FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsUnionCaseFieldsD FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext AttributeApplication FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext Invalid FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewInherit(FSharp.Compiler.EditorServices.InheritanceContext, System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[System.String],Microsoft.FSharp.Core.FSharpOption`1[System.String]]) -FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewMethodOverride(FSharp.Compiler.EditorServices.MethodOverrideCompletionContext, FSharp.Compiler.Text.Range, Int32, Boolean, Boolean) +FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewMethodOverride(FSharp.Compiler.EditorServices.MethodOverrideCompletionContext, FSharp.Compiler.Text.Range, Int32, Boolean, Boolean, Int32) FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewOpenDeclaration(Boolean) FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewParameterList(FSharp.Compiler.Text.Position, System.Collections.Generic.HashSet`1[System.String]) FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewPattern(FSharp.Compiler.EditorServices.PatternContext) diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl index 8e92f93f0e1..f89f7a406be 100755 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl @@ -2136,8 +2136,8 @@ FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileAnswer]] ParseAndCheckFileInProject(System.String, FSharpProjectSnapshot, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileAnswer]] ParseAndCheckFileInProject(System.String, Int32, FSharp.Compiler.Text.ISourceText, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults]] GetBackgroundCheckResultsForFileInProject(System.String, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) -FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpProjectOptions,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectOptionsFromScript(System.String, FSharp.Compiler.Text.ISourceText, Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) -FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.ProjectSnapshot+FSharpProjectSnapshot,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectSnapshotFromScript(System.String, FSharp.Compiler.Text.ISourceTextNew, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) +FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpProjectOptions,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectOptionsFromScript(System.String, FSharp.Compiler.Text.ISourceText, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) +FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.ProjectSnapshot+FSharpProjectSnapshot,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectSnapshotFromScript(System.String, FSharp.Compiler.Text.ISourceTextNew, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Position], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Diagnostics.FSharpDiagnostic[],Microsoft.FSharp.Core.FSharpOption`1[System.Exception]]] Compile(System.String[], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Text.Range,FSharp.Compiler.Text.Range][]] MatchBraces(System.String, FSharp.Compiler.Text.ISourceText, FSharp.Compiler.CodeAnalysis.FSharpParsingOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Text.Range,FSharp.Compiler.Text.Range][]] MatchBraces(System.String, System.String, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) diff --git a/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs b/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs index 71bffac7974..0e12a33fe2f 100644 --- a/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs @@ -1,5 +1,7 @@ module FSharp.Compiler.Service.Tests.ProjectAnalysisTests +open System.Threading.Tasks + #nowarn "57" // Experimental stuff let runningOnMono = try System.Type.GetType("Mono.Runtime") <> null with e -> false @@ -128,8 +130,20 @@ module ClearLanguageServiceRootCachesTest = let weakTcImports = test () checker.InvalidateConfiguration Project1.options checker.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients() - GC.Collect() - System.Threading.SpinWait.SpinUntil(fun () -> not weakTcImports.IsAlive) + + task { + GC.Collect() + GC.WaitForPendingFinalizers() + // Try collecting many times, because GC has some problems, especially on Linux. + // See for example: https://github.com/dotnet/runtime/discussions/108081 + let mutable attempt = 1 + while weakTcImports.IsAlive && attempt < 10 do + GC.Collect() + GC.WaitForPendingFinalizers() + attempt <- attempt + 1 + do! Task.Delay(attempt * 1000) + Assert.False weakTcImports.IsAlive + } [] let ``Test Project1 should have protected FullName and TryFullName return same results`` () = diff --git a/tests/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. diff --git a/tests/fsharp/core/printing/output.1000.stdout.bsl b/tests/fsharp/core/printing/output.1000.stdout.bsl index 1d5c0fcbae2..e2f3a8d57c8 100644 --- a/tests/fsharp/core/printing/output.1000.stdout.bsl +++ b/tests/fsharp/core/printing/output.1000.stdout.bsl @@ -2787,7 +2787,7 @@ val ShortName: string = "hi" > val list2: int list = [1] module FSI_0319. - A8a951db8294f99e95ae1d276a7ddaefd93d1548e6bf749bdeae55d2649682b3 + Ee54a783c1b4e3fe8e3c42c5a10c384669fed24c7ffbdacfc9698816f925f337 {"ImmutableField0":6} type R1 = diff --git a/tests/fsharp/core/printing/output.200.stdout.bsl b/tests/fsharp/core/printing/output.200.stdout.bsl index 52926a6c17a..a707919336b 100644 --- a/tests/fsharp/core/printing/output.200.stdout.bsl +++ b/tests/fsharp/core/printing/output.200.stdout.bsl @@ -2032,7 +2032,7 @@ val ShortName: string = "hi" > val list2: int list = [1] module FSI_0319. - A8a951db8294f99e95ae1d276a7ddaefd93d1548e6bf749bdeae55d2649682b3 + Ee54a783c1b4e3fe8e3c42c5a10c384669fed24c7ffbdacfc9698816f925f337 {"ImmutableField0":6} type R1 = diff --git a/tests/fsharp/core/printing/output.multiemit.stdout.bsl b/tests/fsharp/core/printing/output.multiemit.stdout.bsl index 2933f92f8b5..9cdf63bcc36 100644 --- a/tests/fsharp/core/printing/output.multiemit.stdout.bsl +++ b/tests/fsharp/core/printing/output.multiemit.stdout.bsl @@ -6334,7 +6334,7 @@ val ShortName: string = "hi" > val list2: int list = [1] module FSI_0318. - A8a951db8294f99e95ae1d276a7ddaefd93d1548e6bf749bdeae55d2649682b3 + Ee54a783c1b4e3fe8e3c42c5a10c384669fed24c7ffbdacfc9698816f925f337 {"ImmutableField0":6} type R1 = diff --git a/tests/fsharp/core/printing/output.off.stdout.bsl b/tests/fsharp/core/printing/output.off.stdout.bsl index 66ff18c8fb9..5806de4d312 100644 --- a/tests/fsharp/core/printing/output.off.stdout.bsl +++ b/tests/fsharp/core/printing/output.off.stdout.bsl @@ -1801,7 +1801,7 @@ val ShortName: string = "hi" > val list2: int list module FSI_0319. - A8a951db8294f99e95ae1d276a7ddaefd93d1548e6bf749bdeae55d2649682b3 + Ee54a783c1b4e3fe8e3c42c5a10c384669fed24c7ffbdacfc9698816f925f337 {"ImmutableField0":6} type R1 = diff --git a/tests/fsharp/core/printing/output.stdout.bsl b/tests/fsharp/core/printing/output.stdout.bsl index 2933f92f8b5..9cdf63bcc36 100644 --- a/tests/fsharp/core/printing/output.stdout.bsl +++ b/tests/fsharp/core/printing/output.stdout.bsl @@ -6334,7 +6334,7 @@ val ShortName: string = "hi" > val list2: int list = [1] module FSI_0318. - A8a951db8294f99e95ae1d276a7ddaefd93d1548e6bf749bdeae55d2649682b3 + Ee54a783c1b4e3fe8e3c42c5a10c384669fed24c7ffbdacfc9698816f925f337 {"ImmutableField0":6} type R1 = diff --git a/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs b/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs index 2b194fe27fd..c39e608a4d1 100644 --- a/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs +++ b/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs @@ -128,10 +128,7 @@ module internal ClassificationDefinitions = ] let setIsDarkBackground () = - isDarkBackground <- - VSColorTheme - .GetThemedColor(EnvironmentColors.ToolWindowBackgroundColorKey) - .GetBrightness() < 0.5f + isDarkBackground <- VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowBackgroundColorKey).GetBrightness() < 0.5f let setColors _ = diff --git a/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs b/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs index afdb990489b..fa17d938f10 100644 --- a/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs +++ b/vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs @@ -149,12 +149,8 @@ type internal FSharpClassificationService [] () = member _.AddLexicalClassifications(_: SourceText, _: TextSpan, _: List, _: CancellationToken) = () member _.AddSyntacticClassificationsAsync - ( - document: Document, - textSpan: TextSpan, - result: List, - cancellationToken: CancellationToken - ) = + (document: Document, textSpan: TextSpan, result: List, cancellationToken: CancellationToken) + = cancellableTask { use _logBlock = Logger.LogBlock(LogEditorFunctionId.Classification_Syntactic) @@ -201,12 +197,8 @@ type internal FSharpClassificationService [] () = |> CancellableTask.startAsTask cancellationToken member _.AddSemanticClassificationsAsync - ( - document: Document, - textSpan: TextSpan, - result: List, - cancellationToken: CancellationToken - ) = + (document: Document, textSpan: TextSpan, result: List, cancellationToken: CancellationToken) + = cancellableTask { use _logBlock = Logger.LogBlock(LogEditorFunctionId.Classification_Semantic) diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs b/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs index ca85c9621fe..1805428b8d7 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/ImplementInterface.fs @@ -123,14 +123,8 @@ type internal ImplementInterfaceCodeFixProvider [] () = | None -> [ stubChange ] let getSuggestions - ( - sourceText: SourceText, - results: FSharpCheckFileResults, - state: InterfaceState, - displayContext, - entity, - indentSize - ) = + (sourceText: SourceText, results: FSharpCheckFileResults, state: InterfaceState, displayContext, entity, indentSize) + = if InterfaceStubGenerator.HasNoInterfaceMember entity then CancellableTask.singleton Seq.empty else diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/MakeOuterBindingRecursive.fs b/vsintegration/src/FSharp.Editor/CodeFixes/MakeOuterBindingRecursive.fs index 0d52dbdfa86..267832a1aff 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/MakeOuterBindingRecursive.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/MakeOuterBindingRecursive.fs @@ -34,9 +34,7 @@ type internal MakeOuterBindingRecursiveCodeFixProvider [] |> ValueOption.ofOption |> ValueOption.map (fun bindingRange -> RoslynHelpers.FSharpRangeToTextSpan(sourceText, bindingRange)) |> ValueOption.filter (fun bindingSpan -> - sourceText - .GetSubText(bindingSpan) - .ContentEquals(sourceText.GetSubText context.Span)) + sourceText.GetSubText(bindingSpan).ContentEquals(sourceText.GetSubText context.Span)) |> ValueOption.map (fun bindingSpan -> let title = String.Format(SR.MakeOuterBindingRecursive(), sourceText.GetSubText(bindingSpan).ToString()) diff --git a/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs b/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs index 7fb2e008368..e87fda21539 100644 --- a/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs +++ b/vsintegration/src/FSharp.Editor/Commands/XmlDocCommandService.fs @@ -108,10 +108,7 @@ type internal XmlDocCommandFilter(wpfTextView: IWpfTextView, filePath: string, w paramNames |> List.iter (fun p -> - toInsert - .AppendLine() - .Append(' ', indent) - .Append(sprintf "/// " p) + toInsert.AppendLine().Append(' ', indent).Append(sprintf "/// " p) |> ignore) let _newSS = diff --git a/vsintegration/src/FSharp.Editor/Common/AssemblyInfo.fs b/vsintegration/src/FSharp.Editor/Common/AssemblyInfo.fs index 73e984f934f..124f3de404c 100644 --- a/vsintegration/src/FSharp.Editor/Common/AssemblyInfo.fs +++ b/vsintegration/src/FSharp.Editor/Common/AssemblyInfo.fs @@ -8,6 +8,4 @@ open Microsoft.VisualStudio.Shell // This adds $PackageFolder$ to the directories probed for assemblies to load. // The attribute is inexplicably class-targeted, hence the dummy class. [] -type private BindingPathForUIResources = - class - end +type private BindingPathForUIResources = class end diff --git a/vsintegration/src/FSharp.Editor/Common/CodeAnalysisExtensions.fs b/vsintegration/src/FSharp.Editor/Common/CodeAnalysisExtensions.fs index 4776a963a5c..e0b29c8f9f1 100644 --- a/vsintegration/src/FSharp.Editor/Common/CodeAnalysisExtensions.fs +++ b/vsintegration/src/FSharp.Editor/Common/CodeAnalysisExtensions.fs @@ -9,17 +9,11 @@ type Project with /// Returns the projectIds of all projects within the same solution that directly reference this project member this.GetDependentProjectIds() = - this.Solution - .GetProjectDependencyGraph() - .GetProjectsThatDirectlyDependOnThisProject - this.Id + this.Solution.GetProjectDependencyGraph().GetProjectsThatDirectlyDependOnThisProject this.Id /// Returns all projects within the same solution that directly reference this project. member this.GetDependentProjects() = - this.Solution - .GetProjectDependencyGraph() - .GetProjectsThatDirectlyDependOnThisProject - this.Id + this.Solution.GetProjectDependencyGraph().GetProjectsThatDirectlyDependOnThisProject this.Id |> Seq.map this.Solution.GetProject /// Returns the ProjectIds of all of the projects that this project directly or transitively depends on diff --git a/vsintegration/src/FSharp.Editor/Common/Extensions.fs b/vsintegration/src/FSharp.Editor/Common/Extensions.fs index 5b154deab73..3483c9c583e 100644 --- a/vsintegration/src/FSharp.Editor/Common/Extensions.fs +++ b/vsintegration/src/FSharp.Editor/Common/Extensions.fs @@ -7,9 +7,15 @@ open System open System.IO open System.Collections.Immutable open System.Collections.Generic +open System.Runtime.InteropServices open System.Threading open System.Threading.Tasks +open Microsoft.VisualStudio +open Microsoft.VisualStudio.Shell +open Microsoft.VisualStudio.Shell.Interop +open Microsoft.VisualStudio.TextManager.Interop + open Microsoft.CodeAnalysis open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.Host @@ -19,6 +25,10 @@ open FSharp.Compiler.Syntax open FSharp.Compiler.Text open Microsoft.VisualStudio.FSharp.Editor +open Microsoft.VisualStudio.Editor +open Microsoft.VisualStudio.Text.Editor +open Microsoft.VisualStudio +open Microsoft.VisualStudio.OLE.Interop type private FSharpGlyph = FSharp.Compiler.EditorServices.FSharpGlyph type private FSharpRoslynGlyph = Microsoft.CodeAnalysis.ExternalAccess.FSharp.FSharpGlyph @@ -59,6 +69,56 @@ type Project with member this.IsFSharp = this.Language = LanguageNames.FSharp +type TextViewEventsHandler + ( + onChangeCaretHandler: (IVsTextView * int * int -> unit) option, + onKillFocus: (IVsTextView -> unit) option, + onSetFocus: (IVsTextView -> unit) option + ) = + interface IVsTextViewEvents with + member this.OnChangeCaretLine(view: IVsTextView, newline: int, oldline: int) = + onChangeCaretHandler + |> Option.iter (fun handler -> handler (view, newline, oldline)) + + member this.OnChangeScrollInfo + (_view: IVsTextView, _iBar: int, _iMinUnit: int, _iMaxUnits: int, _iVisibleUnits: int, _iFirstVisibleUnit: int) + = + () + + member this.OnKillFocus(view: IVsTextView) = + onKillFocus |> Option.iter (fun handler -> handler (view)) + + member this.OnSetBuffer(_view: IVsTextView, _buffer: IVsTextLines) = () + + member this.OnSetFocus(view: IVsTextView) = + onSetFocus |> Option.iter (fun handler -> handler (view)) + +type ConnectionPointSubscription = System.IDisposable option + +// Usage example: +// If a handler is None, to not handle that event +// let subscription = subscribeToTextViewEvents (textView, onChangeCaretHandler, onKillFocus, OnSetFocus) +// Unsubscribe using subscription.Dispose() +let subscribeToTextViewEvents (textView: IVsTextView, onChangeCaretHandler, onKillFocus, OnSetFocus) : ConnectionPointSubscription = + let handler = TextViewEventsHandler(onChangeCaretHandler, onKillFocus, OnSetFocus) + + match textView with + | :? IConnectionPointContainer as cpContainer -> + let riid = typeof.GUID + let mutable cookie = 0u + + match cpContainer.FindConnectionPoint(ref riid) with + | null -> None + | cp -> + Some( + cp.Advise(handler, &cookie) + + { new IDisposable with + member _.Dispose() = cp.Unadvise(cookie) + } + ) + | _ -> None + type Document with member this.TryGetLanguageService<'T when 'T :> ILanguageService>() = @@ -69,6 +129,32 @@ type Document with | null -> None | languageServices -> languageServices.GetService<'T>() |> Some + member this.TryGetIVsTextView() : IVsTextView option = + match ServiceProvider.GlobalProvider.GetService(typeof) with + | :? IVsTextManager as textManager -> + // Grab IVsRunningDocumentTable + match ServiceProvider.GlobalProvider.GetService(typeof) with + | :? IVsRunningDocumentTable as rdt -> + match rdt.FindAndLockDocument(uint32 _VSRDTFLAGS.RDT_NoLock, this.FilePath) with + | hr, _, _, docData, _ when ErrorHandler.Succeeded(hr) && docData <> IntPtr.Zero -> + match Marshal.GetObjectForIUnknown docData with + | :? IVsTextBuffer as ivsTextBuffer -> + match textManager.GetActiveView(1, ivsTextBuffer) with + | hr, vsTextView when ErrorHandler.Succeeded(hr) -> Some vsTextView + | _ -> None + | _ -> None + | _ -> None + | _ -> None + | _ -> None + + member this.TryGetTextViewAndCaretPos() : (IVsTextView * Position) option = + match this.TryGetIVsTextView() with + | Some textView -> + match textView.GetCaretPos() with + | hr, line, column when ErrorHandler.Succeeded(hr) -> Some(textView, Position.fromZ line column) + | _ -> None + | None -> None + member this.IsFSharpScript = isScriptFile this.FilePath member this.IsFSharpSignatureFile = isSignatureFile this.FilePath @@ -208,11 +294,7 @@ module private SourceText = type SourceText with member this.ToFSharpSourceText() = - SourceText.weakTable.GetValue( - this, - Runtime.CompilerServices.ConditionalWeakTable<_, _> - .CreateValueCallback(SourceText.create) - ) + SourceText.weakTable.GetValue(this, Runtime.CompilerServices.ConditionalWeakTable<_, _>.CreateValueCallback(SourceText.create)) type NavigationItem with diff --git a/vsintegration/src/FSharp.Editor/Common/Logging.fs b/vsintegration/src/FSharp.Editor/Common/Logging.fs index cf531c65384..b0f56df3234 100644 --- a/vsintegration/src/FSharp.Editor/Common/Logging.fs +++ b/vsintegration/src/FSharp.Editor/Common/Logging.fs @@ -156,11 +156,7 @@ module Activity = OpenTelemetry.Sdk .CreateTracerProviderBuilder() .AddSource(ActivityNames.FscSourceName) - .SetResourceBuilder( - ResourceBuilder - .CreateDefault() - .AddService(serviceName = "F#", serviceVersion = "1.0.0") - ) + .SetResourceBuilder(ResourceBuilder.CreateDefault().AddService(serviceName = "F#", serviceVersion = "1.0.0")) .AddOtlpExporter() .Build() diff --git a/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs b/vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs index 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/FSharpProjectOptionsManager.fs b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs index c51db3021cf..edf31e68a57 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs @@ -16,6 +16,13 @@ open System.Threading open Microsoft.VisualStudio.FSharp.Interactive.Session open System.Runtime.CompilerServices open CancellableTasks +open Microsoft.VisualStudio.FSharp.Editor.Extensions +open System.Windows +open Microsoft.VisualStudio +open FSharp.Compiler.Text +open Microsoft.VisualStudio.TextManager.Interop + +#nowarn "57" [] module private FSharpProjectOptionsHelpers = @@ -118,7 +125,7 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = ConcurrentDictionary() let singleFileCache = - ConcurrentDictionary() + ConcurrentDictionary() // This is used to not constantly emit the same compilation. let weakPEReferences = ConditionalWeakTable() @@ -198,15 +205,29 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = | false, _ -> let! sourceText = document.GetTextAsync(ct) - let! scriptProjectOptions, _ = - checker.GetProjectOptionsFromScript( - document.FilePath, - sourceText.ToFSharpSourceText(), - previewEnabled = SessionsProperties.fsiPreview, - assumeDotNetFramework = not SessionsProperties.fsiUseNetCore, - userOpName = userOpName - ) + let getProjectOptionsFromScript textViewAndCaret = + match textViewAndCaret with + | None -> + checker.GetProjectOptionsFromScript( + document.FilePath, + sourceText.ToFSharpSourceText(), + previewEnabled = SessionsProperties.fsiPreview, + assumeDotNetFramework = not SessionsProperties.fsiUseNetCore, + userOpName = userOpName + ) + + | Some(_, caret) -> + checker.GetProjectOptionsFromScript( + document.FilePath, + sourceText.ToFSharpSourceText(), + caret, + previewEnabled = SessionsProperties.fsiPreview, + assumeDotNetFramework = not SessionsProperties.fsiUseNetCore, + userOpName = userOpName + ) + let textViewAndCaret = document.TryGetTextViewAndCaretPos() + let! scriptProjectOptions, _ = getProjectOptionsFromScript textViewAndCaret let project = document.Project let otherOptions = @@ -243,13 +264,46 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = let parsingOptions, _ = checker.GetParsingOptionsFromProjectOptions(projectOptions) - singleFileCache.[document.Id] <- (document.Project, fileStamp, parsingOptions, projectOptions) + let updateProjectOptions () = + async { + let! scriptProjectOptions, _ = getProjectOptionsFromScript None + + checker.NotifyFileChanged(document.FilePath, scriptProjectOptions) + |> Async.Start + } + |> Async.Start + + let onChangeCaretHandler (_, _newline: int, _oldline: int) = updateProjectOptions () + let onKillFocus (_) = updateProjectOptions () + let onSetFocus (_) = updateProjectOptions () + + let addToCacheAndSubscribe value = + match value with + | projectId, fileStamp, parsingOptions, projectOptions, _ -> + let subscription = + match textViewAndCaret with + | Some(textView, _) -> + subscribeToTextViewEvents (textView, (Some onChangeCaretHandler), (Some onKillFocus), (Some onSetFocus)) + | None -> None + + (projectId, fileStamp, parsingOptions, projectOptions, subscription) + + singleFileCache.AddOrUpdate( + document.Id, // The key to the cache + (fun _ value -> addToCacheAndSubscribe value), // Function to add the cached value if the key does not exist + (fun _ _ value -> value), // Function to update the value if the key exists + (document.Project, fileStamp, parsingOptions, projectOptions, None) // The value to add or update + ) + |> ignore return ValueSome(parsingOptions, projectOptions) - | true, (oldProject, oldFileStamp, parsingOptions, projectOptions) -> + | true, (oldProject, oldFileStamp, parsingOptions, projectOptions, _) -> if fileStamp <> oldFileStamp || isProjectInvalidated document.Project oldProject ct then - singleFileCache.TryRemove(document.Id) |> ignore + match singleFileCache.TryRemove(document.Id) with + | true, (_, _, _, _, Some subscription) -> subscription.Dispose() + | _ -> () + return! tryComputeOptionsBySingleScriptOrFile document userOpName else return ValueSome(parsingOptions, projectOptions) @@ -460,9 +514,10 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = legacyProjectSites.TryRemove(projectId) |> ignore | FSharpProjectOptionsMessage.ClearSingleFileOptionsCache(documentId) -> match singleFileCache.TryRemove(documentId) with - | true, (_, _, _, projectOptions) -> + | true, (_, _, _, projectOptions, subscription) -> lastSuccessfulCompilations.TryRemove(documentId.ProjectId) |> ignore checker.ClearCache([ projectOptions ]) + subscription |> Option.iter (fun handler -> handler.Dispose()) | _ -> () } diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index 55cd1b622b3..5cc9cec2943 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -375,14 +375,10 @@ type internal FSharpPackage() as this = this.ComponentModel.DefaultExportProvider.GetExport() let optionsManager = - workspace.Services - .GetService() - .FSharpProjectOptionsManager + workspace.Services.GetService().FSharpProjectOptionsManager let metadataAsSource = - this.ComponentModel.DefaultExportProvider - .GetExport() - .Value + this.ComponentModel.DefaultExportProvider.GetExport().Value let! solution = this.GetServiceAsync(typeof) let solution = solution :?> IVsSolution @@ -440,9 +436,7 @@ type internal FSharpLanguageService(package: FSharpPackage) = let workspace = package.ComponentModel.GetService() let solutionAnalysis = - workspace.Services - .GetService() - .Advanced.SolutionBackgroundAnalysis + workspace.Services.GetService().Advanced.SolutionBackgroundAnalysis globalOptions.SetBackgroundAnalysisScope(openFilesOnly = not solutionAnalysis) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs index af619dad278..bf04e9a8a2d 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs @@ -18,9 +18,7 @@ type internal FSharpMiscellaneousFileService ConcurrentDictionary>(StringComparer.OrdinalIgnoreCase) let optionsManager = - workspace.Services - .GetRequiredService() - .FSharpProjectOptionsManager + workspace.Services.GetRequiredService().FSharpProjectOptionsManager static let createSourceCodeKind (filePath: string) = if isScriptFile filePath then diff --git a/vsintegration/src/FSharp.Editor/LanguageService/Tokenizer.fs b/vsintegration/src/FSharp.Editor/LanguageService/Tokenizer.fs index bc025402485..83f6532b8ad 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/Tokenizer.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/Tokenizer.fs @@ -508,12 +508,8 @@ module internal Tokenizer = | _ -> ClassificationTypeNames.Text let private scanSourceLine - ( - sourceTokenizer: FSharpSourceTokenizer, - textLine: TextLine, - lineContents: string, - lexState: FSharpTokenizerLexState - ) : SourceLineData = + (sourceTokenizer: FSharpSourceTokenizer, textLine: TextLine, lineContents: string, lexState: FSharpTokenizerLexState) + : SourceLineData = let colorMap = Array.create textLine.Span.Length ClassificationTypeNames.Text let lineTokenizer = sourceTokenizer.CreateLineTokenizer(lineContents) let tokens = ResizeArray() diff --git a/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs b/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs index 6c3b04f1844..1c09806d0ca 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs @@ -347,11 +347,8 @@ module private CheckerExtensions = } member checker.ParseAndCheckDocumentUsingTransparentCompiler - ( - document: Document, - options: FSharpProjectOptions, - userOpName: string - ) = + (document: Document, options: FSharpProjectOptions, userOpName: string) + = cancellableTask { checker.TransparentCompiler.SetCacheSizeFactor(document.Project.TransparentCompilerCacheFactor) @@ -368,12 +365,8 @@ module private CheckerExtensions = /// Parse and check the source text from the Roslyn document with possible stale results. member checker.ParseAndCheckDocumentWithPossibleStaleResults - ( - document: Document, - options: FSharpProjectOptions, - allowStaleResults: bool, - userOpName: string - ) = + (document: Document, options: FSharpProjectOptions, allowStaleResults: bool, userOpName: string) + = cancellableTask { let! ct = CancellableTask.getCancellationToken () @@ -439,12 +432,8 @@ module private CheckerExtensions = /// Parse and check the source text from the Roslyn document. member checker.ParseAndCheckDocument - ( - document: Document, - options: FSharpProjectOptions, - userOpName: string, - ?allowStaleResults: bool - ) = + (document: Document, options: FSharpProjectOptions, userOpName: string, ?allowStaleResults: bool) + = cancellableTask { if checker.UsesTransparentCompiler then diff --git a/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs b/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs index 429b21ce64a..921d82650f1 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/FindUsagesService.fs @@ -83,13 +83,8 @@ module FSharpFindUsagesService = } let findReferencedSymbolsAsync - ( - document: Document, - position: int, - context: IFSharpFindUsagesContext, - allReferences: bool, - userOp: string - ) : CancellableTask = + (document: Document, position: int, context: IFSharpFindUsagesContext, allReferences: bool, userOp: string) + : CancellableTask = cancellableTask { let! cancellationToken = CancellableTask.getCancellationToken () let! sourceText = document.GetTextAsync(cancellationToken) diff --git a/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs b/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs index 69a97e9732f..94615461dc1 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs @@ -645,11 +645,8 @@ type internal GoToDefinition(metadataAsSource: FSharpMetadataAsSourceService) = } member this.NavigateToExternalDeclaration - ( - targetSymbolUse: FSharpSymbolUse, - metadataReferences: seq, - cancellationToken: CancellationToken - ) = + (targetSymbolUse: FSharpSymbolUse, metadataReferences: seq, cancellationToken: CancellationToken) + = let textOpt = match targetSymbolUse.Symbol with @@ -892,9 +889,7 @@ type FSharpCrossLanguageSymbolNavigationService() = let workspace = componentModel.GetService() let metadataAsSource = - componentModel.DefaultExportProvider - .GetExport() - .Value + componentModel.DefaultExportProvider.GetExport().Value let tryFindFieldByName (name: string) (e: FSharpEntity) = let fields = @@ -1060,11 +1055,8 @@ type FSharpCrossLanguageSymbolNavigationService() = interface IFSharpCrossLanguageSymbolNavigationService with member _.TryGetNavigableLocationAsync - ( - assemblyName: string, - documentationCommentId: string, - cancellationToken: CancellationToken - ) : Task = + (assemblyName: string, documentationCommentId: string, cancellationToken: CancellationToken) + : Task = let path = FSharpCrossLanguageSymbolNavigationService.DocCommentIdToPath documentationCommentId diff --git a/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs b/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs index 60ca208a2a0..546b00e1b16 100644 --- a/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs +++ b/vsintegration/src/FSharp.Editor/Navigation/NavigateToSearchService.fs @@ -189,13 +189,8 @@ type internal FSharpNavigateToSearchService interface IFSharpNavigateToSearchService with member _.SearchProjectAsync - ( - project, - _priorityDocuments, - searchPattern, - kinds, - cancellationToken - ) : Task> = + (project, _priorityDocuments, searchPattern, kinds, cancellationToken) + : Task> = cancellableTask { let tryMatch = createMatcherFor searchPattern diff --git a/vsintegration/src/FSharp.Editor/QuickInfo/Views.fs b/vsintegration/src/FSharp.Editor/QuickInfo/Views.fs index ec42d190c15..146c7d7dfcb 100644 --- a/vsintegration/src/FSharp.Editor/QuickInfo/Views.fs +++ b/vsintegration/src/FSharp.Editor/QuickInfo/Views.fs @@ -64,13 +64,8 @@ module internal QuickInfoViewProvider = let encloseRuns runs : obj = ClassifiedTextElement(runs |> List.rev) let provideContent - ( - imageId: ImageId option, - description: TaggedText list, - documentation: TaggedText list, - navigation: FSharpNavigation, - getTooltip - ) = + (imageId: ImageId option, description: TaggedText list, documentation: TaggedText list, navigation: FSharpNavigation, getTooltip) + = let encloseText text = let rec loop text runs stack = diff --git a/vsintegration/src/FSharp.LanguageService/BackgroundRequests.fs b/vsintegration/src/FSharp.LanguageService/BackgroundRequests.fs index 4f6a3922118..c92e4e99586 100644 --- a/vsintegration/src/FSharp.LanguageService/BackgroundRequests.fs +++ b/vsintegration/src/FSharp.LanguageService/BackgroundRequests.fs @@ -98,7 +98,7 @@ type internal FSharpLanguageServiceBackgroundRequests_DEPRECATED lazy // This portion is executed on the language service thread let timestamp = if source=null then System.DateTime(2000,1,1) else source.OpenedTime // source is null in unit tests let checker = getInteractiveChecker() - let checkOptions, _diagnostics = checker.GetProjectOptionsFromScript(fileName, FSharp.Compiler.Text.SourceText.ofString sourceText, SessionsProperties.fsiPreview, timestamp, [| |]) |> Async.RunImmediate + let checkOptions, _diagnostics = checker.GetProjectOptionsFromScript(fileName, FSharp.Compiler.Text.SourceText.ofString sourceText, previewEnabled=SessionsProperties.fsiPreview, loadedTimeStamp=timestamp, otherFlags=[| |]) |> Async.RunImmediate let referencedProjectFileNames = [| |] let projectSite = ProjectSitesAndFiles.CreateProjectSiteForScript(fileName, referencedProjectFileNames, checkOptions) { ProjectSite = projectSite diff --git a/vsintegration/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) = diff --git a/vsintegration/tests/Salsa/salsa.fs b/vsintegration/tests/Salsa/salsa.fs index 6ac626f9fcb..1730bd7ec93 100644 --- a/vsintegration/tests/Salsa/salsa.fs +++ b/vsintegration/tests/Salsa/salsa.fs @@ -1110,7 +1110,7 @@ module internal Salsa = member file.GetFileName() = fileName member file.GetProjectOptionsOfScript() = - project.Solution.Vs.LanguageService.FSharpChecker.GetProjectOptionsFromScript(fileName, FSharp.Compiler.Text.SourceText.ofString file.CombinedLines, false, System.DateTime(2000,1,1), [| |]) + project.Solution.Vs.LanguageService.FSharpChecker.GetProjectOptionsFromScript(fileName, FSharp.Compiler.Text.SourceText.ofString file.CombinedLines, previewEnabled=false, loadedTimeStamp=System.DateTime(2000,1,1), otherFlags=[| |]) |> Async.RunImmediate |> fst // drop diagnostics