From a7363042a16364a6dafdd545f4069dcf04a4197e Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 27 Aug 2019 23:18:13 +0200 Subject: Rename SubExpr to Expr, and Expr to RawExpr For clarity, and consistency with Value --- dhall/src/phase/typecheck.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'dhall/src/phase/typecheck.rs') diff --git a/dhall/src/phase/typecheck.rs b/dhall/src/phase/typecheck.rs index ab6d882..52a4e47 100644 --- a/dhall/src/phase/typecheck.rs +++ b/dhall/src/phase/typecheck.rs @@ -2,7 +2,7 @@ use std::cmp::max; use std::collections::HashMap; use dhall_syntax::{ - rc, Builtin, Const, Expr, ExprF, InterpolatedTextContents, Label, SubExpr, + rc, Builtin, Const, Expr, ExprF, InterpolatedTextContents, Label, }; use crate::core::context::TypecheckContext; @@ -200,7 +200,7 @@ macro_rules! make_type { fn type_of_builtin(b: Builtin) -> Expr { use dhall_syntax::Builtin::*; - match b { + rc(match b { Bool | Natural | Integer | Double | Text => make_type!(Type), List | Optional => make_type!( Type -> Type @@ -280,14 +280,14 @@ fn type_of_builtin(b: Builtin) -> Expr { OptionalNone => make_type!( forall (a: Type) -> Optional a ), - } + }) } pub(crate) fn builtin_to_value(b: Builtin) -> Value { let ctx = TypecheckContext::new(); Value::from_valuef_and_type( ValueF::from_builtin(b), - type_with(&ctx, rc(type_of_builtin(b))).unwrap(), + type_with(&ctx, type_of_builtin(b)).unwrap(), ) } @@ -297,7 +297,7 @@ pub(crate) fn builtin_to_value(b: Builtin) -> Value { /// normalized as well. fn type_with( ctx: &TypecheckContext, - e: SubExpr, + e: Expr, ) -> Result { use dhall_syntax::ExprF::{Annot, Embed, Lam, Let, Pi, Var}; @@ -791,13 +791,13 @@ fn type_last_layer( /// `type_of` is the same as `type_with` with an empty context, meaning that the /// expression must be closed (i.e. no free variables), otherwise type-checking /// will fail. -pub(crate) fn typecheck(e: SubExpr) -> Result { +pub(crate) fn typecheck(e: Expr) -> Result { type_with(&TypecheckContext::new(), e) } pub(crate) fn typecheck_with( - expr: SubExpr, - ty: SubExpr, + expr: Expr, + ty: Expr, ) -> Result { typecheck(expr.rewrap(ExprF::Annot(expr.clone(), ty))) } -- cgit v1.2.3