Skip to content

Fix isNormalized for field selections #1210

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

Merged
merged 1 commit into from
Aug 7, 2019
Merged

Conversation

sjakobi
Copy link
Collaborator

@sjakobi sjakobi commented Aug 6, 2019

In expressions like

({ x : Optional/fold } // {=}).x

isNormalized didn't check if the expression being selected from
was normalized.

Fixes #1209.

In expressions like

    ({ x : Optional/fold } // {=}).x

isNormalized didn't check if the expression being selected from
was normalized.

Fixes #1209.
@sjakobi sjakobi force-pushed the sjakobi/1209-isNormalized branch from 3517a95 to 4fe4a0b Compare August 6, 2019 23:23
Combine x@(RecordLit m) y -> loop x && loop y && Dhall.Map.member k m
Combine x (RecordLit m) -> loop x && Dhall.Map.toList (fmap loop m) == [(k, True)]
Prefer x@(RecordLit m) y -> loop x && loop y && Dhall.Map.member k m
Combine (RecordLit m) _ -> Dhall.Map.member k m && loop r
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps move the loop r check above so that does not have to be repeated across the branches, like this:

Field r k -> loop r && case r of
    RecordLit _ -> False
    

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I actually did that in a previous version of this fix, but I just couldn't handle the inefficiency! ;)

If you don't mind too much I'd slightly prefer to keep the fix as it is now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't mind! It was just a suggestion 🙂

@sjakobi sjakobi merged commit 4559a27 into master Aug 7, 2019
@sjakobi sjakobi deleted the sjakobi/1209-isNormalized branch August 7, 2019 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test failure in "isNormalized should be consistent with normalize"
2 participants