diff --git a/src/Compiler/Checking/AugmentWithHashCompare.fs b/src/Compiler/Checking/AugmentWithHashCompare.fs index 1876f30e17ea..1f477c554a5c 100644 --- a/src/Compiler/Checking/AugmentWithHashCompare.fs +++ b/src/Compiler/Checking/AugmentWithHashCompare.fs @@ -1046,7 +1046,7 @@ type EqualityWithComparerAugmentation = GetHashCode: Val GetHashCodeWithComparer: Val EqualsWithComparer: Val - EqualsExactWithComparer: Val + EqualsWithExactComparer: Val } let CheckAugmentationAttribs isImplementation g amap (tycon: Tycon) = @@ -1322,7 +1322,7 @@ let MakeValsForCompareWithComparerAugmentation g (tcref: TyconRef) = let MakeValsForEqualsAugmentation g (tcref: TyconRef) = let m = tcref.Range let _, ty = mkMinimalTy g tcref - let vis = tcref.TypeReprAccessibility + let vis = tcref.Accessibility let tps = tcref.Typars m let objEqualsVal = @@ -1347,14 +1347,13 @@ let MakeValsForEqualsAugmentation g (tcref: TyconRef) = let MakeValsForEqualityWithComparerAugmentation g (tcref: TyconRef) = let _, ty = mkMinimalTy g tcref - let vis = tcref.TypeReprAccessibility - + let vis = tcref.Accessibility let tps = tcref.Typars tcref.Range let objGetHashCodeVal = mkValSpec g tcref ty vis (Some(mkGetHashCodeSlotSig g)) "GetHashCode" (tps +-> (mkHashTy g ty)) unitArg false - let withcGetHashCodeVal = + let withGetHashCodeVal = mkValSpec g tcref @@ -1366,11 +1365,11 @@ let MakeValsForEqualityWithComparerAugmentation g (tcref: TyconRef) = unaryArg false - let withcEqualsVal = + let withEqualsVal = mkValSpec g tcref ty vis (Some(mkIStructuralEquatableEqualsSlotSig g)) "Equals" (tps +-> (mkEqualsWithComparerTy g ty)) tupArg false - let withcEqualsValExactWithComparer = - let vis = TAccess (updateSyntaxAccessForCompPath (tcref.TypeReprAccessibility.CompilationPaths) SyntaxAccess.Public) + let withEqualsWithExactComparer = + let vis = TAccess (updateSyntaxAccessForCompPath (vis.CompilationPaths) SyntaxAccess.Public) mkValSpec g tcref @@ -1382,12 +1381,11 @@ let MakeValsForEqualityWithComparerAugmentation g (tcref: TyconRef) = (tps +-> (mkEqualsWithComparerTyExact g ty)) tupArg false - { GetHashCode = objGetHashCodeVal - GetHashCodeWithComparer = withcGetHashCodeVal - EqualsWithComparer = withcEqualsVal - EqualsExactWithComparer = withcEqualsValExactWithComparer + GetHashCodeWithComparer = withGetHashCodeVal + EqualsWithComparer = withEqualsVal + EqualsWithExactComparer = withEqualsWithExactComparer } let MakeBindingsForCompareAugmentation g (tycon: Tycon) = diff --git a/src/Compiler/Checking/AugmentWithHashCompare.fsi b/src/Compiler/Checking/AugmentWithHashCompare.fsi index 4a7d74311b17..dbceab6a421d 100644 --- a/src/Compiler/Checking/AugmentWithHashCompare.fsi +++ b/src/Compiler/Checking/AugmentWithHashCompare.fsi @@ -12,7 +12,7 @@ type EqualityWithComparerAugmentation = { GetHashCode: Val GetHashCodeWithComparer: Val EqualsWithComparer: Val - EqualsExactWithComparer: Val } + EqualsWithExactComparer: Val } val CheckAugmentationAttribs: bool -> TcGlobals -> Import.ImportMap -> Tycon -> unit diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index b1ed720c9734..8462b78a464d 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -836,12 +836,12 @@ module AddAugmentationDeclarations = mkLocalValRef augmentation.GetHashCode, mkLocalValRef augmentation.GetHashCodeWithComparer, mkLocalValRef augmentation.EqualsWithComparer, - Some (mkLocalValRef augmentation.EqualsExactWithComparer)) + Some (mkLocalValRef augmentation.EqualsWithExactComparer)) PublishValueDefn cenv env ModuleOrMemberBinding augmentation.GetHashCode PublishValueDefn cenv env ModuleOrMemberBinding augmentation.GetHashCodeWithComparer PublishValueDefn cenv env ModuleOrMemberBinding augmentation.EqualsWithComparer - PublishValueDefnMaybeInclCompilerGenerated cenv env true ModuleOrMemberBinding augmentation.EqualsExactWithComparer + PublishValueDefnMaybeInclCompilerGenerated cenv env true ModuleOrMemberBinding augmentation.EqualsWithExactComparer let AddGenericCompareBindings (cenv: cenv) (tycon: Tycon) = if (* AugmentTypeDefinitions.TyconIsCandidateForAugmentationWithCompare cenv.g tycon && *) Option.isSome tycon.GeneratedCompareToValues then diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 26ec0dfcff77..86f659b10e3a 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -2212,7 +2212,7 @@ type AnonTypeGenerationTable() = mkLocalValRef augmentation.GetHashCode, mkLocalValRef augmentation.GetHashCodeWithComparer, mkLocalValRef augmentation.EqualsWithComparer, - Some(mkLocalValRef augmentation.EqualsExactWithComparer) + Some(mkLocalValRef augmentation.EqualsWithExactComparer) ) // Build the ILTypeDef. We don't rely on the normal record generation process because we want very specific field names diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs index 5b89dfddc81e..1d6f9bb3fc0f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs @@ -769,9 +769,7 @@ let main _ = |> shouldSucceed |> verifyIL [ """ - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2 - '|IsEqual|IsNonEqual|'<(class [Potato]Potato.Lib/IPotato`1) T>(!!T x, - !!T y) cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2 '|IsEqual|IsNonEqual|'<(class [Potato]Potato.Lib/IPotato`1) T>(!!T x, !!T y) cil managed { .maxstack 8 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs index 57f639540c31..c27e38fc304f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs @@ -871,8 +871,7 @@ let main args = IL_0002: newobj instance void Foo/StructUnion::.ctor(int32) IL_0007: ret }""";(*This is a 'maker method' New{CaseName} used for cases which do have fields associated with them, + the _tag gets initialized*)""" - NewCase3(string _field1_3, - string _field2_3) cil managed + NewCase3(string _field1_3, string _field2_3) cil managed { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, int32) = ( 01 00 08 00 00 00 02 00 00 00 00 00 ) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ByRefTests.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ByRefTests.fs index ef8dbac0f0db..b0648b3037a9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ByRefTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ByRefTests.fs @@ -283,9 +283,7 @@ type C() = .get instance int32& modreq([runtime]System.Runtime.InteropServices.InAttribute) Test/C::get_X() }""" - let verifyMethod = """.method public hidebysig specialname - instance int32& modreq([runtime]System.Runtime.InteropServices.InAttribute) - get_X() cil managed + let verifyMethod = """.method public hidebysig specialname instance int32& modreq([runtime]System.Runtime.InteropServices.InAttribute) get_X() cil managed { .param [0] .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )""" @@ -313,9 +311,7 @@ type C() = .get instance int32& modreq([netstandard]System.Runtime.InteropServices.InAttribute) Test/C::get_X() }""" - let verifyMethod = """.method public hidebysig specialname - instance int32& modreq([netstandard]System.Runtime.InteropServices.InAttribute) - get_X() cil managed + let verifyMethod = """.method public hidebysig specialname instance int32& modreq([netstandard]System.Runtime.InteropServices.InAttribute) get_X() cil managed { .param [0] .custom instance void System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )""" @@ -452,9 +448,7 @@ type C<'T>() = abstract X<'U> : unit -> inref<'U> """ - let verifyMethod = """.method public hidebysig abstract virtual - instance !!U& modreq([runtime]System.Runtime.InteropServices.InAttribute) - X() cil managed + let verifyMethod = """.method public hidebysig abstract virtual instance !!U& modreq([runtime]System.Runtime.InteropServices.InAttribute) X() cil managed { .param [0] .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )""" @@ -481,9 +475,7 @@ type C = .get instance int32& modreq([runtime]System.Runtime.InteropServices.InAttribute) Test/C::get_X() }""" - let verifyMethod = """.method public hidebysig specialname abstract virtual - instance int32& modreq([runtime]System.Runtime.InteropServices.InAttribute) - get_X() cil managed + let verifyMethod = """.method public hidebysig specialname abstract virtual instance int32& modreq([runtime]System.Runtime.InteropServices.InAttribute) get_X() cil managed { .param [0] .custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )""" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember.fs index 028ba3000199..79dc02b6c4c0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember.fs @@ -144,3 +144,59 @@ type ILArrayShape = ] |> shouldSucceed + [] // RealSig + [] // Regular + [] + let ``private DU in module`` (realSig, expected) = + FSharp """ +module RealInternalSignature +module Module = + type private DU = ABC | YYZ + + let publicFunction () : bool = + ABC = YYZ + +Module.publicFunction () |> printfn "%b" +""" + |> asExe + |> withRealInternalSignature realSig + |> compileAndRun + |> withILContains [ + $$""" + .method {{expected}} hidebysig instance bool Equals(class RealInternalSignature/Module/DU obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (int32 V_0, + int32 V_1) + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_001b + + IL_0003: ldarg.1 + IL_0004: brfalse.s IL_0019 + + IL_0006: ldarg.0 + IL_0007: ldfld int32 RealInternalSignature/Module/DU::_tag + IL_000c: stloc.0 + IL_000d: ldarg.1 + IL_000e: ldfld int32 RealInternalSignature/Module/DU::_tag + IL_0013: stloc.1 + IL_0014: ldloc.0 + IL_0015: ldloc.1 + IL_0016: ceq + IL_0018: ret + + IL_0019: ldc.i4.0 + IL_001a: ret + + IL_001b: ldarg.1 + IL_001c: ldnull + IL_001d: cgt.un + IL_001f: ldc.i4.0 + IL_0020: ceq + IL_0022: ret + } +""" + ] + |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/CrossAssembly.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/CrossAssembly.fs index a93d48635fe5..fe2a30cabcb5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/CrossAssembly.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/CrossAssembly.fs @@ -54,11 +54,11 @@ Value.Zero = Value.Create 0 |> ignore""" |> compileExeAndRun |> shouldSucceed - [] // Legacy, private WrapType, private visibility in IL + [] // Legacy, private WrapType, assembly visibility in IL [] // RealSig, internal WrapType, assembly visibility in IL [] // Legacy, public WrapType, public visibility in IL - [] // RealSig, private WrapType, private visibility in IL - [] // RealSig, internal WrapType, assembly visibility in IL + [] // RealSig, private WrapType, private visibility in IL + [] // RealSig, internal WrapType, assembly visibility in IL [] // RealSig, public WrapType, public visibility in IL [] let ``Generated typed Equals`` (realsig, typeScope, targetVisibility) = @@ -81,9 +81,7 @@ module Module1 = |> shouldSucceed |> verifyIL [ $""" - .method {targetVisibility} hidebysig instance bool - Equals(valuetype Program/Module1/Struct obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method {targetVisibility} hidebysig instance bool Equals(valuetype Program/Module1/Struct obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed {{ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -172,8 +170,8 @@ module Module1 = [] // Legacy, private WrapType, private visibility in IL [] // RealSig, internal WrapType, assembly visibility in IL [] // Legacy, public WrapType, public visibility in IL - [] // RealSig, private WrapType, private visibility in IL - [] // RealSig, internal WrapType, assembly visibility in IL + [] // RealSig, private WrapType, public visibility in IL + [] // RealSig, internal WrapType, public visibility in IL [] // RealSig, public WrapType, public visibility in IL [] let ``scoped type arg`` (realsig, argScope, targetVisibility) = @@ -195,9 +193,7 @@ module IPartialEqualityComparer = |> shouldSucceed |> verifyIL [ $""" - .method {targetVisibility} hidebysig instance bool - Equals(class Program/IPartialEqualityComparer/WrapType`1 obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method {targetVisibility} hidebysig instance bool Equals(class Program/IPartialEqualityComparer/WrapType`1 obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed {{ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.net472.bsl index 95ca3211f00d..c9ea94af41cf 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.net472.bsl @@ -128,9 +128,7 @@ IL_000c: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [runtime]System.Collections.IComparer comp) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -235,9 +233,7 @@ IL_000b: ret } - .method assembly hidebysig instance bool - Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeStruct obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig instance bool Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeStruct obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -259,9 +255,7 @@ IL_0020: ret } - .method public hidebysig virtual final - instance bool Equals(object obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -285,9 +279,7 @@ IL_0019: ret } - .method public specialname rtspecialname - instance void .ctor(int32 v, - int32 u) cil managed + .method public specialname rtspecialname instance void .ctor(int32 v, int32 u) cil managed { .maxstack 8 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.netcore.bsl index 95ca3211f00d..c9ea94af41cf 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.netcore.bsl @@ -128,9 +128,7 @@ IL_000c: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [runtime]System.Collections.IComparer comp) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -235,9 +233,7 @@ IL_000b: ret } - .method assembly hidebysig instance bool - Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeStruct obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig instance bool Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeStruct obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -259,9 +255,7 @@ IL_0020: ret } - .method public hidebysig virtual final - instance bool Equals(object obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -285,9 +279,7 @@ IL_0019: ret } - .method public specialname rtspecialname - instance void .ctor(int32 v, - int32 u) cil managed + .method public specialname rtspecialname instance void .ctor(int32 v, int32 u) cil managed { .maxstack 8 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.net472.bsl index ca4a16871a38..103177fa29d0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.net472.bsl @@ -67,9 +67,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly static valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion - NewSomeUnion(int32 item1, - int32 item2) cil managed + .method assembly static valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion NewSomeUnion(int32 item1, int32 item2) cil managed { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) @@ -222,9 +220,7 @@ IL_000c: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [runtime]System.Collections.IComparer comp) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -335,9 +331,7 @@ IL_000b: ret } - .method assembly hidebysig instance bool - Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig instance bool Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -361,9 +355,7 @@ IL_0022: ret } - .method public hidebysig virtual final - instance bool Equals(object obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.netcore.bsl index bf1b7955a504..9ce8662fe2d2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.netcore.bsl @@ -67,9 +67,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly static valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion - NewSomeUnion(int32 item1, - int32 item2) cil managed + .method assembly static valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion NewSomeUnion(int32 item1, int32 item2) cil managed { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) @@ -222,9 +220,7 @@ IL_000c: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [runtime]System.Collections.IComparer comp) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -335,9 +331,7 @@ IL_000b: ret } - .method assembly hidebysig instance bool - Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig instance bool Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -361,9 +355,7 @@ IL_0022: ret } - .method public hidebysig virtual final - instance bool Equals(object obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.net472.bsl index 3e88144e8331..764dc4b16ff5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.net472.bsl @@ -87,9 +87,7 @@ IL_0006: ret } - .method assembly specialname rtspecialname - instance void .ctor(int32 v, - int32 u) cil managed + .method assembly specialname rtspecialname instance void .ctor(int32 v, int32 u) cil managed { .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, class [runtime]System.Type) = ( 01 00 60 06 00 00 39 45 71 75 61 6C 73 31 38 2B @@ -191,9 +189,7 @@ IL_000c: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [runtime]System.Collections.IComparer comp) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -298,9 +294,7 @@ IL_000b: ret } - .method assembly hidebysig instance bool - Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeRecord obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig instance bool Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeRecord obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -322,9 +316,7 @@ IL_0020: ret } - .method public hidebysig virtual final - instance bool Equals(object obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -560,9 +552,7 @@ .field private class [runtime]System.Type Type@ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method public specialname rtspecialname - instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, - class [runtime]System.Type Type) cil managed + .method public specialname rtspecialname instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, class [runtime]System.Type Type) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.netcore.bsl index 344d2630e979..9685857b26fd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.netcore.bsl @@ -87,9 +87,7 @@ IL_0006: ret } - .method assembly specialname rtspecialname - instance void .ctor(int32 v, - int32 u) cil managed + .method assembly specialname rtspecialname instance void .ctor(int32 v, int32 u) cil managed { .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, class [runtime]System.Type) = ( 01 00 60 06 00 00 39 45 71 75 61 6C 73 31 38 2B @@ -191,9 +189,7 @@ IL_000c: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [runtime]System.Collections.IComparer comp) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -298,9 +294,7 @@ IL_000b: ret } - .method assembly hidebysig instance bool - Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeRecord obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig instance bool Equals(valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeRecord obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -322,9 +316,7 @@ IL_0020: ret } - .method public hidebysig virtual final - instance bool Equals(object obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) diff --git a/tests/FSharp.Test.Utilities/ILChecker.fs b/tests/FSharp.Test.Utilities/ILChecker.fs index 7b2cdc7b95e7..15579833bcd4 100644 --- a/tests/FSharp.Test.Utilities/ILChecker.fs +++ b/tests/FSharp.Test.Utilities/ILChecker.fs @@ -36,7 +36,8 @@ module ILChecker = let strings = @"""((\\[^\n]|[^""\n])*)""" let verbatimStrings = @"@(""[^""]*"")+" let methodSingleLine = "^(\s*\.method.*)(?: \s*)$[\r?\n?]^(\s*\{)" - let methodMultiLine = "^(\s*\.method.*)(?: \s*)$[\r?\n?]^(?: \s*)(.*)\s*$[\r?\n?]^(\s*\{)" + let methodDoubleLine = "^(\s*\.method.*)(?: \s*)$[\r?\n?]^(?: \s*)(.*)\s*$[\r?\n?]^(\s*\{)" + let methodTripleLine = "^(\s*\.method.*)(?: \s*)$[\r?\n?]^(?: \s*)(.*)\s*$[\r?\n?]^(?: \s*)(.*)\s*$[\r?\n?]^(\s*\{)" let normalizeNewLines (text: string) = text.Replace("\r\n", "\n").Replace("\r\n", "\r") let resourceMultiLine = @"(?\.mresource\s+.*)(?\s*\{[^}]*\})" @@ -52,8 +53,9 @@ module ILChecker = let unifyMethodLine (text:string) = let text1 = Regex.Replace(text, $"{methodSingleLine}", (fun me -> $"{me.Groups[1].Value}\n{me.Groups[2].Value}"), RegexOptions.Multiline) - let text2 = Regex.Replace(text1, $"{methodMultiLine}", (fun me -> $"{me.Groups[1].Value} {me.Groups[2].Value}\n{me.Groups[3].Value}"), RegexOptions.Multiline) - text2 + let text2 = Regex.Replace(text1, $"{methodDoubleLine}", (fun me -> $"{me.Groups[1].Value} {me.Groups[2].Value}\n{me.Groups[3].Value}"), RegexOptions.Multiline) + let text3 = Regex.Replace(text2, $"{methodTripleLine}", (fun me -> $"{me.Groups[1].Value} {me.Groups[2].Value} {me.Groups[3].Value}\n{me.Groups[4].Value}"), RegexOptions.Multiline) + text3 let replace input (pattern, replacement: string) = Regex.Replace(input, pattern, replacement, RegexOptions.Singleline)