diff options
Diffstat (limited to 'test/files/pos')
-rwxr-xr-x | test/files/pos/t1459/App.scala | 2 | ||||
-rw-r--r-- | test/files/pos/t4063.scala | 39 | ||||
-rw-r--r-- | test/files/pos/t4070.scala | 37 | ||||
-rw-r--r-- | test/files/pos/t4070b.scala | 35 | ||||
-rw-r--r-- | test/files/pos/t4273.scala | 8 | ||||
-rw-r--r-- | test/files/pos/t5020.scala | 19 | ||||
-rw-r--r-- | test/files/pos/t5119.scala | 13 | ||||
-rw-r--r-- | test/files/pos/t5175.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t5175.scala | 9 | ||||
-rw-r--r-- | test/files/pos/t5317.scala | 12 | ||||
-rw-r--r-- | test/files/pos/t5359.scala | 17 | ||||
-rw-r--r-- | test/files/pos/virtpatmat_alts_subst.flags | 1 | ||||
-rw-r--r-- | test/files/pos/virtpatmat_alts_subst.scala | 6 | ||||
-rw-r--r-- | test/files/pos/virtpatmat_binding_opt.flags | 1 | ||||
-rw-r--r-- | test/files/pos/virtpatmat_binding_opt.scala | 11 |
15 files changed, 210 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/t4063.scala b/test/files/pos/t4063.scala new file mode 100644 index 0000000000..5e19c42edc --- /dev/null +++ b/test/files/pos/t4063.scala @@ -0,0 +1,39 @@ +trait Parallel +trait Parallelizable[+ParRepr <: Parallel] + +trait PIterableLike[+T, +Repr <: Parallel] extends Parallel with Parallelizable[PIterableLike[T, Repr]] + +trait PMap[K, V] extends PIterableLike[(K, V), PMap[K, V]] +trait PSet[T] extends PIterableLike[T, PSet[T]] + +trait CIterableLike[+T, +Repr] + +trait CSet[T] extends CIterableLike[T, CSet[T]] with Parallelizable[PSet[T]] + +trait CMap[K, V] extends CIterableLike[(K, V), CMap[K, V]] with Parallelizable[PMap[K, V]] + +object Test { + var x = 0 + + def main() { + val map: CMap[Int, CSet[Int]] = new CMap[Int, CSet[Int]] {} + val set: CSet[Int] = new CSet[Int] {} + + // should infer type argument + //map.synchronized[CIterableLike[Any, Any] with Parallelizable[PIterableLike[Any, Parallel with Parallelizable[Parallel]]]] { + // or: + //map.synchronized[CIterableLike[Any, Any] with Parallelizable[PIterableLike[Any, Parallel]]] { + // or, maybe it could also infer existential types: + //map.synchronized[CIterableLike[Any, _] with Parallelizable[PIterableLike[Any, _]]] { + + map.synchronized { + if (x == 0) { + map + } else { + set + } + } + + } +} + 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/t4273.scala b/test/files/pos/t4273.scala new file mode 100644 index 0000000000..9a942e8325 --- /dev/null +++ b/test/files/pos/t4273.scala @@ -0,0 +1,8 @@ +class A { + implicit def compareComparables[T](x: T)(implicit ord: Ordering[T]) = new ord.Ops(x) + + class Bippy + implicit val bippyOrdering = new Ordering[Bippy] { def compare(x: Bippy, y: Bippy) = util.Random.nextInt } + + (new Bippy) < (new Bippy) +}
\ 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/t5119.scala b/test/files/pos/t5119.scala new file mode 100644 index 0000000000..4a67244e50 --- /dev/null +++ b/test/files/pos/t5119.scala @@ -0,0 +1,13 @@ +import collection.mutable + +object Test { + class IMap0[K[_], V[_]](backing: Map[K[_], V[_]]) { + def mapSeparate[VL[_], VR[_]](f: V[_] => ({type l[T] = Either[VL[T], VR[T]]})#l[_] ) = { + backing.view.map { case (k,v) => f(v) match { + case Left(l) => Left((k, l)) + case Right(r) => Right((k, r)) + } + } + } + } +} 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 |