Beispiel #1
0
        (ir0.AtomicTypeLiteral.for_nonlocal_template(
            'F',
            args=[],
            is_metafunction_that_may_return_error=False,
            may_be_alias=True),
         ir0.AtomicTypeLiteral.for_nonlocal_template(
             'F',
             args=[],
             is_metafunction_that_may_return_error=False,
             may_be_alias=False)),
        (ir0.ClassMemberAccess(class_type_expr=type_literal('MyClass'),
                               member_name='value_type',
                               member_type=ir0.TypeType()),
         ir0.ClassMemberAccess(class_type_expr=type_literal('MyClass'),
                               member_name='value_type',
                               member_type=ir0.Int64Type())),
    ],
    ids=[
        'AtomicTypeLiteral.for_nonlocal_type, different may_be_alias',
        'AtomicTypeLiteral.for_nonlocal_template, different arg_types',
        'AtomicTypeLiteral.for_nonlocal_template, different is_metafunction_that_may_return_error',
        'AtomicTypeLiteral.for_nonlocal_template, different may_be_alias',
        'ClassMemberAccess, different member_type',
    ])
def test_unify_ir0_term_equality_fails_different_direct_values_in_term_non_syntactically_comparable_expr_not_affecting_equality(
        expr1, expr2):
    result = _unify([expr1], [expr2],
                    expr_variables=set(),
                    pattern_variables=set())
    assert result.kind == UnificationResultKind.CERTAIN
def _variadic_int64_arg_type():
    return ir0.TemplateArgType(expr_type=ir0.Int64Type(), is_variadic=True)
def int_member_access(class_expr: ir0.Expr, member_name: str):
    return ir0.ClassMemberAccess(class_type_expr=class_expr,
                                 member_name=member_name,
                                 member_type=ir0.Int64Type())
def _variadic_int64_arg_decl(name: str):
    return ir0.TemplateArgDecl(expr_type=ir0.Int64Type(),
                               name=name,
                               is_variadic=True)
def _local_variadic_int(cpp_type: str):
    return ir0.AtomicTypeLiteral.for_local(cpp_type,
                                           ir0.Int64Type(),
                                           is_variadic=True)
def _int64_list_sum(l: ir0.Expr):
    return _metafunction_call(template_expr=GlobalLiterals.INT64_LIST_SUM,
                              args=[l],
                              instantiation_might_trigger_static_asserts=False,
                              member_name='value',
                              member_type=ir0.Int64Type())
Beispiel #7
0
        (ir0.AtomicTypeLiteral.for_nonlocal_template(
            'F',
            args=(),
            is_metafunction_that_may_return_error=False,
            may_be_alias=True),
         ir0.AtomicTypeLiteral.for_nonlocal_template(
             'F',
             args=(),
             is_metafunction_that_may_return_error=False,
             may_be_alias=False)),
        (ir0.ClassMemberAccess(inner_expr=type_literal('MyClass'),
                               member_name='value_type',
                               expr_type=ir0.TypeType()),
         ir0.ClassMemberAccess(inner_expr=type_literal('MyClass'),
                               member_name='value_type',
                               expr_type=ir0.Int64Type())),
    ],
    ids=[
        'AtomicTypeLiteral.for_nonlocal_type, different may_be_alias',
        'AtomicTypeLiteral.for_nonlocal_template, different arg_types',
        'AtomicTypeLiteral.for_nonlocal_template, different is_metafunction_that_may_return_error',
        'AtomicTypeLiteral.for_nonlocal_template, different may_be_alias',
        'ClassMemberAccess, different expr_type',
    ])
def test_unify_ir0_term_equality_fails_different_direct_values_in_term_non_syntactically_comparable_expr_not_affecting_equality(
        expr1: ir0.Expr, expr2: ir0.Expr):
    result = _unify((expr1, ), (expr2, ),
                    expr_variables=set(),
                    pattern_variables=set())
    assert result.kind == UnificationResultKind.CERTAIN
Beispiel #8
0
def _int64_arg_type() -> ir0.TemplateArgType:
    return ir0.TemplateArgType(expr_type=ir0.Int64Type(), is_variadic=False)