protected function getReferencedFieldsAndFragmentNames(FragmentDefinitionNode $fragment): ComparisonContext
    {
        if ($this->cachedFieldsAndFragmentNames->offsetExists($fragment)) {
            return $this->cachedFieldsAndFragmentNames->offsetGet($fragment);
        }

        /** @var NamedTypeInterface $fragmentType */
        $fragmentType = TypeASTConverter::convert($this->getContext()->getSchema(), $fragment->getTypeCondition());

        return $this->getFieldsAndFragmentNames($fragment->getSelectionSet(), $fragmentType);
    }