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

Ensure units are all created with matching tags #5534

Merged
merged 1 commit into from
Jan 13, 2025
Merged

Conversation

ChrisPenner
Copy link
Contributor

@ChrisPenner ChrisPenner commented Jan 13, 2025

Overview

Values which should have been equal would be reported as non-equal WHEN:

  • The matching values contained a unit value ()
  • One unit value was created with a literal () and the other came from a builtin
  • The units were in an Any when they were being compared
  • They were compared using Universal.eq

The reason is that unit values were created with PackedTag 0 in some locations and unitTag in others;
the difference was only surfaced when wrapped in Any because universal equality within Any checks type tags.

Implementation notes

  • Use the unitTag for all units regardless where they come from.
  • Do the same for tuples (a.k.a. pairs)
  • Clarify the use of PackedTag 0 for the pure effects case.

Test coverage

Ran all the base tests.

<*> readTVarIO (sandbox cc)
Nothing ->
die $ "standalone: unknown combinator: " ++ show init
standalone cc init =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just ormolu doing its thang

@ChrisPenner ChrisPenner marked this pull request as ready for review January 13, 2025 19:22
@ChrisPenner ChrisPenner requested a review from dolio January 13, 2025 19:22
Copy link
Contributor

@dolio dolio left a comment

Choose a reason for hiding this comment

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

Looks good.

@ceedubs
Copy link
Contributor

ceedubs commented Jan 13, 2025

I can confirm that this fixes #5532 (which Chris probably already checked, but it isn't linked here).

@aryairani aryairani merged commit 6b6fadb into trunk Jan 13, 2025
32 checks passed
@aryairani aryairani deleted the cp/fix-unit-tags branch January 13, 2025 20:52
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.

4 participants