Skip to content

Comparison operations return incorrect array type #185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vadixidav opened this issue Jan 22, 2019 · 3 comments
Closed

Comparison operations return incorrect array type #185

vadixidav opened this issue Jan 22, 2019 · 3 comments

Comments

@vadixidav
Copy link
Contributor

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.

@9prady9
Copy link
Member

9prady9 commented Jan 22, 2019

I thought I had it covered, I will look into it. Thank you for reporting.

@vadixidav
Copy link
Contributor Author

vadixidav commented Jan 22, 2019

@9prady9 Also consider using bool now thanks to this. Sort of related and unrelated to this issue, but should probably be used here if possible.

@9prady9
Copy link
Member

9prady9 commented Jan 23, 2019

I was mistaken about my earlier comment about bool, we are using bool wherever possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants