-
Notifications
You must be signed in to change notification settings - Fork 182
refactored binders to have a private value field #384
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,9 +85,20 @@ impl<I: Interner> CoherenceSolver<'_, I> { | |
|
|
||
| let interner = self.db.interner(); | ||
|
|
||
| let (lhs_binders, lhs_bound) = lhs.binders.as_ref().into(); | ||
| let (rhs_binders, rhs_bound) = rhs.binders.as_ref().into(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is slightly misleading, because
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. binders are cloned later anyway, but I agree, as_ref is kind of a bad name (I just copied it from rustc), should I change it?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, you mean the names, hmm, ok
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||
|
|
||
| // Upshift the rhs variables in params to account for the joined binders | ||
| let lhs_params = params(interner, lhs).iter().cloned(); | ||
| let rhs_params = params(interner, rhs) | ||
| let lhs_params = lhs_bound | ||
| .trait_ref | ||
| .substitution | ||
| .parameters(interner) | ||
| .iter() | ||
| .cloned(); | ||
| let rhs_params = rhs_bound | ||
| .trait_ref | ||
| .substitution | ||
| .parameters(interner) | ||
| .iter() | ||
| .map(|param| param.shifted_in(interner)); | ||
|
|
||
|
|
@@ -98,10 +109,8 @@ impl<I: Interner> CoherenceSolver<'_, I> { | |
| .map(|(a, b)| GoalData::EqGoal(EqGoal { a, b }).intern(interner)); | ||
|
|
||
| // Upshift the rhs variables in where clauses | ||
| let lhs_where_clauses = lhs.binders.value.where_clauses.iter().cloned(); | ||
| let rhs_where_clauses = rhs | ||
| .binders | ||
| .value | ||
| let lhs_where_clauses = lhs_bound.where_clauses.iter().cloned(); | ||
| let rhs_where_clauses = rhs_bound | ||
| .where_clauses | ||
| .iter() | ||
| .map(|wc| wc.shifted_in(interner)); | ||
|
|
@@ -114,16 +123,8 @@ impl<I: Interner> CoherenceSolver<'_, I> { | |
| // Join all the goals we've created together with And, then quantify them | ||
| // over the joined binders. This is our query. | ||
| let goal = Box::new(Goal::all(interner, params_goals.chain(wc_goals))) | ||
| .quantify( | ||
| interner, | ||
| QuantifierKind::Exists, | ||
| lhs.binders.binders.clone(), | ||
| ) | ||
| .quantify( | ||
| interner, | ||
| QuantifierKind::Exists, | ||
| rhs.binders.binders.clone(), | ||
| ) | ||
| .quantify(interner, QuantifierKind::Exists, lhs_binders) | ||
| .quantify(interner, QuantifierKind::Exists, rhs_binders) | ||
| .compatible(interner) | ||
| .negate(interner); | ||
|
|
||
|
|
@@ -267,12 +268,3 @@ impl<I: Interner> CoherenceSolver<'_, I> { | |
| result | ||
| } | ||
| } | ||
|
|
||
| fn params<'a, I: Interner>(interner: &I, impl_datum: &'a ImplDatum<I>) -> &'a [Parameter<I>] { | ||
| impl_datum | ||
| .binders | ||
| .value | ||
| .trait_ref | ||
| .substitution | ||
| .parameters(interner) | ||
| } | ||
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.
This does technically add a clone to binders. But I don't think it matters.