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: 
  /// Indicates if an F# type is the type associated with an F# exception declaration
  let isExnDeclTy g ty =
      isAppTy g ty && (tcrefOfAppTy g ty).IsExceptionDecl
  
  /// Get the base type of a type, taking into account type instantiations. Return None if the
  /// type has no base type.
  let GetSuperTypeOfType g amap m ty =
  #if !NO_EXTENSIONTYPING
      let ty = (if isAppTy g ty && (tcrefOfAppTy g ty).IsProvided then stripTyEqns g ty else stripTyEqnsAndMeasureEqns g ty)
  #else
      let ty = stripTyEqnsAndMeasureEqns g ty
  #endif
  
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 =
  