This commit is contained in:
Michael Zhang 2023-11-30 00:17:28 -06:00
parent f479cf0420
commit 6012067fa5

View file

@ -226,7 +226,7 @@ impl Monotype {
} }
} }
#[derive(Debug, Clone)] #[derive(Clone)]
pub enum ContextEntry { pub enum ContextEntry {
TypeVar, TypeVar,
TermAnnot(Type), TermAnnot(Type),
@ -235,6 +235,20 @@ pub enum ContextEntry {
Marker, Marker,
} }
impl fmt::Debug for ContextEntry {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::TypeVar => write!(f, "Ty"),
Self::TermAnnot(arg0) => f.debug_tuple("Annot").field(arg0).finish(),
Self::ExistentialVar => write!(f, "ExVar"),
Self::ExistentialSolved(arg0) => {
f.debug_tuple("ExSolv").field(arg0).finish()
}
Self::Marker => write!(f, ""),
}
}
}
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum CompleteContextEntry { pub enum CompleteContextEntry {
TypeVar(String), TypeVar(String),
@ -243,12 +257,18 @@ pub enum CompleteContextEntry {
Marker(String), Marker(String),
} }
#[derive(Debug, Clone)] #[derive(Clone)]
pub struct Context { pub struct Context {
// TODO: Make this not pub(crate) // TODO: Make this not pub(crate)
pub(crate) vector: Vector<ContextEntry>, pub(crate) vector: Vector<ContextEntry>,
} }
impl fmt::Debug for Context {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self.vector)
}
}
// impl fmt::Debug for Context { // impl fmt::Debug for Context {
// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { // fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// f.write_str("Γ")?; // f.write_str("Γ")?;