making never type cause less errors

This commit is contained in:
Jakub Doka 2024-10-25 15:14:32 +02:00
parent c88daa4800
commit 2bab16d3ce
No known key found for this signature in database
GPG key ID: C6E9A89936B8C143

View file

@ -398,15 +398,19 @@ mod ty {
pub const DEFAULT_INT: Self = Self::UINT; pub const DEFAULT_INT: Self = Self::UINT;
pub fn is_signed(self) -> bool { pub fn is_signed(self) -> bool {
(I8..=INT).contains(&self.repr()) (I8..=INT).contains(&self.repr()) || self.is_never()
} }
pub fn is_unsigned(self) -> bool { pub fn is_unsigned(self) -> bool {
(U8..=UINT).contains(&self.repr()) (U8..=UINT).contains(&self.repr()) || self.is_never()
} }
pub fn is_integer(self) -> bool { pub fn is_integer(self) -> bool {
(U8..=INT).contains(&self.repr()) (U8..=INT).contains(&self.repr()) || self.is_never()
}
pub fn is_never(self) -> bool {
self == Self::NEVER
} }
pub fn strip_pointer(self) -> Self { pub fn strip_pointer(self) -> Self {
@ -417,7 +421,7 @@ mod ty {
} }
pub fn is_pointer(self) -> bool { pub fn is_pointer(self) -> bool {
matches!(self.expand(), Kind::Ptr(_)) matches!(self.expand(), Kind::Ptr(_)) || self.is_never()
} }
pub fn try_upcast(self, ob: Self, kind: TyCheck) -> Option<Self> { pub fn try_upcast(self, ob: Self, kind: TyCheck) -> Option<Self> {
@ -443,11 +447,6 @@ mod ty {
self.0.get() self.0.get()
} }
#[allow(unused)]
pub fn is_struct(&self) -> bool {
matches!(self.expand(), Kind::Struct(_))
}
pub(crate) fn simple_size(&self) -> Option<Size> { pub(crate) fn simple_size(&self) -> Option<Size> {
Some(match self.expand() { Some(match self.expand() {
Kind::Ptr(_) => 8, Kind::Ptr(_) => 8,