Skip to content

Comparison operations return incorrect array type #185

Closed
@vadixidav

Description

@vadixidav

In the code for macro overloaded_binary_func here the trait bound is present:

where A: HasAfEnum + ImplicitPromote<B>,
        B: HasAfEnum + ImplicitPromote<A>,
        <A as ImplicitPromote<B>>::Output: HasAfEnum

The macro then is used for comparison operators:

overloaded_binary_func!("Perform `less than` comparison operation", lt, lt_helper, af_lt);
overloaded_binary_func!("Perform `greater than` comparison operation", gt, gt_helper, af_gt);
overloaded_binary_func!("Perform `less than equals` comparison operation", le, le_helper, af_le);
overloaded_binary_func!("Perform `greater than equals` comparison operation", ge, ge_helper, af_ge);
overloaded_binary_func!("Perform `equals` comparison operation", eq, eq_helper, af_eq);

This results in the output array erroneously no longer being Array<u8> or Array<bool> (in Rust versions where bool is guaranteed to be 8 bits), and instead being the same an the input types in most scenarios. Another macro needs to be made here that specifically does comparison operations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions