diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-05-17 17:01:20 +0200 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-05-17 11:16:39 -0700 |
commit | b7c352a57f65458c66c78a368f75aaaa4a08e443 (patch) | |
tree | 4b2b7fcea439948c5de65b05a392091a66eea0a4 /test/files/pos | |
parent | 4f8c306aca703c63282295c9f74f0cb35f9f85d4 (diff) | |
parent | be405eed9bef9736f0142d6ddf53b6bf8af08696 (diff) | |
download | scala-b7c352a57f65458c66c78a368f75aaaa4a08e443.tar.gz scala-b7c352a57f65458c66c78a368f75aaaa4a08e443.tar.bz2 scala-b7c352a57f65458c66c78a368f75aaaa4a08e443.zip |
Merge v2.10.1-326-g4f8c306' into merge/v2.10.1-326-g4f8c306-to-master
================================================================
Merge commit 'v2.10.1-326-g4f8c306' into merge/v2.10.1-326-g4f8c306-to-master
Conflicts:
src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
src/reflect/scala/reflect/runtime/JavaMirrors.scala
================================================================
Merge -s ours 4e64a27 ([nomaster commit range])
================================================================
Merge commit '0ae7e55' into merge/v2.10.1-326-g4f8c306-to-master
Conflicts:
src/compiler/scala/tools/nsc/typechecker/Macros.scala
Diffstat (limited to 'test/files/pos')
159 files changed, 943 insertions, 389 deletions
diff --git a/test/files/pos/CustomGlobal.scala b/test/files/pos/CustomGlobal.scala index 30bf227950..a5668bd7c0 100644 --- a/test/files/pos/CustomGlobal.scala +++ b/test/files/pos/CustomGlobal.scala @@ -22,7 +22,7 @@ class CustomGlobal(currentSettings: Settings, reporter: Reporter) extends Global override def newTyper(context: Context): Typer = new CustomTyper(context) class CustomTyper(context : Context) extends Typer(context) { - override def typed(tree: Tree, mode: Int, pt: Type): Tree = { + override def typed(tree: Tree, mode: Mode, pt: Type): Tree = { if (tree.summaryString contains "Bippy") println("I'm typing a Bippy! It's a " + tree.shortClass + ".") diff --git a/test/files/pos/List1.scala b/test/files/pos/List1.scala index 9d3a51f4e3..30ebf5e1e7 100644 --- a/test/files/pos/List1.scala +++ b/test/files/pos/List1.scala @@ -9,15 +9,15 @@ object lists { def Nil[b] = new List[b] { def isEmpty: Boolean = true; - def head = error("head of Nil"); - def tail = error("tail of Nil"); + def head = sys.error("head of Nil"); + def tail = sys.error("tail of Nil"); } def Cons[c](x: c, xs: List[c]): List[c] = new List[c] { def isEmpty = false; def head = x; def tail = xs; - } + } def foo = { val intnil = Nil[Int]; diff --git a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala index d92fbca380..cf58bc3dfd 100644 --- a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala +++ b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala @@ -21,7 +21,7 @@ object Macros { // normalize argument name var b1 = new Transformer { override def transform(tree: Tree): Tree = tree match { - case Ident(x) if (x==n) => Ident(newTermName("_arg")) + case Ident(x) if (x==n) => Ident(TermName("_arg")) case tt @ TypeTree() if tt.original != null => TypeTree(tt.tpe) setOriginal transform(tt.original) // without the fix to LazyTreeCopier.Annotated, we would need to uncomment the line below to make the macro work // that's because the pattern match in the input expression gets expanded into Typed(<x>, TypeTree(<Int @unchecked>)) diff --git a/test/files/pos/annotations.scala b/test/files/pos/annotations.scala index 706a715bad..4832ce4ecd 100644 --- a/test/files/pos/annotations.scala +++ b/test/files/pos/annotations.scala @@ -2,7 +2,7 @@ class ann(i: Int) extends scala.annotation.Annotation class cfann(x: String) extends annotation.ClassfileAnnotation // annotations on abstract types -abstract class C1[@serializable @cloneable +T, U, V[_]] +abstract class C1[@annotation.elidable(0) +T, U, V[_]] abstract class C2[@deprecated @ann(1) T <: Number, V] diff --git a/test/files/pos/annotations2.scala b/test/files/pos/annotations2.scala new file mode 100644 index 0000000000..3bce7f8ac4 --- /dev/null +++ b/test/files/pos/annotations2.scala @@ -0,0 +1,31 @@ + +class B[T](x: (T, T)) { + def this(xx: (T, Any, Any)) = this((xx._1, xx._1)) +} +class BAnn[T](x: (T, T)) extends scala.annotation.StaticAnnotation { + def this(xx: (T, Any, Any)) = this((xx._1, xx._1)) +} +class CAnn[T](x: (T, T)) extends scala.annotation.StaticAnnotation { + def this(xx: Class[T]) = this((xx.newInstance(), xx.newInstance())) +} + +class A1 { + val b1 = new B((1, 2, 3)) + val b2 = new B((1, 2)) + val b3 = new B[Int]((1, 2, 3)) + val b4 = new B[Int]((1, 2)) +} + +class A2 { + @BAnn((1, 2, 3)) val b1 = null + @BAnn((1, 2)) val b2 = null + @BAnn[Int]((1, 2, 3)) val b3 = null + @BAnn[Int]((1, 2)) val b4 = null +} + +class A3 { + @CAnn(classOf[Int]) val b1 = null + @CAnn((1, 2)) val b2 = null + @CAnn[Int](classOf[Int]) val b3 = null + @CAnn[Int]((1, 2)) val b4 = null +} diff --git a/test/files/pos/attachments-typed-another-ident.check b/test/files/pos/attachments-typed-another-ident.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/pos/attachments-typed-another-ident.check diff --git a/test/files/pos/attachments-typed-another-ident.flags b/test/files/pos/attachments-typed-another-ident.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/pos/attachments-typed-another-ident.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/pos/attachments-typed-another-ident/Impls_1.scala b/test/files/pos/attachments-typed-another-ident/Impls_1.scala new file mode 100644 index 0000000000..c3f541075e --- /dev/null +++ b/test/files/pos/attachments-typed-another-ident/Impls_1.scala @@ -0,0 +1,17 @@ +import scala.reflect.macros.Context +import language.experimental.macros + +object MyAttachment + +object Macros { + def impl(c: Context) = { + import c.universe._ + val ident = Ident(TermName("bar")) updateAttachment MyAttachment + assert(ident.attachments.get[MyAttachment.type].isDefined, ident.attachments) + val typed = c.typeCheck(ident) + assert(typed.attachments.get[MyAttachment.type].isDefined, typed.attachments) + c.Expr[Int](typed) + } + + def foo = macro impl +} diff --git a/test/files/pos/attachments-typed-another-ident/Macros_Test_2.scala b/test/files/pos/attachments-typed-another-ident/Macros_Test_2.scala new file mode 100644 index 0000000000..022639bfe9 --- /dev/null +++ b/test/files/pos/attachments-typed-another-ident/Macros_Test_2.scala @@ -0,0 +1,5 @@ +object Test extends App { + def bar = 2 + Macros.foo +} + diff --git a/test/files/pos/attachments-typed-ident/Impls_1.scala b/test/files/pos/attachments-typed-ident/Impls_1.scala index cc40893a93..c382cabc59 100644 --- a/test/files/pos/attachments-typed-ident/Impls_1.scala +++ b/test/files/pos/attachments-typed-ident/Impls_1.scala @@ -6,7 +6,7 @@ object MyAttachment object Macros { def impl(c: Context) = { import c.universe._ - val ident = Ident(newTermName("bar")) updateAttachment MyAttachment + val ident = Ident(TermName("bar")) updateAttachment MyAttachment assert(ident.attachments.get[MyAttachment.type].isDefined, ident.attachments) val typed = c.typeCheck(ident) assert(typed.attachments.get[MyAttachment.type].isDefined, typed.attachments) diff --git a/test/files/pos/attributes.scala b/test/files/pos/attributes.scala index ec735d0aae..60e00bff7d 100644 --- a/test/files/pos/attributes.scala +++ b/test/files/pos/attributes.scala @@ -1,3 +1,5 @@ +class serializable extends annotation.StaticAnnotation + @serializable class C1; @serializable @volatile class C2; @serializable @volatile class C3; diff --git a/test/files/pos/chang/Test.scala b/test/files/pos/chang/Test.scala index 9bb745e377..f74c6355b5 100644 --- a/test/files/pos/chang/Test.scala +++ b/test/files/pos/chang/Test.scala @@ -1,3 +1,3 @@ -object Test extends Application { +object Test extends App { new com.netgents.hello.Outer[String] } diff --git a/test/files/pos/cycle-jsoup.flags b/test/files/pos/cycle-jsoup.flags new file mode 100644 index 0000000000..ca20f55172 --- /dev/null +++ b/test/files/pos/cycle-jsoup.flags @@ -0,0 +1 @@ +-Ybreak-cycles diff --git a/test/files/pos/cycle-jsoup.scala b/test/files/pos/cycle-jsoup.scala new file mode 100644 index 0000000000..879e693537 --- /dev/null +++ b/test/files/pos/cycle-jsoup.scala @@ -0,0 +1,5 @@ +object Test { + def main(args : Array[String]) { + org.jsoup.Jsoup.parse(null: java.net.URL, 3000) + } +} diff --git a/test/files/pos/cycle.flags b/test/files/pos/cycle.flags new file mode 100644 index 0000000000..ca20f55172 --- /dev/null +++ b/test/files/pos/cycle.flags @@ -0,0 +1 @@ +-Ybreak-cycles diff --git a/test/files/pos/cycle/J_1.java b/test/files/pos/cycle/J_1.java new file mode 100644 index 0000000000..0cc218eebe --- /dev/null +++ b/test/files/pos/cycle/J_1.java @@ -0,0 +1,16 @@ +package bar; + +public class J_1 { + public void f(C.D arg) { + } +} + +class B extends J_1 { + public void g(C.D arg) { + } +} + +class C extends B { + public class D { + } +} diff --git a/test/files/pos/cycle/X_2.scala b/test/files/pos/cycle/X_2.scala new file mode 100644 index 0000000000..c1840f3b99 --- /dev/null +++ b/test/files/pos/cycle/X_2.scala @@ -0,0 +1,3 @@ +import bar.J_1._ //<--- illegal cyclic reference involving + +class X diff --git a/test/files/pos/depmet_implicit_chaining_zw.scala b/test/files/pos/depmet_implicit_chaining_zw.scala index 93da3b0f8e..ce5ea476d8 100644 --- a/test/files/pos/depmet_implicit_chaining_zw.scala +++ b/test/files/pos/depmet_implicit_chaining_zw.scala @@ -3,7 +3,7 @@ trait Succ[N] trait ZipWith[N, S] { type T - val x: T = error("") + val x: T = sys.error("") } object ZipWith { @@ -15,7 +15,7 @@ object ZipWith { type T = Stream[S] => zWith.T // dependent types replace the associated types functionality } - // can't use implicitly[ZipWith[Succ[Succ[Zero]], Int => String => Boolean]], + // can't use implicitly[ZipWith[Succ[Succ[Zero]], Int => String => Boolean]], // since that will chop of the {type T = ... } refinement in adapt (pt = ZipWith[Succ[Succ[Zero]], Int => String => Boolean]) // this works // def zipWith(implicit zw: ZipWith[Succ[Succ[Zero]], Int => String => Boolean]): zw.T = zw.x @@ -25,4 +25,4 @@ object ZipWith { type _2 = Succ[Succ[Zero]] val zw = ?[ZipWith[_2, Int => String => Boolean]].x // : Stream[Int] => Stream[String] => Stream[Boolean] // val zw = implicitly[ZipWith[Succ[Succ[Zero]], Int => String => Boolean]{type T = Stream[Int] => Stream[String] => Stream[Boolean]}].x -}
\ No newline at end of file +} diff --git a/test/files/pos/depmet_implicit_norm_ret.scala b/test/files/pos/depmet_implicit_norm_ret.scala index bafd2f7c51..0c587cf164 100644 --- a/test/files/pos/depmet_implicit_norm_ret.scala +++ b/test/files/pos/depmet_implicit_norm_ret.scala @@ -1,29 +1,29 @@ object Test{ def ?[S <: AnyRef](implicit w : S) : w.type = w - + // fallback, lower priority (overloading rules apply: pick alternative in subclass lowest in subtyping lattice) class ZipWithDefault { implicit def ZeroZipWith[S] = new ZipWith[S] { type T = Stream[S] - } + } } - + object ZipWith extends ZipWithDefault { // def apply[S: ZipWith](s : S) = ?[ZipWith[S]].zipWith(s) // TODO: bug return type should be inferred def apply[S](s : S)(implicit zw: ZipWith[S]): zw.T = zw.zipWith(s) implicit def SuccZipWith[S,R](implicit zWith : ZipWith[R]) = new ZipWith[S => R] { type T = Stream[S] => zWith.T // dependent types replace the associated types functionality - } + } } - + trait ZipWith[S] { type T - def zipWith : S => T = error("") + def zipWith : S => T = sys.error("") } - + // bug: inferred return type = (Stream[A]) => java.lang.Object with Test.ZipWith[B]{type T = Stream[B]}#T // this seems incompatible with vvvvvvvvvvvvvvvvvvvvvv -- #3731 - def map[A,B](f : A => B) /* : Stream[A] => Stream[B]*/ = ZipWith(f) - val tst: Stream[Int] = map{x: String => x.length}(Stream("a")) -}
\ No newline at end of file + def map[A,B](f : A => B) /* : Stream[A] => Stream[B]*/ = ZipWith(f) + val tst: Stream[Int] = map{x: String => x.length}(Stream("a")) +} diff --git a/test/files/pos/depmet_implicit_oopsla_session_simpler.scala b/test/files/pos/depmet_implicit_oopsla_session_simpler.scala index d2986ef56f..7c9af66611 100644 --- a/test/files/pos/depmet_implicit_oopsla_session_simpler.scala +++ b/test/files/pos/depmet_implicit_oopsla_session_simpler.scala @@ -5,7 +5,7 @@ object Sessions { def run(dp: Dual): Unit } - sealed case class Stop extends Session { + sealed case class Stop() extends Session { type Dual = Stop def run(dp: Dual): Unit = {} diff --git a/test/files/pos/exhaust_2.scala b/test/files/pos/exhaust_2.scala new file mode 100644 index 0000000000..4f4e47c43b --- /dev/null +++ b/test/files/pos/exhaust_2.scala @@ -0,0 +1,54 @@ +object ExhaustivityWarnBugReportMinimal { + //sealed is needed for the warning + sealed trait FoundNode[T]/*presence of parameters is irrelevant*/ + // This also causes a warning: + // sealed abstract class FoundNode[T]/*presence of parameters is irrelevant*/ + case class FoundFilter[T](/*presence of parameters is irrelevant*/) extends FoundNode[T] + case class FoundTypeCase[T](/*presence of parameters is irrelevant*/) extends FoundNode[T] + val f: Some[_] = ??? + f match { + case x: Some[t] => //no warning + } + //With these variants, no warnings: + //val v: (Some[Int], FoundNode[_]) = (???, ???) + //val v: (Some[AnyRef], FoundNode[_]) = (???, ???) + //val v: (Some[String], FoundNode[_]) = (???, ???) + + val v: (Some[_], FoundNode[_]) = (???, ???) + //Warning here: + v match { + case (x: Some[t], _: FoundNode[_]) => + } + v match { + case (x: Some[t], _) => + } + + v match { + case (x: Some[_], _) => + } + case class Foo[T]() + + val vp: (Foo[_], FoundNode[_]) = (???, ???) + vp match { + case (x: Foo[_], _) => + } + + //No warning here: + v match { + case (Some(y), _) => + } + + v match { + case (x, _) => + } + + val v2: (Some[_], Int) = (???, ???) + v2 match { + case (x: Some[t], _) => + } + + val v3: (Option[_], FoundNode[_]) = (???, ???) + v match { + case (x: Option[_], _) => + } +} diff --git a/test/files/pos/implicits-new.scala b/test/files/pos/implicits-new.scala index ffc387132a..7b4f20c6c9 100644 --- a/test/files/pos/implicits-new.scala +++ b/test/files/pos/implicits-new.scala @@ -3,9 +3,9 @@ import scala.reflect.{ClassTag, classTag} // #1435 object t1435 { - implicit def a(s:String):String = error("") - implicit def a(i:Int):String = error("") - implicit def b(i:Int):String = error("") + implicit def a(s:String):String = sys.error("") + implicit def a(i:Int):String = sys.error("") + implicit def b(i:Int):String = sys.error("") } class C1435 { @@ -89,4 +89,4 @@ package foo2709 { // Problem with specs object specsProblem { println(implicitly[TypeTag[Class[_]]]) -}
\ No newline at end of file +} diff --git a/test/files/pos/implicits-old.scala b/test/files/pos/implicits-old.scala index 2c01dd0ba8..62ae6b835c 100644 --- a/test/files/pos/implicits-old.scala +++ b/test/files/pos/implicits-old.scala @@ -1,8 +1,8 @@ // #1435 object t1435 { - implicit def a(s:String):String = error("") - implicit def a(i:Int):String = error("") - implicit def b(i:Int):String = error("") + implicit def a(s:String):String = sys.error("") + implicit def a(i:Int):String = sys.error("") + implicit def b(i:Int):String = sys.error("") } class C1435 { @@ -45,7 +45,7 @@ object Test1625 { implicit def byName[A](x: =>A) = new Wrapped(x) implicit def byVal[A](x: A) = x - + def main(args: Array[String]) = { // val res:Wrapped = 7 // works @@ -57,7 +57,7 @@ object Test1625 { } object Test2188 { - implicit def toJavaList[A: ClassManifest](t:collection.Seq[A]):java.util.List[A] = java.util.Arrays.asList(t.toArray:_*) + implicit def toJavaList[A: ClassManifest](t:collection.Seq[A]):java.util.List[A] = java.util.Arrays.asList(t.toArray:_*) val x: java.util.List[String] = List("foo") } @@ -67,21 +67,21 @@ object TestNumericWidening { val x: java.lang.Long = y } -// #2709 -package foo2709 { - class A - class B - - package object bar { - implicit def a2b(a: A): B = new B - } - - package bar { - object test { - new A: B - } - } -} +// #2709 +package foo2709 { + class A + class B + + package object bar { + implicit def a2b(a: A): B = new B + } + + package bar { + object test { + new A: B + } + } +} // Problem with specs object specsProblem { diff --git a/test/files/pos/infer2-pos.scala b/test/files/pos/infer2-pos.scala index 06d0f5814f..0ed9666f40 100644 --- a/test/files/pos/infer2-pos.scala +++ b/test/files/pos/infer2-pos.scala @@ -1,7 +1,7 @@ package test class Lst[T] case class cons[T](x: T, xs: Lst[T]) extends Lst[T] -case class nil[T] extends Lst[T] +case class nil[T]() extends Lst[T] object test { Console.println(cons(1, nil())) } diff --git a/test/files/pos/javaConversions-2.10-ambiguity.scala b/test/files/pos/javaConversions-2.10-ambiguity.scala new file mode 100644 index 0000000000..c4aad6cbfc --- /dev/null +++ b/test/files/pos/javaConversions-2.10-ambiguity.scala @@ -0,0 +1,10 @@ +import collection.{JavaConversions, mutable, concurrent} +import JavaConversions._ +import java.util.concurrent.{ConcurrentHashMap => CHM} + +object Bar { + def assertType[T](t: T) = t + val a = new CHM[String, String]() += (("", "")) + assertType[concurrent.Map[String, String]](a) +} +// vim: set et: diff --git a/test/files/pos/javaConversions-2.10-regression.scala b/test/files/pos/javaConversions-2.10-regression.scala index e1b81015ba..7c7ff03b55 100644 --- a/test/files/pos/javaConversions-2.10-regression.scala +++ b/test/files/pos/javaConversions-2.10-regression.scala @@ -3,10 +3,10 @@ import JavaConversions._ import java.util.concurrent.{ConcurrentHashMap => CHM} object Foo { - def buildCache2_9_simple[K <: AnyRef, V <: AnyRef]: mutable.ConcurrentMap[K, V] = - asScalaConcurrentMap(new CHM()) + def buildCache2_9_simple[K <: AnyRef, V <: AnyRef]: concurrent.Map[K, V] = + mapAsScalaConcurrentMap(new CHM()) - def buildCache2_9_implicit[K <: AnyRef, V <: AnyRef]: mutable.ConcurrentMap[K, V] = + def buildCache2_9_implicit[K <: AnyRef, V <: AnyRef]: concurrent.Map[K, V] = new CHM[K, V]() } diff --git a/test/files/pos/kinds.scala b/test/files/pos/kinds.scala new file mode 100644 index 0000000000..6d6da0c8b6 --- /dev/null +++ b/test/files/pos/kinds.scala @@ -0,0 +1,13 @@ +trait IllKind1 { + def g(s: String): String = s + def f: String = ??? + def f[C](c: C): String = g(f) +} + +trait IllKind2 { + def b1: Char = ??? + def b2: Byte = ??? + + def f1 = "abc" contains b1 + def f2 = "abc" contains b2 +} diff --git a/test/files/pos/liftcode_polymorphic.scala b/test/files/pos/liftcode_polymorphic.scala index 8f537d278a..249f5a0569 100644 --- a/test/files/pos/liftcode_polymorphic.scala +++ b/test/files/pos/liftcode_polymorphic.scala @@ -1,6 +1,6 @@ import scala.reflect.runtime.universe._ -object Append extends Application { +object Append extends App { def append[A](l1: List[A], l2: List[A]):List[A] = l1 match { diff --git a/test/files/pos/relax_implicit_divergence.scala b/test/files/pos/relax_implicit_divergence.scala index 8525c84bab..f17d0239d8 100644 --- a/test/files/pos/relax_implicit_divergence.scala +++ b/test/files/pos/relax_implicit_divergence.scala @@ -1,7 +1,7 @@ class A(val options: Seq[String]) object Test { - implicit def ss: Equiv[Seq[String]] = error("dummy") - implicit def equivA(implicit seqEq: Equiv[Seq[String]]): Equiv[A] = error("dummy") + implicit def ss: Equiv[Seq[String]] = sys.error("dummy") + implicit def equivA(implicit seqEq: Equiv[Seq[String]]): Equiv[A] = sys.error("dummy") implicitly[Equiv[A]] -}
\ No newline at end of file +} diff --git a/test/files/pos/sealed-final.flags b/test/files/pos/sealed-final.flags new file mode 100644 index 0000000000..cfabf7a5b4 --- /dev/null +++ b/test/files/pos/sealed-final.flags @@ -0,0 +1 @@ +-Xfatal-warnings -Yinline-warnings -optimise
\ No newline at end of file diff --git a/test/files/pos/sealed-final.scala b/test/files/pos/sealed-final.scala new file mode 100644 index 0000000000..bdedb5c1f6 --- /dev/null +++ b/test/files/pos/sealed-final.scala @@ -0,0 +1,14 @@ +sealed abstract class Foo { + @inline def bar(x: Int) = x + 1 +} +object Foo { + def mkFoo(): Foo = new Baz2 +} + +object Baz1 extends Foo +final class Baz2 extends Foo + +object Test { + // bar should be inlined now + def f = Foo.mkFoo() bar 10 +} diff --git a/test/files/pos/simple-exceptions.scala b/test/files/pos/simple-exceptions.scala index 38f2fc8500..a9f16bf90b 100644 --- a/test/files/pos/simple-exceptions.scala +++ b/test/files/pos/simple-exceptions.scala @@ -8,7 +8,7 @@ object Test { try { try { Console.println("hi!") - error("xx") + sys.error("xx") } finally Console.println("ho!") } diff --git a/test/files/pos/spec-Function1.scala b/test/files/pos/spec-Function1.scala index 5b6af67a74..2a3074fd14 100644 --- a/test/files/pos/spec-Function1.scala +++ b/test/files/pos/spec-Function1.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/test/files/pos/spec-annotations.scala b/test/files/pos/spec-annotations.scala index 48281e5df5..b23abf48e8 100644 --- a/test/files/pos/spec-annotations.scala +++ b/test/files/pos/spec-annotations.scala @@ -1,7 +1,7 @@ class ann(i: Int) extends scala.annotation.Annotation // annotations on abstract types -abstract class C1[@serializable @cloneable +T, U, V[_]] +abstract class C1[@annotation.elidable(0) +T, U, V[_]] abstract class C2[@deprecated @ann(1) T <: Number, V] diff --git a/test/files/pos/spec-arrays.scala b/test/files/pos/spec-arrays.scala index 84f6eef071..7ae2cb1efb 100644 --- a/test/files/pos/spec-arrays.scala +++ b/test/files/pos/spec-arrays.scala @@ -177,38 +177,11 @@ class ScalaSpec3Test extends Test { } } -object TestJava extends scala.testing.Benchmark { - def run() { - (new JavaTest).run() - } -} - -object TestSpec extends scala.testing.Benchmark { - def run() { - (new ScalaSpecTest).run() - } -} - -object TestSpec2 extends scala.testing.Benchmark { - def run() { - (new ScalaSpec2Test).run() - } -} - -object TestGen extends scala.testing.Benchmark { - def run() { - (new ScalaGenTest).run() - } -} - -object TestWrap extends scala.testing.Benchmark { - def run() { - (new ScalaWrapTest).run() - } -} - -object TestSpec3 extends scala.testing.Benchmark { - def run() { - (new ScalaSpec3Test).run() - } +object TestRunner { + (new JavaTest).run() + (new ScalaSpecTest).run() + (new ScalaSpec2Test).run() + (new ScalaGenTest).run() + (new ScalaWrapTest).run() + (new ScalaSpec3Test).run() } diff --git a/test/files/pos/spec-asseenfrom.scala b/test/files/pos/spec-asseenfrom.scala index cf20fc5ffa..ede5791709 100644 --- a/test/files/pos/spec-asseenfrom.scala +++ b/test/files/pos/spec-asseenfrom.scala @@ -1,8 +1,8 @@ -class Automaton[@specialized(Double) W,State] { +class Automaton[@specialized(Double) W,State] { - def finalWeight(s: State): W = error("todo"); + def finalWeight(s: State): W = sys.error("todo"); - def allStates: Set[State] = error("toodo"); + def allStates: Set[State] = sys.error("toodo"); /** * Returns a map from states to its final weight. may expand all nodes. diff --git a/test/files/pos/spec-cyclic.scala b/test/files/pos/spec-cyclic.scala index b983caa6db..6cd7685370 100644 --- a/test/files/pos/spec-cyclic.scala +++ b/test/files/pos/spec-cyclic.scala @@ -6,25 +6,25 @@ trait MyPartialFunction[-A, +B] extends AnyRef with AbsFun[A, B] trait ColMap[A, +B] extends MyPartialFunction[A, B] /*with Collection[(A, B)] */ -trait ColSorted[K,+A] extends ColRanged[K,A] +trait ColSorted[K,+A] extends ColRanged[K,A] -trait ColSortedMap[K,+E] extends ColMap[K,E] with ColSorted[K,Tuple2[K,E]] +trait ColSortedMap[K,+E] extends ColMap[K,E] with ColSorted[K,Tuple2[K,E]] trait MutMap[A, B] extends AnyRef with ColMap[A, B] -trait ColRanged[K, +A] //extends Iterable[A] +trait ColRanged[K, +A] //extends Iterable[A] trait JclRanged[K,A] extends ColRanged[K,A] //with MutableIterable[A] { -trait JclMap[K,E] extends /*collection.jcl.MutableIterable[Tuple2[K,E]] with*/ MutMap[K,E] +trait JclMap[K,E] extends /*collection.jcl.MutableIterable[Tuple2[K,E]] with*/ MutMap[K,E] trait JclSorted[K,A] extends ColSorted[K,A] with JclRanged[K,A] trait JclSortedMap[K,E] extends ColSortedMap[K,E] with JclMap[K,E] with JclSorted[K,Tuple2[K,E]] class Foo[A, B] extends JclSortedMap[A, B] { - def apply(x: A): B = error("NYI") + def apply(x: A): B = sys.error("NYI") } class Bar { diff --git a/test/files/pos/spec-funs.scala b/test/files/pos/spec-funs.scala index 611ec0ef62..b9acbe171a 100644 --- a/test/files/pos/spec-funs.scala +++ b/test/files/pos/spec-funs.scala @@ -54,10 +54,7 @@ final class ClosureTest { } } -object TestInt extends scala.testing.Benchmark { - def run() = (new IntTest).run() -} - -object TestClosure extends scala.testing.Benchmark { - def run() = (new ClosureTest).run() +object TestRunner { + (new IntTest).run() + (new ClosureTest).run() } diff --git a/test/files/pos/spec-sealed.scala b/test/files/pos/spec-sealed.scala index 5782930899..d7ecfaaabd 100644 --- a/test/files/pos/spec-sealed.scala +++ b/test/files/pos/spec-sealed.scala @@ -2,13 +2,13 @@ sealed abstract class MyList[@specialized +A] { def head: A def tail: MyList[A] - def ::[@specialized B >: A](x: B): MyList[B] = + def ::[@specialized B >: A](x: B): MyList[B] = new Cons[B](x, this) } case object MyNil extends MyList[Nothing] { - def head = error("nil") - def tail = error("nil") + def head = sys.error("nil") + def tail = sys.error("nil") } case class Cons[@specialized a](private val hd: a, tl: MyList[a]) extends MyList[a] { @@ -19,7 +19,7 @@ case class Cons[@specialized a](private val hd: a, tl: MyList[a]) extends MyList abstract class IntList extends MyList[Int] object Main extends App { - val xs = 1 :: 2 :: 3 :: MyNil + val xs = 1 :: 2 :: 3 :: MyNil println(xs) } diff --git a/test/files/pos/spec-sparsearray-new.scala b/test/files/pos/spec-sparsearray-new.scala index 7b3934c476..df31089fe2 100644 --- a/test/files/pos/spec-sparsearray-new.scala +++ b/test/files/pos/spec-sparsearray-new.scala @@ -4,7 +4,7 @@ import scala.collection.mutable.MapLike 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")) + if(ind < 0) None else Some(sys.error("ignore")) } /** @@ -13,13 +13,13 @@ class SparseArray[@specialized(Int) T:ClassTag] extends collection.mutable.Map[I * negative and can be converted into an insertion point with -(rv+1). */ private def findOffset(i : Int) : Int = { - error("impl doesn't matter") + sys.error("impl doesn't matter") } - override def apply(i : Int) : T = { error("ignore") } - override def update(i : Int, value : T) = error("ignore") + override def apply(i : Int) : T = { sys.error("ignore") } + override def update(i : Int, value : T) = sys.error("ignore") override def empty = new SparseArray[T] - def -=(ind: Int) = error("ignore") - def +=(kv: (Int,T)) = error("ignore") - override final def iterator = error("ignore") -}
\ No newline at end of file + def -=(ind: Int) = sys.error("ignore") + def +=(kv: (Int,T)) = sys.error("ignore") + override final def iterator = sys.error("ignore") +} diff --git a/test/files/pos/spec-sparsearray-old.scala b/test/files/pos/spec-sparsearray-old.scala index ea7710a785..e10dabd542 100644 --- a/test/files/pos/spec-sparsearray-old.scala +++ b/test/files/pos/spec-sparsearray-old.scala @@ -3,7 +3,7 @@ import scala.collection.mutable.MapLike class SparseArray[@specialized(Int) T:ClassManifest] 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")) + if(ind < 0) None else Some(sys.error("ignore")) } /** @@ -12,13 +12,13 @@ class SparseArray[@specialized(Int) T:ClassManifest] extends collection.mutable. * negative and can be converted into an insertion point with -(rv+1). */ private def findOffset(i : Int) : Int = { - error("impl doesn't matter") + sys.error("impl doesn't matter") } - override def apply(i : Int) : T = { error("ignore") } - override def update(i : Int, value : T) = error("ignore") + override def apply(i : Int) : T = { sys.error("ignore") } + override def update(i : Int, value : T) = sys.error("ignore") override def empty = new SparseArray[T] - def -=(ind: Int) = error("ignore") - def +=(kv: (Int,T)) = error("ignore") - override final def iterator = error("ignore") + def -=(ind: Int) = sys.error("ignore") + def +=(kv: (Int,T)) = sys.error("ignore") + override final def iterator = sys.error("ignore") } diff --git a/test/files/pos/spec-traits.scala b/test/files/pos/spec-traits.scala index c6cc2921b7..074f6c3d3c 100644 --- a/test/files/pos/spec-traits.scala +++ b/test/files/pos/spec-traits.scala @@ -11,19 +11,19 @@ class Lazy { // issue 3307 class Bug3307 { - def f[Z](block: String => Z) { - block("abc") + def f[Z](block: String => Z) { + block("abc") } - - ({ () => - f { implicit x => println(x) } })() + + ({ () => + f { implicit x => println(x) } })() } // issue 3301 trait T[X] class Bug3301 { - def t[A]: T[A] = error("stub") + def t[A]: T[A] = sys.error("stub") () => { type X = Int diff --git a/test/files/pos/super.cmds b/test/files/pos/super.cmds deleted file mode 100644 index 8f3f8a4172..0000000000 --- a/test/files/pos/super.cmds +++ /dev/null @@ -1,2 +0,0 @@ -javac Super_1.java -scalac Super_2.scala diff --git a/test/files/pos/switch-small.flags b/test/files/pos/switch-small.flags new file mode 100644 index 0000000000..85d8eb2ba2 --- /dev/null +++ b/test/files/pos/switch-small.flags @@ -0,0 +1 @@ +-Xfatal-warnings diff --git a/test/files/pos/t0031.scala b/test/files/pos/t0031.scala index ec6eae9282..d4050c8184 100644 --- a/test/files/pos/t0031.scala +++ b/test/files/pos/t0031.scala @@ -4,17 +4,17 @@ object Main { def ensure(postcondition: a => Boolean): a } - def require[a](precondition: => Boolean)(command: => a): Ensure[a] = + def require[a](precondition: => Boolean)(command: => a): Ensure[a] = if (precondition) new Ensure[a] { def ensure(postcondition: a => Boolean): a = { val result = command; if (postcondition(result)) result - else error("Assertion error") + else sys.error("Assertion error") } } else - error("Assertion error"); + sys.error("Assertion error"); def arb[a](s: List[a]) = require (! s.isEmpty) { diff --git a/test/files/pos/t0227.scala b/test/files/pos/t0227.scala index 8650350c4a..806b20d409 100644 --- a/test/files/pos/t0227.scala +++ b/test/files/pos/t0227.scala @@ -5,7 +5,7 @@ final class Settings { abstract class Factory { type libraryType <: Base - final def apply(settings: Settings): libraryType = error("bla") + final def apply(settings: Settings): libraryType = sys.error("bla") } abstract class Base { @@ -19,7 +19,7 @@ class SA(val settings: Settings) extends Base { SD ) ::: settings.f( SC - ) + ) } object SC extends Factory { diff --git a/test/files/pos/t0301.scala b/test/files/pos/t0301.scala index cb68f38062..24b4776010 100644 --- a/test/files/pos/t0301.scala +++ b/test/files/pos/t0301.scala @@ -1,7 +1,7 @@ package fos abstract class Expr -case class Var extends Expr +case class Var() extends Expr object Analyzer { def substitution(expr: Expr, cls: (Var,Var)): Expr = diff --git a/test/files/pos/t0422.scala b/test/files/pos/t0422.scala index cb3ba279d4..2adfa392d2 100644 --- a/test/files/pos/t0422.scala +++ b/test/files/pos/t0422.scala @@ -1,5 +1,4 @@ -import scala.util.regexp.WordExp; -import scala.util.automata.WordBerrySethi; +package scala.xml.dtd.impl object BoolWordExp extends WordExp { type _labelT = MyLabels; diff --git a/test/files/pos/t0851.scala b/test/files/pos/t0851.scala new file mode 100644 index 0000000000..fc7109dcd4 --- /dev/null +++ b/test/files/pos/t0851.scala @@ -0,0 +1,14 @@ +package test + +object test1 { + case class Foo[T,T2](f : (T,T2) => String) extends (((T,T2)) => String){ + def apply(t : T) = (s:T2) => f(t,s) + def apply(p : (T,T2)) = f(p._1,p._2) + } + implicit def g[T](f : (T,String) => String) = Foo(f) + def main(args : Array[String]) : Unit = { + val f = (x:Int,s:String) => s + x + println(f(1)) + () + } +} diff --git a/test/files/pos/t0872.scala b/test/files/pos/t0872.scala new file mode 100644 index 0000000000..8f4c1c4436 --- /dev/null +++ b/test/files/pos/t0872.scala @@ -0,0 +1,8 @@ +object Main { + def main(args : Array[String]) { + val fn = (a : Int, str : String) => "a: " + a + ", str: " + str + implicit def fx[T](f : (T,String) => String) = (x:T) => f(x,null) + println(fn(1)) + () + } +} diff --git a/test/files/pos/t1029.cmds b/test/files/pos/t1029.cmds deleted file mode 100644 index 06b863dc03..0000000000 --- a/test/files/pos/t1029.cmds +++ /dev/null @@ -1,2 +0,0 @@ -scalac Test_1.scala -scalac Test_2.scala diff --git a/test/files/pos/t1107.scala b/test/files/pos/t1107a.scala index 0bf40bb4cc..0bf40bb4cc 100644 --- a/test/files/pos/t1107.scala +++ b/test/files/pos/t1107a.scala diff --git a/test/files/pos/t1203.scala b/test/files/pos/t1203a.scala index 062ef93fc6..062ef93fc6 100644 --- a/test/files/pos/t1203.scala +++ b/test/files/pos/t1203a.scala diff --git a/test/files/pos/t1230/S.scala b/test/files/pos/t1230/S.scala index f8a691b6de..530dd4b853 100644 --- a/test/files/pos/t1230/S.scala +++ b/test/files/pos/t1230/S.scala @@ -1 +1 @@ -object S extends Application { (new J).foo = 5 } +object S extends App { (new J).foo = 5 } diff --git a/test/files/pos/t1231/S.scala b/test/files/pos/t1231/S.scala index ee08866e04..f14aa2561b 100644 --- a/test/files/pos/t1231/S.scala +++ b/test/files/pos/t1231/S.scala @@ -1 +1 @@ -object S extends Application { println(J.j1) } +object S extends App { println(J.j1) } diff --git a/test/files/pos/t1385.scala b/test/files/pos/t1385.scala index 59953bcc39..6fe7308281 100644 --- a/test/files/pos/t1385.scala +++ b/test/files/pos/t1385.scala @@ -1,3 +1,3 @@ -@serializable object Test { - private def readResolve:AnyRef = this +object Test extends Serializable { + private def readResolve: AnyRef = this } diff --git a/test/files/pos/t1439.flags b/test/files/pos/t1439.flags index 1e70f5c5c7..bca57e4785 100644 --- a/test/files/pos/t1439.flags +++ b/test/files/pos/t1439.flags @@ -1 +1 @@ --unchecked -Xfatal-warnings -Xoldpatmat -language:higherKinds +-unchecked -Xfatal-warnings -language:higherKinds diff --git a/test/files/pos/t1648.scala b/test/files/pos/t1648.scala deleted file mode 100644 index 6d53ce11ee..0000000000 --- a/test/files/pos/t1648.scala +++ /dev/null @@ -1,4 +0,0 @@ -object Test { - class MyClass extends scala.util.logging.Logged { } - val x = new MyClass with scala.util.logging.ConsoleLogger -} diff --git a/test/files/pos/t1751/A1_2.scala b/test/files/pos/t1751/A1_2.scala new file mode 100644 index 0000000000..354d5eecd0 --- /dev/null +++ b/test/files/pos/t1751/A1_2.scala @@ -0,0 +1,2 @@ +@SuiteClasses(Array(classOf[A2])) +class A1 diff --git a/test/files/pos/t1751/A2_1.scala b/test/files/pos/t1751/A2_1.scala new file mode 100644 index 0000000000..c768062e43 --- /dev/null +++ b/test/files/pos/t1751/A2_1.scala @@ -0,0 +1,2 @@ +@SuiteClasses(Array()) +class A2 diff --git a/test/files/pos/t1751/SuiteClasses.java b/test/files/pos/t1751/SuiteClasses.java new file mode 100644 index 0000000000..a415e4f572 --- /dev/null +++ b/test/files/pos/t1751/SuiteClasses.java @@ -0,0 +1,3 @@ +public @interface SuiteClasses { + public Class<?>[] value(); +} diff --git a/test/files/pos/t1782/Ann.java b/test/files/pos/t1782/Ann.java new file mode 100644 index 0000000000..0dcfbd2ed7 --- /dev/null +++ b/test/files/pos/t1782/Ann.java @@ -0,0 +1,3 @@ +public @interface Ann { + public Days value(); +} diff --git a/test/files/pos/t1782/Days.java b/test/files/pos/t1782/Days.java new file mode 100644 index 0000000000..203a87b1c2 --- /dev/null +++ b/test/files/pos/t1782/Days.java @@ -0,0 +1,3 @@ +public enum Days { + Friday, Sunday +} diff --git a/test/files/pos/t1782/ImplementedBy.java b/test/files/pos/t1782/ImplementedBy.java new file mode 100644 index 0000000000..6aa8b4fa9e --- /dev/null +++ b/test/files/pos/t1782/ImplementedBy.java @@ -0,0 +1,3 @@ +public @interface ImplementedBy { + public Class<?> value(); +} diff --git a/test/files/pos/t1782/Test_1.scala b/test/files/pos/t1782/Test_1.scala new file mode 100644 index 0000000000..6467a74c29 --- /dev/null +++ b/test/files/pos/t1782/Test_1.scala @@ -0,0 +1,16 @@ +@ImplementedBy(classOf[Provider]) +trait Service { + def someMethod() +} + +class Provider + extends Service +{ + // test enumeration java annotations + @Ann(Days.Friday) def someMethod() = () + + // #2103 + @scala.beans.BeanProperty + @Ann(value = Days.Sunday) + val t2103 = "test" +} diff --git a/test/files/pos/t1942.cmds b/test/files/pos/t1942.cmds deleted file mode 100644 index c14311042a..0000000000 --- a/test/files/pos/t1942.cmds +++ /dev/null @@ -1,2 +0,0 @@ -scalac A_1.scala -scalac Test_2.scala diff --git a/test/files/pos/t2331.scala b/test/files/pos/t2331.scala index 9a15b5c2a9..a7f80ac98e 100644 --- a/test/files/pos/t2331.scala +++ b/test/files/pos/t2331.scala @@ -4,8 +4,8 @@ trait C { object Test { val o /*: C --> no crash*/ = new C { - def m[T]: Nothing /*: T --> no crash*/ = error("omitted") + def m[T]: Nothing /*: T --> no crash*/ = sys.error("omitted") } o.m[Nothing] -}
\ No newline at end of file +} diff --git a/test/files/pos/t2421.scala b/test/files/pos/t2421.scala index 26e485c160..2544a1cb36 100644 --- a/test/files/pos/t2421.scala +++ b/test/files/pos/t2421.scala @@ -1,14 +1,14 @@ object Test { abstract class <~<[-From, +To] extends (From => To) - implicit def trivial[A]: A <~< A = error("") + implicit def trivial[A]: A <~< A = sys.error("") trait Forcible[T] - implicit val forcibleInt: (Int <~< Forcible[Int]) = error("") + implicit val forcibleInt: (Int <~< Forcible[Int]) = sys.error("") - def headProxy[P <: Forcible[Int]](implicit w: Int <~< P): P = error("") - - headProxy - // trivial[Int] should not be considered a valid implicit, since w would have type Int <~< Int, + def headProxy[P <: Forcible[Int]](implicit w: Int <~< P): P = sys.error("") + + headProxy + // trivial[Int] should not be considered a valid implicit, since w would have type Int <~< Int, // and headProxy's type parameter P cannot be instantiated to Int -}
\ No newline at end of file +} diff --git a/test/files/pos/t2421b_pos.scala b/test/files/pos/t2421b_pos.scala index 8b848abb75..0df3461662 100644 --- a/test/files/pos/t2421b_pos.scala +++ b/test/files/pos/t2421b_pos.scala @@ -11,7 +11,7 @@ object Test { f } -/* bug: +/* bug: error: ambiguous implicit values: both method b in object Test1 of type [X <: Test1.B]Test1.F[X] and method a in object Test1 of type => Test1.F[Test1.A] diff --git a/test/files/pos/t2429.scala b/test/files/pos/t2429.scala index 3ea3f9e2a5..550681b6a2 100755 --- a/test/files/pos/t2429.scala +++ b/test/files/pos/t2429.scala @@ -1,10 +1,10 @@ object Msg { trait T - + trait TSeq - + object TSeq { - implicit def fromSeq(s: Seq[T]): TSeq = error("stub") + implicit def fromSeq(s: Seq[T]): TSeq = sys.error("stub") } def render { @@ -12,7 +12,7 @@ object Msg { case (a, b) => { a match { case _ => b match { - case _ => error("stub") + case _ => sys.error("stub") } } } @@ -20,6 +20,6 @@ object Msg { } } object Oops { - implicit def someImplicit(s: Seq[_]): String = error("stub") + implicit def someImplicit(s: Seq[_]): String = sys.error("stub") def item: String = Nil map { case e: Any => e } } diff --git a/test/files/pos/t2464.cmds b/test/files/pos/t2464.cmds deleted file mode 100644 index ca733ef23d..0000000000 --- a/test/files/pos/t2464.cmds +++ /dev/null @@ -1,3 +0,0 @@ -javac JavaOne.java -scalac ScalaOne_1.scala -scalac t2464_2.scala diff --git a/test/files/pos/t2484.scala b/test/files/pos/t2484.scala index 7d1b7cb03c..29f798edf9 100755 --- a/test/files/pos/t2484.scala +++ b/test/files/pos/t2484.scala @@ -1,7 +1,9 @@ +import concurrent.ExecutionContext.Implicits.global + class Admin extends javax.swing.JApplet { val jScrollPane = new javax.swing.JScrollPane (null, 0, 0) def t2484: Unit = { - scala.concurrent.ops.spawn {jScrollPane.synchronized { + scala.concurrent.future {jScrollPane.synchronized { def someFunction () = {} //scala.concurrent.ops.spawn {someFunction ()} jScrollPane.addComponentListener (new java.awt.event.ComponentAdapter {override def componentShown (e: java.awt.event.ComponentEvent) = { diff --git a/test/files/pos/t2698.scala b/test/files/pos/t2698.scala index 0e2662de61..7de50a13d6 100644 --- a/test/files/pos/t2698.scala +++ b/test/files/pos/t2698.scala @@ -1,5 +1,6 @@ +package scala.xml.dtd.impl + import scala.collection._ -import scala.util.regexp._ abstract class S2 { val lang: WordExp diff --git a/test/files/pos/t2726.cmds b/test/files/pos/t2726.cmds deleted file mode 100644 index 5fcb18bfbb..0000000000 --- a/test/files/pos/t2726.cmds +++ /dev/null @@ -1,2 +0,0 @@ -scalac SQLBuilder_1.scala -scalac test_2.scala diff --git a/test/files/pos/t2797.scala b/test/files/pos/t2797.scala index 4323664e91..cf579d8de4 100644 --- a/test/files/pos/t2797.scala +++ b/test/files/pos/t2797.scala @@ -1,9 +1,9 @@ class MyVector[A] { - def map[B](f: A => B): MyVector[B] = error("") + def map[B](f: A => B): MyVector[B] = sys.error("") } object Test { def unzip[B, C](_this: MyVector[(B, C)]): (MyVector[B], MyVector[C]) = { (_this.map{ bc => bc._1 }, _this.map{ bc => bc._2 }) } -}
\ No newline at end of file +} diff --git a/test/files/pos/t294/Ann.java b/test/files/pos/t294/Ann.java new file mode 100644 index 0000000000..934ca46297 --- /dev/null +++ b/test/files/pos/t294/Ann.java @@ -0,0 +1,3 @@ +public @interface Ann { + public Ann2[] nested(); +} diff --git a/test/files/pos/t294/Ann2.java b/test/files/pos/t294/Ann2.java new file mode 100644 index 0000000000..025b79e794 --- /dev/null +++ b/test/files/pos/t294/Ann2.java @@ -0,0 +1,3 @@ +public @interface Ann2 { + public int value(); +} diff --git a/test/files/pos/t294/Test_1.scala b/test/files/pos/t294/Test_1.scala new file mode 100644 index 0000000000..ff1f34b10e --- /dev/null +++ b/test/files/pos/t294/Test_1.scala @@ -0,0 +1,7 @@ +// also test pickling of java annotations; Test_2.scala will +// read this class file +@Ann(nested = Array(new Ann2(10))) class Test { + @Ann2(100) var ctx: Object = _ + @Ann(nested = Array()) def foo = 10 + @Ann(nested = Array(new Ann2(10), new Ann2(23))) val bam = -3 +} diff --git a/test/files/pos/t294/Test_2.scala b/test/files/pos/t294/Test_2.scala new file mode 100644 index 0000000000..9fb1c6e175 --- /dev/null +++ b/test/files/pos/t294/Test_2.scala @@ -0,0 +1 @@ +class Test2 extends Test diff --git a/test/files/pos/t3108.scala b/test/files/pos/t3108.scala deleted file mode 100644 index 6a1da73220..0000000000 --- a/test/files/pos/t3108.scala +++ /dev/null @@ -1,5 +0,0 @@ -object A { - val a: NotNull = "" - val b: NotNull = 41 -} - diff --git a/test/files/pos/t3152.scala b/test/files/pos/t3152.scala index a20428dbee..3d1dcbd6f0 100644 --- a/test/files/pos/t3152.scala +++ b/test/files/pos/t3152.scala @@ -1,13 +1,13 @@ trait Applicative[M[_]] sealed trait MA[M[_], A] { - def sequence[N[_], B](implicit a: A <:< N[B], n: Applicative[N]): N[M[B]] = error("stub") - // def sequence3[N[_], B]()(implicit a: A <:< N[B], n: Applicative[N]): N[M[B]] = error("stub") + def sequence[N[_], B](implicit a: A <:< N[B], n: Applicative[N]): N[M[B]] = sys.error("stub") + // def sequence3[N[_], B]()(implicit a: A <:< N[B], n: Applicative[N]): N[M[B]] = sys.error("stub") } object test { - implicit def ListMA[A](l: List[A]): MA[List, A] = error("stub") - implicit val ao: Applicative[Option] = error("stub") + implicit def ListMA[A](l: List[A]): MA[List, A] = sys.error("stub") + implicit val ao: Applicative[Option] = sys.error("stub") /* This compiles OK: (Nil: List[Option[Int]]).sequence3(): Option[List[Int]] @@ -17,4 +17,4 @@ object test { // !!! No line number is reported with the error (Nil: List[Option[Int]]).sequence: Option[List[Int]] (List[Option[Int]]()).sequence: Option[List[Int]] -}
\ No newline at end of file +} diff --git a/test/files/pos/t3160.scala b/test/files/pos/t3160.scala new file mode 100644 index 0000000000..3309ece160 --- /dev/null +++ b/test/files/pos/t3160.scala @@ -0,0 +1,6 @@ +import scala.collection.mutable._ +import scala.xml._ + +class A { + def f(x: Node): Node = ??? +} diff --git a/test/files/pos/t3252.scala b/test/files/pos/t3252.scala index 4b8e862714..3ecc1e7cef 100644 --- a/test/files/pos/t3252.scala +++ b/test/files/pos/t3252.scala @@ -8,8 +8,8 @@ class A { } } - private def g[T](block : => T) = error("") + private def g[T](block : => T) = sys.error("") } object B { - def h(block : => Unit) : Nothing = error("") -}
\ No newline at end of file + def h(block : => Unit) : Nothing = sys.error("") +} diff --git a/test/files/pos/t3349/Test.scala b/test/files/pos/t3349/Test.scala index 8174e4c4f8..595beadc20 100644 --- a/test/files/pos/t3349/Test.scala +++ b/test/files/pos/t3349/Test.scala @@ -1,5 +1,5 @@ object Test { val label = "name" - val table: Table = error("") + val table: Table = sys.error("") table.addColumn( label, label.getClass ) -}
\ No newline at end of file +} diff --git a/test/files/pos/t3363-new.scala b/test/files/pos/t3363-new.scala index e609f4d55f..fef2bf8a72 100644 --- a/test/files/pos/t3363-new.scala +++ b/test/files/pos/t3363-new.scala @@ -9,7 +9,7 @@ object TestCase { //if you inherit from MapOps[T] instead of MapOps[F] then code compiles fine implicit def map2ops[T,F](fs: Map[T,F]) = new MapOps[F] { //if you remove this line, then code compiles - lazy val m: TypeTag[T] = error("just something to make it compile") + lazy val m: TypeTag[T] = sys.error("just something to make it compile") def is(xs: List[T]) = List(xs) } @@ -17,4 +17,4 @@ object TestCase { println(Map(1 -> "2") is List(2)) } - }
\ No newline at end of file + } diff --git a/test/files/pos/t3363-old.scala b/test/files/pos/t3363-old.scala index bae54084ea..c08cf2a6b6 100644 --- a/test/files/pos/t3363-old.scala +++ b/test/files/pos/t3363-old.scala @@ -7,7 +7,7 @@ object TestCase { //if you inherit from MapOps[T] instead of MapOps[F] then code compiles fine implicit def map2ops[T,F](fs: Map[T,F]) = new MapOps[F] { //if you remove this line, then code compiles - lazy val m: Manifest[T] = error("just something to make it compile") + lazy val m: Manifest[T] = sys.error("just something to make it compile") def is(xs: List[T]) = List(xs) } diff --git a/test/files/pos/t3417.scala b/test/files/pos/t3417.scala deleted file mode 100644 index d2de1608aa..0000000000 --- a/test/files/pos/t3417.scala +++ /dev/null @@ -1,11 +0,0 @@ -trait X extends NotNull { - def foo = 1 -} - -trait Y extends Object with NotNull { - def bar = 1 -} - -class Z extends NotNull - -class W extends Object with NotNull diff --git a/test/files/pos/t342.scala b/test/files/pos/t342.scala deleted file mode 100644 index 752b24d2ba..0000000000 --- a/test/files/pos/t342.scala +++ /dev/null @@ -1,8 +0,0 @@ -object Main extends App { - - object Foo extends Enumeration(0, "Bar") { // 2 - val Bar = Value - } - import Foo._; - Console.println(Bar) -} diff --git a/test/files/pos/t344.scala b/test/files/pos/t344.scala index 8a6ad9120d..449a763af7 100644 --- a/test/files/pos/t344.scala +++ b/test/files/pos/t344.scala @@ -1,7 +1,7 @@ object Bug { class A; - case class A1 extends A; - case class A2 extends A; + case class A1() extends A; + case class A2() extends A; def f: A = if (true) A1() diff --git a/test/files/pos/t3440.scala b/test/files/pos/t3440.scala index 46bba1b207..0e7ca6b70f 100644 --- a/test/files/pos/t3440.scala +++ b/test/files/pos/t3440.scala @@ -4,15 +4,15 @@ object test { } case object Int8 extends SampleFormat1 { - def readerFactory = error("") + def readerFactory = sys.error("") } case object Int16 extends SampleFormat1 { - def readerFactory = error("") + def readerFactory = sys.error("") } - + (new {}: Any) match { case 8 => Int8 case 16 => Int16 - case _ => error("") + case _ => sys.error("") } -}
\ No newline at end of file +} diff --git a/test/files/pos/t3477.scala b/test/files/pos/t3477.scala index 660aa55736..6a94baa6c8 100644 --- a/test/files/pos/t3477.scala +++ b/test/files/pos/t3477.scala @@ -1,7 +1,7 @@ class J3 { - def f[K, K1 >: K, V](x: Map[K1, V]): Map[K, V] = error("") + def f[K, K1 >: K, V](x: Map[K1, V]): Map[K, V] = sys.error("") } object Test { (new J3).f(Map[Int, Int]()) -}
\ No newline at end of file +} diff --git a/test/files/pos/t3631.scala b/test/files/pos/t3631.scala new file mode 100644 index 0000000000..bcf91619ee --- /dev/null +++ b/test/files/pos/t3631.scala @@ -0,0 +1,3 @@ +case class X22(x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int, x15: Int, x16: Int, x17: Int, x18: Int, x19: Int, x20: Int, x21: Int, x22: Int) { } + +case class X23(x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int, x15: Int, x16: Int, x17: Int, x18: Int, x19: Int, x20: Int, x21: Int, x22: Int, x23: Int) { }
\ No newline at end of file diff --git a/test/files/pos/t3731.scala b/test/files/pos/t3731.scala index 75938540c0..7a3cbec0f4 100644 --- a/test/files/pos/t3731.scala +++ b/test/files/pos/t3731.scala @@ -1,8 +1,8 @@ object Test{ trait ZW[S]{type T} - def ZipWith[S, M <: ZW[S]]: M#T = error("ZW") + def ZipWith[S, M <: ZW[S]]: M#T = sys.error("ZW") - // meh must be parameterised to force an asSeenFrom that + // meh must be parameterised to force an asSeenFrom that // duplicates the refinement in the TR's pre without updating its sym def meh[A] = ZipWith[A, ZW[A]{type T=Stream[A]}] diff --git a/test/files/pos/t3864/tuples_1.scala b/test/files/pos/t3864/tuples_1.scala index 1d19af6e41..5e97f8452b 100644 --- a/test/files/pos/t3864/tuples_1.scala +++ b/test/files/pos/t3864/tuples_1.scala @@ -1,11 +1,11 @@ -trait PimpedType[X] { +trait EnrichedType[X] { val value: X } trait Tuples { - -trait Tuple15W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O] extends PimpedType[Tuple15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O]] { + +trait Tuple15W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O] extends EnrichedType[Tuple15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O]] { def fold[Z](f: => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) => Z): Z = {import value._; f(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15)} def toIndexedSeq[Z](implicit ev: value.type <:< Tuple15[Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z]): IndexedSeq[Z] = {val zs = ev(value); import zs._; IndexedSeq(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15)} def mapElements[AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO](_1: (A => AA) = identity[A] _, _2: (B => BB) = identity[B] _, _3: (C => CC) = identity[C] _, _4: (D => DD) = identity[D] _, _5: (E => EE) = identity[E] _, _6: (F => FF) = identity[F] _, _7: (G => GG) = identity[G] _, _8: (H => HH) = identity[H] _, _9: (I => II) = identity[I] _, _10: (J => JJ) = identity[J] _, _11: (K => KK) = identity[K] _, _12: (L => LL) = identity[L] _, _13: (M => MM) = identity[M] _, _14: (N => NN) = identity[N] _, _15: (O => OO) = identity[O] _): (AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO) = (_1(value._1), _2(value._2), _3(value._3), _4(value._4), _5(value._5), _6(value._6), _7(value._7), _8(value._8), _9(value._9), _10(value._10), _11(value._11), _12(value._12), _13(value._13), _14(value._14), _15(value._15)) @@ -13,8 +13,8 @@ trait Tuple15W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O] extends PimpedType[T implicit def ToTuple15W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O](t: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)): Tuple15W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O] = new { val value = t } with Tuple15W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O] - -trait Tuple16W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P] extends PimpedType[Tuple16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P]] { + +trait Tuple16W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P] extends EnrichedType[Tuple16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P]] { def fold[Z](f: => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) => Z): Z = {import value._; f(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16)} def toIndexedSeq[Z](implicit ev: value.type <:< Tuple16[Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z]): IndexedSeq[Z] = {val zs = ev(value); import zs._; IndexedSeq(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16)} def mapElements[AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP](_1: (A => AA) = identity[A] _, _2: (B => BB) = identity[B] _, _3: (C => CC) = identity[C] _, _4: (D => DD) = identity[D] _, _5: (E => EE) = identity[E] _, _6: (F => FF) = identity[F] _, _7: (G => GG) = identity[G] _, _8: (H => HH) = identity[H] _, _9: (I => II) = identity[I] _, _10: (J => JJ) = identity[J] _, _11: (K => KK) = identity[K] _, _12: (L => LL) = identity[L] _, _13: (M => MM) = identity[M] _, _14: (N => NN) = identity[N] _, _15: (O => OO) = identity[O] _, _16: (P => PP) = identity[P] _): (AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP) = (_1(value._1), _2(value._2), _3(value._3), _4(value._4), _5(value._5), _6(value._6), _7(value._7), _8(value._8), _9(value._9), _10(value._10), _11(value._11), _12(value._12), _13(value._13), _14(value._14), _15(value._15), _16(value._16)) @@ -22,8 +22,8 @@ trait Tuple16W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P] extends PimpedTyp implicit def ToTuple16W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P](t: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)): Tuple16W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P] = new { val value = t } with Tuple16W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P] - -trait Tuple17W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q] extends PimpedType[Tuple17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q]] { + +trait Tuple17W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q] extends EnrichedType[Tuple17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q]] { def fold[Z](f: => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) => Z): Z = {import value._; f(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17)} def toIndexedSeq[Z](implicit ev: value.type <:< Tuple17[Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z]): IndexedSeq[Z] = {val zs = ev(value); import zs._; IndexedSeq(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17)} def mapElements[AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ](_1: (A => AA) = identity[A] _, _2: (B => BB) = identity[B] _, _3: (C => CC) = identity[C] _, _4: (D => DD) = identity[D] _, _5: (E => EE) = identity[E] _, _6: (F => FF) = identity[F] _, _7: (G => GG) = identity[G] _, _8: (H => HH) = identity[H] _, _9: (I => II) = identity[I] _, _10: (J => JJ) = identity[J] _, _11: (K => KK) = identity[K] _, _12: (L => LL) = identity[L] _, _13: (M => MM) = identity[M] _, _14: (N => NN) = identity[N] _, _15: (O => OO) = identity[O] _, _16: (P => PP) = identity[P] _, _17: (Q => QQ) = identity[Q] _): (AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ) = (_1(value._1), _2(value._2), _3(value._3), _4(value._4), _5(value._5), _6(value._6), _7(value._7), _8(value._8), _9(value._9), _10(value._10), _11(value._11), _12(value._12), _13(value._13), _14(value._14), _15(value._15), _16(value._16), _17(value._17)) @@ -31,8 +31,8 @@ trait Tuple17W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q] extends Pimped implicit def ToTuple17W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q](t: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)): Tuple17W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q] = new { val value = t } with Tuple17W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q] - -trait Tuple18W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R] extends PimpedType[Tuple18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R]] { + +trait Tuple18W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R] extends EnrichedType[Tuple18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R]] { def fold[Z](f: => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) => Z): Z = {import value._; f(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18)} def toIndexedSeq[Z](implicit ev: value.type <:< Tuple18[Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z]): IndexedSeq[Z] = {val zs = ev(value); import zs._; IndexedSeq(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18)} def mapElements[AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR](_1: (A => AA) = identity[A] _, _2: (B => BB) = identity[B] _, _3: (C => CC) = identity[C] _, _4: (D => DD) = identity[D] _, _5: (E => EE) = identity[E] _, _6: (F => FF) = identity[F] _, _7: (G => GG) = identity[G] _, _8: (H => HH) = identity[H] _, _9: (I => II) = identity[I] _, _10: (J => JJ) = identity[J] _, _11: (K => KK) = identity[K] _, _12: (L => LL) = identity[L] _, _13: (M => MM) = identity[M] _, _14: (N => NN) = identity[N] _, _15: (O => OO) = identity[O] _, _16: (P => PP) = identity[P] _, _17: (Q => QQ) = identity[Q] _, _18: (R => RR) = identity[R] _): (AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR) = (_1(value._1), _2(value._2), _3(value._3), _4(value._4), _5(value._5), _6(value._6), _7(value._7), _8(value._8), _9(value._9), _10(value._10), _11(value._11), _12(value._12), _13(value._13), _14(value._14), _15(value._15), _16(value._16), _17(value._17), _18(value._18)) @@ -40,8 +40,8 @@ trait Tuple18W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R] extends Pim implicit def ToTuple18W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R](t: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)): Tuple18W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R] = new { val value = t } with Tuple18W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R] - -trait Tuple19W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S] extends PimpedType[Tuple19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S]] { + +trait Tuple19W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S] extends EnrichedType[Tuple19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S]] { def fold[Z](f: => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) => Z): Z = {import value._; f(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19)} def toIndexedSeq[Z](implicit ev: value.type <:< Tuple19[Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z]): IndexedSeq[Z] = {val zs = ev(value); import zs._; IndexedSeq(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19)} def mapElements[AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR, SS](_1: (A => AA) = identity[A] _, _2: (B => BB) = identity[B] _, _3: (C => CC) = identity[C] _, _4: (D => DD) = identity[D] _, _5: (E => EE) = identity[E] _, _6: (F => FF) = identity[F] _, _7: (G => GG) = identity[G] _, _8: (H => HH) = identity[H] _, _9: (I => II) = identity[I] _, _10: (J => JJ) = identity[J] _, _11: (K => KK) = identity[K] _, _12: (L => LL) = identity[L] _, _13: (M => MM) = identity[M] _, _14: (N => NN) = identity[N] _, _15: (O => OO) = identity[O] _, _16: (P => PP) = identity[P] _, _17: (Q => QQ) = identity[Q] _, _18: (R => RR) = identity[R] _, _19: (S => SS) = identity[S] _): (AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR, SS) = (_1(value._1), _2(value._2), _3(value._3), _4(value._4), _5(value._5), _6(value._6), _7(value._7), _8(value._8), _9(value._9), _10(value._10), _11(value._11), _12(value._12), _13(value._13), _14(value._14), _15(value._15), _16(value._16), _17(value._17), _18(value._18), _19(value._19)) @@ -49,8 +49,8 @@ trait Tuple19W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S] extends implicit def ToTuple19W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S](t: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)): Tuple19W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S] = new { val value = t } with Tuple19W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S] - -trait Tuple20W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T] extends PimpedType[Tuple20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T]] { + +trait Tuple20W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T] extends EnrichedType[Tuple20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T]] { def fold[Z](f: => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) => Z): Z = {import value._; f(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20)} def toIndexedSeq[Z](implicit ev: value.type <:< Tuple20[Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z]): IndexedSeq[Z] = {val zs = ev(value); import zs._; IndexedSeq(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20)} def mapElements[AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR, SS, TT](_1: (A => AA) = identity[A] _, _2: (B => BB) = identity[B] _, _3: (C => CC) = identity[C] _, _4: (D => DD) = identity[D] _, _5: (E => EE) = identity[E] _, _6: (F => FF) = identity[F] _, _7: (G => GG) = identity[G] _, _8: (H => HH) = identity[H] _, _9: (I => II) = identity[I] _, _10: (J => JJ) = identity[J] _, _11: (K => KK) = identity[K] _, _12: (L => LL) = identity[L] _, _13: (M => MM) = identity[M] _, _14: (N => NN) = identity[N] _, _15: (O => OO) = identity[O] _, _16: (P => PP) = identity[P] _, _17: (Q => QQ) = identity[Q] _, _18: (R => RR) = identity[R] _, _19: (S => SS) = identity[S] _, _20: (T => TT) = identity[T] _): (AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR, SS, TT) = (_1(value._1), _2(value._2), _3(value._3), _4(value._4), _5(value._5), _6(value._6), _7(value._7), _8(value._8), _9(value._9), _10(value._10), _11(value._11), _12(value._12), _13(value._13), _14(value._14), _15(value._15), _16(value._16), _17(value._17), _18(value._18), _19(value._19), _20(value._20)) @@ -58,8 +58,8 @@ trait Tuple20W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T] exten implicit def ToTuple20W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T](t: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)): Tuple20W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T] = new { val value = t } with Tuple20W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T] - -trait Tuple21W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U] extends PimpedType[Tuple21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U]] { + +trait Tuple21W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U] extends EnrichedType[Tuple21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U]] { def fold[Z](f: => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) => Z): Z = {import value._; f(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21)} def toIndexedSeq[Z](implicit ev: value.type <:< Tuple21[Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z]): IndexedSeq[Z] = {val zs = ev(value); import zs._; IndexedSeq(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21)} def mapElements[AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR, SS, TT, UU](_1: (A => AA) = identity[A] _, _2: (B => BB) = identity[B] _, _3: (C => CC) = identity[C] _, _4: (D => DD) = identity[D] _, _5: (E => EE) = identity[E] _, _6: (F => FF) = identity[F] _, _7: (G => GG) = identity[G] _, _8: (H => HH) = identity[H] _, _9: (I => II) = identity[I] _, _10: (J => JJ) = identity[J] _, _11: (K => KK) = identity[K] _, _12: (L => LL) = identity[L] _, _13: (M => MM) = identity[M] _, _14: (N => NN) = identity[N] _, _15: (O => OO) = identity[O] _, _16: (P => PP) = identity[P] _, _17: (Q => QQ) = identity[Q] _, _18: (R => RR) = identity[R] _, _19: (S => SS) = identity[S] _, _20: (T => TT) = identity[T] _, _21: (U => UU) = identity[U] _): (AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR, SS, TT, UU) = (_1(value._1), _2(value._2), _3(value._3), _4(value._4), _5(value._5), _6(value._6), _7(value._7), _8(value._8), _9(value._9), _10(value._10), _11(value._11), _12(value._12), _13(value._13), _14(value._14), _15(value._15), _16(value._16), _17(value._17), _18(value._18), _19(value._19), _20(value._20), _21(value._21)) @@ -67,12 +67,12 @@ trait Tuple21W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U] ex implicit def ToTuple21W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U](t: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)): Tuple21W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U] = new { val value = t } with Tuple21W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U] - -trait Tuple22W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V] extends PimpedType[Tuple22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V]] { + +trait Tuple22W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V] extends EnrichedType[Tuple22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V]] { def fold[Z](f: => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V) => Z): Z = {import value._; f(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22)} def toIndexedSeq[Z](implicit ev: value.type <:< Tuple22[Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z]): IndexedSeq[Z] = {val zs = ev(value); import zs._; IndexedSeq(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22)} def mapElements[AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR, SS, TT, UU, VV](_1: (A => AA) = identity[A] _, _2: (B => BB) = identity[B] _, _3: (C => CC) = identity[C] _, _4: (D => DD) = identity[D] _, _5: (E => EE) = identity[E] _, _6: (F => FF) = identity[F] _, _7: (G => GG) = identity[G] _, _8: (H => HH) = identity[H] _, _9: (I => II) = identity[I] _, _10: (J => JJ) = identity[J] _, _11: (K => KK) = identity[K] _, _12: (L => LL) = identity[L] _, _13: (M => MM) = identity[M] _, _14: (N => NN) = identity[N] _, _15: (O => OO) = identity[O] _, _16: (P => PP) = identity[P] _, _17: (Q => QQ) = identity[Q] _, _18: (R => RR) = identity[R] _, _19: (S => SS) = identity[S] _, _20: (T => TT) = identity[T] _, _21: (U => UU) = identity[U] _, _22: (V => VV) = identity[V] _): (AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR, SS, TT, UU, VV) = (_1(value._1), _2(value._2), _3(value._3), _4(value._4), _5(value._5), _6(value._6), _7(value._7), _8(value._8), _9(value._9), _10(value._10), _11(value._11), _12(value._12), _13(value._13), _14(value._14), _15(value._15), _16(value._16), _17(value._17), _18(value._18), _19(value._19), _20(value._20), _21(value._21), _22(value._22)) } implicit def ToTuple22W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V](t: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)): Tuple22W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V] = new { val value = t } with Tuple22W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V] -}
\ No newline at end of file +} diff --git a/test/files/pos/t3883.scala b/test/files/pos/t3883.scala index adde0526b2..1b62c0c6d6 100644 --- a/test/files/pos/t3883.scala +++ b/test/files/pos/t3883.scala @@ -1,14 +1,14 @@ // need to test both orders object A1 { - implicit def i: Equiv[Boolean] = error("") - implicit def div[T, A](implicit f: T => A, eq: Equiv[A]): Equiv[T] = error("") + implicit def i: Equiv[Boolean] = sys.error("") + implicit def div[T, A](implicit f: T => A, eq: Equiv[A]): Equiv[T] = sys.error("") implicitly[Equiv[Boolean]] } object A2 { - implicit def div[T, A](implicit f: T => A, eq: Equiv[A]): Equiv[T] = error("") - implicit def i: Equiv[Boolean] = error("") + implicit def div[T, A](implicit f: T => A, eq: Equiv[A]): Equiv[T] = sys.error("") + implicit def i: Equiv[Boolean] = sys.error("") implicitly[Equiv[Boolean]] } diff --git a/test/files/pos/t3927.scala b/test/files/pos/t3927.scala index eb4c4b3be5..f5869c55d5 100644 --- a/test/files/pos/t3927.scala +++ b/test/files/pos/t3927.scala @@ -1,6 +1,6 @@ object A { def x { - implicit lazy val e: Equiv[Int] = error("") + implicit lazy val e: Equiv[Int] = sys.error("") implicitly[Equiv[Int]] } -} +} diff --git a/test/files/pos/t3943/Client_2.scala b/test/files/pos/t3943/Client_2.scala new file mode 100644 index 0000000000..650ac9b7a9 --- /dev/null +++ b/test/files/pos/t3943/Client_2.scala @@ -0,0 +1,7 @@ +object Test { + val x: Child = new Child + x.getInner.foo("meh") +// error: type mismatch; +// found : java.lang.String("meh") +// required: E +} diff --git a/test/files/pos/t3943/Outer_1.java b/test/files/pos/t3943/Outer_1.java new file mode 100644 index 0000000000..1d38c5e76b --- /dev/null +++ b/test/files/pos/t3943/Outer_1.java @@ -0,0 +1,14 @@ +class Outer<E> { + abstract class Inner { + abstract public void foo(E e); + } +} + +class Child extends Outer<String> { + // the implicit prefix for Inner is Outer<E> instead of Outer<String> + public Inner getInner() { + return new Inner() { + public void foo(String e) { System.out.println("meh "+e); } + }; + } +} diff --git a/test/files/pos/t422.scala b/test/files/pos/t422.scala deleted file mode 100644 index cb3ba279d4..0000000000 --- a/test/files/pos/t422.scala +++ /dev/null @@ -1,17 +0,0 @@ -import scala.util.regexp.WordExp; -import scala.util.automata.WordBerrySethi; - -object BoolWordExp extends WordExp { - type _labelT = MyLabels; - type _regexpT = RegExp; - abstract class MyLabels extends Label ; - case class MyLabel(c:Char) extends MyLabels; -} - -object MyTranslator extends WordBerrySethi { - override val lang = BoolWordExp; - import lang._; - override protected def seenLabel( r:RegExp, i:Int, label: _labelT ): Unit = { - super.seenLabel(r,i,label) - } -} diff --git a/test/files/pos/t4351.check b/test/files/pos/t4351.check deleted file mode 100644 index cb5d407e13..0000000000 --- a/test/files/pos/t4351.check +++ /dev/null @@ -1 +0,0 @@ -runtime exception diff --git a/test/files/pos/t4351.scala b/test/files/pos/t4351.scala deleted file mode 100644 index 2d57588793..0000000000 --- a/test/files/pos/t4351.scala +++ /dev/null @@ -1,20 +0,0 @@ -object Test { - def main(args: Array[String]): Unit = { - try new BooleanPropImpl() value - catch { - case e: RuntimeException => println("runtime exception") - } - } -} - -trait Prop[@specialized(Boolean) +T] { - def value: T -} - -class PropImpl[+T] extends Prop[T] { - def value: T = scala.sys.error("") -} - -trait BooleanProp extends Prop[Boolean] - -class BooleanPropImpl() extends PropImpl[Boolean] with BooleanProp diff --git a/test/files/pos/t4365/a_1.scala b/test/files/pos/t4365/a_1.scala new file mode 100644 index 0000000000..6f3405b1ff --- /dev/null +++ b/test/files/pos/t4365/a_1.scala @@ -0,0 +1,18 @@ +import scala.collection._ + +trait SeqViewLike[+A, + +Coll, + +This <: SeqView[A, Coll] with SeqViewLike[A, Coll, This]] + extends Seq[A] with GenSeqViewLike[A, Coll, This] +{ + + trait Transformed[+B] extends super[GenSeqViewLike].Transformed[B] + + abstract class AbstractTransformed[+B] extends Seq[B] with Transformed[B] { + def underlying: Coll = error("") + } + + trait Reversed extends Transformed[A] with super[GenSeqViewLike].Reversed + + protected def newReversed: Transformed[A] = new AbstractTransformed[A] with Reversed +} diff --git a/test/files/pos/t4365/b_1.scala b/test/files/pos/t4365/b_1.scala new file mode 100644 index 0000000000..e5b5687185 --- /dev/null +++ b/test/files/pos/t4365/b_1.scala @@ -0,0 +1,22 @@ +import scala.collection._ + +trait GenSeqViewLike[+A, + +Coll, + +This <: GenSeqView[A, Coll] with GenSeqViewLike[A, Coll, This]] +extends GenSeq[A] { +self => + + trait Transformed[+B] { + def length: Int = 0 + def apply(idx: Int): B = error("") + } + + trait Reversed extends Transformed[A] { + def iterator: Iterator[A] = createReversedIterator + + private def createReversedIterator: Iterator[A] = { + self.foreach(_ => ()) + null + } + } +} diff --git a/test/files/pos/t4649.flags b/test/files/pos/t4649.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/pos/t4649.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/t4649.scala b/test/files/pos/t4649.scala new file mode 100644 index 0000000000..0d6caa8d7a --- /dev/null +++ b/test/files/pos/t4649.scala @@ -0,0 +1,6 @@ +object Test { + // @annotation.tailrec + def lazyFilter[E](s: Stream[E], p: E => Boolean): Stream[E] = s match { + case h #:: t => if (p(h)) h #:: lazyFilter(t, p) else lazyFilter(t, p) + } +} diff --git a/test/files/pos/t4744.flags b/test/files/pos/t4744.flags new file mode 100644 index 0000000000..ca20f55172 --- /dev/null +++ b/test/files/pos/t4744.flags @@ -0,0 +1 @@ +-Ybreak-cycles diff --git a/test/files/pos/t4744/Bar.scala b/test/files/pos/t4744/Bar.scala new file mode 100644 index 0000000000..1fb6d78973 --- /dev/null +++ b/test/files/pos/t4744/Bar.scala @@ -0,0 +1 @@ +class Bar { val quux = new Foo[java.lang.Integer]() } diff --git a/test/files/pos/t4744/Foo.java b/test/files/pos/t4744/Foo.java new file mode 100644 index 0000000000..6c764d0470 --- /dev/null +++ b/test/files/pos/t4744/Foo.java @@ -0,0 +1 @@ +public class Foo<T extends Comparable<? super T>> {} diff --git a/test/files/pos/t4786.scala b/test/files/pos/t4786.scala new file mode 100644 index 0000000000..f0579142b8 --- /dev/null +++ b/test/files/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/files/pos/t4859.scala b/test/files/pos/t4859.scala new file mode 100644 index 0000000000..284a39b7ab --- /dev/null +++ b/test/files/pos/t4859.scala @@ -0,0 +1,17 @@ +object O { + // error: C is not a legal prefix for a constructor + C().CC() + // but this works. + D().DD() +} + +case class C() { + case class CC() +} + +case class D() { + class DD() + object DD { + def apply() = new DD() + } +} diff --git a/test/files/pos/t5223.scala b/test/files/pos/t5223.scala index 0b2528e367..d81daa9907 100644 --- a/test/files/pos/t5223.scala +++ b/test/files/pos/t5223.scala @@ -2,5 +2,5 @@ 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)} + reify{def printf(format: String, args: Any*): String = ("abc": @deprecated)} }
\ No newline at end of file diff --git a/test/files/pos/t5399a.scala b/test/files/pos/t5399a.scala new file mode 100644 index 0000000000..4ebd85ad03 --- /dev/null +++ b/test/files/pos/t5399a.scala @@ -0,0 +1,19 @@ +class Foo { + trait Init[T] + class ScopedKey[T] extends Init[T] + + trait Setting[T] { + val key: ScopedKey[T] + } + + case class ScopedKey1[T](val foo: Init[T]) extends ScopedKey[T] + + val scalaHome: Setting[Option[String]] = null + val scalaVersion: Setting[String] = null + + def testPatternMatch(s: Setting[_]) { + s.key match { + case ScopedKey1(scalaHome.key | scalaVersion.key) => () + } + } +} diff --git a/test/files/pos/t5580b.scala b/test/files/pos/t5580b.scala deleted file mode 100644 index d5a4a0a2b2..0000000000 --- a/test/files/pos/t5580b.scala +++ /dev/null @@ -1,19 +0,0 @@ -/** It's a pos test because it does indeed compile, - * not so much because I'm glad it does. Testing - * that error messages created and discarded during - * implicit search don't blow it up. - */ - -import scala.collection.mutable.WeakHashMap -import scala.collection.JavaConversions._ - -class bar { } - -class foo { - val map = WeakHashMap[AnyRef, collection.mutable.Map[bar, collection.mutable.Set[bar]]]() - - def test={ - val tmp:bar=null - if (map.get(tmp).isEmpty) map.put(tmp,collection.mutable.Set()) - } -} diff --git a/test/files/pos/t5606.scala b/test/files/pos/t5606.scala new file mode 100644 index 0000000000..2545271e32 --- /dev/null +++ b/test/files/pos/t5606.scala @@ -0,0 +1,9 @@ + + + + + + + + +case class CaseTest[_](someData:String) diff --git a/test/files/pos/t5639/Bar.scala b/test/files/pos/t5639/Bar.scala new file mode 100644 index 0000000000..f577500acd --- /dev/null +++ b/test/files/pos/t5639/Bar.scala @@ -0,0 +1,7 @@ +package pack.age + +import pack.age.Implicits._ + +object Quux { + def baz : Baz = 1 +} diff --git a/test/files/pos/t5639/Foo.scala b/test/files/pos/t5639/Foo.scala new file mode 100644 index 0000000000..6602150661 --- /dev/null +++ b/test/files/pos/t5639/Foo.scala @@ -0,0 +1,7 @@ +package pack.age + +class Baz + +object Implicits { + implicit def Baz(n: Int): Baz = new Baz +} diff --git a/test/files/pos/t5644/BoxesRunTime.java b/test/files/pos/t5644/BoxesRunTime.java index 241bf79ac8..74c4c6b4b9 100644 --- a/test/files/pos/t5644/BoxesRunTime.java +++ b/test/files/pos/t5644/BoxesRunTime.java @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2006-2011, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2006-2013, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/test/files/pos/t5809.scala b/test/files/pos/t5809.scala index 133e13c4ed..6101f546b3 100644 --- a/test/files/pos/t5809.scala +++ b/test/files/pos/t5809.scala @@ -1,5 +1,6 @@ package object foo { - implicit class PimpedInt(foo: Int) { + implicit class EnrichedInt(foo: Int) { def bar = ??? + def bippy = foo } -}
\ No newline at end of file +} diff --git a/test/files/pos/t5858.scala b/test/files/pos/t5858.scala new file mode 100644 index 0000000000..f2b0f58d76 --- /dev/null +++ b/test/files/pos/t5858.scala @@ -0,0 +1,3 @@ +object Test { + new xml.Elem(null, null, xml.Null, xml.TopScope, Nil: _*) // was ambiguous +} diff --git a/test/files/pos/t5877.scala b/test/files/pos/t5877.scala index c7827df99f..939013cd01 100644 --- a/test/files/pos/t5877.scala +++ b/test/files/pos/t5877.scala @@ -7,8 +7,8 @@ package foo { } package object foo { - // Crasher: No synthetics for method PimpedFoo2: synthetics contains - implicit class PimpedFoo2(value: Foo) { + // Crasher: No synthetics for method EnrichedFoo2: synthetics contains + implicit class EnrichedFoo2(value: Foo) { def huzzah = "" } } diff --git a/test/files/pos/t5877b.scala b/test/files/pos/t5877b.scala index 6b8cbd473e..43a2ea2f06 100644 --- a/test/files/pos/t5877b.scala +++ b/test/files/pos/t5877b.scala @@ -7,7 +7,7 @@ object Test { } object `package` { - implicit class PimpedFoo2(value: Foo) { + implicit class EnrichedFoo2(value: Foo) { def huzzah = "" } } diff --git a/test/files/pos/t6123-explaintypes-implicits.flags b/test/files/pos/t6123-explaintypes-implicits.flags new file mode 100644 index 0000000000..b36707c7cf --- /dev/null +++ b/test/files/pos/t6123-explaintypes-implicits.flags @@ -0,0 +1 @@ +-explaintypes diff --git a/test/files/pos/t6123-explaintypes-implicits.scala b/test/files/pos/t6123-explaintypes-implicits.scala new file mode 100644 index 0000000000..5242b443d5 --- /dev/null +++ b/test/files/pos/t6123-explaintypes-implicits.scala @@ -0,0 +1,13 @@ +object ImplicitBugReport { + trait Exp[+T] + trait CanBuildExp[-Elem, +To] extends (Exp[Elem] => To) + trait TraversableExp[T, ExpT <: Exp[T]] extends Exp[Traversable[T]] + + implicit def canBuildExp[T]: CanBuildExp[T, Exp[T]] = ??? + implicit def canBuildExpTrav[T, ExpT <: Exp[T]](implicit c: CanBuildExp[T, ExpT]): CanBuildExp[Traversable[T], TraversableExp[T, ExpT]] = ??? + def toExpTempl[T, That](t: T)(implicit c: CanBuildExp[T, That]): That = ??? + + def testBug() { + val a1 = toExpTempl(Seq(1, 2, 3, 5)) + } +} diff --git a/test/files/pos/t6123-explaintypes-macros.flags b/test/files/pos/t6123-explaintypes-macros.flags new file mode 100644 index 0000000000..b36707c7cf --- /dev/null +++ b/test/files/pos/t6123-explaintypes-macros.flags @@ -0,0 +1 @@ +-explaintypes diff --git a/test/files/pos/t6123-explaintypes-macros.scala b/test/files/pos/t6123-explaintypes-macros.scala new file mode 100644 index 0000000000..e650ad2038 --- /dev/null +++ b/test/files/pos/t6123-explaintypes-macros.scala @@ -0,0 +1,7 @@ +import scala.language.experimental.macros +import scala.reflect.macros.Context + +object Macros { + def printf(format: String, params: Any*): Unit = macro printf_impl + def printf_impl(c: Context)(format: c.Expr[String], params: c.Expr[Any]*): c.Expr[Unit] = ??? +} diff --git a/test/files/pos/t6162-inheritance.flags b/test/files/pos/t6162-inheritance.flags new file mode 100644 index 0000000000..c6bfaf1f64 --- /dev/null +++ b/test/files/pos/t6162-inheritance.flags @@ -0,0 +1 @@ +-deprecation -Xfatal-warnings diff --git a/test/files/pos/t6162-inheritance.scala b/test/files/pos/t6162-inheritance.scala new file mode 100644 index 0000000000..fca751edab --- /dev/null +++ b/test/files/pos/t6162-inheritance.scala @@ -0,0 +1,22 @@ +package scala.t6126 + +// Don't warn about inheritance in the same file. +// We might use that as a prelude to sealing a class. + +@deprecatedInheritance("`Foo` will be made final in a future version.", "2.10.0") +class Foo + +class SubFoo extends Foo + +@deprecatedInheritance() +trait T + +object SubT extends T + +@deprecatedInheritance() +trait S + +object O { + new S { + } +} diff --git a/test/files/pos/t6301.scala b/test/files/pos/t6301.scala new file mode 100644 index 0000000000..fa81bbfa77 --- /dev/null +++ b/test/files/pos/t6301.scala @@ -0,0 +1,9 @@ +trait LoadedOver[@specialized(Int) A] { + def foo(x: Any): A + def foo(xs: String): A +} + +object Test { + def loaded: AnyRef with LoadedOver[Int] = sys.error("") + loaded.foo("") +} diff --git a/test/files/pos/t6355pos.scala b/test/files/pos/t6355pos.scala new file mode 100644 index 0000000000..c0e740dd68 --- /dev/null +++ b/test/files/pos/t6355pos.scala @@ -0,0 +1,16 @@ +import scala.language.dynamics + +class A extends Dynamic { + def applyDynamic[T1](method: String)(x1: T1): Any = 1 + def applyDynamic[T1, T2](method: String)(x: T1, y: T2): Any = 2 + def applyDynamic[T1, T2, T3](method: String)(x: T1, y: T2, z: T3): Any = 3 +} + +object Test { + def main(args: Array[String]): Unit = { + val x = new A + println(x[Int](5)) + println(x[Int, String](5, "a")) + println(x[Int, String, Int](5, "a", 5)) + } +} diff --git a/test/files/pos/t640.scala b/test/files/pos/t640.scala index 55f61df8af..45608bc3d4 100644 --- a/test/files/pos/t640.scala +++ b/test/files/pos/t640.scala @@ -1,2 +1,2 @@ -@serializable class A -@serializable class B extends A +class A extends Serializable +class B extends A with Serializable diff --git a/test/files/pos/t6447.scala b/test/files/pos/t6447.scala new file mode 100644 index 0000000000..1c0c0f2a31 --- /dev/null +++ b/test/files/pos/t6447.scala @@ -0,0 +1,18 @@ +import scala.language.experimental.macros +import scala.reflect.macros.Context + +class X { type T } + +object X { + // this works + def foo(x: X): x.T = macro fooImpl + def fooImpl(c: Context)(x: c.Expr[X]): c.Expr[x.value.T] = ??? + + // this doesn't + def bar(x: X, y: X): (x.T, y.T) = macro barImpl + def barImpl(c: Context)(x: c.Expr[X], y: c.Expr[X]): c.Expr[(x.value.T, y.value.T)] = ??? + + // neither does this + def baz(x: X)(xs: List[x.T]): Unit = macro bazImpl + def bazImpl(c: Context)(x: c.Expr[X])(xs: c.Expr[List[x.value.T]]): c.Expr[Unit] = ??? +} diff --git a/test/files/pos/t6664.scala b/test/files/pos/t6664.scala new file mode 100644 index 0000000000..7eb85f619d --- /dev/null +++ b/test/files/pos/t6664.scala @@ -0,0 +1,4 @@ +final case class A(i: Int, s: String) { + protected def copy(s2: String): A = A(i, s2) + protected def copy(i2: Int): A = A(i2, s) +} diff --git a/test/files/pos/t6664b.scala b/test/files/pos/t6664b.scala new file mode 100644 index 0000000000..a622866838 --- /dev/null +++ b/test/files/pos/t6664b.scala @@ -0,0 +1,5 @@ +object T { + def A(s: String): A = new A(3, s) + def A(i: Int): A = A(i, "abc") + case class A(i: Int, s: String) +} diff --git a/test/files/pos/t6745.scala b/test/files/pos/t6745.scala new file mode 100644 index 0000000000..2ab8e6d39a --- /dev/null +++ b/test/files/pos/t6745.scala @@ -0,0 +1,4 @@ +class Bar(val i: Int) { + self: Any with AnyRef => + def this() = this(0) +} diff --git a/test/files/pos/t6815.scala b/test/files/pos/t6815.scala new file mode 100644 index 0000000000..9244b3d353 --- /dev/null +++ b/test/files/pos/t6815.scala @@ -0,0 +1,17 @@ +trait U { + trait ValOrDefDefApi { + def name: Any + } + type ValOrDefDef <: ValOrDefDefApi + type ValDef <: ValOrDefDef with ValDefApi + trait ValDefApi extends ValOrDefDefApi { this: ValDef => } + val emptyValDef: ValDef // the result type is volatile +} + +object Test { + val u: U = ??? + + u.emptyValDef match { + case u.emptyValDef => // but we shouldn't let that stop us from treating it as a stable identifier pattern. + } +} diff --git a/test/files/pos/t6815_import.scala b/test/files/pos/t6815_import.scala new file mode 100644 index 0000000000..56f4358d59 --- /dev/null +++ b/test/files/pos/t6815_import.scala @@ -0,0 +1,16 @@ +trait U { + trait ValOrDefDefApi { + def name: Any + } + type ValOrDefDef <: ValOrDefDefApi + type ValDef <: ValOrDefDef with ValDefApi + trait ValDefApi extends ValOrDefDefApi { this: ValDef => } + val emptyValDef: ValDef // the result type is volatile +} + +object Test { + val u: U = ??? + + // but we shouldn't let that stop us from treating it as a stable identifier for import + import u.emptyValDef.name +} diff --git a/test/files/pos/t6966.scala b/test/files/pos/t6966.scala new file mode 100644 index 0000000000..23adc6d0d2 --- /dev/null +++ b/test/files/pos/t6966.scala @@ -0,0 +1,17 @@ +import Ordering.{Byte, comparatorToOrdering} +trait Format[T] +trait InputCache[T] +object CacheIvy { + implicit def basicInputCache[I](implicit fmt: Format[I], eqv: Equiv[I]): InputCache[I] = null + implicit def arrEquiv[T](implicit t: Equiv[T]): Equiv[Array[T]] = null + implicit def hNilCache: InputCache[HNil] = null + implicit def ByteArrayFormat: Format[Array[Byte]] = null + type :+:[H, T <: HList] = HCons[H,T] + implicit def hConsCache[H, T <: HList](implicit head: InputCache[H], tail: InputCache[T]): InputCache[H :+: T] = null + hConsCache[Array[Byte], HNil] +} + +sealed trait HList +sealed trait HNil extends HList +object HNil extends HNil +final class HCons[H, T <: HList](head : H, tail : T) extends HList
\ No newline at end of file diff --git a/test/files/pos/t715.cmds b/test/files/pos/t715.cmds deleted file mode 100644 index 2836967fca..0000000000 --- a/test/files/pos/t715.cmds +++ /dev/null @@ -1,2 +0,0 @@ -scalac meredith_1.scala -scalac runner_2.scala diff --git a/test/files/pos/t715/meredith_1.scala b/test/files/pos/t715/meredith_1.scala index 8261b9881a..c28afb4a9b 100644 --- a/test/files/pos/t715/meredith_1.scala +++ b/test/files/pos/t715/meredith_1.scala @@ -3,7 +3,7 @@ package com.sap.dspace.model.othello; import scala.xml._ trait XMLRenderer { - type T <: Any {def getClass() : java.lang.Class[_]} + type T <: Any {def getClass(): java.lang.Class[_]} val valueTypes = List( classOf[java.lang.Boolean], @@ -14,21 +14,21 @@ trait XMLRenderer { ) def value2XML( - value : Object, - field : java.lang.reflect.Field, - pojo : T - ) : Node = { + value: Object, + field: java.lang.reflect.Field, + pojo: T + ): Node = { value match { - case null => Text( "null" ) + case null => Text("null") case vUnmatched => if (value.isInstanceOf[java.lang.Boolean]) - Text( value.asInstanceOf[java.lang.Boolean].toString ) + Text(value.asInstanceOf[java.lang.Boolean].toString) else if (value.isInstanceOf[java.lang.Integer]) - Text( value.asInstanceOf[java.lang.Integer].toString ) + Text(value.asInstanceOf[java.lang.Integer].toString) else if (value.isInstanceOf[java.lang.Float]) - Text( value.asInstanceOf[java.lang.Float].toString ) + Text(value.asInstanceOf[java.lang.Float].toString) // else if (value.isInstanceOf[T]) - // pojo2XML( value.asInstanceOf[T] ) + // pojo2XML(value.asInstanceOf[T]) else <unmatchedType> <theType> @@ -42,16 +42,16 @@ trait XMLRenderer { } def field2XML( - field : java.lang.reflect.Field, - pojo : T - ) : Elem = { + field: java.lang.reflect.Field, + pojo: T + ): Elem = { - val accessible = field.isAccessible; - field.setAccessible( true ); + val accessible = field.isAccessible + field.setAccessible(true) // BUGBUG lgm need to disambiguate on type and possibly make // recursive call to pojo2XML - val fldValXML = value2XML( field.get( pojo ), field, pojo ); - field.setAccessible( accessible ); + val fldValXML = value2XML(field.get( pojo ), field, pojo) + field.setAccessible( accessible ) Elem( null, @@ -62,37 +62,37 @@ trait XMLRenderer { ) } - def pojo2XML( pojo : T ) : Elem = { + def pojo2XML(pojo: T): Elem = { val progeny = for (field <- pojo.getClass.getDeclaredFields) - yield field2XML( field, pojo ); + yield field2XML(field, pojo) Elem( null, pojo.getClass.getName, null, TopScope, - progeny.asInstanceOf[Array[scala.xml.Node]] : _* + progeny.asInstanceOf[Array[scala.xml.Node]]: _* ) } } -case class POJO2XMLRenderer( recurse : Boolean ) +case class POJO2XMLRenderer(recurse: Boolean) extends XMLRenderer { type T = java.io.Serializable override def value2XML( - value : Object, - field : java.lang.reflect.Field, - pojo : java.io.Serializable - ) : Node = { - if (recurse) super.value2XML( value, field, pojo ) - else Text( value + "" ) + value: Object, + field: java.lang.reflect.Field, + pojo: java.io.Serializable + ): Node = { + if (recurse) super.value2XML(value, field, pojo) + else Text(value + "") } } -object thePOJO2XMLRenderer extends POJO2XMLRenderer( true ) { +object thePOJO2XMLRenderer extends POJO2XMLRenderer(true) { } -object Test extends Application { +object Test extends App { println(com.sap.dspace.model.othello.thePOJO2XMLRenderer) } diff --git a/test/files/pos/t715/runner_2.scala b/test/files/pos/t715/runner_2.scala index 1e4f40d654..d54805629a 100644 --- a/test/files/pos/t715/runner_2.scala +++ b/test/files/pos/t715/runner_2.scala @@ -1,3 +1,3 @@ -object Test extends Application { +object Test extends App { println(com.sap.dspace.model.othello.thePOJO2XMLRenderer) } diff --git a/test/files/pos/t7228.scala b/test/files/pos/t7228.scala new file mode 100644 index 0000000000..5d936f6529 --- /dev/null +++ b/test/files/pos/t7228.scala @@ -0,0 +1,75 @@ +object AdaptWithWeaklyConformantType { + implicit class D(d: Double) { def double = d*2 } + + val x1: Int = 1 + var x2: Int = 2 + val x3 = 3 + var x4 = 4 + final val x5 = 5 + final var x6 = 6 + + def f1 = x1.double + def f2 = x2.double + def f3 = x3.double + def f4 = x4.double + def f5 = x5.double + def f6 = x6.double +} + +object AdaptAliasWithWeaklyConformantType { + implicit class D(d: Double) { def double = d*2 } + type T = Int + + val x1: T = 1 + var x2: T = 2 + val x3 = (3: T) + var x4 = (4: T) + final val x5 = (5: T) + final var x6 = (6: T) + + def f1 = x1.double + def f2 = x2.double + def f3 = x3.double + def f4 = x4.double + def f5 = x5.double + def f6 = x6.double +} + +object AdaptToAliasWithWeaklyConformantType { + type U = Double + implicit class D(d: U) { def double = d*2 } + + val x1: Int = 1 + var x2: Int = 2 + val x3 = (3: Int) + var x4 = (4: Int) + final val x5 = (5: Int) + final var x6 = (6: Int) + + def f1 = x1.double + def f2 = x2.double + def f3 = x3.double + def f4 = x4.double + def f5 = x5.double + def f6 = x6.double +} + +object AdaptAliasToAliasWithWeaklyConformantType { + type U = Double + type T = Int + implicit class D(d: U) { def double = d*2 } + + val x1: T = 1 + var x2: T = 2 + val x3 = (3: T) + var x4 = (4: T) + final val x5 = (5: T) + final var x6 = (6: T) + + def f1 = x1.double + def f2 = x2.double + def f3 = x3.double + def f4 = x4.double + def f5 = x5.double + def f6 = x6.double +} diff --git a/test/files/pos/t7294.scala b/test/files/pos/t7294.scala new file mode 100644 index 0000000000..ccac2b1400 --- /dev/null +++ b/test/files/pos/t7294.scala @@ -0,0 +1,6 @@ +object Test { + // no fruitless warning as Tuple2 isn't (yet) final. + // The corresponding `neg` test will treat it as final + // for the purposes of these tests under -Xfuture. + (1, 2) match { case Seq() => 0; case _ => 1 } +} diff --git a/test/files/pos/t7296.scala b/test/files/pos/t7296.scala new file mode 100644 index 0000000000..0c078d3657 --- /dev/null +++ b/test/files/pos/t7296.scala @@ -0,0 +1,6 @@ +object Test { + type A = Int + // Emits the implementation restriction but then proceeds to crash + // when creating the Foo.unapply. + case class Foo(a: A, b: A, c: A, d: A, e: A, f: A, g: A, h: A, i: A, j: A, k: A, l: A, m: A, n: A, o: A, p: A, q: A, r: A, s: A, t: A, u: A, v: A, w: A, x: A, y: A, Z: A) +} diff --git a/test/files/pos/t7315.flags b/test/files/pos/t7315.flags new file mode 100644 index 0000000000..d1b831ea87 --- /dev/null +++ b/test/files/pos/t7315.flags @@ -0,0 +1 @@ +-deprecation -Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/t7315.scala b/test/files/pos/t7315.scala new file mode 100644 index 0000000000..0abcea2451 --- /dev/null +++ b/test/files/pos/t7315.scala @@ -0,0 +1,4 @@ +package scala.pack + +@deprecatedInheritance +class C[@specialized A]
\ No newline at end of file diff --git a/test/files/pos/t7377b.flags b/test/files/pos/t7377b.flags deleted file mode 100644 index cb8324a345..0000000000 --- a/test/files/pos/t7377b.flags +++ /dev/null @@ -1 +0,0 @@ --Xoldpatmat
\ No newline at end of file diff --git a/test/files/pos/t911.scala b/test/files/pos/t911.scala index 224b14cda3..cfa4f49dc1 100644 --- a/test/files/pos/t911.scala +++ b/test/files/pos/t911.scala @@ -1,6 +1,6 @@ object Test { -def foo : Any = { - case class Foo {} - Foo; -} + def foo: Any = { + case class Foo() {} + Foo; + } } diff --git a/test/files/pos/tcpoly_boundedmonad.scala b/test/files/pos/tcpoly_boundedmonad.scala index 24a911769b..8c605dc7b6 100644 --- a/test/files/pos/tcpoly_boundedmonad.scala +++ b/test/files/pos/tcpoly_boundedmonad.scala @@ -1,19 +1,19 @@ trait Monad[T <: Bound[T], MyType[x <: Bound[x]], Bound[_]] { - def map[S <: Bound[S]](f: T => S): MyType[S] + def map[S <: Bound[S]](f: T => S): MyType[S] - def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_], + def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_], Result[x <: RBound[x]] <: Monad[x, RContainer, RBound]] - (f: T => Result[S]): Result[S] + (f: T => Result[S]): Result[S] def filter(p: T => Boolean): MyType[T] } class Set[T <: Ordered[T]] extends Monad[T, Set, Ordered] { - def map[S <: Ordered[S]](f: T => S): Set[S] = error("TODO") - - def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_], + def map[S <: Ordered[S]](f: T => S): Set[S] = sys.error("TODO") + + def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_], Result[x <: RBound[x]] <: Monad[x, RContainer, RBound]] - (f: T => Result[S]): Result[S] = error("TODO") - - def filter(p: T => Boolean): Set[T] = error("TODO") + (f: T => Result[S]): Result[S] = sys.error("TODO") + + def filter(p: T => Boolean): Set[T] = sys.error("TODO") } diff --git a/test/files/pos/tcpoly_infer_explicit_tuple_wrapper.scala b/test/files/pos/tcpoly_infer_explicit_tuple_wrapper.scala index 97594d506d..f719972a17 100644 --- a/test/files/pos/tcpoly_infer_explicit_tuple_wrapper.scala +++ b/test/files/pos/tcpoly_infer_explicit_tuple_wrapper.scala @@ -2,15 +2,15 @@ import scala.collection.generic.GenericTraversableTemplate import scala.collection.Iterable class IterableOps[CC[+B] <: Iterable[B] with GenericTraversableTemplate[B, CC], A1, A2](tuple: (CC[A1], Iterable[A2])) { - def unzip: (CC[A1], CC[A2]) = error("foo") + def unzip: (CC[A1], CC[A2]) = sys.error("foo") } object Test { - implicit def tupleOfIterableWrapper[CC[+B] <: Iterable[B] with GenericTraversableTemplate[B, CC], A1, A2](tuple: (CC[A1], Iterable[A2])) + implicit def tupleOfIterableWrapper[CC[+B] <: Iterable[B] with GenericTraversableTemplate[B, CC], A1, A2](tuple: (CC[A1], Iterable[A2])) = new IterableOps[CC, A1, A2](tuple) - + val t = (List(1, 2, 3), List(6, 5, 4)) tupleOfIterableWrapper(t) unzip -}
\ No newline at end of file +} diff --git a/test/files/pos/tcpoly_infer_implicit_tuple_wrapper.scala b/test/files/pos/tcpoly_infer_implicit_tuple_wrapper.scala index 3073b298de..19243505b4 100644 --- a/test/files/pos/tcpoly_infer_implicit_tuple_wrapper.scala +++ b/test/files/pos/tcpoly_infer_implicit_tuple_wrapper.scala @@ -2,7 +2,7 @@ import scala.collection.generic.GenericTraversableTemplate import scala.collection.Iterable class IterableOps[CC[+B] <: Iterable[B] with GenericTraversableTemplate[B, CC], A1, A2](tuple: (CC[A1], Iterable[A2])) { - def unzip: (CC[A1], CC[A2]) = error("foo") + def unzip: (CC[A1], CC[A2]) = sys.error("foo") } object Test { @@ -15,4 +15,4 @@ object Test { tupleOfIterableWrapper(t) unzip t unzip -}
\ No newline at end of file +} diff --git a/test/files/pos/tcpoly_overloaded.scala b/test/files/pos/tcpoly_overloaded.scala index 4240074d85..4f6334685b 100644 --- a/test/files/pos/tcpoly_overloaded.scala +++ b/test/files/pos/tcpoly_overloaded.scala @@ -1,10 +1,10 @@ trait Monad[T <: Bound[T], MyType[x <: Bound[x]], Bound[_]] { - def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_], + def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_], Result[x <: RBound[x]] <: Monad[x, RContainer, RBound]] - (f: T => Result[S]): Result[S] - def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_], + (f: T => Result[S]): Result[S] + def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_], Result[x <: RBound[x]] <: Monad[x, RContainer, RBound]] - (f: T => Result[S], foo: String): Result[S] + (f: T => Result[S], foo: String): Result[S] def flatMap[S <: Bound[S]] (f: T => MyType[S], foo: Int): MyType[S] } @@ -12,14 +12,14 @@ trait Monad[T <: Bound[T], MyType[x <: Bound[x]], Bound[_]] { trait Test { def moo: MList[Int] class MList[T](el: T) extends Monad[T, List, Any] { - def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_], + def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_], Result[x <: RBound[x]] <: Monad[x, RContainer, RBound]] - (f: T => Result[S]): Result[S] = error("foo") - def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_], + (f: T => Result[S]): Result[S] = sys.error("foo") + def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_], Result[x <: RBound[x]] <: Monad[x, RContainer, RBound]] - (f: T => Result[S], foo: String): Result[S] = error("foo") + (f: T => Result[S], foo: String): Result[S] = sys.error("foo") def flatMap[S] - (f: T => List[S], foo: Int): List[S] = error("foo") + (f: T => List[S], foo: Int): List[S] = sys.error("foo") } val l: MList[String] = moo.flatMap[String, List, Any, MList]((x: Int) => new MList("String")) } diff --git a/test/files/pos/tcpoly_subst.scala b/test/files/pos/tcpoly_subst.scala index f8ddb9a715..88cc4d0610 100644 --- a/test/files/pos/tcpoly_subst.scala +++ b/test/files/pos/tcpoly_subst.scala @@ -1,4 +1,4 @@ object test { - def make[m[x], b]: m[b] = error("foo") + def make[m[x], b]: m[b] = sys.error("foo") val lst: List[Int] = make[List, Int] } diff --git a/test/files/pos/tcpoly_variance_pos.scala b/test/files/pos/tcpoly_variance_pos.scala index b641716d50..b63abce202 100644 --- a/test/files/pos/tcpoly_variance_pos.scala +++ b/test/files/pos/tcpoly_variance_pos.scala @@ -1,7 +1,7 @@ class A[m[+x]] { - def str: m[Object] = error("foo") + def str: m[Object] = sys.error("foo") } class B[m[+x]] extends A[m] { - override def str: m[String] = error("foo") + override def str: m[String] = sys.error("foo") } diff --git a/test/files/pos/tcpoly_wildcards.scala b/test/files/pos/tcpoly_wildcards.scala index d3bb86b591..f6d1b666d0 100644 --- a/test/files/pos/tcpoly_wildcards.scala +++ b/test/files/pos/tcpoly_wildcards.scala @@ -1,3 +1,3 @@ trait test[b[_,_]] { - def moo[a[_, _]] = error("a") + def moo[a[_, _]] = sys.error("a") } diff --git a/test/files/pos/ticket2251.scala b/test/files/pos/ticket2251.scala index b3afee4ea9..c220e85350 100644 --- a/test/files/pos/ticket2251.scala +++ b/test/files/pos/ticket2251.scala @@ -22,4 +22,18 @@ lub of List(D, C) is B[_2] forSome { type _2 >: D with C{} <: B[_1] forSome { ty // should be: B[X] forSome {type X <: B[X]} -- can this be done automatically? for now, just detect f-bounded polymorphism and fall back to more coarse approximation val data: List[A] = List(new C, new D) + + val data2 = List(new C, new D) + + val data3: List[B[X] forSome { type X <: B[_ <: A] }] = List(new C, new D) + + // Not yet -- + // val data4: List[B[X] forSome { type X <: B[X] }] = List(new C, new D) + // <console>:7: error: type mismatch; + // found : List[B[_ >: D with C <: B[_ >: D with C <: A]]] + // required: List[B[X] forSome { type X <: B[X] }] + // val data4: List[B[X] forSome { type X <: B[X] }] = List(new C, new D) + + // works + val data5 = List[B[X] forSome { type X <: B[X] }](new C, new D) } diff --git a/test/files/pos/typealias_dubious.scala b/test/files/pos/typealias_dubious.scala index 587453a037..cdba1a64d0 100644 --- a/test/files/pos/typealias_dubious.scala +++ b/test/files/pos/typealias_dubious.scala @@ -1,15 +1,15 @@ class MailBox { - //class Message + //class Message type Message = AnyRef -} - +} + abstract class Actor { private val in = new MailBox - def send(msg: in.Message) = error("foo") + def send(msg: in.Message) = sys.error("foo") - def unstable: Actor = error("foo") + def unstable: Actor = sys.error("foo") - def dubiousSend(msg: MailBox#Message) = + def dubiousSend(msg: MailBox#Message) = unstable.send(msg) // in.Message becomes unstable.Message, but that's ok since Message is a concrete type member -} +} diff --git a/test/files/pos/variances-flip.scala b/test/files/pos/variances-flip.scala new file mode 100644 index 0000000000..c3ea7b571d --- /dev/null +++ b/test/files/pos/variances-flip.scala @@ -0,0 +1,7 @@ +trait Foo[-A, +B, -C, +D] { + private[this] def b: B = ??? + private[this] def d: D = ??? + + def f(p1: B => A, p2: D => C) = g(p1(b), p2(d)) + def g(x: A, y: C) = ((b, d)) +} diff --git a/test/files/pos/variances-local.scala b/test/files/pos/variances-local.scala new file mode 100644 index 0000000000..35e395095c --- /dev/null +++ b/test/files/pos/variances-local.scala @@ -0,0 +1,7 @@ +class Foo1[+T] { + private[this] type MyType = T +} + +class Foo2[+T] { + protected[this] type MyType = T +} diff --git a/test/files/pos/virtpatmat_binding_opt.scala b/test/files/pos/virtpatmat_binding_opt.scala index 962e3d7dbe..8ec931fe78 100644 --- a/test/files/pos/virtpatmat_binding_opt.scala +++ b/test/files/pos/virtpatmat_binding_opt.scala @@ -4,8 +4,8 @@ class Test { case that: Test2 => println(that) this - case _ => error("meh") + case _ => sys.error("meh") } } -class Test2 extends Test
\ No newline at end of file +class Test2 extends Test |