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

Goals and folding goals #325

Merged
merged 10 commits into from
Feb 8, 2020

Conversation

nikomatsakis
Copy link
Contributor

Refactors how the Folder is setup:

  • Simpler trait setup: Instead of having a ton of small traits, we have one larger trait with default methods
  • Documented, at least somewhat, in the chalk book
  • Now permits "overriding" the handling of goals and clauses

The motivation for this work is to work towards the "syntactic equality" goal, where we desugar aliases into a combination of an inference variable and an alias goal ahead of time, rather than building "rich type equality" into the solver itself.

Copy link
Member

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

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

Overall I like this; cleans up this quite a bit. That as_dyn is a bit ugly, but not sure there's a way around that.

book/src/types/operations/fold.md Outdated Show resolved Hide resolved
chalk-integration/src/lowering.rs Outdated Show resolved Hide resolved
chalk-ir/src/fold.rs Show resolved Hide resolved

/// Folding a goal invokes the `fold_goal` callback (which will, by
/// default, invoke super-fold).
impl<TF: TypeFamily, TTF: TargetTypeFamily<TF>> Fold<TF, TTF> for Goal<TF> {
Copy link
Member

Choose a reason for hiding this comment

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

Why remove this from boring_impls?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not boring. It invokes a callback on folder rather than just recursively reproducing its structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe this naming scheme isn't obvious to everyone else though. :)

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, my thought for "boring" is either boilerplate-like code or code that is extremely simple.

chalk-ir/src/lib.rs Outdated Show resolved Hide resolved
chalk-ir/src/lib.rs Outdated Show resolved Hide resolved
chalk-ir/src/lib.rs Outdated Show resolved Hide resolved
chalk-derive/src/lib.rs Outdated Show resolved Hide resolved
@nikomatsakis
Copy link
Contributor Author

OK, @jackh726, I think I addressed all your comments.

@jackh726
Copy link
Member

jackh726 commented Feb 8, 2020

Yeah, LGTM

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.

2 participants