Improve error messages for typerefs a bit
This commit is contained in:
parent
c0e375d84c
commit
62d73b19a2
@ -311,3 +311,13 @@ fn write_access(f: &mut std::fmt::Formatter<'_>, name: &String) -> std::fmt::Res
|
|||||||
f.write_char('.')?;
|
f.write_char('.')?;
|
||||||
Display::fmt(name, f)
|
Display::fmt(name, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl std::fmt::Display for VagueType {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match self {
|
||||||
|
VagueType::Unknown => write!(f, "Unknown"),
|
||||||
|
VagueType::Number => write!(f, "Number"),
|
||||||
|
VagueType::TypeRef(_) => write!(f, "{{unknown}}"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -113,17 +113,14 @@ pub enum TypeKind {
|
|||||||
Borrow(Box<TypeKind>),
|
Borrow(Box<TypeKind>),
|
||||||
#[error("Ptr({0})")]
|
#[error("Ptr({0})")]
|
||||||
Ptr(Box<TypeKind>),
|
Ptr(Box<TypeKind>),
|
||||||
#[error(transparent)]
|
#[error("{0}")]
|
||||||
Vague(#[from] VagueType),
|
Vague(VagueType),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub enum VagueType {
|
pub enum VagueType {
|
||||||
#[error("Unknown")]
|
|
||||||
Unknown,
|
Unknown,
|
||||||
#[error("Number")]
|
|
||||||
Number,
|
Number,
|
||||||
#[error("TypeRef({0})")]
|
|
||||||
TypeRef(usize),
|
TypeRef(usize),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user