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

[analysis] Implement a Bool lattice #6036

Merged
merged 2 commits into from
Oct 25, 2023
Merged

[analysis] Implement a Bool lattice #6036

merged 2 commits into from
Oct 25, 2023

Conversation

tlively
Copy link
Member

@tlively tlively commented Oct 21, 2023

This is a lattice with two elements: false is bottom and true is top.

Add a new gtest file for testing lattices.

};

#if __cplusplus >= 202002L
static_assert(Lattice<Bool>);
Copy link
Member

Choose a reason for hiding this comment

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

What does this do? Check it can instantiate the concept perhaps? (I just made that up as my best guess, I have no idea how concepts work... 😄 )

Copy link
Member Author

Choose a reason for hiding this comment

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

Concepts are named collections of type constraints, so this checks that the Bool type satisfies the Lattice constraints.

Copy link
Member

Choose a reason for hiding this comment

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

I see, thanks. So this is the same as Lattice<Bool> _unused; basically, but without declaring a variable, and just asserting in debug builds?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately you cannot write Lattice<Bool> _unused because concepts are not types, they're just predicates on types. Since this is a static_assert, it is evaluated at compile time for all C++20 builds, not just debug builds.

@tlively
Copy link
Member Author

tlively commented Oct 25, 2023

Merge activity

  • Oct 25, 1:00 PM: @tlively started a stack merge that includes this pull request via Graphite.
  • Oct 25, 1:43 PM: Graphite rebased this pull request as part of a merge.
  • Oct 25, 2:19 PM: @tlively merged this pull request with Graphite.

Base automatically changed from join to main October 25, 2023 17:43
This is a lattice with two elements: `false` is bottom and `true` is top.

Add a new gtest file for testing lattices.
@tlively tlively merged commit 2b65663 into main Oct 25, 2023
14 checks passed
@tlively tlively deleted the bool-lattice branch October 25, 2023 18:19
radekdoulik pushed a commit to dotnet/binaryen that referenced this pull request Jul 12, 2024
This is a lattice with two elements: `false` is bottom and `true` is top.

Add a new gtest file for testing lattices.
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.

None yet

3 participants