Skip to content

Commit 5af5189

Browse files
committed
Harmonize derived... operation between TypeArgRefs and TypeRefs
1 parent c0642c4 commit 5af5189

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4019,7 +4019,16 @@ object Types {
40194019
else pre match {
40204020
case Range(preLo, preHi) =>
40214021
val forwarded =
4022-
if (tp.symbol.is(ClassTypeParam)) tp.argForParam(preHi)
4022+
if (tp.symbol.is(ClassTypeParam)) {
4023+
tp.argForParam(preHi) match {
4024+
case arg: TypeArgRef =>
4025+
arg.underlying match {
4026+
case TypeBounds(lo, hi) => range(atVariance(-variance)(reapply(lo)), reapply(hi))
4027+
case arg => reapply(arg)
4028+
}
4029+
case arg => reapply(arg)
4030+
}
4031+
}
40234032
else tryWiden(tp, preHi)
40244033
forwarded.orElse(
40254034
range(super.derivedSelect(tp, preLo), super.derivedSelect(tp, preHi)))

0 commit comments

Comments
 (0)