-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add facet type values and an instruction that produces them #4460
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…value" This reverts commit 39bf354.
zygoloid
approved these changes
Nov 4, 2024
jonmeow
reviewed
Nov 4, 2024
@@ -79,6 +79,7 @@ auto HandleParseNode(Context& context, Parse::RequirementEqualEqualId node_id) | |||
auto rhs = context.node_stack().PopExpr(); | |||
auto lhs = context.node_stack().PopExpr(); | |||
// TODO: type check lhs and rhs are comparable | |||
// TODO: require that at least one side uses a designator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a reminder, as I was seeing several of these, but it'd be helpful if you could adhere to sentence capitalization and punctuation in comments. I believe this includes TODOs.
https://google.github.io/styleguide/cppguide.html#Punctuation,_Spelling_and_Grammar
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 11, 2024
This does a few things: * Replaces the single `TypeId` in the `FacetTypeInfo` struct with a vector of `InterfaceId`, `SpecificId` pairs (sorted in id order) representing the set of interface requirements of the facet type. This will later be used to support facet types with multiple interface requirements (as in `I & J` or `I where .Self impls J`). * Replace `InterfaceType` instructions (used as the type of an `InterfaceDecl` instruction) with `FacetType` instructions (introduced in #4460) with a (newly introduced) `FacetTypeFromInterface()` function. * Replace code that consumed `InterfaceType` values with code that consumed `FaceType` values. I've generally left the assumption in the code that it is dealing with a single interface, using the (newly introduced) `FacetTypeInfo::TryAsSingleInterface`, and producing an error otherwise. There isn't yet support for the `&` operator or `where .Self impls`, so this is generally a good assumption for now, except you can get a facet type with no associated interfaces from a `type where`... expression. In some cases, the facet type value is pulled from the evaluation of an `InterfaceDecl` instruction, where the single interface assumption will hold permanently. * Some related cleans up: nicer stringification and formatting of facet types, suppression of some errors when there already was an error. There is still a lot left to do, including: * Type `type` should be a facet type with a reserved id, replacing the built-in instruction. * Code using `TryAsSingleInterface` should generally be upgraded to handle more than (or less than) one interface. Name lookup should be particularly exciting. * Operator `&` should be defined on facet types, unioning their interface and other requirements. * Requirements from a `where` clause don't do anything yet. * Impls and impl lookup need to resolve facet types, and do things like determine if all the associated constants are given values. --------- Co-authored-by: Josh L <[email protected]> Co-authored-by: Geoff Romer <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Still to do:
type
should be associated with a canonical facet type value&
on facet type values