code: def collect_conflicts_between_fields_and_fragment(
      context: ValidationContext,
      conflicts: List[Conflict],
      cached_fields_and_fragment_names: Dict,
      compared_fragments: Set[str],
      compared_fragment_pairs: "PairSet",
      are_mutually_exclusive: bool,
      field_map: NodeAndDefCollection,
      fragment_name: str,
  ) -> None:
      
      # Memoize so a fragment is not compared for conflicts more than once.
      if fragment_name in compared_fragments:
          return
      compared_fragments.add(fragment_name)
  
      fragment = context.get_fragment(fragment_name)
      if not fragment:
          return None
  
      field_map2, fragment_names2 = get_referenced_fields_and_fragment_names(
          context, cached_fields_and_fragment_names, fragment
      )
  
      # Do not compare a fragment's fieldMap to itself.
      if field_map is field_map2:
          return
  
      # (D) First collect any conflicts between the provided collection of fields and the
      # collection of fields represented by the given fragment.
      collect_conflicts_between(
          context,
          conflicts,
          cached_fields_and_fragment_names,
          compared_fragment_pairs,
          are_mutually_exclusive,
          field_map,
          field_map2,
      )
  
      # (E) Then collect any conflicts between the provided collection of fields and any
      # fragment names found in the given fragment.
      for fragment_name2 in fragment_names2:
          collect_conflicts_between_fields_and_fragment(
              context,
              conflicts,
              cached_fields_and_fragment_names,
              compared_fragments,
              compared_fragment_pairs,
              are_mutually_exclusive,
              field_map,
              fragment_name2,
          )
docs: Collect conflicts between fields and fragment.
  
      Collect all conflicts found between a set of fields and a fragment reference
      including via spreading in any nested fragments.