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
Try to instantiate type variables in tryInsertImplicitOnQualifier
Fixes#13842
What happened in #13842 was that we were not hitting this case in
`tryWiden`, which is a method in ApproximatingTypeMap that tries
to dealias or widen before propagating a Range outwards:
```scala
case info: SingletonType =>
// if H#x: y.type, then for any x in L..H, x.type =:= y.type,
// hence we can replace with y.type under all variances
reapply(info)
```
The actual info here was a TypeVar with a singleton type as lower bound. Instantiating
the TypeVar produces a SingletonType and case applies.
We cannot really instantiate TypeVars here since this is very low-level code. For instance
we might be in a state where the instantiation is provisional and the TyperState is thrown
away. But AsSeenFrom results are cached so we'd have the wrong type in the caches.
What we do instead is add an additional case in `tryInsertImplicitOnQualifier` which is the
last resort when an application fails. Here, if we can instantiate some type variables in the
qualifier, we try again.
0 commit comments