@@ -2723,23 +2723,7 @@ module internal LoopAndConstantOptimization =
27232723 | _ -> ValueNone
27242724
27252725[<AutoOpen>]
2726- module internal AttribChecking =
2727-
2728- /// An immutable mapping from witnesses to some data.
2729- ///
2730- /// Note: this uses an immutable HashMap/Dictionary with an IEqualityComparer that captures TcGlobals, see EmptyTraitWitnessInfoHashMap
2731- type TraitWitnessInfoHashMap < 'T > = ImmutableDictionary< TraitWitnessInfo, 'T>
2732-
2733- /// Create an empty immutable mapping from witnesses to some data
2734- let EmptyTraitWitnessInfoHashMap g : TraitWitnessInfoHashMap < 'T > =
2735- ImmutableDictionary.Create(
2736- { new IEqualityComparer<_> with
2737- member _. Equals( a, b) =
2738- nullSafeEquality a b ( fun a b -> traitKeysAEquiv g TypeEquivEnv.EmptyIgnoreNulls a b)
2739-
2740- member _. GetHashCode( a) = hash a.MemberName
2741- }
2742- )
2726+ module internal ResumableCodePatterns =
27432727
27442728 [<return : Struct>]
27452729 let (| MatchTwoCasesExpr | _ |) expr =
@@ -2900,39 +2884,8 @@ module internal AttribChecking =
29002884 ValueSome( iref, f, args, m, ( fun ( f2 , args2 ) -> Expr.App(( iref, a, b, ( f2 :: args2), m))))
29012885 | _ -> ValueNone
29022886
2903- let ComputeUseMethodImpl g ( v : Val ) =
2904- v.ImplementedSlotSigs
2905- |> List.exists ( fun slotsig ->
2906- let oty = slotsig.DeclaringType
2907- let otcref = tcrefOfAppTy g oty
2908- let tcref = v.MemberApparentEntity
2909-
2910- // REVIEW: it would be good to get rid of this special casing of Compare and GetHashCode
2911- isInterfaceTy g oty
2912- &&
2913-
2914- ( let isCompare =
2915- tcref.GeneratedCompareToValues.IsSome
2916- && ( typeEquiv g oty g.mk_ IComparable_ ty
2917- || tyconRefEq g g.system_ GenericIComparable_ tcref otcref)
2918-
2919- not isCompare)
2920- &&
2921-
2922- ( let isGenericEquals =
2923- tcref.GeneratedHashAndEqualsWithComparerValues.IsSome
2924- && tyconRefEq g g.system_ GenericIEquatable_ tcref otcref
2925-
2926- not isGenericEquals)
2927- &&
2928-
2929- ( let isStructural =
2930- ( tcref.GeneratedCompareToWithComparerValues.IsSome
2931- && typeEquiv g oty g.mk_ IStructuralComparable_ ty)
2932- || ( tcref.GeneratedHashAndEqualsWithComparerValues.IsSome
2933- && typeEquiv g oty g.mk_ IStructuralEquatable_ ty)
2934-
2935- not isStructural))
2887+ [<AutoOpen>]
2888+ module internal SeqExprPatterns =
29362889
29372890 [<return : Struct>]
29382891 let (| Seq | _ |) g expr =
@@ -3054,6 +3007,58 @@ module internal AttribChecking =
30543007 | ValApp g g.seq_ empty_ vref (_, [], m) -> ValueSome m
30553008 | _ -> ValueNone
30563009
3010+ [<AutoOpen>]
3011+ module internal ExtensionAndMiscHelpers =
3012+
3013+ /// An immutable mapping from witnesses to some data.
3014+ ///
3015+ /// Note: this uses an immutable HashMap/Dictionary with an IEqualityComparer that captures TcGlobals, see EmptyTraitWitnessInfoHashMap
3016+ type TraitWitnessInfoHashMap < 'T > = ImmutableDictionary< TraitWitnessInfo, 'T>
3017+
3018+ /// Create an empty immutable mapping from witnesses to some data
3019+ let EmptyTraitWitnessInfoHashMap g : TraitWitnessInfoHashMap < 'T > =
3020+ ImmutableDictionary.Create(
3021+ { new IEqualityComparer<_> with
3022+ member _. Equals( a, b) =
3023+ nullSafeEquality a b ( fun a b -> traitKeysAEquiv g TypeEquivEnv.EmptyIgnoreNulls a b)
3024+
3025+ member _. GetHashCode( a) = hash a.MemberName
3026+ }
3027+ )
3028+
3029+ let ComputeUseMethodImpl g ( v : Val ) =
3030+ v.ImplementedSlotSigs
3031+ |> List.exists ( fun slotsig ->
3032+ let oty = slotsig.DeclaringType
3033+ let otcref = tcrefOfAppTy g oty
3034+ let tcref = v.MemberApparentEntity
3035+
3036+ // REVIEW: it would be good to get rid of this special casing of Compare and GetHashCode
3037+ isInterfaceTy g oty
3038+ &&
3039+
3040+ ( let isCompare =
3041+ tcref.GeneratedCompareToValues.IsSome
3042+ && ( typeEquiv g oty g.mk_ IComparable_ ty
3043+ || tyconRefEq g g.system_ GenericIComparable_ tcref otcref)
3044+
3045+ not isCompare)
3046+ &&
3047+
3048+ ( let isGenericEquals =
3049+ tcref.GeneratedHashAndEqualsWithComparerValues.IsSome
3050+ && tyconRefEq g g.system_ GenericIEquatable_ tcref otcref
3051+
3052+ not isGenericEquals)
3053+ &&
3054+
3055+ ( let isStructural =
3056+ ( tcref.GeneratedCompareToWithComparerValues.IsSome
3057+ && typeEquiv g oty g.mk_ IStructuralComparable_ ty)
3058+ || ( tcref.GeneratedHashAndEqualsWithComparerValues.IsSome
3059+ && typeEquiv g oty g.mk_ IStructuralEquatable_ ty)
3060+
3061+ not isStructural))
30573062
30583063 [<return : Struct>]
30593064 let (| EmptyModuleOrNamespaces | _ |) ( moduleOrNamespaceContents : ModuleOrNamespaceContents ) =
0 commit comments