From b6aa1399005f6311b01d9ff16e7368a18b70758b Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Tue, 14 Feb 2023 14:04:13 -0800 Subject: [PATCH 1/9] Generate IsReadOnlyAttribute for platforms without it. --- .gitignore | 13 + src/Compiler/AbstractIL/il.fs | 5 + src/Compiler/AbstractIL/il.fsi | 1 + src/Compiler/CodeGen/IlxGen.fs | 27 +- src/Compiler/Driver/CompilerImports.fs | 15 +- src/Compiler/Driver/CompilerOptions.fs | 10 +- src/Compiler/Driver/CreateILModule.fs | 5 +- src/Compiler/TypedTree/TcGlobals.fs | 110 ++++- .../EmittedIL/Misc/Misc.fs | 36 +- .../EmittedIL/Misc/Structs02.fs.il.debug.bsl | 5 +- .../Misc/Structs02.fs.il.release.bsl | 75 ++-- .../Misc/Structs02_asNetStandard20.fs | 18 + .../Structs02_asNetStandard20.fs.il.debug.bsl | 408 ++++++++++++++++++ ...tructs02_asNetStandard20.fs.il.release.bsl | 375 ++++++++++++++++ .../FloatsAndDoubles.fs.il.debug.bsl | 6 +- .../FloatsAndDoubles.fs.il.release.bsl | 292 ++++++------- tests/FSharp.Test.Utilities/Compiler.fs | 19 +- tests/FSharp.Test.Utilities/CompilerAssert.fs | 83 ++-- .../DirectoryAttribute.fs | 4 +- .../FSharp.Test.Utilities.fsproj | 5 +- tests/FSharp.Test.Utilities/Utilities.fs | 120 ++++-- .../CodeGen/EmittedIL/StaticLinkTests.fs | 3 +- .../Compiler/Service/MultiProjectTests.fs | 4 +- 23 files changed, 1319 insertions(+), 320 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.debug.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.release.bsl diff --git a/.gitignore b/.gitignore index 78418b2b36..875098dae1 100644 --- a/.gitignore +++ b/.gitignore @@ -125,3 +125,16 @@ nCrunchTemp_* tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.actual *.vsp +/Z.fs +/Y.fs +/X.fs +/Library.fs +/Ghost.fs +/D.fsi +/D.fs +/C.fsi +/C.fs +/B.fsi +/B.fs +/A.fsi +/A.fs diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index 2470c7ae21..1504c4f2fd 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -3274,6 +3274,9 @@ let destILArrTy ty = // Sigs of special types built-in // -------------------------------------------------------------------- +[] +let tname_Attribute = "System.Attribute" + [] let tname_Object = "System.Object" @@ -3347,6 +3350,8 @@ type ILGlobals(primaryScopeRef: ILScopeRef, equivPrimaryAssemblyRefs: ILAssembly member x.primaryAssemblyName = x.primaryAssemblyRef.Name + member val typ_Attribute = mkILBoxedType (mkILNonGenericTySpec (mkSysILTypeRef tname_Attribute)) + member val typ_Object = mkILBoxedType (mkILNonGenericTySpec (mkSysILTypeRef tname_Object)) member val typ_String = mkILBoxedType (mkILNonGenericTySpec (mkSysILTypeRef tname_String)) diff --git a/src/Compiler/AbstractIL/il.fsi b/src/Compiler/AbstractIL/il.fsi index cf4400582c..ef467fa973 100644 --- a/src/Compiler/AbstractIL/il.fsi +++ b/src/Compiler/AbstractIL/il.fsi @@ -1815,6 +1815,7 @@ type internal ILGlobals = member primaryAssemblyScopeRef: ILScopeRef member primaryAssemblyRef: ILAssemblyRef member primaryAssemblyName: string + member typ_Attribute: ILType member typ_Object: ILType member typ_String: ILType member typ_Type: ILType diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index f130a63fa6..2a821d65a7 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -610,16 +610,10 @@ type PtrsOK = | PtrTypesNotOK let GenReadOnlyAttribute (g: TcGlobals) = - mkILCustomAttribute (g.attrib_IsReadOnlyAttribute.TypeRef, [], [], []) + g.AddEmbeddableSystemAttribute(g.attrib_IsReadOnlyAttribute.TypeRef, [], [], []) let GenReadOnlyAttributeIfNecessary (g: TcGlobals) ty = - let add = - false - && g.isSystem_Runtime_CompilerServices_IsReadOnlyAttributeAvailable - && isInByrefTy g ty - && g.attrib_IsReadOnlyAttribute.TyconRef.CanDeref - - if add then + if isInByrefTy g ty then let attr = GenReadOnlyAttribute g Some attr else @@ -2088,15 +2082,7 @@ type AnonTypeGenerationTable() = let ilMethods = [ for propName, fldName, fldTy in flds -> - let attrs = - if - false - && g.isSystem_Runtime_CompilerServices_IsReadOnlyAttributeAvailable - && isStruct - then - [ GenReadOnlyAttribute g ] - else - [] + let attrs = if isStruct then [ GenReadOnlyAttribute g ] else [] mkLdfldMethodDef ("get_" + propName, ILMemberAccess.Public, false, ilTy, fldName, fldTy, attrs) |> g.AddMethodGeneratedAttributes @@ -10897,12 +10883,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) = let isStruct = isStructTyconRef tcref let attrs = - if - false - && g.isSystem_Runtime_CompilerServices_IsReadOnlyAttributeAvailable - && isStruct - && not isStatic - then + if isStruct && not isStatic then [ GenReadOnlyAttribute g ] else [] diff --git a/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs index 2b6fc09a65..fe1d608191 100644 --- a/src/Compiler/Driver/CompilerImports.fs +++ b/src/Compiler/Driver/CompilerImports.fs @@ -1163,7 +1163,7 @@ and [] TcImports | ResolvedCcu ccu -> Some ccu | UnresolvedCcu _ -> None - static let ccuHasType (ccu: CcuThunk) (nsname: string list) (tname: string) = + static let ccuHasType (ccu: CcuThunk) (nsname: string list) (tname: string) (publicOnly: bool) = let matchNameSpace (entityOpt: Entity option) n = match entityOpt with | None -> None @@ -1172,7 +1172,14 @@ and [] TcImports match (Some ccu.Contents, nsname) ||> List.fold matchNameSpace with | Some ns -> match Map.tryFind tname ns.ModuleOrNamespaceType.TypesByMangledName with - | Some _ -> true + | Some e -> + if publicOnly then + match e.TypeReprInfo with + | TILObjectRepr data -> + let (TILObjectReprData(_, _, tyDef)) = data + not (tyDef.Access = ILTypeDefAccess.Public) + | _ -> true + else true | None -> false | None -> false @@ -2461,8 +2468,8 @@ and [] TcImports ccu |] - let tryFindSysTypeCcu path typeName = - sysCcus |> Array.tryFind (fun ccu -> ccuHasType ccu path typeName) + let tryFindSysTypeCcu path typeName publicOnly = + sysCcus |> Array.tryFind (fun ccu -> ccuHasType ccu path typeName publicOnly) let ilGlobals = mkILGlobals (primaryScopeRef, equivPrimaryAssemblyRefs, fsharpCoreAssemblyScopeRef) diff --git a/src/Compiler/Driver/CompilerOptions.fs b/src/Compiler/Driver/CompilerOptions.fs index f74c049d3d..59ab3f396c 100644 --- a/src/Compiler/Driver/CompilerOptions.fs +++ b/src/Compiler/Driver/CompilerOptions.fs @@ -331,25 +331,25 @@ let ParseCompilerOptions (collectOtherArgument: string -> unit, blocks: Compiler let rec processArg args = match args with | [] -> () - | rsp: string :: t when rsp.StartsWithOrdinal("@") -> + | opt: string :: t when opt.StartsWithOrdinal("@") -> let responseFileOptions = let fullpath = try - Some(rsp.TrimStart('@') |> FileSystem.GetFullPathShim) + Some(opt.TrimStart('@') |> FileSystem.GetFullPathShim) with _ -> None match fullpath with | None -> - errorR (Error(FSComp.SR.optsResponseFileNameInvalid rsp, rangeCmdArgs)) + errorR (Error(FSComp.SR.optsResponseFileNameInvalid opt, rangeCmdArgs)) [] | Some path when not (FileSystem.FileExistsShim path) -> - errorR (Error(FSComp.SR.optsResponseFileNotFound (rsp, path), rangeCmdArgs)) + errorR (Error(FSComp.SR.optsResponseFileNotFound (opt, path), rangeCmdArgs)) [] | Some path -> match ResponseFile.parseFile path with | Choice2Of2 _ -> - errorR (Error(FSComp.SR.optsInvalidResponseFile (rsp, path), rangeCmdArgs)) + errorR (Error(FSComp.SR.optsInvalidResponseFile (opt, path), rangeCmdArgs)) [] | Choice1Of2 rspData -> let onlyOptions l = diff --git a/src/Compiler/Driver/CreateILModule.fs b/src/Compiler/Driver/CreateILModule.fs index 60c588263e..95a60326df 100644 --- a/src/Compiler/Driver/CreateILModule.fs +++ b/src/Compiler/Driver/CreateILModule.fs @@ -286,7 +286,7 @@ module MainModuleBuilder = ( ctok, tcConfig: TcConfig, - tcGlobals, + tcGlobals: TcGlobals, tcImports: TcImports, pdbfile, assemblyName, @@ -304,8 +304,7 @@ module MainModuleBuilder = RequireCompilationThread ctok let ilTypeDefs = - //let topTypeDef = mkILTypeDefForGlobalFunctions tcGlobals.ilg (mkILMethods [], emptyILFields) - mkILTypeDefs codegenResults.ilTypeDefs + mkILTypeDefs (codegenResults.ilTypeDefs @ tcGlobals.embeddedTypeDefs) let mainModule = let hashAlg = diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs index d45349f954..cc58ab8fc9 100755 --- a/src/Compiler/TypedTree/TcGlobals.fs +++ b/src/Compiler/TypedTree/TcGlobals.fs @@ -12,6 +12,7 @@ open System.Collections.Concurrent open System.Diagnostics open Internal.Utilities.Library +open Internal.Utilities.Library.Extras open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AbstractIL.ILX open FSharp.Compiler.CompilerGlobalState @@ -102,6 +103,23 @@ let mk_MFCompilerServices_tcref ccu n = mkNonLocalTyconRef2 ccu CompilerServices let mk_MFRuntimeHelpers_tcref ccu n = mkNonLocalTyconRef2 ccu RuntimeHelpersPath n let mk_MFControl_tcref ccu n = mkNonLocalTyconRef2 ccu ControlPathArray n +let mkLocalPrivateAttributeWithDefaultConstructor (ilg: ILGlobals, name: string) = + let ctor = mkILNonGenericEmptyCtor (ilg.typ_Attribute, None, None) + + mkILGenericClass ( + name, + ILTypeDefAccess.Private, + ILGenericParameterDefs.Empty, + ilg.typ_Attribute, + ILTypes.Empty, + mkILMethods [ ctor ], + emptyILFields, + emptyILTypeDefs, + emptyILProperties, + emptyILEvents, + emptyILCustomAttrs, + ILTypeInit.BeforeField + ) type [] @@ -184,6 +202,8 @@ let tname_IAsyncResult = "System.IAsyncResult" [] let tname_IsByRefLikeAttribute = "System.Runtime.CompilerServices.IsByRefLikeAttribute" + + //------------------------------------------------------------------------- // Table of all these "globals" //------------------------------------------------------------------------- @@ -197,12 +217,18 @@ type TcGlobals( isInteractive: bool, useReflectionFreeCodeGen: bool, // The helper to find system types amongst referenced DLLs - tryFindSysTypeCcu, + tryFindSysTypeCcuHelper, emitDebugInfoInQuotations: bool, noDebugAttributes: bool, pathMap: PathMap, langVersion: LanguageVersion) = + let tryFindSysTypeCcu path nm = + tryFindSysTypeCcuHelper path nm false + + let tryFindPublicSysTypeCcu path nm = + tryFindSysTypeCcuHelper path nm true + let vara = Construct.NewRigidTypar "a" envRange let varb = Construct.NewRigidTypar "b" envRange let varc = Construct.NewRigidTypar "c" envRange @@ -249,17 +275,19 @@ type TcGlobals( let v_puint16_tcr = mk_MFCore_tcref fslibCcu "uint16`1" let v_puint64_tcr = mk_MFCore_tcref fslibCcu "uint64`1" let v_punativeint_tcr = mk_MFCore_tcref fslibCcu "unativeint`1" - let v_byref_tcr = mk_MFCore_tcref fslibCcu "byref`1" + let v_byref_tcr = mk_MFCore_tcref fslibCcu "byref`1" let v_byref2_tcr = mk_MFCore_tcref fslibCcu "byref`2" let v_outref_tcr = mk_MFCore_tcref fslibCcu "outref`1" - let v_inref_tcr = mk_MFCore_tcref fslibCcu "inref`1" - let v_nativeptr_tcr = mk_MFCore_tcref fslibCcu "nativeptr`1" - let v_voidptr_tcr = mk_MFCore_tcref fslibCcu "voidptr" - let v_ilsigptr_tcr = mk_MFCore_tcref fslibCcu "ilsigptr`1" - let v_fastFunc_tcr = mk_MFCore_tcref fslibCcu "FSharpFunc`2" + let v_inref_tcr = mk_MFCore_tcref fslibCcu "inref`1" + let v_nativeptr_tcr = mk_MFCore_tcref fslibCcu "nativeptr`1" + let v_voidptr_tcr = mk_MFCore_tcref fslibCcu "voidptr" + let v_ilsigptr_tcr = mk_MFCore_tcref fslibCcu "ilsigptr`1" + let v_fastFunc_tcr = mk_MFCore_tcref fslibCcu "FSharpFunc`2" let v_refcell_tcr_canon = mk_MFCore_tcref fslibCcu "Ref`1" let v_refcell_tcr_nice = mk_MFCore_tcref fslibCcu "ref`1" - let v_mfe_tcr = mk_MFCore_tcref fslibCcu "MatchFailureException" + let v_mfe_tcr = mk_MFCore_tcref fslibCcu "MatchFailureException" + + let mutable embeddedILTypeDefs = ConcurrentDictionary() let dummyAssemblyNameCarryingUsefulErrorInformation path typeName = FSComp.SR.tcGlobalsSystemTypeNotFound (String.concat "." path + "." + typeName) @@ -280,7 +308,7 @@ type TcGlobals( let ccu = findSysTypeCcu path nm mkNonLocalTyconRef2 ccu (Array.ofList path) nm - let findSysILTypeRef (nm:string) = + let findSysILTypeRef nm = let path, typeName = splitILTypeName nm let scoref = match tryFindSysTypeCcu path typeName with @@ -288,21 +316,61 @@ type TcGlobals( | Some ccu -> ccu.ILScopeRef mkILTyRef (scoref, nm) - let tryFindSysILTypeRef (nm:string) = + let tryFindSysILTypeRef nm = let path, typeName = splitILTypeName nm tryFindSysTypeCcu path typeName |> Option.map (fun ccu -> mkILTyRef (ccu.ILScopeRef, nm)) - let findSysAttrib (nm:string) = + let findSysAttrib nm = let tref = findSysILTypeRef nm let path, typeName = splitILTypeName nm AttribInfo(tref, findSysTyconRef path typeName) let tryFindSysAttrib nm = let path, typeName = splitILTypeName nm + + // System Attributes must be public types. match tryFindSysTypeCcu path typeName with | Some _ -> Some (findSysAttrib nm) | None -> None + let findPublicSysAttrib nm = + let path, typeName = splitILTypeName nm + let ccu = + match tryFindPublicSysTypeCcu path typeName with + | None -> CcuThunk.CreateDelayed(dummyAssemblyNameCarryingUsefulErrorInformation path typeName) + | Some ccu -> ccu + let tref = + let scoref = + match tryFindSysTypeCcu path typeName with + | None -> ILScopeRef.Assembly (mkSimpleAssemblyRef (dummyAssemblyNameCarryingUsefulErrorInformation path typeName)) + | Some ccu -> ccu.ILScopeRef + mkILTyRef (scoref, nm) + let tcref = mkNonLocalTyconRef2 ccu (Array.ofList path) nm + AttribInfo(tref, tcref) + + let findOrEmbedSysPublicAttribute nm = + let sysAttrib = findPublicSysAttrib nm + if sysAttrib.TyconRef.CanDeref then + sysAttrib + else + let attrRef = ILTypeRef.Create(ILScopeRef.Local, [], nm) + let attrTycon = + Construct.NewTycon( + Some (CompPath(ILScopeRef.Local, [])), + attrRef.Name, + range0, + taccessInternal, + taccessInternal, + TyparKind.Type, + LazyWithContext.NotLazy [], + FSharp.Compiler.Xml.XmlDoc.Empty, + false, + false, + false, + MaybeLazy.Strict(Construct.NewEmptyModuleOrNamespaceType ModuleOrType) + ) + AttribInfo(attrRef, mkLocalTyconRef attrTycon) + let mkSysNonGenericTy path n = mkNonGenericTy(findSysTyconRef path n) let tryMkSysNonGenericTy path n = tryFindSysTyconRef path n |> Option.map mkNonGenericTy @@ -811,7 +879,7 @@ type TcGlobals( let v_check_this_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "CheckThis" , None , None , [vara], ([[varaTy]], varaTy)) let v_quote_to_linq_lambda_info = makeIntrinsicValRef(fslib_MFLinqRuntimeHelpersQuotationConverter_nleref, "QuotationToLambdaExpression" , None , None , [vara], ([[mkQuotedExprTy varaTy]], mkLinqExpressionTy varaTy)) - let tref_DebuggableAttribute = findSysILTypeRef tname_DebuggableAttribute + let tref_DebuggableAttribute = findSysILTypeRef tname_DebuggableAttribute let tref_CompilerGeneratedAttribute = findSysILTypeRef tname_CompilerGeneratedAttribute let tref_InternalsVisibleToAttribute = findSysILTypeRef tname_InternalsVisibleToAttribute @@ -821,6 +889,12 @@ type TcGlobals( let mkCompilerGeneratedAttribute () = mkILCustomAttribute (tref_CompilerGeneratedAttribute, [], [], []) let compilerGlobalState = CompilerGlobalState() + // Todo: Review mkILCustomAttribute throughout fsc/fsi/ fcs to ensure that we use embedable attributes where appropriate + let addEmbeddableCustomAttribute (tref: ILTypeRef, argTys, argvs, propvs) = + if tref.Scope = ILScopeRef.Local && not(embeddedILTypeDefs.ContainsKey(tref.Name)) then + embeddedILTypeDefs.TryAdd(tref.Name, mkLocalPrivateAttributeWithDefaultConstructor (ilg, tref.Name)) |> ignore + mkILCustomAttribute (tref, argTys, argvs, propvs) + // Requests attributes to be added to compiler generated methods. let addGeneratedAttrs (attrs: ILAttributes) = let attribs = @@ -998,6 +1072,8 @@ type TcGlobals( member _.ilg = ilg + member _.embeddedTypeDefs = embeddedILTypeDefs.Values |> Seq.toList + // A table of all intrinsics that the compiler cares about member _.knownIntrinsics = v_knownIntrinsics @@ -1164,6 +1240,8 @@ type TcGlobals( member val ArrayCollector_tcr = mk_MFCompilerServices_tcref fslibCcu "ArrayCollector`1" + member g.AddEmbeddableSystemAttribute (tref: ILTypeRef, argTys, argvs, propvs) = addEmbeddableCustomAttribute (tref, argTys, argvs, propvs) + member g.mk_GeneratedSequenceBase_ty seqElemTy = TType_app(g.seq_base_tcr,[seqElemTy], v_knownWithoutNull) member val ResumableStateMachine_tcr = mk_MFCompilerServices_tcref fslibCcu "ResumableStateMachine`1" @@ -1242,7 +1320,8 @@ type TcGlobals( member val exn_ty = mkNonGenericTy v_exn_tcr member val float_ty = v_float_ty member val float32_ty = v_float32_ty - /// Memoization table to help minimize the number of ILSourceDocument objects we create + + /// Memoization table to help minimize the number of ILSourceDocument objects we create member _.memoize_file x = v_memoize_file.Apply x member val system_Array_ty = mkSysNonGenericTy sys "Array" @@ -1347,8 +1426,6 @@ type TcGlobals( member val iltyp_RuntimeMethodHandle = findSysILTypeRef tname_RuntimeMethodHandle |> mkILNonGenericValueTy member val iltyp_RuntimeTypeHandle = findSysILTypeRef tname_RuntimeTypeHandle |> mkILNonGenericValueTy member val iltyp_ReferenceAssemblyAttributeOpt = tryFindSysILTypeRef tname_ReferenceAssemblyAttribute |> Option.map mkILNonGenericBoxedTy - - member val attrib_AttributeUsageAttribute = findSysAttrib "System.AttributeUsageAttribute" member val attrib_ParamArrayAttribute = findSysAttrib "System.ParamArrayAttribute" member val attrib_IDispatchConstantAttribute = tryFindSysAttrib "System.Runtime.CompilerServices.IDispatchConstantAttribute" @@ -1356,8 +1433,7 @@ type TcGlobals( // We use 'findSysAttrib' here because lookup on attribute is done by name comparison, and can proceed // even if the type is not found in a system assembly. - member val attrib_IsReadOnlyAttribute = findSysAttrib "System.Runtime.CompilerServices.IsReadOnlyAttribute" - + member val attrib_IsReadOnlyAttribute = findOrEmbedSysPublicAttribute "System.Runtime.CompilerServices.IsReadOnlyAttribute" member val attrib_SystemObsolete = findSysAttrib "System.ObsoleteAttribute" member val attrib_DllImportAttribute = tryFindSysAttrib "System.Runtime.InteropServices.DllImportAttribute" member val attrib_StructLayoutAttribute = findSysAttrib "System.Runtime.InteropServices.StructLayoutAttribute" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Misc.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Misc.fs index 12df8ad0d8..b210b9e9c7 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Misc.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Misc.fs @@ -10,7 +10,6 @@ module Misc = let verifyCompilation compilation = compilation |> withOptions [ "--test:EmitFeeFeeAs100001" ] - |> asExe |> withNoOptimize |> withEmbeddedPdb |> withEmbedAllSource @@ -21,108 +20,126 @@ module Misc = [] let ``AnonRecd_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=CodeGenRenamings01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd CodeGenRenamings01.exe" # CodeGenRenamings01.fs - [] let ``CodeGenRenamings01_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=ArgumentNamesInClosures01.fs SCFLAGS="-a -g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ArgumentNamesInClosures01.dll" # ArgumentNamesInClosures01.fs - [] let ``ArgumentNamesInClosures01_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=Decimal01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Decimal01.exe" # Decimal01.fs [] let ``Decimal01_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=EntryPoint01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd EntryPoint01.exe" # EntryPoint01.fs [] let ``EntryPoint01_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=EqualsOnUnions01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd EqualsOnUnions01.exe" # EqualsOnUnions01.fs - [] let ``EqualsOnUnions01_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=ForLoop01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ForLoop01.exe" # ForLoop01.fs - [] let ``ForLoop01_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=ForLoop02.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ForLoop02.exe" # ForLoop02.fs [] let ``ForLoop02_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=ForLoop03.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ForLoop03.exe" # ForLoop03.fs [] let ``ForLoop03_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=NoBoxingOnDispose01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd NoBoxingOnDispose01.exe" # NoBoxingOnDispose01.fs [] let ``NoBoxingOnDispose01_fs`` compilation = compilation + |> asExe |> verifyCompilation //SOURCE=IfThenElse01.fs SCFLAGS="-a -g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd IfThenElse01.dll" # IfThenElse01.fs [] let ``IfThenElse01_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=LetIfThenElse01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd LetIfThenElse01.exe" # LetIfThenElse01.fs - [] let ``LetIfThenElse01_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=Lock01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Lock01.exe" # Lock01.fs - [] let ``Lock01_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=ModuleWithExpression01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ModuleWithExpression01.exe" # ModuleWithExpression01.fs [] let ``ModuleWithExpression01_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=NonEscapingArguments02.fs SCFLAGS="-a -g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd NonEscapingArguments02.dll" # NonEscapingArguments02.fs [] let ``NonEscapingArguments02_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=Seq_for_all01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Seq_for_all01.exe" # Seq_for_all01.fs [] let ``Seq_for_all01_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=StructsAsArrayElements01.fs SCFLAGS="-a -g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd StructsAsArrayElements01.dll" # StructsAsArrayElements01.fs - [] let ``StructsAsArrayElements01_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=PreserveSig.fs SCFLAGS="-a -g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd PreserveSig.dll" # PreserveSig.fs - [] let ``PreserveSig_fs`` compilation = compilation + |> asExe |> verifyCompilation // # The name of this test is a bit misleading for legacy reasons: it used to test the --no-generate-filter-blocks option, which is now gone @@ -130,58 +147,75 @@ module Misc = [] let ``TryWith_NoFilterBlocks01_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=Structs01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Structs01.exe" # Structs01.fs - [] let ``Structs01_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=Structs02.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Structs02.exe" # Structs02.fs - [] let ``Structs02_fs`` compilation = compilation + |> asExe |> verifyCompilation + [] + let ``Structs02_asNetStandard20_fs`` compilation = + compilation + |>asLibrary + |>asNetStandard20 + |>verifyCompilation + // SOURCE=Marshal.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Marshal.exe" # Marshal.fs [] let ``Marshal_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=MethodImplNoInline.fs SCFLAGS="-O" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd MethodImplNoInline.exe" # MethodImplNoInline.fs [] let ``MethodImplNoInline_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=MethodImplNoInline02.fs SCFLAGS="-O" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd MethodImplNoInline02.exe" # MethodImplNoInline02.fs [] let ``MethodImplNoInline02_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=CustomAttributeGenericParameter01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd CustomAttributeGenericParameter01.exe" # CustomAttributeGenericParameter01.fs - [] let ``CustomAttributeGenericParameter01_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=GenericTypeStaticField.fs SCFLAGS="-g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd GenericTypeStaticField.exe" # GenericTypeStaticField.fs - [] let ``GenericTypeStaticField_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=GeneralizationOnUnions01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd GeneralizationOnUnions01.exe" # GeneralizationOnUnions01.fs [] let ``GeneralizationOnUnions01_fs`` compilation = compilation + |> asExe |> verifyCompilation // SOURCE=AbstractClass.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd AbstractClass.exe" # AbstractClass.fs [] let ``AbstractClass_fs`` compilation = compilation + |> asExe |> verifyCompilation diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.debug.bsl index 0d829bd476..4537f5e078 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.debug.bsl @@ -37,13 +37,13 @@ // WARNING: managed resource file FSharpOptimizationData.Structs02 created } .module Structs02.exe -// MVID: {63E6EA31-BE14-39D7-A745-038331EAE663} +// MVID: {63EB287E-BE14-39D7-A745-03837E28EB63} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x000002A17A200000 +// Image base: 0x0000013176FA0000 // =============== CLASS MEMBERS DECLARATION =================== @@ -66,6 +66,7 @@ .method public hidebysig specialname instance int32 get_hash() cil managed { + .custom instance void [mscorlib]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) // Code size 7 (0x7) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.release.bsl index 58df8fea49..0a16a6bca1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.release.bsl @@ -4,10 +4,10 @@ // Metadata version: v4.0.30319 -.assembly extern System.Runtime +.assembly extern mscorlib { - .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: - .ver 7:0:0:0 + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 } .assembly extern FSharp.Core { @@ -21,44 +21,44 @@ int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) // --- The following custom attribute is added automatically, do not uncomment ------- - // .custom instance void [System.Runtime]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 01 00 00 00 00 ) + // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 01 00 00 00 00 ) .hash algorithm 0x00008004 .ver 0:0:0:0 } .mresource public FSharpSignatureData.Structs02 { - // Offset: 0x00000000 Length: 0x000007B3 + // Offset: 0x00000000 Length: 0x000007B6 // WARNING: managed resource file FSharpSignatureData.Structs02 created } .mresource public FSharpOptimizationData.Structs02 { - // Offset: 0x000007B8 Length: 0x0000023D + // Offset: 0x000007C0 Length: 0x00000237 // WARNING: managed resource file FSharpOptimizationData.Structs02 created } .module Structs02.exe -// MVID: {63DBF1DE-9F75-7AA4-A745-0383DEF1DB63} +// MVID: {63EB2A5A-BE14-39D7-A745-03835A2AEB63} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x0000024203AB0000 +// Image base: 0x000001FDA5220000 // =============== CLASS MEMBERS DECLARATION =================== .class public abstract auto ansi sealed Experiment.Test - extends [System.Runtime]System.Object + extends [mscorlib]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) .class sequential ansi serializable sealed nested public Repro - extends [System.Runtime]System.ValueType - implements class [System.Runtime]System.IEquatable`1, - [System.Runtime]System.Collections.IStructuralEquatable, - class [System.Runtime]System.IComparable`1, - [System.Runtime]System.IComparable, - [System.Runtime]System.Collections.IStructuralComparable + extends [mscorlib]System.ValueType + implements class [mscorlib]System.IEquatable`1, + [mscorlib]System.Collections.IStructuralEquatable, + class [mscorlib]System.IComparable`1, + [mscorlib]System.IComparable, + [mscorlib]System.Collections.IStructuralComparable { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) @@ -66,8 +66,9 @@ .method public hidebysig specialname instance int32 get_hash() cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 @@ -78,16 +79,16 @@ .method public hidebysig virtual final instance int32 CompareTo(valuetype Experiment.Test/Repro obj) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 33 (0x21) .maxstack 5 .locals init (valuetype Experiment.Test/Repro& V_0, - class [System.Runtime]System.Collections.IComparer V_1, + class [mscorlib]System.Collections.IComparer V_1, int32 V_2, int32 V_3) IL_0000: ldarga.s obj IL_0002: stloc.0 - IL_0003: call class [System.Runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0003: call class [mscorlib]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() IL_0008: stloc.1 IL_0009: ldarg.0 IL_000a: ldfld int32 Experiment.Test/Repro::hash@ @@ -108,7 +109,7 @@ .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 13 (0xd) .maxstack 8 IL_0000: ldarg.0 @@ -120,14 +121,14 @@ .method public hidebysig virtual final instance int32 CompareTo(object obj, - class [System.Runtime]System.Collections.IComparer comp) cil managed + class [mscorlib]System.Collections.IComparer comp) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 39 (0x27) .maxstack 5 .locals init (valuetype Experiment.Test/Repro V_0, valuetype Experiment.Test/Repro& V_1, - class [System.Runtime]System.Collections.IComparer V_2, + class [mscorlib]System.Collections.IComparer V_2, int32 V_3, int32 V_4) IL_0000: ldarg.1 @@ -154,13 +155,13 @@ } // end of method Repro::CompareTo .method public hidebysig virtual final - instance int32 GetHashCode(class [System.Runtime]System.Collections.IEqualityComparer comp) cil managed + instance int32 GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 27 (0x1b) .maxstack 7 .locals init (int32 V_0, - class [System.Runtime]System.Collections.IEqualityComparer V_1) + class [mscorlib]System.Collections.IEqualityComparer V_1) IL_0000: ldc.i4.0 IL_0001: stloc.0 IL_0002: ldc.i4 0x9e3779b9 @@ -185,26 +186,26 @@ .method public hidebysig virtual final instance int32 GetHashCode() cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 12 (0xc) .maxstack 8 IL_0000: ldarg.0 - IL_0001: call class [System.Runtime]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() - IL_0006: call instance int32 Experiment.Test/Repro::GetHashCode(class [System.Runtime]System.Collections.IEqualityComparer) + IL_0001: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: call instance int32 Experiment.Test/Repro::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) IL_000b: ret } // end of method Repro::GetHashCode .method public hidebysig virtual final instance bool Equals(object obj, - class [System.Runtime]System.Collections.IEqualityComparer comp) cil managed + class [mscorlib]System.Collections.IEqualityComparer comp) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 42 (0x2a) .maxstack 4 .locals init (object V_0, valuetype Experiment.Test/Repro V_1, valuetype Experiment.Test/Repro& V_2, - class [System.Runtime]System.Collections.IEqualityComparer V_3) + class [mscorlib]System.Collections.IEqualityComparer V_3) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -277,7 +278,7 @@ .method public hidebysig virtual final instance bool Equals(valuetype Experiment.Test/Repro obj) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 18 (0x12) .maxstack 4 .locals init (valuetype Experiment.Test/Repro& V_0) @@ -294,7 +295,7 @@ .method public hidebysig virtual final instance bool Equals(object obj) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 30 (0x1e) .maxstack 4 .locals init (object V_0, @@ -343,7 +344,7 @@ } // end of class Experiment.Test .class private abstract auto ansi sealed '.$Experiment'.Test - extends [System.Runtime]System.Object + extends [mscorlib]System.Object { .method public static void main@() cil managed { @@ -359,4 +360,4 @@ // ============================================================= // *********** DISASSEMBLY COMPLETE *********************** -// WARNING: Created Win32 resource file D:\code\FS\fsharp\artifacts\bin\FSharp.Compiler.ComponentTests\Release\net7.0\tests\EmittedIL\Misc\Structs02_fs\Structs02.res +// WARNING: Created Win32 resource file C:\kevinransom\fsharp\artifacts\bin\FSharp.Compiler.ComponentTests\Release\net472\tests\EmittedIL\Misc\Structs02_fs\Structs02.res diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs new file mode 100644 index 0000000000..83fdc82675 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs @@ -0,0 +1,18 @@ +// regression test for 767815: Invalid code is generated when using field initializers in struct constructor + +module Experiment.Test + +[] +type Repro = + val hash : int + new(length) = + { hash = + let mutable h = 0 + for i=0 to length-1 do + h <- 26*h + h + } + +let test() = + let t = Repro(42) + t.hash \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.debug.bsl new file mode 100644 index 0000000000..0c84f18e77 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.debug.bsl @@ -0,0 +1,408 @@ + +// Microsoft (R) .NET IL Disassembler. Version 5.0.0-preview.7.20364.11 + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly extern netstandard +{ + .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) // .{...-.Q + .ver 2:0:0:0 +} +.assembly extern FSharp.Core +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: + .ver 7:0:0:0 +} +.assembly Structs02_asNetStandard20 +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + // --- The following custom attribute is added automatically, do not uncomment ------- + // .custom instance void [netstandard]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [netstandard]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 01 00 00 00 00 ) + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.Structs02_asNetStandard20 +{ + // Offset: 0x00000000 Length: 0x000007F5 + // WARNING: managed resource file FSharpSignatureData.Structs02_asNetStandard20 created +} +.mresource public FSharpOptimizationData.Structs02_asNetStandard20 +{ + // Offset: 0x00000800 Length: 0x0000024A + // WARNING: managed resource file FSharpOptimizationData.Structs02_asNetStandard20 created +} +.module Structs02_asNetStandard20.dll +// MVID: {63EC00CF-37AB-0DD0-A745-0383CF00EC63} +.imagebase 0x00400000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000001 // ILONLY +// Image base: 0x00000249F4B00000 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class public abstract auto ansi sealed Experiment.Test + extends [mscorlib]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class sequential ansi serializable sealed nested public Repro + extends [netstandard]System.ValueType + implements class [netstandard]System.IEquatable`1, + [netstandard]System.Collections.IStructuralEquatable, + class [netstandard]System.IComparable`1, + [netstandard]System.IComparable, + [netstandard]System.Collections.IStructuralComparable + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .field assembly int32 hash@ + .method public hidebysig specialname + instance int32 get_hash() cil managed + { + .custom instance void System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [netstandard]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 Experiment.Test/Repro::hash@ + IL_0006: ret + } // end of method Repro::get_hash + + .method public hidebysig virtual final + instance int32 CompareTo(valuetype Experiment.Test/Repro obj) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 46 (0x2e) + .maxstack 5 + .locals init (valuetype Experiment.Test/Repro& V_0, + class [netstandard]System.Collections.IComparer V_1, + int32 V_2, + int32 V_3, + class [netstandard]System.Collections.IComparer V_4, + int32 V_5, + int32 V_6) + IL_0000: ldarga.s obj + IL_0002: stloc.0 + IL_0003: call class [netstandard]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0008: stloc.1 + IL_0009: ldarg.0 + IL_000a: ldfld int32 Experiment.Test/Repro::hash@ + IL_000f: stloc.2 + IL_0010: ldloc.0 + IL_0011: ldfld int32 Experiment.Test/Repro::hash@ + IL_0016: stloc.3 + IL_0017: ldloc.1 + IL_0018: stloc.s V_4 + IL_001a: ldloc.2 + IL_001b: stloc.s V_5 + IL_001d: ldloc.3 + IL_001e: stloc.s V_6 + IL_0020: ldloc.s V_5 + IL_0022: ldloc.s V_6 + IL_0024: cgt + IL_0026: ldloc.s V_5 + IL_0028: ldloc.s V_6 + IL_002a: clt + IL_002c: sub + IL_002d: ret + } // end of method Repro::CompareTo + + .method public hidebysig virtual final + instance int32 CompareTo(object obj) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 13 (0xd) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: unbox.any Experiment.Test/Repro + IL_0007: call instance int32 Experiment.Test/Repro::CompareTo(valuetype Experiment.Test/Repro) + IL_000c: ret + } // end of method Repro::CompareTo + + .method public hidebysig virtual final + instance int32 CompareTo(object obj, + class [netstandard]System.Collections.IComparer comp) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 51 (0x33) + .maxstack 5 + .locals init (valuetype Experiment.Test/Repro V_0, + valuetype Experiment.Test/Repro& V_1, + class [netstandard]System.Collections.IComparer V_2, + int32 V_3, + int32 V_4, + class [netstandard]System.Collections.IComparer V_5, + int32 V_6, + int32 V_7) + IL_0000: ldarg.1 + IL_0001: unbox.any Experiment.Test/Repro + IL_0006: stloc.0 + IL_0007: ldloca.s V_0 + IL_0009: stloc.1 + IL_000a: ldarg.2 + IL_000b: stloc.2 + IL_000c: ldarg.0 + IL_000d: ldfld int32 Experiment.Test/Repro::hash@ + IL_0012: stloc.3 + IL_0013: ldloc.1 + IL_0014: ldfld int32 Experiment.Test/Repro::hash@ + IL_0019: stloc.s V_4 + IL_001b: ldloc.2 + IL_001c: stloc.s V_5 + IL_001e: ldloc.3 + IL_001f: stloc.s V_6 + IL_0021: ldloc.s V_4 + IL_0023: stloc.s V_7 + IL_0025: ldloc.s V_6 + IL_0027: ldloc.s V_7 + IL_0029: cgt + IL_002b: ldloc.s V_6 + IL_002d: ldloc.s V_7 + IL_002f: clt + IL_0031: sub + IL_0032: ret + } // end of method Repro::CompareTo + + .method public hidebysig virtual final + instance int32 GetHashCode(class [netstandard]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 31 (0x1f) + .maxstack 7 + .locals init (int32 V_0, + class [netstandard]System.Collections.IEqualityComparer V_1, + int32 V_2, + class [netstandard]System.Collections.IEqualityComparer V_3) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4 0x9e3779b9 + IL_0007: ldarg.1 + IL_0008: stloc.1 + IL_0009: ldarg.0 + IL_000a: ldfld int32 Experiment.Test/Repro::hash@ + IL_000f: stloc.2 + IL_0010: ldloc.1 + IL_0011: stloc.3 + IL_0012: ldloc.2 + IL_0013: ldloc.0 + IL_0014: ldc.i4.6 + IL_0015: shl + IL_0016: ldloc.0 + IL_0017: ldc.i4.2 + IL_0018: shr + IL_0019: add + IL_001a: add + IL_001b: add + IL_001c: stloc.0 + IL_001d: ldloc.0 + IL_001e: ret + } // end of method Repro::GetHashCode + + .method public hidebysig virtual final + instance int32 GetHashCode() cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 12 (0xc) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call class [netstandard]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: call instance int32 Experiment.Test/Repro::GetHashCode(class [netstandard]System.Collections.IEqualityComparer) + IL_000b: ret + } // end of method Repro::GetHashCode + + .method public hidebysig virtual final + instance bool Equals(object obj, + class [netstandard]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 53 (0x35) + .maxstack 4 + .locals init (object V_0, + valuetype Experiment.Test/Repro V_1, + valuetype Experiment.Test/Repro& V_2, + class [netstandard]System.Collections.IEqualityComparer V_3, + int32 V_4, + int32 V_5, + class [netstandard]System.Collections.IEqualityComparer V_6) + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: isinst Experiment.Test/Repro + IL_0008: ldnull + IL_0009: cgt.un + IL_000b: brfalse.s IL_0033 + + IL_000d: ldarg.1 + IL_000e: unbox.any Experiment.Test/Repro + IL_0013: stloc.1 + IL_0014: ldloca.s V_1 + IL_0016: stloc.2 + IL_0017: ldarg.2 + IL_0018: stloc.3 + IL_0019: ldarg.0 + IL_001a: ldfld int32 Experiment.Test/Repro::hash@ + IL_001f: stloc.s V_4 + IL_0021: ldloc.2 + IL_0022: ldfld int32 Experiment.Test/Repro::hash@ + IL_0027: stloc.s V_5 + IL_0029: ldloc.3 + IL_002a: stloc.s V_6 + IL_002c: ldloc.s V_4 + IL_002e: ldloc.s V_5 + IL_0030: ceq + IL_0032: ret + + IL_0033: ldc.i4.0 + IL_0034: ret + } // end of method Repro::Equals + + .method public specialname rtspecialname + instance void .ctor(int32 length) cil managed + { + // Code size 37 (0x25) + .maxstack 5 + .locals init (int32 V_0, + valuetype Experiment.Test/Repro& V_1, + int32 V_2, + int32 V_3) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: stloc.0 + IL_0003: stloc.1 + IL_0004: ldc.i4.0 + IL_0005: stloc.3 + IL_0006: ldarg.1 + IL_0007: ldc.i4.1 + IL_0008: sub + IL_0009: stloc.2 + IL_000a: ldloc.2 + IL_000b: ldloc.3 + IL_000c: blt.s IL_001d + + IL_000e: ldc.i4.s 26 + IL_0010: ldloc.0 + IL_0011: mul + IL_0012: stloc.0 + IL_0013: ldloc.3 + IL_0014: ldc.i4.1 + IL_0015: add + IL_0016: stloc.3 + IL_0017: ldloc.3 + IL_0018: ldloc.2 + IL_0019: ldc.i4.1 + IL_001a: add + IL_001b: bne.un.s IL_000e + + IL_001d: ldloc.1 + IL_001e: ldloc.0 + IL_001f: stfld int32 Experiment.Test/Repro::hash@ + IL_0024: ret + } // end of method Repro::.ctor + + .method public hidebysig virtual final + instance bool Equals(valuetype Experiment.Test/Repro obj) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 18 (0x12) + .maxstack 4 + .locals init (valuetype Experiment.Test/Repro& V_0) + IL_0000: ldarga.s obj + IL_0002: stloc.0 + IL_0003: ldarg.0 + IL_0004: ldfld int32 Experiment.Test/Repro::hash@ + IL_0009: ldloc.0 + IL_000a: ldfld int32 Experiment.Test/Repro::hash@ + IL_000f: ceq + IL_0011: ret + } // end of method Repro::Equals + + .method public hidebysig virtual final + instance bool Equals(object obj) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 30 (0x1e) + .maxstack 4 + .locals init (object V_0, + valuetype Experiment.Test/Repro V_1) + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: isinst Experiment.Test/Repro + IL_0008: ldnull + IL_0009: cgt.un + IL_000b: brfalse.s IL_001c + + IL_000d: ldarg.1 + IL_000e: unbox.any Experiment.Test/Repro + IL_0013: stloc.1 + IL_0014: ldarg.0 + IL_0015: ldloc.1 + IL_0016: call instance bool Experiment.Test/Repro::Equals(valuetype Experiment.Test/Repro) + IL_001b: ret + + IL_001c: ldc.i4.0 + IL_001d: ret + } // end of method Repro::Equals + + .property instance int32 hash() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) + .get instance int32 Experiment.Test/Repro::get_hash() + } // end of property Repro::hash + } // end of class Repro + + .method public static int32 test() cil managed + { + // Code size 16 (0x10) + .maxstack 3 + .locals init (valuetype Experiment.Test/Repro V_0) + IL_0000: ldc.i4.s 42 + IL_0002: newobj instance void Experiment.Test/Repro::.ctor(int32) + IL_0007: stloc.0 + IL_0008: ldloca.s V_0 + IL_000a: ldfld int32 Experiment.Test/Repro::hash@ + IL_000f: ret + } // end of method Test::test + +} // end of class Experiment.Test + +.class private abstract auto ansi sealed '.$Experiment'.Test + extends [mscorlib]System.Object +{ +} // end of class '.$Experiment'.Test + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.IsReadOnlyAttribute + extends [mscorlib]System.Attribute +{ + .method public specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Attribute::.ctor() + IL_0006: ret + } // end of method IsReadOnlyAttribute::.ctor + +} // end of class System.Runtime.CompilerServices.IsReadOnlyAttribute + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** +// WARNING: Created Win32 resource file C:\kevinransom\fsharp\artifacts\bin\FSharp.Compiler.ComponentTests\Debug\net472\tests\EmittedIL\Misc\Structs02_asNetStandard20_fs\Structs02_asNetStandard20.res diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.release.bsl new file mode 100644 index 0000000000..158f0d1b7c --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.release.bsl @@ -0,0 +1,375 @@ + +// Microsoft (R) .NET IL Disassembler. Version 5.0.0-preview.7.20364.11 + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly extern netstandard +{ + .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) // .{...-.Q + .ver 2:0:0:0 +} +.assembly extern FSharp.Core +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: + .ver 7:0:0:0 +} +.assembly Structs02_asNetStandard20 +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + // --- The following custom attribute is added automatically, do not uncomment ------- + // .custom instance void [netstandard]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [netstandard]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 01 00 00 00 00 ) + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.Structs02_asNetStandard20 +{ + // Offset: 0x00000000 Length: 0x000007F9 + // WARNING: managed resource file FSharpSignatureData.Structs02_asNetStandard20 created +} +.mresource public FSharpOptimizationData.Structs02_asNetStandard20 +{ + // Offset: 0x00000800 Length: 0x0000024A + // WARNING: managed resource file FSharpOptimizationData.Structs02_asNetStandard20 created +} +.module Structs02_asNetStandard20.dll +// MVID: {63EC03D0-37AB-0DD0-A745-0383D003EC63} +.imagebase 0x00400000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000001 // ILONLY +// Image base: 0x000001DC13190000 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class public abstract auto ansi sealed Experiment.Test + extends [mscorlib]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class sequential ansi serializable sealed nested public Repro + extends [netstandard]System.ValueType + implements class [netstandard]System.IEquatable`1, + [netstandard]System.Collections.IStructuralEquatable, + class [netstandard]System.IComparable`1, + [netstandard]System.IComparable, + [netstandard]System.Collections.IStructuralComparable + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .field assembly int32 hash@ + .method public hidebysig specialname + instance int32 get_hash() cil managed + { + .custom instance void System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [netstandard]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 Experiment.Test/Repro::hash@ + IL_0006: ret + } // end of method Repro::get_hash + + .method public hidebysig virtual final + instance int32 CompareTo(valuetype Experiment.Test/Repro obj) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 33 (0x21) + .maxstack 5 + .locals init (valuetype Experiment.Test/Repro& V_0, + class [netstandard]System.Collections.IComparer V_1, + int32 V_2, + int32 V_3) + IL_0000: ldarga.s obj + IL_0002: stloc.0 + IL_0003: call class [netstandard]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0008: stloc.1 + IL_0009: ldarg.0 + IL_000a: ldfld int32 Experiment.Test/Repro::hash@ + IL_000f: stloc.2 + IL_0010: ldloc.0 + IL_0011: ldfld int32 Experiment.Test/Repro::hash@ + IL_0016: stloc.3 + IL_0017: ldloc.2 + IL_0018: ldloc.3 + IL_0019: cgt + IL_001b: ldloc.2 + IL_001c: ldloc.3 + IL_001d: clt + IL_001f: sub + IL_0020: ret + } // end of method Repro::CompareTo + + .method public hidebysig virtual final + instance int32 CompareTo(object obj) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 13 (0xd) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: unbox.any Experiment.Test/Repro + IL_0007: call instance int32 Experiment.Test/Repro::CompareTo(valuetype Experiment.Test/Repro) + IL_000c: ret + } // end of method Repro::CompareTo + + .method public hidebysig virtual final + instance int32 CompareTo(object obj, + class [netstandard]System.Collections.IComparer comp) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 39 (0x27) + .maxstack 5 + .locals init (valuetype Experiment.Test/Repro V_0, + valuetype Experiment.Test/Repro& V_1, + class [netstandard]System.Collections.IComparer V_2, + int32 V_3, + int32 V_4) + IL_0000: ldarg.1 + IL_0001: unbox.any Experiment.Test/Repro + IL_0006: stloc.0 + IL_0007: ldloca.s V_0 + IL_0009: stloc.1 + IL_000a: ldarg.2 + IL_000b: stloc.2 + IL_000c: ldarg.0 + IL_000d: ldfld int32 Experiment.Test/Repro::hash@ + IL_0012: stloc.3 + IL_0013: ldloc.1 + IL_0014: ldfld int32 Experiment.Test/Repro::hash@ + IL_0019: stloc.s V_4 + IL_001b: ldloc.3 + IL_001c: ldloc.s V_4 + IL_001e: cgt + IL_0020: ldloc.3 + IL_0021: ldloc.s V_4 + IL_0023: clt + IL_0025: sub + IL_0026: ret + } // end of method Repro::CompareTo + + .method public hidebysig virtual final + instance int32 GetHashCode(class [netstandard]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 27 (0x1b) + .maxstack 7 + .locals init (int32 V_0, + class [netstandard]System.Collections.IEqualityComparer V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4 0x9e3779b9 + IL_0007: ldarg.1 + IL_0008: stloc.1 + IL_0009: ldarg.0 + IL_000a: ldfld int32 Experiment.Test/Repro::hash@ + IL_000f: ldloc.0 + IL_0010: ldc.i4.6 + IL_0011: shl + IL_0012: ldloc.0 + IL_0013: ldc.i4.2 + IL_0014: shr + IL_0015: add + IL_0016: add + IL_0017: add + IL_0018: stloc.0 + IL_0019: ldloc.0 + IL_001a: ret + } // end of method Repro::GetHashCode + + .method public hidebysig virtual final + instance int32 GetHashCode() cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 12 (0xc) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call class [netstandard]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: call instance int32 Experiment.Test/Repro::GetHashCode(class [netstandard]System.Collections.IEqualityComparer) + IL_000b: ret + } // end of method Repro::GetHashCode + + .method public hidebysig virtual final + instance bool Equals(object obj, + class [netstandard]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 42 (0x2a) + .maxstack 4 + .locals init (object V_0, + valuetype Experiment.Test/Repro V_1, + valuetype Experiment.Test/Repro& V_2, + class [netstandard]System.Collections.IEqualityComparer V_3) + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: isinst Experiment.Test/Repro + IL_0008: ldnull + IL_0009: cgt.un + IL_000b: brfalse.s IL_0028 + + IL_000d: ldarg.1 + IL_000e: unbox.any Experiment.Test/Repro + IL_0013: stloc.1 + IL_0014: ldloca.s V_1 + IL_0016: stloc.2 + IL_0017: ldarg.2 + IL_0018: stloc.3 + IL_0019: ldarg.0 + IL_001a: ldfld int32 Experiment.Test/Repro::hash@ + IL_001f: ldloc.2 + IL_0020: ldfld int32 Experiment.Test/Repro::hash@ + IL_0025: ceq + IL_0027: ret + + IL_0028: ldc.i4.0 + IL_0029: ret + } // end of method Repro::Equals + + .method public specialname rtspecialname + instance void .ctor(int32 length) cil managed + { + // Code size 37 (0x25) + .maxstack 5 + .locals init (int32 V_0, + valuetype Experiment.Test/Repro& V_1, + int32 V_2, + int32 V_3) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: stloc.0 + IL_0003: stloc.1 + IL_0004: ldc.i4.0 + IL_0005: stloc.3 + IL_0006: ldarg.1 + IL_0007: ldc.i4.1 + IL_0008: sub + IL_0009: stloc.2 + IL_000a: ldloc.2 + IL_000b: ldloc.3 + IL_000c: blt.s IL_001d + + IL_000e: ldc.i4.s 26 + IL_0010: ldloc.0 + IL_0011: mul + IL_0012: stloc.0 + IL_0013: ldloc.3 + IL_0014: ldc.i4.1 + IL_0015: add + IL_0016: stloc.3 + IL_0017: ldloc.3 + IL_0018: ldloc.2 + IL_0019: ldc.i4.1 + IL_001a: add + IL_001b: bne.un.s IL_000e + + IL_001d: ldloc.1 + IL_001e: ldloc.0 + IL_001f: stfld int32 Experiment.Test/Repro::hash@ + IL_0024: ret + } // end of method Repro::.ctor + + .method public hidebysig virtual final + instance bool Equals(valuetype Experiment.Test/Repro obj) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 18 (0x12) + .maxstack 4 + .locals init (valuetype Experiment.Test/Repro& V_0) + IL_0000: ldarga.s obj + IL_0002: stloc.0 + IL_0003: ldarg.0 + IL_0004: ldfld int32 Experiment.Test/Repro::hash@ + IL_0009: ldloc.0 + IL_000a: ldfld int32 Experiment.Test/Repro::hash@ + IL_000f: ceq + IL_0011: ret + } // end of method Repro::Equals + + .method public hidebysig virtual final + instance bool Equals(object obj) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 30 (0x1e) + .maxstack 4 + .locals init (object V_0, + valuetype Experiment.Test/Repro V_1) + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: isinst Experiment.Test/Repro + IL_0008: ldnull + IL_0009: cgt.un + IL_000b: brfalse.s IL_001c + + IL_000d: ldarg.1 + IL_000e: unbox.any Experiment.Test/Repro + IL_0013: stloc.1 + IL_0014: ldarg.0 + IL_0015: ldloc.1 + IL_0016: call instance bool Experiment.Test/Repro::Equals(valuetype Experiment.Test/Repro) + IL_001b: ret + + IL_001c: ldc.i4.0 + IL_001d: ret + } // end of method Repro::Equals + + .property instance int32 hash() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) + .get instance int32 Experiment.Test/Repro::get_hash() + } // end of property Repro::hash + } // end of class Repro + + .method public static int32 test() cil managed + { + // Code size 16 (0x10) + .maxstack 3 + .locals init (valuetype Experiment.Test/Repro V_0) + IL_0000: ldc.i4.s 42 + IL_0002: newobj instance void Experiment.Test/Repro::.ctor(int32) + IL_0007: stloc.0 + IL_0008: ldloca.s V_0 + IL_000a: ldfld int32 Experiment.Test/Repro::hash@ + IL_000f: ret + } // end of method Test::test + +} // end of class Experiment.Test + +.class private abstract auto ansi sealed '.$Experiment'.Test + extends [mscorlib]System.Object +{ +} // end of class '.$Experiment'.Test + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.IsReadOnlyAttribute + extends [mscorlib]System.Attribute +{ + .method public specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Attribute::.ctor() + IL_0006: ret + } // end of method IsReadOnlyAttribute::.ctor + +} // end of class System.Runtime.CompilerServices.IsReadOnlyAttribute + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** +// WARNING: Created Win32 resource file C:\kevinransom\fsharp\artifacts\bin\FSharp.Compiler.ComponentTests\Release\net472\tests\EmittedIL\Misc\Structs02_asNetStandard20_fs\Structs02_asNetStandard20.res diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.debug.bsl index bb11af3007..2789a10a4d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.debug.bsl @@ -37,13 +37,13 @@ // WARNING: managed resource file FSharpOptimizationData.FloatsAndDoubles created } .module FloatsAndDoubles.exe -// MVID: {63E6EA31-274A-A48B-A745-038331EAE663} +// MVID: {63EB2B21-274A-A48B-A745-0383212BEB63} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x0000015AA6730000 +// Image base: 0x000001AE7E770000 // =============== CLASS MEMBERS DECLARATION =================== @@ -65,6 +65,7 @@ .method public hidebysig specialname instance float64 get_F() cil managed { + .custom instance void [mscorlib]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) // Code size 7 (0x7) @@ -411,6 +412,7 @@ .method public hidebysig specialname instance float64 get_D() cil managed { + .custom instance void [mscorlib]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) // Code size 7 (0x7) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.release.bsl index 078664438a..ceaf99f810 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.release.bsl @@ -4,10 +4,10 @@ // Metadata version: v4.0.30319 -.assembly extern System.Runtime +.assembly extern mscorlib { - .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: - .ver 7:0:0:0 + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 } .assembly extern FSharp.Core { @@ -21,52 +21,53 @@ int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) // --- The following custom attribute is added automatically, do not uncomment ------- - // .custom instance void [System.Runtime]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 01 00 00 00 00 ) + // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 01 00 00 00 00 ) .hash algorithm 0x00008004 .ver 0:0:0:0 } .mresource public FSharpSignatureData.FloatsAndDoubles { - // Offset: 0x00000000 Length: 0x00000C66 + // Offset: 0x00000000 Length: 0x00000C68 // WARNING: managed resource file FSharpSignatureData.FloatsAndDoubles created } .mresource public FSharpOptimizationData.FloatsAndDoubles { - // Offset: 0x00000C70 Length: 0x0000034E + // Offset: 0x00000C70 Length: 0x00000348 // WARNING: managed resource file FSharpOptimizationData.FloatsAndDoubles created } .module FloatsAndDoubles.exe -// MVID: {63DBF1DE-5559-9AC8-A745-0383DEF1DB63} +// MVID: {63EB310D-274A-A48B-A745-03830D31EB63} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x000001AD44060000 +// Image base: 0x000001F8CCAE0000 // =============== CLASS MEMBERS DECLARATION =================== .class public abstract auto ansi sealed floatsanddoubles - extends [System.Runtime]System.Object + extends [mscorlib]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) .class sequential ansi serializable sealed nested public Float - extends [System.Runtime]System.ValueType - implements class [System.Runtime]System.IEquatable`1, - [System.Runtime]System.Collections.IStructuralEquatable, - class [System.Runtime]System.IComparable`1, - [System.Runtime]System.IComparable, - [System.Runtime]System.Collections.IStructuralComparable + extends [mscorlib]System.ValueType + implements class [mscorlib]System.IEquatable`1, + [mscorlib]System.Collections.IStructuralEquatable, + class [mscorlib]System.IComparable`1, + [mscorlib]System.IComparable, + [mscorlib]System.Collections.IStructuralComparable { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) .field assembly float64 F@ .method public hidebysig specialname instance float64 get_F() cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 @@ -77,16 +78,16 @@ .method public hidebysig virtual final instance int32 CompareTo(valuetype floatsanddoubles/Float obj) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 58 (0x3a) .maxstack 5 .locals init (valuetype floatsanddoubles/Float& V_0, - class [System.Runtime]System.Collections.IComparer V_1, + class [mscorlib]System.Collections.IComparer V_1, float64 V_2, float64 V_3) IL_0000: ldarga.s obj IL_0002: stloc.0 - IL_0003: call class [System.Runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0003: call class [mscorlib]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() IL_0008: stloc.1 IL_0009: ldarg.0 IL_000a: ldfld float64 floatsanddoubles/Float::F@ @@ -122,7 +123,7 @@ IL_0030: ldloc.2 IL_0031: ldloc.3 IL_0032: tail. - IL_0034: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [System.Runtime]System.Collections.IComparer, + IL_0034: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [mscorlib]System.Collections.IComparer, !!0, !!0) IL_0039: ret @@ -131,7 +132,7 @@ .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 13 (0xd) .maxstack 8 IL_0000: ldarg.0 @@ -143,14 +144,14 @@ .method public hidebysig virtual final instance int32 CompareTo(object obj, - class [System.Runtime]System.Collections.IComparer comp) cil managed + class [mscorlib]System.Collections.IComparer comp) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 66 (0x42) .maxstack 5 .locals init (valuetype floatsanddoubles/Float V_0, valuetype floatsanddoubles/Float& V_1, - class [System.Runtime]System.Collections.IComparer V_2, + class [mscorlib]System.Collections.IComparer V_2, float64 V_3, float64 V_4) IL_0000: ldarg.1 @@ -194,16 +195,16 @@ IL_0037: ldloc.3 IL_0038: ldloc.s V_4 IL_003a: tail. - IL_003c: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [System.Runtime]System.Collections.IComparer, + IL_003c: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [mscorlib]System.Collections.IComparer, !!0, !!0) IL_0041: ret } // end of method Float::CompareTo .method public hidebysig virtual final - instance int32 GetHashCode(class [System.Runtime]System.Collections.IEqualityComparer comp) cil managed + instance int32 GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 31 (0x1f) .maxstack 7 .locals init (int32 V_0) @@ -213,7 +214,7 @@ IL_0007: ldarg.1 IL_0008: ldarg.0 IL_0009: ldfld float64 floatsanddoubles/Float::F@ - IL_000e: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericHashWithComparerIntrinsic(class [System.Runtime]System.Collections.IEqualityComparer, + IL_000e: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericHashWithComparerIntrinsic(class [mscorlib]System.Collections.IEqualityComparer, !!0) IL_0013: ldloc.0 IL_0014: ldc.i4.6 @@ -232,26 +233,26 @@ .method public hidebysig virtual final instance int32 GetHashCode() cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 12 (0xc) .maxstack 8 IL_0000: ldarg.0 - IL_0001: call class [System.Runtime]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() - IL_0006: call instance int32 floatsanddoubles/Float::GetHashCode(class [System.Runtime]System.Collections.IEqualityComparer) + IL_0001: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: call instance int32 floatsanddoubles/Float::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) IL_000b: ret } // end of method Float::GetHashCode .method public hidebysig virtual final instance bool Equals(object obj, - class [System.Runtime]System.Collections.IEqualityComparer comp) cil managed + class [mscorlib]System.Collections.IEqualityComparer comp) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 42 (0x2a) .maxstack 4 .locals init (object V_0, valuetype floatsanddoubles/Float V_1, valuetype floatsanddoubles/Float& V_2, - class [System.Runtime]System.Collections.IEqualityComparer V_3) + class [mscorlib]System.Collections.IEqualityComparer V_3) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -292,7 +293,7 @@ .method public hidebysig virtual final instance bool Equals(valuetype floatsanddoubles/Float obj) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 39 (0x27) .maxstack 4 .locals init (valuetype floatsanddoubles/Float& V_0, @@ -332,7 +333,7 @@ .method public hidebysig virtual final instance bool Equals(object obj) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 30 (0x1e) .maxstack 4 .locals init (object V_0, @@ -366,20 +367,21 @@ } // end of class Float .class sequential ansi serializable sealed nested public Double - extends [System.Runtime]System.ValueType - implements class [System.Runtime]System.IEquatable`1, - [System.Runtime]System.Collections.IStructuralEquatable, - class [System.Runtime]System.IComparable`1, - [System.Runtime]System.IComparable, - [System.Runtime]System.Collections.IStructuralComparable + extends [mscorlib]System.ValueType + implements class [mscorlib]System.IEquatable`1, + [mscorlib]System.Collections.IStructuralEquatable, + class [mscorlib]System.IComparable`1, + [mscorlib]System.IComparable, + [mscorlib]System.Collections.IStructuralComparable { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) .field assembly float64 D@ .method public hidebysig specialname instance float64 get_D() cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 @@ -390,16 +392,16 @@ .method public hidebysig virtual final instance int32 CompareTo(valuetype floatsanddoubles/Double obj) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 58 (0x3a) .maxstack 5 .locals init (valuetype floatsanddoubles/Double& V_0, - class [System.Runtime]System.Collections.IComparer V_1, + class [mscorlib]System.Collections.IComparer V_1, float64 V_2, float64 V_3) IL_0000: ldarga.s obj IL_0002: stloc.0 - IL_0003: call class [System.Runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0003: call class [mscorlib]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() IL_0008: stloc.1 IL_0009: ldarg.0 IL_000a: ldfld float64 floatsanddoubles/Double::D@ @@ -435,7 +437,7 @@ IL_0030: ldloc.2 IL_0031: ldloc.3 IL_0032: tail. - IL_0034: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [System.Runtime]System.Collections.IComparer, + IL_0034: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [mscorlib]System.Collections.IComparer, !!0, !!0) IL_0039: ret @@ -444,7 +446,7 @@ .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 13 (0xd) .maxstack 8 IL_0000: ldarg.0 @@ -456,14 +458,14 @@ .method public hidebysig virtual final instance int32 CompareTo(object obj, - class [System.Runtime]System.Collections.IComparer comp) cil managed + class [mscorlib]System.Collections.IComparer comp) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 66 (0x42) .maxstack 5 .locals init (valuetype floatsanddoubles/Double V_0, valuetype floatsanddoubles/Double& V_1, - class [System.Runtime]System.Collections.IComparer V_2, + class [mscorlib]System.Collections.IComparer V_2, float64 V_3, float64 V_4) IL_0000: ldarg.1 @@ -507,16 +509,16 @@ IL_0037: ldloc.3 IL_0038: ldloc.s V_4 IL_003a: tail. - IL_003c: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [System.Runtime]System.Collections.IComparer, + IL_003c: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [mscorlib]System.Collections.IComparer, !!0, !!0) IL_0041: ret } // end of method Double::CompareTo .method public hidebysig virtual final - instance int32 GetHashCode(class [System.Runtime]System.Collections.IEqualityComparer comp) cil managed + instance int32 GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 31 (0x1f) .maxstack 7 .locals init (int32 V_0) @@ -526,7 +528,7 @@ IL_0007: ldarg.1 IL_0008: ldarg.0 IL_0009: ldfld float64 floatsanddoubles/Double::D@ - IL_000e: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericHashWithComparerIntrinsic(class [System.Runtime]System.Collections.IEqualityComparer, + IL_000e: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericHashWithComparerIntrinsic(class [mscorlib]System.Collections.IEqualityComparer, !!0) IL_0013: ldloc.0 IL_0014: ldc.i4.6 @@ -545,26 +547,26 @@ .method public hidebysig virtual final instance int32 GetHashCode() cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 12 (0xc) .maxstack 8 IL_0000: ldarg.0 - IL_0001: call class [System.Runtime]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() - IL_0006: call instance int32 floatsanddoubles/Double::GetHashCode(class [System.Runtime]System.Collections.IEqualityComparer) + IL_0001: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: call instance int32 floatsanddoubles/Double::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) IL_000b: ret } // end of method Double::GetHashCode .method public hidebysig virtual final instance bool Equals(object obj, - class [System.Runtime]System.Collections.IEqualityComparer comp) cil managed + class [mscorlib]System.Collections.IEqualityComparer comp) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 42 (0x2a) .maxstack 4 .locals init (object V_0, valuetype floatsanddoubles/Double V_1, valuetype floatsanddoubles/Double& V_2, - class [System.Runtime]System.Collections.IEqualityComparer V_3) + class [mscorlib]System.Collections.IEqualityComparer V_3) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -605,7 +607,7 @@ .method public hidebysig virtual final instance bool Equals(valuetype floatsanddoubles/Double obj) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 39 (0x27) .maxstack 4 .locals init (valuetype floatsanddoubles/Double& V_0, @@ -645,7 +647,7 @@ .method public hidebysig virtual final instance bool Equals(object obj) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) // Code size 30 (0x1e) .maxstack 4 .locals init (object V_0, @@ -682,14 +684,14 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 clo5 - .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 clo5) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) // Code size 14 (0xe) .maxstack 8 IL_0000: ldarg.0 @@ -719,14 +721,14 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> clo4 - .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> clo4) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) // Code size 14 (0xe) .maxstack 8 IL_0000: ldarg.0 @@ -759,14 +761,14 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> { .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> clo3 - .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> clo3) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) // Code size 14 (0xe) .maxstack 8 IL_0000: ldarg.0 @@ -799,14 +801,14 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> { .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> clo2 - .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> clo2) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) // Code size 14 (0xe) .maxstack 8 IL_0000: ldarg.0 @@ -839,14 +841,14 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>>> { .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>>> clo1 - .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>>> clo1) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) // Code size 14 (0xe) .maxstack 8 IL_0000: ldarg.0 @@ -879,14 +881,14 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 clo5 - .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 clo5) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) // Code size 14 (0xe) .maxstack 8 IL_0000: ldarg.0 @@ -916,14 +918,14 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> clo4 - .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> clo4) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) // Code size 14 (0xe) .maxstack 8 IL_0000: ldarg.0 @@ -956,14 +958,14 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> { .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> clo3 - .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>> clo3) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) // Code size 14 (0xe) .maxstack 8 IL_0000: ldarg.0 @@ -996,14 +998,14 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> { .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> clo2 - .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>> clo2) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) // Code size 14 (0xe) .maxstack 8 IL_0000: ldarg.0 @@ -1036,14 +1038,14 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>>> { .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>>> clo1 - .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>>> clo1) cil managed { - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) // Code size 14 (0xe) .maxstack 8 IL_0000: ldarg.0 @@ -1124,17 +1126,17 @@ IL_0015: br.s IL_0093 IL_0017: ldstr "Doubles: %-17s = %-17s is: %-5b Values %f = %f" - IL_001c: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5>>>>,class [System.Runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [System.Runtime]System.Tuple`5>::.ctor(string) - IL_0021: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>>>>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_001c: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5>>>>,class [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [mscorlib]System.Tuple`5>::.ctor(string) + IL_0021: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>>>>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) IL_0026: stloc.2 IL_0027: ldloc.2 IL_0028: newobj instance void floatsanddoubles/main@31::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>>>) IL_002d: call string[] floatsanddoubles::get_names() IL_0032: ldloc.0 - IL_0033: ldelem [System.Runtime]System.String + IL_0033: ldelem [mscorlib]System.String IL_0038: call string[] floatsanddoubles::get_names() IL_003d: ldloc.1 - IL_003e: ldelem [System.Runtime]System.String + IL_003e: ldelem [mscorlib]System.String IL_0043: call valuetype floatsanddoubles/Double[] floatsanddoubles::get_doubles() IL_0048: ldloc.0 IL_0049: ldelema floatsanddoubles/Double @@ -1143,7 +1145,7 @@ IL_0054: ldelem floatsanddoubles/Double IL_0059: box floatsanddoubles/Double IL_005e: constrained. floatsanddoubles/Double - IL_0064: callvirt instance bool [System.Runtime]System.Object::Equals(object) + IL_0064: callvirt instance bool [mscorlib]System.Object::Equals(object) IL_0069: call valuetype floatsanddoubles/Double[] floatsanddoubles::get_doubles() IL_006e: ldloc.0 IL_006f: ldelema floatsanddoubles/Double @@ -1170,8 +1172,8 @@ IL_009b: blt IL_0017 IL_00a0: ldstr "" - IL_00a5: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) - IL_00aa: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_00a5: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) + IL_00aa: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) IL_00af: pop IL_00b0: ldloc.0 IL_00b1: ldc.i4.1 @@ -1192,17 +1194,17 @@ IL_00cb: br IL_0153 IL_00d0: ldstr "Floats: %-17s = %-17s is: %-5b Values %f = %f" - IL_00d5: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5>>>>,class [System.Runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [System.Runtime]System.Tuple`5>::.ctor(string) - IL_00da: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>>>>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_00d5: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5>>>>,class [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [mscorlib]System.Tuple`5>::.ctor(string) + IL_00da: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>>>>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) IL_00df: stloc.s V_5 IL_00e1: ldloc.s V_5 IL_00e3: newobj instance void floatsanddoubles/'main@36-5'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>>>) IL_00e8: call string[] floatsanddoubles::get_names() IL_00ed: ldloc.3 - IL_00ee: ldelem [System.Runtime]System.String + IL_00ee: ldelem [mscorlib]System.String IL_00f3: call string[] floatsanddoubles::get_names() IL_00f8: ldloc.s V_4 - IL_00fa: ldelem [System.Runtime]System.String + IL_00fa: ldelem [mscorlib]System.String IL_00ff: call valuetype floatsanddoubles/Float[] floatsanddoubles::get_floats() IL_0104: ldloc.3 IL_0105: ldelema floatsanddoubles/Float @@ -1211,7 +1213,7 @@ IL_0111: ldelem floatsanddoubles/Float IL_0116: box floatsanddoubles/Float IL_011b: constrained. floatsanddoubles/Float - IL_0121: callvirt instance bool [System.Runtime]System.Object::Equals(object) + IL_0121: callvirt instance bool [mscorlib]System.Object::Equals(object) IL_0126: call valuetype floatsanddoubles/Float[] floatsanddoubles::get_floats() IL_012b: ldloc.3 IL_012c: ldelema floatsanddoubles/Float @@ -1238,8 +1240,8 @@ IL_015c: blt IL_00d0 IL_0161: ldstr "" - IL_0166: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) - IL_016b: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_0166: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) + IL_016b: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) IL_0170: pop IL_0171: ldloc.3 IL_0172: ldc.i4.1 @@ -1275,18 +1277,18 @@ } // end of class floatsanddoubles .class private abstract auto ansi sealed ''.$floatsanddoubles - extends [System.Runtime]System.Object + extends [mscorlib]System.Object { .field static assembly initonly valuetype floatsanddoubles/Float[] floats@22 - .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly initonly valuetype floatsanddoubles/Double[] doubles@23 - .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly initonly string[] names@24 - .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly int32 init@ - .custom instance void [System.Runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [System.Runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method private specialname rtspecialname static void .cctor() cil managed { @@ -1376,35 +1378,35 @@ IL_013a: stsfld valuetype floatsanddoubles/Double[] ''.$floatsanddoubles::doubles@23 IL_013f: stloc.1 IL_0140: ldc.i4.7 - IL_0141: newarr [System.Runtime]System.String + IL_0141: newarr [mscorlib]System.String IL_0146: dup IL_0147: ldc.i4.0 IL_0148: ldstr "Epsilon" - IL_014d: stelem [System.Runtime]System.String + IL_014d: stelem [mscorlib]System.String IL_0152: dup IL_0153: ldc.i4.1 IL_0154: ldstr "MinValue" - IL_0159: stelem [System.Runtime]System.String + IL_0159: stelem [mscorlib]System.String IL_015e: dup IL_015f: ldc.i4.2 IL_0160: ldstr "MaxValue" - IL_0165: stelem [System.Runtime]System.String + IL_0165: stelem [mscorlib]System.String IL_016a: dup IL_016b: ldc.i4.3 IL_016c: ldstr "NegativeInfinity" - IL_0171: stelem [System.Runtime]System.String + IL_0171: stelem [mscorlib]System.String IL_0176: dup IL_0177: ldc.i4.4 IL_0178: ldstr "PositiveInfinity" - IL_017d: stelem [System.Runtime]System.String + IL_017d: stelem [mscorlib]System.String IL_0182: dup IL_0183: ldc.i4.5 IL_0184: ldstr "NaN" - IL_0189: stelem [System.Runtime]System.String + IL_0189: stelem [mscorlib]System.String IL_018e: dup IL_018f: ldc.i4.6 IL_0190: ldstr "Number" - IL_0195: stelem [System.Runtime]System.String + IL_0195: stelem [mscorlib]System.String IL_019a: dup IL_019b: stsfld string[] ''.$floatsanddoubles::names@24 IL_01a0: stloc.2 @@ -1417,4 +1419,4 @@ // ============================================================= // *********** DISASSEMBLY COMPLETE *********************** -// WARNING: Created Win32 resource file D:\code\FS\fsharp\artifacts\bin\FSharp.Compiler.ComponentTests\Release\net7.0\tests\EmittedIL\Structure\FloatsAndDoubles_fs\FloatsAndDoubles.res +// WARNING: Created Win32 resource file C:\kevinransom\fsharp\artifacts\bin\FSharp.Compiler.ComponentTests\Release\net472\tests\EmittedIL\Structure\FloatsAndDoubles_fs\FloatsAndDoubles.res diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index 74250c83cd..0eaa71a634 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -59,7 +59,8 @@ module rec Compiler = OutputDirectory: DirectoryInfo option Name: string option IgnoreWarnings: bool - References: CompilationUnit list } + References: CompilationUnit list + TargetFramework: TargetFramework } member this.CreateOutputDirectory() = match this.OutputDirectory with @@ -204,6 +205,7 @@ module rec Compiler = Name = None IgnoreWarnings = false References = [] + TargetFramework = TargetFramework.Current } let private csFromString (source: SourceCodeFileKind) : CSharpCompilationSource = @@ -306,6 +308,7 @@ module rec Compiler = Name = Some name IgnoreWarnings = false References = [] + TargetFramework = TargetFramework.Current } |> FS let CSharp (source: string) : CompilationUnit = @@ -488,6 +491,12 @@ module rec Compiler = let asLibrary (cUnit: CompilationUnit) : CompilationUnit = withOutputType CompileOutput.Library cUnit + let asNetStandard20 (cUnit: CompilationUnit) : CompilationUnit = + match cUnit with + | FS fs -> FS { fs with TargetFramework = TargetFramework.NetStandard20 } + | CS cs -> CS { cs with TargetFramework = TargetFramework.NetStandard20 } + | IL _ -> failwith "References are not supported in IL" + let asExe (cUnit: CompilationUnit) : CompilationUnit = withOutputType CompileOutput.Exe cUnit @@ -544,7 +553,7 @@ module rec Compiler = | Some outputDirectory -> outputDirectory | _ -> defaultOutputDirectory let cmpl = - Compilation.CreateFromSources([fs.Source] @ fs.AdditionalSources, fs.OutputType, options, refs, name, outDir) |> CompilationReference.CreateFSharp + Compilation.CreateFromSources([fs.Source] @ fs.AdditionalSources, fs.OutputType, options, fs.TargetFramework, refs, name, outDir) |> CompilationReference.CreateFSharp loop (cmpl::acc) xs | CS cs -> @@ -590,7 +599,7 @@ module rec Compiler = | Some di -> di | None -> DirectoryInfo(tryCreateTemporaryDirectory()) let references = processReferences fs.References outputDirectory - let compilation = Compilation.CreateFromSources([fs.Source] @ fs.AdditionalSources, output, options, references, name, outputDirectory) + let compilation = Compilation.CreateFromSources([fs.Source] @ fs.AdditionalSources, output, options, fs.TargetFramework, references, name, outputDirectory) compileFSharpCompilation compilation fs.IgnoreWarnings (FS fs) let toErrorInfo (d: Diagnostic) = @@ -847,7 +856,7 @@ module rec Compiler = disposals.Add({ new IDisposable with member _.Dispose() = outputDirectory.Delete(true) }) let references = processReferences fs.References outputDirectory - let cmpl = Compilation.Create(fs.Source, fs.OutputType, options, references, name, outputDirectory) + let cmpl = Compilation.Create(fs.Source, fs.OutputType, options, fs.TargetFramework, references, name, outputDirectory) let _compilationRefs, _deps = evaluateReferences outputDirectory disposals fs.IgnoreWarnings cmpl let options = let opts = new ResizeArray(fs.Options) @@ -857,7 +866,7 @@ module rec Compiler = match reference with | CompilationReference( cmpl, _) -> match cmpl with - | Compilation(_sources, _outputType, _options, _references, _name, outputDirectory) -> + | Compilation(_sources, _outputType, _options, _targetFramework, _references, _name, outputDirectory) -> if outputDirectory.IsSome then opts.Add($"-I:\"{(outputDirectory.Value.FullName)}\"") | _ -> () diff --git a/tests/FSharp.Test.Utilities/CompilerAssert.fs b/tests/FSharp.Test.Utilities/CompilerAssert.fs index eb9ea5d3a3..0824a065aa 100644 --- a/tests/FSharp.Test.Utilities/CompilerAssert.fs +++ b/tests/FSharp.Test.Utilities/CompilerAssert.fs @@ -206,44 +206,49 @@ and Compilation = sources: SourceCodeFileKind list * outputType: CompileOutput * options: string[] * + targetFramework: TargetFramework * CompilationReference list * name: string option * outputDirectory: DirectoryInfo option with - static member Create(source:SourceCodeFileKind, output:CompileOutput, ?options:string array, ?cmplRefs:CompilationReference list, ?name:string, ?outputDirectory: DirectoryInfo) = + static member Create(source:SourceCodeFileKind, output:CompileOutput, ?options:string array, ?targetFramework:TargetFramework, ?cmplRefs:CompilationReference list, ?name:string, ?outputDirectory: DirectoryInfo) = let options = defaultArg options [||] + let targetFramework = defaultArg targetFramework TargetFramework.Current let cmplRefs = defaultArg cmplRefs [] let name = match defaultArg name null with | null -> None | n -> Some n - Compilation([source], output, options, cmplRefs, name, outputDirectory) + Compilation([source], output, options, targetFramework, cmplRefs, name, outputDirectory) - static member Create(source:string, output:CompileOutput, ?options:string array, ?cmplRefs:CompilationReference list, ?name:string, ?outputDirectory: DirectoryInfo) = + static member Create(source:string, output:CompileOutput, ?options:string array, ?targetFramework:TargetFramework, ?cmplRefs:CompilationReference list, ?name:string, ?outputDirectory: DirectoryInfo) = let options = defaultArg options [||] + let targetFramework = defaultArg targetFramework TargetFramework.Current let cmplRefs = defaultArg cmplRefs [] let name = match defaultArg name null with | null -> None | n -> Some n - Compilation([SourceCodeFileKind.Create("test.fs", source)], output, options, cmplRefs, name, outputDirectory) + Compilation([SourceCodeFileKind.Create("test.fs", source)], output, options, targetFramework, cmplRefs, name, outputDirectory) - static member Create(fileName:string, source:string, output, ?options, ?cmplRefs, ?name, ?outputDirectory: DirectoryInfo) = + static member Create(fileName:string, source:string, output, ?options, ?targetFramework:TargetFramework, ?cmplRefs, ?name, ?outputDirectory: DirectoryInfo) = let source = SourceCodeFileKind.Create(fileName, source) let options = defaultArg options [||] + let targetFramework = defaultArg targetFramework TargetFramework.Current let cmplRefs = defaultArg cmplRefs [] let name = defaultArg name null let outputDirectory = defaultArg outputDirectory null - Compilation.Create(source, output, options, cmplRefs, name, outputDirectory) + Compilation.Create(source, output, options, targetFramework, cmplRefs, name, outputDirectory) - static member CreateFromSources(sources, output, ?options, ?cmplRefs, ?name, ?outputDirectory: DirectoryInfo) = + static member CreateFromSources(sources, output, ?options, ?targetFramework, ?cmplRefs, ?name, ?outputDirectory: DirectoryInfo) = let options = defaultArg options [||] + let targetFramework = defaultArg targetFramework TargetFramework.Current let cmplRefs = defaultArg cmplRefs [] let name = match defaultArg name null with | null -> None | n -> Some n - Compilation(sources, output, options, cmplRefs, name, outputDirectory) + Compilation(sources, output, options, targetFramework, cmplRefs, name, outputDirectory) module rec CompilerAssertHelpers = @@ -302,19 +307,23 @@ module rec CompilerAssertHelpers = worker.ExecuteTestCase assembly (deps |> Array.ofList) #endif - let defaultProjectOptions = + let defaultProjectOptions (targetFramework: TargetFramework) = + let assemblies = TargetFrameworkUtil.getFileReferences targetFramework |> Array.map (fun x -> sprintf "-r:%s" x) + let testDefaults = [| + "--preferreduilang:en-US" + "--noframework" + "--warn:5" +#if NETCOREAPP + "--targetprofile:netcore" +#else + "--targetprofile:mscorlib" +#endif + |] { ProjectFileName = "Z:\\test.fsproj" ProjectId = None SourceFiles = [|"test.fs"|] - OtherOptions = - let assemblies = TargetFrameworkUtil.currentReferences |> Array.map (fun x -> sprintf "-r:%s" x) - let defaultOptions = Array.append [|"--preferreduilang:en-US"; "--noframework"; "--warn:5"|] assemblies -#if NETCOREAPP - Array.append [|"--targetprofile:netcore"|] defaultOptions -#else - Array.append [|"--targetprofile:mscorlib"|] defaultOptions -#endif + OtherOptions = Array.append testDefaults assemblies ReferencedProjects = [||] IsIncompleteTypeCheckEnvironment = false UseScriptResolutionRules = false @@ -324,7 +333,7 @@ module rec CompilerAssertHelpers = Stamp = None } - let rawCompile outputFilePath isExe options (sources: SourceCodeFileKind list) = + let rawCompile outputFilePath isExe options (targetFramework: TargetFramework) (sources: SourceCodeFileKind list) = let args = [| yield "fsc.dll" @@ -332,7 +341,8 @@ module rec CompilerAssertHelpers = yield item.GetSourceFileName yield "-o:" + outputFilePath yield (if isExe then "--target:exe" else "--target:library") - yield! defaultProjectOptions.OtherOptions + yield! (defaultProjectOptions targetFramework).OtherOptions +// yield! TargetFrameworkUtil.getFileReferences targetFramework yield! options |] @@ -341,7 +351,7 @@ module rec CompilerAssertHelpers = let errors, _ = checker.Compile args |> Async.RunImmediate errors, outputFilePath - let compileDisposable (outputDirectory:DirectoryInfo) isExe options nameOpt (sources:SourceCodeFileKind list) = + let compileDisposable (outputDirectory:DirectoryInfo) isExe options targetFramework nameOpt (sources:SourceCodeFileKind list) = let disposeFile path = { new IDisposable with @@ -383,7 +393,7 @@ module rec CompilerAssertHelpers = yield source.WithFileName(destFileName) ] try - disposeList, rawCompile outputFilePath isExe options sources + disposeList, rawCompile outputFilePath isExe options targetFramework sources with | _ -> disposeList.Dispose() @@ -429,14 +439,14 @@ module rec CompilerAssertHelpers = let outputFilePath = Path.ChangeExtension (tryCreateTemporaryFileName (), if isExe then ".exe" else ".dll") try - f (rawCompile outputFilePath isExe options [source]) + f (rawCompile outputFilePath isExe options TargetFramework.Current [source]) finally try File.Delete sourceFile.GetSourceFileName with | _ -> () try File.Delete outputFilePath with | _ -> () let rec evaluateReferences (outputPath:DirectoryInfo) (disposals: ResizeArray) ignoreWarnings (cmpl: Compilation) : string[] * string list = match cmpl with - | Compilation(_, _, _, cmpls, _, _) -> + | Compilation(_, _, _, _, cmpls, _, _) -> let compiledRefs = cmpls |> List.map (fun cmpl -> @@ -476,15 +486,16 @@ module rec CompilerAssertHelpers = let compileCompilationAux outputDirectory (disposals: ResizeArray) ignoreWarnings (cmpl: Compilation) : (FSharpDiagnostic[] * string) * string list = let compilationRefs, deps = evaluateReferences outputDirectory disposals ignoreWarnings cmpl - let isExe, sources, options, name = + let isExe, sources, options, targetFramework, name = match cmpl with - | Compilation(sources, output, options, _, name, _) -> + | Compilation(sources, output, options, targetFramework, _, name, _) -> (match output with | Library -> false | Exe -> true), // isExe sources, options, + targetFramework, name - let disposal, res = compileDisposable outputDirectory isExe (Array.append options compilationRefs) name sources + let disposal, res = compileDisposable outputDirectory isExe (Array.append options compilationRefs) targetFramework name sources disposals.Add(disposal) let deps2 = @@ -686,7 +697,7 @@ Updated automatically, please check diffs in your pull request, changes must be CompilerAssert.Execute(cmpl, newProcess = true, onOutput = (fun output -> Assert.AreEqual(expectedOutput, output, sprintf "'%s' = '%s'" expectedOutput output))) static member Pass (source: string) = - let parseResults, fileAnswer = checker.ParseAndCheckFileInProject("test.fs", 0, SourceText.ofString source, defaultProjectOptions) |> Async.RunImmediate + let parseResults, fileAnswer = checker.ParseAndCheckFileInProject("test.fs", 0, SourceText.ofString source, defaultProjectOptions TargetFramework.Current) |> Async.RunImmediate Assert.IsEmpty(parseResults.Diagnostics, sprintf "Parse errors: %A" parseResults.Diagnostics) @@ -697,7 +708,8 @@ Updated automatically, please check diffs in your pull request, changes must be Assert.IsEmpty(typeCheckResults.Diagnostics, sprintf "Type Check errors: %A" typeCheckResults.Diagnostics) static member PassWithOptions options (source: string) = - let options = { defaultProjectOptions with OtherOptions = Array.append options defaultProjectOptions.OtherOptions} + let defaultOptions = defaultProjectOptions TargetFramework.Current + let options = { defaultOptions with OtherOptions = Array.append options defaultOptions.OtherOptions} let parseResults, fileAnswer = checker.ParseAndCheckFileInProject("test.fs", 0, SourceText.ofString source, options) |> Async.RunImmediate @@ -712,11 +724,12 @@ Updated automatically, please check diffs in your pull request, changes must be static member TypeCheckWithErrorsAndOptionsAgainstBaseLine options (sourceDirectory:string) (sourceFile: string) = let absoluteSourceFile = System.IO.Path.Combine(sourceDirectory, sourceFile) let parseResults, fileAnswer = + let defaultOptions = defaultProjectOptions TargetFramework.Current checker.ParseAndCheckFileInProject( sourceFile, 0, SourceText.ofString (File.ReadAllText absoluteSourceFile), - { defaultProjectOptions with OtherOptions = Array.append options defaultProjectOptions.OtherOptions; SourceFiles = [|sourceFile|] }) + { defaultOptions with OtherOptions = Array.append options defaultOptions.OtherOptions; SourceFiles = [|sourceFile|] }) |> Async.RunImmediate Assert.IsEmpty(parseResults.Diagnostics, sprintf "Parse errors: %A" parseResults.Diagnostics) @@ -742,11 +755,12 @@ Updated automatically, please check diffs in your pull request, changes must be static member TypeCheckWithOptionsAndName options name (source: string) = let errors = let parseResults, fileAnswer = + let defaultOptions = defaultProjectOptions TargetFramework.Current checker.ParseAndCheckFileInProject( name, 0, SourceText.ofString source, - { defaultProjectOptions with OtherOptions = Array.append options defaultProjectOptions.OtherOptions; SourceFiles = [|name|] }) + { defaultOptions with OtherOptions = Array.append options defaultOptions.OtherOptions; SourceFiles = [|name|] }) |> Async.RunImmediate if parseResults.Diagnostics.Length > 0 then @@ -762,11 +776,12 @@ Updated automatically, please check diffs in your pull request, changes must be static member TypeCheckWithOptions options (source: string) = let errors = let parseResults, fileAnswer = + let defaultOptions = defaultProjectOptions TargetFramework.Current checker.ParseAndCheckFileInProject( "test.fs", 0, SourceText.ofString source, - { defaultProjectOptions with OtherOptions = Array.append options defaultProjectOptions.OtherOptions}) + { defaultOptions with OtherOptions = Array.append options defaultOptions.OtherOptions}) |> Async.RunImmediate if parseResults.Diagnostics.Length > 0 then @@ -782,11 +797,12 @@ Updated automatically, please check diffs in your pull request, changes must be /// Parses and type checks the given source. Fails if type checker is aborted. static member ParseAndTypeCheck(options, name, source: string) = let parseResults, fileAnswer = + let defaultOptions = defaultProjectOptions TargetFramework.Current checker.ParseAndCheckFileInProject( name, 0, SourceText.ofString source, - { defaultProjectOptions with OtherOptions = Array.append options defaultProjectOptions.OtherOptions}) + { defaultOptions with OtherOptions = Array.append options defaultOptions.OtherOptions}) |> Async.RunImmediate match fileAnswer with @@ -804,11 +820,12 @@ Updated automatically, please check diffs in your pull request, changes must be static member TypeCheckWithErrorsAndOptionsAndAdjust options libAdjust (source: string) expectedTypeErrors = let errors = let parseResults, fileAnswer = + let defaultOptions = defaultProjectOptions TargetFramework.Current checker.ParseAndCheckFileInProject( "test.fs", 0, SourceText.ofString source, - { defaultProjectOptions with OtherOptions = Array.append options defaultProjectOptions.OtherOptions}) + { defaultOptions with OtherOptions = Array.append options defaultOptions.OtherOptions}) |> Async.RunImmediate if parseResults.Diagnostics.Length > 0 then diff --git a/tests/FSharp.Test.Utilities/DirectoryAttribute.fs b/tests/FSharp.Test.Utilities/DirectoryAttribute.fs index abb37e0b6c..f7c3a380aa 100644 --- a/tests/FSharp.Test.Utilities/DirectoryAttribute.fs +++ b/tests/FSharp.Test.Utilities/DirectoryAttribute.fs @@ -8,6 +8,7 @@ open Xunit.Sdk open FSharp.Compiler.IO open FSharp.Test.Compiler +open FSharp.Test.Utilities /// Attribute to use with Xunit's TheoryAttribute. /// Takes a directory, relative to current test suite's root. @@ -135,7 +136,8 @@ type DirectoryAttribute(dir: string) = Name = Some filename IgnoreWarnings = false References = [] - OutputDirectory = outputDirectory } |> FS + OutputDirectory = outputDirectory + TargetFramework = TargetFramework.Current} |> FS member _.BaselineSuffix with get() = baselineSuffix and set v = baselineSuffix <- v member _.Includes with get() = includes and set v = includes <- v diff --git a/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj b/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj index 0e65633997..89ab2119ad 100644 --- a/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj +++ b/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj @@ -52,7 +52,7 @@ - + @@ -88,6 +88,9 @@ Always + + Always + diff --git a/tests/FSharp.Test.Utilities/Utilities.fs b/tests/FSharp.Test.Utilities/Utilities.fs index 1c6781fdd9..106a400310 100644 --- a/tests/FSharp.Test.Utilities/Utilities.fs +++ b/tests/FSharp.Test.Utilities/Utilities.fs @@ -14,9 +14,9 @@ open Microsoft.CodeAnalysis.CSharp open TestFramework open NUnit.Framework -type TheoryForNETCOREAPPAttribute() = +type TheoryForNETCOREAPPAttribute() = inherit Xunit.TheoryAttribute() - #if !NETCOREAPP + #if !NETCOREAPP do base.Skip <- "Only NETCOREAPP is supported runtime for this kind of test." #endif @@ -86,43 +86,61 @@ module Utilities = let inline getTestsDirectory src dir = src ++ dir - let private getOrCreateResource (resource: byref) (name: string) = - match resource with - | null -> getResourceBlob name - | _ -> resource - module private TestReferences = + let testDirectory = lazy ( + let path = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()) + Directory.CreateDirectory(path) |> ignore + path) + + let private writeToTempDirectory name (image: byte array) = + let path = Path.Combine(testDirectory.Force(), $"{name}.dll") + File.WriteAllBytes(path, image) + path + [] module NetStandard20 = - let netStandard = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netstandard20.netstandard).GetReference(display = "netstandard.dll (netstandard 2.0 ref)") - let mscorlibRef = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netstandard20.mscorlib).GetReference(display = "mscorlib.dll (netstandard 2.0 ref)") - let systemRuntimeRef = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netstandard20.System_Runtime).GetReference(display = "System.Runtime.dll (netstandard 2.0 ref)") - let systemCoreRef = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netstandard20.System_Core).GetReference(display = "System.Core.dll (netstandard 2.0 ref)") - let systemDynamicRuntimeRef = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netstandard20.System_Dynamic_Runtime).GetReference(display = "System.Dynamic.Runtime.dll (netstandard 2.0 ref)") - - - module private NetCoreApp31Refs = - let mutable (_mscorlib: byte[]) = Unchecked.defaultof - let mutable (_netstandard: byte[]) = Unchecked.defaultof - let mutable (_System_Console: byte[]) = Unchecked.defaultof - let mutable (_System_Core: byte[]) = Unchecked.defaultof - let mutable (_System_Dynamic_Runtime: byte[]) = Unchecked.defaultof - let mutable (_System_Runtime: byte[]) = Unchecked.defaultof - let mscorlib () = getOrCreateResource &_mscorlib "mscorlib.dll" - let netstandard () = getOrCreateResource &_netstandard "netstandard.dll" - let System_Core () = getOrCreateResource &_System_Core "System.Core.dll" - let System_Console () = getOrCreateResource &_System_Console "System.Console.dll" - let System_Runtime () = getOrCreateResource &_System_Runtime "System.Runtime.dll" - let System_Dynamic_Runtime () = getOrCreateResource &_System_Dynamic_Runtime "System.Dynamic.Runtime.dll" + let private System_Collections_Immutable = lazy getResourceBlob "System.Collections.Immutable.dll" + + module Files = + let netStandard = lazy writeToTempDirectory "netstandard" TestResources.NetFX.netstandard20.netstandard + let mscorlib = lazy writeToTempDirectory "mscorlib" TestResources.NetFX.netstandard20.mscorlib + let systemRuntime = lazy writeToTempDirectory "System.Runtime" TestResources.NetFX.netstandard20.System_Runtime + let systemCore = lazy writeToTempDirectory "System.Core" TestResources.NetFX.netstandard20.System_Core + let systemDynamicRuntime = lazy writeToTempDirectory "System.Core" TestResources.NetFX.netstandard20.System_Dynamic_Runtime + let systemCollectionsImmutable = lazy writeToTempDirectory "System.Collections.Immutable" (System_Collections_Immutable.Force()) + + module References = + let netStandardRef = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netstandard20.netstandard).GetReference(display = "netstandard.dll (netstandard 2.0 ref)") + let mscorlibRef = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netstandard20.mscorlib).GetReference(display = "mscorlib.dll (netstandard 2.0 ref)") + let systemRuntimeRef = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netstandard20.System_Runtime).GetReference(display = "System.Runtime.dll (netstandard 2.0 ref)") + let systemCoreRef = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netstandard20.System_Core).GetReference(display = "System.Core.dll (netstandard 2.0 ref)") + let systemDynamicRuntimeRef = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netstandard20.System_Dynamic_Runtime).GetReference(display = "System.Dynamic.Runtime.dll (netstandard 2.0 ref)") + let systemCollectionsImmutableRef = lazy AssemblyMetadata.CreateFromImage(System_Collections_Immutable.Force()).GetReference(display = "System.Collections.Immutable.dll (netstandard 2.0 ref)") [] module NetCoreApp31 = - let netStandard = lazy AssemblyMetadata.CreateFromImage(NetCoreApp31Refs.netstandard ()).GetReference(display = "netstandard.dll (netcoreapp 3.1 ref)") - let mscorlibRef = lazy AssemblyMetadata.CreateFromImage(NetCoreApp31Refs.mscorlib ()).GetReference(display = "mscorlib.dll (netcoreapp 3.1 ref)") - let systemRuntimeRef = lazy AssemblyMetadata.CreateFromImage(NetCoreApp31Refs.System_Runtime ()).GetReference(display = "System.Runtime.dll (netcoreapp 3.1 ref)") - let systemCoreRef = lazy AssemblyMetadata.CreateFromImage(NetCoreApp31Refs.System_Core ()).GetReference(display = "System.Core.dll (netcoreapp 3.1 ref)") - let systemDynamicRuntimeRef = lazy AssemblyMetadata.CreateFromImage(NetCoreApp31Refs.System_Dynamic_Runtime ()).GetReference(display = "System.Dynamic.Runtime.dll (netcoreapp 3.1 ref)") - let systemConsoleRef = lazy AssemblyMetadata.CreateFromImage(NetCoreApp31Refs.System_Console ()).GetReference(display = "System.Console.dll (netcoreapp 3.1 ref)") + let private mscorlib = lazy getResourceBlob "mscorlib.dll" + let private netstandard = lazy getResourceBlob "netstandard.dll" + let private System_Console = lazy getResourceBlob "System.Console.dll" + let private System_Core = lazy getResourceBlob "System.Core.dll" + let private System_Dynamic_Runtime = lazy getResourceBlob "System.Dynamic.Runtime.dll" + let private System_Runtime = lazy getResourceBlob "System.Runtime.dll" + + module Files = + let mscorlib = lazy writeToTempDirectory "mscorlib" (mscorlib.Force()) + let netStandard = lazy writeToTempDirectory "netstandard" (netstandard.Force()) + let systemConsole = lazy writeToTempDirectory "System.Console" (System_Console.Force()) + let systemCore = lazy writeToTempDirectory "System.Core" (System_Core.Force()) + let systemDynamicRuntime = lazy writeToTempDirectory "System.Dynamic.Runtime" (System_Dynamic_Runtime.Force()) + let systemRuntime = lazy writeToTempDirectory "System.Runtime" (System_Runtime.Force()) + + module References = + let netStandardRef = lazy AssemblyMetadata.CreateFromImage(netstandard.Force()).GetReference(display = "netstandard.dll (netcoreapp 3.1 ref)") + let mscorlibRef = lazy AssemblyMetadata.CreateFromImage(mscorlib.Force()).GetReference(display = "mscorlib.dll (netcoreapp 3.1 ref)") + let systemConsoleRef = lazy AssemblyMetadata.CreateFromImage(System_Console.Force()).GetReference(display = "System.Console.dll (netcoreapp 3.1 ref)") + let systemCoreRef = lazy AssemblyMetadata.CreateFromImage(System_Core.Force()).GetReference(display = "System.Core.dll (netcoreapp 3.1 ref)") + let systemDynamicRuntimeRef = lazy AssemblyMetadata.CreateFromImage(System_Dynamic_Runtime.Force()).GetReference(display = "System.Dynamic.Runtime.dll (netcoreapp 3.1 ref)") + let systemRuntimeRef = lazy AssemblyMetadata.CreateFromImage(System_Runtime.Force ()).GetReference(display = "System.Runtime.dll (netcoreapp 3.1 ref)") [] module public TargetFrameworkUtil = @@ -230,19 +248,39 @@ let main argv = 0""" open TestReferences + let private netStandard20Files = + lazy ImmutableArray.Create( + NetStandard20.Files.netStandard.Value, + NetStandard20.Files.mscorlib.Value, + NetStandard20.Files.systemRuntime.Value, + NetStandard20.Files.systemCore.Value, + NetStandard20.Files.systemDynamicRuntime.Value, + NetStandard20.Files.systemCollectionsImmutable.Value) + let private netStandard20References = - lazy ImmutableArray.Create(NetStandard20.netStandard.Value, NetStandard20.mscorlibRef.Value, NetStandard20.systemRuntimeRef.Value, NetStandard20.systemCoreRef.Value, NetStandard20.systemDynamicRuntimeRef.Value) + lazy ImmutableArray.Create( + NetStandard20.References.netStandardRef.Value, + NetStandard20.References.mscorlibRef.Value, + NetStandard20.References.systemRuntimeRef.Value, + NetStandard20.References.systemCoreRef.Value, + NetStandard20.References.systemDynamicRuntimeRef.Value, + NetStandard20.References.systemCollectionsImmutableRef.Value) + let private netCoreApp31References = - lazy ImmutableArray.Create(NetCoreApp31.netStandard.Value, NetCoreApp31.mscorlibRef.Value, NetCoreApp31.systemRuntimeRef.Value, NetCoreApp31.systemCoreRef.Value, NetCoreApp31.systemDynamicRuntimeRef.Value, NetCoreApp31.systemConsoleRef.Value) + lazy ImmutableArray.Create( + NetCoreApp31.References.netStandardRef.Value, + NetCoreApp31.References.mscorlibRef.Value, + NetCoreApp31.References.systemRuntimeRef.Value, + NetCoreApp31.References.systemCoreRef.Value, + NetCoreApp31.References.systemDynamicRuntimeRef.Value, + NetCoreApp31.References.systemConsoleRef.Value) let currentReferences = getNetCoreAppReferences let currentReferencesAsPEs = getNetCoreAppReferences - |> Seq.map (fun x -> - PortableExecutableReference.CreateFromFile(x) - ) + |> Seq.map (fun x -> PortableExecutableReference.CreateFromFile(x)) |> ImmutableArray.CreateRange let getReferences tf = @@ -250,3 +288,9 @@ let main argv = 0""" | TargetFramework.NetStandard20 -> netStandard20References.Value | TargetFramework.NetCoreApp31 -> netCoreApp31References.Value | TargetFramework.Current -> currentReferencesAsPEs + + let getFileReferences tf = + match tf with + | TargetFramework.NetStandard20 -> netStandard20Files.Value |> Seq.toArray + | TargetFramework.NetCoreApp31 -> [||] //ToDo --- Perhaps NetCoreApp31Files + | TargetFramework.Current -> currentReferences diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticLinkTests.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticLinkTests.fs index 00ffedb910..2349afe4fd 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticLinkTests.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticLinkTests.fs @@ -5,6 +5,7 @@ namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL open System.IO open System.Reflection open FSharp.Test +open FSharp.Test.Utilities open NUnit.Framework [] @@ -222,7 +223,7 @@ if not test3 then if test1 && test2 && test3 then () else failwith "Test Failed" """ - Compilation.Create(source, Exe, [|"--optimize+"|], [CompilationReference.CreateFSharp(module1, staticLink=true)]) + Compilation.Create(source, Exe, [|"--optimize+"|], TargetFramework.Current, [CompilationReference.CreateFSharp(module1, staticLink=true)]) CompilerAssert.Execute(module2, ignoreWarnings=true) diff --git a/tests/fsharp/Compiler/Service/MultiProjectTests.fs b/tests/fsharp/Compiler/Service/MultiProjectTests.fs index 25ad78f019..0505bcdcae 100644 --- a/tests/fsharp/Compiler/Service/MultiProjectTests.fs +++ b/tests/fsharp/Compiler/Service/MultiProjectTests.fs @@ -45,7 +45,7 @@ namespace CSharpTest let stamp = DateTime.UtcNow let csRefProj = FSharpReferencedProject.CreatePortableExecutable("""Z:\csharp_test.dll""", (fun () -> stamp), getStream) - let fsOptions = CompilerAssert.DefaultProjectOptions + let fsOptions = CompilerAssert.DefaultProjectOptions TargetFramework.Current let fsOptions = { fsOptions with ProjectId = Some(Guid.NewGuid().ToString()) @@ -155,7 +155,7 @@ let x = Script1.x """ try - let fsOptions1 = CompilerAssert.DefaultProjectOptions + let fsOptions1 = CompilerAssert.DefaultProjectOptions TargetFramework.Current let fsOptions1 = { fsOptions1 with ProjectId = Some(Guid.NewGuid().ToString()) From c20001ac7ebcdd701d8445be93bdcfcb1b640463 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Tue, 14 Feb 2023 17:00:36 -0800 Subject: [PATCH 2/9] do public properly --- src/Compiler/Driver/CompilerImports.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs index fe1d608191..031885f8bc 100644 --- a/src/Compiler/Driver/CompilerImports.fs +++ b/src/Compiler/Driver/CompilerImports.fs @@ -1177,7 +1177,7 @@ and [] TcImports match e.TypeReprInfo with | TILObjectRepr data -> let (TILObjectReprData(_, _, tyDef)) = data - not (tyDef.Access = ILTypeDefAccess.Public) + tyDef.Access = ILTypeDefAccess.Public | _ -> true else true | None -> false From c8e4542e2b40302b246619091cf9dd2bb7ea5284 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Tue, 14 Feb 2023 17:32:10 -0800 Subject: [PATCH 3/9] really --- src/Compiler/TypedTree/TcGlobals.fs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs index cc58ab8fc9..87648d0e2b 100755 --- a/src/Compiler/TypedTree/TcGlobals.fs +++ b/src/Compiler/TypedTree/TcGlobals.fs @@ -333,20 +333,23 @@ type TcGlobals( | Some _ -> Some (findSysAttrib nm) | None -> None - let findPublicSysAttrib nm = + let tryFindPublicSysTyconRef path nm = + match tryFindPublicSysTypeCcu path nm with + | Some ccu -> Some (mkNonLocalTyconRef2 ccu (Array.ofList path) nm) + | None -> None + + let findPublicSysILTypeRef nm = let path, typeName = splitILTypeName nm - let ccu = + let scoref = match tryFindPublicSysTypeCcu path typeName with - | None -> CcuThunk.CreateDelayed(dummyAssemblyNameCarryingUsefulErrorInformation path typeName) - | Some ccu -> ccu - let tref = - let scoref = - match tryFindSysTypeCcu path typeName with - | None -> ILScopeRef.Assembly (mkSimpleAssemblyRef (dummyAssemblyNameCarryingUsefulErrorInformation path typeName)) - | Some ccu -> ccu.ILScopeRef - mkILTyRef (scoref, nm) - let tcref = mkNonLocalTyconRef2 ccu (Array.ofList path) nm - AttribInfo(tref, tcref) + | None -> ILScopeRef.Assembly (mkSimpleAssemblyRef (dummyAssemblyNameCarryingUsefulErrorInformation path typeName)) + | Some ccu -> ccu.ILScopeRef + mkILTyRef (scoref, nm) + + let findPublicSysAttrib nm = + let tref = findPublicSysILTypeRef nm + let path, typeName = splitILTypeName nm + AttribInfo(tref, findSysTyconRef path typeName) let findOrEmbedSysPublicAttribute nm = let sysAttrib = findPublicSysAttrib nm From 44d982ab03f13b9ca53f46fa747ae23b6382bbb1 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Tue, 14 Feb 2023 19:37:26 -0800 Subject: [PATCH 4/9] temp --- src/Compiler/Driver/CompilerImports.fs | 2 +- src/Compiler/TypedTree/TcGlobals.fs | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs index 031885f8bc..c649df2603 100644 --- a/src/Compiler/Driver/CompilerImports.fs +++ b/src/Compiler/Driver/CompilerImports.fs @@ -1178,7 +1178,7 @@ and [] TcImports | TILObjectRepr data -> let (TILObjectReprData(_, _, tyDef)) = data tyDef.Access = ILTypeDefAccess.Public - | _ -> true + | _ -> false else true | None -> false | None -> false diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs index 87648d0e2b..281760919b 100755 --- a/src/Compiler/TypedTree/TcGlobals.fs +++ b/src/Compiler/TypedTree/TcGlobals.fs @@ -333,6 +333,11 @@ type TcGlobals( | Some _ -> Some (findSysAttrib nm) | None -> None + let findPublicSysTypeCcu path typeName = + match tryFindPublicSysTypeCcu path typeName with + | None -> CcuThunk.CreateDelayed(dummyAssemblyNameCarryingUsefulErrorInformation path typeName) + | Some ccu -> ccu + let tryFindPublicSysTyconRef path nm = match tryFindPublicSysTypeCcu path nm with | Some ccu -> Some (mkNonLocalTyconRef2 ccu (Array.ofList path) nm) @@ -346,10 +351,14 @@ type TcGlobals( | Some ccu -> ccu.ILScopeRef mkILTyRef (scoref, nm) + let findPublicSysTyconRef path nm = + let ccu = findPublicSysTypeCcu path nm + mkNonLocalTyconRef2 ccu (Array.ofList path) nm + let findPublicSysAttrib nm = let tref = findPublicSysILTypeRef nm let path, typeName = splitILTypeName nm - AttribInfo(tref, findSysTyconRef path typeName) + AttribInfo(tref, findPublicSysTyconRef path typeName) let findOrEmbedSysPublicAttribute nm = let sysAttrib = findPublicSysAttrib nm From a5f990fa6b4a708058f187ff49a82b9c8a679b75 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Wed, 15 Feb 2023 01:04:54 -0800 Subject: [PATCH 5/9] baelines --- src/Compiler/TypedTree/TcGlobals.fs | 54 +++++++++---------- .../Structs02_asNetStandard20.fs.il.debug.bsl | 8 +-- ...tructs02_asNetStandard20.fs.il.release.bsl | 8 +-- 3 files changed, 37 insertions(+), 33 deletions(-) diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs index 281760919b..5bfef4bf7d 100755 --- a/src/Compiler/TypedTree/TcGlobals.fs +++ b/src/Compiler/TypedTree/TcGlobals.fs @@ -103,24 +103,6 @@ let mk_MFCompilerServices_tcref ccu n = mkNonLocalTyconRef2 ccu CompilerServices let mk_MFRuntimeHelpers_tcref ccu n = mkNonLocalTyconRef2 ccu RuntimeHelpersPath n let mk_MFControl_tcref ccu n = mkNonLocalTyconRef2 ccu ControlPathArray n -let mkLocalPrivateAttributeWithDefaultConstructor (ilg: ILGlobals, name: string) = - let ctor = mkILNonGenericEmptyCtor (ilg.typ_Attribute, None, None) - - mkILGenericClass ( - name, - ILTypeDefAccess.Private, - ILGenericParameterDefs.Empty, - ilg.typ_Attribute, - ILTypes.Empty, - mkILMethods [ ctor ], - emptyILFields, - emptyILTypeDefs, - emptyILProperties, - emptyILEvents, - emptyILCustomAttrs, - ILTypeInit.BeforeField - ) - type [] BuiltinAttribInfo = @@ -901,12 +883,6 @@ type TcGlobals( let mkCompilerGeneratedAttribute () = mkILCustomAttribute (tref_CompilerGeneratedAttribute, [], [], []) let compilerGlobalState = CompilerGlobalState() - // Todo: Review mkILCustomAttribute throughout fsc/fsi/ fcs to ensure that we use embedable attributes where appropriate - let addEmbeddableCustomAttribute (tref: ILTypeRef, argTys, argvs, propvs) = - if tref.Scope = ILScopeRef.Local && not(embeddedILTypeDefs.ContainsKey(tref.Name)) then - embeddedILTypeDefs.TryAdd(tref.Name, mkLocalPrivateAttributeWithDefaultConstructor (ilg, tref.Name)) |> ignore - mkILCustomAttribute (tref, argTys, argvs, propvs) - // Requests attributes to be added to compiler generated methods. let addGeneratedAttrs (attrs: ILAttributes) = let attribs = @@ -949,6 +925,33 @@ type TcGlobals( let mkDebuggerTypeProxyAttribute (ty : ILType) = mkILCustomAttribute (findSysILTypeRef tname_DebuggerTypeProxyAttribute, [ilg.typ_Type], [ILAttribElem.TypeRef (Some ty.TypeRef)], []) + // Todo: Review mkILCustomAttribute throughout fsc/fsi/ fcs to ensure that we use embedable attributes where appropriate + let mkLocalPrivateAttributeWithDefaultConstructor (ilg: ILGlobals, name: string) = + + let ctor = addMethodGeneratedAttrs (mkILNonGenericEmptyCtor (ilg.typ_Attribute, None, None)) + + mkILGenericClass ( + name, + ILTypeDefAccess.Private, + ILGenericParameterDefs.Empty, + ilg.typ_Attribute, + ILTypes.Empty, + mkILMethods [ ctor ], + emptyILFields, + emptyILTypeDefs, + emptyILProperties, + emptyILEvents, + emptyILCustomAttrs, + ILTypeInit.BeforeField + ) + + let addEmbeddableCustomAttribute (tref: ILTypeRef, argTys, argvs, propvs) = + + if tref.Scope = ILScopeRef.Local && not(embeddedILTypeDefs.ContainsKey(tref.Name)) then + embeddedILTypeDefs.TryAdd(tref.Name, mkLocalPrivateAttributeWithDefaultConstructor (ilg, tref.Name)) |> ignore + + mkILCustomAttribute (tref, argTys, argvs, propvs) + let betterTyconEntries = [| "Int32" , v_int_tcr "IntPtr" , v_nativeint_tcr @@ -1817,9 +1820,6 @@ type TcGlobals( /// Indicates if we can use System.Array.Empty when emitting IL for empty array literals member val isArrayEmptyAvailable = v_Array_tcref.ILTyconRawMetadata.Methods.FindByName "Empty" |> List.isEmpty |> not - /// Indicates if we can emit the System.Runtime.CompilerServices.IsReadOnlyAttribute - member val isSystem_Runtime_CompilerServices_IsReadOnlyAttributeAvailable = tryFindSysTypeCcu sysCompilerServices "IsReadOnlyAttribute" |> Option.isSome - member _.FindSysTyconRef path nm = findSysTyconRef path nm member _.TryFindSysTyconRef path nm = tryFindSysTyconRef path nm diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.debug.bsl index 0c84f18e77..dcc61118de 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.debug.bsl @@ -42,13 +42,13 @@ // WARNING: managed resource file FSharpOptimizationData.Structs02_asNetStandard20 created } .module Structs02_asNetStandard20.dll -// MVID: {63EC00CF-37AB-0DD0-A745-0383CF00EC63} +// MVID: {63EC9609-37AB-0DD0-A745-03830996EC63} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x00000249F4B00000 +// Image base: 0x000001D3ECF40000 // =============== CLASS MEMBERS DECLARATION =================== @@ -392,6 +392,8 @@ .method public specialname rtspecialname instance void .ctor() cil managed { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [netstandard]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 @@ -405,4 +407,4 @@ // ============================================================= // *********** DISASSEMBLY COMPLETE *********************** -// WARNING: Created Win32 resource file C:\kevinransom\fsharp\artifacts\bin\FSharp.Compiler.ComponentTests\Debug\net472\tests\EmittedIL\Misc\Structs02_asNetStandard20_fs\Structs02_asNetStandard20.res +// WARNING: Created Win32 resource file C:\kevinransom\fsharp\artifacts\bin\FSharp.Compiler.ComponentTests\debug\net472\tests\EmittedIL\Misc\Structs02_asNetStandard20_fs\Structs02_asNetStandard20.res diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.release.bsl index 158f0d1b7c..d69123aa3f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02_asNetStandard20.fs.il.release.bsl @@ -42,13 +42,13 @@ // WARNING: managed resource file FSharpOptimizationData.Structs02_asNetStandard20 created } .module Structs02_asNetStandard20.dll -// MVID: {63EC03D0-37AB-0DD0-A745-0383D003EC63} +// MVID: {63EC9111-37AB-0DD0-A745-03831191EC63} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x000001DC13190000 +// Image base: 0x000002C5E0CF0000 // =============== CLASS MEMBERS DECLARATION =================== @@ -359,6 +359,8 @@ .method public specialname rtspecialname instance void .ctor() cil managed { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [netstandard]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 @@ -372,4 +374,4 @@ // ============================================================= // *********** DISASSEMBLY COMPLETE *********************** -// WARNING: Created Win32 resource file C:\kevinransom\fsharp\artifacts\bin\FSharp.Compiler.ComponentTests\Release\net472\tests\EmittedIL\Misc\Structs02_asNetStandard20_fs\Structs02_asNetStandard20.res +// WARNING: Created Win32 resource file C:\kevinransom\fsharp\artifacts\bin\FSharp.Compiler.ComponentTests\release\net472\tests\EmittedIL\Misc\Structs02_asNetStandard20_fs\Structs02_asNetStandard20.res From fdd86012f0ca34ff05e7af7b624c0b4c9f798a5a Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Wed, 15 Feb 2023 02:14:09 -0800 Subject: [PATCH 6/9] cleanup --- src/Compiler/TypedTree/TcGlobals.fs | 34 +++++++++-------------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs index 5bfef4bf7d..a002981211 100755 --- a/src/Compiler/TypedTree/TcGlobals.fs +++ b/src/Compiler/TypedTree/TcGlobals.fs @@ -315,32 +315,18 @@ type TcGlobals( | Some _ -> Some (findSysAttrib nm) | None -> None - let findPublicSysTypeCcu path typeName = - match tryFindPublicSysTypeCcu path typeName with - | None -> CcuThunk.CreateDelayed(dummyAssemblyNameCarryingUsefulErrorInformation path typeName) - | Some ccu -> ccu - - let tryFindPublicSysTyconRef path nm = - match tryFindPublicSysTypeCcu path nm with - | Some ccu -> Some (mkNonLocalTyconRef2 ccu (Array.ofList path) nm) - | None -> None - - let findPublicSysILTypeRef nm = - let path, typeName = splitILTypeName nm - let scoref = - match tryFindPublicSysTypeCcu path typeName with - | None -> ILScopeRef.Assembly (mkSimpleAssemblyRef (dummyAssemblyNameCarryingUsefulErrorInformation path typeName)) - | Some ccu -> ccu.ILScopeRef - mkILTyRef (scoref, nm) - - let findPublicSysTyconRef path nm = - let ccu = findPublicSysTypeCcu path nm - mkNonLocalTyconRef2 ccu (Array.ofList path) nm - let findPublicSysAttrib nm = - let tref = findPublicSysILTypeRef nm let path, typeName = splitILTypeName nm - AttribInfo(tref, findPublicSysTyconRef path typeName) + let tref, ccu = + let scoref, ccu = + match tryFindPublicSysTypeCcu path typeName with + | None -> + ILScopeRef.Assembly (mkSimpleAssemblyRef (dummyAssemblyNameCarryingUsefulErrorInformation path typeName)), + CcuThunk.CreateDelayed(dummyAssemblyNameCarryingUsefulErrorInformation path typeName) + | Some ccu -> ccu.ILScopeRef, ccu + mkILTyRef (scoref, nm), ccu + let tcref = mkNonLocalTyconRef2 ccu (Array.ofList path) nm + AttribInfo(tref, tcref) let findOrEmbedSysPublicAttribute nm = let sysAttrib = findPublicSysAttrib nm From 123cfd5b85613abda0c799989a528d378a8c37ff Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Wed, 15 Feb 2023 02:48:34 -0800 Subject: [PATCH 7/9] ok --- src/Compiler/TypedTree/TcGlobals.fs | 34 ++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs index a002981211..5bfef4bf7d 100755 --- a/src/Compiler/TypedTree/TcGlobals.fs +++ b/src/Compiler/TypedTree/TcGlobals.fs @@ -315,18 +315,32 @@ type TcGlobals( | Some _ -> Some (findSysAttrib nm) | None -> None + let findPublicSysTypeCcu path typeName = + match tryFindPublicSysTypeCcu path typeName with + | None -> CcuThunk.CreateDelayed(dummyAssemblyNameCarryingUsefulErrorInformation path typeName) + | Some ccu -> ccu + + let tryFindPublicSysTyconRef path nm = + match tryFindPublicSysTypeCcu path nm with + | Some ccu -> Some (mkNonLocalTyconRef2 ccu (Array.ofList path) nm) + | None -> None + + let findPublicSysILTypeRef nm = + let path, typeName = splitILTypeName nm + let scoref = + match tryFindPublicSysTypeCcu path typeName with + | None -> ILScopeRef.Assembly (mkSimpleAssemblyRef (dummyAssemblyNameCarryingUsefulErrorInformation path typeName)) + | Some ccu -> ccu.ILScopeRef + mkILTyRef (scoref, nm) + + let findPublicSysTyconRef path nm = + let ccu = findPublicSysTypeCcu path nm + mkNonLocalTyconRef2 ccu (Array.ofList path) nm + let findPublicSysAttrib nm = + let tref = findPublicSysILTypeRef nm let path, typeName = splitILTypeName nm - let tref, ccu = - let scoref, ccu = - match tryFindPublicSysTypeCcu path typeName with - | None -> - ILScopeRef.Assembly (mkSimpleAssemblyRef (dummyAssemblyNameCarryingUsefulErrorInformation path typeName)), - CcuThunk.CreateDelayed(dummyAssemblyNameCarryingUsefulErrorInformation path typeName) - | Some ccu -> ccu.ILScopeRef, ccu - mkILTyRef (scoref, nm), ccu - let tcref = mkNonLocalTyconRef2 ccu (Array.ofList path) nm - AttribInfo(tref, tcref) + AttribInfo(tref, findPublicSysTyconRef path typeName) let findOrEmbedSysPublicAttribute nm = let sysAttrib = findPublicSysAttrib nm From fb13193b2760508706cd8afa88ed7e7346f19986 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Wed, 15 Feb 2023 09:52:37 -0800 Subject: [PATCH 8/9] .gitignore --- .gitignore | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.gitignore b/.gitignore index 875098dae1..78418b2b36 100644 --- a/.gitignore +++ b/.gitignore @@ -125,16 +125,3 @@ nCrunchTemp_* tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.actual *.vsp -/Z.fs -/Y.fs -/X.fs -/Library.fs -/Ghost.fs -/D.fsi -/D.fs -/C.fsi -/C.fs -/B.fsi -/B.fs -/A.fsi -/A.fs From a9c6f2e5de6675cfc072108ac4ab11f5f81562d3 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Wed, 15 Feb 2023 11:30:22 -0800 Subject: [PATCH 9/9] refactor --- src/Compiler/TypedTree/TcGlobals.fs | 35 +++++++++-------------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs index 5bfef4bf7d..b9bb006f31 100755 --- a/src/Compiler/TypedTree/TcGlobals.fs +++ b/src/Compiler/TypedTree/TcGlobals.fs @@ -315,32 +315,19 @@ type TcGlobals( | Some _ -> Some (findSysAttrib nm) | None -> None - let findPublicSysTypeCcu path typeName = - match tryFindPublicSysTypeCcu path typeName with - | None -> CcuThunk.CreateDelayed(dummyAssemblyNameCarryingUsefulErrorInformation path typeName) - | Some ccu -> ccu - - let tryFindPublicSysTyconRef path nm = - match tryFindPublicSysTypeCcu path nm with - | Some ccu -> Some (mkNonLocalTyconRef2 ccu (Array.ofList path) nm) - | None -> None - - let findPublicSysILTypeRef nm = - let path, typeName = splitILTypeName nm - let scoref = - match tryFindPublicSysTypeCcu path typeName with - | None -> ILScopeRef.Assembly (mkSimpleAssemblyRef (dummyAssemblyNameCarryingUsefulErrorInformation path typeName)) - | Some ccu -> ccu.ILScopeRef - mkILTyRef (scoref, nm) - - let findPublicSysTyconRef path nm = - let ccu = findPublicSysTypeCcu path nm - mkNonLocalTyconRef2 ccu (Array.ofList path) nm - let findPublicSysAttrib nm = - let tref = findPublicSysILTypeRef nm let path, typeName = splitILTypeName nm - AttribInfo(tref, findPublicSysTyconRef path typeName) + let scoref, ccu = + match tryFindPublicSysTypeCcu path typeName with + | None -> + ILScopeRef.Assembly (mkSimpleAssemblyRef (dummyAssemblyNameCarryingUsefulErrorInformation path typeName)), + CcuThunk.CreateDelayed(dummyAssemblyNameCarryingUsefulErrorInformation path typeName) + | Some ccu -> + ccu.ILScopeRef, + ccu + let tref = mkILTyRef (scoref, nm) + let tcref = mkNonLocalTyconRef2 ccu (Array.ofList path) typeName + AttribInfo(tref, tcref) let findOrEmbedSysPublicAttribute nm = let sysAttrib = findPublicSysAttrib nm