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:
438
438
tp.origin, fromBelow = variance > 0 || variance == 0 && tp.hasLowerBound)(using mapCtx)
439
439
val lo1 = apply(lo)
440
440
if (lo1 ne lo) lo1 else tp
441
- case tp : LazyRef =>
442
- TypeBounds .empty
441
+ case tp : LazyRef if isExpandingBounds =>
442
+ emptyRange
443
443
case _ =>
444
444
mapOver(tp)
445
445
}
Original file line number Diff line number Diff line change @@ -5328,8 +5328,23 @@ object Types {
5328
5328
case _ => tp
5329
5329
}
5330
5330
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
+
5331
5339
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
+ }
5333
5348
5334
5349
/** Try to widen a named type to its info relative to given prefix `pre`, where possible.
5335
5350
* The possible cases are listed inline in the code.
You can’t perform that action at this time.
0 commit comments