File tree 2 files changed +14
-1
lines changed
compiler/src/dotty/tools/dotc/core
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1120,7 +1120,12 @@ object Denotations {
1120
1120
then this
1121
1121
else if symbol.isAllOf(ClassTypeParam ) then
1122
1122
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)
1124
1129
else derived(symbol.info)
1125
1130
else derived(symbol.info)
1126
1131
}
Original file line number Diff line number Diff line change @@ -442,6 +442,14 @@ object Types {
442
442
final def containsWildcardTypes (using Context ) =
443
443
existsPart(_.isInstanceOf [WildcardType ], StopAt .Static , forceLazy = false )
444
444
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
+
445
453
// ----- Higher-order combinators -----------------------------------
446
454
447
455
/** 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