aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/pickleOK/i94-nada.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-03-05 13:22:00 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2015-03-18 11:14:15 +0100
commit321563940dee1716c19600efd57acb9ed83a7687 (patch)
tree9053dfcff007d16ceb6dbaa7256889455a7a07a7 /tests/pos/pickleOK/i94-nada.scala
parent7fd242f2f1b1d2f536e73ec0fdb92a34b27b2a89 (diff)
downloaddotty-321563940dee1716c19600efd57acb9ed83a7687.tar.gz
dotty-321563940dee1716c19600efd57acb9ed83a7687.tar.bz2
dotty-321563940dee1716c19600efd57acb9ed83a7687.zip
Compute PureInterface flag after pickling.
ElimLocals becomes a slightly less trivial transform: NormalizeFlags. It also computes PureInterface flag, thus relieving Namer and Unpickler from doing the same in two different ways. Besides, the computation in Namer/TreeInfo was flawed because it did not take into account that nested non-static classes are not allowed in an interface (only static classes are, but these would not be members of the interface in the Scala sense).
Diffstat (limited to 'tests/pos/pickleOK/i94-nada.scala')
-rw-r--r--tests/pos/pickleOK/i94-nada.scala45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/pos/pickleOK/i94-nada.scala b/tests/pos/pickleOK/i94-nada.scala
new file mode 100644
index 000000000..ce8dc98ad
--- /dev/null
+++ b/tests/pos/pickleOK/i94-nada.scala
@@ -0,0 +1,45 @@
+package i94
+
+import scala.language.higherKinds
+
+trait Base {
+ type Rep[T]
+}
+
+trait BaseExp extends Base {
+ type Rep[T] = Exp[T]
+ case class Exp[T](v: T)
+}
+
+trait BaseStr extends Base {
+ type Rep[T] = String
+}
+
+trait BaseDirect extends Base {
+ type Rep[T] = T
+}
+
+trait Test1 {
+ trait Monad[X] {
+ def x: X
+ }
+ sealed abstract class Either[A,B]
+ case class Left[A,B](x: A) extends Either[A,B] with Monad[A]
+ case class Right[A,B](x: B) extends Either[A,B] with Monad[B]
+ def flatMap[X,Y,M[X]<:Monad[X]](m: M[X], f: X => M[Y]): M[Y] = f(m.x)
+ println(flatMap(Left(1), {x: Int => Left(x)}))
+}
+trait Test2 {
+ trait Monad[X] {
+ def x: X
+ }
+ sealed abstract class Either[A,B]
+ case class Left[A,B](x: A) extends Either[A,B] with Monad[A]
+ case class Right[A,B](x: B) extends Either[A,B] with Monad[B]
+ def flatMap[X,Y,M[X]](m: M[X], f: X => M[Y]): M[Y]
+ println(flatMap(Left(1), {x: Int => Left(x)}))
+}
+trait Test3 {
+ def flatMap[X,Y,M[X]](m: M[X], f: X => M[Y]): M[Y]
+ println(flatMap(Some(1), {x: Int => Some(x)}))
+}