anchor.diff:  let private FoldHierarchyOfTypeAux followInterfaces allowMultiIntfInst skipUnref visitor g amap m ty acc =
       let rec loop ndeep ty ((visitedTycon, visited: TyconRefMultiMap<_>, acc) as state) =
   
  -        let seenThisTycon = isAppTy g ty && Set.contains (tcrefOfAppTy g ty).Stamp visitedTycon
  +        let seenThisTycon = 
  +            match tryTcrefOfAppTy g ty with
  +            | ValueSome tcref -> Set.contains tcref.Stamp visitedTycon
  +            | _ -> false
   
           // Do not visit the same type twice. Could only be doing this if we've seen this tycon
           if seenThisTycon && List.exists (typeEquiv g ty) (visited.Find (tcrefOfAppTy g ty)) then state else
  
positive.code:                 [ match tcref.TypeReprInfo with
                    | TMeasureableRepr reprTy ->
                         for ity in GetImmediateInterfacesOfType skipUnref g amap m reprTy do
                            if isAppTy g ity then
                                let itcref = tcrefOfAppTy g ity
                                if not (tyconRefEq g itcref g.system_GenericIComparable_tcref) &&
                                   not (tyconRefEq g itcref g.system_GenericIEquatable_tcref)  then
                                     yield ity
                    | _ -> ()
                    yield mkAppTy g.system_GenericIComparable_tcref [ty]
  
negative.code: 
  /// Check if two types have the same nominal head type
  let HaveSameHeadType g ty1 ty2 =
      match tryTcrefOfAppTy g ty1 with
      | ValueSome tcref1 ->
          match tryTcrefOfAppTy g ty2 with
          | ValueSome tcref2 -> tyconRefEq g tcref1 tcref2
          | _ -> false
      | _ -> false
  
  /// Check if a type has a particular head type
  let HasHeadType g tcref ty2 =
      match tryTcrefOfAppTy g ty2 with
      | ValueSome tcref2 -> tyconRefEq g tcref tcref2
      | ValueNone -> false
  
  /// Check if a type exists somewhere in the hierarchy which has the same head type as the given type (note, the given type need not have a head type at all)
  let ExistsSameHeadTypeInHierarchy g amap m typeToSearchFrom typeToLookFor =
  