def test_compares_deep_types_including_list():
    expect_fails_rule_with_schema(schema, OverlappingFieldsCanBeMerged, '''
    {
        connection {
            ...edgeID
            edges {
                node {
                    id: name
                }
            }
        }
    }

    fragment edgeID on Connection {
        edges {
            node {
                id
            }
        }
    }
    ''', [
        fields_conflict(
            'edges', [['node', [['id', 'id and name are different fields']]]],
            L(14, 9), L(5, 13),
            L(15, 13), L(6, 17),
            L(16, 17), L(7, 21),
        )
    ], sort_list=False)
def test_conflicting_scalar_return_types():
    expect_fails_rule_with_schema(schema, OverlappingFieldsCanBeMerged, '''
    {
        boxUnion {
            ...on IntBox {
                scalar
            }
            ...on StringBox {
                scalar
            }
        }
    }

    ''', [
        fields_conflict('scalar', 'they return differing types Int and String', L(5, 17), L(8, 17))
    ], sort_list=False)
def test_conflicting_scalar_return_types():
    expect_fails_rule_with_schema(
        schema,
        OverlappingFieldsCanBeMerged,
        '''
    {
        boxUnion {
            ...on IntBox {
                scalar
            }
            ...on StringBox {
                scalar
            }
        }
    }

    ''', [
            fields_conflict(
                'scalar', 'they return differing types Int and String', L(
                    5, 17), L(8, 17))
        ],
        sort_list=False)
def test_conflicting_return_types_which_potentially_overlap():
    expect_fails_rule_with_schema(
        schema,
        OverlappingFieldsCanBeMerged,
        '''
    {
        someBox {
            ...on IntBox {
                scalar
            }
            ...on NonNullStringBox1 {
                scalar
            }
        }
    }

    ''', [
            fields_conflict('scalar',
                            'they return differing types Int and String!',
                            L(5, 17), L(8, 17))
        ],
        sort_list=False)
def test_compares_deep_types_including_list():
    expect_fails_rule_with_schema(
        schema,
        OverlappingFieldsCanBeMerged,
        '''
    {
        connection {
            ...edgeID
            edges {
                node {
                    id: name
                }
            }
        }
    }

    fragment edgeID on Connection {
        edges {
            node {
                id
            }
        }
    }
    ''', [
            fields_conflict(
                'edges',
                [['node', [['id', 'id and name are different fields']]]],
                L(14, 9),
                L(5, 13),
                L(15, 13),
                L(6, 17),
                L(16, 17),
                L(7, 21),
            )
        ],
        sort_list=False)