Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix diffs for lists #1213

Merged
merged 2 commits into from
Aug 8, 2019
Merged

Fix diffs for lists #1213

merged 2 commits into from
Aug 8, 2019

Conversation

Gabriella439
Copy link
Collaborator

@Gabriella439 Gabriella439 commented Aug 7, 2019

Fixes #1211

The original implementation of diffing two lists in #450 attempted to add a
special case in the logic for when the list had no common elements.
However, this led to a bug where the two lists would display different
if they were both empty.

A followup change in #740 tried to fix the problem, but introduced a new
issue where different lists would now never render the elements that differed.

This change fixes that by removing the special case.

The new output for the linked example is:

Use "dhall --explain" for detailed errors

Error: Assertion failed

[ …
, - 1
, …
, + 55
]

16│                assert : fibs 10 ≡ [ 0, 1, 2, 3, 5, 8, 13, 21, 34, 55 ]
17│

(stdin):16:16

Fixes #1211

The original implementation of diffing two lists in #450 attempted to add a
special case in the logic for when the list had no common elements.
However, this led to a bug where the two lists would display different
if they were both empty.

lists would never render.

This change fixes that by removing the special case.

The new output for the linked example is:

```
Use "dhall --explain" for detailed errors

Error: Assertion failed

[ …
, - 1
, …
, + 55
]

16│                assert : fibs 10 ≡ [ 0, 1, 2, 3, 5, 8, 13, 21, 34, 55 ]
17│

(stdin):16:16
```
Copy link
Collaborator

@sjakobi sjakobi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was quick! 👍

Cheers! :)

@mergify mergify bot merged commit ecb5814 into master Aug 8, 2019
@mergify mergify bot deleted the gabriel/fix_diff_2 branch August 8, 2019 02:00
Gabriella439 added a commit that referenced this pull request Aug 29, 2019
This is essentially the exact same problem and fix as #1213

Normally I would add a test, except that our test suite for diffs doesn't
yet support escape codes.  However, the basic problem was the following
output:

```
$ dhall diff '"1"' '"2"'
- "…"
+ "…"
```

... which now displays (with color highlighting) this output:

```
$ dhall diff '"1"' '"2"'
"12"  -- Imagine that the 1 is red and the 2 is green
```
mergify bot pushed a commit that referenced this pull request Aug 29, 2019
This is essentially the exact same problem and fix as #1213

Normally I would add a test, except that our test suite for diffs doesn't
yet support escape codes.  However, the basic problem was the following
output:

```
$ dhall diff '"1"' '"2"'
- "…"
+ "…"
```

... which now displays (with color highlighting) this output:

```
$ dhall diff '"1"' '"2"'
"12"  -- Imagine that the 1 is red and the 2 is green
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve diff for un--explained assertion failure
2 participants