File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -438,8 +438,8 @@ object TypeOps:
438438 tp.origin, fromBelow = variance > 0 || variance == 0 && tp.hasLowerBound)(using mapCtx)
439439 val lo1 = apply(lo)
440440 if (lo1 ne lo) lo1 else tp
441- case tp : LazyRef =>
442- TypeBounds .empty
441+ case tp : LazyRef if isExpandingBounds =>
442+ emptyRange
443443 case _ =>
444444 mapOver(tp)
445445 }
Original file line number Diff line number Diff line change @@ -5328,8 +5328,23 @@ object Types {
53285328 case _ => tp
53295329 }
53305330
5331+ private var expandingBounds : Boolean = false
5332+
5333+ /** Whether it is currently expanding bounds
5334+ *
5335+ * It is used to avoid following LazyRef in F-Bounds
5336+ */
5337+ def isExpandingBounds : Boolean = expandingBounds
5338+
53315339 protected def expandBounds (tp : TypeBounds ): Type =
5332- range(atVariance(- variance)(reapply(tp.lo)), reapply(tp.hi))
5340+ if expandingBounds then tp
5341+ else {
5342+ val saved = expandingBounds
5343+ expandingBounds = true
5344+ val res = range(atVariance(- variance)(reapply(tp.lo)), reapply(tp.hi))
5345+ expandingBounds = saved
5346+ res
5347+ }
53335348
53345349 /** Try to widen a named type to its info relative to given prefix `pre`, where possible.
53355350 * The possible cases are listed inline in the code.
You can’t perform that action at this time.
0 commit comments