Skip to content

Commit 76524fb

Browse files
committed
Harmonize derived... operation between TypeArgRefs and TypeRefs
1 parent baa845b commit 76524fb

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
@@ -4006,7 +4006,16 @@ object Types {
40064006
else pre match {
40074007
case Range(preLo, preHi) =>
40084008
val forwarded =
4009-
if (tp.symbol.is(ClassTypeParam)) tp.argForParam(preHi)
4009+
if (tp.symbol.is(ClassTypeParam)) {
4010+
tp.argForParam(preHi) match {
4011+
case arg: TypeArgRef =>
4012+
arg.underlying match {
4013+
case TypeBounds(lo, hi) => range(atVariance(-variance)(reapply(lo)), reapply(hi))
4014+
case arg => reapply(arg)
4015+
}
4016+
case arg => reapply(arg)
4017+
}
4018+
}
40104019
else tryWiden(tp, preHi)
40114020
forwarded.orElse(
40124021
range(super.derivedSelect(tp, preLo), super.derivedSelect(tp, preHi)))

0 commit comments

Comments
 (0)