Skip to content

Commit

Permalink
Implement Debug for all substitutions
Browse files Browse the repository at this point in the history
  • Loading branch information
timsueberkrueb committed Nov 6, 2024
1 parent 66516d9 commit 8ad9df6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions lang/ast/src/traits/subst.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::fmt::Debug;

use crate::ctx::*;
use crate::Variable;
use crate::*;
Expand All @@ -9,7 +11,7 @@ use crate::*;
/// Trait for entities which can be used as a substitution.
/// In order to be used as a substitution an entity has to provide a method
/// to query it for a result for a given deBruijn Level.
pub trait Substitution: Shift + Clone {
pub trait Substitution: Shift + Clone + Debug {
fn get_subst(&self, ctx: &LevelCtx, lvl: Lvl) -> Option<Box<Exp>>;
}

Expand Down Expand Up @@ -37,7 +39,7 @@ impl Substitution for Vec<Vec<Arg>> {

/// An assignment is the simplest form of a substitution which provides just
/// one mapping from a variable (represented by a DeBruijn Level) to an expression.
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Assign {
pub lvl: Lvl,
pub exp: Box<Exp>,
Expand Down Expand Up @@ -116,7 +118,7 @@ impl<T: Substitutable> SwapWithCtx for T {
//
//

#[derive(Clone)]
#[derive(Clone, Debug)]
struct SwapSubst {
fst1: usize,
fst2: usize,
Expand Down
4 changes: 2 additions & 2 deletions lang/transformations/src/lifting/fv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,13 @@ struct NewVar {
}

/// Substitution in the body of the new definition
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct FVBodySubst<'a> {
inner: &'a FVSubst,
}

/// Substitution in the type parameters of the new definition
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct FVParamSubst<'a> {
inner: &'a FVSubst,
}
Expand Down

0 comments on commit 8ad9df6

Please sign in to comment.