11from itertools import chain
2- from typing import Collection , Dict , List , Optional , Set , Tuple , Union , cast
2+ from typing import Collection , Dict , List , Optional , Tuple , Union , cast
33
44from ...error import GraphQLError
55from ...language import (
@@ -181,15 +181,13 @@ def find_conflicts_within_selection_set(
181181 )
182182
183183 if fragment_names :
184- compared_fragments : Set [str ] = set ()
185184 # (B) Then collect conflicts between these fields and those represented by each
186185 # spread fragment name found.
187186 for i , fragment_name in enumerate (fragment_names ):
188187 collect_conflicts_between_fields_and_fragment (
189188 context ,
190189 conflicts ,
191190 cached_fields_and_fragment_names ,
192- compared_fragments ,
193191 compared_fragment_pairs ,
194192 False ,
195193 field_map ,
@@ -217,7 +215,6 @@ def collect_conflicts_between_fields_and_fragment(
217215 context : ValidationContext ,
218216 conflicts : List [Conflict ],
219217 cached_fields_and_fragment_names : Dict ,
220- compared_fragments : Set [str ],
221218 compared_fragment_pairs : "PairSet" ,
222219 are_mutually_exclusive : bool ,
223220 field_map : NodeAndDefCollection ,
@@ -228,11 +225,6 @@ def collect_conflicts_between_fields_and_fragment(
228225 Collect all conflicts found between a set of fields and a fragment reference
229226 including via spreading in any nested fragments.
230227 """
231- # Memoize so a fragment is not compared for conflicts more than once.
232- if fragment_name in compared_fragments :
233- return
234- compared_fragments .add (fragment_name )
235-
236228 fragment = context .get_fragment (fragment_name )
237229 if not fragment :
238230 return None
@@ -264,7 +256,6 @@ def collect_conflicts_between_fields_and_fragment(
264256 context ,
265257 conflicts ,
266258 cached_fields_and_fragment_names ,
267- compared_fragments ,
268259 compared_fragment_pairs ,
269260 are_mutually_exclusive ,
270261 field_map ,
@@ -388,13 +379,11 @@ def find_conflicts_between_sub_selection_sets(
388379 # (I) Then collect conflicts between the first collection of fields and those
389380 # referenced by each fragment name associated with the second.
390381 if fragment_names2 :
391- compared_fragments : Set [str ] = set ()
392382 for fragment_name2 in fragment_names2 :
393383 collect_conflicts_between_fields_and_fragment (
394384 context ,
395385 conflicts ,
396386 cached_fields_and_fragment_names ,
397- compared_fragments ,
398387 compared_fragment_pairs ,
399388 are_mutually_exclusive ,
400389 field_map1 ,
@@ -404,13 +393,11 @@ def find_conflicts_between_sub_selection_sets(
404393 # (I) Then collect conflicts between the second collection of fields and those
405394 # referenced by each fragment name associated with the first.
406395 if fragment_names1 :
407- compared_fragments = set ()
408396 for fragment_name1 in fragment_names1 :
409397 collect_conflicts_between_fields_and_fragment (
410398 context ,
411399 conflicts ,
412400 cached_fields_and_fragment_names ,
413- compared_fragments ,
414401 compared_fragment_pairs ,
415402 are_mutually_exclusive ,
416403 field_map2 ,
0 commit comments