diff options
author | Lukas Rytz <lukas.rytz@typesafe.com> | 2014-07-09 16:33:54 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@typesafe.com> | 2014-07-09 16:33:54 +0200 |
commit | aea6519685561ee076e7fdaac48c2bf970389b83 (patch) | |
tree | d8e37b54a6cc5196a555a05df7ce2ddc0200dfe4 /test/files | |
parent | 4d3ede90b599a344b6d88316a7f62472ef8520e2 (diff) | |
parent | 14fa7bef120cbb996d042daba6095530167c49ed (diff) | |
download | scala-aea6519685561ee076e7fdaac48c2bf970389b83.tar.gz scala-aea6519685561ee076e7fdaac48c2bf970389b83.tar.bz2 scala-aea6519685561ee076e7fdaac48c2bf970389b83.zip |
Merge pull request #3867 from lrytz/t8708
SI-8708 Fix pickling of LOCAL_CHILD child of sealed classes
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/aladdin1055.check | 7 | ||||
-rw-r--r-- | test/files/neg/aladdin1055.flags | 1 | ||||
-rw-r--r-- | test/files/neg/aladdin1055/A.scala | 6 | ||||
-rw-r--r-- | test/files/neg/aladdin1055/Test_1.scala | 5 | ||||
-rw-r--r-- | test/files/pos/t8708/Either_1.scala | 6 | ||||
-rw-r--r-- | test/files/pos/t8708/Test_2.scala | 13 | ||||
-rw-r--r-- | test/files/run/t8708_b.check | 8 | ||||
-rw-r--r-- | test/files/run/t8708_b/A_1.scala | 8 | ||||
-rw-r--r-- | test/files/run/t8708_b/Test_2.scala | 21 |
9 files changed, 75 insertions, 0 deletions
diff --git a/test/files/neg/aladdin1055.check b/test/files/neg/aladdin1055.check new file mode 100644 index 0000000000..41782ae987 --- /dev/null +++ b/test/files/neg/aladdin1055.check @@ -0,0 +1,7 @@ +Test_1.scala:2: warning: match may not be exhaustive. +It would fail on the following input: (_ : this.<local child>) + def foo(t: A.T) = t match { + ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found +one error found diff --git a/test/files/neg/aladdin1055.flags b/test/files/neg/aladdin1055.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/neg/aladdin1055.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/aladdin1055/A.scala b/test/files/neg/aladdin1055/A.scala new file mode 100644 index 0000000000..862336e30c --- /dev/null +++ b/test/files/neg/aladdin1055/A.scala @@ -0,0 +1,6 @@ +object A { + sealed trait T { def f: Int } + class TT extends T { def f = 0 } + + def foo = new T { def f = 1 } // local subclass of sealed trait T +} diff --git a/test/files/neg/aladdin1055/Test_1.scala b/test/files/neg/aladdin1055/Test_1.scala new file mode 100644 index 0000000000..39d9b1dc98 --- /dev/null +++ b/test/files/neg/aladdin1055/Test_1.scala @@ -0,0 +1,5 @@ +object Test { + def foo(t: A.T) = t match { + case a: A.TT => 0 + } +} diff --git a/test/files/pos/t8708/Either_1.scala b/test/files/pos/t8708/Either_1.scala new file mode 100644 index 0000000000..000ed6e7c2 --- /dev/null +++ b/test/files/pos/t8708/Either_1.scala @@ -0,0 +1,6 @@ +sealed trait \/[+A, +B] + +sealed trait EitherT[F[+_], +A, +B] +object EitherT { + def apply[F[+_], A, B](a: F[A \/ B]): EitherT[F, A, B] = new EitherT[F, A, B] { val run = a } +} diff --git a/test/files/pos/t8708/Test_2.scala b/test/files/pos/t8708/Test_2.scala new file mode 100644 index 0000000000..d0e56b9a37 --- /dev/null +++ b/test/files/pos/t8708/Test_2.scala @@ -0,0 +1,13 @@ +import scala.language.higherKinds + +trait ClientTypes[M[+_]] { + final type Context[+A] = EitherT[M, String, A] + object Context { + def apply[A](ca: M[String \/ A]): Context[A] = EitherT[M, String, A](ca) + } + + final type StatefulContext[+A] = EitherT[Context, String, A] + object StatefulContext { + def apply[A](state: Context[String \/ A]): StatefulContext[A] = ??? + } +} diff --git a/test/files/run/t8708_b.check b/test/files/run/t8708_b.check new file mode 100644 index 0000000000..30be62a307 --- /dev/null +++ b/test/files/run/t8708_b.check @@ -0,0 +1,8 @@ +Scope{ + def <init>: <?>; + sealed abstract trait T extends ; + def foo: <?> +} +Scope{ + def f: <?> +} diff --git a/test/files/run/t8708_b/A_1.scala b/test/files/run/t8708_b/A_1.scala new file mode 100644 index 0000000000..e767420f9e --- /dev/null +++ b/test/files/run/t8708_b/A_1.scala @@ -0,0 +1,8 @@ +package p + +class C { + + sealed trait T { def f: Int } + + def foo: T = new T { def f = 1 } +} diff --git a/test/files/run/t8708_b/Test_2.scala b/test/files/run/t8708_b/Test_2.scala new file mode 100644 index 0000000000..c978490609 --- /dev/null +++ b/test/files/run/t8708_b/Test_2.scala @@ -0,0 +1,21 @@ +import scala.tools.partest._ +import java.io.{Console => _, _} + +object Test extends DirectTest { + + override def extraSettings: String = "-usejavacp -cp " + testOutput.path + + override def code = "" + + override def show(): Unit = { + val g = newCompiler() + withRun(g)(r => { + val c = g.rootMirror.getRequiredClass("p.C") + println(c.info.decls) + val t = c.info.member(g.newTypeName("T")) + // this test ensrues that the <local child> dummy class symbol is not entered in the + // scope of trait T during unpickling. + println(t.info.decls) + }) + } +} |