Skip to content

Commit

Permalink
Backport "Fix #19789: Merge same TypeParamRef in orDominator" to LTS (#…
Browse files Browse the repository at this point in the history
…21056)

Backports #20090 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
  • Loading branch information
WojciechMazur authored Jul 5, 2024
2 parents 57841fd + a3004fa commit 6beee6a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/core/TypeOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ object TypeOps:
mergeRefinedOrApplied(tp1, tp21) & mergeRefinedOrApplied(tp1, tp22)
case _ =>
fail
tp1 match {
if tp1 eq tp2 then tp1
else tp1 match {
case tp1 @ RefinedType(parent1, name1, rinfo1) =>
tp2 match {
case RefinedType(parent2, `name1`, rinfo2) =>
Expand All @@ -279,6 +280,7 @@ object TypeOps:
}
case AndType(tp11, tp12) =>
mergeRefinedOrApplied(tp11, tp2) & mergeRefinedOrApplied(tp12, tp2)
case tp1: TypeParamRef if tp1 == tp2 => tp1
case _ => fail
}
}
Expand Down
5 changes: 5 additions & 0 deletions tests/pos/i19789.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type Kinded[F[_]] = F[Any] | F[Nothing]

def values[F[_]]: Vector[Kinded[F]] = ???

def mapValues[F[_], T](f: Kinded[F] => T): Vector[T] = values[F].map { case x => f(x) }

0 comments on commit 6beee6a

Please sign in to comment.