summaryrefslogtreecommitdiff
path: root/dhall
diff options
context:
space:
mode:
authorNadrieril2019-08-06 23:03:01 +0200
committerNadrieril2019-08-06 23:03:01 +0200
commitf7b0c6b9c52f65624dc765fb9eaa7d0d94eeae76 (patch)
treeb72b50561bb3f6f335699c76402819ed20bf42b9 /dhall
parenta307a13738ccca538635ae796e6c998439025b9b (diff)
Generalize empty list annotations
Diffstat (limited to 'dhall')
-rw-r--r--dhall/build.rs2
-rw-r--r--dhall/src/phase/binary.rs8
2 files changed, 8 insertions, 2 deletions
diff --git a/dhall/build.rs b/dhall/build.rs
index 2d75cbf..07da3f5 100644
--- a/dhall/build.rs
+++ b/dhall/build.rs
@@ -103,6 +103,8 @@ fn main() -> std::io::Result<()> {
|| path == "success/unit/import/urls/potPourri"
// TODO: toMap
|| path == "success/toMap"
+ // Not a failure anymore
+ || path == "failure/unit/ListLitEmptyPrecedence"
},
)?;
diff --git a/dhall/src/phase/binary.rs b/dhall/src/phase/binary.rs
index 66b235f..f88eee2 100644
--- a/dhall/src/phase/binary.rs
+++ b/dhall/src/phase/binary.rs
@@ -341,6 +341,10 @@ fn cbor_value_to_dhall(
let y = cbor_value_to_dhall(&y)?;
Annot(x, y)
}
+ [U64(27), x] => {
+ let x = cbor_value_to_dhall(&x)?;
+ EmptyListLit(x)
+ }
_ => Err(DecodeError::WrongFormatError(format!("{:?}", data)))?,
},
_ => Err(DecodeError::WrongFormatError(format!("{:?}", data)))?,
@@ -475,9 +479,9 @@ where
EmptyListLit(x) => match x.as_ref() {
App(f, a) => match f.as_ref() {
ExprF::Builtin(Builtin::List) => ser_seq!(ser; tag(4), expr(a)),
- _ => unreachable!(),
+ _ => ser_seq!(ser; tag(27), expr(x)),
},
- _ => unreachable!(),
+ _ => ser_seq!(ser; tag(27), expr(x)),
},
NEListLit(xs) => ser.collect_seq(
once(tag(4)).chain(once(null())).chain(xs.iter().map(expr)),