From 3750b44e4ee473d65f5f15f25aced4b0f09ca480 Mon Sep 17 00:00:00 2001 From: Alex Berezhnykh Date: Fri, 13 Dec 2024 16:52:36 +0300 Subject: [PATCH 1/2] Make ILTypeDef super type calculation lazy (#18005) --- .../.FSharp.Compiler.Service/9.0.200.md | 1 + src/Compiler/AbstractIL/il.fs | 138 +++++++++++------- src/Compiler/AbstractIL/il.fsi | 56 ++++--- src/Compiler/AbstractIL/ilmorph.fs | 6 +- src/Compiler/AbstractIL/ilprint.fs | 2 +- src/Compiler/AbstractIL/ilread.fs | 37 ++++- src/Compiler/AbstractIL/ilreflect.fs | 4 +- src/Compiler/AbstractIL/ilwrite.fs | 2 +- src/Compiler/Checking/TypeHierarchy.fs | 2 +- src/Compiler/CodeGen/EraseClosures.fs | 14 +- src/Compiler/CodeGen/EraseUnions.fs | 11 +- src/Compiler/CodeGen/IlxGen.fs | 43 +++--- ...ervice.SurfaceArea.netstandard20.debug.bsl | 57 ++------ ...vice.SurfaceArea.netstandard20.release.bsl | 57 ++------ .../ModuleReaderCancellationTests.fs | 4 +- .../FSharp.Compiler.Service.Tests/Symbols.fs | 30 ++++ ...y_FSharp.Compiler.Service_Debug_net9.0.bsl | 2 +- ....Compiler.Service_Debug_netstandard2.0.bsl | 4 +- ...FSharp.Compiler.Service_Release_net9.0.bsl | 14 +- ...ompiler.Service_Release_netstandard2.0.bsl | 16 +- 20 files changed, 277 insertions(+), 223 deletions(-) diff --git a/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md b/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md index 33125ff07ed..a67c88e5284 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md @@ -44,5 +44,6 @@ * Better ranges for #nowarn error reporting; bring back #nowarn warnings for --langVersion:80; add warnings under feature flag ([PR #17871](https://github.com/dotnet/fsharp/pull/17871)) * Better ranges for #nowarn error reporting; bring back #nowarn warnings for --langVersion:80; add warnings under feature flag ([PR #17871](https://github.com/dotnet/fsharp/pull/17871)) * CheckAndThrow can be invoked only from within Cancellable context ([PR #18037](https://github.com/dotnet/fsharp/pull/18037)) +* Make ILTypeDef base type calculation lazy. ([PR #18005](https://github.com/dotnet/fsharp/pull/18005)) ### Breaking Changes diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index 37fda4f2873..33a46ff0a23 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -2562,34 +2562,48 @@ let typeEncodingOfFlags flags = elif f = 0x00010000 then ILDefaultPInvokeEncoding.Unicode else ILDefaultPInvokeEncoding.Ansi -[] -type ILTypeDefKind = - | Class - | ValueType - | Interface - | Enum - | Delegate +[] +type ILTypeDefAdditionalFlags = + | Class = 1 + | ValueType = 2 + | Interface = 4 + | Enum = 8 + | Delegate = 16 + | IsKnownToBeAttribute = 32 + /// The type can contain extension methods, + /// or this information may not be available at the time the ILTypeDef is created + | CanContainExtensionMethods = 1024 + +let internal typeKindFlags = + ILTypeDefAdditionalFlags.Class ||| + ILTypeDefAdditionalFlags.ValueType ||| + ILTypeDefAdditionalFlags.Interface ||| + ILTypeDefAdditionalFlags.Enum ||| + ILTypeDefAdditionalFlags.Delegate + +let inline internal resetTypeKind flags = + flags &&& ~~~typeKindFlags + +let (|HasFlag|_|) (flag: ILTypeDefAdditionalFlags) flags = + flags &&& flag = flag + +let inline typeKindByNames extendsName typeName = + match extendsName with + | "System.Enum" -> ILTypeDefAdditionalFlags.Enum + | "System.Delegate" when typeName <> "System.MulticastDelegate" -> ILTypeDefAdditionalFlags.Delegate + | "System.MulticastDelegate" -> ILTypeDefAdditionalFlags.Delegate + | "System.ValueType" when typeName <> "System.Enum" -> ILTypeDefAdditionalFlags.ValueType + | _ -> ILTypeDefAdditionalFlags.Class let typeKindOfFlags nm (super: ILType option) flags = if (flags &&& 0x00000020) <> 0x0 then - ILTypeDefKind.Interface + ILTypeDefAdditionalFlags.Interface else match super with - | None -> ILTypeDefKind.Class + | None -> ILTypeDefAdditionalFlags.Class | Some ty -> let name = ty.TypeSpec.Name - - if name = "System.Enum" then - ILTypeDefKind.Enum - elif - (name = "System.Delegate" && nm <> "System.MulticastDelegate") - || name = "System.MulticastDelegate" - then - ILTypeDefKind.Delegate - elif name = "System.ValueType" && nm <> "System.Enum" then - ILTypeDefKind.ValueType - else - ILTypeDefKind.Class + typeKindByNames name nm let convertTypeAccessFlags access = match access with @@ -2605,11 +2619,8 @@ let convertTypeAccessFlags access = let convertTypeKind kind = match kind with - | ILTypeDefKind.Class -> TypeAttributes.Class - | ILTypeDefKind.ValueType -> TypeAttributes.Class - | ILTypeDefKind.Interface -> TypeAttributes.Abstract ||| TypeAttributes.Interface - | ILTypeDefKind.Enum -> TypeAttributes.Class - | ILTypeDefKind.Delegate -> TypeAttributes.Class + | HasFlag ILTypeDefAdditionalFlags.Interface -> TypeAttributes.Abstract ||| TypeAttributes.Interface + | _ -> TypeAttributes.Class let convertLayout layout = match layout with @@ -2638,13 +2649,7 @@ let convertInitSemantics (init: ILTypeInit) = | ILTypeInit.BeforeField -> TypeAttributes.BeforeFieldInit | ILTypeInit.OnAny -> enum 0 -[] -type ILTypeDefAdditionalFlags = - | None = 0 - | IsKnownToBeAttribute = 1 - /// The type can contain extension methods, - /// or this information may not be available at the time the ILTypeDef is created - | CanContainExtensionMethods = 2 +let emptyILExtends = notlazy None [] type ILTypeDef @@ -2654,7 +2659,7 @@ type ILTypeDef layout: ILTypeDefLayout, implements: InterruptibleLazy, genericParams: ILGenericParameterDefs, - extends: ILType option, + extends: InterruptibleLazy, methods: ILMethodDefs, nestedTypes: ILTypeDefs, fields: ILFieldDefs, @@ -2705,6 +2710,42 @@ type ILTypeDef NoMetadataIdx ) + new(name, + attributes, + layout, + implements, + genericParams, + extends, + methods, + nestedTypes, + fields, + methodImpls, + events, + properties, + securityDecls, + customAttrs) = + let additionalFlags = + ILTypeDefAdditionalFlags.CanContainExtensionMethods ||| + typeKindOfFlags name extends (int attributes) + ILTypeDef( + name, + attributes, + layout, + InterruptibleLazy.FromValue(implements), + genericParams, + InterruptibleLazy.FromValue(extends), + methods, + nestedTypes, + fields, + methodImpls, + events, + properties, + additionalFlags, + storeILSecurityDecls securityDecls, + customAttrs, + NoMetadataIdx + ) + member _.Name = name member _.Attributes = attributes @@ -2786,20 +2827,15 @@ type ILTypeDef member x.SecurityDecls = x.SecurityDeclsStored.GetSecurityDecls x.MetadataIndex - member x.IsClass = - (typeKindOfFlags x.Name x.Extends (int x.Attributes)) = ILTypeDefKind.Class + member x.IsClass = hasFlag ILTypeDefAdditionalFlags.Class - member x.IsStruct = - (typeKindOfFlags x.Name x.Extends (int x.Attributes)) = ILTypeDefKind.ValueType + member x.IsStruct = hasFlag ILTypeDefAdditionalFlags.ValueType - member x.IsInterface = - (typeKindOfFlags x.Name x.Extends (int x.Attributes)) = ILTypeDefKind.Interface + member x.IsInterface = hasFlag ILTypeDefAdditionalFlags.Interface - member x.IsEnum = - (typeKindOfFlags x.Name x.Extends (int x.Attributes)) = ILTypeDefKind.Enum + member x.IsEnum = hasFlag ILTypeDefAdditionalFlags.Enum - member x.IsDelegate = - (typeKindOfFlags x.Name x.Extends (int x.Attributes)) = ILTypeDefKind.Delegate + member x.IsDelegate = hasFlag ILTypeDefAdditionalFlags.Delegate member x.Access = typeAccessOfFlags (int x.Attributes) member x.IsAbstract = x.Attributes &&& TypeAttributes.Abstract <> enum 0 @@ -2850,9 +2886,10 @@ type ILTypeDef member x.WithKind(kind) = x.With( attributes = (x.Attributes ||| convertTypeKind kind), + newAdditionalFlags = (resetTypeKind additionalFlags ||| kind), extends = match kind with - | ILTypeDefKind.Interface -> None + | HasFlag ILTypeDefAdditionalFlags.Interface -> emptyILExtends | _ -> x.Extends ) @@ -2865,6 +2902,9 @@ type ILTypeDef member x.WithInitSemantics(init) = x.With(attributes = (x.Attributes ||| convertInitSemantics init)) + member x.WithIsKnownToBeAttribute() = + x.With(newAdditionalFlags = (additionalFlags ||| ILTypeDefAdditionalFlags.IsKnownToBeAttribute)) + [] member x.DebugText = x.ToString() @@ -4259,7 +4299,7 @@ let mkILGenericClass (nm, access, genparams, extends, impls, methods, fields, ne name = nm, attributes = attributes, genericParams = genparams, - implements = InterruptibleLazy.FromValue(impls), + implements = impls, layout = ILTypeDefLayout.Auto, extends = Some extends, methods = methods, @@ -4269,7 +4309,6 @@ let mkILGenericClass (nm, access, genparams, extends, impls, methods, fields, ne methodImpls = emptyILMethodImpls, properties = props, events = events, - additionalFlags = ILTypeDefAdditionalFlags.None, securityDecls = emptyILSecurityDecls ) @@ -4283,7 +4322,7 @@ let mkRawDataValueTypeDef (iltyp_ValueType: ILType) (nm, size, pack) = ||| TypeAttributes.ExplicitLayout ||| TypeAttributes.BeforeFieldInit ||| TypeAttributes.AnsiClass), - implements = emptyILInterfaceImpls, + implements = [], extends = Some iltyp_ValueType, layout = ILTypeDefLayout.Explicit { Size = Some size; Pack = Some pack }, methods = emptyILMethods, @@ -4293,7 +4332,6 @@ let mkRawDataValueTypeDef (iltyp_ValueType: ILType) (nm, size, pack) = methodImpls = emptyILMethodImpls, properties = emptyILProperties, events = emptyILEvents, - additionalFlags = ILTypeDefAdditionalFlags.None, securityDecls = emptyILSecurityDecls ) @@ -5590,7 +5628,7 @@ and refsOfILTypeDef s (td: ILTypeDef) = refsOfILTypeDefs s td.NestedTypes refsOfILGenericParams s td.GenericParams refsOfILTypes s (td.Implements.Value |> List.map _.Type) - Option.iter (refsOfILType s) td.Extends + Option.iter (refsOfILType s) td.Extends.Value refsOfILMethodDefs s td.Methods refsOfILFieldDefs s (td.Fields.AsList()) refsOfILMethodImpls s (td.MethodImpls.AsList()) diff --git a/src/Compiler/AbstractIL/il.fsi b/src/Compiler/AbstractIL/il.fsi index 7e768f4671f..f80c64b0c59 100644 --- a/src/Compiler/AbstractIL/il.fsi +++ b/src/Compiler/AbstractIL/il.fsi @@ -1483,15 +1483,6 @@ type ILTypeDefAccess = | Private | Nested of ILMemberAccess -/// A categorization of type definitions into "kinds" -[] -type ILTypeDefKind = - | Class - | ValueType - | Interface - | Enum - | Delegate - /// Tables of named type definitions. [] type ILTypeDefs = @@ -1514,9 +1505,17 @@ type ILTypeDefs = [] type ILTypeDefAdditionalFlags = - | None = 0 - | IsKnownToBeAttribute = 1 - | CanContainExtensionMethods = 2 + | Class = 1 + | ValueType = 2 + | Interface = 4 + | Enum = 8 + | Delegate = 16 + | IsKnownToBeAttribute = 32 + | CanContainExtensionMethods = 1024 + +val (|HasFlag|_|): flag: ILTypeDefAdditionalFlags -> flags: ILTypeDefAdditionalFlags -> bool + +val inline internal typeKindByNames: extendsName: string -> typeName: string -> ILTypeDefAdditionalFlags /// Represents IL Type Definitions. [] @@ -1529,7 +1528,7 @@ type ILTypeDef = layout: ILTypeDefLayout * implements: InterruptibleLazy * genericParams: ILGenericParameterDefs * - extends: ILType option * + extends: InterruptibleLazy * methods: ILMethodDefs * nestedTypes: ILTypeDefs * fields: ILFieldDefs * @@ -1542,14 +1541,14 @@ type ILTypeDef = metadataIndex: int32 -> ILTypeDef - /// Functional creation of a value, immediate + /// Functional creation of a value with lazy calculated data new: name: string * attributes: TypeAttributes * layout: ILTypeDefLayout * implements: InterruptibleLazy * genericParams: ILGenericParameterDefs * - extends: ILType option * + extends: InterruptibleLazy * methods: ILMethodDefs * nestedTypes: ILTypeDefs * fields: ILFieldDefs * @@ -1561,13 +1560,31 @@ type ILTypeDef = customAttrs: ILAttributesStored -> ILTypeDef + /// Functional creation of a value, immediate + new: + name: string * + attributes: TypeAttributes * + layout: ILTypeDefLayout * + implements: InterfaceImpl list * + genericParams: ILGenericParameterDefs * + extends: ILType option * + methods: ILMethodDefs * + nestedTypes: ILTypeDefs * + fields: ILFieldDefs * + methodImpls: ILMethodImplDefs * + events: ILEventDefs * + properties: ILPropertyDefs * + securityDecls: ILSecurityDecls * + customAttrs: ILAttributesStored -> + ILTypeDef + member Name: string member Attributes: TypeAttributes member GenericParams: ILGenericParameterDefs member Layout: ILTypeDefLayout member NestedTypes: ILTypeDefs member Implements: InterruptibleLazy - member Extends: ILType option + member Extends: InterruptibleLazy member Methods: ILMethodDefs member SecurityDecls: ILSecurityDecls member Fields: ILFieldDefs @@ -1605,10 +1622,11 @@ type ILTypeDef = member internal WithImport: bool -> ILTypeDef member internal WithHasSecurity: bool -> ILTypeDef member internal WithLayout: ILTypeDefLayout -> ILTypeDef - member internal WithKind: ILTypeDefKind -> ILTypeDef + member internal WithKind: ILTypeDefAdditionalFlags -> ILTypeDef member internal WithEncoding: ILDefaultPInvokeEncoding -> ILTypeDef member internal WithSpecialName: bool -> ILTypeDef member internal WithInitSemantics: ILTypeInit -> ILTypeDef + member internal WithIsKnownToBeAttribute: unit -> ILTypeDef /// Functional update member With: @@ -1617,7 +1635,7 @@ type ILTypeDef = ?layout: ILTypeDefLayout * ?implements: InterruptibleLazy * ?genericParams: ILGenericParameterDefs * - ?extends: ILType option * + ?extends: InterruptibleLazy * ?methods: ILMethodDefs * ?nestedTypes: ILTypeDefs * ?fields: ILFieldDefs * @@ -2257,6 +2275,8 @@ val internal mkILTypeForGlobalFunctions: ILScopeRef -> ILType val emptyILInterfaceImpls: InterruptibleLazy +val emptyILExtends: InterruptibleLazy + /// Making tables of custom attributes, etc. val mkILCustomAttrs: ILAttribute list -> ILAttributes val mkILCustomAttrsFromArray: ILAttribute[] -> ILAttributes diff --git a/src/Compiler/AbstractIL/ilmorph.fs b/src/Compiler/AbstractIL/ilmorph.fs index 9f2f3d0582f..37d2810dd39 100644 --- a/src/Compiler/AbstractIL/ilmorph.fs +++ b/src/Compiler/AbstractIL/ilmorph.fs @@ -371,12 +371,14 @@ let rec tdef_ty2ty_ilmbody2ilmbody_mdefs2mdefs isInKnownSet enc fs (tdef: ILType let implements = tdef.Implements.Value |> List.map (fun x -> { x with Type = fTyInCtxtR x.Type }) - |> InterruptibleLazy.FromValue + |> notlazy + + let extends = tdef.Extends.Value |> Option.map fTyInCtxtR |> notlazy tdef.With( implements = implements, genericParams = gparams_ty2ty fTyInCtxtR tdef.GenericParams, - extends = Option.map fTyInCtxtR tdef.Extends, + extends = extends, methods = mdefsR, nestedTypes = tdefs_ty2ty_ilmbody2ilmbody_mdefs2mdefs isInKnownSet (enc @ [ tdef ]) fs tdef.NestedTypes, fields = fdefsR, diff --git a/src/Compiler/AbstractIL/ilprint.fs b/src/Compiler/AbstractIL/ilprint.fs index 6ed8aec9286..4ce956971c0 100644 --- a/src/Compiler/AbstractIL/ilprint.fs +++ b/src/Compiler/AbstractIL/ilprint.fs @@ -835,7 +835,7 @@ let rec goutput_tdef enc env contents os (cd: ILTypeDef) = output_sqstring os cd.Name goutput_gparams env os cd.GenericParams output_string os "\n\t" - goutput_superclass env os cd.Extends + goutput_superclass env os cd.Extends.Value output_string os "\n\t" goutput_implements env os cd.Implements.Value output_string os "\n{\n " diff --git a/src/Compiler/AbstractIL/ilread.fs b/src/Compiler/AbstractIL/ilread.fs index 5bedfe05752..14af625419b 100644 --- a/src/Compiler/AbstractIL/ilread.fs +++ b/src/Compiler/AbstractIL/ilread.fs @@ -2107,7 +2107,32 @@ and typeDefReader ctxtH : ILTypeDefStored = let struct (endFieldsIdx, endMethodsIdx) = seekReadTypeDefRowExtents ctxt info idx let typars = seekReadGenericParams ctxt 0 (tomd_TypeDef, idx) let numTypars = typars.Length - let super = seekReadOptionalTypeDefOrRef ctxt numTypars AsObject extendsIdx + + let kind = + let extendsTag = extendsIdx.tag + let extendsIdx = extendsIdx.index + + if flags &&& 0x00000020 <> 0x0 then + ILTypeDefAdditionalFlags.Interface + else if extendsIdx = 0 && extendsTag = tdor_TypeDef then + ILTypeDefAdditionalFlags.Class + else + let extendsName = + if extendsTag = tdor_TypeDef then + let mutable addr = ctxt.rowAddr TableNames.TypeDef extendsIdx + let _ = seekReadInt32Adv mdv &addr + let nameIdx = seekReadStringIdx ctxt mdv &addr + let namespaceIdx = seekReadStringIdx ctxt mdv &addr + readBlobHeapAsTypeName ctxt (nameIdx, namespaceIdx) + elif extendsTag = tdor_TypeRef then + let _, nameIdx, namespaceIdx = seekReadTypeRefRow ctxt mdv extendsIdx + readBlobHeapAsTypeName ctxt (nameIdx, namespaceIdx) + else + "" + + typeKindByNames extendsName nm + + let super = seekReadSuperType ctxt numTypars AsObject extendsIdx let layout = typeLayoutOfFlags ctxt mdv flags idx let hasLayout = @@ -2176,9 +2201,9 @@ and typeDefReader ctxtH : ILTypeDefStored = let additionalFlags = if containsExtensionMethods then - ILTypeDefAdditionalFlags.CanContainExtensionMethods + ILTypeDefAdditionalFlags.CanContainExtensionMethods ||| kind else - ILTypeDefAdditionalFlags.None + kind let mdefs = seekReadMethods ctxt numTypars methodsIdx endMethodsIdx let fdefs = seekReadFields ctxt (numTypars, hasLayout) fieldsIdx endFieldsIdx @@ -2456,6 +2481,12 @@ and seekReadOptionalTypeDefOrRef (ctxt: ILMetadataReader) numTypars boxity idx = else Some(seekReadTypeDefOrRef ctxt numTypars boxity List.empty idx) +and seekReadSuperType (ctxt: ILMetadataReader) numTypars boxity idx = + if idx = TaggedIndex(tdor_TypeDef, 0) then + emptyILExtends + else + InterruptibleLazy(fun () -> seekReadOptionalTypeDefOrRef ctxt numTypars boxity idx) + and seekReadField ctxt mdv (numTypars, hasLayout) (idx: int) = let flags, nameIdx, typeIdx = seekReadFieldRow ctxt mdv idx let nm = readStringHeap ctxt nameIdx diff --git a/src/Compiler/AbstractIL/ilreflect.fs b/src/Compiler/AbstractIL/ilreflect.fs index c6c5e5ab992..d88cc24d689 100644 --- a/src/Compiler/AbstractIL/ilreflect.fs +++ b/src/Compiler/AbstractIL/ilreflect.fs @@ -2160,7 +2160,7 @@ let rec buildTypeDefPass1b cenv nesting emEnv (tdef: ILTypeDef) = let genArgs = getGenericArgumentsOfType typB let emEnv = envPushTyvars emEnv genArgs // Parent may reference types being defined, so has to come after it's Pass1 creation - tdef.Extends + tdef.Extends.Value |> Option.iter (fun ty -> typB.SetParentAndLog(convType cenv emEnv ty)) // build constraints on ILGenericParameterDefs. Constraints may reference types being defined, // so have to come after all types are created @@ -2334,7 +2334,7 @@ let createTypeRef (visited: Dictionary<_, _>, created: Dictionary<_, _>) emEnv t if verbose2 then dprintf "buildTypeDefPass4: Creating Super Class Chain of %s\n" tdef.Name - tdef.Extends |> Option.iter (traverseType CollectTypes.All) + tdef.Extends.Value |> Option.iter (traverseType CollectTypes.All) // We absolutely need the exact interface types... if verbose2 then diff --git a/src/Compiler/AbstractIL/ilwrite.fs b/src/Compiler/AbstractIL/ilwrite.fs index e5183809e1a..2cb9bb01a1b 100644 --- a/src/Compiler/AbstractIL/ilwrite.fs +++ b/src/Compiler/AbstractIL/ilwrite.fs @@ -1223,7 +1223,7 @@ let rec GetTypeDefAsRow cenv env _enc (tdef: ILTypeDef) = else int tdef.Attributes - let tdorTag, tdorRow = GetTypeOptionAsTypeDefOrRef cenv env tdef.Extends + let tdorTag, tdorRow = GetTypeOptionAsTypeDefOrRef cenv env tdef.Extends.Value UnsharedRow [| ULong flags nelem diff --git a/src/Compiler/Checking/TypeHierarchy.fs b/src/Compiler/Checking/TypeHierarchy.fs index 9bf7c2ec892..587e8527fdd 100644 --- a/src/Compiler/Checking/TypeHierarchy.fs +++ b/src/Compiler/Checking/TypeHierarchy.fs @@ -54,7 +54,7 @@ let GetSuperTypeOfType g amap m ty = #endif | ILTypeMetadata (TILObjectReprData(scoref, _, tdef)) -> let tinst = argsOfAppTy g ty - match tdef.Extends with + match tdef.Extends.Value with | None -> None | Some ilTy -> // 'inherit' can refer to a type which has nullable type arguments (e.g. List) let typeAttrs = AttributesFromIL(tdef.MetadataIndex,tdef.CustomAttrsStored) diff --git a/src/Compiler/CodeGen/EraseClosures.fs b/src/Compiler/CodeGen/EraseClosures.fs index b2f6f394256..e1c533f17b2 100644 --- a/src/Compiler/CodeGen/EraseClosures.fs +++ b/src/Compiler/CodeGen/EraseClosures.fs @@ -572,7 +572,7 @@ let rec convIlxClosureDef cenv encl (td: ILTypeDef) clo = name = td.Name, genericParams = td.GenericParams, attributes = td.Attributes, - implements = emptyILInterfaceImpls, + implements = [], nestedTypes = emptyILTypeDefs, layout = ILTypeDefLayout.Auto, extends = Some cenv.mkILTyFuncTy, @@ -582,7 +582,6 @@ let rec convIlxClosureDef cenv encl (td: ILTypeDef) clo = methodImpls = emptyILMethodImpls, properties = emptyILProperties, events = emptyILEvents, - additionalFlags = ILTypeDefAdditionalFlags.None, securityDecls = emptyILSecurityDecls ) .WithSpecialName(false) @@ -706,7 +705,7 @@ let rec convIlxClosureDef cenv encl (td: ILTypeDef) clo = name = td.Name, genericParams = td.GenericParams, attributes = td.Attributes, - implements = emptyILInterfaceImpls, + implements = [], layout = ILTypeDefLayout.Auto, nestedTypes = emptyILTypeDefs, extends = Some nowEnvParentClass, @@ -716,7 +715,6 @@ let rec convIlxClosureDef cenv encl (td: ILTypeDef) clo = methodImpls = emptyILMethodImpls, properties = emptyILProperties, events = emptyILEvents, - additionalFlags = ILTypeDefAdditionalFlags.None, securityDecls = emptyILSecurityDecls ) .WithHasSecurity(false) @@ -733,7 +731,7 @@ let rec convIlxClosureDef cenv encl (td: ILTypeDef) clo = // No code is being declared: just bake a (mutable) environment let cloCodeR = - match td.Extends with + match td.Extends.Value with | None -> (mkILNonGenericEmptyCtor (cenv.ilg.typ_Object, None, cloImports)).MethodBody | Some _ -> convILMethodBody (Some nowCloSpec, None) clo.cloCode.Value @@ -768,9 +766,9 @@ let rec convIlxClosureDef cenv encl (td: ILTypeDef) clo = td.With( implements = td.Implements, extends = - (match td.Extends with - | None -> Some cenv.ilg.typ_Object - | Some x -> Some(x)), + (match td.Extends.Value with + | None -> Some cenv.ilg.typ_Object |> notlazy + | _ -> td.Extends), name = td.Name, genericParams = td.GenericParams, methods = mkILMethods (ctorMethodDef :: nowMethods), diff --git a/src/Compiler/CodeGen/EraseUnions.fs b/src/Compiler/CodeGen/EraseUnions.fs index c62f42e9b37..e841010c837 100644 --- a/src/Compiler/CodeGen/EraseUnions.fs +++ b/src/Compiler/CodeGen/EraseUnions.fs @@ -1338,7 +1338,7 @@ let mkClassUnionDef if isStruct then None else - match td.Extends with + match td.Extends.Value with | None -> Some g.ilg.typ_Object.TypeSpec | Some ilTy -> Some ilTy.TypeSpec @@ -1471,7 +1471,7 @@ let mkClassUnionDef else let baseTySpec = - (match td.Extends with + (match td.Extends.Value with | None -> g.ilg.typ_Object | Some ilTy -> ilTy) .TypeSpec @@ -1593,7 +1593,7 @@ let mkClassUnionDef genericParams = td.GenericParams, attributes = enum 0, layout = ILTypeDefLayout.Auto, - implements = emptyILInterfaceImpls, + implements = [], extends = Some g.ilg.typ_Object, methods = emptyILMethods, securityDecls = emptyILSecurityDecls, @@ -1601,7 +1601,6 @@ let mkClassUnionDef methodImpls = emptyILMethodImpls, events = emptyILEvents, properties = emptyILProperties, - additionalFlags = ILTypeDefAdditionalFlags.None, customAttrs = emptyILCustomAttrsStored ) .WithNestedAccess(cud.UnionCasesAccessibility) @@ -1625,8 +1624,8 @@ let mkClassUnionDef @ td.NestedTypes.AsList() ), extends = - (match td.Extends with - | None -> Some g.ilg.typ_Object + (match td.Extends.Value with + | None -> Some g.ilg.typ_Object |> notlazy | _ -> td.Extends), methods = mkILMethods ( diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index d3495598c89..60a6f012976 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -6270,9 +6270,8 @@ and GenStructStateMachine cenv cgbuf eenvouter (res: LoweredStateMachine) sequel methods = mkILMethods mdefs, methodImpls = mkILMethodImpls mimpls, nestedTypes = emptyILTypeDefs, - implements = InterruptibleLazy.FromValue(ilInterfaceTys), + implements = ilInterfaceTys, extends = Some super, - additionalFlags = ILTypeDefAdditionalFlags.None, securityDecls = emptyILSecurityDecls ) .WithSealed(true) @@ -6708,9 +6707,8 @@ and GenClosureTypeDefs methods = mkILMethods mdefs, methodImpls = mkILMethodImpls mimpls, nestedTypes = emptyILTypeDefs, - implements = InterruptibleLazy.FromValue(ilIntfTys), + implements = ilIntfTys, extends = Some ext, - additionalFlags = ILTypeDefAdditionalFlags.None, securityDecls = emptyILSecurityDecls ) .WithSealed(true) @@ -11039,21 +11037,21 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option | TFSharpUnion | TFSharpRecord -> if tycon.IsStructOrEnumTycon then - ILTypeDefKind.ValueType + ILTypeDefAdditionalFlags.ValueType else - ILTypeDefKind.Class - | TFSharpClass -> ILTypeDefKind.Class + ILTypeDefAdditionalFlags.Class + | TFSharpClass -> ILTypeDefAdditionalFlags.Class - | TFSharpStruct -> ILTypeDefKind.ValueType - | TFSharpInterface -> ILTypeDefKind.Interface - | TFSharpEnum -> ILTypeDefKind.Enum - | TFSharpDelegate _ -> ILTypeDefKind.Delegate - | _ -> ILTypeDefKind.Class + | TFSharpStruct -> ILTypeDefAdditionalFlags.ValueType + | TFSharpInterface -> ILTypeDefAdditionalFlags.Interface + | TFSharpEnum -> ILTypeDefAdditionalFlags.Enum + | TFSharpDelegate _ -> ILTypeDefAdditionalFlags.Delegate + | _ -> ILTypeDefAdditionalFlags.Class let requiresExtraField = let isEmptyStruct = (match ilTypeDefKind with - | ILTypeDefKind.ValueType -> true + | HasFlag ILTypeDefAdditionalFlags.ValueType -> true | _ -> false) && // All structs are sequential by default @@ -11514,12 +11512,6 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option let isKnownToBeAttribute = ExistsSameHeadTypeInHierarchy g cenv.amap m super g.mk_Attribute_ty - let additionalFlags = - if isKnownToBeAttribute then - ILTypeDefAdditionalFlags.IsKnownToBeAttribute - else - ILTypeDefAdditionalFlags.None - let tdef = mkILGenericClass ( ilTypeName, @@ -11545,7 +11537,13 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option .WithSerializable(isSerializable) .WithAbstract(isAbstract) .WithImport(isComInteropTy g thisTy) - .With(methodImpls = mkILMethodImpls methodImpls, newAdditionalFlags = additionalFlags) + .With(methodImpls = mkILMethodImpls methodImpls) + + let tdef = + if isKnownToBeAttribute then + tdef.WithIsKnownToBeAttribute() + else + tdef let tdLayout, tdEncoding = match TryFindFSharpAttribute g g.attrib_StructLayoutAttribute tycon.Attribs with @@ -11584,7 +11582,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option | _ when (match ilTypeDefKind with - | ILTypeDefKind.ValueType -> true + | HasFlag ILTypeDefAdditionalFlags.ValueType -> true | _ -> false) -> @@ -11707,7 +11705,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option methods = mkILMethods ilMethods, methodImpls = mkILMethodImpls methodImpls, nestedTypes = emptyILTypeDefs, - implements = InterruptibleLazy.FromValue(ilIntfTys), + implements = ilIntfTys, extends = Some( if tycon.IsStructOrEnumTycon then @@ -11715,7 +11713,6 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option else g.ilg.typ_Object ), - additionalFlags = ILTypeDefAdditionalFlags.None, securityDecls = emptyILSecurityDecls ) .WithLayout(layout) 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 b66bebd1cbc..c3b65b8e378 100644 --- 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 @@ -1565,7 +1565,7 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILPropertyDefs Properties FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILPropertyDefs get_Properties() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILSecurityDecls SecurityDecls 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[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: 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: ILTypeDefLayout Layout @@ -1576,16 +1576,17 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDef: Int32 MetadataIndex FSharp.Compiler.AbstractIL.IL+ILTypeDef: Int32 get_MetadataIndex() FSharp.Compiler.AbstractIL.IL+ILTypeDef: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]] Implements FSharp.Compiler.AbstractIL.IL+ILTypeDef: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]] get_Implements() +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]] Extends +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]] get_Extends() FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef] GenericParams FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef] get_GenericParams() -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType] Extends -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType] get_Extends() FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.Reflection.TypeAttributes Attributes FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.Reflection.TypeAttributes get_Attributes() FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.String Name FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.String ToString() FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.String get_Name() -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Void .ctor(System.String, System.Reflection.TypeAttributes, ILTypeDefLayout, Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType], ILMethodDefs, ILTypeDefs, ILFieldDefs, ILMethodImplDefs, ILEventDefs, ILPropertyDefs, ILTypeDefAdditionalFlags, ILSecurityDecls, ILAttributesStored) +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Void .ctor(System.String, System.Reflection.TypeAttributes, ILTypeDefLayout, Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef], Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]], ILMethodDefs, ILTypeDefs, ILFieldDefs, ILMethodImplDefs, ILEventDefs, ILPropertyDefs, ILTypeDefAdditionalFlags, ILSecurityDecls, ILAttributesStored) +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Void .ctor(System.String, System.Reflection.TypeAttributes, ILTypeDefLayout, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType], ILMethodDefs, ILTypeDefs, ILFieldDefs, ILMethodImplDefs, ILEventDefs, ILPropertyDefs, ILSecurityDecls, ILAttributesStored) FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess+Nested: ILMemberAccess Item FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess+Nested: ILMemberAccess get_Item() FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess+Tags: Int32 Nested @@ -1617,47 +1618,13 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess: Int32 Tag FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess: Int32 get_Tag() FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess: System.String ToString() FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: ILTypeDefAdditionalFlags CanContainExtensionMethods +FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: ILTypeDefAdditionalFlags Class +FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: ILTypeDefAdditionalFlags Delegate +FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: ILTypeDefAdditionalFlags Enum +FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: ILTypeDefAdditionalFlags Interface FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: ILTypeDefAdditionalFlags IsKnownToBeAttribute -FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: ILTypeDefAdditionalFlags None +FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: ILTypeDefAdditionalFlags ValueType FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: Int32 value__ -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind+Tags: Int32 Class -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind+Tags: Int32 Delegate -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind+Tags: Int32 Enum -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind+Tags: Int32 Interface -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind+Tags: Int32 ValueType -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean Equals(ILTypeDefKind) -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean Equals(ILTypeDefKind, System.Collections.IEqualityComparer) -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean Equals(System.Object) -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean Equals(System.Object, System.Collections.IEqualityComparer) -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean IsClass -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean IsDelegate -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean IsEnum -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean IsInterface -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean IsValueType -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean get_IsClass() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean get_IsDelegate() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean get_IsEnum() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean get_IsInterface() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean get_IsValueType() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: FSharp.Compiler.AbstractIL.IL+ILTypeDefKind+Tags -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind Class -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind Delegate -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind Enum -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind Interface -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind ValueType -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind get_Class() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind get_Delegate() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind get_Enum() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind get_Interface() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind get_ValueType() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Int32 CompareTo(ILTypeDefKind) -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Int32 CompareTo(System.Object) -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Int32 CompareTo(System.Object, System.Collections.IComparer) -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Int32 GetHashCode() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Int32 GetHashCode(System.Collections.IEqualityComparer) -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Int32 Tag -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Int32 get_Tag() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: System.String ToString() FSharp.Compiler.AbstractIL.IL+ILTypeDefLayout+Explicit: ILTypeDefLayoutInfo Item FSharp.Compiler.AbstractIL.IL+ILTypeDefLayout+Explicit: ILTypeDefLayoutInfo get_Item() FSharp.Compiler.AbstractIL.IL+ILTypeDefLayout+Sequential: ILTypeDefLayoutInfo Item @@ -1860,6 +1827,7 @@ FSharp.Compiler.AbstractIL.IL+PublicKey: PublicKey KeyAsToken(Byte[]) FSharp.Compiler.AbstractIL.IL+PublicKey: PublicKey NewPublicKey(Byte[]) FSharp.Compiler.AbstractIL.IL+PublicKey: PublicKey NewPublicKeyToken(Byte[]) FSharp.Compiler.AbstractIL.IL+PublicKey: System.String ToString() +FSharp.Compiler.AbstractIL.IL: Boolean |HasFlag|_|(ILTypeDefAdditionalFlags, ILTypeDefAdditionalFlags) FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILArgConvention FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILArrayShape FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILAssemblyLongevity @@ -1914,7 +1882,6 @@ FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILType FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeDef FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags -FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeDefKind FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeDefLayout FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeDefs FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeInit @@ -1972,6 +1939,8 @@ FSharp.Compiler.AbstractIL.IL: Int32 NoMetadataIdx FSharp.Compiler.AbstractIL.IL: Int32 get_NoMetadataIdx() FSharp.Compiler.AbstractIL.IL: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]] emptyILInterfaceImpls FSharp.Compiler.AbstractIL.IL: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]] get_emptyILInterfaceImpls() +FSharp.Compiler.AbstractIL.IL: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]] emptyILExtends +FSharp.Compiler.AbstractIL.IL: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]] get_emptyILExtends() FSharp.Compiler.AbstractIL.ILBinaryReader+ILModuleReader: ILModuleDef ILModuleDef FSharp.Compiler.AbstractIL.ILBinaryReader+ILModuleReader: ILModuleDef get_ILModuleDef() FSharp.Compiler.AbstractIL.ILBinaryReader+ILModuleReader: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILAssemblyRef] ILAssemblyRefs 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 b66bebd1cbc..c3b65b8e378 100644 --- 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 @@ -1565,7 +1565,7 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILPropertyDefs Properties FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILPropertyDefs get_Properties() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILSecurityDecls SecurityDecls 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[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: 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: ILTypeDefLayout Layout @@ -1576,16 +1576,17 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDef: Int32 MetadataIndex FSharp.Compiler.AbstractIL.IL+ILTypeDef: Int32 get_MetadataIndex() FSharp.Compiler.AbstractIL.IL+ILTypeDef: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]] Implements FSharp.Compiler.AbstractIL.IL+ILTypeDef: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]] get_Implements() +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]] Extends +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]] get_Extends() FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef] GenericParams FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef] get_GenericParams() -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType] Extends -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType] get_Extends() FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.Reflection.TypeAttributes Attributes FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.Reflection.TypeAttributes get_Attributes() FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.String Name FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.String ToString() FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.String get_Name() -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Void .ctor(System.String, System.Reflection.TypeAttributes, ILTypeDefLayout, Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType], ILMethodDefs, ILTypeDefs, ILFieldDefs, ILMethodImplDefs, ILEventDefs, ILPropertyDefs, ILTypeDefAdditionalFlags, ILSecurityDecls, ILAttributesStored) +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Void .ctor(System.String, System.Reflection.TypeAttributes, ILTypeDefLayout, Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef], Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]], ILMethodDefs, ILTypeDefs, ILFieldDefs, ILMethodImplDefs, ILEventDefs, ILPropertyDefs, ILTypeDefAdditionalFlags, ILSecurityDecls, ILAttributesStored) +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Void .ctor(System.String, System.Reflection.TypeAttributes, ILTypeDefLayout, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType], ILMethodDefs, ILTypeDefs, ILFieldDefs, ILMethodImplDefs, ILEventDefs, ILPropertyDefs, ILSecurityDecls, ILAttributesStored) FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess+Nested: ILMemberAccess Item FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess+Nested: ILMemberAccess get_Item() FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess+Tags: Int32 Nested @@ -1617,47 +1618,13 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess: Int32 Tag FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess: Int32 get_Tag() FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess: System.String ToString() FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: ILTypeDefAdditionalFlags CanContainExtensionMethods +FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: ILTypeDefAdditionalFlags Class +FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: ILTypeDefAdditionalFlags Delegate +FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: ILTypeDefAdditionalFlags Enum +FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: ILTypeDefAdditionalFlags Interface FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: ILTypeDefAdditionalFlags IsKnownToBeAttribute -FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: ILTypeDefAdditionalFlags None +FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: ILTypeDefAdditionalFlags ValueType FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: Int32 value__ -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind+Tags: Int32 Class -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind+Tags: Int32 Delegate -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind+Tags: Int32 Enum -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind+Tags: Int32 Interface -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind+Tags: Int32 ValueType -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean Equals(ILTypeDefKind) -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean Equals(ILTypeDefKind, System.Collections.IEqualityComparer) -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean Equals(System.Object) -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean Equals(System.Object, System.Collections.IEqualityComparer) -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean IsClass -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean IsDelegate -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean IsEnum -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean IsInterface -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean IsValueType -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean get_IsClass() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean get_IsDelegate() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean get_IsEnum() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean get_IsInterface() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Boolean get_IsValueType() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: FSharp.Compiler.AbstractIL.IL+ILTypeDefKind+Tags -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind Class -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind Delegate -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind Enum -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind Interface -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind ValueType -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind get_Class() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind get_Delegate() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind get_Enum() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind get_Interface() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: ILTypeDefKind get_ValueType() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Int32 CompareTo(ILTypeDefKind) -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Int32 CompareTo(System.Object) -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Int32 CompareTo(System.Object, System.Collections.IComparer) -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Int32 GetHashCode() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Int32 GetHashCode(System.Collections.IEqualityComparer) -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Int32 Tag -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: Int32 get_Tag() -FSharp.Compiler.AbstractIL.IL+ILTypeDefKind: System.String ToString() FSharp.Compiler.AbstractIL.IL+ILTypeDefLayout+Explicit: ILTypeDefLayoutInfo Item FSharp.Compiler.AbstractIL.IL+ILTypeDefLayout+Explicit: ILTypeDefLayoutInfo get_Item() FSharp.Compiler.AbstractIL.IL+ILTypeDefLayout+Sequential: ILTypeDefLayoutInfo Item @@ -1860,6 +1827,7 @@ FSharp.Compiler.AbstractIL.IL+PublicKey: PublicKey KeyAsToken(Byte[]) FSharp.Compiler.AbstractIL.IL+PublicKey: PublicKey NewPublicKey(Byte[]) FSharp.Compiler.AbstractIL.IL+PublicKey: PublicKey NewPublicKeyToken(Byte[]) FSharp.Compiler.AbstractIL.IL+PublicKey: System.String ToString() +FSharp.Compiler.AbstractIL.IL: Boolean |HasFlag|_|(ILTypeDefAdditionalFlags, ILTypeDefAdditionalFlags) FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILArgConvention FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILArrayShape FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILAssemblyLongevity @@ -1914,7 +1882,6 @@ FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILType FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeDef FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags -FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeDefKind FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeDefLayout FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeDefs FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeInit @@ -1972,6 +1939,8 @@ FSharp.Compiler.AbstractIL.IL: Int32 NoMetadataIdx FSharp.Compiler.AbstractIL.IL: Int32 get_NoMetadataIdx() FSharp.Compiler.AbstractIL.IL: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]] emptyILInterfaceImpls FSharp.Compiler.AbstractIL.IL: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]] get_emptyILInterfaceImpls() +FSharp.Compiler.AbstractIL.IL: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]] emptyILExtends +FSharp.Compiler.AbstractIL.IL: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]] get_emptyILExtends() FSharp.Compiler.AbstractIL.ILBinaryReader+ILModuleReader: ILModuleDef ILModuleDef FSharp.Compiler.AbstractIL.ILBinaryReader+ILModuleReader: ILModuleDef get_ILModuleDef() FSharp.Compiler.AbstractIL.ILBinaryReader+ILModuleReader: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILAssemblyRef] ILAssemblyRefs diff --git a/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs b/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs index a61f61f84f8..995d9dabfb2 100644 --- a/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs @@ -116,8 +116,8 @@ type PreTypeDefData = mkILMethods [] let typeAttributes = TypeAttributes.Public - ILTypeDef(this.Name, typeAttributes, ILTypeDefLayout.Auto, emptyILInterfaceImpls, [], - None, methodsDefs, mkILTypeDefs [], mkILFields [], emptyILMethodImpls, mkILEvents [], mkILProperties [], ILTypeDefAdditionalFlags.None, + ILTypeDef(this.Name, typeAttributes, ILTypeDefLayout.Auto, [], [], + None, methodsDefs, mkILTypeDefs [], mkILFields [], emptyILMethodImpls, mkILEvents [], mkILProperties [], emptyILSecurityDecls, emptyILCustomAttrsStored) type PreTypeDef(data: PreTypeDefData) = diff --git a/tests/FSharp.Compiler.Service.Tests/Symbols.fs b/tests/FSharp.Compiler.Service.Tests/Symbols.fs index eba673f5963..7e01b64f1df 100644 --- a/tests/FSharp.Compiler.Service.Tests/Symbols.fs +++ b/tests/FSharp.Compiler.Service.Tests/Symbols.fs @@ -1271,3 +1271,33 @@ type T() = ) Assert.False hasPropertySymbols + +module Delegates = + [] + let ``IL metadata`` () = + let _, checkResults = getParseAndCheckResults """ + module Delegates + open System + + typeof + typeof + typeof + typeof + """ + + let symbols = + checkResults.GetAllUsesOfAllSymbolsInFile() + |> Seq.choose (fun su -> match su.Symbol with :? FSharpEntity as entity -> Some entity | _ -> None) + |> Seq.map (fun su -> su.DisplayName, su) + |> dict + + let delegateType = symbols["Delegate"] + delegateType.IsDelegate |> shouldEqual false + delegateType.IsClass |> shouldEqual true + + let multicastDelegateType = symbols["MulticastDelegate"] + multicastDelegateType.IsDelegate |> shouldEqual false + multicastDelegateType.IsClass |> shouldEqual true + + symbols["EventHandler"].IsDelegate |> shouldEqual true + symbols["Action"].IsDelegate |> shouldEqual true diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl index 03328728f4c..bd1c0f3f56c 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl @@ -55,7 +55,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILPdbWriter+pushShadowedLocals@959::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000232][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadUntaggedIdx([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.BinaryConstants+TableName, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+ILMetadataReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, int32&)][offset 0x0000000D][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::openMetadataReader(string, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+BinaryFile, int32, [S.P.CoreLib]System.Tuple`8,bool,bool,bool,bool,bool,System.Tuple`5,bool,int32,int32,int32>>, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+PEReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, bool)][offset 0x00000799][found Boolean] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+rowKindSize@4422::Invoke([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+RowKind)][offset 0x00000128][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+rowKindSize@4453::Invoke([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+RowKind)][offset 0x00000128][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000CD][found Char] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl index a863787a54e..bd2d4888522 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl @@ -75,11 +75,11 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILPdbWriter+pushShadowedLocals@959::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000232][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadUntaggedIdx([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.BinaryConstants+TableName, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+ILMetadataReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, int32&)][offset 0x0000000D][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::openMetadataReader(string, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+BinaryFile, int32, [S.P.CoreLib]System.Tuple`8,bool,bool,bool,bool,bool,System.Tuple`5,bool,int32,int32,int32>>, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+PEReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, bool)][offset 0x00000799][found Boolean] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+rowKindSize@4422::Invoke([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+RowKind)][offset 0x00000128][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+rowKindSize@4453::Invoke([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+RowKind)][offset 0x00000128][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.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@5253::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@5291::Invoke([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>, int32, int32)][offset 0x00000087][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.Collections.Utils::shortPath(string)][offset 0x00000015][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment+probePathForDotnetHost@321::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 d1f7525cef2..20f8131d238 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl @@ -74,14 +74,14 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadNestedRowUncached([FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1>, int32)][offset 0x00000038][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadNestedRowUncached([FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1>, int32)][offset 0x00000058][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadGenericParamConstraintIdx([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+ILMetadataReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, int32)][offset 0x00000025][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::rowKindSize$cont@4423(bool, bool, bool, bool[], bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x000000E5][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::rowKindSize$cont@4454(bool, bool, bool, bool[], bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x000000E5][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::openMetadataReader(string, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+BinaryFile, int32, [S.P.CoreLib]System.Tuple`8,bool,bool,bool,bool,bool,System.Tuple`5,bool,int32,int32,int32>>, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+PEReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, bool)][offset 0x000006BF][found Boolean] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadInterfaceImpls@2238-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadGenericParamConstraints@2303-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+enclIdx@2332-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadMethodImpls@3100-4::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadEvents@3180-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadProperties@3250-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadInterfaceImpls@2263-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadGenericParamConstraints@2328-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+enclIdx@2357-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadMethodImpls@3131-4::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadEvents@3211-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadProperties@3281-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000B6][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 9de22b5cd79..c5ce02a7c08 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl @@ -95,18 +95,18 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadNestedRowUncached([FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1>, int32)][offset 0x00000038][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadNestedRowUncached([FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1>, int32)][offset 0x00000058][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::seekReadGenericParamConstraintIdx([FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+ILMetadataReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, int32)][offset 0x00000025][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::rowKindSize$cont@4423(bool, bool, bool, bool[], bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x000000E5][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::rowKindSize$cont@4454(bool, bool, bool, bool[], bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x000000E5][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader::openMetadataReader(string, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+BinaryFile, int32, [S.P.CoreLib]System.Tuple`8,bool,bool,bool,bool,bool,System.Tuple`5,bool,int32,int32,int32>>, [FSharp.Compiler.Service]FSharp.Compiler.AbstractIL.ILBinaryReader+PEReader, [FSharp.Compiler.Service]FSharp.Compiler.IO.ReadOnlyByteMemory, [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, bool)][offset 0x000006BF][found Boolean] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadInterfaceImpls@2238-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadGenericParamConstraints@2303-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+enclIdx@2332-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadMethodImpls@3100-4::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadEvents@3180-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadProperties@3250-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadInterfaceImpls@2263-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadGenericParamConstraints@2328-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+enclIdx@2357-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadMethodImpls@3131-4::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadEvents@3211-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadProperties@3281-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.NativeRes+VersionHelper::TryParse(string, bool, uint16, bool, [S.P.CoreLib]System.Version&)][offset 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@5252(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@5290(uint8[], [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>, int32, int32)][offset 0x0000007E][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.Collections.Utils::shortPath(string)][offset 0x00000016][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment::probePathForDotnetHost@320([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. From 471fdc894ff966be8766874a3e83ef90f8f2b3d2 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Fri, 13 Dec 2024 09:32:56 -0800 Subject: [PATCH 2/2] Improved threadsafety for FileIndexTable.FileToIndex (#18137) * Improved threadsafety for FileIndexTable.FileToIndex * Fix typo * baselines --- src/Compiler/Utilities/range.fs | 42 +++++++++---------- ...y_FSharp.Compiler.Service_Debug_net9.0.bsl | 2 +- ....Compiler.Service_Debug_netstandard2.0.bsl | 2 +- ...FSharp.Compiler.Service_Release_net9.0.bsl | 2 +- ...ompiler.Service_Release_netstandard2.0.bsl | 2 +- 5 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/Compiler/Utilities/range.fs b/src/Compiler/Utilities/range.fs index 09633136dbe..f9940461a32 100755 --- a/src/Compiler/Utilities/range.fs +++ b/src/Compiler/Utilities/range.fs @@ -196,31 +196,29 @@ type FileIndexTable() = match fileToIndexTable.TryGetValue filePath with | true, idx -> idx | _ -> - // If a write operation can happen, we have to lock the whole read-check-write to avoid race conditions - lock fileToIndexTable - <| fun () -> - match fileToIndexTable.TryGetValue filePath with - | true, idx -> idx - | _ -> - - // Try again looking for a normalized entry. - let normalizedFilePath = - if normalize then - FileSystem.NormalizePathShim filePath - else - filePath + // Try again looking for a normalized entry. + let normalizedFilePath = + if normalize then + FileSystem.NormalizePathShim filePath + else + filePath - match fileToIndexTable.TryGetValue normalizedFilePath with - | true, idx -> - // Record the non-normalized entry if necessary - if filePath <> normalizedFilePath then - fileToIndexTable[filePath] <- idx + match fileToIndexTable.TryGetValue normalizedFilePath with + | true, idx -> + // Record the non-normalized entry if necessary + if filePath <> normalizedFilePath then + fileToIndexTable[filePath] <- idx - // Return the index - idx + // Return the index + idx + | _ -> + lock indexToFileTable (fun () -> + // See if it was added on another thread + match fileToIndexTable.TryGetValue normalizedFilePath with + | true, idx -> idx | _ -> - // Get the new index + // Okay it's really not there let idx = indexToFileTable.Count // Record the normalized entry @@ -232,7 +230,7 @@ type FileIndexTable() = fileToIndexTable[filePath] <- idx // Return the index - idx + idx) member t.IndexToFile n = if n < 0 then diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl index bd1c0f3f56c..901f7434dfd 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_net9.0.bsl @@ -59,7 +59,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000CD][found Char] Unexpected type on the stack. -[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@548::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. +[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@546::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. [IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000037][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000043][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$Internal.Utilities.XmlAdapters::.cctor()][offset 0x0000000A][found Char] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl index bd2d4888522..7ae4f3e43ca 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl @@ -84,7 +84,7 @@ [IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment+probePathForDotnetHost@321::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000028][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.SimulatedMSBuildReferenceResolver+Pipe #6 input at line 68@68::FSharp.Compiler.CodeAnalysis.ILegacyReferenceResolver.Resolve([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyResolutionEnvironment, [S.P.CoreLib]System.Tuple`2[], string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>)][offset 0x0000034D][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000CD][found Char] Unexpected type on the stack. -[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@548::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. +[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@546::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. [IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000037][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000043][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$Internal.Utilities.XmlAdapters::.cctor()][offset 0x0000000A][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 20f8131d238..99af17bef5a 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl @@ -85,7 +85,7 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x0000000B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.IL::parseILVersion(string)][offset 0x00000021][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000B6][found Char] Unexpected type on the stack. -[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@548::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. +[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@546::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. [IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000035][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000041][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$Internal.Utilities.XmlAdapters::.cctor()][offset 0x0000000A][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 c5ce02a7c08..3ef589fcd21 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl @@ -111,7 +111,7 @@ [IL]: Error [StackUnexpected]: : Internal.Utilities.FSharpEnvironment::probePathForDotnetHost@320([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000002A][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CodeAnalysis.SimulatedMSBuildReferenceResolver+SimulatedMSBuildResolver@68::FSharp.Compiler.CodeAnalysis.ILegacyReferenceResolver.Resolve([FSharp.Compiler.Service]FSharp.Compiler.CodeAnalysis.LegacyResolutionEnvironment, [S.P.CoreLib]System.Tuple`2[], string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, string, [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, string, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>)][offset 0x000002F5][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.DiagnosticsLogger::.cctor()][offset 0x000000B6][found Char] Unexpected type on the stack. -[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@548::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. +[IL]: Error [CallVirtOnValueType]: : FSharp.Compiler.Text.RangeModule+comparer@546::System.Collections.Generic.IEqualityComparer.GetHashCode([FSharp.Compiler.Service]FSharp.Compiler.Text.Range)][offset 0x00000002] Callvirt on a value type method. [IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000035][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : Internal.Utilities.PathMapModule::applyDir([FSharp.Compiler.Service]Internal.Utilities.PathMap, string)][offset 0x00000041][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$Internal.Utilities.XmlAdapters::.cctor()][offset 0x0000000A][found Char] Unexpected type on the stack.