summaryrefslogtreecommitdiff
path: root/dhall/src/typecheck.rs
diff options
context:
space:
mode:
authorNadrieril2019-03-16 00:18:50 +0100
committerNadrieril2019-03-16 00:18:50 +0100
commit5692bf2c8a7acfb90a5d03d0bd360c105ba2a72b (patch)
treeb86ac0beeb06cb9984f1d6a2ba547d391674533e /dhall/src/typecheck.rs
parent1522469dc0b68c63dbbc81faab057c3d48402657 (diff)
Store an Option in OptionalLit instead of a vec
Closes #21
Diffstat (limited to '')
-rw-r--r--dhall/src/typecheck.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/dhall/src/typecheck.rs b/dhall/src/typecheck.rs
index ed02619..0f87d67 100644
--- a/dhall/src/typecheck.rs
+++ b/dhall/src/typecheck.rs
@@ -477,8 +477,8 @@ where
let t: Box<Expr<_, _>> = match t {
Some(t) => t.clone(),
None => {
- let first_x = iter.next().unwrap();
- bx(type_with(ctx, first_x)?)
+ let x = iter.next().unwrap();
+ bx(type_with(ctx, x)?)
}
};
@@ -493,10 +493,6 @@ where
));
}
}
- let n = xs.len();
- if 2 <= n {
- return Err(TypeError::new(ctx, e, InvalidOptionalLiteral(n)));
- }
for x in iter {
let t2 = type_with(ctx, x)?;
if !prop_equal(&t, &t2) {
@@ -505,7 +501,7 @@ where
return Err(TypeError::new(
ctx,
e,
- InvalidOptionalElement(nf_t, x.clone(), nf_t2),
+ InvalidOptionalElement(nf_t, (**x).clone(), nf_t2),
));
}
}