From 5692bf2c8a7acfb90a5d03d0bd360c105ba2a72b Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 16 Mar 2019 00:18:50 +0100 Subject: Store an Option in OptionalLit instead of a vec Closes #21 --- dhall/src/typecheck.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'dhall/src/typecheck.rs') 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> = 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), )); } } -- cgit v1.2.3