From 4c159640e5ee77ffa48b85a5bffa56350cf933ef Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 4 May 2019 17:59:05 +0200 Subject: Make SubExpr generic in the variable labels type --- dhall/src/expr.rs | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'dhall/src/expr.rs') diff --git a/dhall/src/expr.rs b/dhall/src/expr.rs index 5bde68f..efc3928 100644 --- a/dhall/src/expr.rs +++ b/dhall/src/expr.rs @@ -23,15 +23,17 @@ macro_rules! derive_other_traits { }; } +type OutputSubExpr = SubExpr; + #[derive(Debug, Clone)] pub(crate) struct Parsed( - pub(crate) SubExpr, + pub(crate) SubExpr, pub(crate) ImportRoot, ); derive_other_traits!(Parsed); #[derive(Debug, Clone)] -pub(crate) struct Resolved(pub(crate) SubExpr); +pub(crate) struct Resolved(pub(crate) SubExpr); derive_other_traits!(Resolved); pub(crate) use self::typed::TypedInternal; @@ -57,12 +59,12 @@ impl std::fmt::Display for Normalized { } mod typed { - use super::{Type, Typed}; + use super::{OutputSubExpr, Type, Typed}; use crate::normalize::{Thunk, Value}; use crate::typecheck::{ TypeError, TypeInternal, TypeMessage, TypecheckContext, }; - use dhall_syntax::{Const, Label, SubExpr, V, X}; + use dhall_syntax::{Const, Label, Var}; use std::borrow::Cow; #[derive(Debug, Clone)] @@ -90,7 +92,7 @@ mod typed { } } - pub(crate) fn to_expr(&self) -> SubExpr { + pub(crate) fn to_expr(&self) -> OutputSubExpr { self.to_value().normalize_to_expr() } @@ -129,7 +131,7 @@ mod typed { } } - pub(crate) fn shift(&self, delta: isize, var: &V