@_infer_type.register(irast.UnaryOp)
def __infer_unaryop(ir, schema):
    result = None
    operand_type = infer_type(ir.expr, schema)
    if (ir.op == ast.ops.NOT):
        if (operand_type.name == 'std::bool'):
            result = operand_type
    else:
        if (ir.op not in {ast.ops.UPLUS, ast.ops.UMINUS}):
            raise ql_errors.EdgeQLError(f'unknown unary operator: {ir.op}', context=ir.context)
        result = s_basetypes.TypeRules.get_result(ir.op, (operand_type,), schema)
    if (result is None):
        raise ql_errors.EdgeQLError(f'unary operator `{ir.op.upper()}` is not defined for type {operand_type.name}', context=ir.context)
    return result
@_infer_type.register(irast.UnaryOp)
def __infer_unaryop(ir, schema):
    result = None
    operand_type = infer_type(ir.expr, schema)
    if (ir.op == ast.ops.NOT):
        if (operand_type.name == 'std::bool'):
            result = operand_type
    else:
        if (ir.op not in {ast.ops.UPLUS, ast.ops.UMINUS}):
            raise ql_errors.EdgeQLError(f'unknown unary operator: {ir.op}', context=ir.context)
        result = s_basetypes.TypeRules.get_result(ir.op, (operand_type,), schema)
    if (result is None):
        raise ql_errors.EdgeQLError(f'unary operator `{ir.op.upper()}` is not defined for type {operand_type.name}', context=ir.context)
    return result