diff options
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/existentials3.check | 22 | ||||
-rw-r--r-- | test/files/run/existentials3.scala | 73 | ||||
-rw-r--r-- | test/files/run/repl-existentials.check | 63 | ||||
-rw-r--r-- | test/files/run/repl-existentials.scala | 31 | ||||
-rw-r--r-- | test/files/run/t1195.check | 6 | ||||
-rw-r--r-- | test/files/run/t1195.scala | 26 |
6 files changed, 127 insertions, 94 deletions
diff --git a/test/files/run/existentials3.check b/test/files/run/existentials3.check new file mode 100644 index 0000000000..41dc1f767c --- /dev/null +++ b/test/files/run/existentials3.check @@ -0,0 +1,22 @@ +_ <: scala.runtime.AbstractFunction0[_ <: Object with Test$ToS with scala.ScalaObject with scala.Product with scala.Serializable] with scala.ScalaObject with scala.Serializable with java.lang.Object +_ <: Object with Test$ToS with scala.ScalaObject with scala.Product with scala.Serializable +Object with Test$ToS with scala.ScalaObject +Object with Test$ToS with scala.ScalaObject +Object with Test$ToS with scala.ScalaObject +scala.Function0[Object with Test$ToS with scala.ScalaObject] +scala.Function0[Object with Test$ToS with scala.ScalaObject] +_ <: Object with _ <: Object with Object with Test$ToS with scala.ScalaObject +_ <: Object with _ <: Object with _ <: Object with Test$ToS with scala.ScalaObject +scala.collection.immutable.List[Object with scala.collection.Seq[Int] with scala.ScalaObject] +scala.collection.immutable.List[Object with scala.collection.Seq[_ <: Int] with scala.ScalaObject] +_ <: scala.runtime.AbstractFunction0[_ <: Object with Test$ToS with scala.ScalaObject with scala.Product with scala.Serializable] with scala.ScalaObject with scala.Serializable with java.lang.Object +_ <: Object with Test$ToS with scala.ScalaObject with scala.Product with scala.Serializable +Object with Test$ToS with scala.ScalaObject +Object with Test$ToS with scala.ScalaObject +Object with Test$ToS with scala.ScalaObject +scala.Function0[Object with Test$ToS with scala.ScalaObject] +scala.Function0[Object with Test$ToS with scala.ScalaObject] +_ <: Object with _ <: Object with Object with Test$ToS with scala.ScalaObject +_ <: Object with _ <: Object with _ <: Object with Test$ToS with scala.ScalaObject +scala.collection.immutable.List[Object with scala.collection.Seq[Int] with scala.ScalaObject] +scala.collection.immutable.List[Object with scala.collection.Seq[_ <: Int] with scala.ScalaObject] diff --git a/test/files/run/existentials3.scala b/test/files/run/existentials3.scala new file mode 100644 index 0000000000..bb80d366cc --- /dev/null +++ b/test/files/run/existentials3.scala @@ -0,0 +1,73 @@ +object Test { + trait ToS { final override def toString = getClass.getName } + + def f1 = { case class Bar() extends ToS; Bar } + def f2 = { case class Bar() extends ToS; Bar() } + def f3 = { class Bar() extends ToS; object Bar extends ToS; Bar } + def f4 = { class Bar() extends ToS; new Bar() } + def f5 = { object Bar extends ToS; Bar } + def f6 = { () => { object Bar extends ToS ; Bar } } + def f7 = { val f = { () => { object Bar extends ToS ; Bar } } ; f } + + def f8 = { trait A ; trait B extends A ; class C extends B with ToS; new C { } } + def f9 = { trait A ; trait B ; class C extends B with A with ToS; new C { } } + + def f10 = { class A { type T1 } ; List[A#T1]() } + def f11 = { abstract class A extends Seq[Int] ; List[A]() } + def f12 = { abstract class A extends Seq[U forSome { type U <: Int }] ; List[A]() } + + val g1 = { case class Bar() extends ToS; Bar } + val g2 = { case class Bar() extends ToS; Bar() } + val g3 = { class Bar() extends ToS; object Bar extends ToS; Bar } + val g4 = { class Bar() extends ToS; new Bar() } + val g5 = { object Bar extends ToS; Bar } + val g6 = { () => { object Bar extends ToS ; Bar } } + val g7 = { val f = { () => { object Bar extends ToS ; Bar } } ; f } + + val g8 = { trait A ; trait B extends A ; class C extends B with ToS; new C { } } + val g9 = { trait A ; trait B ; class C extends B with A with ToS; new C { } } + + val g10 = { class A { type T1 } ; List[A#T1]() } + val g11 = { abstract class A extends Seq[Int] ; List[A]() } + val g12 = { abstract class A extends Seq[U forSome { type U <: Int }] ; List[A]() } + + def m[T: Manifest](x: T) = println(manifest[T]) + + // manifests don't work for f10/g10 + def main(args: Array[String]): Unit = { + m(f1) + m(f2) + m(f3) + m(f4) + m(f5) + m(f6) + m(f7) + m(f8) + m(f9) + // m(f10) + m(f11) + m(f12) + m(g1) + m(g2) + m(g3) + m(g4) + m(g5) + m(g6) + m(g7) + m(g8) + m(g9) + // m(g10) + m(g11) + m(g12) + } +} + +object Misc { + trait Bippy { def bippy = "I'm Bippy!" } + object o1 { + def f1 = { trait A extends Seq[U forSome { type U <: Bippy }] ; abstract class B extends A ; trait C extends B ; (null: C) } + def f2 = f1.head.bippy + } + def g1 = o1.f1 _ + def g2 = o1.f2 _ +} diff --git a/test/files/run/repl-existentials.check b/test/files/run/repl-existentials.check deleted file mode 100644 index 7093b428e8..0000000000 --- a/test/files/run/repl-existentials.check +++ /dev/null @@ -1,63 +0,0 @@ -Type in expressions to have them evaluated. -Type :help for more information. - -scala> trait ToS { final override def toString = getClass.getName } -defined trait ToS - -scala> - -scala> // def f1 = { case class Bar() extends ToS; Bar } - -scala> def f2 = { case class Bar() extends ToS; Bar() } -f2: Bar forSome { type Bar <: Object with ToS with ScalaObject with Product with Serializable{def copy(): Bar} } - -scala> def f3 = { class Bar() extends ToS; object Bar extends ToS; Bar } -f3: Object with ToS with ScalaObject - -scala> def f4 = { class Bar() extends ToS; new Bar() } -f4: Object with ToS with ScalaObject - -scala> def f5 = { object Bar extends ToS; Bar } -f5: Object with ToS with ScalaObject - -scala> def f6 = { () => { object Bar extends ToS ; Bar } } -f6: () => Object with ToS with ScalaObject - -scala> def f7 = { val f = { () => { object Bar extends ToS ; Bar } } ; f } -f7: () => Object with ToS with ScalaObject - -scala> - -scala> // def f8 = { trait A ; trait B extends A ; class C extends B with ToS; new C { } } - -scala> // def f9 = { trait A ; trait B ; class C extends B with A with ToS; new C { } } - -scala> - -scala> def f10 = { class A { type T1 } ; List[A#T1]() } -f10: List[Object with ScalaObject{type T1}#T1] - -scala> def f11 = { abstract class A extends Seq[Int] ; List[A]() } -f11: List[Object with Seq[Int] with ScalaObject] - -scala> def f12 = { abstract class A extends Seq[U forSome { type U <: Int }] ; List[A]() } -f12: List[Object with Seq[U forSome { type U <: Int }] with ScalaObject] - -scala> - -scala> trait Bippy { def bippy = "I'm Bippy!" } -defined trait Bippy - -scala> object o1 { - def f1 = { trait A extends Seq[U forSome { type U <: Bippy }] ; abstract class B extends A ; trait C extends B ; (null: C) } - def f2 = f1.head.bippy -} -defined module o1 - -scala> o1.f1 _ -res0: () => C forSome { type C <: Object with A with ScalaObject; type A <: Object with Seq[U forSome { type U <: Bippy }] } = <function0> - -scala> o1.f2 _ -res1: () => String = <function0> - -scala> diff --git a/test/files/run/repl-existentials.scala b/test/files/run/repl-existentials.scala deleted file mode 100644 index 31034b49a0..0000000000 --- a/test/files/run/repl-existentials.scala +++ /dev/null @@ -1,31 +0,0 @@ -import scala.tools.partest.ReplTest - -object Test extends ReplTest { - def code = """ -trait ToS { final override def toString = getClass.getName } - -// def f1 = { case class Bar() extends ToS; Bar } -def f2 = { case class Bar() extends ToS; Bar() } -def f3 = { class Bar() extends ToS; object Bar extends ToS; Bar } -def f4 = { class Bar() extends ToS; new Bar() } -def f5 = { object Bar extends ToS; Bar } -def f6 = { () => { object Bar extends ToS ; Bar } } -def f7 = { val f = { () => { object Bar extends ToS ; Bar } } ; f } - -// def f8 = { trait A ; trait B extends A ; class C extends B with ToS; new C { } } -// def f9 = { trait A ; trait B ; class C extends B with A with ToS; new C { } } - -def f10 = { class A { type T1 } ; List[A#T1]() } -def f11 = { abstract class A extends Seq[Int] ; List[A]() } -def f12 = { abstract class A extends Seq[U forSome { type U <: Int }] ; List[A]() } - -trait Bippy { def bippy = "I'm Bippy!" } -object o1 { - def f1 = { trait A extends Seq[U forSome { type U <: Bippy }] ; abstract class B extends A ; trait C extends B ; (null: C) } - def f2 = f1.head.bippy -} -o1.f1 _ -o1.f2 _ - -""".trim -} diff --git a/test/files/run/t1195.check b/test/files/run/t1195.check new file mode 100644 index 0000000000..dc521fb8ca --- /dev/null +++ b/test/files/run/t1195.check @@ -0,0 +1,6 @@ +_ <: scala.runtime.AbstractFunction1[Int, _ <: Object with scala.ScalaObject with scala.Product with scala.Serializable] with scala.ScalaObject with scala.Serializable with java.lang.Object +_ <: Object with scala.ScalaObject with scala.Product with scala.Serializable +Object with scala.ScalaObject with scala.Product with scala.Serializable +_ <: scala.runtime.AbstractFunction1[Int, _ <: Object with scala.ScalaObject with scala.Product with scala.Serializable] with scala.ScalaObject with scala.Serializable with java.lang.Object +_ <: Object with scala.ScalaObject with scala.Product with scala.Serializable +Object with scala.ScalaObject with scala.Product with scala.Serializable diff --git a/test/files/run/t1195.scala b/test/files/run/t1195.scala new file mode 100644 index 0000000000..81ef5bdb0e --- /dev/null +++ b/test/files/run/t1195.scala @@ -0,0 +1,26 @@ +object Test { + def f() = { case class Bar(x: Int); Bar } + def g() = { case class Bar(x: Int); Bar(5) } + def h() = { case object Bar ; Bar } + + val f1 = f() + val g1 = g() + val h1 = h() + + def m[T: Manifest](x: T) = println(manifest[T]) + + def main(args: Array[String]): Unit = { + m(f) + m(g) + m(h) + m(f1) + m(g1) + m(h1) + } +} + +class A1[T] { + class B1[U] { + def f = { case class D(x: Int) extends A1[String] ; new D(5) } + } +} |