1
1
from 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
3
3
4
4
from ...error import GraphQLError
5
5
from ...language import (
@@ -181,15 +181,13 @@ def find_conflicts_within_selection_set(
181
181
)
182
182
183
183
if fragment_names :
184
- compared_fragments : Set [str ] = set ()
185
184
# (B) Then collect conflicts between these fields and those represented by each
186
185
# spread fragment name found.
187
186
for i , fragment_name in enumerate (fragment_names ):
188
187
collect_conflicts_between_fields_and_fragment (
189
188
context ,
190
189
conflicts ,
191
190
cached_fields_and_fragment_names ,
192
- compared_fragments ,
193
191
compared_fragment_pairs ,
194
192
False ,
195
193
field_map ,
@@ -217,7 +215,6 @@ def collect_conflicts_between_fields_and_fragment(
217
215
context : ValidationContext ,
218
216
conflicts : List [Conflict ],
219
217
cached_fields_and_fragment_names : Dict ,
220
- compared_fragments : Set [str ],
221
218
compared_fragment_pairs : "PairSet" ,
222
219
are_mutually_exclusive : bool ,
223
220
field_map : NodeAndDefCollection ,
@@ -228,11 +225,6 @@ def collect_conflicts_between_fields_and_fragment(
228
225
Collect all conflicts found between a set of fields and a fragment reference
229
226
including via spreading in any nested fragments.
230
227
"""
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
-
236
228
fragment = context .get_fragment (fragment_name )
237
229
if not fragment :
238
230
return None
@@ -264,7 +256,6 @@ def collect_conflicts_between_fields_and_fragment(
264
256
context ,
265
257
conflicts ,
266
258
cached_fields_and_fragment_names ,
267
- compared_fragments ,
268
259
compared_fragment_pairs ,
269
260
are_mutually_exclusive ,
270
261
field_map ,
@@ -388,13 +379,11 @@ def find_conflicts_between_sub_selection_sets(
388
379
# (I) Then collect conflicts between the first collection of fields and those
389
380
# referenced by each fragment name associated with the second.
390
381
if fragment_names2 :
391
- compared_fragments : Set [str ] = set ()
392
382
for fragment_name2 in fragment_names2 :
393
383
collect_conflicts_between_fields_and_fragment (
394
384
context ,
395
385
conflicts ,
396
386
cached_fields_and_fragment_names ,
397
- compared_fragments ,
398
387
compared_fragment_pairs ,
399
388
are_mutually_exclusive ,
400
389
field_map1 ,
@@ -404,13 +393,11 @@ def find_conflicts_between_sub_selection_sets(
404
393
# (I) Then collect conflicts between the second collection of fields and those
405
394
# referenced by each fragment name associated with the first.
406
395
if fragment_names1 :
407
- compared_fragments = set ()
408
396
for fragment_name1 in fragment_names1 :
409
397
collect_conflicts_between_fields_and_fragment (
410
398
context ,
411
399
conflicts ,
412
400
cached_fields_and_fragment_names ,
413
- compared_fragments ,
414
401
compared_fragment_pairs ,
415
402
are_mutually_exclusive ,
416
403
field_map2 ,
0 commit comments