Skip to content

Commit 4f1227e

Browse files
committed
Harmonize derived... operation between TypeArgRefs and TypeRefs
1 parent e3c0aaf commit 4f1227e

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
@@ -4000,7 +4000,16 @@ object Types {
40004000
else pre match {
40014001
case Range(preLo, preHi) =>
40024002
val forwarded =
4003-
if (tp.symbol.is(ClassTypeParam)) tp.argForParam(preHi)
4003+
if (tp.symbol.is(ClassTypeParam)) {
4004+
tp.argForParam(preHi) match {
4005+
case arg: TypeArgRef =>
4006+
arg.underlying match {
4007+
case TypeBounds(lo, hi) => range(atVariance(-variance)(reapply(lo)), reapply(hi))
4008+
case arg => reapply(arg)
4009+
}
4010+
case arg => reapply(arg)
4011+
}
4012+
}
40044013
else tryWiden(tp, preHi)
40054014
forwarded.orElse(
40064015
range(super.derivedSelect(tp, preLo), super.derivedSelect(tp, preHi)))

0 commit comments

Comments
 (0)