summaryrefslogtreecommitdiff
path: root/serde_dhall/src/options/de.rs
diff options
context:
space:
mode:
authorNadrieril2020-12-07 11:56:00 +0000
committerNadrieril2020-12-07 19:34:38 +0000
commit697e93e0f56e3c063ce253983f703be88d468b47 (patch)
treec7217ddd01c149ef15f630cfae0b4582fe014607 /serde_dhall/src/options/de.rs
parent35ed301e8de5a2b1102e370e638564d3c3d204a8 (diff)
Don't store internal structures of `dhall` in `serde_dhall`
Diffstat (limited to 'serde_dhall/src/options/de.rs')
-rw-r--r--serde_dhall/src/options/de.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/serde_dhall/src/options/de.rs b/serde_dhall/src/options/de.rs
index 22fa7ba..39ab5ca 100644
--- a/serde_dhall/src/options/de.rs
+++ b/serde_dhall/src/options/de.rs
@@ -229,7 +229,7 @@ impl<'a, A> Deserializer<'a, A> {
// self
// }
- fn _parse<T>(&self) -> dhall::error::Result<Value>
+ fn _parse<T>(&self) -> dhall::error::Result<Result<Value>>
where
A: TypeAnnot,
T: HasAnnot<A>,
@@ -246,9 +246,12 @@ impl<'a, A> Deserializer<'a, A> {
};
let typed = match &T::get_annot(self.annot) {
None => resolved.typecheck()?,
- Some(ty) => resolved.typecheck_with(ty.to_value().as_hir())?,
+ Some(ty) => resolved.typecheck_with(&ty.to_hir())?,
};
- Ok(Value::from_nir(typed.normalize().as_nir()))
+ Ok(Value::from_nir_and_ty(
+ typed.normalize().as_nir(),
+ typed.ty().as_nir(),
+ ))
}
/// Parses the chosen dhall value with the options provided.
@@ -274,7 +277,7 @@ impl<'a, A> Deserializer<'a, A> {
let val = self
._parse::<T>()
.map_err(ErrorKind::Dhall)
- .map_err(Error)?;
+ .map_err(Error)??;
T::from_dhall(&val)
}
}