You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current logic for unifying under binders as broken in two ways. First off, it's specific (rather unnecessarily) to for<'a> types, when it should be applicable to any zippable things. Secondly, it only tests one half of the necessary conditions! In fact, we've got a comment to this effect, somehow:
Right now, the second test fails for me -- I get lifetime constraints [], which is clearly wrong. We want to be generating constraints like the ones above, which are in fact not reconcilable. (Those constraints say "this is equal if 'b == 'c", which cannot be proven.)
Second, move this logic to zip_binders and remove unify_forall_tys (or make it just invoke zip on its arguments).:
panic!("cannot unify things with binders (other than types)")
}
This should then allow us to support zipping the binders and things inside dyn and impl types using the same routines.
Finally, third, if we like, we could optimize the case where you are zipping two forall with a single argument -- in that case, we could just instantiate with a placeholder on both sides and skip the existentials, I believe. But that's just an optimization.
The text was updated successfully, but these errors were encountered:
The current logic for unifying under binders as broken in two ways. First off, it's specific (rather unnecessarily) to
for<'a>
types, when it should be applicable to any zippable things. Secondly, it only tests one half of the necessary conditions! In fact, we've got a comment to this effect, somehow:chalk/chalk-solve/src/infer/unify.rs
Lines 201 to 209 in 3ea7a60
What I think we should do is two things.
First, we need to instantiate in both directions, as the comment suggests. We should be able to add a "sibling test" to this existing test
chalk/src/test/unify.rs
Lines 122 to 123 in 3ea7a60
that looks like this one:
Right now, the second test fails for me -- I get
lifetime constraints []
, which is clearly wrong. We want to be generating constraints like the ones above, which are in fact not reconcilable. (Those constraints say "this is equal if'b == 'c
", which cannot be proven.)Second, move this logic to
zip_binders
and removeunify_forall_tys
(or make it just invokezip
on its arguments).:chalk/chalk-solve/src/infer/unify.rs
Lines 384 to 389 in 3ea7a60
This should then allow us to support zipping the binders and things inside
dyn
andimpl
types using the same routines.Finally, third, if we like, we could optimize the case where you are zipping two
forall
with a single argument -- in that case, we could just instantiate with a placeholder on both sides and skip the existentials, I believe. But that's just an optimization.The text was updated successfully, but these errors were encountered: