From 9c1e077d3a4fb86a3d46e54ff1be42cd1bef68c3 Mon Sep 17 00:00:00 2001 From: Petr Date: Thu, 19 Dec 2024 17:36:31 +0100 Subject: [PATCH] Serialization and deserialization of the typechecking data --- src/Compiler/AbstractIL/il.fs | 2 + src/Compiler/AbstractIL/il.fsi | 6 + src/Compiler/Driver/CompilerImports.fs | 48 + src/Compiler/Driver/CompilerImports.fsi | 18 + .../Driver/ReuseTcResults/CachingDriver.fs | 62 + src/Compiler/Driver/fsc.fs | 48 +- src/Compiler/TypedTree/CompilerGlobalState.fs | 2 +- .../TypedTree/CompilerGlobalState.fsi | 2 + src/Compiler/TypedTree/TypedTree.fs | 9 + src/Compiler/TypedTree/TypedTree.fsi | 10 + src/Compiler/TypedTree/TypedTreePickle.fs | 1722 +++++++++++++++-- src/Compiler/TypedTree/TypedTreePickle.fsi | 6 + .../FSharp.Compiler.ComponentTests.fsproj | 1 + .../TypeChecks/ReuseTcResults/Activities.fs | 2 + .../ReuseTcResults/Recompilation.fs | 82 + ...ervice.SurfaceArea.netstandard20.debug.bsl | 21 +- ...vice.SurfaceArea.netstandard20.release.bsl | 22 +- tests/FSharp.Test.Utilities/ILChecker.fs | 4 +- ....Compiler.Service_Debug_netstandard2.0.bsl | 6 +- ...FSharp.Compiler.Service_Release_net9.0.bsl | 4 +- ...ompiler.Service_Release_netstandard2.0.bsl | 12 +- 21 files changed, 1899 insertions(+), 190 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/TypeChecks/ReuseTcResults/Recompilation.fs diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index 33a46ff0a23..2b80afae54c 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -2781,6 +2781,8 @@ type ILTypeDef member _.MetadataIndex = metadataIndex + member _.Flags = additionalFlags + member x.With ( ?name, diff --git a/src/Compiler/AbstractIL/il.fsi b/src/Compiler/AbstractIL/il.fsi index f80c64b0c59..3485ea3d091 100644 --- a/src/Compiler/AbstractIL/il.fsi +++ b/src/Compiler/AbstractIL/il.fsi @@ -949,6 +949,8 @@ type internal ILSecurityDecl = ILSecurityDecl of ILSecurityAction * byte[] /// below to construct/destruct these. [] type internal ILSecurityDecls = + new: array: ILSecurityDecl[] -> ILSecurityDecls + member AsList: unit -> ILSecurityDecl list /// Represents the efficiency-oriented storage of ILSecurityDecls in another item. @@ -1207,6 +1209,8 @@ type ILMethodDef = /// name and arity. [] type ILMethodDefs = + new: f: (unit -> ILMethodDef array) -> ILMethodDefs + inherit DelayInitArrayMap interface IEnumerable @@ -1311,6 +1315,7 @@ type ILFieldDef = /// a form to allow efficient looking up fields by name. [] type ILFieldDefs = + member internal AsList: unit -> ILFieldDef list member internal LookupByName: string -> ILFieldDef list @@ -1613,6 +1618,7 @@ type ILTypeDef = member Encoding: ILDefaultPInvokeEncoding member IsKnownToBeAttribute: bool member CanContainExtensionMethods: bool + member Flags: ILTypeDefAdditionalFlags member internal WithAccess: ILTypeDefAccess -> ILTypeDef member internal WithNestedAccess: ILMemberAccess -> ILTypeDef diff --git a/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs index 8478429a452..6d6a8ac9883 100644 --- a/src/Compiler/Driver/CompilerImports.fs +++ b/src/Compiler/Driver/CompilerImports.fs @@ -337,6 +337,54 @@ let EncodeOptimizationData (tcGlobals, tcConfig: TcConfig, outfile, exportRemapp else [] +let GetTypecheckingData (file, ilScopeRef, ilModule, byteReaderA, byteReaderB) = + + let memA = byteReaderA () + + let memB = + match byteReaderB with + | None -> ByteMemory.Empty.AsReadOnly() + | Some br -> br () + + unpickleObjWithDanglingCcus file ilScopeRef ilModule unpickleTcInfo memA memB + +let WriteTypecheckingData (tcConfig: TcConfig, tcGlobals, fileName, inMem, ccu, tcInfo) = + + // need to understand the naming and if we even want two resources here... + let rName = "FSharpTypecheckingData" + let rNameB = "FSharpTypecheckingDataB" + + PickleToResource + inMem + fileName + tcGlobals + tcConfig.compressMetadata + ccu + (rName + ccu.AssemblyName) + (rNameB + ccu.AssemblyName) + pickleTcInfo + tcInfo + +let EncodeTypecheckingData (tcConfig: TcConfig, tcGlobals, generatedCcu, outfile, isIncrementalBuild, tcInfo) = + let r1, r2 = + WriteTypecheckingData( + tcConfig, + tcGlobals, + outfile, + isIncrementalBuild, + generatedCcu, + tcInfo) + + let resources = + [ + r1 + match r2 with + | None -> () + | Some r -> r + ] + + resources + exception AssemblyNotResolved of originalName: string * range: range exception MSBuildReferenceResolutionWarning of message: string * warningCode: string * range: range diff --git a/src/Compiler/Driver/CompilerImports.fsi b/src/Compiler/Driver/CompilerImports.fsi index 2a95347ecbf..aa885a7b705 100644 --- a/src/Compiler/Driver/CompilerImports.fsi +++ b/src/Compiler/Driver/CompilerImports.fsi @@ -19,6 +19,7 @@ open FSharp.Compiler.TcGlobals open FSharp.Compiler.BuildGraph open FSharp.Compiler.IO open FSharp.Compiler.Text +open FSharp.Compiler.TypedTreePickle open FSharp.Core.CompilerServices #if !NO_TYPEPROVIDERS @@ -71,6 +72,23 @@ val EncodeOptimizationData: isIncrementalBuild: bool -> ILResource list +val GetTypecheckingData: + file: string * + ilScopeRef: ILScopeRef * + ilModule: ILModuleDef option * + byteReaderA: (unit -> ReadOnlyByteMemory) * + byteReaderB: (unit -> ReadOnlyByteMemory) option -> + PickledDataWithReferences + +val EncodeTypecheckingData: + tcConfig: TcConfig * + tcGlobals: TcGlobals * + generatedCcu: CcuThunk * + outfile: string * + isIncrementalBuild: bool * + tcInfo: PickledTcInfo -> + ILResource list + [] type ResolveAssemblyReferenceMode = | Speculative diff --git a/src/Compiler/Driver/ReuseTcResults/CachingDriver.fs b/src/Compiler/Driver/ReuseTcResults/CachingDriver.fs index 9a4c4862de6..89b04537b1e 100644 --- a/src/Compiler/Driver/ReuseTcResults/CachingDriver.fs +++ b/src/Compiler/Driver/ReuseTcResults/CachingDriver.fs @@ -3,12 +3,17 @@ module internal FSharp.Compiler.ReuseTcResults open System.Collections.Generic open System.IO +open FSharp.Compiler.CheckDeclarations open FSharp.Compiler.CompilerConfig open FSharp.Compiler.Diagnostics open FSharp.Compiler.GraphChecking open FSharp.Compiler.IO +open FSharp.Compiler.ParseAndCheckInputs open FSharp.Compiler.Syntax open FSharp.Compiler.Syntax.PrettyNaming +open FSharp.Compiler.TypedTree +open CompilerImports +open FSharp.Compiler.AbstractIL.IL type TcData = { @@ -139,3 +144,60 @@ type CachingDriver(tcConfig: TcConfig) = use _ = Activity.start Activity.Events.reuseTcResultsCacheAbsent [] writeThisTcData thisTcData false + + member _.ReuseTcResults inputs (tcInitialState: TcState) = + + let bytes = File.ReadAllBytes("tc") + let memory = ByteMemory.FromArray(bytes) + let byteReaderA () = ReadOnlyByteMemory(memory) + + let byteReaderB = None + + let tcInfo = + GetTypecheckingData( + "", // assembly.FileName, + ILScopeRef.Local, // assembly.ILScopeRef, + None, //assembly.RawMetadata.TryGetILModuleDef(), + byteReaderA, + byteReaderB + ) + + let rawData = tcInfo.RawData + + let topAttrs: TopAttribs = + { + mainMethodAttrs = rawData.MainMethodAttrs + netModuleAttrs = rawData.NetModuleAttrs + assemblyAttrs = rawData.AssemblyAttrs + } + + // need to understand if anything can be used here, pickling state is hard + tcInitialState, + topAttrs, + rawData.DeclaredImpls, + // this is quite definitely wrong, need to figure out what to do with the environment + tcInitialState.TcEnvFromImpls + + member _.CacheTcResults(tcState: TcState, topAttrs: TopAttribs, declaredImpls, tcEnvAtEndOfLastFile, inputs, tcGlobals, outfile) = + let thisTcData = + { + CmdLine = getThisCompilationCmdLine tcConfig.cmdLineArgs + Graph = getThisCompilationGraph inputs + References = getThisCompilationReferences tcConfig.referencedDLLs + } + + writeThisTcData thisTcData + + let tcInfo = + { + MainMethodAttrs = topAttrs.mainMethodAttrs + NetModuleAttrs = topAttrs.netModuleAttrs + AssemblyAttrs = topAttrs.assemblyAttrs + DeclaredImpls = declaredImpls + } + + let encodedData = + EncodeTypecheckingData(tcConfig, tcGlobals, tcState.Ccu, outfile, false, tcInfo) + + let resource = encodedData[0].GetBytes().ToArray() + File.WriteAllBytes("tc", resource) diff --git a/src/Compiler/Driver/fsc.fs b/src/Compiler/Driver/fsc.fs index c119fa78076..5b9bbb25be3 100644 --- a/src/Compiler/Driver/fsc.fs +++ b/src/Compiler/Driver/fsc.fs @@ -150,7 +150,8 @@ let TypeCheck tcEnv0, openDecls0, inputs, - exiter: Exiter + exiter: Exiter, + outfile ) = try if isNil inputs then @@ -167,20 +168,35 @@ let TypeCheck let cachingDriver = CachingDriver(tcConfig) if cachingDriver.CanReuseTcResults(inputs) then - // do nothing, yet - () + cachingDriver.ReuseTcResults inputs tcInitialState + else + let tcState, topAttrs, declaredImpls, tcEnvAtEndOfLastFile = + CheckClosedInputSet( + ctok, + diagnosticsLogger.CheckForErrors, + tcConfig, + tcImports, + tcGlobals, + None, + tcInitialState, + eagerFormat, + inputs + ) - CheckClosedInputSet( - ctok, - (fun () -> diagnosticsLogger.CheckForRealErrorsIgnoringWarnings), - tcConfig, - tcImports, - tcGlobals, - None, - tcInitialState, - eagerFormat, - inputs - ) + cachingDriver.CacheTcResults(tcState, topAttrs, declaredImpls, tcEnvAtEndOfLastFile, inputs, tcGlobals, outfile) + tcState, topAttrs, declaredImpls, tcEnvAtEndOfLastFile + else + CheckClosedInputSet( + ctok, + (fun () -> diagnosticsLogger.CheckForRealErrorsIgnoringWarnings), + tcConfig, + tcImports, + tcGlobals, + None, + tcInitialState, + eagerFormat, + inputs + ) with exn -> errorRecovery exn rangeStartup exiter.Exit 1 @@ -481,6 +497,8 @@ let main1 disposables: DisposablesTracker ) = + CompilerGlobalState.stampCount <- 0L + // See Bug 735819 let lcidFromCodePage = let thread = Thread.CurrentThread @@ -701,7 +719,7 @@ let main1 let inputs = inputs |> List.map fst let tcState, topAttrs, typedAssembly, _tcEnvAtEnd = - TypeCheck(ctok, tcConfig, tcImports, tcGlobals, diagnosticsLogger, assemblyName, tcEnv0, openDecls0, inputs, exiter) + TypeCheck(ctok, tcConfig, tcImports, tcGlobals, diagnosticsLogger, assemblyName, tcEnv0, openDecls0, inputs, exiter, outfile) AbortOnError(diagnosticsLogger, exiter) ReportTime tcConfig "Typechecked" diff --git a/src/Compiler/TypedTree/CompilerGlobalState.fs b/src/Compiler/TypedTree/CompilerGlobalState.fs index 12dda2b08d8..7c93a7107d0 100644 --- a/src/Compiler/TypedTree/CompilerGlobalState.fs +++ b/src/Compiler/TypedTree/CompilerGlobalState.fs @@ -72,7 +72,7 @@ let newUnique() = System.Threading.Interlocked.Increment &uniqueCount /// Unique name generator for stamps attached to to val_specs, tycon_specs etc. //++GLOBAL MUTABLE STATE (concurrency-safe) -let mutable private stampCount = 0L +let mutable stampCount = 0L let newStamp() = let stamp = System.Threading.Interlocked.Increment &stampCount stamp \ No newline at end of file diff --git a/src/Compiler/TypedTree/CompilerGlobalState.fsi b/src/Compiler/TypedTree/CompilerGlobalState.fsi index 6f0dba79ddf..834825d671f 100644 --- a/src/Compiler/TypedTree/CompilerGlobalState.fsi +++ b/src/Compiler/TypedTree/CompilerGlobalState.fsi @@ -47,6 +47,8 @@ type Unique = int64 /// Concurrency-safe val newUnique: (unit -> int64) +val mutable stampCount: int64 + /// Unique name generator for stamps attached to to val_specs, tycon_specs etc. /// Concurrency-safe val newStamp: (unit -> int64) diff --git a/src/Compiler/TypedTree/TypedTree.fs b/src/Compiler/TypedTree/TypedTree.fs index 817730ec6ea..0797dee2d54 100644 --- a/src/Compiler/TypedTree/TypedTree.fs +++ b/src/Compiler/TypedTree/TypedTree.fs @@ -252,6 +252,8 @@ type ValFlags(flags: int64) = // Clear the IsGeneratedEventVal, since there's no use in propagating specialname information for generated add/remove event vals (flags &&& ~~~0b010011001100000000000L) + member x.Flags = flags + /// Represents the kind of a type parameter [] type TyparKind = @@ -490,6 +492,7 @@ type EntityFlags(flags: int64) = /// Get the flags as included in the F# binary metadata member x.PickledBits = (flags &&& ~~~0b000111111000100L) + member x.Flags = flags exception UndefinedName of @@ -5918,6 +5921,12 @@ type PickledCcuInfo = override _.ToString() = "PickledCcuInfo(...)" +type PickledTcInfo = { + MainMethodAttrs: Attribs + NetModuleAttrs: Attribs + AssemblyAttrs: Attribs + DeclaredImpls: CheckedImplFile list +} /// Represents a set of free local values. Computed and cached by later phases /// (never cached type checking). Cached in expressions. Not pickled. diff --git a/src/Compiler/TypedTree/TypedTree.fsi b/src/Compiler/TypedTree/TypedTree.fsi index 28ef5776e5a..761daa7105a 100644 --- a/src/Compiler/TypedTree/TypedTree.fsi +++ b/src/Compiler/TypedTree/TypedTree.fsi @@ -162,6 +162,8 @@ type ValFlags = member WithMakesNoCriticalTailcalls: ValFlags + member Flags: int64 + /// Represents the kind of a type parameter [] type TyparKind = @@ -292,6 +294,8 @@ type EntityFlags = /// Get the flags as included in the F# binary metadata member PickledBits: int64 + member Flags: int64 + member PreEstablishedHasDefaultConstructor: bool /// These two bits represents the on-demand analysis about whether the entity is assumed to be a readonly struct @@ -4297,6 +4301,12 @@ type PickledCcuInfo = [] member DebugText: string +type PickledTcInfo = + { MainMethodAttrs: Attribs + NetModuleAttrs: Attribs + AssemblyAttrs: Attribs + DeclaredImpls: CheckedImplFile list } + /// Represents a set of free local values. Computed type cached by later phases /// (never cached type checking). Cached in expressions. Not pickled. type FreeLocals = Zset diff --git a/src/Compiler/TypedTree/TypedTreePickle.fs b/src/Compiler/TypedTree/TypedTreePickle.fs index d2b3bd0ec79..c8fdf4127d7 100644 --- a/src/Compiler/TypedTree/TypedTreePickle.fs +++ b/src/Compiler/TypedTree/TypedTreePickle.fs @@ -284,6 +284,9 @@ let inline p_tup5 p1 p2 p3 p4 p5 (a, b, c, d, e) (st: WriterState) = let inline p_tup6 p1 p2 p3 p4 p5 p6 (a, b, c, d, e, f) (st: WriterState) = (p1 a st : unit); (p2 b st : unit); (p3 c st : unit); (p4 d st : unit); (p5 e st : unit); (p6 f st : unit) +let inline p_tup8 p1 p2 p3 p4 p5 p6 p7 p8 (a, b, c, d, e, f, g, h) (st: WriterState) = + (p1 a st : unit); (p2 b st : unit); (p3 c st : unit); (p4 d st : unit); (p5 e st : unit); (p6 f st : unit); (p7 g st : unit); (p8 h st : unit) + let inline p_tup9 p1 p2 p3 p4 p5 p6 p7 p8 p9 (a, b, c, d, e, f, x7, x8, x9) (st: WriterState) = (p1 a st : unit); (p2 b st : unit); (p3 c st : unit); (p4 d st : unit); (p5 e st : unit); (p6 f st : unit); (p7 x7 st : unit); (p8 x8 st : unit); (p9 x9 st : unit) @@ -420,6 +423,13 @@ let inline u_tup13 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 (st: ReaderState) let x9 = p9 st in let x10 = p10 st in let x11 = p11 st in let x12 = p12 st in let x13 = p13 st in (a, b, c, d, e, f, x7, x8, x9, x10, x11, x12, x13) +let inline u_tup14 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 (st: ReaderState) = + let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in + let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in + let x9 = p9 st in let x10 = p10 st in let x11 = p11 st in let x12 = p12 st in let x13 = p13 st in let x14 = p14 st in + (a, b, c, d, e, f, x7, x8, x9, x10, x11, x12, x13, x14) + + let inline u_tup17 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 (st: ReaderState) = let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in @@ -427,6 +437,12 @@ let inline u_tup17 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 (s let x14 = p14 st in let x15 = p15 st in let x16 = p16 st in let x17 = p17 st in (a, b, c, d, e, f, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17) +let inline u_tup18 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 (st: ReaderState) = + let a = p1 st in let b = p2 st in let c = p3 st in let d = p4 st in + let e = p5 st in let f = p6 st in let x7 = p7 st in let x8 = p8 st in + let x9 = p9 st in let x10 = p10 st in let x11 = p11 st in let x12 = p12 st in let x13 = p13 st in + let x14 = p14 st in let x15 = p15 st in let x16 = p16 st in let x17 = p17 st in let x18 = p18 st in + (a, b, c, d, e, f, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18) //--------------------------------------------------------------------------- // Pickle/unpickle operations for observably shared graph nodes @@ -517,6 +533,11 @@ let p_option f x st = | None -> p_byte 0 st | Some h -> p_byte 1 st; f h st +let p_non_null_slot f (x: 'a | null) st = + match x with + | null -> p_byte 0 st + | h -> p_byte 1 st; f h st + // Pickle lazy values in such a way that they can, in some future F# compiler version, be read back // lazily. However, a lazy reader is not used in this version because the value may contain the definitions of some // OSGN nodes. @@ -620,6 +641,13 @@ let u_option f st = | 1 -> Some (f st) | n -> ufailwith st ("u_option: found number " + string n) +let u_non_null_slot f st = + let tag = u_byte st + match tag with + | 0 -> Unchecked.defaultof<_> + | 1 -> f st + | n -> ufailwith st ("u_option: found number " + string n) + let u_lazy u st = // Read the number of bytes in the record @@ -802,7 +830,11 @@ let check (ilscope: ILScopeRef) (inMap: NodeInTable<_,_>) = for i = 0 to inMap.Count - 1 do let n = inMap.Get i if not (inMap.IsLinked n) then - warning(Error(FSComp.SR.pickleMissingDefinition (i, inMap.Name, ilscope.QualifiedName), range0)) + + // TODO: do not disable + // warning(Error(FSComp.SR.pickleMissingDefinition (i, inMap.Name, ilscope.QualifiedName), range0)) + () + // Note for compiler developers: to get information about which item this index relates to, // enable the conditional in Pickle.p_osgn_ref to refer to the given index number and recompile // an identical copy of the source for the DLL containing the data being unpickled. A message will @@ -973,6 +1005,27 @@ and p_ILCallSig x st = p_tup3 p_ILCallConv p_ILTypes p_ILType (x.CallingConv, x. and p_ILTypeRef (x: ILTypeRef) st = p_tup3 p_ILScopeRef p_strings p_string (x.Scope, x.Enclosing, x.Name) st +and p_ILTypeDefAdditionalFlags (x: ILTypeDefAdditionalFlags) st = + p_int32 (int x) st + +and p_ILTypeDef (x: ILTypeDef) st = + p_string x.Name st + //p_type_attributes x.Attributes + //p_il_type_def_layout x.Layout + //x.Implements + //x.Extends + //x.Methods + //x.NestedTypes + //x.Fields + //x.MethodImpls + //x.Events + //x.Properties + p_ILTypeDefAdditionalFlags x.Flags st + //x.SecurityDeclsStored + //x.CustomAttrsStored + //p_il + //p_int32 x.MetadataIndex st + and p_ILTypeSpec (a: ILTypeSpec) st = p_tup2 p_ILTypeRef p_ILTypes (a.TypeRef, a.GenericArgs) st let u_ILBasicCallConv st = @@ -994,6 +1047,44 @@ let u_ILHasThis st = let u_ILCallConv st = let a, b = u_tup2 u_ILHasThis u_ILBasicCallConv st in Callconv(a, b) let u_ILTypeRef st = let a, b, c = u_tup3 u_ILScopeRef u_strings u_string st in ILTypeRef.Create(a, b, c) + +let u_ILTypeDefAdditionalFlags st : ILTypeDefAdditionalFlags = + let i = u_int32 st + enum i + +let u_ILTypeDef st : ILTypeDef = + let name = u_string st + let attributes = System.Reflection.TypeAttributes.Public + let layout = ILTypeDefLayout.Auto + let implements = Unchecked.defaultof<_> + let genericParams = [] + let extends = Unchecked.defaultof<_> + let methods = ILMethodDefs(fun () -> [||]) + let nestedTypes = Unchecked.defaultof<_> + let fields = Unchecked.defaultof<_> + let methodImpls = Unchecked.defaultof<_> + let events = Unchecked.defaultof<_> + let properties = Unchecked.defaultof<_> + let additionalFlags = u_ILTypeDefAdditionalFlags st + let securityDeclsStored = ILSecurityDecls([||]) + let customAttrsStored = Unchecked.defaultof<_> + + ILTypeDef(name, + attributes, + layout, + implements, + genericParams, + extends, + methods, + nestedTypes, + fields, + methodImpls, + events, + properties, + additionalFlags, + securityDeclsStored, + customAttrsStored) + let u_ILArrayShape = u_wrap (ILArrayShape) (u_list (u_tup2 (u_option u_int32) (u_option u_int32))) @@ -1292,6 +1383,9 @@ let p_Map pk pv x st = let p_qlist pv = p_wrap QueueList.toList (p_list pv) let p_namemap p = p_Map p_string p +let p_stamp = p_int64 +let p_stamp_map pv = p_Map p_stamp pv + let u_Map_core uk uv n st = Map.ofSeq (seq { for _ in 1..n -> (uk st, uv st) }) @@ -1302,6 +1396,9 @@ let u_Map uk uv st = let u_qlist uv = u_wrap QueueList.ofList (u_list uv) let u_namemap u = u_Map u_string u +let u_stamp = u_int64 +let u_stamp_map uv = u_Map u_stamp uv + let p_pos (x: pos) st = p_tup2 p_int p_int (x.Line, x.Column) st let p_range (x: range) st = @@ -1670,13 +1767,31 @@ let p_tyar_spec_data (x: Typar) st = p_xmldoc (x.typar_id, x.Attribs, int64 x.typar_flags.PickledBits, x.Constraints, x.XmlDoc) st +let p_tyar_spec_data_new (x: Typar) st = + p_tup6 + p_ident + p_attribs + p_int64 + p_tyar_constraints + p_xmldoc + p_stamp + (x.typar_id, x.Attribs, int64 x.typar_flags.PickledBits, x.Constraints, x.XmlDoc, x.Stamp) st + let p_tyar_spec (x: Typar) st = //Disabled, workaround for bug 2721: if x.Rigidity <> TyparRigidity.Rigid then warning(Error(sprintf "p_tyar_spec: typar#%d is not rigid" x.Stamp, x.Range)) if x.IsFromError then warning(Error((0, "p_tyar_spec: from error"), x.Range)) p_osgn_decl st.otypars p_tyar_spec_data x st +let p_tyar_spec_new (x: Typar) st = + //Disabled, workaround for bug 2721: if x.Rigidity <> TyparRigidity.Rigid then warning(Error(sprintf "p_tyar_spec: typar#%d is not rigid" x.Stamp, x.Range)) + if x.IsFromError then warning(Error((0, "p_tyar_spec: from error"), x.Range)) + p_osgn_decl st.otypars p_tyar_spec_data_new x st + + let p_tyar_specs = (p_list p_tyar_spec) +let p_tyar_specs_new = (p_list p_tyar_spec_new) + let u_tyar_spec_data st = let a, c, d, e, g = u_tup5 u_ident u_attribs u_int64 u_tyar_constraints u_xmldoc st { typar_id=a @@ -1689,11 +1804,28 @@ let u_tyar_spec_data st = | doc, [], [] when doc.IsEmpty -> None | _ -> Some { typar_il_name = None; typar_xmldoc = g; typar_constraints = e; typar_attribs = c;typar_is_contravariant = false } } +let u_tyar_spec_data_new st = + let a, c, d, e, g, stamp = u_tup6 u_ident u_attribs u_int64 u_tyar_constraints u_xmldoc u_stamp st + { typar_id=a + typar_stamp=stamp + typar_flags=TyparFlags(int32 d) + typar_solution=None + typar_astype= Unchecked.defaultof<_> + typar_opt_data= + match g, e, c with + | doc, [], [] when doc.IsEmpty -> None + | _ -> Some { typar_il_name = None; typar_xmldoc = g; typar_constraints = e; typar_attribs = c;typar_is_contravariant = false } } + let u_tyar_spec st = u_osgn_decl st.itypars u_tyar_spec_data st +let u_tyar_spec_new st = + u_osgn_decl st.itypars u_tyar_spec_data_new st + let u_tyar_specs = (u_list u_tyar_spec) +let u_tyar_specs_new = (u_list u_tyar_spec_new) + let _ = fill_p_ty2 (fun isStructThisArgPos ty st -> let ty = stripTyparEqns ty @@ -1995,6 +2127,84 @@ let rec p_tycon_repr x st = | TILObjectRepr (TILObjectReprData (_, _, td)) -> error (Failure("Unexpected IL type definition"+td.Name)) +and p_tycon_repr_new (x: TyconRepresentation) st = + // The leading "p_byte 1" and "p_byte 0" come from the F# 2.0 format, which used an option value at this point. + + match x with + // Records + | TFSharpTyconRepr { fsobjmodel_rfields = fs; fsobjmodel_kind = TFSharpRecord } -> + p_byte 1 st + p_byte 0 st + p_rfield_table fs st + false + + // Unions without static fields + | TFSharpTyconRepr { fsobjmodel_cases = x; fsobjmodel_kind = TFSharpUnion; fsobjmodel_rfields = fs } when fs.FieldsByIndex.Length = 0 -> + p_byte 1 st + p_byte 1 st + p_array p_unioncase_spec x.CasesTable.CasesByIndex st + false + + // Unions with static fields, added to format + | TFSharpTyconRepr ({ fsobjmodel_cases = cases; fsobjmodel_kind = TFSharpUnion } as r) -> + if st.oglobals.compilingFSharpCore then + let fields = r.fsobjmodel_rfields.FieldsByIndex + let firstFieldRange = fields[0].DefinitionRange + let allFieldsText = fields |> Array.map (fun f -> f.LogicalName) |> String.concat System.Environment.NewLine + raise (Error(FSComp.SR.pickleFsharpCoreBackwardsCompatible("fields in union",allFieldsText), firstFieldRange)) + + p_byte 2 st + p_array p_unioncase_spec cases.CasesTable.CasesByIndex st + p_tycon_objmodel_data r st + false + + | TAsmRepr ilTy -> + p_byte 1 st + p_byte 2 st + p_ILType ilTy st + false + + | TFSharpTyconRepr r -> + p_byte 1 st + p_byte 3 st + p_tycon_objmodel_data r st + false + + | TMeasureableRepr ty -> + p_byte 1 st + p_byte 4 st + p_ty ty st + false + + | TNoRepr -> + p_byte 0 st + false + +#if !NO_TYPEPROVIDERS + | TProvidedTypeRepr info -> + if info.IsErased then + // Pickle erased type definitions as a NoRepr + p_byte 0 st + false + else + // Pickle generated type definitions as a TAsmRepr + p_byte 1 st + p_byte 2 st + p_ILType (mkILBoxedType(ILTypeSpec.Create(TypeProviders.GetILTypeRefOfProvidedType(info.ProvidedType, range0), []))) st + true + + | TProvidedNamespaceRepr _ -> + p_byte 0 st + false +#endif + + | TILObjectRepr (TILObjectReprData (scope, nesting, td)) -> + p_byte 5 st + p_ILScopeRef scope st + (p_list p_ILTypeDef) nesting st + p_ILTypeDef td st + false + and p_tycon_objmodel_data x st = p_tycon_objmodel_kind x.fsobjmodel_kind st p_vrefs "vslots" x.fsobjmodel_vslots st @@ -2062,6 +2272,29 @@ and p_entity_spec_data (x: Entity) st = else p_space 1 () st +and p_entity_spec_data_new (x: Entity) st = + p_tyar_specs_new (x.entity_typars.Force(x.entity_range)) st + p_string x.entity_logical_name st + p_option p_string x.EntityCompiledName st + p_range x.entity_range st + p_stamp x.entity_stamp st + p_option p_pubpath x.entity_pubpath st + p_access x.Accessibility st + p_access x.TypeReprAccessibility st + p_attribs x.entity_attribs st + let _ = p_tycon_repr_new x.entity_tycon_repr st + p_option p_ty_new x.TypeAbbrev st + p_tcaug_new x.entity_tycon_tcaug st + p_string System.String.Empty st + p_kind x.TypeOrMeasureKind st + p_int64 x.entity_flags.Flags st + p_option p_cpath x.entity_cpath st + p_maybe_lazy p_modul_typ_new x.entity_modul_type st + p_exnc_repr x.ExceptionInfo st + if st.oInMem then + p_used_space1 (p_xmldoc x.XmlDoc) st + else + p_space 1 () st and p_tcaug p st = p_tup9 @@ -2091,8 +2324,38 @@ and p_tcaug p st = p.tcaug_abstract, space) st +and p_tcaug_new (p: TyconAugmentation) st = + p_tup9 + (p_option (p_tup2 (p_vref "compare_obj") (p_vref "compare"))) + (p_option (p_vref "compare_withc")) + (p_option (p_tup3 (p_vref "hash_obj") (p_vref "hash_withc") (p_vref "equals_withc"))) + (p_option (p_tup2 (p_vref "hash") (p_vref "equals"))) + (p_list (p_tup2 p_string (p_vref "adhoc"))) + (p_list (p_tup3 p_ty_new p_bool p_dummy_range)) + (p_option p_ty_new) + p_bool + (p_space 1) + (p.tcaug_compare, + p.tcaug_compare_withc, + p.tcaug_hash_and_equals_withc |> Option.map (fun (v1, v2, v3, _) -> (v1, v2, v3)), + p.tcaug_equals, + (p.tcaug_adhoc_list + |> ResizeArray.toList + // Explicit impls of interfaces only get kept in the adhoc list + // in order to get check the well-formedness of an interface. + // Keeping them across assembly boundaries is not valid, because relinking their ValRefs + // does not work correctly (they may get incorrectly relinked to a default member) + |> List.filter (fun (isExplicitImpl, _) -> not isExplicitImpl) + |> List.map (fun (_, vref) -> vref.LogicalName, vref)), + p.tcaug_interfaces, + p.tcaug_super, + p.tcaug_abstract, + space) st + and p_entity_spec x st = p_osgn_decl st.oentities p_entity_spec_data x st +and p_entity_spec_new x st = p_osgn_decl st.oentities p_entity_spec_data_new x st + and p_parentref x st = match x with | ParentNone -> p_byte 0 st @@ -2162,9 +2425,34 @@ and p_ValData x st = else p_space 1 () st +and p_ValData_new x st = + p_string x.val_logical_name st + p_option p_string x.ValCompiledName st + // only keep range information on published values, not on optimization data + p_ranges (x.ValReprInfo |> Option.map (fun _ -> x.val_range, x.DefinitionRange)) st + + p_ty_new x.val_type st + p_stamp x.val_stamp st + + p_int64 x.val_flags.Flags st + p_option p_member_info x.MemberInfo st + p_attribs x.Attribs st + p_option p_ValReprInfo x.ValReprInfo st + p_string x.XmlDocSig st + p_access x.Accessibility st + p_parentref x.TryDeclaringEntity st + p_option p_const x.LiteralValue st + if st.oInMem then + p_used_space1 (p_xmldoc x.XmlDoc) st + else + p_space 1 () st + and p_Val x st = p_osgn_decl st.ovals p_ValData x st +and p_Val_new x st = + p_osgn_decl st.ovals p_ValData_new x st + and p_modul_typ (x: ModuleOrNamespaceType) st = p_tup3 p_istype @@ -2173,86 +2461,496 @@ and p_modul_typ (x: ModuleOrNamespaceType) st = (x.ModuleOrNamespaceKind, x.AllValsAndMembers, x.AllEntities) st -and u_tycon_repr st = - let tag1 = u_byte st - match tag1 with - | 0 -> (fun _flagBit -> TNoRepr) - | 1 -> - let tag2 = u_byte st - match tag2 with - // Records historically use a different format to other FSharpTyconRepr - | 0 -> - let v = u_rfield_table st - (fun _flagBit -> - TFSharpTyconRepr - { - fsobjmodel_cases = Construct.MakeUnionCases [] - fsobjmodel_kind=TFSharpRecord - fsobjmodel_vslots=[] - fsobjmodel_rfields=v - }) - - // Unions without static fields historically use a different format to other FSharpTyconRepr - | 1 -> - let v = u_list u_unioncase_spec st - (fun _flagBit -> Construct.MakeUnionRepr v) +and p_modul_typ_new (x: ModuleOrNamespaceType) st = + p_tup3 + p_istype + (p_qlist p_Val_new) + (p_qlist p_entity_spec_new) + (x.ModuleOrNamespaceKind, x.AllValsAndMembers, x.AllEntities) + st - | 2 -> - let v = u_ILType st - // This is the F# 3.0 extension to the format used for F# provider-generated types, which record an ILTypeRef in the format - // You can think of an F# 2.0 reader as always taking the path where 'flagBit' is false. Thus the F# 2.0 reader will - // interpret provider-generated types as TAsmRepr. - (fun flagBit -> - if flagBit then - let iltref = v.TypeRef - match st.iILModule with - | None -> TNoRepr - | Some iILModule -> - try - let rec find acc enclosingTypeNames (tdefs: ILTypeDefs) = - match enclosingTypeNames with - | [] -> List.rev acc, tdefs.FindByName iltref.Name - | h :: t -> - let nestedTypeDef = tdefs.FindByName h - find (nestedTypeDef :: acc) t nestedTypeDef.NestedTypes - let nestedILTypeDefs, ilTypeDef = find [] iltref.Enclosing iILModule.TypeDefs - TILObjectRepr(TILObjectReprData(st.iilscope, nestedILTypeDefs, ilTypeDef)) - with _ -> - System.Diagnostics.Debug.Assert(false, sprintf "failed to find IL backing metadata for cross-assembly generated type %s" iltref.FullName) - TNoRepr - else - TAsmRepr v) +and p_qualified_name_of_file qualifiedNameOfFile st = + let (QualifiedNameOfFile ident) = qualifiedNameOfFile + p_ident ident st - | 3 -> - let v = u_tycon_objmodel_data st - (fun _flagBit -> TFSharpTyconRepr v) +and p_pragma pragma st = + let (ScopedPragma.WarningOff (range, warningNumber)) = pragma + p_tup2 + p_range + p_int + (range, warningNumber) + st - | 4 -> - let v = u_ty st - (fun _flagBit -> TMeasureableRepr v) +and p_pragmas x st = + p_list p_pragma x st - | _ -> ufailwith st "u_tycon_repr" +and p_long_ident (x: LongIdent) st = + p_list p_ident x st - // Unions with static fields use a different format to other FSharpTyconRepr - | 2 -> - let cases = u_array u_unioncase_spec st - let data = u_tycon_objmodel_data st - fun _flagBit -> TFSharpTyconRepr { data with fsobjmodel_cases = Construct.MakeUnionCases (Array.toList cases) } - | _ -> ufailwith st "u_tycon_repr" +and p_trivia (x: SyntaxTrivia.IdentTrivia) st = + pfailwith st (nameof p_trivia) -and u_tycon_objmodel_data st = - let x1, x2, x3 = u_tup3 u_tycon_objmodel_kind u_vrefs u_rfield_table st - { - fsobjmodel_cases = Construct.MakeUnionCases [] - fsobjmodel_kind=x1 - fsobjmodel_vslots=x2 - fsobjmodel_rfields=x3 - } +and p_syn_long_ident (x: SynLongIdent) st = + let (SynLongIdent (id, dotRanges, trivia)) = x + p_tup3 + p_long_ident + (p_list p_range) + (p_list (p_option p_trivia)) + (id, dotRanges, trivia) + st -and u_attribs_ext extraf st = u_list_ext extraf u_attrib st -and u_unioncase_spec st = - let a = u_rfield_table st - let b = u_ty st +and p_syn_type (x: SynType) st = + pfailwith st (nameof p_syn_type) + +and p_syn_open_decl_target (x: SynOpenDeclTarget) st = + match x with + | SynOpenDeclTarget.ModuleOrNamespace (longId, range)-> + p_byte 0 st + p_tup2 + p_syn_long_ident + p_range + (longId, range) + st + | SynOpenDeclTarget.Type (typeName, range) -> + p_byte 1 st + p_tup2 + p_syn_type + p_range + (typeName, range) + st + +and p_ccu_data (x: CcuData) st = + p_option p_string x.FileName st + p_ILScopeRef x.ILScopeRef st + p_stamp x.Stamp st + p_option p_string x.QualifiedName st + p_string x.SourceCodeDirectory st + p_bool x.IsFSharp st +#if !NO_TYPEPROVIDERS + p_bool x.IsProviderGenerated st +#endif + p_bool x.UsesFSharp20PlusQuotations st + p_entity_spec_data_new x.Contents st + +and p_ccuref_new (x: CcuThunk) st = + p_tup2 + p_ccu_data + p_string + (x.target, x.name) + st + +and p_nleref_new (x: NonLocalEntityRef) st = + let (NonLocalEntityRef (ccu, strings)) = x + p_tup2 + p_ccuref_new + (p_array p_string) + (ccu, strings) + st + + +and p_tcref_new (x: EntityRef) st = + match x with + | ERefLocal x -> p_byte 0 st; p_local_item_ref "tcref" st.oentities x st + | ERefNonLocal x -> p_byte 1 st; p_nleref_new x st + +and p_nonlocal_val_ref_new (nlv: NonLocalValOrMemberRef) st = + let a = nlv.EnclosingEntity + let key = nlv.ItemKey + let pkey = key.PartialKey + p_tcref_new a st + p_option p_string pkey.MemberParentMangledName st + p_bool pkey.MemberIsOverride st + p_string pkey.LogicalName st + p_int pkey.TotalArgCount st + let isStructThisArgPos = + match key.TypeForLinkage with + | None -> false + | Some ty -> checkForInRefStructThisArg st ty + p_option p_ty_new key.TypeForLinkage st + + +and p_vref_new (x: ValRef) st = + match x with + | VRefLocal x -> p_byte 0 st; p_local_item_ref "valref" st.ovals x st + | VRefNonLocal x -> p_byte 1 st; p_nonlocal_val_ref_new x st + +and p_open_decl (x: OpenDeclaration) st = + p_tup6 + p_syn_open_decl_target + (p_option p_range) + (p_list p_tcref_new) + p_tys + p_range + p_bool + (x.Target, x.Range, x.Modules, x.Types, x.AppliedScope, x.IsOwnNamespace) + st + +and p_binding (x: ModuleOrNamespaceBinding) st = + match x with + | ModuleOrNamespaceBinding.Binding binding -> + p_byte 0 st + p_bind binding st + | ModuleOrNamespaceBinding.Module (moduleOrNamespace, moduleOrNamespaceContents) -> + p_byte 1 st + p_tup2 + p_entity_spec_new + p_module_or_namespace_contents + (moduleOrNamespace, moduleOrNamespaceContents) + st + +and p_tup_info (tupInfo: TupInfo) st = + let (TupInfo.Const c) = tupInfo + p_bool c st + +and p_nullness (nullness: Nullness) st = + match nullness.Evaluate() with + | NullnessInfo.WithNull -> p_byte 0 st + | NullnessInfo.WithoutNull -> p_byte 1 st + | NullnessInfo.AmbivalentToNull -> p_byte 2 st + +and p_typars = p_list p_tpref + +and p_ty_new (ty: TType) st : unit = + match ty with + | TType_tuple (tupInfo, l) -> + p_byte 0 st + p_tup2 + p_tup_info + p_tys_new + (tupInfo, l) + st + + | TType_app (tyconRef, typeInstantiation, nullness) -> + p_byte 1 st + p_tup4 + (p_tcref "app") + p_tys_new + p_nullness + (p_non_null_slot p_entity_spec_new) + (tyconRef, typeInstantiation, nullness, tyconRef.binding) + st + + | TType_fun (domainType, rangeType, nullness) -> + p_byte 2 st + p_ty_new domainType st + p_ty_new rangeType st + p_nullness nullness st + + | TType_var (typar, nullness) -> + p_byte 3 st + p_tup4 + p_tpref + p_nullness + (p_option p_ty_new) + p_stamp + (typar, nullness, typar.Solution, typar.Stamp) + st + + | TType_forall (tps, r) -> + p_byte 4 st + p_tup2 + p_typars + p_ty_new + (tps, r) + st + + | TType_measure unt -> + p_byte 5 st + p_measure_expr unt st + + | TType_ucase (uc, tinst) -> + p_byte 6 st + p_tup2 + p_ucref + p_tys_new + (uc, tinst) + st + + | TType_anon (anonInfo, l) -> + p_byte 7 st + p_tup2 + p_anonInfo + p_tys_new + (anonInfo, l) + st + +and p_tys_new l = + let _count = l.Length + p_list p_ty_new l + +and p_expr_new (expr: Expr) st = + match expr with + | Expr.Link e -> p_byte 0 st; p_expr_new e.Value st + | Expr.Const (x, m, ty) -> p_byte 1 st; p_tup3 p_const p_dummy_range p_ty_new (x, m, ty) st + | Expr.Val (a, b, m) -> + p_byte 2 st + p_tup4 + p_vref_new + p_vrefFlags + p_dummy_range + (p_non_null_slot p_Val_new) + (a, b, m, a.binding) + st + | Expr.Op (a, b, c, d) -> p_byte 3 st; p_tup4 p_op_new p_tys_new p_exprs_new p_dummy_range (a, b, c, d) st + | Expr.Sequential (a, b, c, d) -> p_byte 4 st; p_tup4 p_expr_new p_expr_new p_int p_dummy_range (a, b, (match c with NormalSeq -> 0 | ThenDoSeq -> 1), d) st + | Expr.Lambda (_, a1, b0, b1, c, d, e) -> p_byte 5 st; p_tup6 (p_option p_Val) (p_option p_Val) p_Vals p_expr_new p_dummy_range p_ty_new (a1, b0, b1, c, d, e) st + | Expr.TyLambda (_, b, c, d, e) -> p_byte 6 st; p_tup4 p_tyar_specs_new p_expr_new p_dummy_range p_ty_new (b, c, d, e) st + | Expr.App (funcExpr, formalType, typeArgs, args, range) -> + p_byte 7 st + + p_expr_new funcExpr st + p_ty_new formalType st + p_tys_new typeArgs st + p_exprs_new args st + p_dummy_range range st + | Expr.LetRec (a, b, c, _) -> p_byte 8 st; p_tup3 p_binds p_expr_new p_dummy_range (a, b, c) st + | Expr.Let (a, b, c, _) -> p_byte 9 st; p_tup3 p_bind p_expr_new p_dummy_range (a, b, c) st + | Expr.Match (_, a, b, c, d, e) -> p_byte 10 st; p_tup5 p_dummy_range p_dtree p_targets p_dummy_range p_ty_new (a, b, c, d, e) st + | Expr.Obj (_, b, c, d, e, f, g) -> p_byte 11 st; p_tup6 p_ty_new (p_option p_Val) p_expr_new p_methods p_intfs p_dummy_range (b, c, d, e, f, g) st + | Expr.StaticOptimization (a, b, c, d) -> p_byte 12 st; p_tup4 p_constraints p_expr_new p_expr_new p_dummy_range (a, b, c, d) st + | Expr.TyChoose (a, b, c) -> p_byte 13 st; p_tup3 p_tyar_specs_new p_expr_new p_dummy_range (a, b, c) st + | Expr.Quote (ast, _, _, m, ty) -> p_byte 14 st; p_tup3 p_expr_new p_dummy_range p_ty_new (ast, m, ty) st + | Expr.WitnessArg (traitInfo, m) -> p_byte 15 st; p_trait traitInfo st; p_dummy_range m st + | Expr.DebugPoint (_, innerExpr) -> + p_byte 16 st + p_expr_new innerExpr st + +and p_exprs_new = p_list p_expr_new + +and p_module_or_namespace_contents (x: ModuleOrNamespaceContents) st = + match x with + | TMDefs defs -> + p_byte 0 st + p_list p_module_or_namespace_contents defs st + | TMDefOpens openDecls -> + p_byte 1 st + p_list p_open_decl openDecls st + | TMDefLet (binding, range) -> + p_byte 2 st + p_tup2 + p_bind_new + p_range + (binding, range) + st + | TMDefDo (expr, range) -> + p_byte 3 st + p_tup2 + p_expr_new + p_range + (expr, range) + st + | TMDefRec (isRec, opens, tycons, bindings, range) -> + p_byte 4 st + p_tup5 + p_bool + (p_list p_open_decl) + (p_list p_entity_spec_data_new) + (p_list p_binding) + p_range + (isRec, opens, tycons, bindings, range) + st + +and p_checked_impl_file_contents = p_module_or_namespace_contents + +and p_named_debug_point_key (x: NamedDebugPointKey) st = + p_tup2 + p_range + p_string + (x.Range, x.Name) + st + +and p_named_debug_points = p_Map p_named_debug_point_key p_range + +and p_anon_recd_types = p_stamp_map p_anonInfo + +and p_checked_impl_file file st = + let (CheckedImplFile ( + qualifiedNameOfFile, + pragmas, + signature, + contents, + hasExplicitEntryPoint, + isScript, + anonRecdTypeInfo, + namedDebugPointsForInlinedCode)) = file + + p_tup8 + p_qualified_name_of_file + p_pragmas + p_modul_typ_new + p_checked_impl_file_contents + p_bool + p_bool + p_anon_recd_types + p_named_debug_points + (qualifiedNameOfFile, + pragmas, + signature, + contents, + hasExplicitEntryPoint, + isScript, + anonRecdTypeInfo, + namedDebugPointsForInlinedCode) + st + +and u_tycon_repr st = + let tag1 = u_byte st + match tag1 with + | 0 -> (fun _flagBit -> TNoRepr) + | 1 -> + let tag2 = u_byte st + match tag2 with + // Records historically use a different format to other FSharpTyconRepr + | 0 -> + let v = u_rfield_table st + (fun _flagBit -> + TFSharpTyconRepr + { + fsobjmodel_cases = Construct.MakeUnionCases [] + fsobjmodel_kind=TFSharpRecord + fsobjmodel_vslots=[] + fsobjmodel_rfields=v + }) + + // Unions without static fields historically use a different format to other FSharpTyconRepr + | 1 -> + let v = u_list u_unioncase_spec st + (fun _flagBit -> Construct.MakeUnionRepr v) + + | 2 -> + let v = u_ILType st + // This is the F# 3.0 extension to the format used for F# provider-generated types, which record an ILTypeRef in the format + // You can think of an F# 2.0 reader as always taking the path where 'flagBit' is false. Thus the F# 2.0 reader will + // interpret provider-generated types as TAsmRepr. + (fun flagBit -> + if flagBit then + let iltref = v.TypeRef + match st.iILModule with + | None -> TNoRepr + | Some iILModule -> + try + let rec find acc enclosingTypeNames (tdefs: ILTypeDefs) = + match enclosingTypeNames with + | [] -> List.rev acc, tdefs.FindByName iltref.Name + | h :: t -> + let nestedTypeDef = tdefs.FindByName h + find (nestedTypeDef :: acc) t nestedTypeDef.NestedTypes + let nestedILTypeDefs, ilTypeDef = find [] iltref.Enclosing iILModule.TypeDefs + TILObjectRepr(TILObjectReprData(st.iilscope, nestedILTypeDefs, ilTypeDef)) + with _ -> + System.Diagnostics.Debug.Assert(false, sprintf "failed to find IL backing metadata for cross-assembly generated type %s" iltref.FullName) + TNoRepr + else + TAsmRepr v) + + | 3 -> + let v = u_tycon_objmodel_data st + (fun _flagBit -> TFSharpTyconRepr v) + + | 4 -> + let v = u_ty st + (fun _flagBit -> TMeasureableRepr v) + + | _ -> ufailwith st "u_tycon_repr" + + // Unions with static fields use a different format to other FSharpTyconRepr + | 2 -> + let cases = u_array u_unioncase_spec st + let data = u_tycon_objmodel_data st + fun _flagBit -> TFSharpTyconRepr { data with fsobjmodel_cases = Construct.MakeUnionCases (Array.toList cases) } + | _ -> ufailwith st "u_tycon_repr" + + +and u_tycon_repr_new st = + let tag1 = u_byte st + match tag1 with + | 0 -> (fun _flagBit -> TNoRepr) + | 1 -> + let tag2 = u_byte st + match tag2 with + // Records historically use a different format to other FSharpTyconRepr + | 0 -> + let v = u_rfield_table st + (fun _flagBit -> + TFSharpTyconRepr + { + fsobjmodel_cases = Construct.MakeUnionCases [] + fsobjmodel_kind=TFSharpRecord + fsobjmodel_vslots=[] + fsobjmodel_rfields=v + }) + + // Unions without static fields historically use a different format to other FSharpTyconRepr + | 1 -> + let v = u_list u_unioncase_spec st + (fun _flagBit -> Construct.MakeUnionRepr v) + + | 2 -> + let v = u_ILType st + // This is the F# 3.0 extension to the format used for F# provider-generated types, which record an ILTypeRef in the format + // You can think of an F# 2.0 reader as always taking the path where 'flagBit' is false. Thus the F# 2.0 reader will + // interpret provider-generated types as TAsmRepr. + (fun flagBit -> + if flagBit then + let iltref = v.TypeRef + match st.iILModule with + | None -> TNoRepr + | Some iILModule -> + try + let rec find acc enclosingTypeNames (tdefs: ILTypeDefs) = + match enclosingTypeNames with + | [] -> List.rev acc, tdefs.FindByName iltref.Name + | h :: t -> + let nestedTypeDef = tdefs.FindByName h + find (nestedTypeDef :: acc) t nestedTypeDef.NestedTypes + let nestedILTypeDefs, ilTypeDef = find [] iltref.Enclosing iILModule.TypeDefs + TILObjectRepr(TILObjectReprData(st.iilscope, nestedILTypeDefs, ilTypeDef)) + with _ -> + System.Diagnostics.Debug.Assert(false, sprintf "failed to find IL backing metadata for cross-assembly generated type %s" iltref.FullName) + TNoRepr + else + TAsmRepr v) + + | 3 -> + let v = u_tycon_objmodel_data st + (fun _flagBit -> TFSharpTyconRepr v) + + | 4 -> + let v = u_ty st + (fun _flagBit -> TMeasureableRepr v) + + | _ -> ufailwith st "u_tycon_repr" + + // Unions with static fields use a different format to other FSharpTyconRepr + | 2 -> + let cases = u_array u_unioncase_spec st + let data = u_tycon_objmodel_data st + fun _flagBit -> TFSharpTyconRepr { data with fsobjmodel_cases = Construct.MakeUnionCases (Array.toList cases) } + + | 5 -> + // | TILObjectRepr (TILObjectReprData (scope, nesting, td)) -> + let scope = u_ILScopeRef st + let nesting = u_list u_ILTypeDef st + let definition = u_ILTypeDef st + + (fun _flagBit -> TILObjectRepr (TILObjectReprData (scope, nesting, definition))) + + | _ -> ufailwith st "u_tycon_repr" + + +and u_tycon_objmodel_data st = + let x1, x2, x3 = u_tup3 u_tycon_objmodel_kind u_vrefs u_rfield_table st + { + fsobjmodel_cases = Construct.MakeUnionCases [] + fsobjmodel_kind=x1 + fsobjmodel_vslots=x2 + fsobjmodel_rfields=x3 + } + +and u_attribs_ext extraf st = u_list_ext extraf u_attrib st +and u_unioncase_spec st = + let a = u_rfield_table st + let b = u_ty st // The union case compiled name is now computed from Id field when needed and is not stored in UnionCase record. let _c = u_string st @@ -2368,6 +3066,59 @@ and u_entity_spec_data st : Entity = entity_exn_info = x14 } } +and u_entity_spec_data_new st : Entity = + let x1, x2a, x2b, x2c, stamp, x3, (x4a, x4b), x6, x7, x8, x9, _x10, x10b, x11, x12, x13, x14, x15 = + u_tup18 + u_tyar_specs_new + u_string + (u_option u_string) + u_range + u_stamp + (u_option u_pubpath) + (u_tup2 u_access u_access) + u_attribs + u_tycon_repr_new + (u_option u_ty_new) + u_tcaug_new + u_string + u_kind + u_int64 + (u_option u_cpath ) + (u_lazy u_modul_typ_new) + u_exnc_repr + (u_used_space1 u_xmldoc) + st + // We use a bit that was unused in the F# 2.0 format to indicate two possible representations in the F# 3.0 tycon_repr format + //let x7 = x7f (x11 &&& EntityFlags.ReservedBitForPickleFormatTyconReprFlag <> 0L) + //let x11 = x11 &&& ~~~EntityFlags.ReservedBitForPickleFormatTyconReprFlag + + { entity_typars=LazyWithContext.NotLazy x1 + entity_stamp=stamp + entity_logical_name=x2a + entity_range=x2c + entity_pubpath=x3 + entity_attribs=x6 + entity_tycon_repr=x7 false + entity_tycon_tcaug=x9 + entity_flags=EntityFlags x11 + entity_cpath=x12 + entity_modul_type=MaybeLazy.Lazy x13 + entity_il_repr_cache=newCache() + entity_opt_data= + match x2b, x10b, x15, x8, x4a, x4b, x14 with + | None, TyparKind.Type, None, None, TAccess [], TAccess [], TExnNone -> None + | _ -> + Some { Entity.NewEmptyEntityOptData() with + entity_compiled_name = x2b + entity_kind = x10b + entity_xmldoc= defaultArg x15 XmlDoc.Empty + entity_xmldocsig = System.String.Empty + entity_tycon_abbrev = x8 + entity_accessibility = x4a + entity_tycon_repr_accessibility = x4b + entity_exn_info = x14 } + } + and u_tcaug st = let a1, a2, a3, b2, c, d, e, g, _space = u_tup9 @@ -2395,9 +3146,39 @@ and u_tcaug st = tcaug_closed=true tcaug_abstract=g} +and u_tcaug_new st : TyconAugmentation = + let a1, a2, a3, b2, c, d, e, g, _space = + u_tup9 + (u_option (u_tup2 u_vref u_vref)) + (u_option u_vref) + (u_option (u_tup3 u_vref u_vref u_vref)) + (u_option (u_tup2 u_vref u_vref)) + (u_list (u_tup2 u_string u_vref)) + (u_list (u_tup3 u_ty_new u_bool u_dummy_range)) + (u_option u_ty_new) + u_bool + (u_space 1) + st + {tcaug_compare=a1 + tcaug_compare_withc=a2 + tcaug_hash_and_equals_withc=a3 |> Option.map (fun (v1, v2, v3) -> (v1, v2, v3, None)) + tcaug_equals=b2 + // only used for code generation and checking - hence don't care about the values when reading back in + tcaug_hasObjectGetHashCode=false + tcaug_adhoc_list= ResizeArray<_>(c |> List.map (fun (_, vref) -> (false, vref))) + tcaug_adhoc=NameMultiMap.ofList c + tcaug_interfaces=d + tcaug_super=e + // pickled type definitions are always closed (i.e. no more intrinsic members allowed) + tcaug_closed=true + tcaug_abstract=g} + and u_entity_spec st = u_osgn_decl st.ientities u_entity_spec_data st +and u_entity_spec_new st = + u_osgn_decl st.ientities u_entity_spec_data_new st + and u_parentref st = let tag = u_byte st match tag with @@ -2431,81 +3212,565 @@ and u_member_info st : ValMemberInfo = ImplementedSlotSigs=x4 IsImplemented=x5 } -and u_tycon_objmodel_kind st = - let tag = u_byte st - match tag with - | 0 -> TFSharpClass - | 1 -> TFSharpInterface - | 2 -> TFSharpStruct - | 3 -> u_slotsig st |> TFSharpDelegate - | 4 -> TFSharpEnum - | 5 -> TFSharpUnion - | 6 -> TFSharpRecord - | _ -> ufailwith st "u_tycon_objmodel_kind" +and u_tycon_objmodel_kind st = + let tag = u_byte st + match tag with + | 0 -> TFSharpClass + | 1 -> TFSharpInterface + | 2 -> TFSharpStruct + | 3 -> u_slotsig st |> TFSharpDelegate + | 4 -> TFSharpEnum + | 5 -> TFSharpUnion + | 6 -> TFSharpRecord + | _ -> ufailwith st "u_tycon_objmodel_kind" + +and u_vrefFlags st = + match u_byte st with + | 0 -> NormalValUse + | 1 -> CtorValUsedAsSuperInit + | 2 -> CtorValUsedAsSelfInit + | 3 -> PossibleConstrainedCall (u_ty st) + | 4 -> VSlotDirectCall + | _ -> ufailwith st "u_vrefFlags" + +and u_ValData st = + let x1, x1z, x1a, x2, x4, x8, x9, x10, x12, x13, x13b, x14, x15 = + u_tup13 + u_string + (u_option u_string) + u_ranges + u_ty + u_int64 + (u_option u_member_info) + u_attribs + (u_option u_ValReprInfo) + u_string + u_access + u_parentref + (u_option u_const) + (u_used_space1 u_xmldoc) + st + + { val_logical_name = x1 + val_range = (match x1a with None -> range0 | Some(a, _) -> a) + val_type = x2 + val_stamp = newStamp() + val_flags = ValFlags x4 + val_opt_data = + match x1z, x1a, x10, x14, x13, x15, x8, x13b, x12, x9 with + | None, None, None, None, TAccess [], None, None, ParentNone, "", [] -> None + | _ -> + Some { val_compiled_name = x1z + val_other_range = (match x1a with None -> None | Some(_, b) -> Some(b, true)) + val_defn = None + val_repr_info = x10 + val_repr_info_for_display = None + arg_repr_info_for_display = None + val_const = x14 + val_access = x13 + val_xmldoc = defaultArg x15 XmlDoc.Empty + val_other_xmldoc = None + val_member_info = x8 + val_declaring_entity = x13b + val_xmldocsig = x12 + val_attribs = x9 } + } + + +and u_ValData_new st = + let x1, x1z, x1a, x2, stamp, x4, x8, x9, x10, x12, x13, x13b, x14, x15 = + u_tup14 + u_string + (u_option u_string) + u_ranges + u_ty_new + u_stamp + u_int64 + (u_option u_member_info) + u_attribs + (u_option u_ValReprInfo) + u_string + u_access + u_parentref + (u_option u_const) + (u_used_space1 u_xmldoc) + st + + { val_logical_name = x1 + val_range = (match x1a with None -> range0 | Some(a, _) -> a) + val_type = x2 + val_stamp = stamp + val_flags = ValFlags x4 + val_opt_data = + match x1z, x1a, x10, x14, x13, x15, x8, x13b, x12, x9 with + | None, None, None, None, TAccess [], None, None, ParentNone, "", [] -> None + | _ -> + Some { val_compiled_name = x1z + val_other_range = (match x1a with None -> None | Some(_, b) -> Some(b, true)) + val_defn = None + val_repr_info = x10 + val_repr_info_for_display = None + arg_repr_info_for_display = None + val_const = x14 + val_access = x13 + val_xmldoc = defaultArg x15 XmlDoc.Empty + val_other_xmldoc = None + val_member_info = x8 + val_declaring_entity = x13b + val_xmldocsig = x12 + val_attribs = x9 } + } + +and u_Val st = u_osgn_decl st.ivals u_ValData st + +and u_Val_new st = u_osgn_decl st.ivals u_ValData_new st + +and u_modul_typ st = + let x1, x3, x5 = + u_tup3 + u_istype + (u_qlist u_Val) + (u_qlist u_entity_spec) st + ModuleOrNamespaceType(x1, x3, x5) + +and u_modul_typ_new st = + let x1, x3, x5 = + u_tup3 + u_istype + (u_qlist u_Val_new) + (u_qlist u_entity_spec_new) st + ModuleOrNamespaceType(x1, x3, x5) + +and u_qualified_name_of_file st = + let ident = u_ident st + QualifiedNameOfFile(ident) + +and u_pragma st = + let range, warningNumber = + u_tup2 + u_range + u_int + st + + ScopedPragma.WarningOff (range, warningNumber) + +and u_pragmas st = + u_list u_pragma st + +and u_long_ident st = + u_list u_ident st + +and u_trivia st : SyntaxTrivia.IdentTrivia = + ufailwith st (nameof p_trivia) + +and u_syn_long_ident st = + let id, dotRanges, trivia = + u_tup3 + u_long_ident + (u_list u_range) + (u_list (u_option u_trivia)) + st + + SynLongIdent (id, dotRanges, trivia) + +and u_syn_type st : SynType = + ufailwith st (nameof u_syn_type) + +and u_syn_open_decl_target st : SynOpenDeclTarget = + let tag = u_byte st + match tag with + | 0 -> + let longId, range = + u_tup2 + u_syn_long_ident + u_range + st + + SynOpenDeclTarget.ModuleOrNamespace (longId, range) + | 1 -> + let typeName, range = + u_tup2 + u_syn_type + u_range + st + SynOpenDeclTarget.Type (typeName, range) + | _ -> + ufailwith st (nameof u_syn_open_decl_target) + +and u_ccu_data st : CcuData = + let fileName = u_option u_string st + let ilScopeRef = u_ILScopeRef st + let stamp = u_stamp st + let qualifiedName = u_option u_string st + let sourceCodeDirectory = u_string st + let isFSharp = u_bool st +#if !NO_TYPEPROVIDERS + let isProviderGenerated = u_bool st +#endif + let usesFSharp20PlusQuotations = u_bool st + let contents = u_entity_spec_data_new st + + { + FileName = fileName + ILScopeRef = ilScopeRef + Stamp = stamp + QualifiedName = qualifiedName + SourceCodeDirectory = sourceCodeDirectory + IsFSharp = isFSharp +#if !NO_TYPEPROVIDERS + IsProviderGenerated = isProviderGenerated + InvalidateEvent = Unchecked.defaultof<_> + ImportProvidedType = Unchecked.defaultof<_> +#endif + UsesFSharp20PlusQuotations = usesFSharp20PlusQuotations + Contents = contents + TryGetILModuleDef = Unchecked.defaultof<_> + MemberSignatureEquality = Unchecked.defaultof<_> + TypeForwarders = Unchecked.defaultof<_> + XmlDocumentationInfo = Unchecked.defaultof<_> + } + +and u_ccuref_new st : CcuThunk = + let target, name = + u_tup2 + u_ccu_data + u_string + st + + { + target = target + name = name + } + +and u_nleref_new st = + let ccu, strings = + u_tup2 + u_ccuref_new + (u_array u_string) + st + + NonLocalEntityRef (ccu, strings) + +and u_tcref_new st : EntityRef = + let tag = u_byte st + match tag with + | 0 -> u_local_item_ref st.ientities st |> ERefLocal + | 1 -> u_nleref_new st |> ERefNonLocal + | _ -> ufailwith st "u_item_ref" + +and u_nonlocal_val_ref_new st : NonLocalValOrMemberRef = + let a = u_tcref_new st + let b1 = u_option u_string st + let b2 = u_bool st + let b3 = u_string st + let c = u_int st + let d = u_option u_ty_new st + { EnclosingEntity = a + ItemKey=ValLinkageFullKey({ MemberParentMangledName=b1; MemberIsOverride=b2;LogicalName=b3; TotalArgCount=c }, d) } + +and u_vref_new st : ValRef = + let tag = u_byte st + match tag with + | 0 -> u_local_item_ref st.ivals st |> VRefLocal + | 1 -> u_nonlocal_val_ref_new st |> VRefNonLocal + | _ -> ufailwith st "u_item_ref" + +and u_open_decl st : OpenDeclaration = + let target, range, modules, types, appliedScope, isOwnNamespace = + u_tup6 + u_syn_open_decl_target + (u_option u_range) + (u_list u_tcref_new) + u_tys + u_range + u_bool + st + + { + Target = target + Range = range + Modules = modules + Types = types + AppliedScope = appliedScope + IsOwnNamespace = isOwnNamespace + } + +and u_binding st : ModuleOrNamespaceBinding = + let tag = u_byte st + match tag with + | 0 -> + let binding = u_bind st + ModuleOrNamespaceBinding.Binding binding + | 1 -> + let moduleOrNamespace, moduleOrNamespaceContents = + u_tup2 + u_entity_spec_new + u_module_or_namespace_contents + st + ModuleOrNamespaceBinding.Module (moduleOrNamespace, moduleOrNamespaceContents) + | _ -> + ufailwith st (nameof u_binding) + +and u_tup_info st : TupInfo = + let c = u_bool st + TupInfo.Const c + +and u_nullness st = + let tag = u_byte st + let nullnessInfo = + match tag with + | 0 -> NullnessInfo.WithNull + | 1 -> NullnessInfo.WithoutNull + | 2 -> NullnessInfo.AmbivalentToNull + | _ -> ufailwith st (nameof u_nullness) + + Nullness.Known nullnessInfo + +and u_typars = u_list u_tpref + +and u_ty_new st : TType = + let tag = u_byte st + match tag with + | 0 -> + let tupInfo, l = + u_tup2 + u_tup_info + u_tys_new + st + TType_tuple (tupInfo, l) + + | 1 -> + let tyconRef, typeInstantiation, nullness, binding = + u_tup4 + u_tcref + u_tys_new + u_nullness + (u_non_null_slot u_entity_spec_new) + st + + tyconRef.binding <- binding + TType_app (tyconRef, typeInstantiation, nullness) + + | 2 -> + let (domainType, rangeType, nullness) = + u_tup3 + u_ty_new + u_ty_new + u_nullness + st + TType_fun (domainType, rangeType, nullness) + + | 3 -> + let (typar, nullness, solution, stamp) = + u_tup4 + u_tpref + u_nullness + (u_option u_ty_new) + u_stamp + st + + typar.typar_solution <- solution + typar.typar_stamp <- stamp + TType_var (typar, nullness) + + | 4 -> + let (tps, r) = + u_tup2 + u_typars + u_ty_new + st -and u_vrefFlags st = - match u_byte st with - | 0 -> NormalValUse - | 1 -> CtorValUsedAsSuperInit - | 2 -> CtorValUsedAsSelfInit - | 3 -> PossibleConstrainedCall (u_ty st) - | 4 -> VSlotDirectCall - | _ -> ufailwith st "u_vrefFlags" + TType_forall (tps, r) -and u_ValData st = - let x1, x1z, x1a, x2, x4, x8, x9, x10, x12, x13, x13b, x14, x15 = - u_tup13 - u_string - (u_option u_string) - u_ranges - u_ty - u_int64 - (u_option u_member_info) - u_attribs - (u_option u_ValReprInfo) - u_string - u_access - u_parentref - (u_option u_const) - (u_used_space1 u_xmldoc) - st + | 5 -> + let unt = u_measure_expr st + TType_measure unt - { val_logical_name = x1 - val_range = (match x1a with None -> range0 | Some(a, _) -> a) - val_type = x2 - val_stamp = newStamp() - val_flags = ValFlags x4 - val_opt_data = - match x1z, x1a, x10, x14, x13, x15, x8, x13b, x12, x9 with - | None, None, None, None, TAccess [], None, None, ParentNone, "", [] -> None - | _ -> - Some { val_compiled_name = x1z - val_other_range = (match x1a with None -> None | Some(_, b) -> Some(b, true)) - val_defn = None - val_repr_info = x10 - val_repr_info_for_display = None - arg_repr_info_for_display = None - val_const = x14 - val_access = x13 - val_xmldoc = defaultArg x15 XmlDoc.Empty - val_other_xmldoc = None - val_member_info = x8 - val_declaring_entity = x13b - val_xmldocsig = x12 - val_attribs = x9 } - } + | 6 -> + let uc, tinst = + u_tup2 + u_ucref + u_tys_new + st + TType_ucase (uc, tinst) -and u_Val st = u_osgn_decl st.ivals u_ValData st + | 7 -> + let anonInfo, l = + u_tup2 + u_anonInfo + u_tys_new + st + TType_anon (anonInfo, l) + | _ -> + ufailwith st (nameof u_ty_new) +and u_tys_new = u_list u_ty_new -and u_modul_typ st = - let x1, x3, x5 = - u_tup3 - u_istype - (u_qlist u_Val) - (u_qlist u_entity_spec) st - ModuleOrNamespaceType(x1, x3, x5) +and u_expr_new st : Expr = + let tag = u_byte st + match tag with + | 0 -> let e = u_expr_new st + let r = ref e + Expr.Link r + | 1 -> let a = u_const st + let b = u_dummy_range st + let c = u_ty_new st + Expr.Const (a, b, c) + | 2 -> let valRef = u_vref_new st + let flags = u_vrefFlags st + let range = u_dummy_range st + let binding = (u_non_null_slot u_Val_new) st + + valRef.binding <- binding + let expr = Expr.Val (valRef, flags, range) + expr + | 3 -> let a = u_op_new st + let b = u_tys_new st + let c = u_exprs_new st + let d = u_dummy_range st + Expr.Op (a, b, c, d) + | 4 -> let a = u_expr_new st + let b = u_expr_new st + let c = u_int st + let d = u_dummy_range st + let dir = match c with 0 -> NormalSeq | 1 -> ThenDoSeq | _ -> ufailwith st "specialSeqFlag" + Expr.Sequential (a, b, dir, d) + | 5 -> let a0 = u_option u_Val st + let b0 = u_option u_Val st + let b1 = u_Vals st + let c = u_expr_new st + let d = u_dummy_range st + let e = u_ty_new st + Expr.Lambda (newUnique(), a0, b0, b1, c, d, e) + | 6 -> let b = u_tyar_specs_new st + let c = u_expr_new st + let d = u_dummy_range st + let e = u_ty_new st + Expr.TyLambda (newUnique(), b, c, d, e) + | 7 -> let a1 = u_expr_new st + let a2 = u_ty_new st + let b = u_tys_new st + let c = u_exprs_new st + let d = u_dummy_range st + let expr = Expr.App (a1, a2, b, c, d) + expr + | 8 -> let a = u_binds st + let b = u_expr_new st + let c = u_dummy_range st + Expr.LetRec (a, b, c, Construct.NewFreeVarsCache()) + | 9 -> let a = u_bind st + let b = u_expr_new st + let c = u_dummy_range st + Expr.Let (a, b, c, Construct.NewFreeVarsCache()) + | 10 -> let a = u_dummy_range st + let b = u_dtree st + let c = u_targets st + let d = u_dummy_range st + let e = u_ty_new st + Expr.Match (DebugPointAtBinding.NoneAtSticky, a, b, c, d, e) + | 11 -> let b = u_ty_new st + let c = (u_option u_Val) st + let d = u_expr_new st + let e = u_methods st + let f = u_intfs st + let g = u_dummy_range st + Expr.Obj (newUnique(), b, c, d, e, f, g) + | 12 -> let a = u_constraints st + let b = u_expr_new st + let c = u_expr_new st + let d = u_dummy_range st + Expr.StaticOptimization (a, b, c, d) + | 13 -> let a = u_tyar_specs_new st + let b = u_expr_new st + let c = u_dummy_range st + Expr.TyChoose (a, b, c) + | 14 -> let b = u_expr_new st + let c = u_dummy_range st + let d = u_ty_new st + Expr.Quote (b, ref None, false, c, d) // isFromQueryExpression=false + | 15 -> let traitInfo = u_trait st + let m = u_dummy_range st + Expr.WitnessArg (traitInfo, m) + | 16 -> let m = u_dummy_range st + let expr = u_expr_new st + Expr.DebugPoint (DebugPointAtLeafExpr.Yes m, expr) + | _ -> ufailwith st "u_expr" + +and u_exprs_new = u_list u_expr_new + +and u_module_or_namespace_contents st : ModuleOrNamespaceContents = + let tag = u_byte st + match tag with + | 0 -> + let defs = u_list u_module_or_namespace_contents st + TMDefs defs + | 1 -> + let openDecls = u_list u_open_decl st + TMDefOpens openDecls + | 2 -> + let binding, range = + u_tup2 + u_bind_new + u_range + st + TMDefLet(binding, range) + | 3 -> + let expr, range = + u_tup2 + u_expr_new + u_range + st + TMDefDo(expr, range) + | 4 -> + let isRec, opens, tycons, bindings, range = + u_tup5 + u_bool + (u_list u_open_decl) + (u_list u_entity_spec_data_new) + (u_list u_binding) + u_range + st + TMDefRec (isRec, opens, tycons, bindings, range) + | _ -> + ufailwith st (nameof u_module_or_namespace_contents) + +and u_checked_impl_file_contents = u_module_or_namespace_contents + +and u_named_debug_point_key st : NamedDebugPointKey = + let range, name = + u_tup2 + u_range + u_string + st + { Range = range; Name = name} + +and u_named_debug_points = u_Map u_named_debug_point_key u_range + +and u_anon_recd_types = u_stamp_map u_anonInfo + +and u_checked_impl_file st = + let qualifiedNameOfFile, pragmas, signature, contents, hasExplicitEntryPoint, isScript, anonRecdTypeInfo, namedDebugPointsForInlinedCode = + u_tup8 + u_qualified_name_of_file + u_pragmas + u_modul_typ_new + u_checked_impl_file_contents + u_bool + u_bool + u_anon_recd_types + u_named_debug_points + st + + CheckedImplFile( + qualifiedNameOfFile, + pragmas, + signature, + contents, + hasExplicitEntryPoint, + isScript, + anonRecdTypeInfo, + namedDebugPointsForInlinedCode) //--------------------------------------------------------------------------- // Pickle/unpickle for F# expressions (for optimization data) @@ -2577,6 +3842,8 @@ and p_dtree_discrim x st = and p_target (TTarget(a, b, _)) st = p_tup2 p_Vals p_expr (a, b) st and p_bind (TBind(a, b, _)) st = p_tup2 p_Val p_expr (a, b) st +and p_bind_new (TBind(a, b, _)) st = p_tup2 p_Val_new p_expr_new (a, b) st + and p_lval_op_kind x st = p_byte (match x with LAddrOf _ -> 0 | LByrefGet -> 1 | LSet -> 2 | LByrefSet -> 3) st @@ -2611,6 +3878,11 @@ and u_target st = let a, b = u_tup2 u_Vals u_expr st in (TTarget(a, b, None)) and u_bind st = let a = u_Val st in let b = u_expr st in TBind(a, b, DebugPointAtBinding.NoneAtSticky) +and u_bind_new st = + let a = u_Val_new st + let b = u_expr_new st + TBind(a, b, DebugPointAtBinding.NoneAtSticky) + and u_lval_op_kind st = match u_byte st with | 0 -> LAddrOf false @@ -2619,6 +3891,13 @@ and u_lval_op_kind st = | 3 -> LByrefSet | _ -> ufailwith st "uval_op_kind" +and p_ucref_new (UnionCaseRef(a, b)) st = + p_tup3 + (p_tcref "ucref") + p_string + (p_non_null_slot p_entity_spec_new) + (a, b, a.binding) + st and p_op x st = match x with @@ -2668,6 +3947,68 @@ and p_op x st = | TOp.AnonRecdGet (info, n) -> p_byte 32 st; p_anonInfo info st; p_int n st | TOp.Goto _ | TOp.Label _ | TOp.Return -> failwith "unexpected backend construct in pickled TAST" +and p_op_new x st = + match x with + | TOp.UnionCase c -> + p_byte 0 st + p_ucref_new c st + | TOp.ExnConstr c -> p_byte 1 st; p_tcref "op" c st + | TOp.Tuple tupInfo -> + if evalTupInfoIsStruct tupInfo then + p_byte 29 st + else + p_byte 2 st + | TOp.Recd (a, b) -> p_byte 3 st; p_tup2 p_recdInfo (p_tcref "recd op") (a, b) st + | TOp.ValFieldSet a -> p_byte 4 st; p_rfref a st + | TOp.ValFieldGet a -> p_byte 5 st; p_rfref a st + | TOp.UnionCaseTagGet a -> p_byte 6 st; p_tcref "cnstr op" a st + | TOp.UnionCaseFieldGet (a, b) -> p_byte 7 st; p_tup2 p_ucref p_int (a, b) st + | TOp.UnionCaseFieldSet (a, b) -> p_byte 8 st; p_tup2 p_ucref p_int (a, b) st + | TOp.ExnFieldGet (a, b) -> p_byte 9 st; p_tup2 (p_tcref "exn op") p_int (a, b) st + | TOp.ExnFieldSet (a, b) -> p_byte 10 st; p_tup2 (p_tcref "exn op") p_int (a, b) st + | TOp.TupleFieldGet (tupInfo, a) -> + if evalTupInfoIsStruct tupInfo then + p_byte 30 st; p_int a st + else + p_byte 11 st; p_int a st + | TOp.ILAsm (a, b) -> p_byte 12 st; p_tup2 (p_list p_ILInstr) p_tys (a, b) st + | TOp.RefAddrGet _ -> p_byte 13 st + | TOp.UnionCaseProof a -> p_byte 14 st; p_ucref a st + | TOp.Coerce -> p_byte 15 st + | TOp.TraitCall b -> p_byte 16 st; p_trait b st + | TOp.LValueOp (a, b) -> p_byte 17 st; p_tup2 p_lval_op_kind (p_vref "lval") (a, b) st + | TOp.ILCall (a1, a2, a3, a4, a5, a7, a8, a9, b, c, d) + -> p_byte 18 st; p_tup11 p_bool p_bool p_bool p_bool p_vrefFlags p_bool p_bool p_ILMethodRef p_tys p_tys p_tys (a1, a2, a3, a4, a5, a7, a8, a9, b, c, d) st + | TOp.Array -> p_byte 19 st + | TOp.While _ -> p_byte 20 st + | TOp.IntegerForLoop (_, _, dir) -> p_byte 21 st; p_int (match dir with FSharpForLoopUp -> 0 | CSharpForLoopUp -> 1 | FSharpForLoopDown -> 2) st + | TOp.Bytes bytes -> p_byte 22 st; p_bytes bytes st + | TOp.TryWith _ -> p_byte 23 st + | TOp.TryFinally _ -> p_byte 24 st + | TOp.ValFieldGetAddr (a, _) -> p_byte 25 st; p_rfref a st + | TOp.UInt16s arr -> p_byte 26 st; p_array p_uint16 arr st + | TOp.Reraise -> p_byte 27 st + | TOp.UnionCaseFieldGetAddr (a, b, _) -> p_byte 28 st; p_tup2 p_ucref p_int (a, b) st + // Note tag byte 29 is taken for struct tuples, see above + // Note tag byte 30 is taken for struct tuples, see above + (* 29: TOp.Tuple when evalTupInfoIsStruct tupInfo = true *) + (* 30: TOp.TupleFieldGet when evalTupInfoIsStruct tupInfo = true *) + | TOp.AnonRecd info -> p_byte 31 st; p_anonInfo info st + | TOp.AnonRecdGet (info, n) -> p_byte 32 st; p_anonInfo info st; p_int n st + | TOp.Goto _ | TOp.Label _ | TOp.Return -> failwith "unexpected backend construct in pickled TAST" + +and u_ucref_new st = + let tcref, caseName, binding = + u_tup3 + u_tcref + u_string + (u_non_null_slot u_entity_spec_new) + st + + tcref.binding <- binding + UnionCaseRef(tcref, caseName) + + and u_op st = let tag = u_byte st match tag with @@ -2739,6 +4080,78 @@ and u_op st = TOp.AnonRecdGet (info, n) | _ -> ufailwith st "u_op" +and u_op_new st = + let tag = u_byte st + match tag with + | 0 -> let a = u_ucref_new st + TOp.UnionCase a + | 1 -> let a = u_tcref st + TOp.ExnConstr a + | 2 -> TOp.Tuple tupInfoRef + | 3 -> let b = u_tcref st + TOp.Recd (RecdExpr, b) + | 4 -> let a = u_rfref st + TOp.ValFieldSet a + | 5 -> let a = u_rfref st + TOp.ValFieldGet a + | 6 -> let a = u_tcref st + TOp.UnionCaseTagGet a + | 7 -> let a = u_ucref st + let b = u_int st + TOp.UnionCaseFieldGet (a, b) + | 8 -> let a = u_ucref st + let b = u_int st + TOp.UnionCaseFieldSet (a, b) + | 9 -> let a = u_tcref st + let b = u_int st + TOp.ExnFieldGet (a, b) + | 10 -> let a = u_tcref st + let b = u_int st + TOp.ExnFieldSet (a, b) + | 11 -> let a = u_int st + TOp.TupleFieldGet (tupInfoRef, a) + | 12 -> let a = (u_list u_ILInstr) st + let b = u_tys st + TOp.ILAsm (a, b) + | 13 -> TOp.RefAddrGet false // ok to set the 'readonly' flag on these operands to false on re-read since the flag is only used for typechecking purposes + | 14 -> let a = u_ucref st + TOp.UnionCaseProof a + | 15 -> TOp.Coerce + | 16 -> let a = u_trait st + TOp.TraitCall a + | 17 -> let a = u_lval_op_kind st + let b = u_vref st + TOp.LValueOp (a, b) + | 18 -> let a1, a2, a3, a4, a5, a7, a8, a9 = (u_tup8 u_bool u_bool u_bool u_bool u_vrefFlags u_bool u_bool u_ILMethodRef) st + let b = u_tys st + let c = u_tys st + let d = u_tys st + TOp.ILCall (a1, a2, a3, a4, a5, a7, a8, a9, b, c, d) + | 19 -> TOp.Array + | 20 -> TOp.While (DebugPointAtWhile.No, NoSpecialWhileLoopMarker) + | 21 -> let dir = match u_int st with 0 -> FSharpForLoopUp | 1 -> CSharpForLoopUp | 2 -> FSharpForLoopDown | _ -> failwith "unknown for loop" + TOp.IntegerForLoop (DebugPointAtFor.No, DebugPointAtInOrTo.No, dir) + | 22 -> TOp.Bytes (u_bytes st) + | 23 -> TOp.TryWith (DebugPointAtTry.No, DebugPointAtWith.No) + | 24 -> TOp.TryFinally (DebugPointAtTry.No, DebugPointAtFinally.No) + | 25 -> let a = u_rfref st + TOp.ValFieldGetAddr (a, false) + | 26 -> TOp.UInt16s (u_array u_uint16 st) + | 27 -> TOp.Reraise + | 28 -> let a = u_ucref st + let b = u_int st + TOp.UnionCaseFieldGetAddr (a, b, false) + | 29 -> TOp.Tuple tupInfoStruct + | 30 -> let a = u_int st + TOp.TupleFieldGet (tupInfoStruct, a) + | 31 -> let info = u_anonInfo st + TOp.AnonRecd info + | 32 -> let info = u_anonInfo st + let n = u_int st + TOp.AnonRecdGet (info, n) + | _ -> ufailwith st "u_op" + + and p_expr expr st = match expr with | Expr.Link e -> p_expr e.Value st @@ -2902,8 +4315,33 @@ let pickleModuleOrNamespace mspec st = p_entity_spec mspec st let pickleCcuInfo (minfo: PickledCcuInfo) st = p_tup4 pickleModuleOrNamespace p_string p_bool (p_space 3) (minfo.mspec, minfo.compileTimeWorkingDir, minfo.usesQuotations, ()) st +let pickleTcInfo (tcInfo: PickledTcInfo) (st: WriterState) = + p_tup4 + p_attribs + p_attribs + p_attribs + (p_list p_checked_impl_file) + (tcInfo.MainMethodAttrs, tcInfo.NetModuleAttrs, tcInfo.AssemblyAttrs, tcInfo.DeclaredImpls) + st + let unpickleModuleOrNamespace st = u_entity_spec st let unpickleCcuInfo st = let a, b, c, _space = u_tup4 unpickleModuleOrNamespace u_string u_bool (u_space 3) st { mspec=a; compileTimeWorkingDir=b; usesQuotations=c } + +let unpickleTcInfo st : PickledTcInfo = + let mainMethodAttrs, netModuleAttrs, assemblyAttrs, declaredImpls = + u_tup4 + u_attribs + u_attribs + u_attribs + (u_list u_checked_impl_file) + st + + { + MainMethodAttrs = mainMethodAttrs + NetModuleAttrs = netModuleAttrs + AssemblyAttrs = assemblyAttrs + DeclaredImpls = declaredImpls + } diff --git a/src/Compiler/TypedTree/TypedTreePickle.fsi b/src/Compiler/TypedTree/TypedTreePickle.fsi index 3e3910bd4e1..1b8dbe79152 100644 --- a/src/Compiler/TypedTree/TypedTreePickle.fsi +++ b/src/Compiler/TypedTree/TypedTreePickle.fsi @@ -83,6 +83,9 @@ val internal p_ty: pickler /// Serialize a TAST description of a compilation unit val internal pickleCcuInfo: pickler +/// Serialize typechecking info +val internal pickleTcInfo: pickler + /// Serialize an arbitrary object using the given pickler val pickleObjWithDanglingCcus: inMem: bool -> file: string -> TcGlobals -> scope: CcuThunk -> pickler<'T> -> 'T -> ByteBuffer * ByteBuffer @@ -145,6 +148,9 @@ val internal u_ty: unpickler /// Deserialize a TAST description of a compilation unit val internal unpickleCcuInfo: ReaderState -> PickledCcuInfo +/// Deserialize typechecking info +val internal unpickleTcInfo: ReaderState -> PickledTcInfo + /// Deserialize an arbitrary object which may have holes referring to other compilation units val internal unpickleObjWithDanglingCcus: file: string -> diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index a83be01f432..b2e8152e8e3 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -265,6 +265,7 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/ReuseTcResults/Activities.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/ReuseTcResults/Activities.fs index 1054b4af2a9..aa017d8fb2b 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/ReuseTcResults/Activities.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/ReuseTcResults/Activities.fs @@ -139,6 +139,8 @@ type Activities() = let cUnit = FsxFromPath tempPath |> withReuseTcResults + |> withOptions [ "--compressmetadata-" ] + |> withOptions [ "--optimize-" ] cUnit |> compileExisting diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/ReuseTcResults/Recompilation.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/ReuseTcResults/Recompilation.fs new file mode 100644 index 00000000000..a59e44185d6 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/ReuseTcResults/Recompilation.fs @@ -0,0 +1,82 @@ +namespace TypeChecks.ReuseTcResultsTests + +open System.IO + +open FSharp.Test +open FSharp.Test.Compiler + +open Xunit + +open TestFramework + + +[] +type Recompilation() = + + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [ 42">] + [] + [] + + [] + [] + [] + [] + [] + [] + + //[] + //[] + //[] + //[] + //[] + //[] + let ``Recompiles using restored TC info`` (code: string) = + let fileName = getTemporaryFileName() + let tempPath = $"{fileName}.fsx" + + File.WriteAllText(tempPath, code) + + let cUnit = + FsxFromPath tempPath + |> withReuseTcResults + |> withOptions [ "--compressmetadata-" ] + |> withOptions [ "--optimize-" ] + + let expected = + cUnit + |> compileExisting + |> shouldSucceed + |> fun r -> ILChecker.generateIL r.Output.OutputPath.Value [] + + let actual = + cUnit + |> compileExisting + |> shouldSucceed + |> fun r -> ILChecker.generateIL r.Output.OutputPath.Value [] + + let outcome, _msg, _actualIL = + ILChecker.compareIL + fileName + actual + [ expected ] + + Assert.True(outcome) + 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..1f0e9b2464f 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 @@ -845,6 +845,7 @@ FSharp.Compiler.AbstractIL.IL+ILMethodDefs: Microsoft.FSharp.Collections.FSharpL FSharp.Compiler.AbstractIL.IL+ILMethodDefs: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILMethodDef] FindByName(System.String) FSharp.Compiler.AbstractIL.IL+ILMethodDefs: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodDef] TryFindInstanceByNameAndCallingSignature(System.String, ILCallingSignature) FSharp.Compiler.AbstractIL.IL+ILMethodDefs: System.Collections.Generic.IDictionary`2[System.String,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILMethodDef]] CreateDictionary(ILMethodDef[]) +FSharp.Compiler.AbstractIL.IL+ILMethodDefs: Void .ctor(Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,FSharp.Compiler.AbstractIL.IL+ILMethodDef[]]) FSharp.Compiler.AbstractIL.IL+ILMethodImplDef: Boolean Equals(ILMethodImplDef) FSharp.Compiler.AbstractIL.IL+ILMethodImplDef: Boolean Equals(ILMethodImplDef, System.Collections.IEqualityComparer) FSharp.Compiler.AbstractIL.IL+ILMethodImplDef: Boolean Equals(System.Object) @@ -1568,6 +1569,8 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILSecurityDecls get_SecurityDecls() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDef With(Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Reflection.TypeAttributes], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefLayout], Microsoft.FSharp.Core.FSharpOption`1[Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]]], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef]], Microsoft.FSharp.Core.FSharpOption`1[Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]]], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILFieldDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodImplDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILEventDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILPropertyDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILAttributesStored], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILSecurityDecls]) FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefAccess Access FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefAccess get_Access() +FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefAdditionalFlags Flags +FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefAdditionalFlags get_Flags() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefLayout Layout FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefLayout get_Layout() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefs NestedTypes @@ -2830,12 +2833,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 +2862,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() 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 fabaa710607..1f0e9b2464f 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 @@ -845,6 +845,7 @@ FSharp.Compiler.AbstractIL.IL+ILMethodDefs: Microsoft.FSharp.Collections.FSharpL FSharp.Compiler.AbstractIL.IL+ILMethodDefs: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILMethodDef] FindByName(System.String) FSharp.Compiler.AbstractIL.IL+ILMethodDefs: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodDef] TryFindInstanceByNameAndCallingSignature(System.String, ILCallingSignature) FSharp.Compiler.AbstractIL.IL+ILMethodDefs: System.Collections.Generic.IDictionary`2[System.String,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILMethodDef]] CreateDictionary(ILMethodDef[]) +FSharp.Compiler.AbstractIL.IL+ILMethodDefs: Void .ctor(Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,FSharp.Compiler.AbstractIL.IL+ILMethodDef[]]) FSharp.Compiler.AbstractIL.IL+ILMethodImplDef: Boolean Equals(ILMethodImplDef) FSharp.Compiler.AbstractIL.IL+ILMethodImplDef: Boolean Equals(ILMethodImplDef, System.Collections.IEqualityComparer) FSharp.Compiler.AbstractIL.IL+ILMethodImplDef: Boolean Equals(System.Object) @@ -1568,6 +1569,8 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILSecurityDecls get_SecurityDecls() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDef With(Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Reflection.TypeAttributes], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefLayout], Microsoft.FSharp.Core.FSharpOption`1[Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]]], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef]], Microsoft.FSharp.Core.FSharpOption`1[Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]]], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILFieldDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodImplDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILEventDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILPropertyDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILAttributesStored], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILSecurityDecls]) FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefAccess Access FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefAccess get_Access() +FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefAdditionalFlags Flags +FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefAdditionalFlags get_Flags() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefLayout Layout FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefLayout get_Layout() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefs NestedTypes @@ -2830,12 +2833,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,22 +2862,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: FSharp.Compiler.Diagnostics.ExtendedData+ObsoleteDiagnosticExtendedData -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() diff --git a/tests/FSharp.Test.Utilities/ILChecker.fs b/tests/FSharp.Test.Utilities/ILChecker.fs index b47ae4409f0..1fc96ee3c93 100644 --- a/tests/FSharp.Test.Utilities/ILChecker.fs +++ b/tests/FSharp.Test.Utilities/ILChecker.fs @@ -113,14 +113,14 @@ module ILChecker = ilFilePath - let private generateIL (dllFilePath: string) ildasmArgs = + let generateIL (dllFilePath: string) ildasmArgs = let assemblyName = Some (Path.GetFileNameWithoutExtension dllFilePath) let ilFilePath = generateIlFile dllFilePath ildasmArgs let normalizedText = normalizeILText assemblyName (File.ReadAllText(ilFilePath)) File.WriteAllText(ilFilePath, normalizedText) normalizedText - let private compareIL assemblyName (actualIL: string) expectedIL = + let compareIL assemblyName (actualIL: string) expectedIL = let mutable errorMsgOpt = None 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 bbe1b7623e4..d7b46be994e 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl @@ -53,10 +53,10 @@ [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.ReuseTcResults+clo@59-464::Invoke(string)][offset 0x00000027][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ReuseTcResults+clo@64-464::Invoke(string)][offset 0x00000027][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.CompilerImports+line@560-1::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+line@608-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 0x00000639][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x00000642][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. @@ -80,7 +80,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.NativeRes+VersionHelper::TryParse(string, bool, uint16, bool, [S.P.CoreLib]System.Version&)][offset 0x0000003D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL+parseNamed@5291::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>, int32, int32)][offset 0x00000087][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL+parseNamed@5293::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]: : 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. 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 566e8145be0..e468b35f64d 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl @@ -28,8 +28,8 @@ [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-536::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-536::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-536::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@309-1::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@309-1::Invoke(string)][offset 0x00000014][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@325-1::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@325-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. 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 b1c763266d0..ca8d75be5d1 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl @@ -40,8 +40,8 @@ [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@921-536::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-536::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@309-1::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@309-1::Invoke(string)][offset 0x00000014][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@325-1::Invoke(string)][offset 0x0000000B][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.Driver+ProcessCommandLineFlags@325-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,11 +55,11 @@ [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.ReuseTcResults+clo@59-481::Invoke(string)][offset 0x0000001F][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.ReuseTcResults+clo@64-481::Invoke(string)][offset 0x0000001F][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.CompilerImports+TcConfig-TryResolveLibWithDirectories@558-1::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000021][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+TcConfig-TryResolveLibWithDirectories@558-1::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000003B][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+TcConfig-TryResolveLibWithDirectories@606-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@606-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 0x000005A8][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x000005B1][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. @@ -107,7 +107,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.NativeRes+VersionHelper::TryParse(string, bool, uint16, bool, [S.P.CoreLib]System.Version&)][offset 0x00000026][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseNamed@5290(uint8[], [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>, int32, int32)][offset 0x0000007E][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseNamed@5292(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]: : 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.