From 35db7dba02b6fdcbe9bf93a5a60460ecbc3474a9 Mon Sep 17 00:00:00 2001 From: "Alexey.Berezhnykh" Date: Wed, 20 Nov 2024 02:03:24 +0300 Subject: [PATCH 01/10] wip --- src/Compiler/AbstractIL/il.fs | 117 +++++++++++------- src/Compiler/AbstractIL/il.fsi | 54 +++++--- src/Compiler/AbstractIL/ilmorph.fs | 6 +- src/Compiler/AbstractIL/ilprint.fs | 2 +- src/Compiler/AbstractIL/ilread.fs | 42 ++++++- 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 | 52 ++++---- ...ervice.SurfaceArea.netstandard20.debug.bsl | 11 +- ...vice.SurfaceArea.netstandard20.release.bsl | 56 ++------- .../ModuleReaderCancellationTests.fs | 4 +- 14 files changed, 215 insertions(+), 162 deletions(-) diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index 37fda4f2873..2173ce4e59a 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -2562,34 +2562,41 @@ 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 (|HasFlag|_|) (flag: ILTypeDefAdditionalFlags) flags = + flags &&& flag = flag 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 + ILTypeDefAdditionalFlags.Enum elif (name = "System.Delegate" && nm <> "System.MulticastDelegate") || name = "System.MulticastDelegate" then - ILTypeDefKind.Delegate + ILTypeDefAdditionalFlags.Delegate elif name = "System.ValueType" && nm <> "System.Enum" then - ILTypeDefKind.ValueType + ILTypeDefAdditionalFlags.ValueType else - ILTypeDefKind.Class + ILTypeDefAdditionalFlags.Class let convertTypeAccessFlags access = match access with @@ -2603,13 +2610,10 @@ let convertTypeAccessFlags access = | ILTypeDefAccess.Nested ILMemberAccess.FamilyOrAssembly -> TypeAttributes.NestedFamORAssem | ILTypeDefAccess.Nested ILMemberAccess.Assembly -> TypeAttributes.NestedAssembly -let convertTypeKind kind = +let convertTypeKind (kind: ILTypeDefAdditionalFlags) = 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 +2642,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 +2652,7 @@ type ILTypeDef layout: ILTypeDefLayout, implements: InterruptibleLazy, genericParams: ILGenericParameterDefs, - extends: ILType option, + extends: InterruptibleLazy, methods: ILMethodDefs, nestedTypes: ILTypeDefs, fields: ILFieldDefs, @@ -2705,6 +2703,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 +2820,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 @@ -2852,7 +2881,7 @@ type ILTypeDef attributes = (x.Attributes ||| convertTypeKind kind), extends = match kind with - | ILTypeDefKind.Interface -> None + | HasFlag ILTypeDefAdditionalFlags.Interface -> emptyILExtends | _ -> x.Extends ) @@ -2865,6 +2894,10 @@ type ILTypeDef member x.WithInitSemantics(init) = x.With(attributes = (x.Attributes ||| convertInitSemantics init)) + member x.WithAdditionalFlags(flags, rewriteInsteadOfAdd) = + let additionalFlags = if rewriteInsteadOfAdd then flags else flags ||| additionalFlags + x.With(newAdditionalFlags = additionalFlags) + [] member x.DebugText = x.ToString() @@ -4259,7 +4292,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 +4302,6 @@ let mkILGenericClass (nm, access, genparams, extends, impls, methods, fields, ne methodImpls = emptyILMethodImpls, properties = props, events = events, - additionalFlags = ILTypeDefAdditionalFlags.None, securityDecls = emptyILSecurityDecls ) @@ -4283,7 +4315,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 +4325,6 @@ let mkRawDataValueTypeDef (iltyp_ValueType: ILType) (nm, size, pack) = methodImpls = emptyILMethodImpls, properties = emptyILProperties, events = emptyILEvents, - additionalFlags = ILTypeDefAdditionalFlags.None, securityDecls = emptyILSecurityDecls ) @@ -5590,7 +5621,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..e9e3246a6a0 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,15 @@ 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 /// Represents IL Type Definitions. [] @@ -1529,7 +1526,7 @@ type ILTypeDef = layout: ILTypeDefLayout * implements: InterruptibleLazy * genericParams: ILGenericParameterDefs * - extends: ILType option * + extends: InterruptibleLazy * methods: ILMethodDefs * nestedTypes: ILTypeDefs * fields: ILFieldDefs * @@ -1542,14 +1539,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 +1558,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 +1620,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 WithAdditionalFlags: ILTypeDefAdditionalFlags * rewriteInsteadOfAdd: bool -> ILTypeDef /// Functional update member With: @@ -1617,7 +1633,7 @@ type ILTypeDef = ?layout: ILTypeDefLayout * ?implements: InterruptibleLazy * ?genericParams: ILGenericParameterDefs * - ?extends: ILType option * + ?extends: InterruptibleLazy * ?methods: ILMethodDefs * ?nestedTypes: ILTypeDefs * ?fields: ILFieldDefs * @@ -2257,6 +2273,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..f79f8560070 100644 --- a/src/Compiler/AbstractIL/ilread.fs +++ b/src/Compiler/AbstractIL/ilread.fs @@ -2107,7 +2107,37 @@ 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 + "" + + match extendsName with + | "System.Enum" -> ILTypeDefAdditionalFlags.Enum + | "System.Delegate" when nm <> "System.MulticastDelegate" -> ILTypeDefAdditionalFlags.Delegate + | "System.MulticastDelegate" -> ILTypeDefAdditionalFlags.Delegate + | "System.ValueType" when nm <> "System.Enum" -> ILTypeDefAdditionalFlags.ValueType + | _ -> ILTypeDefAdditionalFlags.Class + + let super = seekReadSuperType ctxt numTypars AsObject extendsIdx let layout = typeLayoutOfFlags ctxt mdv flags idx let hasLayout = @@ -2176,9 +2206,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 +2486,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..c6de83f88ac 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) @@ -11032,28 +11030,28 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option yield! ilDebugDisplayAttributes ] - let ilTypeDefKind = + let typeKind = match tyconRepr with | TFSharpTyconRepr o -> match o.fsobjmodel_kind with | 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 + (match typeKind with + | 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.WithAdditionalFlags(ILTypeDefAdditionalFlags.IsKnownToBeAttribute, false) + else + tdef let tdLayout, tdEncoding = match TryFindFSharpAttribute g g.attrib_StructLayoutAttribute tycon.Attribs with @@ -11583,8 +11581,8 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option ILTypeDefLayout.Auto, ILDefaultPInvokeEncoding.Ansi | _ when - (match ilTypeDefKind with - | ILTypeDefKind.ValueType -> true + (match typeKind with + | HasFlag ILTypeDefAdditionalFlags.ValueType -> true | _ -> false) -> @@ -11627,8 +11625,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option | ILTypeDefLayout.Sequential _ -> List.iter validateSequential ilFieldDefs | _ -> () - let tdef = - tdef.WithKind(ilTypeDefKind).WithLayout(tdLayout).WithEncoding(tdEncoding) + let tdef = tdef.WithKind(typeKind).WithLayout(tdLayout).WithEncoding(tdEncoding) tdef, None @@ -11707,7 +11704,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 +11712,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..642f62b649a 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[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: 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, ILTypeDefKind, 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, ILTypeDefAdditionalFlags, 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 @@ -1972,6 +1973,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..a04b84f87cb 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,14 @@ 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 +1828,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 +1883,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 +1940,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) = From 2180a95f5858de66da913f02967194c9a34342b9 Mon Sep 17 00:00:00 2001 From: "Alexey.Berezhnykh" Date: Wed, 20 Nov 2024 02:07:32 +0300 Subject: [PATCH 02/10] docs --- docs/release-notes/.FSharp.Compiler.Service/9.0.200.md | 1 + 1 file changed, 1 insertion(+) 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 7c7f9652b19..9102ac6045e 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md @@ -42,5 +42,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 From fbd9468779c4223177af37eaf01993f254bc83eb Mon Sep 17 00:00:00 2001 From: "Alexey.Berezhnykh" Date: Wed, 20 Nov 2024 02:34:00 +0300 Subject: [PATCH 03/10] cleanup --- src/Compiler/AbstractIL/il.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index 2173ce4e59a..fedc960608f 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -2610,7 +2610,7 @@ let convertTypeAccessFlags access = | ILTypeDefAccess.Nested ILMemberAccess.FamilyOrAssembly -> TypeAttributes.NestedFamORAssem | ILTypeDefAccess.Nested ILMemberAccess.Assembly -> TypeAttributes.NestedAssembly -let convertTypeKind (kind: ILTypeDefAdditionalFlags) = +let convertTypeKind kind = match kind with | HasFlag ILTypeDefAdditionalFlags.Interface -> TypeAttributes.Abstract ||| TypeAttributes.Interface | _ -> TypeAttributes.Class From 0d6be41ef1e955a253ad91ddeb3b9450af68fe34 Mon Sep 17 00:00:00 2001 From: "Alexey.Berezhnykh" Date: Wed, 20 Nov 2024 04:30:01 +0300 Subject: [PATCH 04/10] wip --- src/Compiler/AbstractIL/il.fs | 11 +++++++++++ src/Compiler/CodeGen/IlxGen.fs | 9 +++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index fedc960608f..e4305ac73ae 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -2574,6 +2574,16 @@ type ILTypeDefAdditionalFlags = /// 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 @@ -2879,6 +2889,7 @@ type ILTypeDef member x.WithKind(kind) = x.With( attributes = (x.Attributes ||| convertTypeKind kind), + newAdditionalFlags = (resetTypeKind additionalFlags ||| kind), extends = match kind with | HasFlag ILTypeDefAdditionalFlags.Interface -> emptyILExtends diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index c6de83f88ac..4eb85424fb3 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -11030,7 +11030,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option yield! ilDebugDisplayAttributes ] - let typeKind = + let ilTypeDefKind = match tyconRepr with | TFSharpTyconRepr o -> match o.fsobjmodel_kind with @@ -11050,7 +11050,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option let requiresExtraField = let isEmptyStruct = - (match typeKind with + (match ilTypeDefKind with | HasFlag ILTypeDefAdditionalFlags.ValueType -> true | _ -> false) && @@ -11581,7 +11581,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option ILTypeDefLayout.Auto, ILDefaultPInvokeEncoding.Ansi | _ when - (match typeKind with + (match ilTypeDefKind with | HasFlag ILTypeDefAdditionalFlags.ValueType -> true | _ -> false) -> @@ -11625,7 +11625,8 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option | ILTypeDefLayout.Sequential _ -> List.iter validateSequential ilFieldDefs | _ -> () - let tdef = tdef.WithKind(typeKind).WithLayout(tdLayout).WithEncoding(tdEncoding) + let tdef = + tdef.WithKind(ilTypeDefKind).WithLayout(tdLayout).WithEncoding(tdEncoding) tdef, None From 46cd25c20fa60b9be68a681c4c0de10fe3ccb0aa Mon Sep 17 00:00:00 2001 From: "Alexey.Berezhnykh" Date: Wed, 20 Nov 2024 06:35:40 +0300 Subject: [PATCH 05/10] fix --- ...FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl | 1 - 1 file changed, 1 deletion(-) 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 a04b84f87cb..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 @@ -1623,7 +1623,6 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags: ILTypeDefAdditionalFlags 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+ILTypeDefLayout+Explicit: ILTypeDefLayoutInfo Item From 967a47290caaff2131fda4ba732eeda5674d7907 Mon Sep 17 00:00:00 2001 From: "Alexey.Berezhnykh" Date: Wed, 20 Nov 2024 19:24:04 +0300 Subject: [PATCH 06/10] fix --- ...rify_FSharp.Compiler.Service_Debug_net9.0.bsl | 2 +- ...arp.Compiler.Service_Debug_netstandard2.0.bsl | 4 ++-- ...fy_FSharp.Compiler.Service_Release_net9.0.bsl | 14 +++++++------- ...p.Compiler.Service_Release_netstandard2.0.bsl | 16 ++++++++-------- 4 files changed, 18 insertions(+), 18 deletions(-) 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 c527d99ccf5..f4912676443 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@4458::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 7d4eff968ac..9605f4e6acb 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@4458::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@5284::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 a930478a45e..e175d148c6b 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@4459(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@2268-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadGenericParamConstraints@2333-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+enclIdx@2362-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadMethodImpls@3136-4::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadEvents@3216-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadProperties@3286-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 b97ede137b1..9e8c3ad5e88 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@4459(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@2268-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadGenericParamConstraints@2333-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+enclIdx@2362-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadMethodImpls@3136-4::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadEvents@3216-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadProperties@3286-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@5283(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 946c6b16f1ea2b78df383ab198060f76a7ba4081 Mon Sep 17 00:00:00 2001 From: "Alexey.Berezhnykh" Date: Tue, 10 Dec 2024 01:38:06 +0300 Subject: [PATCH 07/10] unify logic --- src/Compiler/AbstractIL/il.fs | 21 +++++++++------------ src/Compiler/AbstractIL/il.fsi | 2 ++ src/Compiler/AbstractIL/ilread.fs | 7 +------ 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index e4305ac73ae..724f1766e1a 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -2587,6 +2587,14 @@ let inline internal resetTypeKind flags = 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 ILTypeDefAdditionalFlags.Interface @@ -2595,18 +2603,7 @@ let typeKindOfFlags nm (super: ILType option) flags = | None -> ILTypeDefAdditionalFlags.Class | Some ty -> let name = ty.TypeSpec.Name - - if name = "System.Enum" then - ILTypeDefAdditionalFlags.Enum - elif - (name = "System.Delegate" && nm <> "System.MulticastDelegate") - || name = "System.MulticastDelegate" - then - ILTypeDefAdditionalFlags.Delegate - elif name = "System.ValueType" && nm <> "System.Enum" then - ILTypeDefAdditionalFlags.ValueType - else - ILTypeDefAdditionalFlags.Class + typeKindByNames name nm let convertTypeAccessFlags access = match access with diff --git a/src/Compiler/AbstractIL/il.fsi b/src/Compiler/AbstractIL/il.fsi index e9e3246a6a0..90a70d9281c 100644 --- a/src/Compiler/AbstractIL/il.fsi +++ b/src/Compiler/AbstractIL/il.fsi @@ -1515,6 +1515,8 @@ type ILTypeDefAdditionalFlags = val (|HasFlag|_|): flag: ILTypeDefAdditionalFlags -> flags: ILTypeDefAdditionalFlags -> bool +val inline internal typeKindByNames: extendsName: string -> typeName: string -> ILTypeDefAdditionalFlags + /// Represents IL Type Definitions. [] type ILTypeDef = diff --git a/src/Compiler/AbstractIL/ilread.fs b/src/Compiler/AbstractIL/ilread.fs index f79f8560070..14af625419b 100644 --- a/src/Compiler/AbstractIL/ilread.fs +++ b/src/Compiler/AbstractIL/ilread.fs @@ -2130,12 +2130,7 @@ and typeDefReader ctxtH : ILTypeDefStored = else "" - match extendsName with - | "System.Enum" -> ILTypeDefAdditionalFlags.Enum - | "System.Delegate" when nm <> "System.MulticastDelegate" -> ILTypeDefAdditionalFlags.Delegate - | "System.MulticastDelegate" -> ILTypeDefAdditionalFlags.Delegate - | "System.ValueType" when nm <> "System.Enum" -> ILTypeDefAdditionalFlags.ValueType - | _ -> ILTypeDefAdditionalFlags.Class + typeKindByNames extendsName nm let super = seekReadSuperType ctxt numTypars AsObject extendsIdx let layout = typeLayoutOfFlags ctxt mdv flags idx From 0416fe7f792618afad01af7c22171ca64809577d Mon Sep 17 00:00:00 2001 From: "Alexey.Berezhnykh" Date: Tue, 10 Dec 2024 02:06:25 +0300 Subject: [PATCH 08/10] fixes --- src/Compiler/AbstractIL/il.fs | 5 +- src/Compiler/AbstractIL/il.fsi | 2 +- src/Compiler/CodeGen/IlxGen.fs | 2 +- ...ervice.SurfaceArea.netstandard20.debug.bsl | 52 ++++--------------- 4 files changed, 13 insertions(+), 48 deletions(-) diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index 724f1766e1a..33a46ff0a23 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -2902,9 +2902,8 @@ type ILTypeDef member x.WithInitSemantics(init) = x.With(attributes = (x.Attributes ||| convertInitSemantics init)) - member x.WithAdditionalFlags(flags, rewriteInsteadOfAdd) = - let additionalFlags = if rewriteInsteadOfAdd then flags else flags ||| additionalFlags - x.With(newAdditionalFlags = additionalFlags) + member x.WithIsKnownToBeAttribute() = + x.With(newAdditionalFlags = (additionalFlags ||| ILTypeDefAdditionalFlags.IsKnownToBeAttribute)) [] member x.DebugText = x.ToString() diff --git a/src/Compiler/AbstractIL/il.fsi b/src/Compiler/AbstractIL/il.fsi index 90a70d9281c..f80c64b0c59 100644 --- a/src/Compiler/AbstractIL/il.fsi +++ b/src/Compiler/AbstractIL/il.fsi @@ -1626,7 +1626,7 @@ type ILTypeDef = member internal WithEncoding: ILDefaultPInvokeEncoding -> ILTypeDef member internal WithSpecialName: bool -> ILTypeDef member internal WithInitSemantics: ILTypeInit -> ILTypeDef - member internal WithAdditionalFlags: ILTypeDefAdditionalFlags * rewriteInsteadOfAdd: bool -> ILTypeDef + member internal WithIsKnownToBeAttribute: unit -> ILTypeDef /// Functional update member With: diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 4eb85424fb3..60a6f012976 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -11541,7 +11541,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option let tdef = if isKnownToBeAttribute then - tdef.WithAdditionalFlags(ILTypeDefAdditionalFlags.IsKnownToBeAttribute, false) + tdef.WithIsKnownToBeAttribute() else tdef 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 642f62b649a..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[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 @@ -1585,8 +1585,8 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.Reflection.TypeAttributes get_At 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, ILTypeDefKind, 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, 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 @@ -1618,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 @@ -1861,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 @@ -1915,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 From 121784a26df716a7dc6c56f96afa4776b52bf581 Mon Sep 17 00:00:00 2001 From: "Alexey.Berezhnykh" Date: Tue, 10 Dec 2024 02:55:48 +0300 Subject: [PATCH 09/10] ilverify --- ...rify_FSharp.Compiler.Service_Debug_net9.0.bsl | 2 +- ...arp.Compiler.Service_Debug_netstandard2.0.bsl | 4 ++-- ...fy_FSharp.Compiler.Service_Release_net9.0.bsl | 14 +++++++------- ...p.Compiler.Service_Release_netstandard2.0.bsl | 16 ++++++++-------- 4 files changed, 18 insertions(+), 18 deletions(-) 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 f4912676443..217564803a6 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@4458::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 9605f4e6acb..5f4a8e0d62e 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@4458::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@5284::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 e175d148c6b..935d51eeb26 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@4459(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@2268-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadGenericParamConstraints@2333-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+enclIdx@2362-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadMethodImpls@3136-4::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadEvents@3216-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadProperties@3286-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 9e8c3ad5e88..b3d98fcee71 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@4459(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@2268-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadGenericParamConstraints@2333-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+enclIdx@2362-2::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadMethodImpls@3136-4::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadEvents@3216-3::Invoke(int32)][offset 0x0000002F][found Byte] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.AbstractIL.ILBinaryReader+seekReadProperties@3286-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@5283(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 1a886f5dfc8c3e29c90f96ce06b6e8c735746b16 Mon Sep 17 00:00:00 2001 From: "Alexey.Berezhnykh" Date: Tue, 10 Dec 2024 04:01:17 +0300 Subject: [PATCH 10/10] test --- .../FSharp.Compiler.Service.Tests/Symbols.fs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) 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