aboutsummaryrefslogtreecommitdiff
path: root/tests/pending
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-02-27 11:46:19 +0100
committerMartin Odersky <odersky@gmail.com>2017-02-28 19:34:42 +0100
commit42fd456acf5535a0ec980d207db8cc9e6abc6110 (patch)
tree4ac8900649bc2d1e7c6b1b0b804aeda12d3ed796 /tests/pending
parent860fd56990d0e6e24a404c5054e5821b18f7870f (diff)
downloaddotty-42fd456acf5535a0ec980d207db8cc9e6abc6110.tar.gz
dotty-42fd456acf5535a0ec980d207db8cc9e6abc6110.tar.bz2
dotty-42fd456acf5535a0ec980d207db8cc9e6abc6110.zip
Re-instantiate depmeth tests
These now compile with the changes to dependent methods, except for one which is invalid under dotty.
Diffstat (limited to 'tests/pending')
-rw-r--r--tests/pending/pos/depmet_implicit_norm_ret.scala34
-rw-r--r--tests/pending/pos/depmet_implicit_oopsla_session.scala63
-rw-r--r--tests/pending/pos/depmet_implicit_oopsla_session_2.scala87
-rw-r--r--tests/pending/pos/depmet_implicit_oopsla_session_simpler.scala44
4 files changed, 0 insertions, 228 deletions
diff --git a/tests/pending/pos/depmet_implicit_norm_ret.scala b/tests/pending/pos/depmet_implicit_norm_ret.scala
deleted file mode 100644
index 42bfb9fe1..000000000
--- a/tests/pending/pos/depmet_implicit_norm_ret.scala
+++ /dev/null
@@ -1,34 +0,0 @@
-object Test{
- def ?[S <: AnyRef](implicit w : S) : w.type = w
-
- // fallback, lower priority (overloading rules apply: pick alternative in subclass lowest in subtyping lattice)
- class ZipWithDefault {
- implicit def ZeroZipWith[S]: Test.ZipWith[S]{type T = Stream[S]} = new ZipWith[S] {
- type T = Stream[S]
- }
- }
-
- object ZipWith extends ZipWithDefault {
- // def apply[S: ZipWith](s : S) = ?[ZipWith[S]].zipWith(s) // TODO: bug return type should be inferred
- def apply[S](s : S)(implicit zw: ZipWith[S]): zw.T = zw.zipWith(s)
-
- implicit def SuccZipWith[S,R](implicit zWith : ZipWith[R]): Test.ZipWith[S => R]{type T = Stream[S] => zWith.T} = new ZipWith[S => R] {
- type T = Stream[S] => zWith.T // dependent types replace the associated types functionality
- }
- }
-
- import ZipWith._
-
- trait ZipWith[S] {
- type T
- def zipWith : S => T = sys.error("")
- }
-
- // bug: inferred return type = (Stream[A]) => java.lang.Object with Test.ZipWith[B]{type T = Stream[B]}#T
- // this seems incompatible with vvvvvvvvvvvvvvvvvvvvvv -- #3731
- def map1[A,B](f : A => B) = ZipWith(f)(SuccZipWith) // this typechecks but fails in -Ycheck:first
- val tst1: Stream[Int] = map1[String, Int]{x: String => x.length}.apply(Stream("a"))
-
- def map2[A,B](f : A => B) = ZipWith(f) // this finds ZeroZipWith where scalac finds SuccZipWith and fails typechecking in the next line.
- val tst2: Stream[Int] = map2{x: String => x.length}.apply(Stream("a"))
-}
diff --git a/tests/pending/pos/depmet_implicit_oopsla_session.scala b/tests/pending/pos/depmet_implicit_oopsla_session.scala
deleted file mode 100644
index a9c8e56ce..000000000
--- a/tests/pending/pos/depmet_implicit_oopsla_session.scala
+++ /dev/null
@@ -1,63 +0,0 @@
-object Sessions {
- trait Session[This] {
- type Dual
- type HasDual[D] = Session[This]{type Dual=D}
- def run(p: This, dp: Dual): Unit
- }
-
- implicit object StopSession extends Session[Stop] {
- type Dual = Stop
-
- def run(p: Stop, dp: Stop): Unit = {}
- }
-
- implicit def InDual[A, B](implicit sessionDIn: Session[B]): Sessions.Session[Sessions.In[A,B]]{type Dual = Sessions.Out[A,sessionDIn.Dual]} =
- new Session[In[A, B]] {
- type Dual = Out[A, sessionDIn.Dual]
-
- def run(p: In[A, B], dp: Dual): Unit =
- sessionDIn.run(p.func(dp.x), dp.y)
- }
-
- implicit def OutDual[A, B](implicit sessionDOut: Session[B]): Sessions.Session[Sessions.Out[A,B]]{type Dual = Sessions.In[A,sessionDOut.Dual]} =
- new Session[Out[A, B]] {
- type Dual = In[A, sessionDOut.Dual]
-
- def run(p: Out[A, B], dp: Dual): Unit =
- sessionDOut.run(p.y, dp.func(p.x))
- }
-
- sealed case class Stop()
- sealed case class In[-A, +B](func: A => B)
- sealed case class Out[+A, +B](x: A, y: B)
-
- def addServer =
- In{x: Int =>
- In{y: Int => System.out.println("Thinking")
- Out(x + y,
- Stop())}}
-
- def addClient =
- Out(3,
- Out(4, { System.out.println("Waiting")
- In{z: Int => System.out.println(z)
- Stop()}}))
-
- def runSession[S, D: Session[S]#HasDual](p: S, dp: D) =
- implicitly[Session[S]#HasDual[D]].run(p, dp)
-
- // def runSession[S, D](p: S, dp: D)(implicit s: Session[S]#HasDual[D]) =
- // s.run(p, dp)
- //
- // def runSession[S, D](p: S, dp: D)(implicit s: Session[S]{type Dual=D}) =
- // s.run(p, dp)
-
- // TODO: can we relax the ordering restrictions on dependencies so that we can use
- // def runSession[S](p: S, dp: s.Dual)(implicit s: Session[S]) =
- // s.run(p, dp)
- // to emphasise similarity of type parameters and implicit arguments:
- // def runSession[S][val s: Session[S]](p: S, dp: s.Dual) =
- // s.run(p, dp)
-
- def myRun = runSession(addServer, addClient)
-}
diff --git a/tests/pending/pos/depmet_implicit_oopsla_session_2.scala b/tests/pending/pos/depmet_implicit_oopsla_session_2.scala
deleted file mode 100644
index 29a76d5cf..000000000
--- a/tests/pending/pos/depmet_implicit_oopsla_session_2.scala
+++ /dev/null
@@ -1,87 +0,0 @@
-object Sessions {
- def ?[T <: AnyRef](implicit w: T): w.type = w
-
- // session states
- sealed case class Stop()
- sealed case class In[-Data, +Cont](recv: Data => Cont)
- sealed case class Out[+Data, +Cont](data: Data, cont: Cont)
-
- // the type theory of communicating sessions:
-
- // an instance of type Session[S]{type Dual=D} is evidence that S and D are duals
- // such a value witnesses this fact by describing how to compose an instance of S with an instance of D (through the run method)
- trait Session[S] { type Self = S
- type Dual
- type HasDual[D] = Session[Self]{type Dual=D}
- def run(self: Self, dual: Dual): Unit
- }
-
- // friendly interface to the theory
- def runSession[S, D: Session[S]#HasDual](session: S, dual: D) =
- ?[Session[S]#HasDual[D]].run(session, dual)
-
- // facts in the theory:
-
- // ------------------------[StopDual]
- // Stop is the dual of Stop
- implicit object StopDual extends Session[Stop] {
- type Dual = Stop
-
- def run(self: Self, dual: Dual): Unit = {}
- }
-
- // CD is the dual of Cont
- // -------------------------------------------[InDual]
- // Out[Data, CD] is the dual of In[Data, Cont]
- implicit def InDual[Data, Cont](implicit cont: Session[Cont]): Sessions.Session[Sessions.In[Data,Cont]]{type Dual = Sessions.Out[Data,cont.Dual]} = new Session[In[Data, Cont]] {
- type Dual = Out[Data, cont.Dual]
-
- def run(self: Self, dual: Dual): Unit =
- cont.run(self.recv(dual.data), dual.cont)
- }
-
- // CD is the dual of Cont
- // -------------------------------------------[OutDual]
- // In[Data, CD] is the dual of Out[Data, Cont]
- implicit def OutDual[Data, Cont](implicit cont: Session[Cont]): Sessions.Session[Sessions.Out[Data,Cont]]{type Dual = Sessions.In[Data,cont.Dual]} = new Session[Out[Data, Cont]] {
- type Dual = In[Data, cont.Dual]
-
- def run(self: Self, dual: Dual): Unit =
- cont.run(self.cont, dual.recv(self.data))
- }
-
- // a concrete session
- def addServer =
- In{x: Int =>
- In{y: Int => System.out.println("Thinking")
- Out(x + y,
- Stop())}}
-
- def addClient =
- Out(3,
- Out(4, { System.out.println("Waiting")
- In{z: Int => System.out.println(z)
- Stop()}}))
-
- def myRun = runSession(addServer, addClient)
-}
-
-/* future improvements:
-
-
- // def runSession[S, D](p: S, dp: D)(implicit s: Session[S]#HasDual[D]) =
- // s.run(p, dp)
- //
- // def runSession[S, D](p: S, dp: D)(implicit s: Session[S]{type Dual=D}) =
- // s.run(p, dp)
-
- // TODO: can we relax the ordering restrictions on dependencies so that we can write
- // one possibility: graph of dependencies between arguments must be acyclic
- // def runSession[S](p: S, dp: s.Dual)(implicit s: Session[S]) =
- // s.run(p, dp)
- // to emphasise similarity of type parameters and implicit arguments:
- // def runSession[S][val s: Session[S]](p: S, dp: s.Dual) =
- // s.run(p, dp)
-
-
-*/
diff --git a/tests/pending/pos/depmet_implicit_oopsla_session_simpler.scala b/tests/pending/pos/depmet_implicit_oopsla_session_simpler.scala
deleted file mode 100644
index fad5eba40..000000000
--- a/tests/pending/pos/depmet_implicit_oopsla_session_simpler.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-object Sessions {
- trait Session {
- type Dual <: Session
-
- def run(dp: Dual): Unit
- }
-
- sealed case class Stop() extends Session {
- type Dual = Stop
-
- def run(dp: Dual): Unit = {}
- }
-
- // can't write B <: Session{type Dual = BDual} due to limitations in type inference algorithm
- // (type variables cannot occur on both sides of <:)
- // using B#Dual instead of BDual is too imprecise, since it is disconnected from the actual argument that is passed for B
- // would be nice if we could introduce a universal quantification over BDual that is not part of the
- // type parameter list
- sealed case class In[A, B <: Session, BDual <: Session](recv: A => B)(implicit dual: B <:< Session{type Dual=BDual}) extends Session {
- type Dual = Out[A, BDual]
-
- def run(dp: Dual): Unit = recv(dp.data) run dp.cont
- }
-
- sealed case class Out[A, B <: Session](data: A, cont: B) extends Session {
- type Dual = In[A, cont.Dual, cont.Dual#Dual]
-
- def run(dp: Dual): Unit = cont run dp.recv(data)
- }
-
- def addServer =
- In{x: Int =>
- In{y: Int => System.out.println("Thinking")
- Out(x + y,
- Stop())}}
-
- def addClient =
- Out(3,
- Out(4, { System.out.println("Waiting")
- In{z: Int => System.out.println(z)
- Stop()}}))
-
- def myRun = addServer run addClient
-}