Skip to content

Commit 2433648

Browse files
author
Aleksander Boruch-Gruszecki
committed
Remove unnecessary hack for HKT
Apparently it was fixed along the way.
1 parent 57a51d6 commit 2433648

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -829,11 +829,6 @@ object Contexts {
829829
res
830830
}
831831

832-
def isEmptyBounds(tp: Type) = tp match {
833-
case TypeBounds(lo, hi) => (lo eq defn.NothingType) && (hi eq defn.AnyType)
834-
case _ => false
835-
}
836-
837832
def unify(tv: TypeVar, tp: Type): Unit = {
838833
gadts.println(i"manually unifying $tv with $tp")
839834
constraint = constraint.updateEntry(tv.origin, tp)
@@ -843,9 +838,6 @@ object Contexts {
843838
val res = tvarBound match {
844839
case boundTvar: TypeVar =>
845840
doAddBound(boundTvar)
846-
// hack to normalize T and T[_]
847-
case AppliedType(boundTvar: TypeVar, args) if args forall isEmptyBounds =>
848-
doAddBound(boundTvar)
849841
case tp => doAddBound(tp)
850842
}
851843

tests/gadt/i5068.scala

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,21 @@ object i5068 {
44
final case class ReflK[F[_]]() extends IsK[F, F]
55

66
def foo[F[_], G[_]](r: F IsK G, a: Box[F]): Box[G] = r match { case ReflK() => a }
7+
}
8+
9+
object i5068b {
10+
type WeirdShape[A[_], B] = A[B]
11+
// type WeirderShape[S[_[_], _], I, M] = Any
12+
case class Box[ F[_[_[_], _], _, _[_]] ](value: F[WeirdShape, Int, Option])
13+
sealed trait IsK[F[_[_[_], _], _, _[_]], G[_[_[_], _], _, _[_]]]
14+
final case class ReflK[ F[_[_[_], _], _, _[_]] ]() extends IsK[F, F]
15+
16+
def foo[F[_[_[_], _], _, _[_]], G[_[_[_], _], _, _[_]]](
17+
r: F IsK G,
18+
a: Box[F]
19+
): Box[G] = r match { case ReflK() => a }
720

8-
def main(args: Array[String]): Unit = {
9-
println(foo(ReflK(), Box(Option(10))))
10-
}
21+
// def main(args: Array[String]): Unit = {
22+
// println(foo(ReflK(), Box[WeirderShape](???)))
23+
// }
1124
}

0 commit comments

Comments
 (0)