diff options
author | Nadrieril | 2019-11-11 11:34:29 +0000 |
---|---|---|
committer | Nadrieril | 2019-11-11 13:50:36 +0000 |
commit | 5d5a356b8eb36e277c312e5550d1cb0a2f82e9fa (patch) | |
tree | babaa2061bd48769006973ee74073f61b0ac3f5e /dhall/src/phase | |
parent | b68c3af578d1f6b0d1e32e7d88ef57774fb468d8 (diff) |
Store a `Span` in `Value`
Diffstat (limited to 'dhall/src/phase')
-rw-r--r-- | dhall/src/phase/typecheck.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/dhall/src/phase/typecheck.rs b/dhall/src/phase/typecheck.rs index 4d8c7d3..63f5157 100644 --- a/dhall/src/phase/typecheck.rs +++ b/dhall/src/phase/typecheck.rs @@ -304,6 +304,7 @@ fn type_with( e: Expr<Normalized>, ) -> Result<Value, TypeError> { use dhall_syntax::ExprF::{Annot, Embed, Lam, Let, Pi, Var}; + let span = e.span(); Ok(match e.as_ref() { Lam(var, annot, body) => { @@ -348,7 +349,7 @@ fn type_with( |e| type_with(ctx, e.clone()), |_, _| unreachable!(), )?; - type_last_layer(ctx, expr)? + type_last_layer(ctx, expr, span)? } }) } @@ -358,6 +359,7 @@ fn type_with( fn type_last_layer( ctx: &TypecheckContext, e: ExprF<Value, Normalized>, + span: Span, ) -> Result<Value, TypeError> { use crate::error::TypeMessage::*; use dhall_syntax::BinOp::*; @@ -584,6 +586,7 @@ fn type_last_layer( l.get_type()?, r.get_type()?, ), + Span::PlaceHolder, )?), BinOp(RecursiveRecordTypeMerge, l, r) => { use crate::phase::normalize::merge_maps; @@ -619,6 +622,7 @@ fn type_last_layer( l.clone(), r.clone(), ), + Span::PlaceHolder, ) }, )?; @@ -786,9 +790,11 @@ fn type_last_layer( }; Ok(match ret { - RetTypeOnly(typ) => { - Value::from_valuef_and_type(ValueF::PartialExpr(e), typ) - } + RetTypeOnly(typ) => Value::from_valuef_and_type_and_span( + ValueF::PartialExpr(e), + typ, + span, + ), RetWhole(v) => v, }) } |