formality_core/variable/
debug_impls.rs

1use super::*;
2
3impl<L: Language> std::fmt::Debug for CoreVariable<L> {
4    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5        match self {
6            Self::UniversalVar(arg0) => write!(f, "{:?}", arg0),
7            Self::ExistentialVar(arg0) => write!(f, "{:?}", arg0),
8            Self::BoundVar(arg0) => write!(f, "{:?}", arg0),
9        }
10    }
11}
12
13impl<L: Language> std::fmt::Debug for CoreUniversalVar<L> {
14    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15        let CoreUniversalVar { var_index, kind } = self;
16        write!(f, "!{:?}_{:?}", kind, var_index)
17    }
18}
19
20impl<L: Language> std::fmt::Debug for CoreExistentialVar<L> {
21    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22        let CoreExistentialVar { var_index, kind } = self;
23        write!(f, "?{:?}_{:?}", kind, var_index)
24    }
25}
26
27impl std::fmt::Debug for VarIndex {
28    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29        write!(f, "{}", self.index)
30    }
31}
32
33impl<L: Language> std::fmt::Debug for CoreBoundVar<L> {
34    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
35        match self {
36            CoreBoundVar {
37                debruijn: None,
38                var_index,
39                kind,
40            } => write!(f, "^{:?}_{:?}", kind, var_index),
41            CoreBoundVar {
42                debruijn: Some(db),
43                var_index,
44                kind,
45            } => write!(f, "^{:?}{:?}_{:?}", kind, db.index, var_index),
46        }
47    }
48}
49
50impl std::fmt::Debug for DebruijnIndex {
51    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
52        write!(f, "^{}", self.index)
53    }
54}