Skip to content

Commit

Permalink
revive glam tests by deref-ing LHS if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
Tehforsch committed Jan 7, 2024
1 parent 5f93ed7 commit 76c96ef
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions crates/diman_unit_system/src/codegen/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,11 @@ impl NumericTrait {
quote! {}
}
};
let lhs = if self.lhs.reference.is_ref() && self.lhs.is_storage() {
quote! {(*#lhs)}
} else {
lhs
};
let result = quote! { #lhs.#fn_name(#deref_or_ref #rhs) };
if output_type.is_some() {
quote! { #quantity_type ( #result ) }
Expand Down Expand Up @@ -600,14 +605,14 @@ impl Defs {
// we won't either.
}
for t in [Mul, Div] {
add_trait!(traits, t, (Quantity, Concrete(ty.clone())), (Storage, Concrete(ty.clone())));
add_trait!(traits, t, (&Quantity, Concrete(ty.clone())), (Storage, Concrete(ty.clone())));
add_trait!(traits, t, (Quantity, Concrete(ty.clone())), (&Storage, Concrete(ty.clone())));
add_trait!(traits, t, (&Quantity, Concrete(ty.clone())), (&Storage, Concrete(ty.clone())));
add_trait!(traits, t, (Storage, Concrete(ty.clone())), (Quantity, Concrete(ty.clone())));
add_trait!(traits, t, (&Storage, Concrete(ty.clone())), (Quantity, Concrete(ty.clone())));
add_trait!(traits, t, (Storage, Concrete(ty.clone())), (&Quantity, Concrete(ty.clone())));
add_trait!(traits, t, (&Storage, Concrete(ty.clone())), (&Quantity, Concrete(ty.clone())));
add_trait!(traits, t, (Quantity, Generic), (Storage, Concrete(ty.clone())));
add_trait!(traits, t, (&Quantity, Generic), (Storage, Concrete(ty.clone())));
add_trait!(traits, t, (Quantity, Generic), (&Storage, Concrete(ty.clone())));
add_trait!(traits, t, (&Quantity, Generic), (&Storage, Concrete(ty.clone())));
add_trait!(traits, t, (Storage, Concrete(ty.clone())), (Quantity, Generic));
add_trait!(traits, t, (&Storage, Concrete(ty.clone())), (Quantity, Generic));
add_trait!(traits, t, (Storage, Concrete(ty.clone())), (&Quantity, Generic));
add_trait!(traits, t, (&Storage, Concrete(ty.clone())), (&Quantity, Generic));
}
for t in [MulAssign, DivAssign] {
add_trait!(traits, t, (Quantity, Concrete(ty.clone())), (Storage, Concrete(ty.clone())));
Expand Down

0 comments on commit 76c96ef

Please sign in to comment.