From 0e5c93c398645d39fceb98d054f1a7e67025b4fd Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 4 May 2019 16:50:38 +0200 Subject: Keep Spans through normalization and typechecking --- dhall/src/normalize.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'dhall/src/normalize.rs') diff --git a/dhall/src/normalize.rs b/dhall/src/normalize.rs index 4d87225..8ae746d 100644 --- a/dhall/src/normalize.rs +++ b/dhall/src/normalize.rs @@ -6,12 +6,12 @@ use dhall_proc_macros as dhall; use dhall_syntax::context::Context; use dhall_syntax::{ rc, BinOp, Builtin, Const, ExprF, Integer, InterpolatedText, - InterpolatedTextContents, Label, Natural, SubExpr, V, X, + InterpolatedTextContents, Label, Natural, Span, SubExpr, V, X, }; use crate::expr::{Normalized, Type, Typed, TypedInternal}; -type InputSubExpr = SubExpr; +type InputSubExpr = SubExpr; type OutputSubExpr = SubExpr; impl Typed { @@ -110,10 +110,7 @@ impl NormalizationContext { for v in vs.iter() { let new_item = match v { Type(var, _) => EnvItem::Skip(var.clone()), - Value(e) => EnvItem::Thunk(Thunk::new( - NormalizationContext::new(), - e.as_expr().embed_absurd(), - )), + Value(e) => EnvItem::Thunk(e.to_thunk()), }; ctx = ctx.insert(k.clone(), new_item); } @@ -736,7 +733,10 @@ mod thunk { } pub(crate) fn from_normalized_expr(e: OutputSubExpr) -> Thunk { - Thunk::new(NormalizationContext::new(), e.embed_absurd()) + Thunk::new( + NormalizationContext::new(), + e.embed_absurd().note_absurd(), + ) } // Normalizes contents to normal form; faster than `normalize_nf` if -- cgit v1.2.3