File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1120,7 +1120,12 @@ object Denotations {
11201120 then this
11211121 else if symbol.isAllOf(ClassTypeParam ) then
11221122 val arg = symbol.typeRef.argForParam(pre, widenAbstract = true )
1123- if arg.exists then derivedSingleDenotation(symbol, symbol.info.bounds & arg.bounds, pre)
1123+ if arg.exists then
1124+ val newBounds =
1125+ if symbol.isCompleted && ! symbol.info.containsLazyRefs
1126+ then symbol.info.bounds & arg.bounds
1127+ else arg.bounds
1128+ derivedSingleDenotation(symbol, newBounds, pre)
11241129 else derived(symbol.info)
11251130 else derived(symbol.info)
11261131 }
Original file line number Diff line number Diff line change @@ -442,6 +442,14 @@ object Types {
442442 final def containsWildcardTypes (using Context ) =
443443 existsPart(_.isInstanceOf [WildcardType ], StopAt .Static , forceLazy = false )
444444
445+ /** Does this type contain LazyRef types? */
446+ final def containsLazyRefs (using Context ) =
447+ val acc = new TypeAccumulator [Boolean ]:
448+ def apply (x : Boolean , tp : Type ): Boolean = tp match
449+ case _ : LazyRef => true
450+ case _ => x || foldOver(x, tp)
451+ acc(false , this )
452+
445453// ----- Higher-order combinators -----------------------------------
446454
447455 /** Returns true if there is a part of this type that satisfies predicate `p`.
You can’t perform that action at this time.
0 commit comments