anchor.diff:                  type StructEquals<'a when 'a : struct and 'a : equality>() =
                       member __.Equals (_:IEqualityComparer, x:'a, y:'a) = x.Equals y
   
  +                type RefTypeStructualEquality<'a when 'a : not struct and 'a : null and 'a :> IStructuralEquatable>() =
  +                    member __.Equals (ec:IEqualityComparer, x:'a, y:'a) =
  +                        match x, y with
  +                        | null, null -> true
  +                        | null, _
  +                        | _, null -> false
  +                        | _ -> callStructualEqualityEquals ec x y
  +
  +                type RefTypeEquatable<'a when 'a : not struct and 'a : null and 'a :> IEquatable<'a>>() =
  +                    member __.Equals (_:IEqualityComparer, x:'a, y:'a) =
  +                        match x, y with
  +                        | null, null -> true
  +                        | null, _
  +                        | _, null -> false
  +                        | _ -> callEquatableEquals x y
  +
  +                type RefTypeEquals<'a when 'a : not struct and 'a : null and 'a : equality>() =
  +                    member __.Equals (_:IEqualityComparer, x:'a, y:'a) =
  +                        match x, y with
  +                        | null, null -> true
  +                        | null, _
  +                        | _, null -> false
  +                        | _ ->  x.Equals y
  +
                   [<Struct; NoComparison; CustomEquality>]
  -                type DummyWithInterfaces =
  +                type DummyStructInterfaces =
                       interface IStructuralEquatable with
                           member __.Equals (_,_) = raise (Exception "invalid logic")
                           member __.GetHashCode _ = raise (Exception "invalid logic")
   
  -                    interface IEquatable<DummyWithInterfaces> with
  +                    interface IEquatable<DummyStructInterfaces> with
  +                        member __.Equals _ = raise (Exception "invalid logic")
  +
  +                //[<NoComparison; CustomEquality; AllowNullLiteral>]
  +                [<AllowNullLiteral>]
  +                type DummyRefTypeInterfaces() =
  +                    interface IStructuralEquatable with
  +                        member __.Equals (_,_) = raise (Exception "invalid logic")
  +                        member __.GetHashCode _ = raise (Exception "invalid logic")
  +
  +                    interface IEquatable<DummyRefTypeInterfaces> with
                           member __.Equals _ = raise (Exception "invalid logic")
   #endif
                   let equalityInterfaces (ty:Type) : obj =
  -                    let make = makeEquatableDelegate ty
  -
  +#if FX_ATLEAST_40
  +                    let make = makeEquatableDelegate ty ty
  +#endif
                       match ty with
                       | t when t.IsArray || typeof<System.Array>.IsAssignableFrom t ->
                           // I could do something here, but I doubt it would have any real performance impact
                           null
   
   #if FX_ATLEAST_40
  -                    | t when t.IsValueType && typeof<IStructuralEquatable>.IsAssignableFrom t -> make typedefof<StructStructualEquality<DummyWithInterfaces>>
  -                    | t when t.IsValueType && (makeEquatableType ty).IsAssignableFrom t       -> make typedefof<StructEquatable<DummyWithInterfaces>>
  -                    | t when t.IsValueType                                                    -> make typedefof<StructEquals<DummyWithInterfaces>>
  -
  -                    | t when typeof<IStructuralEquatable>.IsAssignableFrom t ->
  -                        box GenericSpecializeEqualsOther.ReferenceTypeStructuralEquality
  +                    | t when t.IsGenericType && ((t.GetGenericTypeDefinition ()).Equals typedefof<System.Nullable<_>>) ->
  +                        let nt = get (t.GetGenericArguments()) 0
  +                        let make = makeEquatableDelegate ty nt 
  +                        match nt with
  +                        | nt when typeof<IStructuralEquatable>.IsAssignableFrom nt            -> make typedefof<NullableStructualEquality<DummyStructInterfaces>>
  +                        | nt when (makeEquatableType nt).IsAssignableFrom nt                  -> make typedefof<NullableEquatable<DummyStructInterfaces>>
  +                        | _                                                                   -> make typedefof<NullableEquals<DummyStructInterfaces>>
  +
  +                    | t when t.IsValueType && typeof<IStructuralEquatable>.IsAssignableFrom t -> make typedefof<StructStructualEquality<DummyStructInterfaces>>
  +                    | t when t.IsValueType && (makeEquatableType t).IsAssignableFrom t        -> make typedefof<StructEquatable<DummyStructInterfaces>>
  +                    | t when t.IsValueType                                                    -> make typedefof<StructEquals<DummyStructInterfaces>>
  +
  +                    | t when typeof<IStructuralEquatable>.IsAssignableFrom t                  -> make typedefof<RefTypeStructualEquality<DummyRefTypeInterfaces>>
  +
  +                     // only sealed as a derived class might inherit from IStructuralEquatable
  +                    | t when t.IsSealed && (makeEquatableType ty).IsAssignableFrom t          -> make typedefof<RefTypeEquatable<DummyRefTypeInterfaces>>
  +                    | t when t.IsSealed                                                       -> make typedefof<RefTypeEquals<DummyRefTypeInterfaces>>
   #else
                       | t when t.IsValueType && typeof<IStructuralEquatable>.IsAssignableFrom t ->
                           let equals = typeof<IStructuralEquatable>.GetMethod ("Equals", [|typeof<obj>; typeof<IEqualityComparer>|])
  
positive.code:             type private PartialEquivalenceRelation = class end
  
              type GenericSpecializeEqualsOther =
              | ReferenceTypeStructuralEquality   = 0
              | ReferenceTypeSealed               = 1
              | GenericEqualityObj_ER             = 2 
              | GenericEqualityObj_PER            = 3
  
  
negative.code:                         | null -> raise (Exception "invalid logic")
                          | :? GenericSpecializeEqualsOther as t ->
                              match t with
  #if FX_ATLEAST_40
  #else
                              | GenericSpecializeEqualsOther.ReferenceTypeStructuralEquality ->
                                  upcast Func<IEqualityComparer,'a,'a,bool>(fun ec a b ->
                                      match box a, box b with
  