diff options
author | Nadrieril | 2019-04-13 21:34:51 +0200 |
---|---|---|
committer | Nadrieril | 2019-04-13 21:34:51 +0200 |
commit | 427a3416507db3fd4b534322d996bc8aafba5259 (patch) | |
tree | 6d2e12ff2535f4dbde77e7fd61e032e0adcb79c2 | |
parent | bbc09d65ce206d78ac7b8cfc32cc5ed4dec5fbfe (diff) |
Fix `let` parsing
Diffstat (limited to '')
-rw-r--r-- | dhall/src/binary.rs | 1 | ||||
-rw-r--r-- | dhall_core/src/parser.rs | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/dhall/src/binary.rs b/dhall/src/binary.rs index c785daf..8a23e76 100644 --- a/dhall/src/binary.rs +++ b/dhall/src/binary.rs @@ -316,6 +316,7 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<ParsedExpr, DecodeError> { let expr = cbor_value_to_dhall(expr)?; return Ok(bindings .into_iter() + .rev() .fold(expr, |acc, (x, t, v)| rc(Let(x, t, v, acc)))); } [U64(26), x, y] => { diff --git a/dhall_core/src/parser.rs b/dhall_core/src/parser.rs index 2d47ad7..e520f05 100644 --- a/dhall_core/src/parser.rs +++ b/dhall_core/src/parser.rs @@ -604,7 +604,7 @@ make_parser! { spanned(span, BoolIf(rc(cond), rc(left), rc(right))) }, [let_binding(bindings).., in_(()), expression(final_expr)] => { - bindings.fold( + bindings.rev().fold( final_expr, |acc, x| Let(x.0, x.1, x.2, rc(acc)) ) |