Conversation
| matches!(*self, Self::Enum { .. }) | ||
| } | ||
|
|
||
| pub fn is_enum_or_integral_type(&self) -> bool { |
There was a problem hiding this comment.
Do we not want true here for bool? Does it regress anything?
There was a problem hiding this comment.
This function is only called in CastKind::from_types, where Bool is also handled separately. Possibly the IntegralToPointer case is not, so I've added handling for bool explicitly there now.
There was a problem hiding this comment.
You might be introducing some regressions in from_types, can you test bool-to-unsigned casts and maybe bool-to-float? (I'm not sure how much we care about the latter, but it might still be worth to see what happens)
There was a problem hiding this comment.
I'm trying to think of a situation where from_types is actually called and hitting these cases. It's not called for regular casts in the AST, which are passed on from C.
734cb83 to
c7bae39
Compare
c7bae39 to
283df6d
Compare
CTypeKind::is_unsigned_integral_typereturnstrueforBool, which is a bit of a footgun and probably not what most code (or coders) expect. So this removes it. I made sure to check that no code elsewhere relies on this includingBooland adjusted it where necessary. Most of the time, it was being used for wrapping arithmetic, which isn't possible on booleans anyway.