Skip to content

Fix uninterpreted functions in keys of Maps and Sets #2323

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 19 commits into from
Feb 3, 2021
Merged

Conversation

ttuegel
Copy link
Contributor

@ttuegel ttuegel commented Dec 17, 2020

Fixes #2012.

  • Introduce type Kore.Internal.Key.Key, which represents concrete patterns used as keys in maps and sets.
  • Only allow Key to be constructed from TermLike which are constructor-like.
  • The assertion about non-constructor-like keys in maps and sets is removed because the change to a Key type makes that branch of code dead.

Review checklist

The author performs the actions on the checklist. The reviewer evaluates the work and checks the boxes as they are completed.

  • Summary. Write a summary of the changes. Explain what you did to fix the issue, and why you did it. Present the changes in a logical order. Instead of writing a summary in the pull request, you may push a clean Git history.
  • Documentation. Write documentation for new functions. Update documentation for functions that changed, or complete documentation where it is missing.
  • Tests. Write unit tests for every change. Write the unit tests that were missing before the changes. Include any examples from the reported issue as integration tests.
  • Clean up. The changes are already clean. Clean up anything near the changes that you noticed while working. This does not mean only spatially near the changes, but logically near: any code that interacts with the changes!

@ttuegel
Copy link
Contributor Author

ttuegel commented Dec 21, 2020

I still need to fix up the unit tests, but I was able to test this against the C semantics. I can execute beyond the error about uninterpreted functions (which can't be thrown anymore, anyway). However, I discovered that the C semantics also requires using Set in the keys of Map, so I will have to add support for that.

@ttuegel ttuegel marked this pull request as ready for review January 26, 2021 22:04
Copy link
Contributor

@ana-pantilie ana-pantilie left a comment

Choose a reason for hiding this comment

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

I left a few minor suggestions, and I have some questions about the integration tests.

@@ -7535,9 +7523,9 @@
/* Inj: */ inj{SortPair{}, SortData{}}(
/* Fl Fn D Sfc */
LblPair'UndsUndsUnds'MICHELSON-COMMON-SYNTAX'Unds'Pair'Unds'Data'Unds'Data{}(
/* Fl Fn D Sfc */
/* Fl Fn D Sfa Cli */
Copy link
Contributor

@ana-pantilie ana-pantilie Jan 27, 2021

Choose a reason for hiding this comment

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

Why did the simplified attribute change here? (Here and in other places in the output.)

Edit: I think the reason is that now these patterns are considered constructor-like, but I'll leave this comment here in case I'm wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's because built-in lists are now considered constructor-like.

/* Inj: */ inj{SortId{}, SortKItem{}}(
/* Fl Fn D Sfa Cl */
\dv{SortId{}}(/* Fl Fn D Sfa Cl */ "n")
\dv{SortId{}}("n")
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are the attribute comments missing? (Here and in other places in the expected output.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a Key, so the Unparse instance isn't going through TermLike (which is what creates the comments). The comments aren't necessary because all Key are functional constructor-like patterns.

@ana-pantilie ana-pantilie self-requested a review January 31, 2021 12:28
@@ -437,10 +439,9 @@ internal representations themselves; this "flattening" step also recurses to

-}
renormalize
:: HasCallStack
Copy link
Contributor

Choose a reason for hiding this comment

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

why did we get rid of HasCallStack?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function doesn't throw errors anymore.

@ttuegel ttuegel merged commit e87dac7 into master Feb 3, 2021
@ttuegel ttuegel deleted the bug--map-set-key branch February 3, 2021 12:20
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.

Map and Set keys with uninterpreted functions incorrectly considered "concrete"
3 participants