@_infer_type.register(irast.IndexIndirection)
def __infer_index(ir, schema):
    node_type = infer_type(ir.expr, schema)
    index_type = infer_type(ir.index, schema)
    str_t = schema.get('std::str')
    int_t = schema.get('std::int64')
    result = None
    if node_type.issubclass(str_t):
        if (not index_type.issubclass(int_t)):
            raise ql_errors.EdgeQLError(f'cannot index string by {index_type.name}, {int_t.name} was expected', context=ir.index.context)
        result = str_t
    elif isinstance(node_type, s_types.Array):
        if (not index_type.issubclass(int_t)):
            raise ql_errors.EdgeQLError(f'cannot index array by {index_type.name}, {int_t.name} was expected', context=ir.index.context)
        result = node_type.element_type
    return result
@_infer_type.register(irast.IndexIndirection)
def __infer_index(ir, schema):
    node_type = infer_type(ir.expr, schema)
    index_type = infer_type(ir.index, schema)
    str_t = schema.get('std::str')
    int_t = schema.get('std::int64')
    result = None
    if node_type.issubclass(str_t):
        if (not index_type.issubclass(int_t)):
            raise ql_errors.EdgeQLError(f'cannot index string by {index_type.name}, {int_t.name} was expected', context=ir.index.context)
        result = str_t
    elif isinstance(node_type, s_types.Array):
        if (not index_type.issubclass(int_t)):
            raise ql_errors.EdgeQLError(f'cannot index array by {index_type.name}, {int_t.name} was expected', context=ir.index.context)
        result = node_type.element_type
    return result