summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNadrieril2019-04-18 16:09:13 +0200
committerNadrieril2019-04-18 16:09:13 +0200
commit9c8ba84fa5d0b392f19e9e9b8569ee2fbe96bd28 (patch)
tree6ff25e16b293ecab4b2e2ba51903f0f19d29c20b
parentd8fb1cc0f5bdf6650424169b3bd841e611924760 (diff)
Remove obsolete dhall_expr!() macro
Diffstat (limited to '')
-rw-r--r--dhall/src/normalize.rs18
-rw-r--r--dhall/src/traits/static_type.rs28
-rw-r--r--dhall/tests/traits.rs24
-rw-r--r--dhall_generator/src/lib.rs6
4 files changed, 39 insertions, 37 deletions
diff --git a/dhall/src/normalize.rs b/dhall/src/normalize.rs
index a54e48e..1561f01 100644
--- a/dhall/src/normalize.rs
+++ b/dhall/src/normalize.rs
@@ -1,7 +1,7 @@
#![allow(non_snake_case)]
use crate::expr::*;
use dhall_core::*;
-use dhall_generator::dhall_expr;
+use dhall_generator as dhall;
use std::fmt;
impl<'a> Typed<'a> {
@@ -68,7 +68,7 @@ where
(rc(NEListLit(ys)), rest)
}
(ListIndexed, [_, EmptyListLit(t), rest..]) => (
- dhall_expr!([] : List ({ index : Natural, value : t })),
+ dhall::subexpr!([] : List ({ index : Natural, value : t })),
rest,
),
(ListIndexed, [_, NEListLit(xs), rest..]) => {
@@ -78,7 +78,7 @@ where
.enumerate()
.map(|(i, e)| {
let i = rc(NaturalLit(i));
- dhall_expr!({ index = i, value = e })
+ dhall::subexpr!({ index = i, value = e })
})
.collect();
(rc(NEListLit(xs)), rest)
@@ -100,7 +100,7 @@ where
let a1 = shift(1, &V("x".into(), 0), &a0);
let g = g.roll();
break 'ret (
- dhall_expr!(
+ dhall::subexpr!(
g
(List a0)
(λ(x : a0) -> λ(xs : List a1) -> [ x ] # xs)
@@ -126,7 +126,7 @@ where
let a0 = a0.roll();
let g = g.roll();
break 'ret (
- dhall_expr!(
+ dhall::subexpr!(
g
(Optional a0)
(λ(x: a0) -> Some x)
@@ -144,7 +144,7 @@ where
let x = x.clone();
let acc = acc.clone();
let cons = cons.roll();
- dhall_expr!(cons x acc)
+ dhall::subexpr!(cons x acc)
}),
rest,
),
@@ -155,7 +155,7 @@ where
(OptionalFold, [_, NEOptionalLit(x), _, just, _, rest..]) => {
let x = x.clone();
let just = just.roll();
- (dhall_expr!(just x), rest)
+ (dhall::subexpr!(just x), rest)
}
(OptionalFold, [_, EmptyOptionalLit(_), _, _, nothing, rest..]) => {
(nothing.roll(), rest)
@@ -179,7 +179,7 @@ where
};
let g = g.roll();
break 'ret (
- dhall_expr!(g Natural (λ(x : Natural) -> x + 1) 0),
+ dhall::subexpr!(g Natural (λ(x : Natural) -> x + 1) 0),
rest,
);
}
@@ -193,7 +193,7 @@ where
let t = t.roll();
let succ = succ.roll();
let zero = zero.roll();
- (dhall_expr!(succ (fold n t succ zero)), rest)
+ (dhall::subexpr!(succ (fold n t succ zero)), rest)
}
// (NaturalFold, Some(App(f2, args2)), _) => {
// match (f2.as_ref(), args2.as_slice()) {
diff --git a/dhall/src/traits/static_type.rs b/dhall/src/traits/static_type.rs
index 444f464..e92ce78 100644
--- a/dhall/src/traits/static_type.rs
+++ b/dhall/src/traits/static_type.rs
@@ -1,6 +1,6 @@
use crate::expr::*;
use dhall_core::*;
-use dhall_generator::*;
+use dhall_generator as dhall;
/// A value that has a statically-known Dhall type.
///
@@ -57,49 +57,49 @@ impl<'a> StaticType for SimpleType<'a> {
impl SimpleStaticType for bool {
fn get_simple_static_type<'a>() -> SimpleType<'a> {
- mktype(dhall_expr!(Bool))
+ mktype(dhall::subexpr!(Bool))
}
}
impl SimpleStaticType for Natural {
fn get_simple_static_type<'a>() -> SimpleType<'a> {
- mktype(dhall_expr!(Natural))
+ mktype(dhall::subexpr!(Natural))
}
}
impl SimpleStaticType for u32 {
fn get_simple_static_type<'a>() -> SimpleType<'a> {
- mktype(dhall_expr!(Natural))
+ mktype(dhall::subexpr!(Natural))
}
}
impl SimpleStaticType for u64 {
fn get_simple_static_type<'a>() -> SimpleType<'a> {
- mktype(dhall_expr!(Natural))
+ mktype(dhall::subexpr!(Natural))
}
}
impl SimpleStaticType for Integer {
fn get_simple_static_type<'a>() -> SimpleType<'a> {
- mktype(dhall_expr!(Integer))
+ mktype(dhall::subexpr!(Integer))
}
}
impl SimpleStaticType for i32 {
fn get_simple_static_type<'a>() -> SimpleType<'a> {
- mktype(dhall_expr!(Integer))
+ mktype(dhall::subexpr!(Integer))
}
}
impl SimpleStaticType for i64 {
fn get_simple_static_type<'a>() -> SimpleType<'a> {
- mktype(dhall_expr!(Integer))
+ mktype(dhall::subexpr!(Integer))
}
}
impl SimpleStaticType for String {
fn get_simple_static_type<'a>() -> SimpleType<'a> {
- mktype(dhall_expr!(Text))
+ mktype(dhall::subexpr!(Text))
}
}
@@ -107,21 +107,21 @@ impl<A: SimpleStaticType, B: SimpleStaticType> SimpleStaticType for (A, B) {
fn get_simple_static_type<'a>() -> SimpleType<'a> {
let ta: SubExpr<_, _> = A::get_simple_static_type().into();
let tb: SubExpr<_, _> = B::get_simple_static_type().into();
- mktype(dhall_expr!({ _1: ta, _2: tb }))
+ mktype(dhall::subexpr!({ _1: ta, _2: tb }))
}
}
impl<T: SimpleStaticType> SimpleStaticType for Option<T> {
fn get_simple_static_type<'a>() -> SimpleType<'a> {
let t: SubExpr<_, _> = T::get_simple_static_type().into();
- mktype(dhall_expr!(Optional t))
+ mktype(dhall::subexpr!(Optional t))
}
}
impl<T: SimpleStaticType> SimpleStaticType for Vec<T> {
fn get_simple_static_type<'a>() -> SimpleType<'a> {
let t: SubExpr<_, _> = T::get_simple_static_type().into();
- mktype(dhall_expr!(List t))
+ mktype(dhall::subexpr!(List t))
}
}
@@ -133,7 +133,7 @@ impl<'a, T: SimpleStaticType> SimpleStaticType for &'a T {
impl<T> SimpleStaticType for std::marker::PhantomData<T> {
fn get_simple_static_type<'a>() -> SimpleType<'a> {
- mktype(dhall_expr!({}))
+ mktype(dhall::subexpr!({}))
}
}
@@ -143,6 +143,6 @@ impl<T: SimpleStaticType, E: SimpleStaticType> SimpleStaticType
fn get_simple_static_type<'a>() -> SimpleType<'a> {
let tt: SubExpr<_, _> = T::get_simple_static_type().into();
let te: SubExpr<_, _> = E::get_simple_static_type().into();
- mktype(dhall_expr!(< Ok: tt | Err: te>))
+ mktype(dhall::subexpr!(< Ok: tt | Err: te>))
}
}
diff --git a/dhall/tests/traits.rs b/dhall/tests/traits.rs
index 00e6509..a7cd530 100644
--- a/dhall/tests/traits.rs
+++ b/dhall/tests/traits.rs
@@ -1,7 +1,7 @@
#![feature(proc_macro_hygiene)]
use dhall::de::SimpleStaticType;
use dhall_core::{SubExpr, X};
-use dhall_generator::dhall_expr;
+use dhall_generator;
#[test]
fn test_static_type() {
@@ -9,15 +9,21 @@ fn test_static_type() {
x.into()
}
- assert_eq!(bool::get_simple_static_type(), mktype(dhall_expr!(Bool)));
- assert_eq!(String::get_simple_static_type(), mktype(dhall_expr!(Text)));
+ assert_eq!(
+ bool::get_simple_static_type(),
+ mktype(dhall_generator::subexpr!(Bool))
+ );
+ assert_eq!(
+ String::get_simple_static_type(),
+ mktype(dhall_generator::subexpr!(Text))
+ );
assert_eq!(
<Option<bool>>::get_simple_static_type(),
- mktype(dhall_expr!(Optional Bool))
+ mktype(dhall_generator::subexpr!(Optional Bool))
);
assert_eq!(
<(bool, Option<String>)>::get_simple_static_type(),
- mktype(dhall_expr!({ _1: Bool, _2: Optional Text }))
+ mktype(dhall_generator::subexpr!({ _1: Bool, _2: Optional Text }))
);
#[derive(dhall::de::SimpleStaticType)]
@@ -28,7 +34,9 @@ fn test_static_type() {
}
assert_eq!(
<A as dhall::de::SimpleStaticType>::get_simple_static_type(),
- mktype(dhall_expr!({ field1: Bool, field2: Optional Bool }))
+ mktype(
+ dhall_generator::subexpr!({ field1: Bool, field2: Optional Bool })
+ )
);
#[derive(SimpleStaticType)]
@@ -55,7 +63,7 @@ fn test_static_type() {
struct D();
assert_eq!(
<C<D>>::get_simple_static_type(),
- mktype(dhall_expr!({ _1: {}, _2: Optional Text }))
+ mktype(dhall_generator::subexpr!({ _1: {}, _2: Optional Text }))
);
#[derive(SimpleStaticType)]
@@ -66,6 +74,6 @@ fn test_static_type() {
};
assert_eq!(
<E<bool>>::get_simple_static_type(),
- mktype(dhall_expr!(< A: Bool | B: Text >))
+ mktype(dhall_generator::subexpr!(< A: Bool | B: Text >))
);
}
diff --git a/dhall_generator/src/lib.rs b/dhall_generator/src/lib.rs
index 9cf944a..1124968 100644
--- a/dhall_generator/src/lib.rs
+++ b/dhall_generator/src/lib.rs
@@ -10,12 +10,6 @@ mod quote;
use proc_macro::TokenStream;
-// Deprecated
-#[proc_macro]
-pub fn dhall_expr(input: TokenStream) -> TokenStream {
- subexpr(input)
-}
-
#[proc_macro]
pub fn expr(input: TokenStream) -> TokenStream {
quote::expr(input)