diff options
Diffstat (limited to 'test')
326 files changed, 3528 insertions, 721 deletions
diff --git a/test/files/disabled/A.scala b/test/disabled/buildmanager/overloaded_1/A.scala index c070faf978..c070faf978 100644 --- a/test/files/disabled/A.scala +++ b/test/disabled/buildmanager/overloaded_1/A.scala diff --git a/test/files/disabled/overloaded_1.check b/test/disabled/buildmanager/overloaded_1/overloaded_1.check index 4d643ce6b4..4d643ce6b4 100644 --- a/test/files/disabled/overloaded_1.check +++ b/test/disabled/buildmanager/overloaded_1/overloaded_1.check diff --git a/test/files/disabled/overloaded_1.test b/test/disabled/buildmanager/overloaded_1/overloaded_1.test index 392e0d365f..392e0d365f 100644 --- a/test/files/disabled/overloaded_1.test +++ b/test/disabled/buildmanager/overloaded_1/overloaded_1.test diff --git a/test/files/disabled/t4245/A.scala b/test/disabled/buildmanager/t4245/A.scala index 7c4efe1b4b..7c4efe1b4b 100644 --- a/test/files/disabled/t4245/A.scala +++ b/test/disabled/buildmanager/t4245/A.scala diff --git a/test/files/disabled/t4245/t4245.check b/test/disabled/buildmanager/t4245/t4245.check index 3d3898c671..3d3898c671 100644 --- a/test/files/disabled/t4245/t4245.check +++ b/test/disabled/buildmanager/t4245/t4245.check diff --git a/test/files/disabled/t4245/t4245.test b/test/disabled/buildmanager/t4245/t4245.test index 392e0d365f..392e0d365f 100644 --- a/test/files/disabled/t4245/t4245.test +++ b/test/disabled/buildmanager/t4245/t4245.test diff --git a/test/files/run/t4146.scala b/test/disabled/run/t4146.scala index 93ce22b519..a17de50ee1 100644 --- a/test/files/run/t4146.scala +++ b/test/disabled/run/t4146.scala @@ -1,4 +1,4 @@ -object bob extends Application { +object bob extends App { var name = "Bob" } diff --git a/test/files/bench/equality/eqeq.eqlog b/test/files/bench/equality/eqeq.eqlog index d1e27aceed..55a5eb430a 100644 --- a/test/files/bench/equality/eqeq.eqlog +++ b/test/files/bench/equality/eqeq.eqlog @@ -1,42 +1,42 @@ -Banchmark results for testing equality operations:
-eq.scala: Base case, use eq equality only
-eqeq.scala: Test case, use == instead of eq.
-All tests run on Thinkpad T400, 1.6.0_12 client VM.
-Test command: java eq 5 5
- java eqeq 5 5
-eq.scala, no -optimise
-eq$ 109 78 79 63 63
-eq$ 94 63 63 78 78
-eq$ 94 62 62 62 78
-eq$ 94 78 78 78 78
-eq$ 94 78 78 78 78
-eq.scala, with -optimise
-eq$ 421 63 62 47 63
-eq$ 406 62 62 63 62
-eq$ 407 62 62 78 63
-eq$ 406 63 63 62 62
-eq$ 407 62 62 63 47
-eqeq.scala with version of BoxesRuntime as of Nov 13th, no -optimise
-eqeq$ 562 516 516 516 515
-eqeq$ 547 515 515 531 532
-eqeq$ 532 516 516 515 516
-eqeq$ 547 531 531 516 531
-eqeq$ 547 515 515 516 516
-eqeq.scala with version of BoxesRuntime as of Nov 13th, with -optimise
-eqeq$ 1031 390 391 391 391
-eqeq$ 1031 391 391 391 390
-eqeq$ 1031 390 390 391 391
-eqeq$ 1031 406 407 391 390
-eqeq$ 1031 390 390 391 391
-eqeq.scala with 1st optimized of Nov 14th, no -optimise
-eqeq$ 484 421 438 438 437
-eqeq$ 484 438 437 437 438
-eqeq$ 469 437 453 454 438
-eqeq$ 468 437 438 468 438
-eqeq$ 485 437 437 422 438
-eqeq.scala with 1st optimized of Nov 14th, with -optimise
-eqeq$ 1016 375 391 375 375
-eqeq$ 1016 375 391 390 375
-eqeq$ 1016 390 391 375 375
-eqeq$ 1015 375 391 390 375
-eqeq$ 1016 390 375 375 375
+Banchmark results for testing equality operations: +eq.scala: Base case, use eq equality only +eqeq.scala: Test case, use == instead of eq. +All tests run on Thinkpad T400, 1.6.0_12 client VM. +Test command: java eq 5 5 + java eqeq 5 5 +eq.scala, no -optimise +eq$ 109 78 79 63 63 +eq$ 94 63 63 78 78 +eq$ 94 62 62 62 78 +eq$ 94 78 78 78 78 +eq$ 94 78 78 78 78 +eq.scala, with -optimise +eq$ 421 63 62 47 63 +eq$ 406 62 62 63 62 +eq$ 407 62 62 78 63 +eq$ 406 63 63 62 62 +eq$ 407 62 62 63 47 +eqeq.scala with version of BoxesRuntime as of Nov 13th, no -optimise +eqeq$ 562 516 516 516 515 +eqeq$ 547 515 515 531 532 +eqeq$ 532 516 516 515 516 +eqeq$ 547 531 531 516 531 +eqeq$ 547 515 515 516 516 +eqeq.scala with version of BoxesRuntime as of Nov 13th, with -optimise +eqeq$ 1031 390 391 391 391 +eqeq$ 1031 391 391 391 390 +eqeq$ 1031 390 390 391 391 +eqeq$ 1031 406 407 391 390 +eqeq$ 1031 390 390 391 391 +eqeq.scala with 1st optimized of Nov 14th, no -optimise +eqeq$ 484 421 438 438 437 +eqeq$ 484 438 437 437 438 +eqeq$ 469 437 453 454 438 +eqeq$ 468 437 438 468 438 +eqeq$ 485 437 437 422 438 +eqeq.scala with 1st optimized of Nov 14th, with -optimise +eqeq$ 1016 375 391 375 375 +eqeq$ 1016 375 391 390 375 +eqeq$ 1016 390 391 375 375 +eqeq$ 1015 375 391 390 375 +eqeq$ 1016 390 375 375 375 diff --git a/test/files/continuations-run/implicit-infer-annotations.check b/test/files/continuations-run/implicit-infer-annotations.check new file mode 100644 index 0000000000..e8206c4319 --- /dev/null +++ b/test/files/continuations-run/implicit-infer-annotations.check @@ -0,0 +1,5 @@ +Range(5, 6, 7, 8, 9, 10) +Range(5, 6, 7, 8, 9, 10) +15 +List(10, 1, 2, 3) +Range(5, 6, 7, 8, 9, 10) diff --git a/test/files/continuations-run/implicit-infer-annotations.scala b/test/files/continuations-run/implicit-infer-annotations.scala new file mode 100644 index 0000000000..3f0e959f60 --- /dev/null +++ b/test/files/continuations-run/implicit-infer-annotations.scala @@ -0,0 +1,59 @@ +import annotation._ + +object A { + class foo[-B,+C] extends StaticAnnotation with TypeConstraint + + def shift[A, B, C](fun: (A => B) => C): A @foo[B, C] = ??? + def reset[A, C](ctx: => (A @foo[A, C])): C = ??? + + def m1 = reset { shift { f: (Int => Range) => f(5) }.to(10) } +} + +object B { + import scala.util.continuations._ + + def m1 = reset { shift { f: (Int => Range) => f(5) }.to(10) } + def m2 = reset { val a = shift { f: (Int => Range) => f(5) } ; a.to(10) } + + val x1 = reset{ + shift{ cont: (Int => Range) => + cont(5) + }.to(10) + } + + val x2 = reset{ + val a = shift{ cont: (Int => Range) => + cont(5) + } + a.to(10) + } // x is now Range(5, 6, 7, 8, 9, 10) + + val x3 = reset{ + shift{ cont: (Int => Int) => + cont(5) + } + 10 + } // x is now 15 + + val x4 = reset{ + 10 :: shift{ cont: (List[Int] => List[Int]) => + cont(List(1, 2, 3)) + } + } // x is List(10, 1, 2, 3) + + val x5 = reset{ + new scala.runtime.RichInt(shift{ cont: (Int => Range) => + cont(5) + }) to 10 + } +} + +object Test { + def main(args: Array[String]): Unit = { + import B._ + println(x1) + println(x2) + println(x3) + println(x4) + println(x5) + } +} diff --git a/test/files/detach-run/actor/java.policy b/test/files/detach-run/actor/java.policy index 4beb2ca26b..b305f10b4c 100644 --- a/test/files/detach-run/actor/java.policy +++ b/test/files/detach-run/actor/java.policy @@ -19,7 +19,7 @@ grant codeBase "@PROJECT_LIB_BASE@" { permission java.util.PropertyPermission "java.rmi.server.hostname", "read"; permission java.util.PropertyPermission "sun.rmi.dgc.server.gcInterval", "read,write"; }; -
+ //grant { // permission java.security.AllPermission; //}; diff --git a/test/files/instrumented/t6611.check b/test/files/instrumented/t6611.check new file mode 100644 index 0000000000..5cd691e93a --- /dev/null +++ b/test/files/instrumented/t6611.check @@ -0,0 +1 @@ +Method call statistics: diff --git a/test/files/instrumented/t6611.scala b/test/files/instrumented/t6611.scala new file mode 100644 index 0000000000..4c52f8a5ef --- /dev/null +++ b/test/files/instrumented/t6611.scala @@ -0,0 +1,35 @@ +import scala.tools.partest.instrumented.Instrumentation._ + +object Test { + def main(args: Array[String]) { + startProfiling() + + // tests optimization in Cleanup for varargs reference arrays + Array("") + + + Array(true) + Array(true, false) + Array(1: Byte) + Array(1: Byte, 2: Byte) + Array(1: Short) + Array(1: Short, 2: Short) + Array(1) + Array(1, 2) + Array(1L) + Array(1L, 2L) + Array(1d) + Array(1d, 2d) + Array(1f) + Array(1f, 2f) + + /* Not currently optimized: + Array[Int](1, 2) etc + Array(()) + Array((), ()) + */ + + stopProfiling() + printStatistics() + } +} diff --git a/test/files/jvm/t1143-2/t1143-2.scala b/test/files/jvm/t1143-2/t1143-2.scala index 44b1febd8b..13ab13b48c 100644 --- a/test/files/jvm/t1143-2/t1143-2.scala +++ b/test/files/jvm/t1143-2/t1143-2.scala @@ -16,43 +16,39 @@ object Serialize { } } -@serializable @SerialVersionUID(1L) -class VarModel[T]( getter: => T, setter: T => Unit ) -{ +class VarModel[T](getter: => T, setter: T => Unit) extends Serializable { Serialize.write(getter) Serialize.write(setter) - def this( getter: => T ) = this( getter, null ) + def this(getter: => T) = this(getter, null) def getObject: AnyRef = getter.asInstanceOf[AnyRef] - def setObject( v: AnyRef ) = { - if( setter==null ) - throw new RuntimeException( "Tried to set readonly model!") - setter( v.asInstanceOf[T] ) + def setObject(v: AnyRef) = { + if(setter==null) + throw new RuntimeException("Tried to set readonly model!") + setter(v.asInstanceOf[T]) } def detach = () } -@serializable @SerialVersionUID(1L) -class Printer( p: VarModel[String] ) { - def print = println( p.getObject ); +class Printer(p: VarModel[String]) extends Serializable { + def print = println(p.getObject) } class Component extends Marker { } class Form extends Component { } -@serializable @SerialVersionUID(1L) -class Main { +class Main extends Serializable { var pass = "pass" - def main(args : Array[String]) : Unit = { + def main(args: Array[String]): Unit = { val f = new Form { - val p = new Printer( new VarModel( pass, s => pass = s ) ); + val p = new Printer(new VarModel(pass, s => pass = s)) p.print } () diff --git a/test/files/jvm/t1143.scala b/test/files/jvm/t1143.scala index 7dd374f432..eb03c7224e 100644 --- a/test/files/jvm/t1143.scala +++ b/test/files/jvm/t1143.scala @@ -16,9 +16,8 @@ object Serialize { } } -@serializable @SerialVersionUID(1L) -class VarModel[T](getter: => T, setter: T => Unit) { +class VarModel[T](getter: => T, setter: T => Unit) extends Serializable { Serialize.write(getter) Serialize.write(setter) @@ -35,23 +34,20 @@ class VarModel[T](getter: => T, setter: T => Unit) { def detach = () } -@serializable @SerialVersionUID(1L) -class Printer(p: VarModel[String]) { +class Printer(p: VarModel[String]) extends Serializable { def print = println(p.getObject) } -@serializable @SerialVersionUID(1L) -class Component { +class Component extends Serializable { } class Form extends Component { } -@serializable @SerialVersionUID(1L) -class Main { +class Main extends Serializable { var pass = "pass" def main(args: Array[String]) { val f = new Form { diff --git a/test/files/jvm/t1342/SI.scala b/test/files/jvm/t1342/SI.scala index 8e3b753210..7c37d4bcd7 100644 --- a/test/files/jvm/t1342/SI.scala +++ b/test/files/jvm/t1342/SI.scala @@ -4,7 +4,7 @@ class SI extends JI { } } -object Test extends Application { +object Test extends App { val x: JI = new SI x.varArgsMethod("one", "two") } diff --git a/test/files/jvm/t1600.scala b/test/files/jvm/t1600.scala index 7e23687425..69179c1ba4 100644 --- a/test/files/jvm/t1600.scala +++ b/test/files/jvm/t1600.scala @@ -69,8 +69,7 @@ object Test { var hashCodeModifier = 0 } - @serializable - class Foo { + class Foo extends Serializable { override def hashCode = System.identityHashCode(this) + Foo.hashCodeModifier } } diff --git a/test/files/jvm/ticket2163/ticket2163.java b/test/files/jvm/t2163/t2163.java index b6511d241c..83bd37d212 100644 --- a/test/files/jvm/ticket2163/ticket2163.java +++ b/test/files/jvm/t2163/t2163.java @@ -1,9 +1,9 @@ import java.util.*; -public class ticket2163 { +public class t2163 { public void test() { List<Integer> array = new ArrayList<Integer>(); - Ticket2163Scala<List> foo = new Ticket2163Scala<List>(array); + T2163Scala<List> foo = new T2163Scala<List>(array); foo.bar(array); } } diff --git a/test/files/jvm/t2163/t2163.scala b/test/files/jvm/t2163/t2163.scala new file mode 100644 index 0000000000..f73b520cbe --- /dev/null +++ b/test/files/jvm/t2163/t2163.scala @@ -0,0 +1,5 @@ +class T2163Scala[CC[X]](x: CC[Int]) { + def bar[DD[X]](meh: DD[Int]): CC[Int] = x +} + +object Test extends App {} diff --git a/test/files/jvm/t2470.cmds b/test/files/jvm/t2470.cmds deleted file mode 100644 index b4ef0f4aeb..0000000000 --- a/test/files/jvm/t2470.cmds +++ /dev/null @@ -1,3 +0,0 @@ -javac Action.java Task.java -scalac Test_1.scala -scalac Read_Classfile_2.scala diff --git a/test/files/jvm/t2570/Test.scala b/test/files/jvm/t2570/Test.scala index 7944aedae6..f1cba53546 100644 --- a/test/files/jvm/t2570/Test.scala +++ b/test/files/jvm/t2570/Test.scala @@ -1,3 +1,3 @@ class Test2 extends Test1[Test3[Test4]] class Test4 -object Test extends Application {}
\ No newline at end of file +object Test extends App {}
\ No newline at end of file diff --git a/test/files/jvm/t3003.cmds b/test/files/jvm/t3003.cmds deleted file mode 100644 index c00396627c..0000000000 --- a/test/files/jvm/t3003.cmds +++ /dev/null @@ -1,2 +0,0 @@ -javac Annot.java -scalac Test_1.scala diff --git a/test/files/jvm/t3415/HelloWorld.scala b/test/files/jvm/t3415/HelloWorld.scala index 53bf55e444..5ef012390e 100644 --- a/test/files/jvm/t3415/HelloWorld.scala +++ b/test/files/jvm/t3415/HelloWorld.scala @@ -1,4 +1,4 @@ -object Test extends Application { +object Test extends App { @Hello def foo() { } } diff --git a/test/files/jvm/ticket4283/AbstractFoo.java b/test/files/jvm/t4283/AbstractFoo.java index 74f3827fe3..74f3827fe3 100644 --- a/test/files/jvm/ticket4283/AbstractFoo.java +++ b/test/files/jvm/t4283/AbstractFoo.java diff --git a/test/files/jvm/ticket4283/ScalaBipp.scala b/test/files/jvm/t4283/ScalaBipp.scala index 36dea9f4de..36dea9f4de 100644 --- a/test/files/jvm/ticket4283/ScalaBipp.scala +++ b/test/files/jvm/t4283/ScalaBipp.scala diff --git a/test/files/jvm/ticket4283/Test.scala b/test/files/jvm/t4283/Test.scala index 9bbfaab928..9bbfaab928 100644 --- a/test/files/jvm/ticket4283/Test.scala +++ b/test/files/jvm/t4283/Test.scala diff --git a/test/files/jvm/ticket2163/ticket2163.scala b/test/files/jvm/ticket2163/ticket2163.scala deleted file mode 100644 index d30bfe251b..0000000000 --- a/test/files/jvm/ticket2163/ticket2163.scala +++ /dev/null @@ -1,5 +0,0 @@ -class Ticket2163Scala[CC[X]](x: CC[Int]) { - def bar[DD[X]](meh: DD[Int]): CC[Int] = x -} - -object Test extends Application {} diff --git a/test/files/jvm/typerep.scala b/test/files/jvm/typerep.scala index 3befc7ff3f..47bd16a467 100644 --- a/test/files/jvm/typerep.scala +++ b/test/files/jvm/typerep.scala @@ -280,100 +280,74 @@ object TypeRep { override def toString = "Nothing" } - @serializable case class ClassRep[A](elemRep: TypeRep[A]) extends TypeRep[Class[A]] { override def toString = "Class[" + elemRep + "]" } - @serializable case class SomeRep[A](elemRep: TypeRep[A]) extends TypeRep[Some[A]] { override def toString = "Some[" + elemRep + "]" } - @serializable case class NoneRep[A](elemRep: TypeRep[A]) extends TypeRep[Option[A]] { override def toString = "None[" + elemRep + "]" } - - @serializable case class ListRep[A](elemRep: TypeRep[A]) extends TypeRep[List[A]] { override def toString = "List[" + elemRep + "]" } - - @serializable case class ArrayRep[A](elemRep: TypeRep[A]) extends TypeRep[Array[A]] { override def toString = "Array[" + elemRep + "]" } - - @serializable case class Tuple2Rep[A1, A2](_1: TypeRep[A1], _2: TypeRep[A2]) extends TypeRep[(A1, A2)] { override def toString = "Tuple2[" + _1 + ", " + _2 + "]" } - @serializable case class Tuple3Rep[A1, A2, A3](_1: TypeRep[A1], _2: TypeRep[A2], _3: TypeRep[A3]) extends TypeRep[Tuple3[A1, A2, A3]] { override def toString = "Tuple3[" + _1 + ", " + _2 + ", " + _3 + "]" } - @serializable case class Tuple4Rep[A1, A2, A3, A4](_1: TypeRep[A1], _2: TypeRep[A2], _3: TypeRep[A3], _4: TypeRep[A4]) extends TypeRep[Tuple4[A1, A2, A3, A4]] { override def toString = "Tuple4[" + _1 + ", " + _2 + ", " + _3 + ", " + _4 + "]" } - @serializable case class Tuple5Rep[A1, A2, A3, A4, A5](_1: TypeRep[A1], _2: TypeRep[A2], _3: TypeRep[A3], _4: TypeRep[A4], _5: TypeRep[A5]) extends TypeRep[Tuple5[A1, A2, A3, A4, A5]] { override def toString = "Tuple5[" + _1 + ", " + _2 + ", " + _3 + ", " + _4 + ", " + _5 + "]" } - @serializable case class Tuple6Rep[A1, A2, A3, A4, A5, A6](val _1: TypeRep[A1], val _2: TypeRep[A2], val _3: TypeRep[A3], val _4: TypeRep[A4], val _5: TypeRep[A5], val _6: TypeRep[A6]) extends TypeRep[Tuple6[A1, A2, A3, A4, A5, A6]] { override def toString = "Tuple6[" + _1 + ", " + _2 + ", " + _3 + ", " + _4 + ", " + _5 + ", " + _6 + "]" } - @serializable case class Tuple7Rep[A1, A2, A3, A4, A5, A6, A7](val _1: TypeRep[A1], val _2: TypeRep[A2], val _3: TypeRep[A3], val _4: TypeRep[A4], val _5: TypeRep[A5], val _6: TypeRep[A6], val _7: TypeRep[A7]) extends TypeRep[Tuple7[A1, A2, A3, A4, A5, A6, A7]] { override def toString = "Tuple7[" + _1 + ", " + _2 + ", " + _3 + ", " + _4 + ", " + _5 + ", " + _6 + ", " + _7 + "]" } - @serializable case class Tuple8Rep[A1, A2, A3, A4, A5, A6, A7, A8](val _1: TypeRep[A1], val _2: TypeRep[A2], val _3: TypeRep[A3], val _4: TypeRep[A4], val _5: TypeRep[A5], val _6: TypeRep[A6], val _7: TypeRep[A7], val _8: TypeRep[A8]) extends TypeRep[Tuple8[A1, A2, A3, A4, A5, A6, A7, A8]] { override def toString = "Tuple8[" + _1 + ", " + _2 + ", " + _3 + ", " + _4 + ", " + _5 + ", " + _6 + ", " + _7 + ", " + _8 + "]" } - @serializable case class Tuple9Rep[A1, A2, A3, A4, A5, A6, A7, A8, A9](val _1: TypeRep[A1], val _2: TypeRep[A2], val _3: TypeRep[A3], val _4: TypeRep[A4], val _5: TypeRep[A5], val _6: TypeRep[A6], val _7: TypeRep[A7], val _8: TypeRep[A8], val _9: TypeRep[A9]) extends TypeRep[Tuple9[A1, A2, A3, A4, A5, A6, A7, A8, A9]] { override def toString = "Tuple9[" + _1 + ", " + _2 + ", " + _3 + ", " + _4 + ", " + _5 + ", " + _6 + ", " + _7 + ", " + _8 + ", " + _9 + "]" } - @serializable case class Function1Rep[A1, B](a1: TypeRep[A1], b: TypeRep[B]) extends TypeRep[Function1[A1, B]] { override def toString = "Function1[" + a1 + ", " + b + "]" } - @serializable case class Function2Rep[A1, A2, B](a1: TypeRep[A1], a2: TypeRep[A2], b: TypeRep[B]) extends TypeRep[Function2[A1, A2, B]] { override def toString = "Function2[" + a1 + ", " + a2 + ", " + b + "]" } - @serializable case class Function3Rep[A1, A2, A3, B](a1: TypeRep[A1], a2: TypeRep[A2], a3: TypeRep[A3], b: TypeRep[B]) extends TypeRep[Function3[A1, A2, A3, B]] { override def toString = "Function3[" + a1 + ", " + a2 + ", " + a3 + ", " + b + "]" } - @serializable case class Function4Rep[A1, A2, A3, A4, B](a1: TypeRep[A1], a2: TypeRep[A2], a3: TypeRep[A3], a4: TypeRep[A4], b: TypeRep[B]) extends TypeRep[Function4[A1, A2, A3, A4, B]] { override def toString = "Function4[" + a1 + ", " + a2 + ", " + a3 + ", " + a4 + ", " + b + "]" } - @serializable case class Function5Rep[A1, A2, A3, A4, A5, B](a1: TypeRep[A1], a2: TypeRep[A2], a3: TypeRep[A3], a4: TypeRep[A4], a5: TypeRep[A5], b: TypeRep[B]) extends TypeRep[Function5[A1, A2, A3, A4, A5, B]] { override def toString = "Function5[" + a1 + ", " + a2 + ", " + a3 + ", " + a4 + ", " + a5 + ", " + b + "]" } - @serializable case class Function6Rep[A1, A2, A3, A4, A5, A6, B](a1: TypeRep[A1], a2: TypeRep[A2], a3: TypeRep[A3], a4: TypeRep[A4], a5: TypeRep[A5], a6: TypeRep[A6], b: TypeRep[B]) extends TypeRep[Function6[A1, A2, A3, A4, A5, A6, B]] { override def toString = "Function6[" + a1 + ", " + a2 + ", " + a3 + ", " + a4 + ", " + a5 + ", " + a6 + ", " + b + "]" } - @serializable case class Function7Rep[A1, A2, A3, A4, A5, A6, A7, B](a1: TypeRep[A1], a2: TypeRep[A2], a3: TypeRep[A3], a4: TypeRep[A4], a5: TypeRep[A5], a6: TypeRep[A6], a7: TypeRep[A7], b: TypeRep[B]) extends TypeRep[Function7[A1, A2, A3, A4, A5, A6, A7, B]] { override def toString = "Function7[" + a1 + ", " + a2 + ", " + a3 + ", " + a4 + ", " + a5 + ", " + a6 + ", " + a7 + ", " + b + "]" } - @serializable case class Function8Rep[A1, A2, A3, A4, A5, A6, A7, A8, B](a1: TypeRep[A1], a2: TypeRep[A2], a3: TypeRep[A3], a4: TypeRep[A4], a5: TypeRep[A5], a6: TypeRep[A6], a7: TypeRep[A7], a8: TypeRep[A8], b: TypeRep[B]) extends TypeRep[Function8[A1, A2, A3, A4, A5, A6, A7, A8, B]] { override def toString = "Function8[" + a1 + ", " + a2 + ", " + a3 + ", " + a4 + ", " + a5 + ", " + a6 + ", " + a7 + ", " + a8 + b + "]" } - @serializable case class Function9Rep[A1, A2, A3, A4, A5, A6, A7, A8, A9, B](a1: TypeRep[A1], a2: TypeRep[A2], a3: TypeRep[A3], a4: TypeRep[A4], a5: TypeRep[A5], a6: TypeRep[A6], a7: TypeRep[A7], a8: TypeRep[A8], a9: TypeRep[A9], b: TypeRep[B]) extends TypeRep[Function9[A1, A2, A3, A4, A5, A6, A7, A8, A9, B]] { override def toString = "Function9[" + a1 + ", " + a2 + ", " + a3 + ", " + a4 + ", " + a5 + ", " + a6 + ", " + a7 + ", " + a8 + ", " + b + "]" } /* - @serializable case class ObjectRep[A](c: Class) extends TypeRep[A] { override def toString = c.getName } diff --git a/test/files/lib/jsoup-1.3.1.jar.desired.sha1 b/test/files/lib/jsoup-1.3.1.jar.desired.sha1 new file mode 100644 index 0000000000..46fa3dae9d --- /dev/null +++ b/test/files/lib/jsoup-1.3.1.jar.desired.sha1 @@ -0,0 +1 @@ +346d3dff4088839d6b4d163efa2892124039d216 ?jsoup-1.3.1.jar diff --git a/test/files/neg/abstract-inaccessible.check b/test/files/neg/abstract-inaccessible.check index 42b98ac026..d56f5691be 100644 --- a/test/files/neg/abstract-inaccessible.check +++ b/test/files/neg/abstract-inaccessible.check @@ -1,13 +1,15 @@ -abstract-inaccessible.scala:5: error: method implementMe in trait YourTrait references private[foo] trait Bippy. +abstract-inaccessible.scala:5: warning: method implementMe in trait YourTrait references private[foo] trait Bippy. Classes which cannot access Bippy may be unable to provide a concrete implementation of implementMe. def implementMe(f: Int => (String, Bippy)): Unit ^ -abstract-inaccessible.scala:6: error: method overrideMe in trait YourTrait references private[foo] trait Bippy. +abstract-inaccessible.scala:6: warning: method overrideMe in trait YourTrait references private[foo] trait Bippy. Classes which cannot access Bippy may be unable to override overrideMe. def overrideMe[T <: Bippy](x: T): T = x ^ -abstract-inaccessible.scala:7: error: method overrideMeAlso in trait YourTrait references private[foo] trait Bippy. +abstract-inaccessible.scala:7: warning: method overrideMeAlso in trait YourTrait references private[foo] trait Bippy. Classes which cannot access Bippy may be unable to override overrideMeAlso. def overrideMeAlso(x: Map[Int, Set[Bippy]]) = 5 ^ -three errors found +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/ambiguous-float-dots.check b/test/files/neg/ambiguous-float-dots.check index 6c21056d7a..cdd2d6fa2a 100644 --- a/test/files/neg/ambiguous-float-dots.check +++ b/test/files/neg/ambiguous-float-dots.check @@ -1,16 +1,27 @@ -ambiguous-float-dots.scala:2: error: This lexical syntax is deprecated. From scala 2.11, a dot will only be considered part of a number if it is immediately followed by a digit. +ambiguous-float-dots.scala:2: warning: This lexical syntax is deprecated. From scala 2.11, a dot will only be considered part of a number if it is immediately followed by a digit. val x0 = 5. ^ -ambiguous-float-dots.scala:6: error: This lexical syntax is deprecated. From scala 2.11, a dot will only be considered part of a number if it is immediately followed by a digit. +ambiguous-float-dots.scala:6: warning: This lexical syntax is deprecated. From scala 2.11, a dot will only be considered part of a number if it is immediately followed by a digit. val x1 = 5.f ^ -ambiguous-float-dots.scala:7: error: Treating numbers with a leading zero as octal is deprecated. +ambiguous-float-dots.scala:7: warning: Treating numbers with a leading zero as octal is deprecated. val y0 = 055 ^ -ambiguous-float-dots.scala:11: error: This lexical syntax is deprecated. From scala 2.11, a dot will only be considered part of a number if it is immediately followed by a digit. +ambiguous-float-dots.scala:11: warning: This lexical syntax is deprecated. From scala 2.11, a dot will only be considered part of a number if it is immediately followed by a digit. 1.+(2) ^ -ambiguous-float-dots.scala:12: error: This lexical syntax is deprecated. From scala 2.11, a dot will only be considered part of a number if it is immediately followed by a digit. +ambiguous-float-dots.scala:12: warning: This lexical syntax is deprecated. From scala 2.11, a dot will only be considered part of a number if it is immediately followed by a digit. 1. + 2 ^ -5 errors found +ambiguous-float-dots.scala:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 1.+(2) + ^ +ambiguous-float-dots.scala:12: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 1. + 2 + ^ +ambiguous-float-dots.scala:13: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 1 + 2 + ^ +error: No warnings can be incurred under -Xfatal-warnings. +8 warnings found +one error found diff --git a/test/files/neg/array-not-seq.check b/test/files/neg/array-not-seq.check deleted file mode 100644 index a3a639e772..0000000000 --- a/test/files/neg/array-not-seq.check +++ /dev/null @@ -1,13 +0,0 @@ -array-not-seq.scala:2: error: An Array will no longer match as Seq[_]. - def f1(x: Any) = x.isInstanceOf[Seq[_]] - ^ -array-not-seq.scala:4: error: An Array will no longer match as Seq[_]. - case _: Seq[_] => true - ^ -array-not-seq.scala:16: error: An Array will no longer match as Seq[_]. - case (Some(_: Seq[_]), Nil, _) => 1 - ^ -array-not-seq.scala:17: error: An Array will no longer match as Seq[_]. - case (None, List(_: List[_], _), _) => 2 - ^ -four errors found diff --git a/test/files/neg/array-not-seq.flags b/test/files/neg/array-not-seq.flags deleted file mode 100644 index 4e9f7e4a56..0000000000 --- a/test/files/neg/array-not-seq.flags +++ /dev/null @@ -1 +0,0 @@ --Xmigration -Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/array-not-seq.scala b/test/files/neg/array-not-seq.scala deleted file mode 100644 index 5f367bdd85..0000000000 --- a/test/files/neg/array-not-seq.scala +++ /dev/null @@ -1,26 +0,0 @@ -object Test { - def f1(x: Any) = x.isInstanceOf[Seq[_]] - def f2(x: Any) = x match { - case _: Seq[_] => true - case _ => false - } - - def f3(x: Any) = x match { - case _: Array[_] => true - case _ => false - } - - def f4(x: Any) = x.isInstanceOf[Traversable[_]] - - def f5(x1: Any, x2: Any, x3: AnyRef) = (x1, x2, x3) match { - case (Some(_: Seq[_]), Nil, _) => 1 - case (None, List(_: List[_], _), _) => 2 - case _ => 3 - } - - def main(args: Array[String]): Unit = { - // println(f1(Array(1))) - // println(f2(Array(1))) - // println(f3(Array(1)) - } -} diff --git a/test/files/neg/catch-all.check b/test/files/neg/catch-all.check index 62f895cc7e..2d58dd99a8 100644 --- a/test/files/neg/catch-all.check +++ b/test/files/neg/catch-all.check @@ -1,10 +1,15 @@ -catch-all.scala:2: error: This catches all Throwables. If this is really intended, use `case _ : Throwable` to clear this warning. +catch-all.scala:2: warning: This catches all Throwables, which often has undesirable consequences. +If intentional, use `case _ : Throwable` to clear this warning. try { "warn" } catch { case _ => } ^ -catch-all.scala:4: error: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning. +catch-all.scala:4: warning: This catches all Throwables, which often has undesirable consequences. +If intentional, use `case x : Throwable` to clear this warning. try { "warn" } catch { case x => } ^ -catch-all.scala:6: error: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning. +catch-all.scala:6: warning: This catches all Throwables, which often has undesirable consequences. +If intentional, use `case x : Throwable` to clear this warning. try { "warn" } catch { case _: RuntimeException => ; case x => } ^ -three errors found +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/check-dead.check b/test/files/neg/check-dead.check index 29601c1d4a..2150a942bf 100644 --- a/test/files/neg/check-dead.check +++ b/test/files/neg/check-dead.check @@ -1,13 +1,15 @@ -check-dead.scala:7: error: dead code following this construct +check-dead.scala:7: warning: dead code following this construct def z1 = y1(throw new Exception) // should warn ^ -check-dead.scala:10: error: dead code following this construct +check-dead.scala:10: warning: dead code following this construct def z2 = y2(throw new Exception) // should warn ^ -check-dead.scala:29: error: dead code following this construct +check-dead.scala:29: warning: dead code following this construct throw new Exception // should warn ^ -check-dead.scala:33: error: dead code following this construct +check-dead.scala:33: warning: dead code following this construct throw new Exception // should warn ^ -four errors found +error: No warnings can be incurred under -Xfatal-warnings. +four warnings found +one error found diff --git a/test/files/neg/checksensible.check b/test/files/neg/checksensible.check index d785179a56..e5f1a38d96 100644 --- a/test/files/neg/checksensible.check +++ b/test/files/neg/checksensible.check @@ -1,100 +1,102 @@ -checksensible.scala:13: error: comparing a fresh object using `eq' will always yield false +checksensible.scala:13: warning: comparing a fresh object using `eq' will always yield false (new AnyRef) eq (new AnyRef) ^ -checksensible.scala:14: error: comparing a fresh object using `ne' will always yield true +checksensible.scala:14: warning: comparing a fresh object using `ne' will always yield true (new AnyRef) ne (new AnyRef) ^ -checksensible.scala:15: error: comparing a fresh object using `eq' will always yield false +checksensible.scala:15: warning: comparing a fresh object using `eq' will always yield false Shmoopie eq (new AnyRef) ^ -checksensible.scala:16: error: comparing a fresh object using `eq' will always yield false +checksensible.scala:16: warning: comparing a fresh object using `eq' will always yield false (Shmoopie: AnyRef) eq (new AnyRef) ^ -checksensible.scala:17: error: comparing a fresh object using `eq' will always yield false +checksensible.scala:17: warning: comparing a fresh object using `eq' will always yield false (new AnyRef) eq Shmoopie ^ -checksensible.scala:18: error: comparing a fresh object using `eq' will always yield false +checksensible.scala:18: warning: comparing a fresh object using `eq' will always yield false (new AnyRef) eq null ^ -checksensible.scala:19: error: comparing a fresh object using `eq' will always yield false +checksensible.scala:19: warning: comparing a fresh object using `eq' will always yield false null eq new AnyRef ^ -checksensible.scala:26: error: comparing values of types Unit and Int using `==' will always yield false +checksensible.scala:26: warning: comparing values of types Unit and Int using `==' will always yield false (c = 1) == 0 ^ -checksensible.scala:27: error: comparing values of types Int and Unit using `==' will always yield false +checksensible.scala:27: warning: comparing values of types Int and Unit using `==' will always yield false 0 == (c = 1) ^ -checksensible.scala:29: error: comparing values of types Int and String using `==' will always yield false +checksensible.scala:29: warning: comparing values of types Int and String using `==' will always yield false 1 == "abc" ^ -checksensible.scala:33: error: comparing values of types Some[Int] and Int using `==' will always yield false +checksensible.scala:33: warning: comparing values of types Some[Int] and Int using `==' will always yield false Some(1) == 1 // as above ^ -checksensible.scala:38: error: comparing a fresh object using `==' will always yield false +checksensible.scala:38: warning: comparing a fresh object using `==' will always yield false new AnyRef == 1 ^ -checksensible.scala:41: error: comparing values of types Int and Boolean using `==' will always yield false +checksensible.scala:41: warning: comparing values of types Int and Boolean using `==' will always yield false 1 == (new java.lang.Boolean(true)) ^ -checksensible.scala:43: error: comparing values of types Int and Boolean using `!=' will always yield true +checksensible.scala:43: warning: comparing values of types Int and Boolean using `!=' will always yield true 1 != true ^ -checksensible.scala:44: error: comparing values of types Unit and Boolean using `==' will always yield false +checksensible.scala:44: warning: comparing values of types Unit and Boolean using `==' will always yield false () == true ^ -checksensible.scala:45: error: comparing values of types Unit and Unit using `==' will always yield true +checksensible.scala:45: warning: comparing values of types Unit and Unit using `==' will always yield true () == () ^ -checksensible.scala:46: error: comparing values of types Unit and Unit using `==' will always yield true +checksensible.scala:46: warning: comparing values of types Unit and Unit using `==' will always yield true () == println ^ -checksensible.scala:47: error: comparing values of types Unit and scala.runtime.BoxedUnit using `==' will always yield true +checksensible.scala:47: warning: comparing values of types Unit and scala.runtime.BoxedUnit using `==' will always yield true () == scala.runtime.BoxedUnit.UNIT // these should warn for always being true/false ^ -checksensible.scala:48: error: comparing values of types scala.runtime.BoxedUnit and Unit using `!=' will always yield false +checksensible.scala:48: warning: comparing values of types scala.runtime.BoxedUnit and Unit using `!=' will always yield false scala.runtime.BoxedUnit.UNIT != () ^ -checksensible.scala:51: error: comparing values of types Int and Unit using `!=' will always yield true +checksensible.scala:51: warning: comparing values of types Int and Unit using `!=' will always yield true (1 != println) ^ -checksensible.scala:52: error: comparing values of types Int and Symbol using `!=' will always yield true +checksensible.scala:52: warning: comparing values of types Int and Symbol using `!=' will always yield true (1 != 'sym) ^ -checksensible.scala:58: error: comparing a fresh object using `==' will always yield false +checksensible.scala:58: warning: comparing a fresh object using `==' will always yield false ((x: Int) => x + 1) == null ^ -checksensible.scala:59: error: comparing a fresh object using `==' will always yield false +checksensible.scala:59: warning: comparing a fresh object using `==' will always yield false Bep == ((_: Int) + 1) ^ -checksensible.scala:61: error: comparing a fresh object using `==' will always yield false +checksensible.scala:61: warning: comparing a fresh object using `==' will always yield false new Object == new Object ^ -checksensible.scala:62: error: comparing a fresh object using `==' will always yield false +checksensible.scala:62: warning: comparing a fresh object using `==' will always yield false new Object == "abc" ^ -checksensible.scala:63: error: comparing a fresh object using `!=' will always yield true +checksensible.scala:63: warning: comparing a fresh object using `!=' will always yield true new Exception() != new Exception() ^ -checksensible.scala:66: error: comparing values of types Int and Null using `==' will always yield false +checksensible.scala:66: warning: comparing values of types Int and Null using `==' will always yield false if (foo.length == null) "plante" else "plante pas" ^ -checksensible.scala:71: error: comparing values of types Bip and Bop using `==' will always yield false +checksensible.scala:71: warning: comparing values of types Bip and Bop using `==' will always yield false (x1 == x2) ^ -checksensible.scala:81: error: comparing values of types EqEqRefTest.this.C3 and EqEqRefTest.this.Z1 using `==' will always yield false +checksensible.scala:81: warning: comparing values of types EqEqRefTest.this.C3 and EqEqRefTest.this.Z1 using `==' will always yield false c3 == z1 ^ -checksensible.scala:82: error: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `==' will always yield false +checksensible.scala:82: warning: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `==' will always yield false z1 == c3 ^ -checksensible.scala:83: error: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `!=' will always yield true +checksensible.scala:83: warning: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `!=' will always yield true z1 != c3 ^ -checksensible.scala:84: error: comparing values of types EqEqRefTest.this.C3 and String using `!=' will always yield true +checksensible.scala:84: warning: comparing values of types EqEqRefTest.this.C3 and String using `!=' will always yield true c3 != "abc" ^ -checksensible.scala:95: error: comparing values of types Unit and Int using `!=' will always yield true +checksensible.scala:95: warning: comparing values of types Unit and Int using `!=' will always yield true while ((c = in.read) != -1) ^ -33 errors found +error: No warnings can be incurred under -Xfatal-warnings. +33 warnings found +one error found diff --git a/test/files/neg/classmanifests_new_deprecations.check b/test/files/neg/classmanifests_new_deprecations.check index 12428c7626..fddd6bf5b4 100644 --- a/test/files/neg/classmanifests_new_deprecations.check +++ b/test/files/neg/classmanifests_new_deprecations.check @@ -1,31 +1,33 @@ -classmanifests_new_deprecations.scala:2: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead +classmanifests_new_deprecations.scala:2: warning: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead def cm1[T: ClassManifest] = ??? ^ -classmanifests_new_deprecations.scala:3: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead +classmanifests_new_deprecations.scala:3: warning: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead def cm2[T](implicit evidence$1: ClassManifest[T]) = ??? ^ -classmanifests_new_deprecations.scala:4: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead +classmanifests_new_deprecations.scala:4: warning: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead val cm3: ClassManifest[Int] = null ^ -classmanifests_new_deprecations.scala:4: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead +classmanifests_new_deprecations.scala:4: warning: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead val cm3: ClassManifest[Int] = null ^ -classmanifests_new_deprecations.scala:6: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead +classmanifests_new_deprecations.scala:6: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead def rcm1[T: scala.reflect.ClassManifest] = ??? ^ -classmanifests_new_deprecations.scala:7: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead +classmanifests_new_deprecations.scala:7: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead def rcm2[T](implicit evidence$1: scala.reflect.ClassManifest[T]) = ??? ^ -classmanifests_new_deprecations.scala:8: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead +classmanifests_new_deprecations.scala:8: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead val rcm3: scala.reflect.ClassManifest[Int] = null ^ -classmanifests_new_deprecations.scala:8: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead +classmanifests_new_deprecations.scala:8: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead val rcm3: scala.reflect.ClassManifest[Int] = null ^ -classmanifests_new_deprecations.scala:10: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead +classmanifests_new_deprecations.scala:10: warning: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead type CM[T] = ClassManifest[T] ^ -classmanifests_new_deprecations.scala:15: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead +classmanifests_new_deprecations.scala:15: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead type RCM[T] = scala.reflect.ClassManifest[T] ^ -10 errors found +error: No warnings can be incurred under -Xfatal-warnings. +10 warnings found +one error found diff --git a/test/files/neg/cycle-bounds.check b/test/files/neg/cycle-bounds.check new file mode 100644 index 0000000000..d924838aec --- /dev/null +++ b/test/files/neg/cycle-bounds.check @@ -0,0 +1,4 @@ +cycle-bounds.scala:5: error: illegal cyclic reference involving type T +class NotOk[T <: Comparable[_ <: T]] + ^ +one error found diff --git a/test/files/neg/cycle-bounds.flags b/test/files/neg/cycle-bounds.flags new file mode 100644 index 0000000000..ca20f55172 --- /dev/null +++ b/test/files/neg/cycle-bounds.flags @@ -0,0 +1 @@ +-Ybreak-cycles diff --git a/test/files/neg/cycle-bounds.scala b/test/files/neg/cycle-bounds.scala new file mode 100644 index 0000000000..0b43bc703e --- /dev/null +++ b/test/files/neg/cycle-bounds.scala @@ -0,0 +1,5 @@ +// This should be allowed +class Ok[T <: Comparable[_ >: T]] + +// This is (il)legitimately a cyclic reference +class NotOk[T <: Comparable[_ <: T]] diff --git a/test/files/neg/dbldef.check b/test/files/neg/dbldef.check index 3ee63475e4..b896c4cdcf 100644 --- a/test/files/neg/dbldef.check +++ b/test/files/neg/dbldef.check @@ -6,9 +6,7 @@ dbldef.scala:1: error: type mismatch; required: Int case class test0(x: Int, x: Float) ^ -dbldef.scala:1: error: type mismatch; - found : Float - required: Int +dbldef.scala:1: error: in class test0, multiple overloaded alternatives of x define default arguments case class test0(x: Int, x: Float) ^ three errors found diff --git a/test/files/neg/exhausting.check b/test/files/neg/exhausting.check index 0f0d13cb33..c573eb3e15 100644 --- a/test/files/neg/exhausting.check +++ b/test/files/neg/exhausting.check @@ -1,25 +1,27 @@ -exhausting.scala:21: error: match may not be exhaustive. +exhausting.scala:21: warning: match may not be exhaustive. It would fail on the following input: List(_, _, _) def fail1[T](xs: List[T]) = xs match { ^ -exhausting.scala:27: error: match may not be exhaustive. +exhausting.scala:27: warning: match may not be exhaustive. It would fail on the following input: Nil def fail2[T](xs: List[T]) = xs match { ^ -exhausting.scala:32: error: match may not be exhaustive. +exhausting.scala:32: warning: match may not be exhaustive. It would fail on the following input: List((x: Int forSome x not in (1, 2))) def fail3a(xs: List[Int]) = xs match { ^ -exhausting.scala:39: error: match may not be exhaustive. +exhausting.scala:39: warning: match may not be exhaustive. It would fail on the following input: Bar3 def fail3[T](x: Foo[T]) = x match { ^ -exhausting.scala:47: error: match may not be exhaustive. +exhausting.scala:47: warning: match may not be exhaustive. It would fail on the following inputs: (Bar1, Bar2), (Bar1, Bar3), (Bar2, Bar1), (Bar2, Bar2) def fail4[T <: AnyRef](xx: (Foo[T], Foo[T])) = xx match { ^ -exhausting.scala:56: error: match may not be exhaustive. +exhausting.scala:56: warning: match may not be exhaustive. It would fail on the following inputs: (Bar1, Bar2), (Bar1, Bar3), (Bar2, Bar1), (Bar2, Bar2) def fail5[T](xx: (Foo[T], Foo[T])) = xx match { ^ -6 errors found +error: No warnings can be incurred under -Xfatal-warnings. +6 warnings found +one error found diff --git a/test/files/neg/gadts1.check b/test/files/neg/gadts1.check index 44d2b114d6..a61231a27a 100644 --- a/test/files/neg/gadts1.check +++ b/test/files/neg/gadts1.check @@ -1,8 +1,3 @@ -gadts1.scala:15: error: type mismatch; - found : Test.Double - required: a - case NumTerm(n) => c.x = Double(1.0) - ^ gadts1.scala:20: error: class Cell of type Test.Cell does not take type parameters. case Cell[a](x: Int) => c.x = 5 ^ @@ -11,4 +6,4 @@ gadts1.scala:20: error: type mismatch; required: a case Cell[a](x: Int) => c.x = 5 ^ -three errors found +two errors found diff --git a/test/files/neg/import-precedence.check b/test/files/neg/import-precedence.check new file mode 100644 index 0000000000..5f99611052 --- /dev/null +++ b/test/files/neg/import-precedence.check @@ -0,0 +1,19 @@ +import-precedence.scala:18: error: reference to X is ambiguous; +it is imported twice in the same scope by +import uniq1.uniq2._ +and import uniq1.X + object Y { def f = X } + ^ +import-precedence.scala:61: error: reference to X is ambiguous; +it is imported twice in the same scope by +import uniq1.uniq2._ +and import uniq1._ + object Y { def f = X } + ^ +import-precedence.scala:67: error: reference to X is ambiguous; +it is imported twice in the same scope by +import uniq1.uniq2.X +and import uniq1.X + object Y { def f = X } + ^ +three errors found diff --git a/test/files/neg/import-precedence.scala b/test/files/neg/import-precedence.scala new file mode 100644 index 0000000000..0401635e32 --- /dev/null +++ b/test/files/neg/import-precedence.scala @@ -0,0 +1,68 @@ +package uniq1 { + object X + package uniq2 { + object X + package uniq3 { + object X + package uniq4 { + object X + } + } + } +} + +package p1 { + import uniq1.X + package p2 { + import uniq1.uniq2._ + object Y { def f = X } + } +} + +package p2 { + import uniq1.uniq2._ + package p2 { + import uniq1.X + object Y { def f = X } + } +} + +package p3 { + import uniq1.X + import uniq1.uniq2._ + object Y { def f = X } +} + +package p4 { + import uniq1.uniq2._ + import uniq1.X + object Y { def f = X } +} + +package p5 { + import uniq1.X + package p6 { + import uniq1.uniq2.X + object Y { def f = X } + } +} + +package p6 { + import uniq1._ + package p5 { + import uniq1.uniq2._ + object Y { def f = X } + } +} + +package p7 { + import uniq1._ + import uniq1.uniq2._ + object Y { def f = X } +} + +package p8 { + import uniq1.X + import uniq1.uniq2.X + object Y { def f = X } +} diff --git a/test/files/neg/lubs.check b/test/files/neg/lubs.check index 77ab20102c..affbd4983c 100644 --- a/test/files/neg/lubs.check +++ b/test/files/neg/lubs.check @@ -1,5 +1,10 @@ +lubs.scala:10: error: type mismatch; + found : test1.A[test1.A[Object]] + required: test1.A[test1.A[test1.A[Any]]] + val x3: A[A[A[Any]]] = f + ^ lubs.scala:11: error: type mismatch; - found : test1.A[test1.A[test1.A[Any]]] + found : test1.A[test1.A[Object]] required: test1.A[test1.A[test1.A[test1.A[Any]]]] val x4: A[A[A[A[Any]]]] = f ^ @@ -13,4 +18,4 @@ lubs.scala:25: error: type mismatch; required: test2.A{type T >: Null <: test2.A{type T >: Null <: test2.A{type T >: Null <: test2.A}}} val x4: A { type T >: Null <: A { type T >: Null <: A { type T >: Null <: A } } } = f ^ -three errors found +four errors found diff --git a/test/files/neg/macro-deprecate-idents.check b/test/files/neg/macro-deprecate-idents.check index 22b667c390..c653eabaef 100644 --- a/test/files/neg/macro-deprecate-idents.check +++ b/test/files/neg/macro-deprecate-idents.check @@ -1,52 +1,54 @@ -macro-deprecate-idents.scala:2: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:2: warning: macro is now a reserved word; usage as an identifier is deprecated val macro = ??? ^ -macro-deprecate-idents.scala:6: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:6: warning: macro is now a reserved word; usage as an identifier is deprecated var macro = ??? ^ -macro-deprecate-idents.scala:10: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:10: warning: macro is now a reserved word; usage as an identifier is deprecated type macro = Int ^ -macro-deprecate-idents.scala:14: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:14: warning: macro is now a reserved word; usage as an identifier is deprecated class macro ^ -macro-deprecate-idents.scala:18: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:18: warning: macro is now a reserved word; usage as an identifier is deprecated class macro ^ -macro-deprecate-idents.scala:22: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:22: warning: macro is now a reserved word; usage as an identifier is deprecated object macro ^ -macro-deprecate-idents.scala:26: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:26: warning: macro is now a reserved word; usage as an identifier is deprecated object macro ^ -macro-deprecate-idents.scala:30: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:30: warning: macro is now a reserved word; usage as an identifier is deprecated trait macro ^ -macro-deprecate-idents.scala:34: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:34: warning: macro is now a reserved word; usage as an identifier is deprecated trait macro ^ -macro-deprecate-idents.scala:37: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:37: warning: macro is now a reserved word; usage as an identifier is deprecated package macro { ^ -macro-deprecate-idents.scala:38: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:38: warning: macro is now a reserved word; usage as an identifier is deprecated package macro.bar { ^ -macro-deprecate-idents.scala:43: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:43: warning: macro is now a reserved word; usage as an identifier is deprecated package macro.foo { ^ -macro-deprecate-idents.scala:48: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:48: warning: macro is now a reserved word; usage as an identifier is deprecated val Some(macro) = Some(42) ^ -macro-deprecate-idents.scala:49: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:49: warning: macro is now a reserved word; usage as an identifier is deprecated macro match { ^ -macro-deprecate-idents.scala:50: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:50: warning: macro is now a reserved word; usage as an identifier is deprecated case macro => println(macro) ^ -macro-deprecate-idents.scala:50: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:50: warning: macro is now a reserved word; usage as an identifier is deprecated case macro => println(macro) ^ -macro-deprecate-idents.scala:55: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:55: warning: macro is now a reserved word; usage as an identifier is deprecated def macro = 2 ^ -17 errors found +error: No warnings can be incurred under -Xfatal-warnings. +17 warnings found +one error found diff --git a/test/files/neg/main1.check b/test/files/neg/main1.check index 1a7a13e1e9..b745105818 100644 --- a/test/files/neg/main1.check +++ b/test/files/neg/main1.check @@ -1,26 +1,28 @@ -main1.scala:3: error: Foo has a main method with parameter type Array[String], but foo1.Foo will not be a runnable program. +main1.scala:3: warning: Foo has a main method with parameter type Array[String], but foo1.Foo will not be a runnable program. Reason: companion is a trait, which means no static forwarder can be generated. object Foo { // companion is trait ^ -main1.scala:10: error: Foo has a main method with parameter type Array[String], but foo2.Foo will not be a runnable program. +main1.scala:10: warning: Foo has a main method with parameter type Array[String], but foo2.Foo will not be a runnable program. Reason: companion contains its own main method, which means no static forwarder can be generated. object Foo { // companion has its own main ^ -main1.scala:22: error: Foo has a main method with parameter type Array[String], but foo3.Foo will not be a runnable program. +main1.scala:22: warning: Foo has a main method with parameter type Array[String], but foo3.Foo will not be a runnable program. Reason: companion contains its own main method (implementation restriction: no main is allowed, regardless of signature), which means no static forwarder can be generated. object Foo { // Companion contains main, but not an interfering main. ^ -main1.scala:31: error: Foo has a main method with parameter type Array[String], but foo4.Foo will not be a runnable program. +main1.scala:31: warning: Foo has a main method with parameter type Array[String], but foo4.Foo will not be a runnable program. Reason: companion contains its own main method, which means no static forwarder can be generated. object Foo extends Foo { // Inherits main from the class ^ -main1.scala:39: error: Foo has a main method with parameter type Array[String], but foo5.Foo will not be a runnable program. +main1.scala:39: warning: Foo has a main method with parameter type Array[String], but foo5.Foo will not be a runnable program. Reason: companion contains its own main method, which means no static forwarder can be generated. object Foo extends Foo { // Overrides main from the class ^ -5 errors found +error: No warnings can be incurred under -Xfatal-warnings. +5 warnings found +one error found diff --git a/test/files/neg/migration28.check b/test/files/neg/migration28.check index d7dfacf3db..afb4db62e2 100644 --- a/test/files/neg/migration28.check +++ b/test/files/neg/migration28.check @@ -1,5 +1,7 @@ -migration28.scala:4: error: method scanRight in trait TraversableLike has changed semantics in version 2.9.0: +migration28.scala:4: warning: method scanRight in trait TraversableLike has changed semantics in version 2.9.0: The behavior of `scanRight` has changed. The previous behavior can be reproduced with scanRight.reverse. List(1,2,3,4,5).scanRight(0)(_+_) ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/names-defaults-neg-warn.check b/test/files/neg/names-defaults-neg-warn.check index e1085acf76..0f4edef84e 100644 --- a/test/files/neg/names-defaults-neg-warn.check +++ b/test/files/neg/names-defaults-neg-warn.check @@ -1,7 +1,9 @@ -names-defaults-neg-warn.scala:11: error: the parameter name s has been deprecated. Use x instead. +names-defaults-neg-warn.scala:11: warning: the parameter name s has been deprecated. Use x instead. deprNam2.f(s = "dlfkj") ^ -names-defaults-neg-warn.scala:12: error: the parameter name x has been deprecated. Use s instead. +names-defaults-neg-warn.scala:12: warning: the parameter name x has been deprecated. Use s instead. deprNam2.g(x = "dlkjf") ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/newpat_unreachable.check b/test/files/neg/newpat_unreachable.check index 08453cac19..a928e3853a 100644 --- a/test/files/neg/newpat_unreachable.check +++ b/test/files/neg/newpat_unreachable.check @@ -1,27 +1,29 @@ -newpat_unreachable.scala:6: error: patterns after a variable pattern cannot match (SLS 8.1.1) +newpat_unreachable.scala:6: warning: patterns after a variable pattern cannot match (SLS 8.1.1) If you intended to match against parameter b of method contrivedExample, you must use backticks, like: case `b` => case b => println("matched b") ^ -newpat_unreachable.scala:7: error: unreachable code due to variable pattern 'b' on line 6 +newpat_unreachable.scala:7: warning: unreachable code due to variable pattern 'b' on line 6 If you intended to match against parameter c of method contrivedExample, you must use backticks, like: case `c` => case c => println("matched c") ^ -newpat_unreachable.scala:8: error: unreachable code due to variable pattern 'b' on line 6 +newpat_unreachable.scala:8: warning: unreachable code due to variable pattern 'b' on line 6 If you intended to match against value d in class A, you must use backticks, like: case `d` => case d => println("matched d") ^ -newpat_unreachable.scala:9: error: unreachable code due to variable pattern 'b' on line 6 +newpat_unreachable.scala:9: warning: unreachable code due to variable pattern 'b' on line 6 case _ => println("matched neither") ^ -newpat_unreachable.scala:22: error: patterns after a variable pattern cannot match (SLS 8.1.1) +newpat_unreachable.scala:22: warning: patterns after a variable pattern cannot match (SLS 8.1.1) If you intended to match against parameter b of method g, you must use backticks, like: case `b` => case b => 1 ^ -newpat_unreachable.scala:23: error: unreachable code due to variable pattern 'b' on line 22 +newpat_unreachable.scala:23: warning: unreachable code due to variable pattern 'b' on line 22 If you intended to match against parameter c of method h, you must use backticks, like: case `c` => case c => 2 ^ -newpat_unreachable.scala:24: error: unreachable code due to variable pattern 'b' on line 22 +newpat_unreachable.scala:24: warning: unreachable code due to variable pattern 'b' on line 22 case _ => 3 ^ -7 errors found +error: No warnings can be incurred under -Xfatal-warnings. +7 warnings found +one error found diff --git a/test/files/neg/nonlocal-warning.check b/test/files/neg/nonlocal-warning.check new file mode 100644 index 0000000000..67b3b10095 --- /dev/null +++ b/test/files/neg/nonlocal-warning.check @@ -0,0 +1,10 @@ +nonlocal-warning.scala:4: warning: This catches all Throwables, which often has undesirable consequences. +If intentional, use `case x : Throwable` to clear this warning. + catch { case x => 11 } + ^ +nonlocal-warning.scala:2: warning: catch block may intercept non-local return from method foo + def foo(l: List[Int]): Int = { + ^ +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/pending/pos/t4649.flags b/test/files/neg/nonlocal-warning.flags index e8fb65d50c..e8fb65d50c 100644 --- a/test/pending/pos/t4649.flags +++ b/test/files/neg/nonlocal-warning.flags diff --git a/test/files/neg/nonlocal-warning.scala b/test/files/neg/nonlocal-warning.scala new file mode 100644 index 0000000000..f908a86302 --- /dev/null +++ b/test/files/neg/nonlocal-warning.scala @@ -0,0 +1,18 @@ +class Foo { + def foo(l: List[Int]): Int = { + try l foreach { _ => return 5 } + catch { case x => 11 } + 22 + } + + val pf: PartialFunction[Throwable, Unit] = { + case x if false => () + } + + def bar(l: List[Int]): Int = { + try l foreach { _ => return 5 } + catch pf + finally println() + 22 + } +} diff --git a/test/files/neg/nullary-override.check b/test/files/neg/nullary-override.check index 6b2ded2d4a..f032f4a6c2 100644 --- a/test/files/neg/nullary-override.check +++ b/test/files/neg/nullary-override.check @@ -1,4 +1,6 @@ -nullary-override.scala:2: error: non-nullary method overrides nullary method +nullary-override.scala:2: warning: non-nullary method overrides nullary method class B extends A { override def x(): Int = 4 } ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/overloaded-implicit.check b/test/files/neg/overloaded-implicit.check index bdbe6a89d5..ca0870705d 100644 --- a/test/files/neg/overloaded-implicit.check +++ b/test/files/neg/overloaded-implicit.check @@ -1,7 +1,9 @@ -overloaded-implicit.scala:2: error: parameterized overloaded implicit methods are not visible as view bounds +overloaded-implicit.scala:2: warning: parameterized overloaded implicit methods are not visible as view bounds implicit def imp1[T](x: List[T]): Map[T, T] = Map() ^ -overloaded-implicit.scala:3: error: parameterized overloaded implicit methods are not visible as view bounds +overloaded-implicit.scala:3: warning: parameterized overloaded implicit methods are not visible as view bounds implicit def imp1[T](x: Set[T]): Map[T, T] = Map() ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/overloaded-implicit.flags b/test/files/neg/overloaded-implicit.flags index 7949c2afa2..9c1e74e4ef 100644 --- a/test/files/neg/overloaded-implicit.flags +++ b/test/files/neg/overloaded-implicit.flags @@ -1 +1 @@ --Xlint -Xfatal-warnings +-Xlint -Xfatal-warnings -Xdev diff --git a/test/files/neg/package-ob-case.check b/test/files/neg/package-ob-case.check index e6b2f858ef..063a120db1 100644 --- a/test/files/neg/package-ob-case.check +++ b/test/files/neg/package-ob-case.check @@ -1,5 +1,7 @@ -package-ob-case.scala:3: error: it is not recommended to define classes/objects inside of package objects. +package-ob-case.scala:3: warning: it is not recommended to define classes/objects inside of package objects. If possible, define class X in package foo instead. case class X(z: Int) { } ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/patmat-type-check.check b/test/files/neg/patmat-type-check.check index 721217c314..fedac3b746 100644 --- a/test/files/neg/patmat-type-check.check +++ b/test/files/neg/patmat-type-check.check @@ -1,12 +1,27 @@ patmat-type-check.scala:11: warning: fruitless type test: a value of type Test.Bop4[T] cannot also be a Seq[A] def s3[T](x: Bop4[T]) = x match { case Seq('b', 'o', 'b') => true } ^ +patmat-type-check.scala:11: error: pattern type is incompatible with expected type; + found : Seq[A] + required: Test.Bop4[T] + def s3[T](x: Bop4[T]) = x match { case Seq('b', 'o', 'b') => true } + ^ patmat-type-check.scala:15: warning: fruitless type test: a value of type Test.Bop5[_$1,T1,T2] cannot also be a Seq[A] def s4[T1, T2](x: Bop5[_, T1, T2]) = x match { case Seq('b', 'o', 'b') => true } ^ +patmat-type-check.scala:15: error: pattern type is incompatible with expected type; + found : Seq[A] + required: Test.Bop5[_$1,T1,T2] where type _$1 + def s4[T1, T2](x: Bop5[_, T1, T2]) = x match { case Seq('b', 'o', 'b') => true } + ^ patmat-type-check.scala:19: warning: fruitless type test: a value of type Test.Bop3[T] cannot also be a Seq[A] def f4[T](x: Bop3[T]) = x match { case Seq('b', 'o', 'b') => true } ^ +patmat-type-check.scala:19: error: pattern type is incompatible with expected type; + found : Seq[A] + required: Test.Bop3[T] + def f4[T](x: Bop3[T]) = x match { case Seq('b', 'o', 'b') => true } + ^ patmat-type-check.scala:22: error: scrutinee is incompatible with pattern type; found : Seq[A] required: String @@ -28,4 +43,4 @@ patmat-type-check.scala:30: error: scrutinee is incompatible with pattern type; def f4[T](x: Bop3[Char]) = x match { case Seq('b', 'o', 'b') => true } // fail ^ three warnings found -four errors found +7 errors found diff --git a/test/files/neg/patmatexhaust.check b/test/files/neg/patmatexhaust.check index 4556e6622f..6069dfdaab 100644 --- a/test/files/neg/patmatexhaust.check +++ b/test/files/neg/patmatexhaust.check @@ -1,40 +1,42 @@ -patmatexhaust.scala:7: error: match may not be exhaustive. +patmatexhaust.scala:7: warning: match may not be exhaustive. It would fail on the following input: Baz def ma1(x:Foo) = x match { ^ -patmatexhaust.scala:11: error: match may not be exhaustive. +patmatexhaust.scala:11: warning: match may not be exhaustive. It would fail on the following input: Bar(_) def ma2(x:Foo) = x match { ^ -patmatexhaust.scala:23: error: match may not be exhaustive. +patmatexhaust.scala:23: warning: match may not be exhaustive. It would fail on the following inputs: (Kult(_), Kult(_)), (Qult(), Qult()) def ma3(x:Mult) = (x,x) match { // not exhaustive ^ -patmatexhaust.scala:49: error: match may not be exhaustive. +patmatexhaust.scala:49: warning: match may not be exhaustive. It would fail on the following inputs: Gp(), Gu def ma4(x:Deep) = x match { // missing cases: Gu, Gp ^ -patmatexhaust.scala:55: error: unreachable code +patmatexhaust.scala:55: warning: unreachable code case _ if 1 == 0 => ^ -patmatexhaust.scala:53: error: match may not be exhaustive. +patmatexhaust.scala:53: warning: match may not be exhaustive. It would fail on the following input: Gp() def ma5(x:Deep) = x match { ^ -patmatexhaust.scala:75: error: match may not be exhaustive. +patmatexhaust.scala:75: warning: match may not be exhaustive. It would fail on the following input: B() def ma9(x: B) = x match { ^ -patmatexhaust.scala:100: error: match may not be exhaustive. +patmatexhaust.scala:100: warning: match may not be exhaustive. It would fail on the following input: C1() def ma10(x: C) = x match { // not exhaustive: C1 is not sealed. ^ -patmatexhaust.scala:114: error: match may not be exhaustive. +patmatexhaust.scala:114: warning: match may not be exhaustive. It would fail on the following inputs: D1, D2() def ma10(x: C) = x match { // not exhaustive: C1 has subclasses. ^ -patmatexhaust.scala:126: error: match may not be exhaustive. +patmatexhaust.scala:126: warning: match may not be exhaustive. It would fail on the following input: C1() def ma10(x: C) = x match { // not exhaustive: C1 is not abstract. ^ -10 errors found +error: No warnings can be incurred under -Xfatal-warnings. +10 warnings found +one error found diff --git a/test/files/neg/permanent-blindness.check b/test/files/neg/permanent-blindness.check index 18b4543707..cdde201ef6 100644 --- a/test/files/neg/permanent-blindness.check +++ b/test/files/neg/permanent-blindness.check @@ -1,10 +1,12 @@ -permanent-blindness.scala:10: error: imported `Bippy' is permanently hidden by definition of class Bippy in package bar +permanent-blindness.scala:10: warning: imported `Bippy' is permanently hidden by definition of class Bippy in package bar import foo.{ Bippy, Bop, Dingus } ^ -permanent-blindness.scala:10: error: imported `Bop' is permanently hidden by definition of object Bop in package bar +permanent-blindness.scala:10: warning: imported `Bop' is permanently hidden by definition of object Bop in package bar import foo.{ Bippy, Bop, Dingus } ^ -permanent-blindness.scala:10: error: imported `Dingus' is permanently hidden by definition of object Dingus in package bar +permanent-blindness.scala:10: warning: imported `Dingus' is permanently hidden by definition of object Dingus in package bar import foo.{ Bippy, Bop, Dingus } ^ -three errors found +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/sealed-final-neg.check b/test/files/neg/sealed-final-neg.check new file mode 100644 index 0000000000..500d23f49a --- /dev/null +++ b/test/files/neg/sealed-final-neg.check @@ -0,0 +1,4 @@ +sealed-final-neg.scala:41: error: expected class or object definition +"Due to SI-6142 this emits no warnings, so we'll just break it until that's fixed." +^ +one error found diff --git a/test/files/neg/sealed-final-neg.flags b/test/files/neg/sealed-final-neg.flags new file mode 100644 index 0000000000..cfabf7a5b4 --- /dev/null +++ b/test/files/neg/sealed-final-neg.flags @@ -0,0 +1 @@ +-Xfatal-warnings -Yinline-warnings -optimise
\ No newline at end of file diff --git a/test/files/neg/sealed-final-neg.scala b/test/files/neg/sealed-final-neg.scala new file mode 100644 index 0000000000..bc25330e13 --- /dev/null +++ b/test/files/neg/sealed-final-neg.scala @@ -0,0 +1,41 @@ +package neg1 { + 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 + final class Baz3 extends Foo { + override def bar(x: Int) = x - 1 + } + + object Test { + // bar can't be inlined - it is overridden in Baz3 + def f = Foo.mkFoo() bar 10 + } +} + +package neg2 { + 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 + class Baz3 extends Foo { + override def bar(x: Int) = x - 1 + } + + object Test { + // bar can't be inlined - Baz3 is not final + def f = Foo.mkFoo() bar 10 + } +} + +"Due to SI-6142 this emits no warnings, so we'll just break it until that's fixed." diff --git a/test/files/neg/sealed-java-enums.check b/test/files/neg/sealed-java-enums.check index 20d00c8e91..a3c39ec5cd 100644 --- a/test/files/neg/sealed-java-enums.check +++ b/test/files/neg/sealed-java-enums.check @@ -1,5 +1,7 @@ -sealed-java-enums.scala:5: error: match may not be exhaustive. +sealed-java-enums.scala:5: warning: match may not be exhaustive. It would fail on the following inputs: BLOCKED, TERMINATED, TIMED_WAITING def f(state: State) = state match { ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/stmt-expr-discard.check b/test/files/neg/stmt-expr-discard.check index 2d6420a61d..1207e6da50 100644 --- a/test/files/neg/stmt-expr-discard.check +++ b/test/files/neg/stmt-expr-discard.check @@ -1,7 +1,9 @@ -stmt-expr-discard.scala:3: error: a pure expression does nothing in statement position; you may be omitting necessary parentheses +stmt-expr-discard.scala:3: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 2 ^ -stmt-expr-discard.scala:4: error: a pure expression does nothing in statement position; you may be omitting necessary parentheses +stmt-expr-discard.scala:4: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 4 ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/switch.check b/test/files/neg/switch.check index e4730b6459..f968d3a448 100644 --- a/test/files/neg/switch.check +++ b/test/files/neg/switch.check @@ -1,7 +1,9 @@ -switch.scala:38: error: could not emit switch for @switch annotated match +switch.scala:38: warning: could not emit switch for @switch annotated match def fail2(c: Char) = (c: @switch @unchecked) match { ^ -switch.scala:45: error: could not emit switch for @switch annotated match +switch.scala:45: warning: could not emit switch for @switch annotated match def fail3(c: Char) = (c: @unchecked @switch) match { ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/t1224.check b/test/files/neg/t1224.check index fb61275911..ab8a6f1130 100644 --- a/test/files/neg/t1224.check +++ b/test/files/neg/t1224.check @@ -1,4 +1,4 @@ -t1224.scala:4: error: illegal cyclic reference involving type T +t1224.scala:4: error: lower bound C[A.this.T] does not conform to upper bound C[C[A.this.T]] type T >: C[T] <: C[C[T]] ^ one error found diff --git a/test/files/neg/t1224.flags b/test/files/neg/t1224.flags new file mode 100644 index 0000000000..ca20f55172 --- /dev/null +++ b/test/files/neg/t1224.flags @@ -0,0 +1 @@ +-Ybreak-cycles diff --git a/test/files/neg/t2442.check b/test/files/neg/t2442.check index 714816fd62..9ff0b44661 100644 --- a/test/files/neg/t2442.check +++ b/test/files/neg/t2442.check @@ -1,9 +1,11 @@ -t2442.scala:4: error: match may not be exhaustive. +t2442.scala:4: warning: match may not be exhaustive. It would fail on the following input: THREE def f(e: MyEnum) = e match { ^ -t2442.scala:11: error: match may not be exhaustive. +t2442.scala:11: warning: match may not be exhaustive. It would fail on the following input: BLUE def g(e: MySecondEnum) = e match { ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/t2796.check b/test/files/neg/t2796.check index aeb18497ed..4456a7fc19 100644 --- a/test/files/neg/t2796.check +++ b/test/files/neg/t2796.check @@ -1,4 +1,6 @@ -t2796.scala:7: error: Implementation restriction: early definitions in traits are not initialized before the super class is initialized. +t2796.scala:7: warning: Implementation restriction: early definitions in traits are not initialized before the super class is initialized. val abstractVal = "T1.abstractVal" // warn ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/t2968.check b/test/files/neg/t2968.check new file mode 100644 index 0000000000..5d2387f98c --- /dev/null +++ b/test/files/neg/t2968.check @@ -0,0 +1,10 @@ +t2968.scala:8: error: Missing closing brace `}' assumed here +} // missing brace +^ +t2968.scala:17: error: Missing closing brace `}' assumed here +} // missing brace +^ +t2968.scala:26: error: Missing closing brace `}' assumed here +} // missing brace +^ +three errors found diff --git a/test/files/neg/t2968.scala b/test/files/neg/t2968.scala new file mode 100644 index 0000000000..41c3a798a5 --- /dev/null +++ b/test/files/neg/t2968.scala @@ -0,0 +1,26 @@ +object t1 { + case object Const { + } + + class Var + { + +} // missing brace + +object t2 { + case class Const() { + } + + class Var + { + +} // missing brace + +object t3 { + final case class Const() { + } + + class Var + { + +} // missing brace diff --git a/test/files/neg/t2968b.check b/test/files/neg/t2968b.check new file mode 100644 index 0000000000..36d25a2d12 --- /dev/null +++ b/test/files/neg/t2968b.check @@ -0,0 +1,4 @@ +t2968b.scala:7: error: '}' expected but eof found. +// missing brace + ^ +one error found diff --git a/test/files/neg/t2968b.scala b/test/files/neg/t2968b.scala new file mode 100644 index 0000000000..422b618aba --- /dev/null +++ b/test/files/neg/t2968b.scala @@ -0,0 +1,7 @@ +case class Const() +{ +} + +class Var +{ +// missing brace diff --git a/test/files/neg/t3098.check b/test/files/neg/t3098.check index 85829747b9..5343b128f0 100644 --- a/test/files/neg/t3098.check +++ b/test/files/neg/t3098.check @@ -1,5 +1,7 @@ -b.scala:3: error: match may not be exhaustive. +b.scala:3: warning: match may not be exhaustive. It would fail on the following input: (_ : C) def f = (null: T) match { ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/t3160ambiguous.check b/test/files/neg/t3160ambiguous.check new file mode 100644 index 0000000000..e80d9a5461 --- /dev/null +++ b/test/files/neg/t3160ambiguous.check @@ -0,0 +1,7 @@ +t3160ambiguous.scala:8: error: reference to Node is ambiguous; +it is imported twice in the same scope by +import scala.xml._ +and import Bippy._ + def f(x: Node): String = ??? // ambiguous, because Bippy.Node is accessible + ^ +one error found diff --git a/test/files/neg/t3160ambiguous.scala b/test/files/neg/t3160ambiguous.scala new file mode 100644 index 0000000000..cb9759b79c --- /dev/null +++ b/test/files/neg/t3160ambiguous.scala @@ -0,0 +1,15 @@ +object Bippy { + private class Node +} +class Bippy { + import Bippy._ + import scala.xml._ + + def f(x: Node): String = ??? // ambiguous, because Bippy.Node is accessible +} +class Other { + import Bippy._ + import scala.xml._ + + def f(x: Node): String = ??? // unambiguous, because Bippy.Node is inaccessible +} diff --git a/test/files/neg/t3224.check b/test/files/neg/t3224.check index 29304c567a..69b02c8862 100644 --- a/test/files/neg/t3224.check +++ b/test/files/neg/t3224.check @@ -1,6 +1,26 @@ -t3224.scala:29: error: polymorphic expression cannot be instantiated to expected type; +t3224.scala:30: error: polymorphic expression cannot be instantiated to expected type; found : [T]Array[T] required: List[?] - println(Texts textL Array()); println(Texts textL Array(1)); println(Texts textL Array(1, 1)) - ^ -one error found + println(Texts textL Array()) + ^ +t3224.scala:34: error: type mismatch; + found : List[Nothing] + required: Array[?] + println(Texts textA List()) + ^ +t3224.scala:35: error: type mismatch; + found : List[Int] + required: Array[?] + println(Texts textA List(1)) + ^ +t3224.scala:36: error: type mismatch; + found : List[Int] + required: Array[?] + println(Texts textA List(1, 1)); + ^ +t3224.scala:48: error: polymorphic expression cannot be instantiated to expected type; + found : [T]Array[T] + required: List[?] + assert(size(Array()) == 0) + ^ +5 errors found diff --git a/test/files/neg/t3224.scala b/test/files/neg/t3224.scala index 774de3335a..b7af8a67b5 100755 --- a/test/files/neg/t3224.scala +++ b/test/files/neg/t3224.scala @@ -1,30 +1,50 @@ object Texts{ - def textL[T](list: List[T]) = { - list match{ - case List() => "Empty" - case List(_) => "One" + def textL[T](list: List[T]) = { + list match{ + case List() => "Empty" + case List(_) => "One" case List(_*) => "Many" } } - def textA[T](array: Array[T]) = { - array match{ - case Array() => "Empty" - case Array(_) => "One" + def textA[T](array: Array[T]) = { + array match{ + case Array() => "Empty" + case Array(_) => "One" case Array(_*) => "Many" } } } object Test extends App { + { + implicit def array2list[T](array: Array[T]) = { + println(array.toList.size) + array.toList + } + + println(Texts textL List()) + println(Texts textL List(1)) + println(Texts textL List(1, 1)); + + println(Texts textL Array()) + println(Texts textL Array(1)) + println(Texts textL Array(1, 1)) - implicit def array2list[T](array: Array[T]) = { - println(array.toList.size) - array.toList + println(Texts textA List()) + println(Texts textA List(1)) + println(Texts textA List(1, 1)); + + println(Texts textA Array()) + println(Texts textA Array(1)) + println(Texts textA Array(1, 1)) } - - println(Texts textL List()); println(Texts textL List(1)); println(Texts textL List(1, 1)); + { + implicit def array2list[T](array: Array[T]) = array.toList + def size[T](list: List[T]) = list.size - println(Texts textL Array()); println(Texts textL Array(1)); println(Texts textL Array(1, 1)) + assert(size(array2list(Array())) == 0) + assert(size(Array()) == 0) + } } diff --git a/test/files/neg/t3234.check b/test/files/neg/t3234.check index 477b021e5e..8f0d624ed9 100644 --- a/test/files/neg/t3234.check +++ b/test/files/neg/t3234.check @@ -1,2 +1,6 @@ -error: there were 1 inliner warnings; re-run with -Yinline-warnings for details +t3234.scala:17: warning: At the end of the day, could not inline @inline-marked method foo3 + println(foo(42) + foo2(11) + foo3(2)) + ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/t3234.flags b/test/files/neg/t3234.flags index c9cefdc4b9..cc3d9fb6f0 100644 --- a/test/files/neg/t3234.flags +++ b/test/files/neg/t3234.flags @@ -1 +1 @@ --Yinline -Xfatal-warnings
\ No newline at end of file +-Yinline -Yinline-warnings -Xfatal-warnings diff --git a/test/files/neg/t3683a.check b/test/files/neg/t3683a.check index 3de3ad784e..6386265ebc 100644 --- a/test/files/neg/t3683a.check +++ b/test/files/neg/t3683a.check @@ -1,5 +1,7 @@ -t3683a.scala:14: error: match may not be exhaustive. +t3683a.scala:14: warning: match may not be exhaustive. It would fail on the following input: XX() w match { ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/t4302.check b/test/files/neg/t4302.check index 450d28bbc5..ea48729276 100644 --- a/test/files/neg/t4302.check +++ b/test/files/neg/t4302.check @@ -1,4 +1,6 @@ -t4302.scala:2: error: abstract type T is unchecked since it is eliminated by erasure +t4302.scala:2: warning: abstract type T is unchecked since it is eliminated by erasure def hasMatch[T](x: AnyRef) = x.isInstanceOf[T] ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/t4440.check b/test/files/neg/t4440.check index 2861dc3040..10e7188e32 100644 --- a/test/files/neg/t4440.check +++ b/test/files/neg/t4440.check @@ -1,13 +1,15 @@ -t4440.scala:12: error: The outer reference in this type test cannot be checked at run time. +t4440.scala:12: warning: The outer reference in this type test cannot be checked at run time. case _: b.Inner => println("b") ^ -t4440.scala:13: error: The outer reference in this type test cannot be checked at run time. +t4440.scala:13: warning: The outer reference in this type test cannot be checked at run time. case _: a.Inner => println("a") // this is the case we want ^ -t4440.scala:16: error: The outer reference in this type test cannot be checked at run time. +t4440.scala:16: warning: The outer reference in this type test cannot be checked at run time. case _: a.Inner => println("a") ^ -t4440.scala:17: error: The outer reference in this type test cannot be checked at run time. +t4440.scala:17: warning: The outer reference in this type test cannot be checked at run time. case _: b.Inner => println("b") // this is the case we want ^ -four errors found +error: No warnings can be incurred under -Xfatal-warnings. +four warnings found +one error found diff --git a/test/files/neg/t4537.check b/test/files/neg/t4537.check deleted file mode 100644 index 931bcd0405..0000000000 --- a/test/files/neg/t4537.check +++ /dev/null @@ -1,4 +0,0 @@ -c.scala:7: error: object Settings in package a cannot be accessed in package a - println(Settings.Y) - ^ -one error found diff --git a/test/files/neg/t4537/c.scala b/test/files/neg/t4537/c.scala deleted file mode 100644 index 379599112d..0000000000 --- a/test/files/neg/t4537/c.scala +++ /dev/null @@ -1,8 +0,0 @@ -package b -package c - -import a._ - -object Test { - println(Settings.Y) -}
\ No newline at end of file diff --git a/test/files/neg/t4691_exhaust_extractor.check b/test/files/neg/t4691_exhaust_extractor.check index cd12e56f86..6396944145 100644 --- a/test/files/neg/t4691_exhaust_extractor.check +++ b/test/files/neg/t4691_exhaust_extractor.check @@ -1,13 +1,15 @@ -t4691_exhaust_extractor.scala:17: error: match may not be exhaustive. +t4691_exhaust_extractor.scala:17: warning: match may not be exhaustive. It would fail on the following input: Bar3() def f1(x: Foo) = x match { ^ -t4691_exhaust_extractor.scala:23: error: match may not be exhaustive. +t4691_exhaust_extractor.scala:23: warning: match may not be exhaustive. It would fail on the following input: Bar3() def f2(x: Foo) = x match { ^ -t4691_exhaust_extractor.scala:29: error: match may not be exhaustive. +t4691_exhaust_extractor.scala:29: warning: match may not be exhaustive. It would fail on the following input: Bar3() def f3(x: Foo) = x match { ^ -three errors found +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/t4749.check b/test/files/neg/t4749.check index 93ad3935fa..34eed6e433 100644 --- a/test/files/neg/t4749.check +++ b/test/files/neg/t4749.check @@ -1,28 +1,30 @@ -t4749.scala:2: error: Fail1 has a main method with parameter type Array[String], but bippy.Fail1 will not be a runnable program. +t4749.scala:2: warning: Fail1 has a main method with parameter type Array[String], but bippy.Fail1 will not be a runnable program. Reason: main method must have exact signature (Array[String])Unit object Fail1 { ^ -t4749.scala:6: error: Fail2 has a main method with parameter type Array[String], but bippy.Fail2 will not be a runnable program. +t4749.scala:6: warning: Fail2 has a main method with parameter type Array[String], but bippy.Fail2 will not be a runnable program. Reason: main methods cannot be generic. object Fail2 { ^ -t4749.scala:13: error: Fail3 has a main method with parameter type Array[String], but bippy.Fail3 will not be a runnable program. +t4749.scala:13: warning: Fail3 has a main method with parameter type Array[String], but bippy.Fail3 will not be a runnable program. Reason: main methods cannot refer to type parameters or abstract types. object Fail3 extends Bippy[Unit] { } ^ -t4749.scala:16: error: Fail4 has a main method with parameter type Array[String], but bippy.Fail4 will not be a runnable program. +t4749.scala:16: warning: Fail4 has a main method with parameter type Array[String], but bippy.Fail4 will not be a runnable program. Reason: companion is a trait, which means no static forwarder can be generated. object Fail4 { ^ -t4749.scala:21: error: Fail5 has a main method with parameter type Array[String], but bippy.Fail5 will not be a runnable program. +t4749.scala:21: warning: Fail5 has a main method with parameter type Array[String], but bippy.Fail5 will not be a runnable program. Reason: companion contains its own main method, which means no static forwarder can be generated. object Fail5 extends Fail5 { } ^ -t4749.scala:26: error: Fail6 has a main method with parameter type Array[String], but bippy.Fail6 will not be a runnable program. +t4749.scala:26: warning: Fail6 has a main method with parameter type Array[String], but bippy.Fail6 will not be a runnable program. Reason: companion contains its own main method (implementation restriction: no main is allowed, regardless of signature), which means no static forwarder can be generated. object Fail6 { ^ -6 errors found +error: No warnings can be incurred under -Xfatal-warnings. +6 warnings found +one error found diff --git a/test/files/neg/t4762.check b/test/files/neg/t4762.check index 5e67f2022a..a0525f6226 100644 --- a/test/files/neg/t4762.check +++ b/test/files/neg/t4762.check @@ -1,7 +1,9 @@ -t4762.scala:15: error: private[this] value x in class B shadows mutable x inherited from class A. Changes to x will not be visible within class B - you may want to give them distinct names. +t4762.scala:15: warning: private[this] value x in class B shadows mutable x inherited from class A. Changes to x will not be visible within class B - you may want to give them distinct names. /* (99,99) */ (this.x, this.y), ^ -t4762.scala:48: error: private[this] value x in class Derived shadows mutable x inherited from class Base. Changes to x will not be visible within class Derived - you may want to give them distinct names. +t4762.scala:48: warning: private[this] value x in class Derived shadows mutable x inherited from class Base. Changes to x will not be visible within class Derived - you may want to give them distinct names. class Derived( x : Int ) extends Base( x ) { override def toString = x.toString } ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/t4851.check b/test/files/neg/t4851.check index 8011350f23..0fd66b9efe 100644 --- a/test/files/neg/t4851.check +++ b/test/files/neg/t4851.check @@ -1,43 +1,45 @@ -S.scala:2: error: Adapting argument list by inserting (): leaky (Object-receiving) target makes this especially dangerous. +S.scala:2: warning: Adapting argument list by inserting (): leaky (Object-receiving) target makes this especially dangerous. signature: J(x: Any): J given arguments: <none> after adaptation: new J((): Unit) val x1 = new J ^ -S.scala:3: error: Adapting argument list by inserting (): leaky (Object-receiving) target makes this especially dangerous. +S.scala:3: warning: Adapting argument list by inserting (): leaky (Object-receiving) target makes this especially dangerous. signature: J(x: Any): J given arguments: <none> after adaptation: new J((): Unit) val x2 = new J() ^ -S.scala:4: error: Adapting argument list by creating a 5-tuple: this may not be what you want. +S.scala:4: warning: Adapting argument list by creating a 5-tuple: this may not be what you want. signature: J(x: Any): J given arguments: 1, 2, 3, 4, 5 after adaptation: new J((1, 2, 3, 4, 5): (Int, Int, Int, Int, Int)) val x3 = new J(1, 2, 3, 4, 5) ^ -S.scala:6: error: Adapting argument list by creating a 3-tuple: this may not be what you want. +S.scala:6: warning: Adapting argument list by creating a 3-tuple: this may not be what you want. signature: Some.apply[A](x: A): Some[A] given arguments: 1, 2, 3 after adaptation: Some((1, 2, 3): (Int, Int, Int)) val y1 = Some(1, 2, 3) ^ -S.scala:7: error: Adapting argument list by creating a 3-tuple: this may not be what you want. +S.scala:7: warning: Adapting argument list by creating a 3-tuple: this may not be what you want. signature: Some(x: A): Some[A] given arguments: 1, 2, 3 after adaptation: new Some((1, 2, 3): (Int, Int, Int)) val y2 = new Some(1, 2, 3) ^ -S.scala:9: error: Adapting argument list by inserting (): this is unlikely to be what you want. +S.scala:9: warning: Adapting argument list by inserting (): this is unlikely to be what you want. signature: J2[T](x: T): J2[T] given arguments: <none> after adaptation: new J2((): Unit) val z1 = new J2 ^ -S.scala:10: error: Adapting argument list by inserting (): this is unlikely to be what you want. +S.scala:10: warning: Adapting argument list by inserting (): this is unlikely to be what you want. signature: J2[T](x: T): J2[T] given arguments: <none> after adaptation: new J2((): Unit) val z2 = new J2() ^ -7 errors found +error: No warnings can be incurred under -Xfatal-warnings. +7 warnings found +one error found diff --git a/test/files/neg/t5353.check b/test/files/neg/t5353.check new file mode 100644 index 0000000000..75e2435600 --- /dev/null +++ b/test/files/neg/t5353.check @@ -0,0 +1,4 @@ +t5353.scala:2: error: this type parameter must be specified + def f(x: Boolean) = if (x) Array("abc") else Array() + ^ +one error found diff --git a/test/files/neg/t5353.scala b/test/files/neg/t5353.scala new file mode 100644 index 0000000000..1ee869aac1 --- /dev/null +++ b/test/files/neg/t5353.scala @@ -0,0 +1,3 @@ +class A { + def f(x: Boolean) = if (x) Array("abc") else Array() +} diff --git a/test/files/neg/t5426.check b/test/files/neg/t5426.check index d9e192d3f0..98f3ddaaae 100644 --- a/test/files/neg/t5426.check +++ b/test/files/neg/t5426.check @@ -1,13 +1,15 @@ -t5426.scala:2: error: comparing values of types Some[Int] and Int using `==' will always yield false +t5426.scala:2: warning: comparing values of types Some[Int] and Int using `==' will always yield false def f1 = Some(5) == 5 ^ -t5426.scala:3: error: comparing values of types Int and Some[Int] using `==' will always yield false +t5426.scala:3: warning: comparing values of types Int and Some[Int] using `==' will always yield false def f2 = 5 == Some(5) ^ -t5426.scala:8: error: comparing values of types Int and Some[Int] using `==' will always yield false +t5426.scala:8: warning: comparing values of types Int and Some[Int] using `==' will always yield false (x1 == x2) ^ -t5426.scala:9: error: comparing values of types Some[Int] and Int using `==' will always yield false +t5426.scala:9: warning: comparing values of types Some[Int] and Int using `==' will always yield false (x2 == x1) ^ -four errors found +error: No warnings can be incurred under -Xfatal-warnings. +four warnings found +one error found diff --git a/test/files/neg/t5663-badwarneq.check b/test/files/neg/t5663-badwarneq.check index 00c2234e9d..12e93ff373 100644 --- a/test/files/neg/t5663-badwarneq.check +++ b/test/files/neg/t5663-badwarneq.check @@ -1,22 +1,24 @@ -t5663-badwarneq.scala:42: error: comparing case class values of types Some[Int] and None.type using `==' will always yield false +t5663-badwarneq.scala:42: warning: comparing case class values of types Some[Int] and None.type using `==' will always yield false println(new Some(1) == None) // Should complain on type, was: spuriously complains on fresh object ^ -t5663-badwarneq.scala:43: error: comparing case class values of types Some[Int] and Thing using `==' will always yield false +t5663-badwarneq.scala:43: warning: comparing case class values of types Some[Int] and Thing using `==' will always yield false println(Some(1) == new Thing(1)) // Should complain on type, was: spuriously complains on fresh object ^ -t5663-badwarneq.scala:51: error: ThingOne and Thingy are unrelated: they will most likely never compare equal +t5663-badwarneq.scala:51: warning: ThingOne and Thingy are unrelated: they will most likely never compare equal println(t1 == t2) // true, but apparently unrelated, a compromise warning ^ -t5663-badwarneq.scala:52: error: ThingThree and Thingy are unrelated: they will most likely never compare equal +t5663-badwarneq.scala:52: warning: ThingThree and Thingy are unrelated: they will most likely never compare equal println(t4 == t2) // true, complains because ThingThree is final and Thingy not a subclass, stronger claim than unrelated ^ -t5663-badwarneq.scala:55: error: comparing case class values of types ThingTwo and Some[Int] using `==' will always yield false +t5663-badwarneq.scala:55: warning: comparing case class values of types ThingTwo and Some[Int] using `==' will always yield false println(t3 == Some(1)) // false, warn on different cases ^ -t5663-badwarneq.scala:56: error: comparing values of types ThingOne and Cousin using `==' will always yield false +t5663-badwarneq.scala:56: warning: comparing values of types ThingOne and Cousin using `==' will always yield false println(t1 == c) // should warn ^ -t5663-badwarneq.scala:64: error: comparing case class values of types Simple and SimpleSibling.type using `==' will always yield false +t5663-badwarneq.scala:64: warning: comparing case class values of types Simple and SimpleSibling.type using `==' will always yield false println(new Simple() == SimpleSibling) // like Some(1) == None, but needn't be final case ^ -7 errors found +error: No warnings can be incurred under -Xfatal-warnings. +7 warnings found +one error found diff --git a/test/files/neg/t5692a.check b/test/files/neg/t5692a.check index ded95a8820..7fbfb5dba7 100644 --- a/test/files/neg/t5692a.check +++ b/test/files/neg/t5692a.check @@ -1,4 +1,4 @@ -Test_2.scala:2: error: type parameter not specified +Test_2.scala:2: error: this type parameter must be specified def x = Macros.foo ^ one error found diff --git a/test/files/neg/t5692b.check b/test/files/neg/t5692b.check index e453870ec8..16796826b4 100644 --- a/test/files/neg/t5692b.check +++ b/test/files/neg/t5692b.check @@ -1,4 +1,4 @@ -Test_2.scala:2: error: type parameters not specified +Test_2.scala:2: error: these type parameters must be specified def x = Macros.foo ^ one error found diff --git a/test/files/neg/t5762.check b/test/files/neg/t5762.check index 10064032aa..2a2f12144a 100644 --- a/test/files/neg/t5762.check +++ b/test/files/neg/t5762.check @@ -1,13 +1,15 @@ -t5762.scala:6: error: non-variable type argument Int in type pattern D[Int] is unchecked since it is eliminated by erasure +t5762.scala:6: warning: non-variable type argument Int in type pattern D[Int] is unchecked since it is eliminated by erasure case _: D[Int] if bippy => 1 ^ -t5762.scala:7: error: non-variable type argument String in type pattern D[String] is unchecked since it is eliminated by erasure +t5762.scala:7: warning: non-variable type argument String in type pattern D[String] is unchecked since it is eliminated by erasure case _: D[String] => 2 ^ -t5762.scala:20: error: non-variable type argument D[Int] in type pattern D[D[Int]] is unchecked since it is eliminated by erasure +t5762.scala:20: warning: non-variable type argument D[Int] in type pattern D[D[Int]] is unchecked since it is eliminated by erasure case _: D[D[Int]] if bippy => 1 ^ -t5762.scala:21: error: non-variable type argument D[String] in type pattern D[D[String]] is unchecked since it is eliminated by erasure +t5762.scala:21: warning: non-variable type argument D[String] in type pattern D[D[String]] is unchecked since it is eliminated by erasure case _: D[D[String]] => 2 ^ -four errors found +error: No warnings can be incurred under -Xfatal-warnings. +four warnings found +one error found diff --git a/test/files/neg/t5830.check b/test/files/neg/t5830.check index 726fac2a1e..58c3a1be38 100644 --- a/test/files/neg/t5830.check +++ b/test/files/neg/t5830.check @@ -1,7 +1,9 @@ -t5830.scala:6: error: unreachable code +t5830.scala:6: warning: unreachable code case 'a' => println("b") // unreachable ^ -t5830.scala:4: error: could not emit switch for @switch annotated match +t5830.scala:4: warning: could not emit switch for @switch annotated match def unreachable(ch: Char) = (ch: @switch) match { ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/t6011.check b/test/files/neg/t6011.check index 5b5a861e5b..cb7f189031 100644 --- a/test/files/neg/t6011.check +++ b/test/files/neg/t6011.check @@ -1,10 +1,12 @@ -t6011.scala:4: error: unreachable code +t6011.scala:4: warning: unreachable code case 'a' | 'c' => 1 // unreachable ^ -t6011.scala:10: error: unreachable code +t6011.scala:10: warning: unreachable code case 'b' | 'a' => 1 // unreachable ^ -t6011.scala:8: error: could not emit switch for @switch annotated match +t6011.scala:8: warning: could not emit switch for @switch annotated match def f2(ch: Char): Any = (ch: @annotation.switch) match { ^ -three errors found +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/t6048.check b/test/files/neg/t6048.check index 5bdf2eca88..5e11d24fde 100644 --- a/test/files/neg/t6048.check +++ b/test/files/neg/t6048.check @@ -1,13 +1,15 @@ -t6048.scala:3: error: unreachable code +t6048.scala:3: warning: unreachable code case _ if false => x // unreachable ^ -t6048.scala:8: error: unreachable code +t6048.scala:8: warning: unreachable code case _ if false => x // unreachable ^ -t6048.scala:13: error: patterns after a variable pattern cannot match (SLS 8.1.1) +t6048.scala:13: warning: patterns after a variable pattern cannot match (SLS 8.1.1) case _ => x ^ -t6048.scala:14: error: unreachable code due to variable pattern on line 13 +t6048.scala:14: warning: unreachable code due to variable pattern on line 13 case 5 if true => x // unreachable ^ -four errors found +error: No warnings can be incurred under -Xfatal-warnings. +four warnings found +one error found diff --git a/test/files/neg/t6162-inheritance.check b/test/files/neg/t6162-inheritance.check index a7d3cc3238..e98fa79eb7 100644 --- a/test/files/neg/t6162-inheritance.check +++ b/test/files/neg/t6162-inheritance.check @@ -1,10 +1,18 @@ -t6162-inheritance.scala:6: error: inheritance from class Foo in package t6126 is deprecated: `Foo` will be made final in a future version. +t6162-inheritance.scala:6: warning: inheritance from class Foo in package t6126 is deprecated: `Foo` will be made final in a future version. class SubFoo extends Foo ^ -t6162-inheritance.scala:11: error: inheritance from trait T in package t6126 is deprecated +t6162-inheritance.scala:11: warning: inheritance from trait T in package t6126 is deprecated object SubT extends T ^ -t6162-inheritance.scala:17: error: inheritance from trait S in package t6126 is deprecated +t6162-inheritance.scala:17: warning: inheritance from trait S in package t6126 is deprecated new S { ^ -three errors found +t6162-inheritance.scala:6: warning: inheritance from class Foo in package t6126 is deprecated: `Foo` will be made final in a future version. +class SubFoo extends Foo + ^ +t6162-inheritance.scala:11: warning: inheritance from trait T in package t6126 is deprecated +object SubT extends T + ^ +error: No warnings can be incurred under -Xfatal-warnings. +5 warnings found +one error found diff --git a/test/files/neg/t6162-overriding.check b/test/files/neg/t6162-overriding.check index e774888d36..6bff75d88d 100644 --- a/test/files/neg/t6162-overriding.check +++ b/test/files/neg/t6162-overriding.check @@ -1,7 +1,9 @@ -t6162-overriding.scala:14: error: overriding method bar in class Bar is deprecated: `bar` will be made private in a future version. +t6162-overriding.scala:14: warning: overriding method bar in class Bar is deprecated: `bar` will be made private in a future version. override def bar = 43 ^ -t6162-overriding.scala:15: error: overriding method baz in class Bar is deprecated +t6162-overriding.scala:15: warning: overriding method baz in class Bar is deprecated override def baz = 43 ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/t6264.check b/test/files/neg/t6264.check index 438be4c39f..c0975a80b2 100644 --- a/test/files/neg/t6264.check +++ b/test/files/neg/t6264.check @@ -1,4 +1,6 @@ -t6264.scala:3: error: non-variable type argument Tuple1[_] in type Tuple2[_, Tuple1[_]] is unchecked since it is eliminated by erasure +t6264.scala:3: warning: non-variable type argument Tuple1[_] in type Tuple2[_, Tuple1[_]] is unchecked since it is eliminated by erasure x.isInstanceOf[Tuple2[_, Tuple1[_]]] ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/t6276.check b/test/files/neg/t6276.check index 0b3dfa5531..f275de9d0a 100644 --- a/test/files/neg/t6276.check +++ b/test/files/neg/t6276.check @@ -1,19 +1,21 @@ -t6276.scala:4: error: method a in class C does nothing other than call itself recursively +t6276.scala:4: warning: method a in class C does nothing other than call itself recursively def a: Any = a // warn ^ -t6276.scala:5: error: value b in class C does nothing other than call itself recursively +t6276.scala:5: warning: value b in class C does nothing other than call itself recursively val b: Any = b // warn ^ -t6276.scala:7: error: method c in class C does nothing other than call itself recursively +t6276.scala:7: warning: method c in class C does nothing other than call itself recursively def c: Any = this.c // warn ^ -t6276.scala:8: error: method d in class C does nothing other than call itself recursively +t6276.scala:8: warning: method d in class C does nothing other than call itself recursively def d: Any = C.this.d // warn ^ -t6276.scala:13: error: method a does nothing other than call itself recursively +t6276.scala:13: warning: method a does nothing other than call itself recursively def a: Any = a // warn ^ -t6276.scala:22: error: method a does nothing other than call itself recursively +t6276.scala:22: warning: method a does nothing other than call itself recursively def a = a // warn ^ -6 errors found +error: No warnings can be incurred under -Xfatal-warnings. +6 warnings found +one error found diff --git a/test/files/neg/t6355.check b/test/files/neg/t6355.check new file mode 100644 index 0000000000..c1fa147f52 --- /dev/null +++ b/test/files/neg/t6355.check @@ -0,0 +1,4 @@ +t6355.scala:12: error: implementation restriction: applyDynamic cannot be overloaded + def applyDynamic(name: String)(x: Int): Int = 2 + ^ +one error found diff --git a/test/files/neg/t6355.scala b/test/files/neg/t6355.scala new file mode 100644 index 0000000000..3007dc49f6 --- /dev/null +++ b/test/files/neg/t6355.scala @@ -0,0 +1,13 @@ +package foo + +import scala.language.dynamics + +class DoesntExtendDynamic { + def applyDynamic(name: String)(s: String): Int = 1 + def applyDynamic(name: String)(x: Int): Int = 2 +} + +class A extends Dynamic { + def applyDynamic(name: String)(s: String): Int = 1 + def applyDynamic(name: String)(x: Int): Int = 2 +} diff --git a/test/files/neg/t6357.check b/test/files/neg/t6357.check new file mode 100644 index 0000000000..a534d1439a --- /dev/null +++ b/test/files/neg/t6357.check @@ -0,0 +1,4 @@ +t6357.scala:3: error: value class may not be a local class + final class Y(val j: Int) extends AnyVal + ^ +one error found diff --git a/test/files/neg/t6357.scala b/test/files/neg/t6357.scala new file mode 100644 index 0000000000..47f5629638 --- /dev/null +++ b/test/files/neg/t6357.scala @@ -0,0 +1,6 @@ +object K { + def q = { + final class Y(val j: Int) extends AnyVal + 3 + } +} diff --git a/test/files/neg/t6406-regextract.check b/test/files/neg/t6406-regextract.check new file mode 100644 index 0000000000..19425a68b0 --- /dev/null +++ b/test/files/neg/t6406-regextract.check @@ -0,0 +1,6 @@ +t6406-regextract.scala:4: warning: method unapplySeq in class Regex is deprecated: Extracting a match result from anything but a CharSequence or Match is deprecated + List(1) collect { case r(i) => i } + ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found +one error found diff --git a/test/files/neg/t6406-regextract.flags b/test/files/neg/t6406-regextract.flags new file mode 100644 index 0000000000..85d8eb2ba2 --- /dev/null +++ b/test/files/neg/t6406-regextract.flags @@ -0,0 +1 @@ +-Xfatal-warnings diff --git a/test/files/neg/t6406-regextract.scala b/test/files/neg/t6406-regextract.scala new file mode 100644 index 0000000000..0f5dad908d --- /dev/null +++ b/test/files/neg/t6406-regextract.scala @@ -0,0 +1,5 @@ + +object Test extends App { + val r = "(\\d+)".r + List(1) collect { case r(i) => i } +} diff --git a/test/files/neg/t6426.check b/test/files/neg/t6426.check new file mode 100644 index 0000000000..149f74c4de --- /dev/null +++ b/test/files/neg/t6426.check @@ -0,0 +1,7 @@ +t6426.scala:4: error: wildcard invalid as backquoted identifier + println(`_`.Buffer(0)) + ^ +t6426.scala:5: error: ')' expected but '}' found. +} +^ +two errors found diff --git a/test/files/neg/t6426.scala b/test/files/neg/t6426.scala new file mode 100644 index 0000000000..a27d18eb58 --- /dev/null +++ b/test/files/neg/t6426.scala @@ -0,0 +1,5 @@ +class A { + import collection.{mutable => _, _} + + println(`_`.Buffer(0)) +} diff --git a/test/files/neg/t6567.check b/test/files/neg/t6567.check new file mode 100644 index 0000000000..a733d75354 --- /dev/null +++ b/test/files/neg/t6567.check @@ -0,0 +1,9 @@ +t6567.scala:8: warning: Suspicious application of an implicit view (Test.this.a2b) in the argument to Option.apply. + Option[B](a) + ^ +t6567.scala:10: warning: Suspicious application of an implicit view (Test.this.a2b) in the argument to Option.apply. + val b: Option[B] = Option(a) + ^ +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/t6567.flags b/test/files/neg/t6567.flags new file mode 100644 index 0000000000..e93641e931 --- /dev/null +++ b/test/files/neg/t6567.flags @@ -0,0 +1 @@ +-Xlint -Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/t6567.scala b/test/files/neg/t6567.scala new file mode 100644 index 0000000000..650e5e39ae --- /dev/null +++ b/test/files/neg/t6567.scala @@ -0,0 +1,11 @@ +class A +class B + +object Test { + val a: A = null + implicit def a2b(a: A) = new B + + Option[B](a) + + val b: Option[B] = Option(a) +} diff --git a/test/files/neg/unchecked-abstract.check b/test/files/neg/unchecked-abstract.check index 6e811dc156..72019082ac 100644 --- a/test/files/neg/unchecked-abstract.check +++ b/test/files/neg/unchecked-abstract.check @@ -1,25 +1,27 @@ -unchecked-abstract.scala:16: error: abstract type H in type Contravariant[M.this.H] is unchecked since it is eliminated by erasure +unchecked-abstract.scala:16: warning: abstract type H in type Contravariant[M.this.H] is unchecked since it is eliminated by erasure /* warn */ println(x.isInstanceOf[Contravariant[H]]) ^ -unchecked-abstract.scala:21: error: abstract type H in type Contravariant[M.this.H] is unchecked since it is eliminated by erasure +unchecked-abstract.scala:21: warning: abstract type H in type Contravariant[M.this.H] is unchecked since it is eliminated by erasure /* warn */ println(x.isInstanceOf[Contravariant[H]]) ^ -unchecked-abstract.scala:27: error: abstract type T in type Invariant[M.this.T] is unchecked since it is eliminated by erasure +unchecked-abstract.scala:27: warning: abstract type T in type Invariant[M.this.T] is unchecked since it is eliminated by erasure /* warn */ println(x.isInstanceOf[Invariant[T]]) ^ -unchecked-abstract.scala:28: error: abstract type L in type Invariant[M.this.L] is unchecked since it is eliminated by erasure +unchecked-abstract.scala:28: warning: abstract type L in type Invariant[M.this.L] is unchecked since it is eliminated by erasure /* warn */ println(x.isInstanceOf[Invariant[L]]) ^ -unchecked-abstract.scala:31: error: abstract type H in type Invariant[M.this.H] is unchecked since it is eliminated by erasure +unchecked-abstract.scala:31: warning: abstract type H in type Invariant[M.this.H] is unchecked since it is eliminated by erasure /* warn */ println(x.isInstanceOf[Invariant[H]]) ^ -unchecked-abstract.scala:33: error: abstract type L in type Invariant[M.this.L] is unchecked since it is eliminated by erasure +unchecked-abstract.scala:33: warning: abstract type L in type Invariant[M.this.L] is unchecked since it is eliminated by erasure /* warn */ println(x.isInstanceOf[Invariant[L]]) ^ -unchecked-abstract.scala:36: error: abstract type H in type Invariant[M.this.H] is unchecked since it is eliminated by erasure +unchecked-abstract.scala:36: warning: abstract type H in type Invariant[M.this.H] is unchecked since it is eliminated by erasure /* warn */ println(x.isInstanceOf[Invariant[H]]) ^ -unchecked-abstract.scala:37: error: abstract type T in type Invariant[M.this.T] is unchecked since it is eliminated by erasure +unchecked-abstract.scala:37: warning: abstract type T in type Invariant[M.this.T] is unchecked since it is eliminated by erasure /* warn */ println(x.isInstanceOf[Invariant[T]]) ^ -8 errors found +error: No warnings can be incurred under -Xfatal-warnings. +8 warnings found +one error found diff --git a/test/files/neg/unchecked-impossible.check b/test/files/neg/unchecked-impossible.check index 0ab371dbaa..d150a5a853 100644 --- a/test/files/neg/unchecked-impossible.check +++ b/test/files/neg/unchecked-impossible.check @@ -1,4 +1,10 @@ -unchecked-impossible.scala:5: error: fruitless type test: a value of type T2[Int,Int] cannot also be a Seq[A] +unchecked-impossible.scala:5: warning: fruitless type test: a value of type T2[Int,Int] cannot also be a Seq[A] case Seq(x) => ^ +unchecked-impossible.scala:5: error: pattern type is incompatible with expected type; + found : Seq[A] + required: T2[Int,Int] + case Seq(x) => + ^ +one warning found one error found diff --git a/test/files/neg/unchecked-knowable.check b/test/files/neg/unchecked-knowable.check index d279427327..327a5f202d 100644 --- a/test/files/neg/unchecked-knowable.check +++ b/test/files/neg/unchecked-knowable.check @@ -1,7 +1,9 @@ -unchecked-knowable.scala:18: error: fruitless type test: a value of type Bippy cannot also be a A1 +unchecked-knowable.scala:18: warning: fruitless type test: a value of type Bippy cannot also be a A1 /* warn */ (new Bippy).isInstanceOf[A1] ^ -unchecked-knowable.scala:19: error: fruitless type test: a value of type Bippy cannot also be a B1 +unchecked-knowable.scala:19: warning: fruitless type test: a value of type Bippy cannot also be a B1 /* warn */ (new Bippy).isInstanceOf[B1] ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/unchecked-refinement.check b/test/files/neg/unchecked-refinement.check index d81517464f..e85a51f44d 100644 --- a/test/files/neg/unchecked-refinement.check +++ b/test/files/neg/unchecked-refinement.check @@ -1,13 +1,15 @@ -unchecked-refinement.scala:17: error: abstract type U in type pattern Foo[U,U,V] is unchecked since it is eliminated by erasure +unchecked-refinement.scala:17: warning: abstract type U in type pattern Foo[U,U,V] is unchecked since it is eliminated by erasure /* warn */ case _: Foo[U, U, V] if b => () ^ -unchecked-refinement.scala:19: error: non-variable type argument Any in type pattern Foo[Any,U,V] is unchecked since it is eliminated by erasure +unchecked-refinement.scala:19: warning: non-variable type argument Any in type pattern Foo[Any,U,V] is unchecked since it is eliminated by erasure /* warn */ case _: Foo[Any, U, V] if b => () ^ -unchecked-refinement.scala:23: error: a pattern match on a refinement type is unchecked +unchecked-refinement.scala:23: warning: a pattern match on a refinement type is unchecked /* nowarn - todo */ case x: AnyRef { def bippy: Int } if b => x.bippy // this could/should do an instance check and not warn ^ -unchecked-refinement.scala:24: error: a pattern match on a refinement type is unchecked +unchecked-refinement.scala:24: warning: a pattern match on a refinement type is unchecked /* nowarn - todo */ case x: AnyRef { def size: Int } if b => x.size // this could/should do a static conformance test and not warn ^ -four errors found +error: No warnings can be incurred under -Xfatal-warnings. +four warnings found +one error found diff --git a/test/files/neg/unchecked-suppress.check b/test/files/neg/unchecked-suppress.check index 2e23d21386..038105918e 100644 --- a/test/files/neg/unchecked-suppress.check +++ b/test/files/neg/unchecked-suppress.check @@ -1,10 +1,12 @@ -unchecked-suppress.scala:4: error: non-variable type argument Int in type pattern Set[Int] is unchecked since it is eliminated by erasure +unchecked-suppress.scala:4: warning: non-variable type argument Int in type pattern Set[Int] is unchecked since it is eliminated by erasure case xs: Set[Int] => xs.head // unchecked ^ -unchecked-suppress.scala:5: error: non-variable type argument String in type pattern Map[String @unchecked,String] is unchecked since it is eliminated by erasure +unchecked-suppress.scala:5: warning: non-variable type argument String in type pattern Map[String @unchecked,String] is unchecked since it is eliminated by erasure case xs: Map[String @unchecked, String] => xs.head // one unchecked, one okay ^ -unchecked-suppress.scala:7: error: non-variable type argument Int in type pattern (Int, Int) => Int is unchecked since it is eliminated by erasure +unchecked-suppress.scala:7: warning: non-variable type argument Int in type pattern (Int, Int) => Int is unchecked since it is eliminated by erasure case f: ((Int, Int) => Int) => // unchecked ^ -three errors found +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/unchecked.check b/test/files/neg/unchecked.check index 2883b716c9..570f02f219 100644 --- a/test/files/neg/unchecked.check +++ b/test/files/neg/unchecked.check @@ -1,19 +1,21 @@ -unchecked.scala:18: error: non-variable type argument String in type pattern Iterable[String] is unchecked since it is eliminated by erasure +unchecked.scala:18: warning: non-variable type argument String in type pattern Iterable[String] is unchecked since it is eliminated by erasure case xs: Iterable[String] => xs.head // unchecked ^ -unchecked.scala:22: error: non-variable type argument Any in type pattern Set[Any] is unchecked since it is eliminated by erasure +unchecked.scala:22: warning: non-variable type argument Any in type pattern Set[Any] is unchecked since it is eliminated by erasure case xs: Set[Any] => xs.head // unchecked ^ -unchecked.scala:26: error: non-variable type argument Any in type pattern Map[Any,Any] is unchecked since it is eliminated by erasure +unchecked.scala:26: warning: non-variable type argument Any in type pattern Map[Any,Any] is unchecked since it is eliminated by erasure case xs: Map[Any, Any] => xs.head // unchecked ^ -unchecked.scala:35: error: non-variable type argument List[Nothing] in type pattern Test.Contra[List[Nothing]] is unchecked since it is eliminated by erasure +unchecked.scala:35: warning: non-variable type argument List[Nothing] in type pattern Test.Contra[List[Nothing]] is unchecked since it is eliminated by erasure case xs: Contra[List[Nothing]] => xs.head // unchecked ^ -unchecked.scala:50: error: non-variable type argument String in type pattern Test.Exp[String] is unchecked since it is eliminated by erasure +unchecked.scala:50: warning: non-variable type argument String in type pattern Test.Exp[String] is unchecked since it is eliminated by erasure case ArrayApply(x: Exp[Array[T]], _, j: Exp[String]) => x // unchecked ^ -unchecked.scala:55: error: non-variable type argument Array[T] in type pattern Test.Exp[Array[T]] is unchecked since it is eliminated by erasure +unchecked.scala:55: warning: non-variable type argument Array[T] in type pattern Test.Exp[Array[T]] is unchecked since it is eliminated by erasure case ArrayApply(x: Exp[Array[T]], _, _) => x // unchecked ^ -6 errors found +error: No warnings can be incurred under -Xfatal-warnings. +6 warnings found +one error found diff --git a/test/files/neg/unchecked2.check b/test/files/neg/unchecked2.check index 68fdfa82ac..a7b8391856 100644 --- a/test/files/neg/unchecked2.check +++ b/test/files/neg/unchecked2.check @@ -1,43 +1,45 @@ -unchecked2.scala:4: error: fruitless type test: a value of type Some[List[Int]] cannot also be a Option[List[String]] (but still might match its erasure) +unchecked2.scala:4: warning: fruitless type test: a value of type Some[List[Int]] cannot also be a Option[List[String]] (but still might match its erasure) /* warn */ Some(List(1)).isInstanceOf[Option[List[String]]] ^ -unchecked2.scala:5: error: non-variable type argument Option[_] in type Option[Option[_]] is unchecked since it is eliminated by erasure +unchecked2.scala:5: warning: non-variable type argument Option[_] in type Option[Option[_]] is unchecked since it is eliminated by erasure /* warn */ Some(123).isInstanceOf[Option[Option[_]]] ^ -unchecked2.scala:6: error: fruitless type test: a value of type Some[Int] cannot also be a Option[String] (but still might match its erasure) +unchecked2.scala:6: warning: fruitless type test: a value of type Some[Int] cannot also be a Option[String] (but still might match its erasure) /* warn */ Some(123).isInstanceOf[Option[String]] ^ -unchecked2.scala:7: error: fruitless type test: a value of type Some[Int] cannot also be a Option[List[String]] (but still might match its erasure) +unchecked2.scala:7: warning: fruitless type test: a value of type Some[Int] cannot also be a Option[List[String]] (but still might match its erasure) /* warn */ Some(123).isInstanceOf[Option[List[String]]] ^ -unchecked2.scala:8: error: fruitless type test: a value of type Some[Int] cannot also be a Option[List[Int => String]] (but still might match its erasure) +unchecked2.scala:8: warning: fruitless type test: a value of type Some[Int] cannot also be a Option[List[Int => String]] (but still might match its erasure) /* warn */ Some(123).isInstanceOf[Option[List[Int => String]]] ^ -unchecked2.scala:9: error: fruitless type test: a value of type Some[Int] cannot also be a Option[(String, Double)] (but still might match its erasure) +unchecked2.scala:9: warning: fruitless type test: a value of type Some[Int] cannot also be a Option[(String, Double)] (but still might match its erasure) /* warn */ Some(123).isInstanceOf[Option[(String, Double)]] ^ -unchecked2.scala:10: error: fruitless type test: a value of type Some[Int] cannot also be a Option[String => Double] (but still might match its erasure) +unchecked2.scala:10: warning: fruitless type test: a value of type Some[Int] cannot also be a Option[String => Double] (but still might match its erasure) /* warn */ Some(123).isInstanceOf[Option[String => Double]] ^ -unchecked2.scala:14: error: non-variable type argument List[String] in type Option[List[String]] is unchecked since it is eliminated by erasure +unchecked2.scala:14: warning: non-variable type argument List[String] in type Option[List[String]] is unchecked since it is eliminated by erasure /* warn */ (Some(List(1)): Any).isInstanceOf[Option[List[String]]] ^ -unchecked2.scala:15: error: non-variable type argument Int in type Option[Int] is unchecked since it is eliminated by erasure +unchecked2.scala:15: warning: non-variable type argument Int in type Option[Int] is unchecked since it is eliminated by erasure /* warn */ (Some(123): Any).isInstanceOf[Option[Int]] ^ -unchecked2.scala:16: error: non-variable type argument String in type Option[String] is unchecked since it is eliminated by erasure +unchecked2.scala:16: warning: non-variable type argument String in type Option[String] is unchecked since it is eliminated by erasure /* warn */ (Some(123): Any).isInstanceOf[Option[String]] ^ -unchecked2.scala:17: error: non-variable type argument List[String] in type Option[List[String]] is unchecked since it is eliminated by erasure +unchecked2.scala:17: warning: non-variable type argument List[String] in type Option[List[String]] is unchecked since it is eliminated by erasure /* warn */ (Some(123): Any).isInstanceOf[Option[List[String]]] ^ -unchecked2.scala:18: error: non-variable type argument List[Int => String] in type Option[List[Int => String]] is unchecked since it is eliminated by erasure +unchecked2.scala:18: warning: non-variable type argument List[Int => String] in type Option[List[Int => String]] is unchecked since it is eliminated by erasure /* warn */ (Some(123): Any).isInstanceOf[Option[List[Int => String]]] ^ -unchecked2.scala:19: error: non-variable type argument (String, Double) in type Option[(String, Double)] is unchecked since it is eliminated by erasure +unchecked2.scala:19: warning: non-variable type argument (String, Double) in type Option[(String, Double)] is unchecked since it is eliminated by erasure /* warn */ (Some(123): Any).isInstanceOf[Option[(String, Double)]] ^ -unchecked2.scala:20: error: non-variable type argument String => Double in type Option[String => Double] is unchecked since it is eliminated by erasure +unchecked2.scala:20: warning: non-variable type argument String => Double in type Option[String => Double] is unchecked since it is eliminated by erasure /* warn */ (Some(123): Any).isInstanceOf[Option[String => Double]] ^ -14 errors found +error: No warnings can be incurred under -Xfatal-warnings. +14 warnings found +one error found diff --git a/test/files/neg/unchecked3.check b/test/files/neg/unchecked3.check index f4f0c74257..a7582a8930 100644 --- a/test/files/neg/unchecked3.check +++ b/test/files/neg/unchecked3.check @@ -1,37 +1,42 @@ -unchecked3.scala:24: error: non-variable type argument Double in type pattern E1[Double] is unchecked since it is eliminated by erasure +unchecked3.scala:24: warning: non-variable type argument Double in type pattern E1[Double] is unchecked since it is eliminated by erasure /* warn */ def peerTypes2(x: B1[Int]) = x match { case _: E1[Double] => true } ^ -unchecked3.scala:25: error: non-variable type argument Double in type pattern F1[Double] is unchecked since it is eliminated by erasure +unchecked3.scala:25: warning: non-variable type argument Double in type pattern F1[Double] is unchecked since it is eliminated by erasure /* warn */ def peerTypes3(x: B1[_]) = x match { case _: F1[Double] => true } ^ -unchecked3.scala:28: error: non-variable type argument Int in type pattern A2[Int] is unchecked since it is eliminated by erasure +unchecked3.scala:28: warning: non-variable type argument Int in type pattern A2[Int] is unchecked since it is eliminated by erasure /* warn */ def twotypes1[T](x: B2[T, Int]) = x match { case _: A2[Int] => true } ^ -unchecked3.scala:32: error: non-variable type argument Int in type pattern B2[_,Int] is unchecked since it is eliminated by erasure +unchecked3.scala:32: warning: non-variable type argument Int in type pattern B2[_,Int] is unchecked since it is eliminated by erasure /* warn */ def twotypes5[T](x: A2[T]) = x match { case _: B2[_, Int] => true } ^ -unchecked3.scala:40: error: non-variable type argument String in type pattern Array[List[String]] is unchecked since it is eliminated by erasure +unchecked3.scala:40: warning: non-variable type argument String in type pattern Array[List[String]] is unchecked since it is eliminated by erasure /* warn */ case _: Array[List[String]] => () ^ -unchecked3.scala:43: error: non-variable type argument String in type pattern Array[Array[List[String]]] is unchecked since it is eliminated by erasure +unchecked3.scala:43: warning: non-variable type argument String in type pattern Array[Array[List[String]]] is unchecked since it is eliminated by erasure /* warn */ case _: Array[Array[List[String]]] => () ^ -unchecked3.scala:50: error: non-variable type argument String in type pattern Array[List[String]] is unchecked since it is eliminated by erasure +unchecked3.scala:50: warning: non-variable type argument String in type pattern Array[List[String]] is unchecked since it is eliminated by erasure /* warn */ case _: Array[List[String]] => () ^ -unchecked3.scala:53: error: non-variable type argument String in type pattern Array[Array[List[String]]] is unchecked since it is eliminated by erasure +unchecked3.scala:53: warning: non-variable type argument String in type pattern Array[Array[List[String]]] is unchecked since it is eliminated by erasure /* warn */ case _: Array[Array[List[String]]] => () ^ -unchecked3.scala:60: error: non-variable type argument String in type pattern Array[List[String]] is unchecked since it is eliminated by erasure +unchecked3.scala:60: warning: non-variable type argument String in type pattern Array[List[String]] is unchecked since it is eliminated by erasure /* warn */ case _: Array[List[String]] => () ^ -unchecked3.scala:62: error: non-variable type argument Array[String] in type pattern Array[List[Array[String]]] is unchecked since it is eliminated by erasure +unchecked3.scala:62: warning: non-variable type argument Array[String] in type pattern Array[List[Array[String]]] is unchecked since it is eliminated by erasure /* warn */ case _: Array[List[Array[String]]] => () ^ -unchecked3.scala:63: error: non-variable type argument String in type pattern Array[Array[List[String]]] is unchecked since it is eliminated by erasure +unchecked3.scala:63: warning: non-variable type argument String in type pattern Array[Array[List[String]]] is unchecked since it is eliminated by erasure /* warn */ case _: Array[Array[List[String]]] => () ^ -unchecked3.scala:75: error: abstract type A in type pattern Set[Q.this.A] is unchecked since it is eliminated by erasure +unchecked3.scala:75: warning: abstract type A in type pattern Set[Q.this.A] is unchecked since it is eliminated by erasure /* warn */ case xs: Set[A] => xs.head ^ -12 errors found +unchecked3.scala:62: warning: unreachable code + /* warn */ case _: Array[List[Array[String]]] => () + ^ +error: No warnings can be incurred under -Xfatal-warnings. +13 warnings found +one error found diff --git a/test/files/neg/unit-returns-value.check b/test/files/neg/unit-returns-value.check index ab458a350b..f30a506ebe 100644 --- a/test/files/neg/unit-returns-value.check +++ b/test/files/neg/unit-returns-value.check @@ -1,7 +1,15 @@ -unit-returns-value.scala:4: error: a pure expression does nothing in statement position; you may be omitting necessary parentheses +unit-returns-value.scala:4: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses if (b) return 5 ^ -unit-returns-value.scala:4: error: enclosing method f has result type Unit: return value discarded +unit-returns-value.scala:4: warning: enclosing method f has result type Unit: return value discarded if (b) return 5 ^ -two errors found +unit-returns-value.scala:22: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + i1 // warn + ^ +unit-returns-value.scala:23: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + i2 // warn + ^ +error: No warnings can be incurred under -Xfatal-warnings. +four warnings found +one error found diff --git a/test/files/neg/unit-returns-value.scala b/test/files/neg/unit-returns-value.scala index ecc981f217..fc5a37069f 100644 --- a/test/files/neg/unit-returns-value.scala +++ b/test/files/neg/unit-returns-value.scala @@ -3,9 +3,30 @@ object Test { var b = false if (b) return 5 } - + // no warning def g { return println("hello") } } + +class UnusedValues { + var i1 = 2 + val i2 = 2 + lazy val i3 = 2 + object i4 { } + def i5 = 2 + final def i6 = 2 + + def x = { + i1 // warn + i2 // warn + i3 // no warn + i4 // no warn + i5 // no warn + i6 // could warn someday, if i6 returned 2.type instead of Int + + 5 + } +} + diff --git a/test/files/neg/virtpatmat_reach_null.check b/test/files/neg/virtpatmat_reach_null.check index 595c8ec889..e0c36c8c5b 100644 --- a/test/files/neg/virtpatmat_reach_null.check +++ b/test/files/neg/virtpatmat_reach_null.check @@ -1,4 +1,6 @@ -virtpatmat_reach_null.scala:13: error: unreachable code +virtpatmat_reach_null.scala:13: warning: unreachable code case _ => // unreachable ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/virtpatmat_reach_sealed_unsealed.check b/test/files/neg/virtpatmat_reach_sealed_unsealed.check index 10638eff52..064a12bcaa 100644 --- a/test/files/neg/virtpatmat_reach_sealed_unsealed.check +++ b/test/files/neg/virtpatmat_reach_sealed_unsealed.check @@ -1,14 +1,16 @@ -virtpatmat_reach_sealed_unsealed.scala:16: error: match may not be exhaustive. +virtpatmat_reach_sealed_unsealed.scala:16: warning: match may not be exhaustive. It would fail on the following input: false (true: Boolean) match { case true => } // not exhaustive, but reachable ^ -virtpatmat_reach_sealed_unsealed.scala:18: error: unreachable code +virtpatmat_reach_sealed_unsealed.scala:18: warning: unreachable code (true: Boolean) match { case true => case false => case _ => } // exhaustive, last case is unreachable ^ -virtpatmat_reach_sealed_unsealed.scala:19: error: unreachable code +virtpatmat_reach_sealed_unsealed.scala:19: warning: unreachable code (true: Boolean) match { case true => case false => case _: Boolean => } // exhaustive, last case is unreachable ^ -virtpatmat_reach_sealed_unsealed.scala:20: error: unreachable code +virtpatmat_reach_sealed_unsealed.scala:20: warning: unreachable code (true: Boolean) match { case true => case false => case _: Any => } // exhaustive, last case is unreachable ^ -four errors found +error: No warnings can be incurred under -Xfatal-warnings. +four warnings found +one error found diff --git a/test/files/neg/virtpatmat_unreach_select.check b/test/files/neg/virtpatmat_unreach_select.check index 3771971020..4fc78cd412 100644 --- a/test/files/neg/virtpatmat_unreach_select.check +++ b/test/files/neg/virtpatmat_unreach_select.check @@ -1,4 +1,6 @@ -virtpatmat_unreach_select.scala:10: error: unreachable code +virtpatmat_unreach_select.scala:10: warning: unreachable code case WARNING.id => // unreachable ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/warn-inferred-any.check b/test/files/neg/warn-inferred-any.check new file mode 100644 index 0000000000..4628033e55 --- /dev/null +++ b/test/files/neg/warn-inferred-any.check @@ -0,0 +1,12 @@ +warn-inferred-any.scala:8: warning: a type was inferred to be `Any`; this may indicate a programming error. + { List(1, 2, 3) contains "a" } // only this warns + ^ +warn-inferred-any.scala:16: warning: a type was inferred to be `AnyVal`; this may indicate a programming error. + { 1l to 5l contains 5 } + ^ +warn-inferred-any.scala:17: warning: a type was inferred to be `AnyVal`; this may indicate a programming error. + { 1l to 5l contains 5d } + ^ +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/warn-inferred-any.flags b/test/files/neg/warn-inferred-any.flags new file mode 100644 index 0000000000..a3127d392a --- /dev/null +++ b/test/files/neg/warn-inferred-any.flags @@ -0,0 +1 @@ +-Xfatal-warnings -Ywarn-infer-any diff --git a/test/files/neg/warn-inferred-any.scala b/test/files/neg/warn-inferred-any.scala new file mode 100644 index 0000000000..b853e6e5a8 --- /dev/null +++ b/test/files/neg/warn-inferred-any.scala @@ -0,0 +1,19 @@ +trait Foo[-A <: AnyRef, +B <: AnyRef] { + def run[U](x: A)(action: B => U): Boolean = ??? + + { run(_: A)(_: B => String) } +} + +trait Xs[+A] { + { List(1, 2, 3) contains "a" } // only this warns + { List(1, 2, 3) contains 1 } + { identity(List(1, 2, 3) contains 1) } + { List("a") foreach println } +} + +trait Ys[+A] { + { 1 to 5 contains 5l } + { 1l to 5l contains 5 } + { 1l to 5l contains 5d } + { 1l to 5l contains 5l } +} diff --git a/test/files/neg/warn-unused-imports.check b/test/files/neg/warn-unused-imports.check new file mode 100644 index 0000000000..e61ec267d3 --- /dev/null +++ b/test/files/neg/warn-unused-imports.check @@ -0,0 +1,44 @@ +warn-unused-imports.scala:7: warning: it is not recommended to define classes/objects inside of package objects. +If possible, define class A in package p1 instead. + class A + ^ +warn-unused-imports.scala:13: warning: it is not recommended to define classes/objects inside of package objects. +If possible, define class A in package p2 instead. + class A + ^ +warn-unused-imports.scala:99: warning: local trait Warn is never used + trait Warn { // warn about unused local trait for good measure + ^ +warn-unused-imports.scala:57: warning: Unused import + import p1.A // warn + ^ +warn-unused-imports.scala:62: warning: Unused import + import p1.{ A, B } // warn on A + ^ +warn-unused-imports.scala:67: warning: Unused import + import p1.{ A, B } // warn on both + ^ +warn-unused-imports.scala:67: warning: Unused import + import p1.{ A, B } // warn on both + ^ +warn-unused-imports.scala:73: warning: Unused import + import c._ // warn + ^ +warn-unused-imports.scala:78: warning: Unused import + import p1._ // warn + ^ +warn-unused-imports.scala:85: warning: Unused import + import c._ // warn + ^ +warn-unused-imports.scala:91: warning: Unused import + import p1.c._ // warn + ^ +warn-unused-imports.scala:98: warning: Unused import + import p1._ // warn + ^ +warn-unused-imports.scala:118: warning: Unused import + import p1.A // warn + ^ +error: No warnings can be incurred under -Xfatal-warnings. +13 warnings found +one error found diff --git a/test/files/neg/warn-unused-imports.flags b/test/files/neg/warn-unused-imports.flags new file mode 100644 index 0000000000..954eaba352 --- /dev/null +++ b/test/files/neg/warn-unused-imports.flags @@ -0,0 +1 @@ +-Xfatal-warnings -Xlint diff --git a/test/files/neg/warn-unused-imports.scala b/test/files/neg/warn-unused-imports.scala new file mode 100644 index 0000000000..b7a2f1c414 --- /dev/null +++ b/test/files/neg/warn-unused-imports.scala @@ -0,0 +1,125 @@ +class Bippo { + def length: Int = 123 + class Tree +} + +package object p1 { + class A + implicit class B(val s: String) { def bippy = s } + val c: Bippo = new Bippo + type D = String +} +package object p2 { + class A + implicit class B(val s: String) { def bippy = s } + val c: Bippo = new Bippo + type D = Int +} + +trait NoWarn { + { + import p1._ // no warn + println("abc".bippy) + } + + { + import p1._ // no warn + println(new A) + } + + { + import p1.B // no warn + println("abc".bippy) + } + + { + import p1._ // no warn + import c._ // no warn + println(length) + } + + { + import p1._ // no warn + import c._ // no warn + val x: Tree = null + println(x) + } + + { + import p1.D // no warn + val x: D = null + println(x) + } +} + +trait Warn { + { + import p1.A // warn + println(123) + } + + { + import p1.{ A, B } // warn on A + println("abc".bippy) + } + + { + import p1.{ A, B } // warn on both + println(123) + } + + { + import p1._ // no warn (technically this could warn, but not worth the effort to unroll unusedness transitively) + import c._ // warn + println(123) + } + + { + import p1._ // warn + println(123) + } + + { + class Tree + import p1._ // no warn + import c._ // warn + val x: Tree = null + println(x) + } + + { + import p1.c._ // warn + println(123) + } +} + +trait Nested { + { + import p1._ // warn + trait Warn { // warn about unused local trait for good measure + import p2._ + println(new A) + println("abc".bippy) + } + println("") + } + + { + import p1._ // no warn + trait NoWarn { + import p2.B // no warn + println("abc".bippy) + println(new A) + } + println(new NoWarn { }) + } + + { + import p1.A // warn + trait Warn { + import p2.A + println(new A) + } + println(new Warn { }) + } +} diff --git a/test/files/neg/warn-unused-privates.check b/test/files/neg/warn-unused-privates.check new file mode 100644 index 0000000000..9c41a33e8f --- /dev/null +++ b/test/files/neg/warn-unused-privates.check @@ -0,0 +1,63 @@ +warn-unused-privates.scala:2: warning: private constructor in class Bippy is never used + private def this(c: Int) = this(c, c) // warn + ^ +warn-unused-privates.scala:4: warning: private method in class Bippy is never used + private def boop(x: Int) = x+a+b // warn + ^ +warn-unused-privates.scala:6: warning: private val in class Bippy is never used + final private val MILLIS2: Int = 1000 // warn + ^ +warn-unused-privates.scala:13: warning: private val in object Bippy is never used + private val HEY_INSTANCE: Int = 1000 // warn + ^ +warn-unused-privates.scala:35: warning: private val in class Boppy is never used + private val hummer = "def" // warn + ^ +warn-unused-privates.scala:42: warning: private var in trait Accessors is never used + private var v1: Int = 0 // warn + ^ +warn-unused-privates.scala:43: warning: private setter in trait Accessors is never used + private var v2: Int = 0 // warn, never set + ^ +warn-unused-privates.scala:44: warning: private var in trait Accessors is never used + private var v3: Int = 0 // warn, never got + ^ +warn-unused-privates.scala:56: warning: private default argument in trait DefaultArgs is never used + private def bippy(x1: Int, x2: Int = 10, x3: Int = 15): Int = x1 + x2 + x3 + ^ +warn-unused-privates.scala:56: warning: private default argument in trait DefaultArgs is never used + private def bippy(x1: Int, x2: Int = 10, x3: Int = 15): Int = x1 + x2 + x3 + ^ +warn-unused-privates.scala:67: warning: local var in method f0 is never used + var x = 1 // warn + ^ +warn-unused-privates.scala:74: warning: local val in method f1 is never used + val b = new Outer // warn + ^ +warn-unused-privates.scala:84: warning: private object in object Types is never used + private object Dongo { def f = this } // warn + ^ +warn-unused-privates.scala:94: warning: local object in method l1 is never used + object HiObject { def f = this } // warn + ^ +warn-unused-privates.scala:78: warning: local var x in method f2 is never set - it could be a val + var x = 100 // warn about it being a var + ^ +warn-unused-privates.scala:85: warning: private class Bar1 in object Types is never used + private class Bar1 // warn + ^ +warn-unused-privates.scala:87: warning: private type Alias1 in object Types is never used + private type Alias1 = String // warn + ^ +warn-unused-privates.scala:95: warning: local class Hi is never used + class Hi { // warn + ^ +warn-unused-privates.scala:99: warning: local class DingDongDoobie is never used + class DingDongDoobie // warn + ^ +warn-unused-privates.scala:102: warning: local type OtherThing is never used + type OtherThing = String // warn + ^ +error: No warnings can be incurred under -Xfatal-warnings. +20 warnings found +one error found diff --git a/test/files/neg/warn-unused-privates.flags b/test/files/neg/warn-unused-privates.flags new file mode 100644 index 0000000000..7949c2afa2 --- /dev/null +++ b/test/files/neg/warn-unused-privates.flags @@ -0,0 +1 @@ +-Xlint -Xfatal-warnings diff --git a/test/files/neg/warn-unused-privates.scala b/test/files/neg/warn-unused-privates.scala new file mode 100644 index 0000000000..cb6e946a34 --- /dev/null +++ b/test/files/neg/warn-unused-privates.scala @@ -0,0 +1,105 @@ +class Bippy(a: Int, b: Int) { + private def this(c: Int) = this(c, c) // warn + private def bippy(x: Int): Int = bippy(x) // TODO: could warn + private def boop(x: Int) = x+a+b // warn + final private val MILLIS1 = 2000 // no warn, might have been inlined + final private val MILLIS2: Int = 1000 // warn + final private val HI_COMPANION: Int = 500 // no warn, accessed from companion + def hi() = Bippy.HI_INSTANCE +} +object Bippy { + def hi(x: Bippy) = x.HI_COMPANION + private val HI_INSTANCE: Int = 500 // no warn, accessed from instance + private val HEY_INSTANCE: Int = 1000 // warn +} + +class A(val msg: String) +class B1(msg: String) extends A(msg) +class B2(msg0: String) extends A(msg0) +class B3(msg0: String) extends A("msg") + +/*** Early defs warnings disabled primarily due to SI-6595. + * The test case is here to assure we aren't issuing false positives; + * the ones labeled "warn" don't warn. + ***/ +class Boppy extends { + private val hmm: String = "abc" // no warn, used in early defs + private val hom: String = "def" // no warn, used in body + private final val him = "ghi" // no warn, might have been (was) inlined + final val him2 = "ghi" // no warn, same + final val himinline = him + private val hum: String = "jkl" // warn + final val ding = hmm.length +} with Mutable { + val dinger = hom + private val hummer = "def" // warn + + private final val bum = "ghi" // no warn, might have been (was) inlined + final val bum2 = "ghi" // no warn, same +} + +trait Accessors { + private var v1: Int = 0 // warn + private var v2: Int = 0 // warn, never set + private var v3: Int = 0 // warn, never got + private var v4: Int = 0 // no warn + + def bippy(): Int = { + v3 = 5 + v4 = 6 + v2 + v4 + } +} + +trait DefaultArgs { + // warn about default getters for x2 and x3 + private def bippy(x1: Int, x2: Int = 10, x3: Int = 15): Int = x1 + x2 + x3 + + def boppy() = bippy(5, 100, 200) +} + +class Outer { + class Inner +} + +trait Locals { + def f0 = { + var x = 1 // warn + var y = 2 + y = 3 + y + y + } + def f1 = { + val a = new Outer // no warn + val b = new Outer // warn + new a.Inner + } + def f2 = { + var x = 100 // warn about it being a var + x + } +} + +object Types { + private object Dongo { def f = this } // warn + private class Bar1 // warn + private class Bar2 // no warn + private type Alias1 = String // warn + private type Alias2 = String // no warn + def bippo = (new Bar2).toString + + def f(x: Alias2) = x.length + + def l1() = { + object HiObject { def f = this } // warn + class Hi { // warn + def f1: Hi = new Hi + def f2(x: Hi) = x + } + class DingDongDoobie // warn + class Bippy // no warn + type Something = Bippy // no warn + type OtherThing = String // warn + (new Bippy): Something + } +} diff --git a/test/files/pos/annotations.scala b/test/files/pos/annotations.scala index 706a715bad..501e2a6bd3 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[@cloneable +T, U, V[_]] abstract class C2[@deprecated @ann(1) T <: Number, V] 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/classtag-pos.flags b/test/files/pos/classtag-pos.flags new file mode 100644 index 0000000000..281f0a10cd --- /dev/null +++ b/test/files/pos/classtag-pos.flags @@ -0,0 +1 @@ +-Yrangepos diff --git a/test/files/pos/classtag-pos.scala b/test/files/pos/classtag-pos.scala new file mode 100644 index 0000000000..768d2e27f4 --- /dev/null +++ b/test/files/pos/classtag-pos.scala @@ -0,0 +1,5 @@ +import scala.reflect.runtime.universe._ + +class A { + def f[T: TypeTag] = typeOf[T] match { case TypeRef(_, _, args) => args } +} 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/pending/pos/exhaust_2.scala b/test/files/pos/exhaust_2.scala index 4f4e47c43b..4f4e47c43b 100644 --- a/test/pending/pos/exhaust_2.scala +++ b/test/files/pos/exhaust_2.scala 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/pending/pos/no-widen-locals.scala b/test/files/pos/no-widen-locals.scala index 013e63f0a2..013e63f0a2 100644 --- a/test/pending/pos/no-widen-locals.scala +++ b/test/files/pos/no-widen-locals.scala 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/spec-annotations.scala b/test/files/pos/spec-annotations.scala index 48281e5df5..6c1f737470 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[@cloneable +T, U, V[_]] abstract class C2[@deprecated @ann(1) T <: Number, V] 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/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/pending/pos/t1751/A1_2.scala b/test/files/pos/t1751/A1_2.scala index 354d5eecd0..354d5eecd0 100644 --- a/test/pending/pos/t1751/A1_2.scala +++ b/test/files/pos/t1751/A1_2.scala diff --git a/test/pending/pos/t1751/A2_1.scala b/test/files/pos/t1751/A2_1.scala index c768062e43..c768062e43 100644 --- a/test/pending/pos/t1751/A2_1.scala +++ b/test/files/pos/t1751/A2_1.scala diff --git a/test/pending/pos/t1751/SuiteClasses.java b/test/files/pos/t1751/SuiteClasses.java index a415e4f572..a415e4f572 100644 --- a/test/pending/pos/t1751/SuiteClasses.java +++ b/test/files/pos/t1751/SuiteClasses.java diff --git a/test/pending/pos/t1782/Ann.java b/test/files/pos/t1782/Ann.java index 0dcfbd2ed7..0dcfbd2ed7 100644 --- a/test/pending/pos/t1782/Ann.java +++ b/test/files/pos/t1782/Ann.java diff --git a/test/pending/pos/t1782/Days.java b/test/files/pos/t1782/Days.java index 203a87b1c2..203a87b1c2 100644 --- a/test/pending/pos/t1782/Days.java +++ b/test/files/pos/t1782/Days.java diff --git a/test/pending/pos/t1782/ImplementedBy.java b/test/files/pos/t1782/ImplementedBy.java index 6aa8b4fa9e..6aa8b4fa9e 100644 --- a/test/pending/pos/t1782/ImplementedBy.java +++ b/test/files/pos/t1782/ImplementedBy.java diff --git a/test/pending/pos/t1782/Test_1.scala b/test/files/pos/t1782/Test_1.scala index 6467a74c29..6467a74c29 100644 --- a/test/pending/pos/t1782/Test_1.scala +++ b/test/files/pos/t1782/Test_1.scala 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/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/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/pending/pos/t294/Ann.java b/test/files/pos/t294/Ann.java index 934ca46297..934ca46297 100644 --- a/test/pending/pos/t294/Ann.java +++ b/test/files/pos/t294/Ann.java diff --git a/test/pending/pos/t294/Ann2.java b/test/files/pos/t294/Ann2.java index 025b79e794..025b79e794 100644 --- a/test/pending/pos/t294/Ann2.java +++ b/test/files/pos/t294/Ann2.java diff --git a/test/pending/pos/t294/Test_1.scala b/test/files/pos/t294/Test_1.scala index ff1f34b10e..ff1f34b10e 100644 --- a/test/pending/pos/t294/Test_1.scala +++ b/test/files/pos/t294/Test_1.scala diff --git a/test/pending/pos/t294/Test_2.scala b/test/files/pos/t294/Test_2.scala index 9fb1c6e175..9fb1c6e175 100644 --- a/test/pending/pos/t294/Test_2.scala +++ b/test/files/pos/t294/Test_2.scala 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/t3577.scala b/test/files/pos/t3577.scala new file mode 100644 index 0000000000..80a280f67a --- /dev/null +++ b/test/files/pos/t3577.scala @@ -0,0 +1,29 @@ +case class Check[A](val value: A) + +case class C2(checks: Check[_]*); + +object C { + def m(x : C2): Any = (null: Any) match { + case C2(_, rest @ _*) => { + rest.map(_.value) + } + } +} + +/////////////////// + +object Container { + trait Exp[+T] + abstract class FuncExp[-S, +T] + + sealed abstract class FoundNode[T, Repr] { + def optimize[TupleT, U, That](parentNode: FlatMap[T, Repr, U, That]): Any + def optimize2[TupleT, U, That](parentNode: Any): Any + } + + class FlatMap[T, Repr, U, That] + + val Seq(fn: FoundNode[t, repr]) = Seq[FoundNode[_, _]]() + fn.optimize(null) // was: scala.MatchError: ? (of class BoundedWildcardType) @ Variances#varianceInType + fn.optimize2(null) // was: fatal error: bad type: ?(class scala.reflect.internal.Types$BoundedWildcardType) @ Pickle.putType +} 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/pending/pos/t4649.scala b/test/files/pos/t4649.scala index 0d6caa8d7a..0d6caa8d7a 100644 --- a/test/pending/pos/t4649.scala +++ b/test/files/pos/t4649.scala 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/pending/pos/t4786.scala b/test/files/pos/t4786.scala index f0579142b8..f0579142b8 100644 --- a/test/pending/pos/t4786.scala +++ b/test/files/pos/t4786.scala diff --git a/test/files/pos/t5130.scala b/test/files/pos/t5130.scala new file mode 100644 index 0000000000..676d3c7050 --- /dev/null +++ b/test/files/pos/t5130.scala @@ -0,0 +1,46 @@ +import scala.language.reflectiveCalls + +class A { + this_a => + + def b = new B + class B { def a: this_a.type = this_a } +} +trait A2 { def c = () } + +object Test { + val v1 = new A { def c = () } + val v2 = new A with A2 { } + val v3: A { def c: Unit } = null + def d1 = new A { def c = () } + def d2 = new A with A2 { } + def d3: A { def c: Unit } = null + var x1 = new A { def c = () } + var x2 = new A with A2 { } + var x3: A { def c: Unit } = null + + def main(args: Array[String]): Unit = { + val mv1 = new A { def c = () } + val mv2 = new A with A2 { } + val mv3: A { def c: Unit } = null + def md1 = new A { def c = () } + def md2 = new A with A2 { } + def md3: A { def c: Unit } = null + + v1.b.a.c + v2.b.a.c + v3.b.a.c + d1.b.a.c + d2.b.a.c + d3.b.a.c + x1.b.a.c + x2.b.a.c + x3.b.a.c + mv1.b.a.c + mv2.b.a.c + mv3.b.a.c + md1.b.a.c + md2.b.a.c + md3.b.a.c + } +} diff --git a/test/pending/pos/t5399a.scala b/test/files/pos/t5399a.scala index 4ebd85ad03..4ebd85ad03 100644 --- a/test/pending/pos/t5399a.scala +++ b/test/files/pos/t5399a.scala diff --git a/test/files/pos/t5604b/T_1.scala b/test/files/pos/t5604b/T_1.scala new file mode 100644 index 0000000000..179dcb10c6 --- /dev/null +++ b/test/files/pos/t5604b/T_1.scala @@ -0,0 +1,6 @@ +// sandbox/t5604/T.scala +package t6504 + +trait T { + def foo: Boolean = false +} diff --git a/test/files/pos/t5604b/T_2.scala b/test/files/pos/t5604b/T_2.scala new file mode 100644 index 0000000000..179dcb10c6 --- /dev/null +++ b/test/files/pos/t5604b/T_2.scala @@ -0,0 +1,6 @@ +// sandbox/t5604/T.scala +package t6504 + +trait T { + def foo: Boolean = false +} diff --git a/test/files/pos/t5604b/Test_1.scala b/test/files/pos/t5604b/Test_1.scala new file mode 100644 index 0000000000..f7c58ebe83 --- /dev/null +++ b/test/files/pos/t5604b/Test_1.scala @@ -0,0 +1,7 @@ +// sandbox/t5604/Test.scala +package t6504 + +object Test { + def blerg1(a: Any): Any = if (foo) blerg1(0) + def blerg2(a: Any): Any = if (t6504.foo) blerg2(0) +} diff --git a/test/files/pos/t5604b/Test_2.scala b/test/files/pos/t5604b/Test_2.scala new file mode 100644 index 0000000000..f7c58ebe83 --- /dev/null +++ b/test/files/pos/t5604b/Test_2.scala @@ -0,0 +1,7 @@ +// sandbox/t5604/Test.scala +package t6504 + +object Test { + def blerg1(a: Any): Any = if (foo) blerg1(0) + def blerg2(a: Any): Any = if (t6504.foo) blerg2(0) +} diff --git a/test/files/pos/t5604b/pack_1.scala b/test/files/pos/t5604b/pack_1.scala new file mode 100644 index 0000000000..f50d568bfa --- /dev/null +++ b/test/files/pos/t5604b/pack_1.scala @@ -0,0 +1,5 @@ +// sandbox/t5604/pack.scala +package t6504 + +object `package` extends T { +} diff --git a/test/pending/pos/t5606.scala b/test/files/pos/t5606.scala index 2545271e32..2545271e32 100644 --- a/test/pending/pos/t5606.scala +++ b/test/files/pos/t5606.scala diff --git a/test/pending/pos/t5639/Bar.scala b/test/files/pos/t5639/Bar.scala index f577500acd..f577500acd 100644 --- a/test/pending/pos/t5639/Bar.scala +++ b/test/files/pos/t5639/Bar.scala diff --git a/test/pending/pos/t5639/Foo.scala b/test/files/pos/t5639/Foo.scala index 6602150661..6602150661 100644 --- a/test/pending/pos/t5639/Foo.scala +++ b/test/files/pos/t5639/Foo.scala diff --git a/test/files/pos/t5809.scala b/test/files/pos/t5809.scala index 133e13c4ed..4bcd743faa 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) { def bar = ??? + def bippy = foo } -}
\ No newline at end of file +} diff --git a/test/files/pos/t5859.scala b/test/files/pos/t5859.scala new file mode 100644 index 0000000000..2a31e68ee5 --- /dev/null +++ b/test/files/pos/t5859.scala @@ -0,0 +1,15 @@ + +class A { + def f(xs: List[Int], ys: AnyRef*) = () + def f(xs: AnyRef*) = () + + f() + f(List[AnyRef](): _*) + f(List(): _*) + f(Nil: _*) + f(Array(): _*) + f(Array[AnyRef](): _*) + f(List(1)) + f(List(1), Nil: _*) + f(List(1), Array(): _*) +} diff --git a/test/files/pos/t6072.scala b/test/files/pos/t6072.scala new file mode 100644 index 0000000000..e25ebbffc5 --- /dev/null +++ b/test/files/pos/t6072.scala @@ -0,0 +1,3 @@ +class A { + object B { def eq(lvl: Int) = ??? } +} 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/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/t6482.scala b/test/files/pos/t6482.scala new file mode 100644 index 0000000000..24ea38e519 --- /dev/null +++ b/test/files/pos/t6482.scala @@ -0,0 +1,11 @@ +final class TraversableOnceOps[+A](val collection: TraversableOnce[A]) extends AnyVal { + def reduceLeftOption[B >: A](op: (B, A) => B): Option[B] = + if (collection.isEmpty) None else Some(collection.reduceLeft[B](op)) +} +// error: type arguments [B] do not conform to method reduceLeft's type parameter bounds [B >: A] +// if (collection.isEmpty) None else Some(collection.reduceLeft[B](op)) +// ^ + +class Foo[+A <: AnyRef](val xs: List[A]) extends AnyVal { + def baz[B >: A](x: B): List[B] = x :: xs +} 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/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/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/presentation/ide-bug-1000531.check b/test/files/presentation/ide-bug-1000531.check index 4be98a6b21..6c3892d272 100644 --- a/test/files/presentation/ide-bug-1000531.check +++ b/test/files/presentation/ide-bug-1000531.check @@ -19,7 +19,7 @@ retrieved 126 members [accessible: true] `method addString(b: StringBuilder)StringBuilder` [accessible: true] `method addString(b: StringBuilder, sep: String)StringBuilder` [accessible: true] `method addString(b: StringBuilder, start: String, sep: String, end: String)StringBuilder` -[accessible: true] `method aggregate[B](z: B)(seqop: (B, B) => B, combop: (B, B) => B)B` +[accessible: true] `method aggregate[B](z: => B)(seqop: (B, B) => B, combop: (B, B) => B)B` [accessible: true] `method asInstanceOf[T0]=> T0` [accessible: true] `method buffered=> scala.collection.BufferedIterator[B]` [accessible: true] `method collectFirst[B](pf: PartialFunction[B,B])Option[B]` diff --git a/test/files/run/collection-stacks.check b/test/files/run/collection-stacks.check new file mode 100644 index 0000000000..aa25cd1fa6 --- /dev/null +++ b/test/files/run/collection-stacks.check @@ -0,0 +1,14 @@ +3-2-1: true +3-2-1: true +apply +3: true +3: true +1: true +1: true +top +3: true +3: true +pop +2-1: true +3: true +2-1: true diff --git a/test/files/run/collection-stacks.scala b/test/files/run/collection-stacks.scala new file mode 100644 index 0000000000..be9fbbf1ae --- /dev/null +++ b/test/files/run/collection-stacks.scala @@ -0,0 +1,38 @@ +import scala.collection.{ immutable, mutable } + +object Test extends App { + def mutableStack[T](xs: T*): mutable.Stack[T] = { + val s = new mutable.Stack[T] + s.pushAll(xs) + s + } + + def immutableStack[T](xs: T*): immutable.Stack[T] = { + immutable.Stack.empty[T] pushAll xs + } + + def check[T](expected: T, got: T) { + println(got + ": " + (expected == got)) + } + + // check #957 + check("3-2-1", immutableStack(1, 2, 3).iterator.mkString("-")) + check("3-2-1", mutableStack(1, 2, 3).iterator.mkString("-")) + + println("apply") + check(3, immutableStack(1, 2, 3).apply(0)) + check(3, mutableStack(1, 2, 3).apply(0)) + check(1, immutableStack(1, 2, 3).apply(2)) + check(1, mutableStack(1, 2, 3).apply(2)) + + println("top") + check(3, immutableStack(1, 2, 3).top) + check(3, mutableStack(1, 2, 3).top) + + println("pop") + check("2-1", immutableStack(1, 2, 3).pop.mkString("-")) + check(3, mutableStack(1, 2, 3).pop()) + check("2-1", { val s = mutableStack(1, 2, 3); s.pop(); s.toList.mkString("-") }) +} + +// vim: set ts=2 sw=2 et: diff --git a/test/files/run/compiler-asSeenFrom.scala b/test/files/run/compiler-asSeenFrom.scala index 19feb45101..0d4b504d3c 100644 --- a/test/files/run/compiler-asSeenFrom.scala +++ b/test/files/run/compiler-asSeenFrom.scala @@ -47,10 +47,10 @@ package ll { for (p <- typeRefPrefixes ; c <- classes filter (isPossibleEnclosure(p.typeSymbol, _)) ; a <- targs) yield typeRef(p, c, List(a)) ) - + val wfmt = "%-" + 25 + "s" def to_s(x: Any): String = wfmt.format(x.toString.replaceAll("""\bll\.""", "")) - + def fmt(args: Any*): String = { (args map to_s mkString " ").replaceAll("""\s+$""", "") } @@ -61,7 +61,7 @@ package ll { } def permuteAsSeenFrom(targs: List[Type]) = ( - for { + for { tp <- typeRefs(targs filterNot (_ eq NoType)) prefix <- asSeenPrefixes if tp.prefix != prefix @@ -72,11 +72,11 @@ package ll { } yield ((site, tp, prefix, seen)) ) - + def block(label: Any)(lines: List[String]): List[String] = { val first = "" + label + " {" val last = "}" - + first +: lines.map(" " + _) :+ last } @@ -84,7 +84,7 @@ package ll { permuteAsSeenFrom(targs).groupBy(_._1).toList.sortBy(_._1.toString) flatMap { case (site, xs) => block(fmt(site)) { - fmt("type", "seen from prefix", "is") :: + fmt("type", "seen from prefix", "is") :: fmt("----", "----------------", "--") :: { xs.groupBy(_._2).toList.sortBy(_._1.toString) flatMap { case (tp, ys) => @@ -95,7 +95,7 @@ package ll { } } } - + def pretty(xs: List[_]) = if (xs.isEmpty) "" else xs.mkString("\n ", "\n ", "\n") def signaturesIn(info: Type): List[String] = ( @@ -103,11 +103,11 @@ package ll { filterNot (s => s.isType || s.owner == ObjectClass || s.owner == AnyClass || s.isConstructor) map (_.defString) ) - + def check(source: String, unit: global.CompilationUnit) = { import syms._ - afterTyper { + exitingTyper { val typeArgs = List[Type](IntClass.tpe, ListClass[Int]) ++ tparams.map(_.tpe) permute(typeArgs) foreach println } diff --git a/test/files/run/constant-type.check b/test/files/run/constant-type.check index dfd8be5297..4eededb8ba 100644 --- a/test/files/run/constant-type.check +++ b/test/files/run/constant-type.check @@ -13,16 +13,16 @@ scala> :power scala> val s = transformedType(StringClass.toType).asInstanceOf[Type] s: $r.intp.global.Type = String -scala> { println(afterPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))) } +scala> { println(exitingPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))) } Class[String](classOf[java.lang.String]) -scala> { afterPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))) } +scala> { exitingPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))) } Class(classOf[java.lang.String]) -scala> { ConstantType(Constant(s)); println(afterPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))); } +scala> { ConstantType(Constant(s)); println(exitingPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))); } Class[String](classOf[java.lang.String]) -scala> { ConstantType(Constant(s)); afterPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))); } +scala> { ConstantType(Constant(s)); exitingPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))); } Class(classOf[java.lang.String]) scala> diff --git a/test/files/run/constant-type.scala b/test/files/run/constant-type.scala index 84539e2895..373746af4a 100644 --- a/test/files/run/constant-type.scala +++ b/test/files/run/constant-type.scala @@ -9,9 +9,9 @@ object Test extends ReplTest { def code = """ :power val s = transformedType(StringClass.toType).asInstanceOf[Type] -{ println(afterPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))) } -{ afterPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))) } -{ ConstantType(Constant(s)); println(afterPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))); } -{ ConstantType(Constant(s)); afterPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))); } +{ println(exitingPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))) } +{ exitingPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))) } +{ ConstantType(Constant(s)); println(exitingPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))); } +{ ConstantType(Constant(s)); exitingPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))); } """ } diff --git a/test/files/run/deeps.check b/test/files/run/deeps.check new file mode 100644 index 0000000000..a68e474f62 --- /dev/null +++ b/test/files/run/deeps.check @@ -0,0 +1,87 @@ +testEquals1 +false +false +true + +testEquals2 +false +false +true + +testEquals3 +x=Array(1) +y=Array(1) +false +false +true + +x=Array(Array(1), Array(1)) +y=Array(Array(1), Array(1)) +false +false +true + +x=Array(Array(Array(1), Array(1)), Array(Array(1), Array(1))) +y=Array(Array(Array(1), Array(1)), Array(Array(1), Array(1))) +false +false +true + +testEquals4 +false +false +true +false +false +true +Array(true, false) +Array(true, false) +[true;false] +true;false + +Array(Array(true, false), Array(true, false)) +Array(Array(true, false), Array(true, false)) +[Array(true, false);Array(true, false)] +Array(true, false);Array(true, false) + +Array(Array(Array(true, false), Array(true, false)), Array(Array(true, false), Array(true, false))) +Array(Array(Array(true, false), Array(true, false)), Array(Array(true, false), Array(true, false))) +[Array(Array(true, false), Array(true, false));Array(Array(true, false), Array(true, false))] +Array(Array(true, false), Array(true, false));Array(Array(true, false), Array(true, false)) + +Array(1.0, 0.0) +Array(1.0, 0.0) +[1.0;0.0] +1.0;0.0 + +Array(Array(1.0, 0.0), Array(1.0, 0.0)) +Array(Array(1.0, 0.0), Array(1.0, 0.0)) +[Array(1.0, 0.0);Array(1.0, 0.0)] +Array(1.0, 0.0);Array(1.0, 0.0) + +Array(Array(Array(1.0, 0.0), Array(1.0, 0.0)), Array(Array(1.0, 0.0), Array(1.0, 0.0))) +Array(Array(Array(1.0, 0.0), Array(1.0, 0.0)), Array(Array(1.0, 0.0), Array(1.0, 0.0))) +[Array(Array(1.0, 0.0), Array(1.0, 0.0));Array(Array(1.0, 0.0), Array(1.0, 0.0))] +Array(Array(1.0, 0.0), Array(1.0, 0.0));Array(Array(1.0, 0.0), Array(1.0, 0.0)) + +Array(a, b) +Array(a, b) +[a;b] +a;b + +Array(Array(a, b), Array(a, b)) +Array(Array(a, b), Array(a, b)) +[Array(a, b);Array(a, b)] +Array(a, b);Array(a, b) + +Array(Array(Array(a, b), Array(a, b)), Array(Array(a, b), Array(a, b))) +Array(Array(Array(a, b), Array(a, b)), Array(Array(a, b), Array(a, b))) +[Array(Array(a, b), Array(a, b));Array(Array(a, b), Array(a, b))] +Array(Array(a, b), Array(a, b));Array(Array(a, b), Array(a, b)) + +[Array(true, false); Array(false)] +[Array(1, 2); Array(3)] +[Array(1, 2); Array(3)] + +Array(boo, and, foo) +Array(a) diff --git a/test/files/run/deeps.scala b/test/files/run/deeps.scala new file mode 100644 index 0000000000..6049cc6024 --- /dev/null +++ b/test/files/run/deeps.scala @@ -0,0 +1,114 @@ +//############################################################################ +// deepEquals / deep.toString +//############################################################################ + +//############################################################################ +// need to revisit array equqality +object Test { + + def testEquals1 { + println(Array(1) == Array(1)) + println(Array(1) equals Array(1)) + println(Array(1).deep == Array(1).deep) + println + } + + def testEquals2 { + println(Array(Array(1), Array(2)) == Array(Array(1), Array(2))) + println(Array(Array(1), Array(2)) equals Array(Array(1), Array(2))) + println(Array(Array(1), Array(2)).deep equals Array(Array(1), Array(2)).deep) + println + } + + def testEquals3 { + val a1 = Array(1) + val b1 = Array(1) + val a2 = Array(a1, b1) + val b2 = Array(a1, b1) + val a3 = Array(a2, b2) + val b3 = Array(a2, b2) + def test[T](x: Array[T], y: Array[T]) { + println("x=" + x.deep.toString) + println("y=" + y.deep.toString) + println(x == y) + println(x equals y) + println(x.deep == y.deep) + println + } + test(a1, b1) + test(a2, b2) + test(a3, b3) + } + + def testEquals4 { + println("boo:and:foo".split(':') == "boo:and:foo".split(':')) + println("boo:and:foo".split(':') equals "boo:and:foo".split(':')) + println("boo:and:foo".split(':').deep == "boo:and:foo".split(':').deep) + + val xs = new java.util.ArrayList[String](); xs.add("a") + val ys = new java.util.ArrayList[String](); ys.add("a") + println(xs.toArray == ys.toArray) + println(xs.toArray equals ys.toArray) + println(xs.toArray.deep == ys.toArray.deep) + } + + def testToString1 { + def sweep(s: String) = ( + s.replaceAll("D@[0-9a-fA-F]+", "D@0000000") + .replaceAll("Z@[0-9a-fA-F]+", "Z@0000000") + .replaceAll(";@[0-9a-fA-F]+", ";@0000000") + ) + def test[T](a: Array[T]) { + println(sweep(a.deep.toString)) + println(a.deep.toString) + println(a.deep.mkString("[", ";", "]")) + println(a.deep.mkString(";")) + println + } + + val ba1 = Array(true, false) + val ba2 = Array(ba1, ba1) + val ba3 = Array(ba2, ba2) + test(ba1) + test(ba2) + test(ba3) + + val da1 = Array(1.0d, 0.0d) + val da2 = Array(da1, da1) + val da3 = Array(da2, da2) + test(da1) + test(da2) + test(da3) + + val sa1 = Array("a", "b") + val sa2 = Array(sa1, sa1) + val sa3 = Array(sa2, sa2) + test(sa1) + test(sa2) + test(sa3) + } + + def testToString2 { + println(Array(Array(true, false), Array(false)).deep.mkString("[", "; ", "]")) + println(Array(Array('1', '2'), Array('3')).deep.mkString("[", "; ", "]")) + println(Array(Array(1, 2), Array(3)).deep.mkString("[", "; ", "]")) + println + } + + def testToString3 { + println("boo:and:foo".split(':').deep.toString) + + val xs = new java.util.ArrayList[String](); xs.add("a") + println(xs.toArray.deep.toString) + } + + def main(args: Array[String]): Unit = { + println("testEquals1") ; testEquals1 + println("testEquals2") ; testEquals2 + println("testEquals3") ; testEquals3 + println("testEquals4") ; testEquals4 + testToString1 + testToString2 + testToString3 + } +} diff --git a/test/files/run/existentials-in-compiler.scala b/test/files/run/existentials-in-compiler.scala index c69d1217fd..14c25849cb 100644 --- a/test/files/run/existentials-in-compiler.scala +++ b/test/files/run/existentials-in-compiler.scala @@ -73,7 +73,7 @@ package extest { def check(source: String, unit: global.CompilationUnit) = { getRequiredPackage("extest").moduleClass.info.decls.toList.filter(_.isType).map(_.initialize).sortBy(_.name.toString) foreach { clazz => - afterTyper { + exitingTyper { clazz.info println(clazz.defString) println(" " + classExistentialType(clazz) + "\n") diff --git a/test/files/run/lub-visibility.check b/test/files/run/lub-visibility.check index 3461d1bf6b..f3a6bef215 100644 --- a/test/files/run/lub-visibility.check +++ b/test/files/run/lub-visibility.check @@ -8,7 +8,7 @@ scala> // should infer List[scala.collection.immutable.Seq[Nothing]] scala> // but reverted that for SI-5534. scala> val x = List(List(), Vector()) -x: List[scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq{def dropRight(n: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]; def takeRight(n: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]; def drop(n: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]; def take(n: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]; def slice(from: Int,until: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]}]; def dropRight(n: Int): scala.collection.immutable.Seq[Nothing] with scala.collection.Ab... +x: List[scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing]{def dropRight(n: Int): scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing]; def takeRight(n: Int): scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing]; def drop(n: Int): scala.collecti... scala> scala> diff --git a/test/files/run/parserJavaIdent.check b/test/files/run/parserJavaIdent.check new file mode 100644 index 0000000000..597ddbee47 --- /dev/null +++ b/test/files/run/parserJavaIdent.check @@ -0,0 +1,26 @@ +[1.7] parsed: simple +[1.8] parsed: with123 +[1.6] parsed: with$ +[1.10] parsed: withøßöèæ +[1.6] parsed: with_ +[1.6] parsed: _with +[1.1] failure: java identifier expected + +3start +^ +[1.1] failure: java identifier expected + +-start +^ +[1.5] failure: java identifier expected + +with-s + ^ +[1.3] failure: java identifier expected + +we♥scala + ^ +[1.6] failure: java identifier expected + +with space + ^ diff --git a/test/files/run/parserJavaIdent.scala b/test/files/run/parserJavaIdent.scala new file mode 100644 index 0000000000..c068075e4e --- /dev/null +++ b/test/files/run/parserJavaIdent.scala @@ -0,0 +1,26 @@ +object Test extends scala.util.parsing.combinator.JavaTokenParsers { + + def test[A](s: String) { + val res = parseAll(ident, s) match { + case Failure(_, in) => Failure("java identifier expected", in) + case o => o + } + println(res) + } + + def main(args: Array[String]) { + // Happy tests + test("simple") + test("with123") + test("with$") + test("withøßöèæ") + test("with_") + test("_with") + // Sad tests + test("3start") + test("-start") + test("with-s") + test("we♥scala") + test("with space") + } +} diff --git a/test/pending/run/reify_implicits-new.check b/test/files/run/reify_implicits-new.check index e3aeb20f6b..e3aeb20f6b 100644 --- a/test/pending/run/reify_implicits-new.check +++ b/test/files/run/reify_implicits-new.check diff --git a/test/pending/run/reify_implicits-new.scala b/test/files/run/reify_implicits-new.scala index 42a1deef26..42a1deef26 100644 --- a/test/pending/run/reify_implicits-new.scala +++ b/test/files/run/reify_implicits-new.scala diff --git a/test/pending/run/reify_implicits-old.check b/test/files/run/reify_implicits-old.check index e3aeb20f6b..e3aeb20f6b 100644 --- a/test/pending/run/reify_implicits-old.check +++ b/test/files/run/reify_implicits-old.check diff --git a/test/pending/run/reify_implicits-old.scala b/test/files/run/reify_implicits-old.scala index 8ff256d2d4..8ff256d2d4 100644 --- a/test/pending/run/reify_implicits-old.scala +++ b/test/files/run/reify_implicits-old.scala diff --git a/test/files/run/reify_newimpl_11.check b/test/files/run/reify_newimpl_11.check index 2f5cb581e6..c019c6db2d 100644 --- a/test/files/run/reify_newimpl_11.check +++ b/test/files/run/reify_newimpl_11.check @@ -1,2 +1,4 @@ -scala.tools.reflect.ToolBoxError: reflective toolbox has failed: -unresolved free type variables (namely: T defined by C in reify_newimpl_11.scala:6:11). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types +scala.tools.reflect.ToolBoxError: reflective toolbox failed due to unresolved free type variables: + T defined by C in reify_newimpl_11.scala:6:11 +have you forgotten to use TypeTag annotations for type parameters external to a reifee? +if you have troubles tracking free type variables, consider using -Xlog-free-types diff --git a/test/files/run/reify_newimpl_13.check b/test/files/run/reify_newimpl_13.check index d518cd7b84..13e3c9af1e 100644 --- a/test/files/run/reify_newimpl_13.check +++ b/test/files/run/reify_newimpl_13.check @@ -1,2 +1,4 @@ -scala.tools.reflect.ToolBoxError: reflective toolbox has failed: -unresolved free type variables (namely: T defined by C in reify_newimpl_13.scala:7:13). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types +scala.tools.reflect.ToolBoxError: reflective toolbox failed due to unresolved free type variables: + T defined by C in reify_newimpl_13.scala:7:13 +have you forgotten to use TypeTag annotations for type parameters external to a reifee? +if you have troubles tracking free type variables, consider using -Xlog-free-types diff --git a/test/files/run/reify_newimpl_19.check b/test/files/run/reify_newimpl_19.check index 8b8652f92c..c749d4f106 100644 --- a/test/files/run/reify_newimpl_19.check +++ b/test/files/run/reify_newimpl_19.check @@ -1,2 +1,4 @@ -scala.tools.reflect.ToolBoxError: reflective toolbox has failed: -unresolved free type variables (namely: T defined by C in reify_newimpl_19.scala:7:10). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types +scala.tools.reflect.ToolBoxError: reflective toolbox failed due to unresolved free type variables: + T defined by C in reify_newimpl_19.scala:7:10 +have you forgotten to use TypeTag annotations for type parameters external to a reifee? +if you have troubles tracking free type variables, consider using -Xlog-free-types diff --git a/test/files/run/repl-colon-type.check b/test/files/run/repl-colon-type.check index 35cd04ba87..7716221f54 100644 --- a/test/files/run/repl-colon-type.check +++ b/test/files/run/repl-colon-type.check @@ -14,7 +14,6 @@ scala> :type List[1, 2, 3] List[1, 2, 3] ^ - scala> :type List(1, 2, 3) List[Int] @@ -52,10 +51,9 @@ scala> :type protected lazy val f = 5 Access to protected value f not permitted because enclosing object $eval in package $line19 is not a subclass of object $iw where target is defined - lazy val $result = `f` + lazy val $result = f ^ - scala> :type def f = 5 => Int diff --git a/test/files/run/repl-out-dir.check b/test/files/run/repl-out-dir.check new file mode 100644 index 0000000000..a96f9ba9d9 --- /dev/null +++ b/test/files/run/repl-out-dir.check @@ -0,0 +1,53 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> case class Bippy(x: Int) +defined class Bippy + +scala> val x = Bippy(1) +x: Bippy = Bippy(1) + +scala> $intp.showDirectory +repl-out-dir-run.obj + $line1 + $eval$.class + $eval.class + $line2 + $eval$.class + $eval.class + $read$$iw$$iw$.class + $read$$iw$.class + $read$.class + $read.class + $line3 + $eval$.class + $eval.class + $read$$iw$$iw$.class + $read$$iw$$iw$Bippy$.class + $read$$iw$$iw$Bippy.class + $read$$iw$.class + $read$.class + $read.class + $line4 + $eval$.class + $eval.class + $read$$iw$$iw$.class + $read$$iw$.class + $read$.class + $read.class + $line5 + $eval$.class + $eval.class + $read$$iw$$iw$.class + $read$$iw$.class + $read$.class + $read.class + $repl_$init.class + Test$.class + Test.class + +scala> + +scala> diff --git a/test/files/run/repl-out-dir.scala b/test/files/run/repl-out-dir.scala new file mode 100644 index 0000000000..33c823aa2d --- /dev/null +++ b/test/files/run/repl-out-dir.scala @@ -0,0 +1,13 @@ +import scala.tools.partest.ReplTest +import scala.tools.nsc.Settings + +object Test extends ReplTest { + override def extraSettings = s"-Yrepl-outdir ${testOutput.path}" + + def code = s""" +case class Bippy(x: Int) +val x = Bippy(1) +$$intp.showDirectory + """ + +} diff --git a/test/files/run/search.check b/test/files/run/search.check new file mode 100644 index 0000000000..a885696509 --- /dev/null +++ b/test/files/run/search.check @@ -0,0 +1,6 @@ +Found(2) +Found(4) +InsertionPoint(9) +Found(2) +Found(4) +InsertionPoint(9) diff --git a/test/files/run/search.scala b/test/files/run/search.scala new file mode 100644 index 0000000000..ed7fed54a7 --- /dev/null +++ b/test/files/run/search.scala @@ -0,0 +1,14 @@ +object Test extends App { + import scala.collection.{LinearSeq, IndexedSeq} + import scala.collection.Searching.search + + val ls = LinearSeq(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13) + println(ls.search(3)) + println(ls.search(5, 3, 8)) + println(ls.search(12)) + + val is = IndexedSeq(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13) + println(is.search(3)) + println(is.search(5, 3, 8)) + println(is.search(12)) +} diff --git a/test/files/run/settings-parse.check b/test/files/run/settings-parse.check new file mode 100644 index 0000000000..18145c9100 --- /dev/null +++ b/test/files/run/settings-parse.check @@ -0,0 +1,566 @@ +0) List(-cp, ) ==> Settings { + -d = . + -classpath = "" +} + +1) List(-cp, , ) ==> Settings { + -d = . + -classpath = "" +} + +2) List(, -cp, ) ==> Settings { + -d = . + -classpath = "" +} + +3) List(-cp, , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +4) List(-cp, , , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +5) List(-cp, , -deprecation, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +6) List(, -cp, , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +7) List(-cp, , -deprecation, foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +8) List(-cp, , , -deprecation, foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +9) List(-cp, , -deprecation, , foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +10) List(-cp, , -deprecation, foo.scala, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +11) List(, -cp, , -deprecation, foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +12) List(-cp, , foo.scala) ==> Settings { + -d = . + -classpath = "" +} + +13) List(-cp, , , foo.scala) ==> Settings { + -d = . + -classpath = "" +} + +14) List(-cp, , foo.scala, ) ==> Settings { + -d = . + -classpath = "" +} + +15) List(, -cp, , foo.scala) ==> Settings { + -d = . + -classpath = "" +} + +16) List(-cp, , foo.scala, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +17) List(-cp, , , foo.scala, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +18) List(-cp, , foo.scala, , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +19) List(-cp, , foo.scala, -deprecation, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +20) List(, -cp, , foo.scala, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +21) List(-deprecation, -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +22) List(, -deprecation, -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +23) List(-deprecation, -cp, , ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +24) List(-deprecation, , -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +25) List(-deprecation, -cp, , foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +26) List(, -deprecation, -cp, , foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +27) List(-deprecation, -cp, , , foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +28) List(-deprecation, -cp, , foo.scala, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +29) List(-deprecation, , -cp, , foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +30) List(-deprecation, foo.scala, -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +31) List(, -deprecation, foo.scala, -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +32) List(-deprecation, , foo.scala, -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +33) List(-deprecation, foo.scala, -cp, , ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +34) List(-deprecation, foo.scala, , -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +35) List(foo.scala, -cp, ) ==> Settings { + -d = . + -classpath = "" +} + +36) List(, foo.scala, -cp, ) ==> Settings { + -d = . + -classpath = "" +} + +37) List(foo.scala, -cp, , ) ==> Settings { + -d = . + -classpath = "" +} + +38) List(foo.scala, , -cp, ) ==> Settings { + -d = . + -classpath = "" +} + +39) List(foo.scala, -cp, , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +40) List(, foo.scala, -cp, , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +41) List(foo.scala, -cp, , , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +42) List(foo.scala, -cp, , -deprecation, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +43) List(foo.scala, , -cp, , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +44) List(foo.scala, -deprecation, -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +45) List(, foo.scala, -deprecation, -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +46) List(foo.scala, , -deprecation, -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +47) List(foo.scala, -deprecation, -cp, , ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +48) List(foo.scala, -deprecation, , -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +0) List(-cp, /tmp:/bippy) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +1) List(-cp, /tmp:/bippy, ) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +2) List(, -cp, /tmp:/bippy) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +3) List(-cp, /tmp:/bippy, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +4) List(-cp, /tmp:/bippy, , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +5) List(-cp, /tmp:/bippy, -deprecation, ) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +6) List(, -cp, /tmp:/bippy, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +7) List(-cp, /tmp:/bippy, -deprecation, foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +8) List(-cp, /tmp:/bippy, , -deprecation, foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +9) List(-cp, /tmp:/bippy, -deprecation, , foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +10) List(-cp, /tmp:/bippy, -deprecation, foo.scala, ) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +11) List(, -cp, /tmp:/bippy, -deprecation, foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +12) List(-cp, /tmp:/bippy, foo.scala) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +13) List(-cp, /tmp:/bippy, , foo.scala) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +14) List(-cp, /tmp:/bippy, foo.scala, ) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +15) List(, -cp, /tmp:/bippy, foo.scala) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +16) List(-cp, /tmp:/bippy, foo.scala, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +17) List(-cp, /tmp:/bippy, , foo.scala, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +18) List(-cp, /tmp:/bippy, foo.scala, , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +19) List(-cp, /tmp:/bippy, foo.scala, -deprecation, ) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +20) List(, -cp, /tmp:/bippy, foo.scala, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +21) List(-deprecation, -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +22) List(, -deprecation, -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +23) List(-deprecation, -cp, /tmp:/bippy, ) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +24) List(-deprecation, , -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +25) List(-deprecation, -cp, /tmp:/bippy, foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +26) List(, -deprecation, -cp, /tmp:/bippy, foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +27) List(-deprecation, -cp, /tmp:/bippy, , foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +28) List(-deprecation, -cp, /tmp:/bippy, foo.scala, ) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +29) List(-deprecation, , -cp, /tmp:/bippy, foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +30) List(-deprecation, foo.scala, -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +31) List(, -deprecation, foo.scala, -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +32) List(-deprecation, , foo.scala, -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +33) List(-deprecation, foo.scala, -cp, /tmp:/bippy, ) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +34) List(-deprecation, foo.scala, , -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +35) List(foo.scala, -cp, /tmp:/bippy) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +36) List(, foo.scala, -cp, /tmp:/bippy) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +37) List(foo.scala, -cp, /tmp:/bippy, ) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +38) List(foo.scala, , -cp, /tmp:/bippy) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +39) List(foo.scala, -cp, /tmp:/bippy, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +40) List(, foo.scala, -cp, /tmp:/bippy, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +41) List(foo.scala, -cp, /tmp:/bippy, , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +42) List(foo.scala, -cp, /tmp:/bippy, -deprecation, ) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +43) List(foo.scala, , -cp, /tmp:/bippy, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +44) List(foo.scala, -deprecation, -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +45) List(, foo.scala, -deprecation, -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +46) List(foo.scala, , -deprecation, -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +47) List(foo.scala, -deprecation, -cp, /tmp:/bippy, ) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +48) List(foo.scala, -deprecation, , -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + diff --git a/test/files/run/settings-parse.scala b/test/files/run/settings-parse.scala new file mode 100644 index 0000000000..2b04f55b24 --- /dev/null +++ b/test/files/run/settings-parse.scala @@ -0,0 +1,27 @@ +import scala.tools.nsc._ + +object Test { + val tokens = List("", "-deprecation", "foo.scala") + val subsets = tokens.toSet.subsets.toList + val permutations0 = subsets.flatMap(_.toList.permutations).distinct + + def runWithCp(cp: String) = { + val permutations = permutations0 flatMap ("-cp CPTOKEN" :: _ permutations) + + for ((p, i) <- permutations.distinct.sortBy(_ mkString "").zipWithIndex) { + val args = p flatMap (_ split "\\s+") map (x => if (x == "CPTOKEN") cp else x) + val s = new settings.MutableSettings(println) + val (ok, residual) = s.processArguments(args, processAll = true) + + val expected = args filter (_ == "foo.scala") + assert(residual == expected, residual) + assert(ok, args) + println(s"$i) $args ==> $s") + } + } + + def main(args0: Array[String]): Unit = { + runWithCp("") + runWithCp("/tmp:/bippy") + } +} diff --git a/test/files/run/shortClass.check b/test/files/run/shortClass.check new file mode 100644 index 0000000000..fbdb725cca --- /dev/null +++ b/test/files/run/shortClass.check @@ -0,0 +1,10 @@ +bippity.bop.Foo +bippity.bop.Foo$Bar +bippity.bop.Foo$Bar$ +Test$$anon$1 +Test$$anon$2 +Foo +Bar +Bar$ +Foo with DingDongBippy +Bar with DingDongBippy diff --git a/test/files/run/shortClass.scala b/test/files/run/shortClass.scala new file mode 100644 index 0000000000..b7bb016896 --- /dev/null +++ b/test/files/run/shortClass.scala @@ -0,0 +1,24 @@ +import scala.reflect.internal.util._ + +package bippity { + trait DingDongBippy + + package bop { + class Foo { + class Bar + object Bar + } + } +} + +object Test { + import bippity._ + import bop._ + + def main(args: Array[String]): Unit = { + val f = new Foo + val instances = List(f, new f.Bar, f.Bar, new Foo with DingDongBippy, new f.Bar with DingDongBippy) + instances map (_.getClass.getName) foreach println + instances map shortClassOfInstance foreach println + } +} diff --git a/test/files/run/streams.check b/test/files/run/streams.check index 7f894052d9..032057d4a1 100644 --- a/test/files/run/streams.check +++ b/test/files/run/streams.check @@ -23,3 +23,4 @@ Stream(100001, ?) true true 705082704 +6 diff --git a/test/files/run/streams.scala b/test/files/run/streams.scala index 51b4e5d76c..dc5d0204ac 100644 --- a/test/files/run/streams.scala +++ b/test/files/run/streams.scala @@ -29,7 +29,7 @@ object Test extends App { def powers(x: Int) = if ((x&(x-1)) == 0) Some(x) else None println(s3.flatMap(powers).reverse.head) - // large enough to generate StackOverflows (on most systems) + // large enough to generate StackOverflows (on most systems) // unless the following methods are tail call optimized. val size = 100000 @@ -43,4 +43,7 @@ object Test extends App { println(Stream.from(1).take(size).foldLeft(0)(_ + _)) val arr = new Array[Int](size) Stream.from(1).take(size).copyToArray(arr, 0) + + // dropRight terminates + println(Stream from 1 dropRight 1000 take 3 sum) } diff --git a/test/files/run/t1500.scala b/test/files/run/t1500.scala index ab132b724f..6d2e7ee05f 100644 --- a/test/files/run/t1500.scala +++ b/test/files/run/t1500.scala @@ -21,7 +21,7 @@ object Test { val settings = new Settings() settings.classpath.value = System.getProperty("java.class.path") val tool = new interpreter.IMain(settings) - val global = tool.compiler + val global = tool.global import global._ import definitions._ diff --git a/test/files/run/t1501.scala b/test/files/run/t1501.scala index aba206bc7a..a2f7bb3a65 100644 --- a/test/files/run/t1501.scala +++ b/test/files/run/t1501.scala @@ -31,7 +31,7 @@ object Test { val settings = new Settings() settings.classpath.value = System.getProperty("java.class.path") val tool = new interpreter.IMain(settings) - val global = tool.compiler + val global = tool.global import global._ import definitions._ diff --git a/test/files/run/t2251.check b/test/files/run/t2251.check new file mode 100644 index 0000000000..55ad2a5857 --- /dev/null +++ b/test/files/run/t2251.check @@ -0,0 +1 @@ +Set(List(List(C), Stream(D, ?))) diff --git a/test/files/run/t2251.scala b/test/files/run/t2251.scala new file mode 100644 index 0000000000..00c5619b49 --- /dev/null +++ b/test/files/run/t2251.scala @@ -0,0 +1,19 @@ +class A +trait B[T <: B[T]] extends A +class C extends B[C] { override def toString = "C" } +class D extends B[D] { override def toString = "D" } + +class E { + val ys = List(List(new C), Stream(new D)) +} + +object Test { + def trav = List(List(), Stream()) + + def main(args: Array[String]): Unit = { + val f = (new E).ys _ + var xs: Set[List[_ <: Seq[B[_]]]] = Set() + xs += f() + println(xs) + } +} diff --git a/test/files/run/t2251b.check b/test/files/run/t2251b.check new file mode 100644 index 0000000000..42b0be457a --- /dev/null +++ b/test/files/run/t2251b.check @@ -0,0 +1,11 @@ +TypeTag[List[scala.collection.immutable.LinearSeq[B[_ >: D with C <: B[_ >: D with C <: A]]] with scala.collection.AbstractSeq[B[_ >: D with C <: B[_ >: D with C <: A]]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.LinearSeq with scala.collection.AbstractSeq]; def reverse: scala.collection.immutable.LinearSeq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.LinearSeq with scala.collection.AbstractSeq]; def reverse: scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def dropRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]}; def dropRight(n: Int): scala.collection.immutable.LinearSeq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.LinearSeq with scala.collection.AbstractSeq]; def reverse: scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def dropRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]}; def takeRight(n: Int): scala.collection.immutable.LinearSeq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.LinearSeq with scala.collection.AbstractSeq]; def reverse: scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def dropRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]}; def drop(n: Int): scala.collection.immutable.LinearSeq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.LinearSeq with scala.collection.AbstractSeq]; def reverse: scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def dropRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]}; def take(n: Int): scala.collection.immutable.LinearSeq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.LinearSeq with scala.collection.AbstractSeq]; def reverse: scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def dropRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]}; def slice(from: Int,until: Int): scala.collection.immutable.LinearSeq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.LinearSeq with scala.collection.AbstractSeq]; def reverse: scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def dropRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]}; def splitAt(n: Int): (scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A], scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A])}]] +TypeTag[List[scala.collection.immutable.Iterable[B[_ >: F with E with D with C <: B[_ >: F with E with D with C <: A]]] with F with Int => Any]] +TypeTag[List[scala.collection.immutable.Seq[B[_ >: D with C <: B[_ >: D with C <: A]]] with scala.collection.AbstractSeq[B[_ >: D with C <: B[_ >: D with C <: A]]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def init: scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]}; def takeRight(n: Int): scala.collection.immutable.Seq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def init: scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]}; def drop(n: Int): scala.collection.immutable.Seq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def init: scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]}; def take(n: Int): scala.collection.immutable.Seq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def init: scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]}; def slice(from: Int,until: Int): scala.collection.immutable.Seq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def init: scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]}; def splitAt(n: Int): (scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A], scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]); def init: scala.collection.immutable.Seq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def init: scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]}}]] +TypeTag[List[scala.collection.Set[_ >: G with F <: B[_ >: G with F <: B[_ >: G with F <: A]]]]] +TypeTag[List[scala.collection.Set[_ >: G with F <: B[_ >: G with F <: B[_ >: G with F <: A]]]]] +TypeTag[List[scala.collection.Set[_ >: G with F <: B[_ >: G with F <: B[_ >: G with F <: A]]]]] +TypeTag[List[Seq[B[_ >: G with F <: B[_ >: G with F <: A]]]]] +TypeTag[List[scala.collection.Map[_ >: F with C <: B[_ >: F with C <: B[_ >: F with C <: A]], B[_ >: G with D <: B[_ >: G with D <: A]]]]] +TypeTag[List[scala.collection.AbstractSeq[B[_ >: G with F <: B[_ >: G with F <: A]]] with scala.collection.LinearSeq[B[_ >: G with F <: B[_ >: G with F <: A]]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.AbstractSeq with scala.collection.LinearSeq]; def dropRight(n: Int): scala.collection.AbstractSeq[B[_ >: G with F <: A]] with scala.collection.LinearSeq[B[_ >: G with F <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.AbstractSeq with scala.collection.LinearSeq]; def dropRight(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def drop(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def take(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def slice(from: Int,until: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]}; def drop(n: Int): scala.collection.AbstractSeq[B[_ >: G with F <: A]] with scala.collection.LinearSeq[B[_ >: G with F <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.AbstractSeq with scala.collection.LinearSeq]; def dropRight(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def drop(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def take(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def slice(from: Int,until: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]}; def take(n: Int): scala.collection.AbstractSeq[B[_ >: G with F <: A]] with scala.collection.LinearSeq[B[_ >: G with F <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.AbstractSeq with scala.collection.LinearSeq]; def dropRight(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def drop(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def take(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def slice(from: Int,until: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]}; def slice(from: Int,until: Int): scala.collection.AbstractSeq[B[_ >: G with F <: A]] with scala.collection.LinearSeq[B[_ >: G with F <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.AbstractSeq with scala.collection.LinearSeq]; def dropRight(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def drop(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def take(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def slice(from: Int,until: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]}}]] +TypeTag[List[Seq[B[_ >: G with F <: B[_ >: G with F <: A]]]]] +TypeTag[List[Seq[B[_ >: G with F <: B[_ >: G with F <: A]]]]] diff --git a/test/files/run/t2251b.scala b/test/files/run/t2251b.scala new file mode 100644 index 0000000000..b67b3aec1e --- /dev/null +++ b/test/files/run/t2251b.scala @@ -0,0 +1,48 @@ +class A +trait B[T <: B[T]] extends A +class B1[T <: B1[T]] extends B[T] +class C extends B[C] { override def toString = "C" } +class D extends B[D] { override def toString = "D" } +class E extends B[E] { override def toString = "E" } +class F extends B[F] { override def toString = "F" } +class G extends B1[G] { override def toString = "G" } + +object Test { + import scala.collection.{ mutable, immutable } + import scala.collection.immutable.{ Vector } + import scala.reflect.runtime.universe._ + def what[T: TypeTag](x: T) = println(typeTag[T]) + + def main(args: Array[String]): Unit = { + what(List(List(new C), Stream(new D))) + what(List(List(new C), Stream(new D), Vector(new E), Set(new F))) + what(List(immutable.Vector(new C), Stream(new D))) + what(List(collection.Set(new F), mutable.Set(new G))) + what(List(collection.Set(new F), immutable.Set(new G))) + what(List(mutable.Set(new F), immutable.Set(new G))) + what(List(mutable.Seq(new F), immutable.Seq(new G))) + what(List(mutable.Map(new C -> new D), immutable.Map(new F -> new G))) + what(List(mutable.MutableList(new F), immutable.List(new G))) + what(List(mutable.Seq(new F), collection.Seq(new G))) + what(List(mutable.LinearSeq(new F), collection.IndexedSeq(new G))) + } +} + + +// class D extends B[D] { override def toString = "D" } + + +// class E { +// val ys = List(List(new C), Stream(new D)) +// } + +// object Test { +// def trav = List(List(), Stream()) + +// def main(args: Array[String]): Unit = { +// val f = (new E).ys _ +// var xs: Set[List[_ <: Seq[B[_]]]] = Set() +// xs += f() +// println(xs) +// } +// } diff --git a/test/pending/run/t2318.check b/test/files/run/t2318.check index a486f1ac47..a486f1ac47 100644 --- a/test/pending/run/t2318.check +++ b/test/files/run/t2318.check diff --git a/test/pending/run/t2318.scala b/test/files/run/t2318.scala index e42cbb9680..47d083eb9d 100644 --- a/test/pending/run/t2318.scala +++ b/test/files/run/t2318.scala @@ -7,7 +7,8 @@ object Test { override def checkPermission(perm: Permission) = perm match { case _: java.lang.RuntimePermission => () case _: java.io.FilePermission => () - case x: java.security.AccessControlException if x.getName contains ".networkaddress." => () // generality ftw + case x: java.security.SecurityPermission if x.getName contains ".networkaddress." => () // generality ftw + case x: java.util.PropertyPermission if x.getName == "sun.net.inetaddr.ttl" => () case _ => super.checkPermission(perm) } } diff --git a/test/files/run/t2418.check b/test/files/run/t2418.check new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/files/run/t2418.check @@ -0,0 +1 @@ +10 diff --git a/test/files/run/t2418.scala b/test/files/run/t2418.scala new file mode 100644 index 0000000000..f330bef60a --- /dev/null +++ b/test/files/run/t2418.scala @@ -0,0 +1,10 @@ +class Foo { + @volatile final var x=10 + override def toString = "" + x +} + +object Test { + def main(args: Array[String]): Unit = { + println((new Foo)) + } +} diff --git a/test/files/run/t2886.check b/test/files/run/t2886.check index ce31bc7408..cb0db8a6dc 100644 --- a/test/files/run/t2886.check +++ b/test/files/run/t2886.check @@ -1,5 +1,5 @@ ((x: String) => { - val x$1 = x; - val x$2 = x; + <artifact> val x$1 = x; + <artifact> val x$2 = x; Test.this.test(x$2, x$1) }) diff --git a/test/files/run/t3038d.scala b/test/files/run/t3038d.scala index 6cd2d83776..9550165235 100644 --- a/test/files/run/t3038d.scala +++ b/test/files/run/t3038d.scala @@ -16,9 +16,7 @@ trait Foo { } } - -@serializable -class Bar extends Foo { +class Bar extends Foo with Serializable { @transient protected var first: Any = null def size = a @transient var second: Any = null diff --git a/test/files/run/t3667.check b/test/files/run/t3667.check index bbe5d1bc48..6375c88997 100644 --- a/test/files/run/t3667.check +++ b/test/files/run/t3667.check @@ -1,6 +1,3 @@ -1 -2 -3 4 2 3 diff --git a/test/files/run/t3667.scala b/test/files/run/t3667.scala index f30d57ce3a..ada09d5886 100644 --- a/test/files/run/t3667.scala +++ b/test/files/run/t3667.scala @@ -1,27 +1,9 @@ object Test { def main(args: Array[String]) { - val o1 = new Outer1 - val o2 = new Outer2 - val o3 = new Outer3 val o4 = new Outer4 val o5 = new Outer5 val o6 = new Outer6 - println(1) - ser(new o1.Inner(1)) - o1.Inner // make sure the Inner$module field of the Outer1 instance is initialized! - ser(new o1.Inner(1)) - - println(2) - ser(new o2.Inner(1)) - o2.Inner - ser(new o2.Inner(1)) - - println(3) - ser(new o3.Inner(1)) - o3.Inner - ser(new o3.Inner(1)) - println(4) ser(new o4.Inner(1)) o4.Inner @@ -54,23 +36,6 @@ object Test { } -@serializable -class Outer1 { - @serializable - class Inner(x: Int = 1) -} - -@serializable -class Outer2 { - case class Inner(x: Int = 1) -} - -@serializable -class Outer3 { - case class Inner(x: Int) -} - - class Outer4 extends Serializable { class Inner(x: Int = 1) extends Serializable } diff --git a/test/pending/run/t3897.check b/test/files/run/t3897.check index 244b83716f..244b83716f 100644 --- a/test/pending/run/t3897.check +++ b/test/files/run/t3897.check diff --git a/test/pending/run/t3897/J_2.java b/test/files/run/t3897/J_2.java index 178412dc92..178412dc92 100644 --- a/test/pending/run/t3897/J_2.java +++ b/test/files/run/t3897/J_2.java diff --git a/test/pending/run/t3897/a_1.scala b/test/files/run/t3897/a_1.scala index 4da959e2ac..4da959e2ac 100644 --- a/test/pending/run/t3897/a_1.scala +++ b/test/files/run/t3897/a_1.scala diff --git a/test/pending/run/t3897/a_2.scala b/test/files/run/t3897/a_2.scala index 4d9e59ef05..4d9e59ef05 100644 --- a/test/pending/run/t3897/a_2.scala +++ b/test/files/run/t3897/a_2.scala diff --git a/test/files/run/t4023.check b/test/files/run/t4023.check new file mode 100644 index 0000000000..05f867c397 --- /dev/null +++ b/test/files/run/t4023.check @@ -0,0 +1,21 @@ +Try 1: (6 classes) +class Test$C$B1 +class Test$C$B2 +class Test$C$B3$ +class Test$C$B4$ +class Test$C$B5$ +class Test$C$B6$ +Try 2: (6 classes) +class Test$C$B1 +class Test$C$B2 +class Test$C$B3$ +class Test$C$B4$ +class Test$C$B5$ +class Test$C$B6$ +Try 3: (6 classes) +class Test$C$B1 +class Test$C$B2 +class Test$C$B3$ +class Test$C$B4$ +class Test$C$B5$ +class Test$C$B6$ diff --git a/test/files/run/t4023.scala b/test/files/run/t4023.scala new file mode 100644 index 0000000000..4846fa31b4 --- /dev/null +++ b/test/files/run/t4023.scala @@ -0,0 +1,23 @@ +object Test { + object C { + class B1 + private class B2 + object B3 + private object B4 + object B5 extends B1 + private object B6 extends B2 + + val valuesTry1 = this.getClass.getDeclaredClasses + val valuesTry2 = C.getClass.getDeclaredClasses + val valuesTry3 = getClass.getDeclaredClasses + } + + def main(args: Array[String]) { + println("Try 1: (" + C.valuesTry1.length + " classes)") + C.valuesTry1.foreach(println) + println("Try 2: (" + C.valuesTry2.length + " classes)") + C.valuesTry2.foreach(println) + println("Try 3: (" + C.valuesTry3.length + " classes)") + C.valuesTry3.foreach(println) + } +}
\ No newline at end of file diff --git a/test/files/run/t4047.scala b/test/files/run/t4047.scala index cd42a8b4df..08989bd278 100644 --- a/test/files/run/t4047.scala +++ b/test/files/run/t4047.scala @@ -18,7 +18,7 @@ class D extends Bar[Unit]{ def foo = println("Unit: called D.foo") } -object Test extends Application { +object Test extends App { val a: Foo[Unit] = new A a.foo a.foo diff --git a/test/files/run/t4537.check b/test/files/run/t4537.check new file mode 100644 index 0000000000..63739ca64a --- /dev/null +++ b/test/files/run/t4537.check @@ -0,0 +1 @@ +b.Settings diff --git a/test/files/neg/t4537/a.scala b/test/files/run/t4537/a.scala index 65e183c5f8..125e223e13 100644 --- a/test/files/neg/t4537/a.scala +++ b/test/files/run/t4537/a.scala @@ -1,5 +1,5 @@ package a private[a] object Settings { - val X = 0 -}
\ No newline at end of file + val X = "a.Settings" +} diff --git a/test/files/neg/t4537/b.scala b/test/files/run/t4537/b.scala index bb9dd4e15a..c709d49b04 100644 --- a/test/files/neg/t4537/b.scala +++ b/test/files/run/t4537/b.scala @@ -1,5 +1,5 @@ package b object Settings { - val Y = 0 -}
\ No newline at end of file + val Y = "b.Settings" +} diff --git a/test/files/run/t4537/c.scala b/test/files/run/t4537/c.scala new file mode 100644 index 0000000000..ee05d4bbfb --- /dev/null +++ b/test/files/run/t4537/c.scala @@ -0,0 +1,8 @@ +package b +package c + +import a._ + +object Unambiguous { + println(Settings.Y) +} diff --git a/test/files/run/t4537/d.scala b/test/files/run/t4537/d.scala new file mode 100644 index 0000000000..dd1d2045ed --- /dev/null +++ b/test/files/run/t4537/d.scala @@ -0,0 +1,6 @@ +import a._ +import b._ + +object Test extends App { + println(Settings.Y) +} diff --git a/test/files/run/t4729.check b/test/files/run/t4729.check new file mode 100644 index 0000000000..9a2aa56d99 --- /dev/null +++ b/test/files/run/t4729.check @@ -0,0 +1,4 @@ +WrappedArray(1, 2) +WrappedArray(1, 2) +WrappedArray(1, 2) +WrappedArray(1, 2) diff --git a/test/files/run/t4729/J_1.java b/test/files/run/t4729/J_1.java new file mode 100644 index 0000000000..2ffb5a88d1 --- /dev/null +++ b/test/files/run/t4729/J_1.java @@ -0,0 +1,4 @@ +// Java Interface: +public interface J_1 { + public void method(String... s); +} diff --git a/test/files/run/t4729/S_2.scala b/test/files/run/t4729/S_2.scala new file mode 100644 index 0000000000..e34e3d34d4 --- /dev/null +++ b/test/files/run/t4729/S_2.scala @@ -0,0 +1,29 @@ + // Scala class: +class ScalaVarArgs extends J_1 { + // -- no problem on overriding it using ordinary class + def method(s: String*) { println(s) } +} + +object Test { + def main(args: Array[String]) { + //[1] Ok - no problem using inferred type + val varArgs = new J_1 { + def method(s: String*) { println(s) } + } + varArgs.method("1", "2") + + //[2] Ok -- no problem when explicit set its type after construction + val b: J_1 = varArgs + b.method("1", "2") + + //[3] Ok -- no problem on calling its method + (new ScalaVarArgs).method("1", "2") + (new ScalaVarArgs: J_1).method("1", "2") + + //[4] Not Ok -- error when assigning anonymous class to a explictly typed val + // Compiler error: object creation impossible, since method method in trait VarArgs of type (s: <repeated...>[java.lang.String])Unit is not defined + val tagged: J_1 = new J_1 { + def method(s: String*) { println(s) } + } + } +} diff --git a/test/files/run/t4935.flags b/test/files/run/t4935.flags index ac14fe5dbd..49d036a887 100644 --- a/test/files/run/t4935.flags +++ b/test/files/run/t4935.flags @@ -1 +1 @@ --optimize
+-optimize diff --git a/test/files/run/t4996.check b/test/files/run/t4996.check new file mode 100644 index 0000000000..8d45b413c9 --- /dev/null +++ b/test/files/run/t4996.check @@ -0,0 +1,4 @@ +B.foo +M.foo +B.foo +M.foo
\ No newline at end of file diff --git a/test/files/run/t4996.scala b/test/files/run/t4996.scala new file mode 100644 index 0000000000..8e7636aaac --- /dev/null +++ b/test/files/run/t4996.scala @@ -0,0 +1,47 @@ + + + + + + +trait A[@specialized(Int) T] { + def foo(t: T) +} + + +trait B extends A[Int] { + def foo(t: Int) { + println("B.foo") + } +} + + +trait M extends B { + abstract override def foo(t: Int) { + super.foo(t) + println("M.foo") + } +} + + +object C extends B with M + + +object D extends B { + override def foo(t: Int) { + super.foo(t) + println("M.foo") + } +} + + +object Test { + + def main(args: Array[String]) { + D.foo(42) // OK, prints B.foo M.foo + C.foo(42) // was StackOverflowError + } + +} + + diff --git a/test/pending/run/t5293-map.scala b/test/files/run/t5293-map.scala index 2707aed07e..2707aed07e 100644 --- a/test/pending/run/t5293-map.scala +++ b/test/files/run/t5293-map.scala diff --git a/test/pending/run/t5293.scala b/test/files/run/t5293.scala index 01ead45d2a..01ead45d2a 100644 --- a/test/pending/run/t5293.scala +++ b/test/files/run/t5293.scala diff --git a/test/pending/run/t5418.check b/test/files/run/t5418.check index e69de29bb2..e69de29bb2 100644 --- a/test/pending/run/t5418.check +++ b/test/files/run/t5418.check diff --git a/test/pending/run/t5418.scala b/test/files/run/t5418.scala index e3cb20cf82..e3cb20cf82 100644 --- a/test/pending/run/t5418.scala +++ b/test/files/run/t5418.scala diff --git a/test/files/run/t5604.check b/test/files/run/t5604.check new file mode 100644 index 0000000000..53a2fc8894 --- /dev/null +++ b/test/files/run/t5604.check @@ -0,0 +1,8 @@ +long +double +long +double +long +double +long +double diff --git a/test/files/run/t5604.scala b/test/files/run/t5604.scala new file mode 100644 index 0000000000..a06c8aab3e --- /dev/null +++ b/test/files/run/t5604.scala @@ -0,0 +1,50 @@ +// a.scala +// Fri Jan 13 11:31:47 PST 2012 + +package foo { + object regular extends Duh { + def buh(n: Long) = println("long") + def buh(n: Double) = println("double") + } + class regular { + import regular._ + + duh(33L) + duh(3.0d) + foo.regular.duh(33L) + foo.regular.duh(3.0d) + buh(66L) + buh(6.0d) + foo.regular.buh(66L) + foo.regular.buh(6.0d) + } + + trait Duh { + def duh(n: Long) = println("long") + def duh(n: Double) = println("double") + } + package object bar extends Duh { + def buh(n: Long) = println("long") + def buh(n: Double) = println("double") + } + package bar { + object Main { + def main(args:Array[String]) { + duh(33L) + duh(3.0d) + foo.bar.duh(33L) + foo.bar.duh(3.0d) + buh(66L) + buh(6.0d) + foo.bar.buh(66L) + foo.bar.buh(6.0d) + } + } + } +} + +object Test { + def main(args: Array[String]): Unit = { + foo.bar.Main.main(null) + } +} diff --git a/test/pending/run/t5610a.check b/test/files/run/t5610a.check index 2aa46b3b91..2aa46b3b91 100644 --- a/test/pending/run/t5610a.check +++ b/test/files/run/t5610a.check diff --git a/test/pending/run/t5610a.scala b/test/files/run/t5610a.scala index f20b295762..f20b295762 100644 --- a/test/pending/run/t5610a.scala +++ b/test/files/run/t5610a.scala diff --git a/test/files/run/t6028.check b/test/files/run/t6028.check index 34f4b22134..42921ae2f5 100644 --- a/test/files/run/t6028.check +++ b/test/files/run/t6028.check @@ -31,14 +31,14 @@ package <empty> { }; final def apply(): Int = $anonfun$foo$1.this.apply$mcI$sp(); <specialized> def apply$mcI$sp(): Int = $anonfun$foo$1.this.$outer.T$$classParam.+($anonfun$foo$1.this.$outer.field()).+($anonfun$foo$1.this.methodParam$1).+($anonfun$foo$1.this.methodLocal$1); - <synthetic> <paramaccessor> private[this] val $outer: T = _; - <synthetic> <stable> def T$$anonfun$$$outer(): T = $anonfun$foo$1.this.$outer; - final <bridge> def apply(): Object = scala.Int.box($anonfun$foo$1.this.apply()); + <synthetic> <paramaccessor> <artifact> private[this] val $outer: T = _; + <synthetic> <stable> <artifact> def T$$anonfun$$$outer(): T = $anonfun$foo$1.this.$outer; + final <bridge> <artifact> def apply(): Object = scala.Int.box($anonfun$foo$1.this.apply()); <synthetic> <paramaccessor> private[this] val methodParam$1: Int = _; <synthetic> <paramaccessor> private[this] val methodLocal$1: Int = _ }; abstract trait MethodLocalTrait$1 extends Object { - <synthetic> <stable> def T$MethodLocalTrait$$$outer(): T + <synthetic> <stable> <artifact> def T$MethodLocalTrait$$$outer(): T }; object MethodLocalObject$2 extends Object with T#MethodLocalTrait$1 { def <init>($outer: T, barParam$1: Int): T#MethodLocalObject$2.type = { @@ -46,9 +46,9 @@ package <empty> { MethodLocalObject$2.this.$asInstanceOf[T#MethodLocalTrait$1$class]()./*MethodLocalTrait$1$class*/$init$(barParam$1); () }; - <synthetic> <paramaccessor> private[this] val $outer: T = _; - <synthetic> <stable> def T$MethodLocalObject$$$outer(): T = MethodLocalObject$2.this.$outer; - <synthetic> <stable> def T$MethodLocalTrait$$$outer(): T = MethodLocalObject$2.this.$outer + <synthetic> <paramaccessor> <artifact> private[this] val $outer: T = _; + <synthetic> <stable> <artifact> def T$MethodLocalObject$$$outer(): T = MethodLocalObject$2.this.$outer; + <synthetic> <stable> <artifact> def T$MethodLocalTrait$$$outer(): T = MethodLocalObject$2.this.$outer }; final <stable> private[this] def MethodLocalObject$1(barParam$1: Int, MethodLocalObject$module$1: runtime.VolatileObjectRef): T#MethodLocalObject$2.type = { MethodLocalObject$module$1.elem = new T#MethodLocalObject$2.type(T.this, barParam$1); @@ -69,9 +69,9 @@ package <empty> { <specialized> def apply$mcV$sp(): Unit = try { $anonfun$tryy$1.this.tryyLocal$1.elem = $anonfun$tryy$1.this.tryyParam$1 } finally (); - <synthetic> <paramaccessor> private[this] val $outer: T = _; - <synthetic> <stable> def T$$anonfun$$$outer(): T = $anonfun$tryy$1.this.$outer; - final <bridge> def apply(): Object = { + <synthetic> <paramaccessor> <artifact> private[this] val $outer: T = _; + <synthetic> <stable> <artifact> def T$$anonfun$$$outer(): T = $anonfun$tryy$1.this.$outer; + final <bridge> <artifact> def apply(): Object = { $anonfun$tryy$1.this.apply(); scala.runtime.BoxedUnit.UNIT }; diff --git a/test/files/run/t6064.scala b/test/files/run/t6064.scala new file mode 100644 index 0000000000..fc184dd92d --- /dev/null +++ b/test/files/run/t6064.scala @@ -0,0 +1,9 @@ +object Test extends App { + assert(Option(42) contains 42) + assert(Some(42) contains 42) + assert(Option(BigInt(42)) contains 42) + assert(Option(42) contains BigInt(42)) + assert(!(None contains 42)) + assert(Some(null) contains null) + assert(!(Option(null) contains null)) +}
\ No newline at end of file diff --git a/test/files/run/t6150.scala b/test/files/run/t6150.scala index bd8af5d460..f3e83e1549 100644 --- a/test/files/run/t6150.scala +++ b/test/files/run/t6150.scala @@ -1,7 +1,3 @@ - - - - object Test { import collection.{ immutable, mutable, generic } def TheOneTrueCBF = collection.IndexedSeq.ReusableCBF @@ -38,7 +34,3 @@ object Test { check(iv.:+(4)(cbf3)) } } - - - - diff --git a/test/files/run/t6154.check b/test/files/run/t6154.check new file mode 100644 index 0000000000..9766475a41 --- /dev/null +++ b/test/files/run/t6154.check @@ -0,0 +1 @@ +ok diff --git a/test/files/run/t6154.scala b/test/files/run/t6154.scala new file mode 100644 index 0000000000..02ef62905f --- /dev/null +++ b/test/files/run/t6154.scala @@ -0,0 +1,10 @@ +object Test { + def foo(a: Int) { + var bar: Int = 0 + bar = try { 0 } catch { case ex: Throwable => 0 } + new { foo(bar) } + } + + def main(args: Array[String]): Unit = + try foo(0) catch { case _: java.lang.StackOverflowError => println("ok") } +} diff --git a/test/files/run/t6206.check b/test/files/run/t6206.check new file mode 100644 index 0000000000..8064573667 --- /dev/null +++ b/test/files/run/t6206.check @@ -0,0 +1,4 @@ +outer +outer +inner +inner diff --git a/test/files/run/t6206.scala b/test/files/run/t6206.scala new file mode 100644 index 0000000000..07ff246d02 --- /dev/null +++ b/test/files/run/t6206.scala @@ -0,0 +1,37 @@ +class Outer { + def apply( position : Inner ) {} + class Inner + + this.apply(new Inner) + this (new Inner) // error, +} + + +class Outer1 { + + self => + + def apply( position : Inner ) : String = "outer" + + class Inner( ) { + + def apply(arg: Inner): String = "inner" + + def testMe = { + List( + self.apply( this ), // a) this works + self( this ), // b) this does not work! + this apply this, + this(this) + ) foreach println + } + } +} + +object Test { + def main(args: Array[String]): Unit = { + val o = new Outer1 + val i = new o.Inner + i.testMe + } +} diff --git a/test/files/run/t6223.check b/test/files/run/t6223.check index 90ec019407..4a09d1930f 100644 --- a/test/files/run/t6223.check +++ b/test/files/run/t6223.check @@ -1,4 +1,4 @@ bar -bar$mcI$sp bar$mIc$sp bar$mIcI$sp +bar$mcI$sp diff --git a/test/files/run/t6223.scala b/test/files/run/t6223.scala index 4ab7c832e6..fb176e32e6 100644 --- a/test/files/run/t6223.scala +++ b/test/files/run/t6223.scala @@ -5,7 +5,7 @@ class Foo[@specialized(Int) A](a:A) { object Test { def main(args:Array[String]) { val f = new Foo(333) - val ms = f.getClass().getDeclaredMethods() + val ms = f.getClass().getDeclaredMethods().sortBy(_.getName) ms.foreach(m => println(m.getName)) } } diff --git a/test/files/run/t6381.check b/test/files/run/t6381.check new file mode 100644 index 0000000000..b51cfd0398 --- /dev/null +++ b/test/files/run/t6381.check @@ -0,0 +1,17 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> import language.experimental.macros +import language.experimental.macros + +scala> def pos_impl(c: reflect.macros.Context): c.Expr[String] = + c.literal(c.enclosingPosition.getClass.toString) +pos_impl: (c: scala.reflect.macros.Context)c.Expr[String] + +scala> def pos = macro pos_impl +pos: String + +scala> pos +res0: String = class scala.reflect.internal.util.RangePosition + +scala> diff --git a/test/files/run/t6381.scala b/test/files/run/t6381.scala new file mode 100644 index 0000000000..859ec3cb30 --- /dev/null +++ b/test/files/run/t6381.scala @@ -0,0 +1,13 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ + |import language.experimental.macros + |def pos_impl(c: reflect.macros.Context): c.Expr[String] = + | c.literal(c.enclosingPosition.getClass.toString) + |def pos = macro pos_impl + |pos + |""".stripMargin.trim + + override def extraSettings: String = "-Yrangepos" +} diff --git a/test/files/run/t6406-regextract.check b/test/files/run/t6406-regextract.check new file mode 100644 index 0000000000..88c5a52eb3 --- /dev/null +++ b/test/files/run/t6406-regextract.check @@ -0,0 +1,4 @@ +List(1, 3) +List(1, 3) +List(1, 3) +Some(2011) Some(2011) diff --git a/test/files/run/t6406-regextract.scala b/test/files/run/t6406-regextract.scala new file mode 100644 index 0000000000..83679a5167 --- /dev/null +++ b/test/files/run/t6406-regextract.scala @@ -0,0 +1,30 @@ + +object Test extends App { + import util.matching._ + import Regex._ + + val r = "(\\d+)".r + val q = """(\d)""".r + val ns = List("1,2","x","3,4") + val u = r.unanchored + + val is = ns collect { case u(x) => x } map { case r(x) => x } + println(is) + // Match from same pattern + val js = (ns map { u findFirstMatchIn _ }).flatten map { case r(x) => x } + println(js) + // Match not from same pattern + val ks = (ns map { q findFirstMatchIn _ }).flatten map { case r(x) => x } + println(ks) + + val t = "Last modified 2011-07-15" + val p1 = """(\d\d\d\d)-(\d\d)-(\d\d)""".r + val y1: Option[String] = for { + p1(year, month, day) <- p1 findFirstIn t + } yield year + val y2: Option[String] = for { + p1(year, month, day) <- p1 findFirstMatchIn t + } yield year + println(s"$y1 $y2") + +} diff --git a/test/files/run/t6448.check b/test/files/run/t6448.check new file mode 100644 index 0000000000..9401568319 --- /dev/null +++ b/test/files/run/t6448.check @@ -0,0 +1,32 @@ + +=List.collect= +f(1) +f(2) +List(1) + +=List.collectFirst= +f(1) +Some(1) + +=Option.collect= +f(1) +Some(1) + +=Option.collect= +f(2) +None + +=Stream.collect= +f(1) +f(2) +List(1) + +=Stream.collectFirst= +f(1) +Some(1) + +=ParVector.collect= +(ParVector(1),2) + +=ParArray.collect= +(ParArray(1),2) diff --git a/test/files/run/t6448.scala b/test/files/run/t6448.scala new file mode 100644 index 0000000000..4d1528e500 --- /dev/null +++ b/test/files/run/t6448.scala @@ -0,0 +1,61 @@ +// Tests to show that various `collect` functions avoid calling +// both `PartialFunction#isDefinedAt` and `PartialFunction#apply`. +// +object Test { + def f(i: Int) = { println("f(" + i + ")"); true } + class Counter { + var count = 0 + def apply(i: Int) = synchronized {count += 1; true} + } + + def testing(label: String)(body: => Any) { + println(s"\n=$label=") + println(body) + } + + def main(args: Array[String]) { + testing("List.collect")(List(1, 2) collect { case x if f(x) && x < 2 => x}) + testing("List.collectFirst")(List(1, 2) collectFirst { case x if f(x) && x < 2 => x}) + testing("Option.collect")(Some(1) collect { case x if f(x) && x < 2 => x}) + testing("Option.collect")(Some(2) collect { case x if f(x) && x < 2 => x}) + testing("Stream.collect")((Stream(1, 2).collect { case x if f(x) && x < 2 => x}).toList) + testing("Stream.collectFirst")(Stream.continually(1) collectFirst { case x if f(x) && x < 2 => x}) + + import collection.parallel.ParIterable + import collection.parallel.immutable.ParVector + import collection.parallel.mutable.ParArray + testing("ParVector.collect") { + val counter = new Counter() + (ParVector(1, 2) collect { case x if counter(x) && x < 2 => x}, counter.synchronized(counter.count)) + } + + testing("ParArray.collect") { + val counter = new Counter() + (ParArray(1, 2) collect { case x if counter(x) && x < 2 => x}, counter.synchronized(counter.count)) + } + + object PendingTests { + testing("Iterator.collect")((Iterator(1, 2) collect { case x if f(x) && x < 2 => x}).toList) + + testing("List.view.collect")((List(1, 2).view collect { case x if f(x) && x < 2 => x}).force) + + // This would do the trick in Future.collect, but I haven't added this yet as there is a tradeoff + // with extra allocations to consider. + // + // pf.lift(v) match { + // case Some(x) => p success x + // case None => fail(v) + // } + testing("Future.collect") { + import concurrent.ExecutionContext.Implicits.global + import concurrent.Await + import concurrent.duration.Duration + val result = concurrent.future(1) collect { case x if f(x) => x} + Await.result(result, Duration.Inf) + } + + // TODO Future.{onSuccess, onFailure, recoverWith, andThen} + } + + } +} diff --git a/test/files/run/t6467.scala b/test/files/run/t6467.scala new file mode 100644 index 0000000000..dc93b69fdc --- /dev/null +++ b/test/files/run/t6467.scala @@ -0,0 +1,20 @@ + + + + +import collection._ + + + +object Test extends App { + + def compare(s1: String, s2: String) { + assert(s1 == s2, s1 + "\nvs.\n" + s2) + } + + compare(List(1, 2, 3, 4).aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, "1234") + compare(List(1, 2, 3, 4).par.aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, "1234") + compare(Seq(0 until 100: _*).aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, (0 until 100).mkString) + compare(Seq(0 until 100: _*).par.aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, (0 until 100).mkString) + +}
\ No newline at end of file diff --git a/test/files/run/t6584.check b/test/files/run/t6584.check new file mode 100644 index 0000000000..35c8688751 --- /dev/null +++ b/test/files/run/t6584.check @@ -0,0 +1,8 @@ +Array: 102400 +Vector: 102400 +List: 102400 +Stream: 102400 +Array: 102400 +Vector: 102400 +List: 102400 +Stream: 102400 diff --git a/test/files/run/t6584.scala b/test/files/run/t6584.scala new file mode 100644 index 0000000000..24c236ef35 --- /dev/null +++ b/test/files/run/t6584.scala @@ -0,0 +1,16 @@ +object Test { + def main(args: Array[String]): Unit = { + val size = 100 * 1024 + val doubled = (1 to size) ++ (1 to size) + + println("Array: " + Array.tabulate(size)(x => x).distinct.size) + println("Vector: " + Vector.tabulate(size)(x => x).distinct.size) + println("List: " + List.tabulate(size)(x => x).distinct.size) + println("Stream: " + Stream.tabulate(size)(x => x).distinct.size) + + println("Array: " + doubled.toArray.distinct.size) + println("Vector: " + doubled.toVector.distinct.size) + println("List: " + doubled.toList.distinct.size) + println("Stream: " + doubled.toStream.distinct.size) + } +} diff --git a/test/files/run/t6611.scala b/test/files/run/t6611.scala new file mode 100644 index 0000000000..c295368aea --- /dev/null +++ b/test/files/run/t6611.scala @@ -0,0 +1,61 @@ +object Test extends App { + locally { + val a = Array("1") + val a2 = Array(a: _*) + assert(a ne a2) + } + + locally { + val a = Array("1": Object) + val a2 = Array(a: _*) + assert(a ne a2) + } + + locally { + val a = Array(true) + val a2 = Array(a: _*) + assert(a ne a2) + } + + locally { + val a = Array(1: Short) + val a2 = Array(a: _*) + assert(a ne a2) + } + + locally { + val a = Array(1: Byte) + val a2 = Array(a: _*) + assert(a ne a2) + } + + locally { + val a = Array(1) + val a2 = Array(a: _*) + assert(a ne a2) + } + + locally { + val a = Array(1L) + val a2 = Array(a: _*) + assert(a ne a2) + } + + locally { + val a = Array(1f) + val a2 = Array(a: _*) + assert(a ne a2) + } + + locally { + val a = Array(1d) + val a2 = Array(a: _*) + assert(a ne a2) + } + + locally { + val a = Array(()) + val a2 = Array(a: _*) + assert(a ne a2) + } +} diff --git a/test/files/run/t6637.check b/test/files/run/t6637.check new file mode 100644 index 0000000000..9766475a41 --- /dev/null +++ b/test/files/run/t6637.check @@ -0,0 +1 @@ +ok diff --git a/test/files/run/t6637.scala b/test/files/run/t6637.scala new file mode 100644 index 0000000000..d3c380370b --- /dev/null +++ b/test/files/run/t6637.scala @@ -0,0 +1,8 @@ + +object Test extends App { + try { + class A ; class B ; List().head.isInstanceOf[A with B] + } catch { + case _ :java.util.NoSuchElementException => println("ok") + } +} diff --git a/test/flaky/pos/t2868.cmds b/test/flaky/pos/t2868.cmds deleted file mode 100644 index ed8124a9e0..0000000000 --- a/test/flaky/pos/t2868.cmds +++ /dev/null @@ -1,3 +0,0 @@ -javac Jann.java Nest.java -scalac pick_1.scala -scalac test_2.scala diff --git a/test/partest b/test/partest index 8352f8a946..ae60c49929 100755 --- a/test/partest +++ b/test/partest @@ -70,6 +70,12 @@ if $cygwin; then else format=windows fi + if [ -n "${JAVA_HOME}" ] ; then + JAVA_HOME=`cygpath --$format "$JAVA_HOME"` + fi + if [ -n "${JAVACMD}" ] ; then + JAVACMD=`cygpath --$format "$JAVACMD"` + fi SCALA_HOME=`cygpath --$format "$SCALA_HOME"` EXT_CLASSPATH=`cygpath --path --$format "$EXT_CLASSPATH"` fi @@ -84,7 +90,7 @@ if [ ! -z "${PARTEST_DEBUG}" ] ; then partestDebugStr="-Dpartest.debug=${PARTEST_DEBUG}" fi -${JAVACMD:=java} \ +"${JAVACMD:=java}" \ $JAVA_OPTS -cp "$EXT_CLASSPATH" \ ${partestDebugStr} \ -Dscala.home="${SCALA_HOME}" \ diff --git a/test/pending/pos/overloading-boundaries.scala b/test/pending/pos/overloading-boundaries.scala new file mode 100644 index 0000000000..d2e9fdbb12 --- /dev/null +++ b/test/pending/pos/overloading-boundaries.scala @@ -0,0 +1,37 @@ +package bar { + object bippy extends (Double => String) { + def apply(x: Double): String = "Double" + } +} + +package object bar { + def bippy(x: Int, y: Int, z: Int) = "(Int, Int, Int)" +} + +object Test { + def main(args: Array[String]): Unit = { + println(bar.bippy(5.5d)) + println(bar.bippy(1, 2, 3)) + } +} + +/**** + +% scalac3 a.scala +a.scala:13: error: not enough arguments for method bippy: (x: Int, y: Int, z: Int)String. +Unspecified value parameters y, z. + println(bar.bippy(5.5d)) + ^ +one error found + +# Comment out the call to bar.bippy(5.5d) - compiles +% scalac3 a.scala + +# Compiles only from pure source though - if classes are present, fails. +% scalac3 a.scala +a.scala:2: error: bippy is already defined as method bippy in package object bar + object bippy extends (Double => String) { + ^ +one error found + +****/ diff --git a/test/pending/pos/t1751.cmds b/test/pending/pos/t1751.cmds deleted file mode 100644 index d4a4898ffd..0000000000 --- a/test/pending/pos/t1751.cmds +++ /dev/null @@ -1,3 +0,0 @@ -javac SuiteClasses.java -scalac A2_1.scala -scalac A1_2.scala diff --git a/test/pending/pos/t1782.cmds b/test/pending/pos/t1782.cmds deleted file mode 100644 index 61f3d3788e..0000000000 --- a/test/pending/pos/t1782.cmds +++ /dev/null @@ -1,2 +0,0 @@ -javac Ann.java Days.java ImplementedBy.java -scalac Test_1.scala diff --git a/test/pending/pos/t1832.scala b/test/pending/pos/t1832.scala deleted file mode 100644 index bca863f4bd..0000000000 --- a/test/pending/pos/t1832.scala +++ /dev/null @@ -1,10 +0,0 @@ -// Edit by paulp: reduced. -trait Cloning { - trait Foo - def fn(g: Int => Unit): Foo - - implicit def mkStar(i: Int) = new { def *(a: Foo): Foo = null } - - val pool1 = 4 * fn { case i => i * 2 } - val pool2 = 4 * fn { case i: Int => i * 2 } -} diff --git a/test/pending/pos/t294.cmds b/test/pending/pos/t294.cmds deleted file mode 100644 index 62c9a5a068..0000000000 --- a/test/pending/pos/t294.cmds +++ /dev/null @@ -1,3 +0,0 @@ -javac Ann.java Ann2.java -scalac Test_1.scala -scalac Test_2.scala diff --git a/test/pending/pos/t4612.scala b/test/pending/pos/t4612.scala new file mode 100644 index 0000000000..a93c12ef01 --- /dev/null +++ b/test/pending/pos/t4612.scala @@ -0,0 +1,15 @@ +class CyclicReferenceCompilerBug { + trait Trait[A] { + def foo: A + } + + class Class extends Trait[Class] { + def foo = new Class + + trait OtherTrait extends Trait[OtherTrait] { + self: Class => + + def foo = new Class + } + } +} diff --git a/test/pending/pos/t4695/T_1.scala b/test/pending/pos/t4695/T_1.scala new file mode 100644 index 0000000000..70fb1a7f21 --- /dev/null +++ b/test/pending/pos/t4695/T_1.scala @@ -0,0 +1,4 @@ +package foo + +class Bar { } +package object Bar { } diff --git a/test/pending/pos/t4695/T_2.scala b/test/pending/pos/t4695/T_2.scala new file mode 100644 index 0000000000..70fb1a7f21 --- /dev/null +++ b/test/pending/pos/t4695/T_2.scala @@ -0,0 +1,4 @@ +package foo + +class Bar { } +package object Bar { } diff --git a/test/pending/pos/t4717.scala b/test/pending/pos/t4717.scala deleted file mode 100644 index 7eaa3dd487..0000000000 --- a/test/pending/pos/t4717.scala +++ /dev/null @@ -1,7 +0,0 @@ -trait Bounds[@specialized A] { - // okay without `>: A` - def x[B >: A]: Unit = new Bounds[B] { - lazy val it = ??? // def or val okay - it - } -}
\ No newline at end of file diff --git a/test/pending/pos/t5082.scala b/test/pending/pos/t5082.scala new file mode 100644 index 0000000000..20a6cfc55f --- /dev/null +++ b/test/pending/pos/t5082.scala @@ -0,0 +1,8 @@ +object Test { + sealed trait A + case object A1 extends A +} + +trait Something[T] + +case class Test() extends Something[Test.A] diff --git a/test/pending/pos/t5259.scala b/test/pending/pos/t5259.scala deleted file mode 100644 index 317e28a9dc..0000000000 --- a/test/pending/pos/t5259.scala +++ /dev/null @@ -1,14 +0,0 @@ -object DefaultArgBogusTypeMismatch { - - class A[T] - class B { - type T = this.type - def m(implicit a : A[T] = new A[T]) = a - } - - def newB = new B - val a1 = newB.m // Bogus type mismatch - - val stableB = new B - val a2 = stableB.m // OK -} diff --git a/test/pending/pos/t5399.scala b/test/pending/pos/t5399.scala deleted file mode 100644 index 89caba39c1..0000000000 --- a/test/pending/pos/t5399.scala +++ /dev/null @@ -1,8 +0,0 @@ -class Test { - class A[T] - class B[T](val a: A[T]) - - case class CaseClass[T](x: T) - - def break(existB: B[_]) = CaseClass(existB.a) match { case CaseClass(_) => } -} diff --git a/test/pending/pos/t5626.scala b/test/pending/pos/t5626.scala deleted file mode 100644 index 7ab3881827..0000000000 --- a/test/pending/pos/t5626.scala +++ /dev/null @@ -1,12 +0,0 @@ -object Test { - val blob0 = new { - case class Foo(i : Int) - } - val foo0 = blob0.Foo(22) - - val blob1 = new { - class Foo(i: Int) - object Foo { def apply(i: Int): Foo = new Foo(i) } - } - val foo1 = blob1.Foo(22) -} diff --git a/test/pending/pos/t5654.scala b/test/pending/pos/t5654.scala deleted file mode 100644 index eb711a5f37..0000000000 --- a/test/pending/pos/t5654.scala +++ /dev/null @@ -1,4 +0,0 @@ -case class Bomb(a: Array[_]) -case class Bomb2(a: Array[T] forSome { type T }) -class Okay1(a: Array[_]) -case class Okay2(s: Seq[_])
\ No newline at end of file diff --git a/test/pending/pos/t5877.scala b/test/pending/pos/t5877.scala new file mode 100644 index 0000000000..b77605f7f2 --- /dev/null +++ b/test/pending/pos/t5877.scala @@ -0,0 +1,5 @@ +package foo { } + +package object foo { + implicit class Foo(val s: String) { } +} diff --git a/test/pending/pos/t5954/T_1.scala b/test/pending/pos/t5954/T_1.scala new file mode 100644 index 0000000000..0064c596b6 --- /dev/null +++ b/test/pending/pos/t5954/T_1.scala @@ -0,0 +1,8 @@ +package p { + package base { + class X + } + package object base { + case class B() + } +} diff --git a/test/pending/pos/t5954/T_2.scala b/test/pending/pos/t5954/T_2.scala new file mode 100644 index 0000000000..0064c596b6 --- /dev/null +++ b/test/pending/pos/t5954/T_2.scala @@ -0,0 +1,8 @@ +package p { + package base { + class X + } + package object base { + case class B() + } +} diff --git a/test/pending/pos/t5954/T_3.scala b/test/pending/pos/t5954/T_3.scala new file mode 100644 index 0000000000..0064c596b6 --- /dev/null +++ b/test/pending/pos/t5954/T_3.scala @@ -0,0 +1,8 @@ +package p { + package base { + class X + } + package object base { + case class B() + } +} diff --git a/test/pending/pos/t6225.scala b/test/pending/pos/t6225.scala new file mode 100644 index 0000000000..d7dff3c419 --- /dev/null +++ b/test/pending/pos/t6225.scala @@ -0,0 +1,11 @@ +package library.x { + class X { + class Foo + implicit val foo = new Foo + } +} +package library { package object x extends X } +package app { + import library.x._ + object App { implicitly[Foo] } +} diff --git a/test/pending/pos/z1720.scala b/test/pending/pos/z1720.scala deleted file mode 100644 index 6050f3ff88..0000000000 --- a/test/pending/pos/z1720.scala +++ /dev/null @@ -1,16 +0,0 @@ -package test - -class Thing { - def info: Info[this.type] = InfoRepository.getInfo(this) - def info2: Info[this.type] = { - def self: this.type = this - InfoRepository.getInfo(self) - } -} - -trait Info[T] -case class InfoImpl[T](thing: T) extends Info[T] - -object InfoRepository { - def getInfo(t: Thing): Info[t.type] = InfoImpl(t) -}
\ No newline at end of file diff --git a/test/scaladoc/resources/links.scala b/test/scaladoc/resources/links.scala index bd69665357..ecac9c63cf 100644 --- a/test/scaladoc/resources/links.scala +++ b/test/scaladoc/resources/links.scala @@ -25,6 +25,7 @@ package scala.test.scaladoc.links { object Target { type T = Int => Int type S = Int + type ::[X] = scala.collection.immutable.::[X] class C def foo(i: Int) = 2 def foo(z: String) = 3 @@ -46,6 +47,7 @@ package scala.test.scaladoc.links { * - [[[[Target!.foo[A[_[_]]]* trait Target -> def foo with 3 nested tparams]]]] (should exercise nested parens) * - [[Target$.T object Target -> type T]] * - [[Target$.S object Target -> type S]] + * - [[Target$.:: object Target -> type ::]] * - [[Target$.foo(z:Str* object Target -> def foo]] * - [[Target$.bar object Target -> def bar]] * - [[[[Target$.foo[A[_[_]]]* trait Target -> def foo with 3 nested tparams]]]] (should exercise nested parens) diff --git a/test/scaladoc/run/links.scala b/test/scaladoc/run/links.scala index 0c67857e1c..9fbf618558 100644 --- a/test/scaladoc/run/links.scala +++ b/test/scaladoc/run/links.scala @@ -25,7 +25,7 @@ object Test extends ScaladocModelTest { val memberLinks = countLinks(TEST.comment.get, _.link.isInstanceOf[LinkToMember]) val templateLinks = countLinks(TEST.comment.get, _.link.isInstanceOf[LinkToTpl]) - assert(memberLinks == 17, memberLinks + " == 17 (the member links in object TEST)") + assert(memberLinks == 18, memberLinks + " == 18 (the member links in object TEST)") assert(templateLinks == 6, templateLinks + " == 6 (the template links in object TEST)") } -}
\ No newline at end of file +} diff --git a/test/scaladoc/scalacheck/HtmlFactoryTest.scala b/test/scaladoc/scalacheck/HtmlFactoryTest.scala index 13eacf79a5..d7b5e48288 100644 --- a/test/scaladoc/scalacheck/HtmlFactoryTest.scala +++ b/test/scaladoc/scalacheck/HtmlFactoryTest.scala @@ -680,7 +680,7 @@ object Test extends Properties("HtmlFactory") { property("package object") = files("com/example/p1/package.html") match { case node: scala.xml.Node => - node.toString contains "com.example.p1.package#packageObjectMethod" + node.toString contains "com.example.p1#packageObjectMethod" case _ => false } |