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
**Note**: this is a trial as `Constraints` should be immutable.
In tests/pos/11234.scala, we have the following F-bounded constraints:
bounds =
A0 <: Foo[LazyRef(A0)]
A <: Foo[LazyRef(A)]
ordering =
A <: A0
As `Foo[T]` is non-variant, at some point we will add `A0 <: A`, it
will trigger unification of `A0` and `A`. The unification will call
`Foo[A0].&(Foo[A])`, which in turn calls `TypeComparer.glb(Foo[A0],
Foo[A])`. The call `glb(Foo[A0], Foo[A])` in a fresh TypeComparer
will in turn add `A0 <: A` thus trigger the unification again.
We break the loop by remembering the unification pair and use the
knowledge in subtyping.
liufengyun
added a commit
to dotty-staging/dotty
that referenced
this issue
Jan 28, 2021
**Note**: this is a trial as `Constraints` should be immutable.
In tests/pos/11234.scala, we have the following F-bounded constraints:
bounds =
A0 <: Foo[LazyRef(A0)]
A <: Foo[LazyRef(A)]
ordering =
A <: A0
As `Foo[T]` is non-variant, at some point we will add `A0 <: A`, it
will trigger unification of `A0` and `A`. The unification will call
`Foo[A0].&(Foo[A])`, which in turn calls `TypeComparer.glb(Foo[A0],
Foo[A])`. The call `glb(Foo[A0], Foo[A])` in a fresh TypeComparer
will in turn add `A0 <: A` thus trigger the unification again.
We break the loop by remembering the unification pair and use the
knowledge in subtyping.
In tests/pos/11234.scala, we have the following F-bounded constraints:
bounds =
A0 <: Foo[LazyRef(A0)]
A <: Foo[LazyRef(A)]
ordering =
A <: A0
As `Foo[T]` is non-variant, at some point we will add `A0 <: A`, it
will trigger unification of `A0` and `A`. The unification will call
`Foo[A0].&(Foo[A])`, which in turn calls `TypeComparer.glb(Foo[A0],
Foo[A])`. The call `glb(Foo[A0], Foo[A])` in a fresh TypeComparer
will in turn add `A0 <: A` thus trigger the unification again.
We need to perform substitution before merge the bounds.
Compiler version
M3
Minimized code
Output
Compiler reports an error with a huge type. It's impossible to see what's wrong.
The following code compiles without any problem:
Expectation
Compiles without error.
This is another issue reported in #11078. As the fix is different, thus it better to handle it in a different issue.
The text was updated successfully, but these errors were encountered: