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

Initial support for constraints formed by combining interfaces #1307

Merged
merged 14 commits into from
Jun 7, 2022
Merged

Initial support for constraints formed by combining interfaces #1307

merged 14 commits into from
Jun 7, 2022

Conversation

zygoloid
Copy link
Contributor

@zygoloid zygoloid commented Jun 2, 2022

Add scaffolding for constraints in general, and support specifically constraints formed by applying a & operator.

No support for constraints formed with where nor for named constraints at this point.

@zygoloid zygoloid requested a review from josh11b June 2, 2022 00:27
@zygoloid zygoloid requested a review from a team as a code owner June 2, 2022 00:27
@zygoloid zygoloid added the explorer Action items related to Carbon explorer code label Jun 4, 2022
};

// A collection of values that are known to be the same.
struct EqualityConstraint {
Copy link
Contributor

Choose a reason for hiding this comment

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

Using a vector to keep track of equalities is likely to be inefficient. A better data structure for this purpose is union-find.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I have a TODO to add something more efficient, but any such approach depends on us having some way of looking up Values that's more efficient than a linear scan (such as hashing or canonicalization or similar). Do you want this addressed before this patch lands, or can we work on that as a separate step?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Given the approval, I'm assuming it's fine to address this later :)

Copy link
Contributor

Choose a reason for hiding this comment

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

yes

Copy link
Contributor

@jsiek jsiek left a comment

Choose a reason for hiding this comment

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

This PR looks good! Thanks Richard. I'll mark this as approved and leave it up to you to handle the minor comments/suggestions.

@zygoloid zygoloid merged commit 62a3fa6 into carbon-language:trunk Jun 7, 2022
chandlerc pushed a commit that referenced this pull request Jun 28, 2022
Add scaffolding for constraints in general, and support specifically constraints formed by applying a `&` operator.

No support for constraints formed with `where` nor for named constraints at this point.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
explorer Action items related to Carbon explorer code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants