summaryrefslogtreecommitdiff
path: root/test/files/pos
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/pos')
-rwxr-xr-xtest/files/pos/t1459/App.scala2
-rw-r--r--test/files/pos/t4070.scala37
-rw-r--r--test/files/pos/t4070b.scala35
-rw-r--r--test/files/pos/t5020.scala19
-rw-r--r--test/files/pos/t5175.flags1
-rw-r--r--test/files/pos/t5175.scala9
-rw-r--r--test/files/pos/t5317.scala12
-rw-r--r--test/files/pos/t5359.scala17
-rw-r--r--test/files/pos/virtpatmat_alts_subst.flags1
-rw-r--r--test/files/pos/virtpatmat_alts_subst.scala6
-rw-r--r--test/files/pos/virtpatmat_binding_opt.flags1
-rw-r--r--test/files/pos/virtpatmat_binding_opt.scala11
12 files changed, 150 insertions, 1 deletions
diff --git a/test/files/pos/t1459/App.scala b/test/files/pos/t1459/App.scala
index 651b285b17..36e5022e94 100755
--- a/test/files/pos/t1459/App.scala
+++ b/test/files/pos/t1459/App.scala
@@ -1,7 +1,7 @@
package foo
import base._
-object App extends Application {
+object App extends scala.App {
class Concrete extends AbstractBase {
override def doStuff(params:java.lang.String*): Unit = println("doStuff invoked")
}
diff --git a/test/files/pos/t4070.scala b/test/files/pos/t4070.scala
new file mode 100644
index 0000000000..29c8d16e30
--- /dev/null
+++ b/test/files/pos/t4070.scala
@@ -0,0 +1,37 @@
+package a {
+ // method before classes
+ trait Foo {
+ def crash(x: Dingus[_]): Unit = x match { case m: Bippy[tv] => () }
+
+ class Dingus[T]
+ class Bippy[CC[X] <: Seq[X]]() extends Dingus[CC[Int]]
+ }
+}
+
+package b {
+ // classes before method
+ trait Foo {
+ class Dingus[T]
+ class Bippy[CC[X] <: Seq[X]]() extends Dingus[CC[Int]]
+
+ def crash(x: Dingus[_]): Unit = x match { case m: Bippy[tv] => () }
+ }
+}
+
+
+/*
+// With crash below the clasess:
+% scalac -Dscalac.debug.tvar ./a.scala
+[ create] ?_$1 ( In Foo#crash )
+[ setInst] tv[Int] ( In Foo#crash, _$1=tv[Int] )
+[ create] tv[Int] ( In Foo#crash )
+[ clone] tv[Int] ( Foo#crash )
+
+// With crash above the classes:
+% scalac -Dscalac.debug.tvar ./a.scala
+[ create] ?tv ( In Foo#crash )
+./a.scala:2: error: Invalid type application in TypeVar: List(), List(Int)
+ def crash(x: Dingus[_]): Unit = x match { case m: Bippy[tv] => () }
+ ^
+one error found
+*/
diff --git a/test/files/pos/t4070b.scala b/test/files/pos/t4070b.scala
new file mode 100644
index 0000000000..36d03de80c
--- /dev/null
+++ b/test/files/pos/t4070b.scala
@@ -0,0 +1,35 @@
+package a {
+ abstract class DeliteOp[B]
+ abstract class DeliteCollection[A]
+ abstract class Exp[T] { def Type: T }
+
+ trait DeliteOpMap[A,B,C[X] <: DeliteCollection[X]] extends DeliteOp[C[B]] {
+ val in: Exp[C[A]]
+ val func: Exp[B]
+ val alloc: Exp[C[B]]
+ }
+
+ object Test {
+ def f(x: DeliteOp[_]) = x match {
+ case map: DeliteOpMap[_,_,_] => map.alloc.Type
+ }
+ }
+}
+
+package b {
+ object Test {
+ def f(x: DeliteOp[_]) = x match {
+ case map: DeliteOpMap[_,_,_] => map.alloc.Type
+ }
+ }
+
+ abstract class DeliteOp[B]
+ abstract class DeliteCollection[A]
+ abstract class Exp[T] { def Type: T }
+
+ trait DeliteOpMap[A,B,C[X] <: DeliteCollection[X]] extends DeliteOp[C[B]] {
+ val in: Exp[C[A]]
+ val func: Exp[B]
+ val alloc: Exp[C[B]]
+ }
+} \ No newline at end of file
diff --git a/test/files/pos/t5020.scala b/test/files/pos/t5020.scala
new file mode 100644
index 0000000000..06f7723f9f
--- /dev/null
+++ b/test/files/pos/t5020.scala
@@ -0,0 +1,19 @@
+package a {
+ sealed trait GenericList[U, M[_ <: U]] {
+ type Transformed[N[MMA <: U]] <: GenericList[U, N]
+ }
+
+ trait GenericCons[U, M[_ <: U], T <: GenericList[U, M]] extends GenericList[U, M] {
+ type Transformed[N[MMB <: U]] = GenericCons[U, N, GenericList[U, M]#Transformed[N]]
+ }
+}
+
+package b {
+ sealed trait GenericList[L, M[_ >: L]] {
+ type Transformed[N[MMA >: L]] <: GenericList[L, N]
+ }
+
+ trait GenericCons[L, M[_ >: L], T <: GenericList[L, M]] extends GenericList[L, M] {
+ type Transformed[N[MMB >: L]] = GenericCons[L, N, T#Transformed[N]]
+ }
+} \ No newline at end of file
diff --git a/test/files/pos/t5175.flags b/test/files/pos/t5175.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/pos/t5175.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/pos/t5175.scala b/test/files/pos/t5175.scala
new file mode 100644
index 0000000000..e15cc3affd
--- /dev/null
+++ b/test/files/pos/t5175.scala
@@ -0,0 +1,9 @@
+object Test {
+ def ==(p: Phase): Int = 0
+
+ def foo {
+ ==(new Phase())
+ }
+}
+
+class Phase
diff --git a/test/files/pos/t5317.scala b/test/files/pos/t5317.scala
new file mode 100644
index 0000000000..8c9c9d8222
--- /dev/null
+++ b/test/files/pos/t5317.scala
@@ -0,0 +1,12 @@
+object Test {
+ trait S { type T; val x: AnyRef }
+ trait A extends S { type T <: A; val x: A = null }
+ trait B extends S { type T <: B; val x: B = null }
+
+ val a = new A{}
+ val b = new B{}
+ val y = if (true) a else b
+
+ // lub of y should allow for this
+ println(y.x.x)
+}
diff --git a/test/files/pos/t5359.scala b/test/files/pos/t5359.scala
new file mode 100644
index 0000000000..c22b2b1c76
--- /dev/null
+++ b/test/files/pos/t5359.scala
@@ -0,0 +1,17 @@
+// /scala/trac/5359/a.scala
+// Thu Jan 5 13:31:05 PST 2012
+
+object test {
+ trait Step[F[_]] {
+ // crash: typeConstructor inapplicable for <none>
+ this match {
+ case S1() =>
+ }
+ }
+ case class S1[F[_]]() extends Step[F]
+
+ // okay
+ (null: Step[Option]) match {
+ case S1() =>
+ }
+}
diff --git a/test/files/pos/virtpatmat_alts_subst.flags b/test/files/pos/virtpatmat_alts_subst.flags
new file mode 100644
index 0000000000..9769db9257
--- /dev/null
+++ b/test/files/pos/virtpatmat_alts_subst.flags
@@ -0,0 +1 @@
+ -Yvirtpatmat -Xexperimental
diff --git a/test/files/pos/virtpatmat_alts_subst.scala b/test/files/pos/virtpatmat_alts_subst.scala
new file mode 100644
index 0000000000..e27c52f9c7
--- /dev/null
+++ b/test/files/pos/virtpatmat_alts_subst.scala
@@ -0,0 +1,6 @@
+case class Foo(s: String) {
+ def appliedType(tycon: Any) =
+ tycon match {
+ case Foo(sym @ ("NothingClass" | "AnyClass")) => println(sym)
+ }
+}
diff --git a/test/files/pos/virtpatmat_binding_opt.flags b/test/files/pos/virtpatmat_binding_opt.flags
new file mode 100644
index 0000000000..9769db9257
--- /dev/null
+++ b/test/files/pos/virtpatmat_binding_opt.flags
@@ -0,0 +1 @@
+ -Yvirtpatmat -Xexperimental
diff --git a/test/files/pos/virtpatmat_binding_opt.scala b/test/files/pos/virtpatmat_binding_opt.scala
new file mode 100644
index 0000000000..962e3d7dbe
--- /dev/null
+++ b/test/files/pos/virtpatmat_binding_opt.scala
@@ -0,0 +1,11 @@
+class Test {
+ def combine = this match {
+ case that if that eq this => this // just return this
+ case that: Test2 =>
+ println(that)
+ this
+ case _ => error("meh")
+ }
+}
+
+class Test2 extends Test \ No newline at end of file