Skip to content

Commit

Permalink
Tidy test case
Browse files Browse the repository at this point in the history
  • Loading branch information
jroesch committed Aug 4, 2015
1 parent 8602a7d commit 0bb5a1a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/test/run-pass/type-macros.rs
Expand Up @@ -57,9 +57,11 @@ impl<Rec: HList + Sized, X, Xs: HList, Ys: HList> Add<Ys> for Cons<X, Xs> where
// type macro Expr allows us to expand the + operator appropriately
macro_rules! Expr {
{ ( $($LHS:tt)+ ) } => { Expr!($($LHS)+) };
{ HList ! [ $($LHS:tt)* ] + $($RHS:tt)+ } => { <Expr!(HList![$($LHS)*]) as Add<Expr!($($RHS)+)>>::Output };
{ $LHS:tt + $($RHS:tt)+ } => { <Expr!($LHS) as Add<Expr!($($RHS)+)>>::Output };
{ $LHS:ty } => { $LHS };
{ HList ! [ $($LHS:tt)* ] + $($RHS:tt)+ } => {
<Expr!(HList![$($LHS)*]) as Add<Expr!($($RHS)+)>>::Output
};
{ $LHS:tt + $($RHS:tt)+ } => { <Expr!($LHS) as Add<Expr!($($RHS)+)>>::Output };
{ $LHS:ty } => { $LHS };
}

// test demonstrating term level `xs + ys` and type level `Expr!(Xs + Ys)`
Expand Down

0 comments on commit 0bb5a1a

Please sign in to comment.