Skip to content

Commit 991a3cc

Browse files
committed
Merge TypeParamRefs in orDominator
1 parent fd2a03e commit 991a3cc

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,13 @@ object TypeOps:
271271
tp1.derivedSelect(pre1 | pre2)
272272
case _ => fallback
273273
}
274+
case tp1: TypeParamRef =>
275+
tp2 match {
276+
case tp2: TypeParamRef
277+
if (tp1.binder eq tp2.binder) && (tp1.paramNum == tp2.paramNum) =>
278+
tp1
279+
case _ => fallback
280+
}
274281
case AndType(tp11, tp12) =>
275282
mergeRefinedOrApplied(tp11, tp2) & mergeRefinedOrApplied(tp12, tp2)
276283
case _ => fail

tests/pos/i19789.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
type Kinded[F[_]] = F[Any] | F[Nothing]
2+
3+
def values[F[_]]: Vector[Kinded[F]] = ???
4+
5+
def mapValues[F[_], T](f: Kinded[F] => T): Vector[T] = values[F].map { case x => f(x) }

0 commit comments

Comments
 (0)