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
Fix#9000: Avoid spurious cyclic errors for typelevel matches
I still don't know why the match type
```
type A2B[Xs <: Tuple] <: Tuple = Xs match
case Unit => Unit
case a *: as => B *: A2B[as]
```
compiled OK if it appeared in a user defined object, but failed with a cyclic
reference when written on the top level. But the logic for cyclic detection was
clearly very fragile, and unadapted to the case at hand. Essentially, it's a
type map that inserts LazyRefs when it detects legal cycles. The problem is that
these insertions cause recomputations of applied types in the TypeMap. And these
fail since the type constructor (A2B in this case) has not yet been completed.
So after a LazyRef was inserted, the cycle checker fails again in an unrecoverable
way because it tries to get the type parameters of an uncompleted type constructor.
So the question would be rather - why did this work if the match type appears in
a user-defined object? I could not answer that question, but I could fix the logic
to handle these cases.
0 commit comments