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
Avoid inifinite loop when comparing & types with class types
The problem is that in two cases of subtype checking we form the base type
of the lhs, and, if that yields a new type continue with that one. But
this is not enough to ensure progress. Concrete test cases were in `run/mixins1`
and pos/intersections.scala. In `mixins1` we had an infinite cycle in the situation
A[LazyRef(This)] & B <: A[B]
where `This <: A[This]` and `B extended A[B]`. We got `A[LazyRef(This)] & A[B]` as a base type,
which simplified to `A[_ >: LayzRef(This) | B <: LazyRef(This) & B]`. Then, subsequent base
types cycled back and forth until the original type was reached.
The change in TypeComparer avoids the simplification (which is really a complication) and
keeps instead ``A[LazyRef(This)] & A[B]`. We then need the change in SymDenotations to
make sure that the base type of this type wrt `A` is referentially the same type, so that
we avoid the loop.
I wish there was a more robust measure for determining whether taking a base type represents
progress.
0 commit comments