aboutsummaryrefslogtreecommitdiff
path: root/tests/pending/pos/depmet_implicit_chaining_zw.scala
diff options
context:
space:
mode:
authorSamuel Gruetter <samuel.gruetter@epfl.ch>2014-12-16 16:38:09 +0100
committerSamuel Gruetter <samuel.gruetter@epfl.ch>2014-12-16 16:38:09 +0100
commit42851ed2675015d42bb341b82a09bd0bef4a8ce4 (patch)
tree06806b4183cf74a43553e9a8a9acfeff84fdf712 /tests/pending/pos/depmet_implicit_chaining_zw.scala
parent5be609fc4e04e3cca5e1435ee41b8cacac9b0513 (diff)
downloaddotty-42851ed2675015d42bb341b82a09bd0bef4a8ce4.tar.gz
dotty-42851ed2675015d42bb341b82a09bd0bef4a8ce4.tar.bz2
dotty-42851ed2675015d42bb341b82a09bd0bef4a8ce4.zip
move failing tests from tests/untried/pos to tests/pending/pos
Diffstat (limited to 'tests/pending/pos/depmet_implicit_chaining_zw.scala')
-rw-r--r--tests/pending/pos/depmet_implicit_chaining_zw.scala28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/pending/pos/depmet_implicit_chaining_zw.scala b/tests/pending/pos/depmet_implicit_chaining_zw.scala
new file mode 100644
index 000000000..a9da1e976
--- /dev/null
+++ b/tests/pending/pos/depmet_implicit_chaining_zw.scala
@@ -0,0 +1,28 @@
+trait Zero
+trait Succ[N]
+
+trait ZipWith[N, S] {
+ type T
+ val x: T = sys.error("")
+}
+
+object ZipWith {
+ implicit def ZeroZipWith[S]: ZipWith[Zero,S]{type T = Stream[S]} = new ZipWith[Zero, S] {
+ type T = Stream[S]
+ }
+
+ implicit def SuccZipWith[N, S, R](implicit zWith : ZipWith[N, R]): ZipWith[Succ[N],S => R]{type T = Stream[S] => zWith.T} = new ZipWith[Succ[N], S => R] {
+ type T = Stream[S] => zWith.T // dependent types replace the associated types functionality
+ }
+
+ // can't use implicitly[ZipWith[Succ[Succ[Zero]], Int => String => Boolean]],
+ // since that will chop of the {type T = ... } refinement in adapt (pt = ZipWith[Succ[Succ[Zero]], Int => String => Boolean])
+ // this works
+ // def zipWith(implicit zw: ZipWith[Succ[Succ[Zero]], Int => String => Boolean]): zw.T = zw.x
+ // thus, I present ?: implicitly on steroids!
+ def ?[T <: AnyRef](implicit w: T): w.type = w
+
+ type _2 = Succ[Succ[Zero]]
+ val zw = ?[ZipWith[_2, Int => String => Boolean]].x // : Stream[Int] => Stream[String] => Stream[Boolean]
+ // val zw = implicitly[ZipWith[Succ[Succ[Zero]], Int => String => Boolean]{type T = Stream[Int] => Stream[String] => Stream[Boolean]}].x
+}