diff --git a/core/src/test/scala/shapeless/hlistconstraints.scala b/core/src/test/scala/shapeless/hlistconstraints.scala index 06a04de54..38913ceb9 100644 --- a/core/src/test/scala/shapeless/hlistconstraints.scala +++ b/core/src/test/scala/shapeless/hlistconstraints.scala @@ -19,6 +19,8 @@ package shapeless import org.junit.Test import org.junit.Assert._ +import shapeless.test.illTyped + class HListConstraintsTests { @Test def testUnaryTCConstraint { @@ -31,7 +33,10 @@ class HListConstraintsTests { val l2 = Option(23) :: true :: Option("foo") :: HNil acceptOption(l1) // Compiles - //acceptOption(l2) // Does not compile + + illTyped(""" + acceptOption(l2) + """) val l3 = 23 :: true :: "foo" :: HNil @@ -45,7 +50,9 @@ class HListConstraintsTests { def acceptConst[L <: HList : *->*[Const[String]#λ]#λ](l : L) = true acceptConst(l4) // Compiles - //acceptConst(l5) // Does not compile + illTyped(""" + acceptConst(l5) + """) } @Test @@ -60,7 +67,9 @@ class HListConstraintsTests { val l2 = 23 :: true :: 13 :: 7 :: 5 :: 2.0 :: "foo" :: "bar" :: HNil acceptBasis(l1) // Compiles - //acceptBasis(l2) // Does not compile + illTyped(""" + acceptBasis(l2) + """) } @Test @@ -77,7 +86,9 @@ class HListConstraintsTests { val l2 = Apple :: 23 :: "foo" :: Pear :: HNil acceptLUB(l1) // Compiles - //acceptLUB(l2) // Does not compile + illTyped(""" + acceptLUB(l2) + """) } @Test @@ -107,11 +118,15 @@ class HListConstraintsTests { def acceptKeys[R <: HList : Keys[author.type :: title.type :: id.type :: HNil]#λ](r : R) = true acceptKeys(summary) // Compiles - //acceptKeys(book) // Does not compile + illTyped(""" + acceptKeys(book) + """) def acceptValues[R <: HList : Values[Int :: String :: HNil]#λ](r : R) = true acceptValues(summary) // Compiles - //acceptValues(book) // Does not compile + illTyped(""" + acceptValues(book) + """) } } diff --git a/core/src/test/scala/shapeless/sized.scala b/core/src/test/scala/shapeless/sized.scala index 491e56373..ace7327b0 100644 --- a/core/src/test/scala/shapeless/sized.scala +++ b/core/src/test/scala/shapeless/sized.scala @@ -19,6 +19,8 @@ package shapeless import org.junit.Test import org.junit.Assert._ +import shapeless.test.illTyped + class SizedTests { import nat._ import Sized._ @@ -41,8 +43,12 @@ class SizedTests { val nl0d = l0.sized(3) assertTrue(nl0d.isEmpty) - //val h0 = nl0.get.head // Does not compile - //val t0 = nl0.get.tail // Does not compile + illTyped(""" + val h0 = nl0.get.head + """) + illTyped(""" + val t0 = nl0.get.tail + """) val nl1 = l1.sized(0) assertTrue(nl1.isEmpty) @@ -55,7 +61,10 @@ class SizedTests { val h1 = nl1b.get.head val t1 = nl1b.get.tail - //val t1b = nl1b.get.tail.tail // Does not compile + + illTyped(""" + val t1b = nl1b.get.tail.tail + """) val nl2 = l2.sized(0) assertTrue(nl2.isEmpty) @@ -69,7 +78,10 @@ class SizedTests { val h2 = nl2c.get.head val t2 = nl2c.get.tail val t2b = nl2c.get.tail.tail - //val t2c = nl1c.get.tail.tail.tail // Does not compile + + illTyped(""" + val t2c = nl1c.get.tail.tail.tail + """) val nl3 = l3.sized(0) assertTrue(nl3.isEmpty) @@ -84,7 +96,10 @@ class SizedTests { val t3 = nl3d.get.tail val t3b = nl3d.get.tail.tail val t3c = nl3d.get.tail.tail.tail - //val t3d = nl1d.get.tail.tail.tail.tail // Does not compile + + illTyped(""" + val t3d = nl1d.get.tail.tail.tail.tail + """) val rs = "foo".sized(3).get.unsized @@ -138,15 +153,24 @@ class SizedTests { val tk1 = cl.get.take(1) val tk4 = cl.get.take(4) - //val tk7 = cl.get.take(7) // Does not compile + + illTyped(""" + val tk7 = cl.get.take(7) + """) val dr1 = cl.get.drop(1) val dr4 = cl.get.drop(4) - //val dr7 = cl.get.drop(7) // Does not compile + + illTyped(""" + val dr7 = cl.get.drop(7) + """) val (pr1, sf1) = cl.get.splitAt(1) val (pr4, sf4) = cl.get.splitAt(4) - //val (pr7, sf7) = cl.get.splitAt(7) // Does not compile + + illTyped(""" + val (pr7, sf7) = cl.get.splitAt(7) + """) val ml = cl.get map (_.toString) typed[Sized[List[String], _6]](ml)