diff options
author | Nadrieril Feneanar | 2019-08-30 19:17:07 +0200 |
---|---|---|
committer | GitHub | 2019-08-30 19:17:07 +0200 |
commit | ddecd2c40b91ea6aa4e23ccb2f6817ad5d1df3de (patch) | |
tree | fc915b8f5e5f41eb20571c4ad67dd4bb9ace72bc /dhall/src/phase/typecheck.rs | |
parent | a981afc465f4279a7a4d6ce3ac5844e04846613b (diff) | |
parent | a7363042a16364a6dafdd545f4069dcf04a4197e (diff) |
Merge pull request #108 from Nadrieril/rename-subexpr
Rename SubExpr to Expr
Diffstat (limited to '')
-rw-r--r-- | dhall/src/phase/typecheck.rs | 16 |
1 files changed, 8 insertions, 8 deletions
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<E>(b: Builtin) -> Expr<E> { 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<E>(b: Builtin) -> Expr<E> { 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<Normalized>, + e: Expr<Normalized>, ) -> Result<Value, TypeError> { 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<Normalized>) -> Result<Value, TypeError> { +pub(crate) fn typecheck(e: Expr<Normalized>) -> Result<Value, TypeError> { type_with(&TypecheckContext::new(), e) } pub(crate) fn typecheck_with( - expr: SubExpr<Normalized>, - ty: SubExpr<Normalized>, + expr: Expr<Normalized>, + ty: Expr<Normalized>, ) -> Result<Value, TypeError> { typecheck(expr.rewrap(ExprF::Annot(expr.clone(), ty))) } |