From d6f9361e4bf9ee8615d1a700963535f82580ca0d Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 7 Nov 2011 07:49:17 +0000 Subject: Fixed hang in typechecker. Another page in the storied history of "check the normalized type, then act on the unnormalized type", in this case leading to a tight loop of foreverness. Closes SI-5156, review by moors. --- test/files/pos/t5156.scala | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/files/pos/t5156.scala (limited to 'test/files/pos/t5156.scala') diff --git a/test/files/pos/t5156.scala b/test/files/pos/t5156.scala new file mode 100644 index 0000000000..e7912ef35c --- /dev/null +++ b/test/files/pos/t5156.scala @@ -0,0 +1,21 @@ +sealed trait HList +final case class HCons[H, T <: HList](head : H, tail : T) extends HList +case object HNil extends HList + +object HList { + type ::[H, T <: HList] = HCons[H, T] + type HNil = HNil.type + + implicit def hlistOps[L <: HList](l : L) = new { + def ::[H](h : H) : H :: L = HCons(h, l) + def last(implicit last : Last[L]) {} + } + + class Last[L <: HList] + implicit def hsingleLast[H] = new Last[H :: HNil] + implicit def hlistLast[H, T <: HList](implicit lt : Last[T]) = new Last[H :: T] + + type III = Int :: Int :: Int :: HNil + val iii : III = 0 :: 0 :: 0 :: HNil + val l = iii.last +} -- cgit v1.2.3