aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2016-10-25 19:03:25 +0200
committerGitHub <noreply@github.com>2016-10-25 19:03:25 +0200
commite41393d78b68364596ebb2bd2702418beac8fd6d (patch)
tree60e5284a3c888178f6a0d4220448c93463c04d37 /tests
parentf1284b48d48ec16840e3e018e060edc50d4d1bb7 (diff)
parentf368dd523fd68bb5edc992676ae35b69bbd90db8 (diff)
downloaddotty-e41393d78b68364596ebb2bd2702418beac8fd6d.tar.gz
dotty-e41393d78b68364596ebb2bd2702418beac8fd6d.tar.bz2
dotty-e41393d78b68364596ebb2bd2702418beac8fd6d.zip
Merge pull request #1600 from dotty-staging/fix-#1500
Fix-#1500 Include constraining type variables when interpolating
Diffstat (limited to 'tests')
-rw-r--r--tests/pos/i1500.scala19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/pos/i1500.scala b/tests/pos/i1500.scala
new file mode 100644
index 000000000..713d06689
--- /dev/null
+++ b/tests/pos/i1500.scala
@@ -0,0 +1,19 @@
+sealed trait HList
+sealed trait HNil extends HList
+sealed trait ::[+H, +T <: HList] extends HList
+
+case class Size[L <: HList](value: Int)
+
+object Size {
+ implicit val caseHNil: Size[HNil] = Size(0)
+ implicit def caseHCons[H, T <: HList](implicit e: Size[T]): Size[H :: T] = Size(e.value + 1)
+}
+
+object HListTest {
+ def main(args: Array[String]): Unit = {
+ assert(implicitly[Size[HNil]].value == 0)
+ assert(implicitly[Size[Int :: HNil]].value == 1)
+ assert(implicitly[Size[Int :: Int :: HNil]].value == 2)
+ assert(implicitly[Size[Int :: Int :: Int :: HNil]].value == 3)
+ }
+}