diff options
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/contextbounds-implicits-new.scala | 4 | ||||
-rw-r--r-- | test/files/pos/implicits-new.scala | 9 | ||||
-rw-r--r-- | test/files/pos/liftcode_polymorphic.scala | 25 | ||||
-rw-r--r-- | test/files/pos/manifest1-new.scala | 4 | ||||
-rw-r--r-- | test/files/pos/nothing_manifest_disambig-new.scala | 2 | ||||
-rw-r--r-- | test/files/pos/spec-constr-new.scala | 6 | ||||
-rw-r--r-- | test/files/pos/spec-doubledef-new.scala | 4 | ||||
-rw-r--r-- | test/files/pos/spec-fields-new.scala | 6 | ||||
-rw-r--r-- | test/files/pos/spec-params-new.scala | 6 | ||||
-rw-r--r-- | test/files/pos/spec-sparsearray-new.scala | 5 | ||||
-rw-r--r-- | test/files/pos/t1381-new.scala | 4 | ||||
-rw-r--r-- | test/files/pos/t2795-new.scala | 6 | ||||
-rw-r--r-- | test/files/pos/t3363-new.scala | 4 | ||||
-rw-r--r-- | test/files/pos/t3498-new.scala | 4 | ||||
-rw-r--r-- | test/files/pos/t5223.scala | 4 | ||||
-rw-r--r-- | test/files/pos/t5305.scala | 2 | ||||
-rw-r--r-- | test/files/pos/t531.scala | 4 | ||||
-rw-r--r-- | test/files/pos/t532.scala | 4 | ||||
-rw-r--r-- | test/files/pos/t5769.scala | 5 | ||||
-rw-r--r-- | test/files/pos/t5809.scala | 11 | ||||
-rw-r--r-- | test/files/pos/t5862.scala | 38 | ||||
-rw-r--r-- | test/files/pos/typetags.scala | 12 |
22 files changed, 118 insertions, 51 deletions
diff --git a/test/files/pos/contextbounds-implicits-new.scala b/test/files/pos/contextbounds-implicits-new.scala index 71b3cca36f..327c4a98dc 100644 --- a/test/files/pos/contextbounds-implicits-new.scala +++ b/test/files/pos/contextbounds-implicits-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + /* Tests implicit parameters in the presence of context bounds. * See Section 7.4 of the Scala Language Specification. */ @@ -5,4 +7,4 @@ class C { def f[T: TypeTag, S: TypeTag](x: T, y: S)(implicit p: C) { } -} +}
\ No newline at end of file diff --git a/test/files/pos/implicits-new.scala b/test/files/pos/implicits-new.scala index 7eb7e100c3..ffc387132a 100644 --- a/test/files/pos/implicits-new.scala +++ b/test/files/pos/implicits-new.scala @@ -1,3 +1,6 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.{ClassTag, classTag} + // #1435 object t1435 { implicit def a(s:String):String = error("") @@ -57,7 +60,7 @@ object Test1625 { } object Test2188 { - implicit def toJavaList[A: ArrayTag](t:collection.Seq[A]):java.util.List[A] = java.util.Arrays.asList(t.toArray:_*) + implicit def toJavaList[A: ClassTag](t:collection.Seq[A]):java.util.List[A] = java.util.Arrays.asList(t.toArray:_*) val x: java.util.List[String] = List("foo") } @@ -85,5 +88,5 @@ package foo2709 { // Problem with specs object specsProblem { - println(implicitly[ConcreteTypeTag[Class[_]]]) -} + println(implicitly[TypeTag[Class[_]]]) +}
\ No newline at end of file diff --git a/test/files/pos/liftcode_polymorphic.scala b/test/files/pos/liftcode_polymorphic.scala index 9c59b34bee..8f537d278a 100644 --- a/test/files/pos/liftcode_polymorphic.scala +++ b/test/files/pos/liftcode_polymorphic.scala @@ -1,13 +1,12 @@ -import scala.reflect.mirror._
-
-object Append extends Application {
-
- def append[A](l1: List[A], l2: List[A]):List[A] =
- l1 match {
- case Nil => l2
- case x::xs => x :: append(xs, l2)
- }
-
- println(reify(append _).tree)
-}
-
+import scala.reflect.runtime.universe._ + +object Append extends Application { + + def append[A](l1: List[A], l2: List[A]):List[A] = + l1 match { + case Nil => l2 + case x::xs => x :: append(xs, l2) + } + + println(reify(append _).tree) +} diff --git a/test/files/pos/manifest1-new.scala b/test/files/pos/manifest1-new.scala index 645bd42665..3907d7854b 100644 --- a/test/files/pos/manifest1-new.scala +++ b/test/files/pos/manifest1-new.scala @@ -1,4 +1,4 @@ -import scala.reflect.TypeTag +import scala.reflect.runtime.universe._ object Test { def foo[T](x: T)(implicit m: TypeTag[T]) { @@ -18,4 +18,4 @@ object Test { val d: D = new D { type T = String; val m = stringm; val x = "x" } import d.m foo(d.x) -} +}
\ No newline at end of file diff --git a/test/files/pos/nothing_manifest_disambig-new.scala b/test/files/pos/nothing_manifest_disambig-new.scala index a60b0fdbf8..ed3a9e8fb1 100644 --- a/test/files/pos/nothing_manifest_disambig-new.scala +++ b/test/files/pos/nothing_manifest_disambig-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test { def mani[T: TypeTag](xs: T) = xs mani(List()) diff --git a/test/files/pos/spec-constr-new.scala b/test/files/pos/spec-constr-new.scala index 7cd02b0680..7beff91d8d 100644 --- a/test/files/pos/spec-constr-new.scala +++ b/test/files/pos/spec-constr-new.scala @@ -1,7 +1,9 @@ -class SparseArray2[@specialized(Int) T:ArrayTag](val maxSize: Int, initialLength:Int = 3) { +import scala.reflect.{ClassTag, classTag} + +class SparseArray2[@specialized(Int) T:ClassTag](val maxSize: Int, initialLength:Int = 3) { private var data = new Array[T](initialLength); private var index = new Array[Int](initialLength); // comment out to compile correctly data.length + 3; -} +}
\ No newline at end of file diff --git a/test/files/pos/spec-doubledef-new.scala b/test/files/pos/spec-doubledef-new.scala index 33f1e82b6e..ad9c6399a5 100644 --- a/test/files/pos/spec-doubledef-new.scala +++ b/test/files/pos/spec-doubledef-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object Test { def fn[@specialized T, @specialized U](t : T => Int, u : U => Int) : T = null.asInstanceOf[T] @@ -25,4 +27,4 @@ abstract class B[T, @specialized(scala.Int) U : TypeTag, @specialized(scala.Int) Pair(u, v2) } } -} +}
\ No newline at end of file diff --git a/test/files/pos/spec-fields-new.scala b/test/files/pos/spec-fields-new.scala index ddd8bd6624..de75b4b748 100644 --- a/test/files/pos/spec-fields-new.scala +++ b/test/files/pos/spec-fields-new.scala @@ -1,4 +1,6 @@ -abstract class Foo[@specialized T: ArrayTag, U <: Ordered[U]](x: T, size: Int) { +import scala.reflect.{ClassTag, classTag} + +abstract class Foo[@specialized T: ClassTag, U <: Ordered[U]](x: T, size: Int) { var y: T var z: T = x @@ -7,4 +9,4 @@ abstract class Foo[@specialized T: ArrayTag, U <: Ordered[U]](x: T, size: Int) { def getZ = z def setZ(zz: T) = z = zz -} +}
\ No newline at end of file diff --git a/test/files/pos/spec-params-new.scala b/test/files/pos/spec-params-new.scala index 5fe0c82d40..661e686f0e 100644 --- a/test/files/pos/spec-params-new.scala +++ b/test/files/pos/spec-params-new.scala @@ -1,4 +1,6 @@ -class Foo[@specialized A: ArrayTag] { +import scala.reflect.{ClassTag, classTag} + +class Foo[@specialized A: ClassTag] { // conflicting in bounds, expect a normalized member calling m // and bridge + implementation in specialized subclasses @@ -29,4 +31,4 @@ class Foo[@specialized A: ArrayTag] { val xs = new Array[A](1) xs(0) = x } -} +}
\ No newline at end of file diff --git a/test/files/pos/spec-sparsearray-new.scala b/test/files/pos/spec-sparsearray-new.scala index 0659bf7926..7b3934c476 100644 --- a/test/files/pos/spec-sparsearray-new.scala +++ b/test/files/pos/spec-sparsearray-new.scala @@ -1,6 +1,7 @@ +import scala.reflect.{ClassTag, classTag} import scala.collection.mutable.MapLike -class SparseArray[@specialized(Int) T:ArrayTag] extends collection.mutable.Map[Int,T] with collection.mutable.MapLike[Int,T,SparseArray[T]] { +class SparseArray[@specialized(Int) T:ClassTag] extends collection.mutable.Map[Int,T] with collection.mutable.MapLike[Int,T,SparseArray[T]] { override def get(x: Int) = { val ind = findOffset(x) if(ind < 0) None else Some(error("ignore")) @@ -21,4 +22,4 @@ class SparseArray[@specialized(Int) T:ArrayTag] extends collection.mutable.Map[I def -=(ind: Int) = error("ignore") def +=(kv: (Int,T)) = error("ignore") override final def iterator = error("ignore") -} +}
\ No newline at end of file diff --git a/test/files/pos/t1381-new.scala b/test/files/pos/t1381-new.scala index 8781ef4fdb..57e0f31fba 100644 --- a/test/files/pos/t1381-new.scala +++ b/test/files/pos/t1381-new.scala @@ -1,4 +1,4 @@ -import scala.reflect.TypeTag +import scala.reflect.runtime.universe._ class D[V <: Variable] @@ -28,4 +28,4 @@ abstract class EV[T](initval:T) extends PV[T](initval) with IV { override def d : ID[VT] = null // Comment this out to eliminate crash protected var indx = d.index(initval) -} +}
\ No newline at end of file diff --git a/test/files/pos/t2795-new.scala b/test/files/pos/t2795-new.scala index af9c4e8b1c..a6a5fdb127 100644 --- a/test/files/pos/t2795-new.scala +++ b/test/files/pos/t2795-new.scala @@ -1,11 +1,13 @@ package t1 +import scala.reflect.{ClassTag, classTag} + trait Element[T] { } trait Config { type T <: Element[T] - implicit val m: ArrayTag[T] + implicit val m: ClassTag[T] // XXX Following works fine: // type T <: Element[_] } @@ -14,4 +16,4 @@ trait Transform { self: Config => def processBlock(block: Array[T]): Unit = { var X = new Array[T](1) } -} +}
\ No newline at end of file diff --git a/test/files/pos/t3363-new.scala b/test/files/pos/t3363-new.scala index 270462745c..e609f4d55f 100644 --- a/test/files/pos/t3363-new.scala +++ b/test/files/pos/t3363-new.scala @@ -1,3 +1,5 @@ +import scala.reflect.runtime.universe._ + object TestCase { //now matter if you put (abstract) class or trait it will fail in all cases @@ -15,4 +17,4 @@ object TestCase { println(Map(1 -> "2") is List(2)) } - } + }
\ No newline at end of file diff --git a/test/files/pos/t3498-new.scala b/test/files/pos/t3498-new.scala index 653c50042a..eaf00cc351 100644 --- a/test/files/pos/t3498-new.scala +++ b/test/files/pos/t3498-new.scala @@ -1,4 +1,6 @@ -abstract class A[T, @specialized(scala.Int) U : ArrayTag] { +import scala.reflect.{ClassTag, classTag} + +abstract class A[T, @specialized(scala.Int) U : ClassTag] { def f(state: T): Array[U] } diff --git a/test/files/pos/t5223.scala b/test/files/pos/t5223.scala index 398630dc61..0b2528e367 100644 --- a/test/files/pos/t5223.scala +++ b/test/files/pos/t5223.scala @@ -1,6 +1,6 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Foo extends App { reify{def printf(format: String, args: Any*): String = null } reify{def printf(format: String, args: Any*): String = ("abc": @cloneable)} -} +}
\ No newline at end of file diff --git a/test/files/pos/t5305.scala b/test/files/pos/t5305.scala index 4c32cd7c6d..c0237ca3bd 100644 --- a/test/files/pos/t5305.scala +++ b/test/files/pos/t5305.scala @@ -7,7 +7,7 @@ object t5305 { } in { - import O.{F, v} + import O.{F, v} type x = {type l = (F, v.type)} // not found: type F } } diff --git a/test/files/pos/t531.scala b/test/files/pos/t531.scala index 5176912ef0..d53539f34f 100644 --- a/test/files/pos/t531.scala +++ b/test/files/pos/t531.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def titi = { @@ -8,4 +8,4 @@ object Test extends App { }} () } -} +}
\ No newline at end of file diff --git a/test/files/pos/t532.scala b/test/files/pos/t532.scala index a319fdfa27..7c33637b5d 100644 --- a/test/files/pos/t532.scala +++ b/test/files/pos/t532.scala @@ -1,4 +1,4 @@ -import scala.reflect.mirror._ +import scala.reflect.runtime.universe._ object Test extends App { def titi: Unit = { @@ -8,4 +8,4 @@ object Test extends App { }} () } -} +}
\ No newline at end of file diff --git a/test/files/pos/t5769.scala b/test/files/pos/t5769.scala index 723d37bfee..fdc46b65e9 100644 --- a/test/files/pos/t5769.scala +++ b/test/files/pos/t5769.scala @@ -1,8 +1,9 @@ // a.scala +import scala.reflect.{ClassTag, classTag} class A { type AI = Array[Int] - def f1 = arrayTag[Array[Int]] - def f2 = arrayTag[AI] + def f1 = classTag[Array[Int]] + def f2 = classTag[AI] }
\ No newline at end of file diff --git a/test/files/pos/t5809.scala b/test/files/pos/t5809.scala index 8f6ce708d2..133e13c4ed 100644 --- a/test/files/pos/t5809.scala +++ b/test/files/pos/t5809.scala @@ -1,10 +1,5 @@ -package scala.reflect - -package object api { - implicit class PimpedExpr[T](expr: Universe # Expr[T]) { - def runtimeEval: T = { - println("hello, dear") - expr.eval - } +package object foo { + implicit class PimpedInt(foo: Int) { + def bar = ??? } }
\ No newline at end of file diff --git a/test/files/pos/t5862.scala b/test/files/pos/t5862.scala new file mode 100644 index 0000000000..e3006ddc3f --- /dev/null +++ b/test/files/pos/t5862.scala @@ -0,0 +1,38 @@ +package test + +import java.io.DataOutput +import java.io.DataInput + +/** Interface for writing outputs from a DoFn. */ +trait Emitter[A] { + def emit(value: A): Unit +} + +/** A wrapper for a 'map' function tagged for a specific output channel. */ +abstract class TaggedMapper[A, K, V] + (val tags: Set[Int]) + (implicit val mA: Manifest[A], val wtA: WireFormat[A], + val mK: Manifest[K], val wtK: WireFormat[K], val ordK: Ordering[K], + val mV: Manifest[V], val wtV: WireFormat[V]) + extends Serializable { +} + +/** Type-class for sending types across the Hadoop wire. */ +trait WireFormat[A] + +class MapReduceJob { + trait DataSource + + import scala.collection.mutable.{ Set => MSet, Map => MMap } + private val mappers: MMap[DataSource, MSet[TaggedMapper[_, _, _]]] = MMap.empty + + def addTaggedMapper[A, K, V](input: DataSource, m: TaggedMapper[A, K, V]): Unit = { + if (!mappers.contains(input)) + mappers += (input -> MSet(m)) + else + mappers(input) += m // : Unit + + m.tags.foreach { tag => + } + } +} diff --git a/test/files/pos/typetags.scala b/test/files/pos/typetags.scala new file mode 100644 index 0000000000..33390d7b89 --- /dev/null +++ b/test/files/pos/typetags.scala @@ -0,0 +1,12 @@ +import scala.reflect.{basis => rb} +import scala.reflect.runtime.{universe => ru} + +object Test { + def main(args: Array[String]) { + def foo(implicit t: rb.TypeTag[List[Int]]) { + println(t) + val t2: ru.TypeTag[_] = t in ru.rootMirror + println(t2) + } + } +} |