From 726c281cdd3824fcfdde34fe8d01f95416f7808c Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 7 May 2019 16:01:24 +0200 Subject: Clean up some of the SubExpr type-changing methods --- dhall/src/core/thunk.rs | 4 ++-- dhall/src/phase/parse.rs | 2 +- dhall/src/phase/typecheck.rs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'dhall') diff --git a/dhall/src/core/thunk.rs b/dhall/src/core/thunk.rs index 8775ce2..69c4347 100644 --- a/dhall/src/core/thunk.rs +++ b/dhall/src/core/thunk.rs @@ -126,7 +126,7 @@ impl Thunk { } pub(crate) fn from_normalized_expr(e: OutputSubExpr) -> Thunk { - Thunk::new(NormalizationContext::new(), e.embed_absurd().note_absurd()) + Thunk::new(NormalizationContext::new(), e.absurd()) } // Normalizes contents to normal form; faster than `normalize_nf` if @@ -253,7 +253,7 @@ impl TypeThunk { TypeThunk::Type(t) => Ok(t.clone()), TypeThunk::Thunk(th) => { // TODO: rule out statically - mktype(ctx, th.normalize_to_expr().embed_absurd().note_absurd()) + mktype(ctx, th.normalize_to_expr().absurd()) } } } diff --git a/dhall/src/phase/parse.rs b/dhall/src/phase/parse.rs index 809faf4..6b426af 100644 --- a/dhall/src/phase/parse.rs +++ b/dhall/src/phase/parse.rs @@ -13,7 +13,7 @@ pub(crate) fn parse_file(f: &Path) -> Result { File::open(f)?.read_to_string(&mut buffer)?; let expr = parse_expr(&*buffer)?; let root = ImportRoot::LocalDir(f.parent().unwrap().to_owned()); - Ok(Parsed(expr.unnote().note_absurd(), root)) + Ok(Parsed(expr, root)) } pub(crate) fn parse_str(s: &str) -> Result { diff --git a/dhall/src/phase/typecheck.rs b/dhall/src/phase/typecheck.rs index 3e6986f..32c1531 100644 --- a/dhall/src/phase/typecheck.rs +++ b/dhall/src/phase/typecheck.rs @@ -230,7 +230,7 @@ pub(crate) fn type_of_const(c: Const) -> Result { } } -fn type_of_builtin(b: Builtin) -> Expr { +fn type_of_builtin(b: Builtin) -> Expr { use dhall_syntax::Builtin::*; match b { Bool | Natural | Integer | Double | Text => dhall::expr!(Type), @@ -635,7 +635,7 @@ fn type_last_layer( } Const(c) => Ok(RetTyped(Typed::from_const(c))), Builtin(b) => { - Ok(RetType(mktype(ctx, rc(type_of_builtin(b)).note_absurd())?)) + Ok(RetType(mktype(ctx, rc(type_of_builtin(b)).absurd())?)) } BoolLit(_) => Ok(RetType(builtin_to_type(Bool)?)), NaturalLit(_) => Ok(RetType(builtin_to_type(Natural)?)), @@ -712,7 +712,7 @@ pub(crate) fn typecheck_with( ty: &Type, ) -> Result { let expr: SubExpr<_, _> = e.0; - let ty: SubExpr<_, _> = ty.to_expr().embed_absurd().note_absurd(); + let ty: SubExpr<_, _> = ty.to_expr().absurd(); type_of(expr.rewrap(ExprF::Annot(expr.clone(), ty))) } pub(crate) fn skip_typecheck(e: Resolved) -> Typed { -- cgit v1.2.3