summaryrefslogtreecommitdiff
path: root/test/pending/pos
diff options
context:
space:
mode:
Diffstat (limited to 'test/pending/pos')
-rw-r--r--test/pending/pos/existentials-harmful.scala54
-rw-r--r--test/pending/pos/t4012.scala7
-rw-r--r--test/pending/pos/t4541.scala10
-rw-r--r--test/pending/pos/t4786.scala24
-rw-r--r--test/pending/pos/t4790.scala4
-rw-r--r--test/pending/pos/t5259.scala14
-rw-r--r--test/pending/pos/t5399.scala15
-rw-r--r--test/pending/pos/t5400.scala14
8 files changed, 88 insertions, 54 deletions
diff --git a/test/pending/pos/existentials-harmful.scala b/test/pending/pos/existentials-harmful.scala
deleted file mode 100644
index 8722852e8a..0000000000
--- a/test/pending/pos/existentials-harmful.scala
+++ /dev/null
@@ -1,54 +0,0 @@
-// a.scala
-// Mon Jul 11 14:18:26 PDT 2011
-
-object ExistentialsConsideredHarmful {
- class Animal(val name: String)
- object Dog extends Animal("Dog")
- object Sheep extends Animal("Sheep")
-
- trait Tools[A] {
- def shave(a: A): A
- }
- def tools[A](a: A): Tools[A] = null // dummy
-
- case class TransportBox[A <: Animal](animal: A, tools: Tools[A]) {
- def label: String = animal.name
- }
-
- // 1.
- def carry[A <: Animal](box: TransportBox[A]): Unit = {
- println(box.animal.name+" got carried away")
- }
-
- val aBox =
- if (math.random < 0.5)
- TransportBox(Dog, tools(Dog))
- else
- TransportBox(Sheep, tools(Sheep))
-
- // 2.
- //aBox.tools.shave(aBox.animal)
-
- // Use pattern match to avoid opening the existential twice
- aBox match {
- case TransportBox(animal, tools) => tools.shave(animal)
- }
-
- abstract class BoxCarrier[R <: Animal](box: TransportBox[R]) {
- def speed: Int
-
- def talkToAnimal: Unit = println("The carrier says hello to"+box.animal.name)
- }
-
- // 3.
- //val bc = new BoxCarrier(aBox) {
-
- // Use pattern match to avoid opening the existential twice
- // Type annotation on bc is required ... possible compiler bug?
- // val bc : BoxCarrier[_ <: Animal] = aBox match {
- val bc = aBox match {
- case tb : TransportBox[a] => new BoxCarrier(tb) {
- def speed: Int = 12
- }
- }
-}
diff --git a/test/pending/pos/t4012.scala b/test/pending/pos/t4012.scala
new file mode 100644
index 0000000000..9b8a1b0dbe
--- /dev/null
+++ b/test/pending/pos/t4012.scala
@@ -0,0 +1,7 @@
+trait C1[+A] {
+ def head: A = sys.error("")
+}
+trait C2[@specialized +A] extends C1[A] {
+ override def head: A = super.head
+}
+class C3 extends C2[Char] \ No newline at end of file
diff --git a/test/pending/pos/t4541.scala b/test/pending/pos/t4541.scala
new file mode 100644
index 0000000000..c6d9672cc5
--- /dev/null
+++ b/test/pending/pos/t4541.scala
@@ -0,0 +1,10 @@
+@SerialVersionUID(1L)
+final class SparseArray[@specialized T](private var data : Array[T]) extends Serializable {
+ def use(inData : Array[T]) = {
+ data = inData;
+ }
+
+ def set(that : SparseArray[T]) = {
+ use(that.data.clone)
+ }
+} \ No newline at end of file
diff --git a/test/pending/pos/t4786.scala b/test/pending/pos/t4786.scala
new file mode 100644
index 0000000000..f0579142b8
--- /dev/null
+++ b/test/pending/pos/t4786.scala
@@ -0,0 +1,24 @@
+trait Matrix[@specialized A, Repr[C] <: Matrix[C, Repr]] { // crash goes away if @specialize is removed
+ def duplicate(mb: MatrixBuilder[A, Repr]): Repr[A] = {
+ mb.zeros
+ }
+}
+trait DenseMatrix[@specialized A] extends Matrix[A, DenseMatrix]
+trait DenseMatrixFlt extends DenseMatrix[Float]
+
+trait MatrixBuilder[@specialized A, Repr[C] <: Matrix[C, Repr]] {
+ def zeros: Repr[A]
+}
+object DenseFloatBuilder extends MatrixBuilder[Float, DenseMatrix] {
+ val zeros = new Object with DenseMatrixFlt
+ // Note:
+ // - in 2.9 crash goes away if the explicit type "DenseMatrixFlt" is assigned to "zeros"
+ // - in 2.9 crash goes away if DenseMatrixFlt is a class instead of a trait:
+ // val zeros = new DenseMatrixFlt
+}
+
+object Test extends App {
+ val m1 = DenseFloatBuilder.zeros // in 2.9 crash goes away if explicit type "DenseMatrixFlt" is assigned to m1
+ val m2 = m1.duplicate(DenseFloatBuilder)
+}
+
diff --git a/test/pending/pos/t4790.scala b/test/pending/pos/t4790.scala
new file mode 100644
index 0000000000..e451fe80ab
--- /dev/null
+++ b/test/pending/pos/t4790.scala
@@ -0,0 +1,4 @@
+package spectest {
+ class Sp[@specialized A, B](val a: A, val b: B) { }
+ class Fsp[@specialized A, B](a: A, b: B) extends Sp(a,b) { def ab = (a,b) }
+}
diff --git a/test/pending/pos/t5259.scala b/test/pending/pos/t5259.scala
new file mode 100644
index 0000000000..317e28a9dc
--- /dev/null
+++ b/test/pending/pos/t5259.scala
@@ -0,0 +1,14 @@
+object DefaultArgBogusTypeMismatch {
+
+ class A[T]
+ class B {
+ type T = this.type
+ def m(implicit a : A[T] = new A[T]) = a
+ }
+
+ def newB = new B
+ val a1 = newB.m // Bogus type mismatch
+
+ val stableB = new B
+ val a2 = stableB.m // OK
+}
diff --git a/test/pending/pos/t5399.scala b/test/pending/pos/t5399.scala
new file mode 100644
index 0000000000..d8c1d5e51c
--- /dev/null
+++ b/test/pending/pos/t5399.scala
@@ -0,0 +1,15 @@
+class Test {
+ type AnyCyclic = Execute[Task]#CyclicException[_]
+
+ trait Task[T]
+
+ trait Execute[A[_] <: AnyRef] {
+ class CyclicException[T](val caller: A[T], val target: A[T])
+ }
+
+ def convertCyclic(c: AnyCyclic): String =
+ (c.caller, c.target) match {
+ case (caller: Task[_], target: Task[_]) => "bazinga!"
+ }
+}
+
diff --git a/test/pending/pos/t5400.scala b/test/pending/pos/t5400.scala
new file mode 100644
index 0000000000..cb4be4bde5
--- /dev/null
+++ b/test/pending/pos/t5400.scala
@@ -0,0 +1,14 @@
+trait TFn1B {
+ type In
+ type Out
+ type Apply[T <: In] <: Out
+}
+
+trait TFn1[I, O] extends TFn1B {
+ type In = I
+ type Out = O
+}
+
+trait >>[F1 <: TFn1[_, _], F2 <: TFn1[_, _]] extends TFn1[F1#In, F2#Out] {
+ type Apply[T] = F2#Apply[F1#Apply[T]]
+}