summaryrefslogtreecommitdiff
path: root/test/files/pos/t5294b.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/pos/t5294b.scala')
-rw-r--r--test/files/pos/t5294b.scala36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/files/pos/t5294b.scala b/test/files/pos/t5294b.scala
new file mode 100644
index 0000000000..038d2ff806
--- /dev/null
+++ b/test/files/pos/t5294b.scala
@@ -0,0 +1,36 @@
+class Test {
+ def test = {
+
+ val l1 = null: Int #: String #: Boolean #: String #: HNil.type
+
+ type _2 = Succ[Succ[Zero.type]]
+
+ val t1: Boolean = null.asInstanceOf[ l1.type#Drop[_2]#Head ]
+
+ val t2: Boolean = null.asInstanceOf[ l1.type#Apply[_2] ]
+ }
+}
+
+
+sealed trait Nat {
+ type Fold[U, F[_ <: U] <: U, Z <: U] <: U
+}
+
+final object Zero extends Nat {
+ type Fold[U, F[_ <: U] <: U, Z <: U] = Z
+}
+
+final class Succ[N <: Nat] extends Nat {
+ type Fold[U, F[_ <: U] <: U, Z <: U] = F[N#Fold[U, F, Z]]
+}
+
+trait HList {
+ type Head
+ type Tail <: HList
+ type Drop[N <: Nat] = N#Fold[HList, ({ type L[X <: HList] = X#Tail })#L, this.type]
+ type Apply[N <: Nat] = Drop[N]#Head
+}
+
+class #: [H, T <: HList] extends HList { type Head = H; type Tail = T }
+
+object HNil extends HList { type Head = Nothing; type Tail = Nothing }