diff --git a/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md index 91b91f3c3eb..4fdf50a224a 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md @@ -52,7 +52,7 @@ * Better CE error reporting when using `use!` with `and!` ([PR #17671](https://github.com/dotnet/fsharp/pull/17671)) * Better error reporting for let bindings. ([PR #17601](https://github.com/dotnet/fsharp/pull/17601)) * Optimize ILTypeDef interface impls reading from metadata. ([PR #17382](https://github.com/dotnet/fsharp/pull/17382)) +* Make ILTypeDef interface impls calculation lazy. ([PR #17392](https://github.com/dotnet/fsharp/pull/17392)) * Better error reporting for active patterns. ([PR #17666](https://github.com/dotnet/fsharp/pull/17666)) - ### Breaking Changes diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index 9ed1822676b..b10a119fced 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -1909,6 +1909,23 @@ let inline conditionalAdd condition flagToAdd source = let NoMetadataIdx = -1 +type InterfaceImpl = + { Idx: int; Type: ILType; mutable CustomAttrsStored: ILAttributesStored } + + member x.CustomAttrs = + match x.CustomAttrsStored with + | ILAttributesStored.Reader f -> + let res = ILAttributes(f x.Idx) + x.CustomAttrsStored <- ILAttributesStored.Given res + res + | ILAttributesStored.Given attrs -> attrs + + static member Create(ilType: ILType, customAttrsStored: ILAttributesStored) = + { Idx = NoMetadataIdx; Type = ilType; CustomAttrsStored = customAttrsStored } + + static member Create(ilType: ILType) = InterfaceImpl.Create(ilType, emptyILCustomAttrsStored) + + [] type ILMethodDef ( @@ -2635,8 +2652,7 @@ type ILTypeDef name: string, attributes: TypeAttributes, layout: ILTypeDefLayout, - implements: ILTypes, - implementsCustomAttrs: (ILAttributesStored * int) list option, + implements: InterruptibleLazy, genericParams: ILGenericParameterDefs, extends: ILType option, methods: ILMethodDefs, @@ -2659,7 +2675,6 @@ type ILTypeDef attributes, layout, implements, - implementsCustomAttrs, genericParams, extends, methods, @@ -2676,7 +2691,6 @@ type ILTypeDef attributes, layout, implements, - implementsCustomAttrs, genericParams, extends, methods, @@ -2703,8 +2717,6 @@ type ILTypeDef member _.Implements = implements - member _.ImplementsCustomAttrs = implementsCustomAttrs - member _.Extends = extends member _.Methods = methods @@ -2744,8 +2756,7 @@ type ILTypeDef ?properties, ?newAdditionalFlags, ?customAttrs, - ?securityDecls, - ?implementsCustomAttrs + ?securityDecls ) = ILTypeDef( name = defaultArg name x.Name, @@ -2754,7 +2765,6 @@ type ILTypeDef genericParams = defaultArg genericParams x.GenericParams, nestedTypes = defaultArg nestedTypes x.NestedTypes, implements = defaultArg implements x.Implements, - implementsCustomAttrs = defaultArg implementsCustomAttrs x.ImplementsCustomAttrs, extends = defaultArg extends x.Extends, methods = defaultArg methods x.Methods, securityDecls = defaultArg securityDecls x.SecurityDecls, @@ -3333,6 +3343,8 @@ let mkILTypeDefs l = mkILTypeDefsFromArray (Array.ofList l) let mkILTypeDefsComputed f = ILTypeDefs f let emptyILTypeDefs = mkILTypeDefsFromArray [||] +let emptyILInterfaceImpls = InterruptibleLazy.FromValue([]) + // -------------------------------------------------------------------- // Operations on method tables. // -------------------------------------------------------------------- @@ -4240,7 +4252,7 @@ let mkILSimpleStorageCtor (baseTySpec, ty, extraParams, flds, access, tag, impor let mkILStorageCtor (preblock, ty, flds, access, tag, imports) = mkILStorageCtorWithParamNames (preblock, ty, [], addParamNames flds, access, tag, imports) -let mkILGenericClass (nm, access, genparams, extends, impl, methods, fields, nestedTypes, props, events, attrs, init) = +let mkILGenericClass (nm, access, genparams, extends, impls, methods, fields, nestedTypes, props, events, attrs, init) = let attributes = convertTypeAccessFlags access ||| TypeAttributes.AutoLayout @@ -4254,8 +4266,7 @@ let mkILGenericClass (nm, access, genparams, extends, impl, methods, fields, nes name = nm, attributes = attributes, genericParams = genparams, - implements = impl, - implementsCustomAttrs = None, + implements = InterruptibleLazy.FromValue(impls), layout = ILTypeDefLayout.Auto, extends = Some extends, methods = methods, @@ -4279,8 +4290,7 @@ let mkRawDataValueTypeDef (iltyp_ValueType: ILType) (nm, size, pack) = ||| TypeAttributes.ExplicitLayout ||| TypeAttributes.BeforeFieldInit ||| TypeAttributes.AnsiClass), - implements = [], - implementsCustomAttrs = None, + implements = emptyILInterfaceImpls, extends = Some iltyp_ValueType, layout = ILTypeDefLayout.Explicit { Size = Some size; Pack = Some pack }, methods = emptyILMethods, @@ -5586,7 +5596,7 @@ and refsOfILMethodImpl s m = and refsOfILTypeDef s (td: ILTypeDef) = refsOfILTypeDefs s td.NestedTypes refsOfILGenericParams s td.GenericParams - refsOfILTypes s td.Implements + refsOfILTypes s (td.Implements.Value |> List.map _.Type) Option.iter (refsOfILType s) td.Extends refsOfILMethodDefs s td.Methods refsOfILFieldDefs s (td.Fields.AsList()) diff --git a/src/Compiler/AbstractIL/il.fsi b/src/Compiler/AbstractIL/il.fsi index e3ec95a40d7..1487830e8f0 100644 --- a/src/Compiler/AbstractIL/il.fsi +++ b/src/Compiler/AbstractIL/il.fsi @@ -327,6 +327,15 @@ type ILCallingSignature = ArgTypes: ILTypes ReturnType: ILType } +type InterfaceImpl = + { Idx: int + Type: ILType + mutable CustomAttrsStored: ILAttributesStored } + + member CustomAttrs: ILAttributes + static member Create: ilType: ILType * customAttrsStored: ILAttributesStored -> InterfaceImpl + static member Create: ilType: ILType -> InterfaceImpl + /// Actual generic parameters are always types. type ILGenericArgs = ILType list @@ -1518,8 +1527,7 @@ type ILTypeDef = name: string * attributes: TypeAttributes * layout: ILTypeDefLayout * - implements: ILTypes * - implementsCustomAttrs: (ILAttributesStored * int) list option * + implements: InterruptibleLazy * genericParams: ILGenericParameterDefs * extends: ILType option * methods: ILMethodDefs * @@ -1539,8 +1547,7 @@ type ILTypeDef = name: string * attributes: TypeAttributes * layout: ILTypeDefLayout * - implements: ILTypes * - implementsCustomAttrs: (ILAttributesStored * int) list option * + implements: InterruptibleLazy * genericParams: ILGenericParameterDefs * extends: ILType option * methods: ILMethodDefs * @@ -1559,8 +1566,7 @@ type ILTypeDef = member GenericParams: ILGenericParameterDefs member Layout: ILTypeDefLayout member NestedTypes: ILTypeDefs - member Implements: ILTypes - member ImplementsCustomAttrs: (ILAttributesStored * int) list option + member Implements: InterruptibleLazy member Extends: ILType option member Methods: ILMethodDefs member SecurityDecls: ILSecurityDecls @@ -1609,7 +1615,7 @@ type ILTypeDef = ?name: string * ?attributes: TypeAttributes * ?layout: ILTypeDefLayout * - ?implements: ILTypes * + ?implements: InterruptibleLazy * ?genericParams: ILGenericParameterDefs * ?extends: ILType option * ?methods: ILMethodDefs * @@ -1620,8 +1626,7 @@ type ILTypeDef = ?properties: ILPropertyDefs * ?newAdditionalFlags: ILTypeDefAdditionalFlags * ?customAttrs: ILAttributesStored * - ?securityDecls: ILSecurityDecls * - ?implementsCustomAttrs: (ILAttributesStored * int) list option -> + ?securityDecls: ILSecurityDecls -> ILTypeDef /// Represents a prefix of information for ILTypeDef. @@ -2161,7 +2166,7 @@ val internal mkILGenericClass: ILTypeDefAccess * ILGenericParameterDefs * ILType * - ILType list * + InterfaceImpl list * ILMethodDefs * ILFieldDefs * ILTypeDefs * @@ -2245,6 +2250,8 @@ val internal mkCtorMethSpecForDelegate: ILGlobals -> ILType * bool -> ILMethodSp /// The toplevel "class" for a module or assembly. val internal mkILTypeForGlobalFunctions: ILScopeRef -> ILType +val emptyILInterfaceImpls: 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 334ed93d212..9f2f3d0582f 100644 --- a/src/Compiler/AbstractIL/ilmorph.fs +++ b/src/Compiler/AbstractIL/ilmorph.fs @@ -368,8 +368,13 @@ let rec tdef_ty2ty_ilmbody2ilmbody_mdefs2mdefs isInKnownSet enc fs (tdef: ILType let mdefsR = fMethodDefs (enc, tdef) tdef.Methods let fdefsR = fdefs_ty2ty fTyInCtxtR tdef.Fields + let implements = + tdef.Implements.Value + |> List.map (fun x -> { x with Type = fTyInCtxtR x.Type }) + |> InterruptibleLazy.FromValue + tdef.With( - implements = List.map fTyInCtxtR tdef.Implements, + implements = implements, genericParams = gparams_ty2ty fTyInCtxtR tdef.GenericParams, extends = Option.map fTyInCtxtR tdef.Extends, methods = mdefsR, diff --git a/src/Compiler/AbstractIL/ilprint.fs b/src/Compiler/AbstractIL/ilprint.fs index 9d278dbe317..6ed8aec9286 100644 --- a/src/Compiler/AbstractIL/ilprint.fs +++ b/src/Compiler/AbstractIL/ilprint.fs @@ -752,8 +752,9 @@ let goutput_superclass env os = output_string os "extends " (goutput_typ_with_shortened_class_syntax env) os typ -let goutput_implements env os (imp: ILTypes) = +let goutput_implements env os (imp: InterfaceImpl list) = if not (List.isEmpty imp) then + let imp = imp |> Seq.map _.Type output_string os "implements " output_seq ", " (goutput_typ_with_shortened_class_syntax env) os imp @@ -836,7 +837,7 @@ let rec goutput_tdef enc env contents os (cd: ILTypeDef) = output_string os "\n\t" goutput_superclass env os cd.Extends output_string os "\n\t" - goutput_implements env os cd.Implements + goutput_implements env os cd.Implements.Value output_string os "\n{\n " if contents then diff --git a/src/Compiler/AbstractIL/ilread.fs b/src/Compiler/AbstractIL/ilread.fs index 02696c53f0e..7ffa71feeee 100644 --- a/src/Compiler/AbstractIL/ilread.fs +++ b/src/Compiler/AbstractIL/ilread.fs @@ -2192,8 +2192,7 @@ and typeDefReader ctxtH : ILTypeDefStored = let fdefs = seekReadFields ctxt (numTypars, hasLayout) fieldsIdx endFieldsIdx let nested = seekReadNestedTypeDefs ctxt idx - let impls, intImplsAttrs = - seekReadInterfaceImpls ctxt mdv numTypars idx |> List.unzip + let impls = seekReadInterfaceImpls ctxt mdv numTypars idx let mimpls = seekReadMethodImpls ctxt numTypars idx let props = seekReadProperties ctxt numTypars idx @@ -2206,7 +2205,6 @@ and typeDefReader ctxtH : ILTypeDefStored = layout = layout, nestedTypes = nested, implements = impls, - implementsCustomAttrs = Some intImplsAttrs, extends = super, methods = mdefs, securityDeclsStored = ctxt.securityDeclsReader_TypeDef, @@ -2240,19 +2238,26 @@ and seekReadNestedTypeDefs (ctxt: ILMetadataReader) tidx = |]) and seekReadInterfaceImpls (ctxt: ILMetadataReader) mdv numTypars tidx = - seekReadIndexedRows ( - ctxt.getNumRows TableNames.InterfaceImpl, - id, - id, - (fun idx -> - let mutable addr = ctxt.rowAddr TableNames.InterfaceImpl idx - let _tidx = seekReadUntaggedIdx TableNames.TypeDef ctxt mdv &addr - simpleIndexCompare tidx _tidx), - isSorted ctxt TableNames.InterfaceImpl, - (fun idx -> - let intfIdx = seekReadInterfaceIdx ctxt mdv idx - seekReadTypeDefOrRef ctxt numTypars AsObject [] intfIdx, (ctxt.customAttrsReader_InterfaceImpl, idx)) - ) + InterruptibleLazy(fun () -> + seekReadIndexedRows ( + ctxt.getNumRows TableNames.InterfaceImpl, + id, + id, + (fun idx -> + let mutable addr = ctxt.rowAddr TableNames.InterfaceImpl idx + let _tidx = seekReadUntaggedIdx TableNames.TypeDef ctxt mdv &addr + simpleIndexCompare tidx _tidx), + isSorted ctxt TableNames.InterfaceImpl, + (fun idx -> + let intfIdx = seekReadInterfaceIdx ctxt mdv idx + let ilType = seekReadTypeDefOrRef ctxt numTypars AsObject [] intfIdx + + { + Idx = idx + Type = ilType + CustomAttrsStored = ctxt.customAttrsReader_InterfaceImpl + }) + )) and seekReadGenericParams ctxt numTypars (a, b) : ILGenericParameterDefs = ctxt.seekReadGenericParams (GenericParamsIdx(numTypars, a, b)) diff --git a/src/Compiler/AbstractIL/ilreflect.fs b/src/Compiler/AbstractIL/ilreflect.fs index 9b0b7eddb9e..2a65eb8679b 100644 --- a/src/Compiler/AbstractIL/ilreflect.fs +++ b/src/Compiler/AbstractIL/ilreflect.fs @@ -2178,7 +2178,8 @@ let rec buildTypeDefPass2 cenv nesting emEnv (tdef: ILTypeDef) = let typB = envGetTypB emEnv tref let emEnv = envPushTyvars emEnv (getGenericArgumentsOfType typB) // add interface impls - tdef.Implements + tdef.Implements.Value + |> List.map _.Type |> convTypes cenv emEnv |> List.iter (fun implT -> typB.AddInterfaceImplementationAndLog implT) // add methods, properties @@ -2339,7 +2340,8 @@ let createTypeRef (visited: Dictionary<_, _>, created: Dictionary<_, _>) emEnv t if verbose2 then dprintf "buildTypeDefPass4: Creating Interface Chain of %s\n" tdef.Name - tdef.Implements |> List.iter (traverseType CollectTypes.All) + tdef.Implements.Value + |> List.iter (fun x -> traverseType CollectTypes.All x.Type) if verbose2 then dprintf "buildTypeDefPass4: Do value types in fields of %s\n" tdef.Name diff --git a/src/Compiler/AbstractIL/ilwrite.fs b/src/Compiler/AbstractIL/ilwrite.fs index 832aa1c2810..3cbdd3c752b 100644 --- a/src/Compiler/AbstractIL/ilwrite.fs +++ b/src/Compiler/AbstractIL/ilwrite.fs @@ -1323,7 +1323,7 @@ and GenTypeDefPass2 pidx enc cenv (tdef: ILTypeDef) = // Now generate or assign index numbers for tables referenced by the maps. // Don't yet generate contents of these tables - leave that to pass3, as // code may need to embed these entries. - cenv.implementsIdxs[tidx] <- tdef.Implements |> List.map (GenImplementsPass2 cenv env tidx) + cenv.implementsIdxs[tidx] <- tdef.Implements.Value |> List.map (fun x -> GenImplementsPass2 cenv env tidx x.Type) tdef.Fields.AsList() |> List.iter (GenFieldDefPass2 tdef cenv tidx) tdef.Methods |> Seq.iter (GenMethodDefPass2 tdef cenv tidx) @@ -2875,12 +2875,9 @@ let rec GenTypeDefPass3 enc cenv (tdef: ILTypeDef) = let env = envForTypeDef tdef let tidx = GetIdxForTypeDef cenv (TdKey(enc, tdef.Name)) - match tdef.ImplementsCustomAttrs with - | None -> () - | Some attrList -> - attrList - |> List.zip cenv.implementsIdxs[tidx] - |> List.iter (fun (impIdx,(attrs,metadataIdx)) -> GenCustomAttrsPass3Or4 cenv (hca_InterfaceImpl,impIdx) (attrs.GetCustomAttrs metadataIdx)) + tdef.Implements.Value + |> List.zip cenv.implementsIdxs[tidx] + |> List.iter (fun (impIdx, impl) -> GenCustomAttrsPass3Or4 cenv (hca_InterfaceImpl,impIdx) impl.CustomAttrs) tdef.Properties.AsList() |> List.iter (GenPropertyPass3 cenv env) tdef.Events.AsList() |> List.iter (GenEventPass3 cenv env) diff --git a/src/Compiler/Checking/TypeHierarchy.fs b/src/Compiler/Checking/TypeHierarchy.fs index 102f36908fe..0805fcaf09b 100644 --- a/src/Compiler/Checking/TypeHierarchy.fs +++ b/src/Compiler/Checking/TypeHierarchy.fs @@ -117,17 +117,16 @@ let GetImmediateInterfacesOfMetadataType g amap m skipUnref ty (tcref: TyconRef) // succeeded with more reported. There are pathological corner cases where this // doesn't apply: e.g. for mscorlib interfaces like IComparable, but we can always // assume those are present. - match tdef.ImplementsCustomAttrs with - | Some attrsList when g.langFeatureNullness && g.checkNullness -> - for (attrs,attrsIdx),intfTy in tdef.Implements |> List.zip attrsList do - if skipUnref = SkipUnrefInterfaces.No || CanRescopeAndImportILType scoref amap m intfTy then + let checkNullness = g.langFeatureNullness && g.checkNullness + for {Idx = attrsIdx; Type = intfTy; CustomAttrsStored = attrs} in tdef.Implements.Value do + if skipUnref = SkipUnrefInterfaces.No || CanRescopeAndImportILType scoref amap m intfTy then + if checkNullness then let typeAttrs = AttributesFromIL(attrsIdx,attrs) let nullness = {DirectAttributes = typeAttrs; Fallback = FromClass typeAttrs} RescopeAndImportILType scoref amap m tinst nullness intfTy - | _ -> - for intfTy in tdef.Implements do - if skipUnref = SkipUnrefInterfaces.No || CanRescopeAndImportILType scoref amap m intfTy then + else RescopeAndImportILTypeSkipNullness scoref amap m tinst intfTy + | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata -> for intfTy in tcref.ImmediateInterfaceTypesOfFSharpTycon do instType (mkInstForAppTy g ty) intfTy ] diff --git a/src/Compiler/CodeGen/EraseClosures.fs b/src/Compiler/CodeGen/EraseClosures.fs index ed32d83b369..df2604717ed 100644 --- a/src/Compiler/CodeGen/EraseClosures.fs +++ b/src/Compiler/CodeGen/EraseClosures.fs @@ -572,8 +572,7 @@ let rec convIlxClosureDef cenv encl (td: ILTypeDef) clo = name = td.Name, genericParams = td.GenericParams, attributes = td.Attributes, - implements = [], - implementsCustomAttrs = None, + implements = emptyILInterfaceImpls, nestedTypes = emptyILTypeDefs, layout = ILTypeDefLayout.Auto, extends = Some cenv.mkILTyFuncTy, @@ -707,8 +706,7 @@ let rec convIlxClosureDef cenv encl (td: ILTypeDef) clo = name = td.Name, genericParams = td.GenericParams, attributes = td.Attributes, - implements = [], - implementsCustomAttrs = None, + implements = emptyILInterfaceImpls, layout = ILTypeDefLayout.Auto, nestedTypes = emptyILTypeDefs, extends = Some nowEnvParentClass, diff --git a/src/Compiler/CodeGen/EraseUnions.fs b/src/Compiler/CodeGen/EraseUnions.fs index 88336c057b2..79788107475 100644 --- a/src/Compiler/CodeGen/EraseUnions.fs +++ b/src/Compiler/CodeGen/EraseUnions.fs @@ -1571,8 +1571,7 @@ let mkClassUnionDef genericParams = td.GenericParams, attributes = enum 0, layout = ILTypeDefLayout.Auto, - implements = [], - implementsCustomAttrs = None, + implements = emptyILInterfaceImpls, extends = Some g.ilg.typ_Object, methods = emptyILMethods, securityDecls = emptyILSecurityDecls, diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 6758b6dcd94..82572ea888a 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -2227,7 +2227,8 @@ type AnonTypeGenerationTable() = let ilInterfaceTys = [ - for intfTy, _, _ in tcaug.tcaug_interfaces -> GenType cenv m (TypeReprEnv.Empty.ForTypars tps) intfTy + for intfTy, _, _ in tcaug.tcaug_interfaces -> + GenType cenv m (TypeReprEnv.Empty.ForTypars tps) intfTy |> InterfaceImpl.Create ] let ilTypeDef = @@ -6023,7 +6024,8 @@ and GenStructStateMachine cenv cgbuf eenvouter (res: LoweredStateMachine) sequel let interfaceTys = GetImmediateInterfacesOfType SkipUnrefInterfaces.Yes g cenv.amap m templateStructTy - let ilInterfaceTys = List.map (GenType cenv m eenvinner.tyenv) interfaceTys + let ilInterfaceTys = + List.map (GenType cenv m eenvinner.tyenv >> InterfaceImpl.Create) interfaceTys let super = g.iltyp_ValueType @@ -6254,8 +6256,7 @@ and GenStructStateMachine cenv cgbuf eenvouter (res: LoweredStateMachine) sequel methods = mkILMethods mdefs, methodImpls = mkILMethodImpls mimpls, nestedTypes = emptyILTypeDefs, - implements = ilInterfaceTys, - implementsCustomAttrs = None, + implements = InterruptibleLazy.FromValue(ilInterfaceTys), extends = Some super, additionalFlags = ILTypeDefAdditionalFlags.None, securityDecls = emptyILSecurityDecls @@ -6381,7 +6382,8 @@ and GenObjectExpr cenv cgbuf eenvouter objExpr (baseType, baseValOpt, basecall, let mimpls = mimpls |> List.choose id // choose the ones that actually have method impls let interfaceTys = - interfaceImpls |> List.map (fst >> GenType cenv m eenvinner.tyenv) + interfaceImpls + |> List.map (fst >> GenType cenv m eenvinner.tyenv >> InterfaceImpl.Create) let super = (if isInterfaceTy g baseType then @@ -6390,7 +6392,11 @@ and GenObjectExpr cenv cgbuf eenvouter objExpr (baseType, baseValOpt, basecall, ilCloRetTy) let interfaceTys = - interfaceTys @ (if isInterfaceTy g baseType then [ ilCloRetTy ] else []) + interfaceTys + @ (if isInterfaceTy g baseType then + [ InterfaceImpl.Create(ilCloRetTy) ] + else + []) let cloTypeDefs = GenClosureTypeDefs @@ -6688,8 +6694,7 @@ and GenClosureTypeDefs methods = mkILMethods mdefs, methodImpls = mkILMethodImpls mimpls, nestedTypes = emptyILTypeDefs, - implements = ilIntfTys, - implementsCustomAttrs = None, + implements = InterruptibleLazy.FromValue(ilIntfTys), extends = Some ext, additionalFlags = ILTypeDefAdditionalFlags.None, securityDecls = emptyILSecurityDecls @@ -10770,23 +10775,20 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option let ilThisTy = GenType cenv m eenvinner.tyenv thisTy let tref = ilThisTy.TypeRef let ilGenParams = GenGenericParams cenv eenvinner tycon.TyparsNoRange + let checkNullness = g.langFeatureNullness && g.checkNullness let ilIntfTys = tycon.ImmediateInterfaceTypesOfFSharpTycon - |> List.map (GenType cenv m eenvinner.tyenv) - - let ilIntCustomAttrs = - if g.langFeatureNullness && g.checkNullness && not (isNil ilIntfTys) then - tycon.ImmediateInterfaceTypesOfFSharpTycon - |> List.map ( - GenAdditionalAttributesForTy g - >> mkILCustomAttrs - >> ILAttributesStored.Given - >> (fun x -> x, 0) - ) - |> Some - else - None + |> List.map (fun x -> + let ilType = GenType cenv m eenvinner.tyenv x + + let customAttrs = + if checkNullness then + GenAdditionalAttributesForTy g x |> mkILCustomAttrs |> ILAttributesStored.Given + else + emptyILCustomAttrsStored + + InterfaceImpl.Create(ilType, customAttrs)) let ilTypeName = tref.Name @@ -11447,11 +11449,7 @@ 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, - implementsCustomAttrs = ilIntCustomAttrs - ) + .With(methodImpls = mkILMethodImpls methodImpls, newAdditionalFlags = additionalFlags) let tdLayout, tdEncoding = match TryFindFSharpAttribute g g.attrib_StructLayoutAttribute tycon.Attribs with @@ -11613,8 +11611,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option methods = mkILMethods ilMethods, methodImpls = mkILMethodImpls methodImpls, nestedTypes = emptyILTypeDefs, - implements = ilIntfTys, - implementsCustomAttrs = None, + implements = InterruptibleLazy.FromValue(ilIntfTys), extends = Some( if tycon.IsStructOrEnumTycon then @@ -11837,7 +11834,7 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = let interfaces = exnc.ImmediateInterfaceTypesOfFSharpTycon - |> List.map (GenType cenv m eenv.tyenv) + |> List.map (GenType cenv m eenv.tyenv >> InterfaceImpl.Create) let tdef = mkILGenericClass ( diff --git a/src/Compiler/CodeGen/IlxGenSupport.fs b/src/Compiler/CodeGen/IlxGenSupport.fs index 073b4473ea9..0e163db4069 100644 --- a/src/Compiler/CodeGen/IlxGenSupport.fs +++ b/src/Compiler/CodeGen/IlxGenSupport.fs @@ -46,7 +46,7 @@ let mkLocalPrivateAttributeWithDefaultConstructor (g: TcGlobals, name: string) = ILTypeDefAccess.Private, ILGenericParameterDefs.Empty, g.ilg.typ_Attribute, - ILTypes.Empty, + [], ilMethods, emptyILFields, emptyILTypeDefs, @@ -140,7 +140,7 @@ let mkLocalPrivateAttributeWithPropertyConstructors ILTypeDefAccess.Private, ILGenericParameterDefs.Empty, g.ilg.typ_Attribute, - ILTypes.Empty, + [], mkILMethods ( ilCtorDef :: (ilElements |> List.fold (fun acc (_, getter, _, _) -> getter @ acc) []) @@ -205,7 +205,7 @@ let mkLocalPrivateAttributeWithByteAndByteArrayConstructors (g: TcGlobals, name: ILTypeDefAccess.Private, ILGenericParameterDefs.Empty, g.ilg.typ_Attribute, - ILTypes.Empty, + [], mkILMethods ([ ilScalarCtorDef; ilArrayCtorDef ]), mkILFields [ fieldDef ], emptyILTypeDefs, @@ -233,7 +233,7 @@ let mkLocalPrivateInt32Enum (g: TcGlobals, tref: ILTypeRef, values: (string * in ILTypeDefAccess.Private, ILGenericParameterDefs.Empty, g.ilg.typ_Enum, - ILTypes.Empty, + [], mkILMethods [], mkILFields enumFields, emptyILTypeDefs, 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 3ae2414fc07..543c92ef5cc 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+ILType]], 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], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]]]) +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: ILTypeDefAccess Access FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefAccess get_Access() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefLayout Layout @@ -1574,20 +1574,18 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefs NestedTypes FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefs get_NestedTypes() 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: 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.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType] Implements -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType] get_Implements() 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: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]] ImplementsCustomAttrs -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]] get_ImplementsCustomAttrs() 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, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]], 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], 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 @@ -1773,6 +1771,20 @@ FSharp.Compiler.AbstractIL.IL+ILVersionInfo: UInt16 get_Major() FSharp.Compiler.AbstractIL.IL+ILVersionInfo: UInt16 get_Minor() FSharp.Compiler.AbstractIL.IL+ILVersionInfo: UInt16 get_Revision() FSharp.Compiler.AbstractIL.IL+ILVersionInfo: Void .ctor(UInt16, UInt16, UInt16, UInt16) +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributes CustomAttrs +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributes get_CustomAttrs() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributesStored CustomAttrsStored +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributesStored CustomAttrsStored@ +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributesStored get_CustomAttrsStored() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILType Type +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILType get_Type() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: Int32 Idx +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: Int32 get_Idx() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: InterfaceImpl Create(ILType) +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: InterfaceImpl Create(ILType, ILAttributesStored) +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: System.String ToString() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: Void .ctor(Int32, ILType, ILAttributesStored) +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: Void set_CustomAttrsStored(ILAttributesStored) FSharp.Compiler.AbstractIL.IL+MethodBody+IL: Internal.Utilities.Library.InterruptibleLazy`1[FSharp.Compiler.AbstractIL.IL+ILMethodBody] Item FSharp.Compiler.AbstractIL.IL+MethodBody+IL: Internal.Utilities.Library.InterruptibleLazy`1[FSharp.Compiler.AbstractIL.IL+ILMethodBody] get_Item() FSharp.Compiler.AbstractIL.IL+MethodBody+PInvoke: System.Lazy`1[FSharp.Compiler.AbstractIL.IL+PInvokeMethod] Item @@ -1909,6 +1921,7 @@ FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeInit FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeRef FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeSpec FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILVersionInfo +FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+InterfaceImpl FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+MethodBody FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+PublicKey FSharp.Compiler.AbstractIL.IL: ILAttributes emptyILCustomAttrs @@ -1957,6 +1970,8 @@ FSharp.Compiler.AbstractIL.IL: ILTypeDefs mkILTypeDefsComputed(Microsoft.FSharp. FSharp.Compiler.AbstractIL.IL: ILTypeDefs mkILTypeDefsFromArray(ILTypeDef[]) 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.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 3ae2414fc07..543c92ef5cc 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[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType]], 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], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]]]) +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: ILTypeDefAccess Access FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefAccess get_Access() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefLayout Layout @@ -1574,20 +1574,18 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefs NestedTypes FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefs get_NestedTypes() 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: 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.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType] Implements -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType] get_Implements() 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: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]] ImplementsCustomAttrs -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]] get_ImplementsCustomAttrs() 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, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]], 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], 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 @@ -1773,6 +1771,20 @@ FSharp.Compiler.AbstractIL.IL+ILVersionInfo: UInt16 get_Major() FSharp.Compiler.AbstractIL.IL+ILVersionInfo: UInt16 get_Minor() FSharp.Compiler.AbstractIL.IL+ILVersionInfo: UInt16 get_Revision() FSharp.Compiler.AbstractIL.IL+ILVersionInfo: Void .ctor(UInt16, UInt16, UInt16, UInt16) +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributes CustomAttrs +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributes get_CustomAttrs() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributesStored CustomAttrsStored +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributesStored CustomAttrsStored@ +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributesStored get_CustomAttrsStored() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILType Type +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILType get_Type() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: Int32 Idx +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: Int32 get_Idx() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: InterfaceImpl Create(ILType) +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: InterfaceImpl Create(ILType, ILAttributesStored) +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: System.String ToString() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: Void .ctor(Int32, ILType, ILAttributesStored) +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: Void set_CustomAttrsStored(ILAttributesStored) FSharp.Compiler.AbstractIL.IL+MethodBody+IL: Internal.Utilities.Library.InterruptibleLazy`1[FSharp.Compiler.AbstractIL.IL+ILMethodBody] Item FSharp.Compiler.AbstractIL.IL+MethodBody+IL: Internal.Utilities.Library.InterruptibleLazy`1[FSharp.Compiler.AbstractIL.IL+ILMethodBody] get_Item() FSharp.Compiler.AbstractIL.IL+MethodBody+PInvoke: System.Lazy`1[FSharp.Compiler.AbstractIL.IL+PInvokeMethod] Item @@ -1909,6 +1921,7 @@ FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeInit FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeRef FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeSpec FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILVersionInfo +FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+InterfaceImpl FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+MethodBody FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+PublicKey FSharp.Compiler.AbstractIL.IL: ILAttributes emptyILCustomAttrs @@ -1957,6 +1970,8 @@ FSharp.Compiler.AbstractIL.IL: ILTypeDefs mkILTypeDefsComputed(Microsoft.FSharp. FSharp.Compiler.AbstractIL.IL: ILTypeDefs mkILTypeDefsFromArray(ILTypeDef[]) 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.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 9ce34ec9be7..ed245117916 100644 --- a/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs @@ -115,7 +115,7 @@ type PreTypeDefData = mkILMethods [] let typeAttributes = TypeAttributes.Public - ILTypeDef(this.Name, typeAttributes, ILTypeDefLayout.Auto, [], None, [], + ILTypeDef(this.Name, typeAttributes, ILTypeDefLayout.Auto, emptyILInterfaceImpls, [], None, methodsDefs, mkILTypeDefs [], mkILFields [], emptyILMethodImpls, mkILEvents [], mkILProperties [], ILTypeDefAdditionalFlags.None, emptyILSecurityDecls, emptyILCustomAttrsStored)