aboutsummaryrefslogtreecommitdiff
path: root/tests/disabled
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2017-03-09 10:20:25 +0100
committerGitHub <noreply@github.com>2017-03-09 10:20:25 +0100
commit8e5c9c4a1a4555883307b7e81fea064134f350f2 (patch)
treee2feee0b87ed785e32ed8ba8fa2953128498f917 /tests/disabled
parent6abaa109e1add82f4add605a5cb3243e34b1ee33 (diff)
parentc7f1f35c36593ac9454c8572a59c649610829b6a (diff)
downloaddotty-8e5c9c4a1a4555883307b7e81fea064134f350f2.tar.gz
dotty-8e5c9c4a1a4555883307b7e81fea064134f350f2.tar.bz2
dotty-8e5c9c4a1a4555883307b7e81fea064134f350f2.zip
Merge pull request #2045 from dotty-staging/fix-hlist-hmap
Fix type inference for HLists and HMaps
Diffstat (limited to 'tests/disabled')
-rw-r--r--tests/disabled/pos/depmet_implicit_oopsla_session_simpler.scala45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/disabled/pos/depmet_implicit_oopsla_session_simpler.scala b/tests/disabled/pos/depmet_implicit_oopsla_session_simpler.scala
new file mode 100644
index 000000000..8cc6fe754
--- /dev/null
+++ b/tests/disabled/pos/depmet_implicit_oopsla_session_simpler.scala
@@ -0,0 +1,45 @@
+// Disabled because we now get an unsafe instantiation error
+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 // error: unsafe instantiation
+}