summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/phase/normalize.rs
diff options
context:
space:
mode:
authorNadrieril2020-01-19 18:30:13 +0000
committerNadrieril2020-01-19 18:30:13 +0000
commitaec80599f161096b68cac88ffb8852a61b62fcfa (patch)
tree945a87f97f062dcc7b0f4ec2f04dd8bc2da431ef /dhall/src/semantics/phase/normalize.rs
parent2f19fe1978c0fc8c456563c68ca08eb5b48ef0cd (diff)
Restore more types in value_to_tyexpr
Diffstat (limited to '')
-rw-r--r--dhall/src/semantics/phase/normalize.rs23
1 files changed, 15 insertions, 8 deletions
diff --git a/dhall/src/semantics/phase/normalize.rs b/dhall/src/semantics/phase/normalize.rs
index 541a196..f0a6a8c 100644
--- a/dhall/src/semantics/phase/normalize.rs
+++ b/dhall/src/semantics/phase/normalize.rs
@@ -374,9 +374,13 @@ pub(crate) fn apply_any(f: Value, a: Value, ty: &Value) -> ValueKind<Value> {
let args = args.iter().cloned().chain(once(a.clone())).collect();
apply_builtin(*b, args, ty)
}
- ValueKind::UnionConstructor(l, kts) => {
- ValueKind::UnionLit(l.clone(), a, kts.clone())
- }
+ ValueKind::UnionConstructor(l, kts, uniont) => ValueKind::UnionLit(
+ l.clone(),
+ a,
+ kts.clone(),
+ uniont.clone(),
+ f.get_type().unwrap(),
+ ),
_ => {
drop(f_borrow);
ValueKind::PartialExpr(ExprKind::App(f, a))
@@ -692,9 +696,11 @@ pub(crate) fn normalize_one_layer(
Ret::Expr(expr)
}
},
- UnionType(kts) => {
- Ret::ValueKind(UnionConstructor(l.clone(), kts.clone()))
- }
+ UnionType(kts) => Ret::ValueKind(UnionConstructor(
+ l.clone(),
+ kts.clone(),
+ v.get_type().unwrap(),
+ )),
_ => {
drop(v_borrow);
Ret::Expr(expr)
@@ -710,7 +716,8 @@ pub(crate) fn normalize_one_layer(
let handlers_borrow = handlers.as_whnf();
let variant_borrow = variant.as_whnf();
match (&*handlers_borrow, &*variant_borrow) {
- (RecordLit(kvs), UnionConstructor(l, _)) => match kvs.get(l) {
+ (RecordLit(kvs), UnionConstructor(l, _, _)) => match kvs.get(l)
+ {
Some(h) => Ret::Value(h.clone()),
None => {
drop(handlers_borrow);
@@ -718,7 +725,7 @@ pub(crate) fn normalize_one_layer(
Ret::Expr(expr)
}
},
- (RecordLit(kvs), UnionLit(l, v, _)) => match kvs.get(l) {
+ (RecordLit(kvs), UnionLit(l, v, _, _, _)) => match kvs.get(l) {
Some(h) => Ret::Value(h.app(v.clone())),
None => {
drop(handlers_borrow);