Nadrieril / dhall-rust

Maintainable configuration files, for Rust users
Other
303 stars 27 forks source link

`with` expression fails during parsing #174

Closed kritzcreek closed 4 years ago

kritzcreek commented 4 years ago

Let me start of by saying thank you so much for the package!

The smallest example I can produce is:

let x = {=} in x with y = 42

which fails with:

thread 'main' panicked at 'Tried to union incompatible spans: WithSugar and Parsed(ParsedSpan { input: "let x = {=} in x with y = 42\n", start: 0, end: 12 })', /home/creek/.cargo/registry/src/github.com-1ecc6299db9ec823/dhall-0.5.3/src/syntax/ast/span.rs:69:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

curiously enough:

{=} with y = 42

works just fine, so it seems to be an interaction between with and let

Nadrieril commented 4 years ago

Thanks for the minimized test! I can't seem to reproduce your error; this parses and normalizes correctly for me. What is the code you're writing that crashes?

Nadrieril commented 4 years ago

Are you using the latest version of dhall_rust?

kritzcreek commented 4 years ago

Are you using the latest version of dhall_rust?

Yeah I'm using 0.5.3

I can't seem to reproduce your error; this parses and normalizes correctly for me. What is the code you're writing that crashes?

It's in a branch here: https://github.com/kritzcreek/vessel/tree/dhall-record. It reproduces when I run cargo run sources, which tries to read the package-set.dhall file in the repo root I commited. It's read in read_package_set which fixes the expected type to HashMap<Name, PackageInfo> if that matters.

Nadrieril commented 4 years ago

Ah, turns out I had forgotten to publish a few changes, and I had already solved your problem ^^. This is fixed in 0.6.0 (there's a breaking change, see CHANGELOG.md). Can you confirm that your issue is fixed?

kritzcreek commented 4 years ago

Confirmed :) Thanks!