diff options
Diffstat (limited to 'test/files')
39 files changed, 195 insertions, 23 deletions
diff --git a/test/files/jvm/deprecation.check b/test/files/jvm/deprecation.check index 3c27d4d082..d57b6b55a5 100644 --- a/test/files/jvm/deprecation.check +++ b/test/files/jvm/deprecation.check @@ -1,3 +1,3 @@ -warning: there were 4 deprecation warnings; re-run with -deprecation for details +warning: there were four deprecation warnings; re-run with -deprecation for details Note: deprecation/Use_2.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. diff --git a/test/files/jvm/serialization-new.check b/test/files/jvm/serialization-new.check index 8ec5754ea2..1555135926 100644 --- a/test/files/jvm/serialization-new.check +++ b/test/files/jvm/serialization-new.check @@ -1,4 +1,4 @@ -warning: there were 2 deprecation warnings; re-run with -deprecation for details +warning: there were two deprecation warnings; re-run with -deprecation for details a1 = Array[1,2,3] _a1 = Array[1,2,3] arrayEquals(a1, _a1): true diff --git a/test/files/jvm/serialization.check b/test/files/jvm/serialization.check index 8ec5754ea2..1555135926 100644 --- a/test/files/jvm/serialization.check +++ b/test/files/jvm/serialization.check @@ -1,4 +1,4 @@ -warning: there were 2 deprecation warnings; re-run with -deprecation for details +warning: there were two deprecation warnings; re-run with -deprecation for details a1 = Array[1,2,3] _a1 = Array[1,2,3] arrayEquals(a1, _a1): true diff --git a/test/files/neg/aladdin1055.check b/test/files/neg/aladdin1055.check new file mode 100644 index 0000000000..41782ae987 --- /dev/null +++ b/test/files/neg/aladdin1055.check @@ -0,0 +1,7 @@ +Test_1.scala:2: warning: match may not be exhaustive. +It would fail on the following input: (_ : this.<local child>) + def foo(t: A.T) = t match { + ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found +one error found diff --git a/test/files/neg/aladdin1055.flags b/test/files/neg/aladdin1055.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/neg/aladdin1055.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/aladdin1055/A.scala b/test/files/neg/aladdin1055/A.scala new file mode 100644 index 0000000000..862336e30c --- /dev/null +++ b/test/files/neg/aladdin1055/A.scala @@ -0,0 +1,6 @@ +object A { + sealed trait T { def f: Int } + class TT extends T { def f = 0 } + + def foo = new T { def f = 1 } // local subclass of sealed trait T +} diff --git a/test/files/neg/aladdin1055/Test_1.scala b/test/files/neg/aladdin1055/Test_1.scala new file mode 100644 index 0000000000..39d9b1dc98 --- /dev/null +++ b/test/files/neg/aladdin1055/Test_1.scala @@ -0,0 +1,5 @@ +object Test { + def foo(t: A.T) = t match { + case a: A.TT => 0 + } +} diff --git a/test/files/neg/checksensible.check b/test/files/neg/checksensible.check index e5f1a38d96..7de22fef54 100644 --- a/test/files/neg/checksensible.check +++ b/test/files/neg/checksensible.check @@ -97,6 +97,7 @@ checksensible.scala:84: warning: comparing values of types EqEqRefTest.this.C3 a checksensible.scala:95: warning: comparing values of types Unit and Int using `!=' will always yield true while ((c = in.read) != -1) ^ +warning: there were three deprecation warnings; re-run with -deprecation for details error: No warnings can be incurred under -Xfatal-warnings. -33 warnings found +34 warnings found one error found diff --git a/test/files/neg/overloaded-implicit.check b/test/files/neg/overloaded-implicit.check index ca0870705d..0e6617d904 100644 --- a/test/files/neg/overloaded-implicit.check +++ b/test/files/neg/overloaded-implicit.check @@ -4,6 +4,7 @@ overloaded-implicit.scala:2: warning: parameterized overloaded implicit methods 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() ^ +warning: there were four feature warnings; re-run with -feature for details error: No warnings can be incurred under -Xfatal-warnings. -two warnings found +three warnings found one error found diff --git a/test/files/neg/t1909-object.check b/test/files/neg/t1909-object.check index 401c1f7ebf..7141c84d4b 100644 --- a/test/files/neg/t1909-object.check +++ b/test/files/neg/t1909-object.check @@ -1,4 +1,6 @@ -t1909-object.scala:4: error: !!! SI-1909 Unable to STATICally lift object InnerTrouble$1, which is defined in the self- or super-constructor call of class Kaboom. A VerifyError is likely. +t1909-object.scala:4: warning: !!! SI-1909 Unable to STATICally lift object InnerTrouble$1, which is defined in the self- or super-constructor call of class Kaboom. A VerifyError is likely. object InnerTrouble ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/t5675.check b/test/files/neg/t5675.check index 13226935dc..3b3b2fa04c 100644 --- a/test/files/neg/t5675.check +++ b/test/files/neg/t5675.check @@ -1,2 +1,4 @@ -error: there was one feature warning; re-run with -feature for details +warning: there was one feature warning; re-run with -feature for details +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/t6567.check b/test/files/neg/t6567.check index a733d75354..f42f157371 100644 --- a/test/files/neg/t6567.check +++ b/test/files/neg/t6567.check @@ -4,6 +4,7 @@ t6567.scala:8: warning: Suspicious application of an implicit view (Test.this.a2 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) ^ +warning: there was one feature warning; re-run with -feature for details error: No warnings can be incurred under -Xfatal-warnings. -two warnings found +three warnings found one error found diff --git a/test/files/neg/t8675.check b/test/files/neg/t8675.check new file mode 100644 index 0000000000..4e44fba918 --- /dev/null +++ b/test/files/neg/t8675.check @@ -0,0 +1,11 @@ +t8675.scala:13: error: type mismatch; + found : Boolean(true) + required: String + a.update(0, x[A]({new isString(true)})) // !!! allowed + ^ +t8675.scala:22: error: type mismatch; + found : Boolean(true) + required: String + new X().m(x[A]({new isString(true)})) // !!! allowed + ^ +two errors found diff --git a/test/files/neg/t8675.scala b/test/files/neg/t8675.scala new file mode 100644 index 0000000000..ca9bb57ffa --- /dev/null +++ b/test/files/neg/t8675.scala @@ -0,0 +1,24 @@ +class A(s: String) { + def foo(x: A) = x +} + +class isString(s: String) + +class Test { + + def x[A](a: Any): A = ??? + + def test { + val a = Array[A]() + a.update(0, x[A]({new isString(true)})) // !!! allowed + + // boils down to + class X { + def m(p: Any) {} + } + implicit class XOps(x: X) { + def m(p: Any) {} + } + new X().m(x[A]({new isString(true)})) // !!! allowed + } +} diff --git a/test/files/neg/t8675b.check b/test/files/neg/t8675b.check new file mode 100644 index 0000000000..cb7ac8af59 --- /dev/null +++ b/test/files/neg/t8675b.check @@ -0,0 +1,6 @@ +t8675b.scala:19: error: missing parameter type for expanded function +The argument types of an anonymous function must be fully known. (SLS 8.5) +Expected type was: List[Test.Reportable1[?,?]] => Boolean + for (path: List[Any] <- (null : Engine1).asRequirement.pathsIncludingSelf.toList) { + ^ +one error found diff --git a/test/files/neg/t8675b.scala b/test/files/neg/t8675b.scala new file mode 100644 index 0000000000..2c5015b1d0 --- /dev/null +++ b/test/files/neg/t8675b.scala @@ -0,0 +1,22 @@ +object Test { + trait Engine1 + + implicit class EngineTools1[Params, R](e: Engine1) { + def asRequirement: Requirement1[Params, R] = ??? + } + trait Requirement1[Params, R] { + def pathsIncludingSelf: Traversable[List[Reportable1[Params, R]]] + } + trait Reportable1[Params, R] + + // "missing paramater type" error was swallowed in 2.11.0 leading to a crash + // in the backend. + // + // This error is itself a regression (or at least a change) in 2.11.0-M7, + // specifically in SI-7944. The type paramaters to the implicit view + // `EngineTools1` are undetermined, and are now treated as type variables + // in the expected type of the closure argument to `withFilter`. + for (path: List[Any] <- (null : Engine1).asRequirement.pathsIncludingSelf.toList) { + ??? + } +} diff --git a/test/files/neg/unchecked-refinement.check b/test/files/neg/unchecked-refinement.check index e85a51f44d..0bb944621b 100644 --- a/test/files/neg/unchecked-refinement.check +++ b/test/files/neg/unchecked-refinement.check @@ -10,6 +10,7 @@ unchecked-refinement.scala:23: warning: a pattern match on a refinement type is 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 ^ +warning: there was one feature warning; re-run with -feature for details error: No warnings can be incurred under -Xfatal-warnings. -four warnings found +5 warnings found one error found diff --git a/test/files/pos/t8708/Either_1.scala b/test/files/pos/t8708/Either_1.scala new file mode 100644 index 0000000000..000ed6e7c2 --- /dev/null +++ b/test/files/pos/t8708/Either_1.scala @@ -0,0 +1,6 @@ +sealed trait \/[+A, +B] + +sealed trait EitherT[F[+_], +A, +B] +object EitherT { + def apply[F[+_], A, B](a: F[A \/ B]): EitherT[F, A, B] = new EitherT[F, A, B] { val run = a } +} diff --git a/test/files/pos/t8708/Test_2.scala b/test/files/pos/t8708/Test_2.scala new file mode 100644 index 0000000000..d0e56b9a37 --- /dev/null +++ b/test/files/pos/t8708/Test_2.scala @@ -0,0 +1,13 @@ +import scala.language.higherKinds + +trait ClientTypes[M[+_]] { + final type Context[+A] = EitherT[M, String, A] + object Context { + def apply[A](ca: M[String \/ A]): Context[A] = EitherT[M, String, A](ca) + } + + final type StatefulContext[+A] = EitherT[Context, String, A] + object StatefulContext { + def apply[A](state: Context[String \/ A]): StatefulContext[A] = ??? + } +} diff --git a/test/files/run/colltest.check b/test/files/run/colltest.check index 46e4017eb6..9579d781aa 100644 --- a/test/files/run/colltest.check +++ b/test/files/run/colltest.check @@ -1,4 +1,4 @@ -warning: there were 2 deprecation warnings; re-run with -deprecation for details +warning: there were two deprecation warnings; re-run with -deprecation for details true false true diff --git a/test/files/run/inferred-type-constructors.check b/test/files/run/inferred-type-constructors.check index 67075a59a9..4a63853bd9 100644 --- a/test/files/run/inferred-type-constructors.check +++ b/test/files/run/inferred-type-constructors.check @@ -1,4 +1,4 @@ -warning: there were 2 feature warnings; re-run with -feature for details +warning: there were two feature warnings; re-run with -feature for details p.Iterable[Int] p.Set[Int] p.Seq[Int] diff --git a/test/files/run/names-defaults.check b/test/files/run/names-defaults.check index 97cfa4e520..25999c488a 100644 --- a/test/files/run/names-defaults.check +++ b/test/files/run/names-defaults.check @@ -1,7 +1,7 @@ names-defaults.scala:269: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses spawn(b = { val ttt = 1; ttt }, a = 0) ^ -warning: there were 4 deprecation warnings; re-run with -deprecation for details +warning: there were four deprecation warnings; re-run with -deprecation for details 1: @ get: $ get: 2 diff --git a/test/files/run/richs.check b/test/files/run/richs.check index bcaf8bdb8d..cf265ae007 100644 --- a/test/files/run/richs.check +++ b/test/files/run/richs.check @@ -1,4 +1,4 @@ -warning: there were 2 deprecation warnings; re-run with -deprecation for details +warning: there were two deprecation warnings; re-run with -deprecation for details RichCharTest1: true diff --git a/test/files/run/t2212.check b/test/files/run/t2212.check index f7e80439c7..1465f1341a 100644 --- a/test/files/run/t2212.check +++ b/test/files/run/t2212.check @@ -1,4 +1,4 @@ -warning: there were 2 deprecation warnings; re-run with -deprecation for details +warning: there were two deprecation warnings; re-run with -deprecation for details LinkedList(1) LinkedList(1) true diff --git a/test/files/run/t3996.check b/test/files/run/t3996.check index 2e8e558f88..a9ecc29fea 100644 --- a/test/files/run/t3996.check +++ b/test/files/run/t3996.check @@ -1 +1 @@ -warning: there were 2 deprecation warnings; re-run with -deprecation for details +warning: there were two deprecation warnings; re-run with -deprecation for details diff --git a/test/files/run/t4080.check b/test/files/run/t4080.check index c642cc67da..462e925b76 100644 --- a/test/files/run/t4080.check +++ b/test/files/run/t4080.check @@ -1,2 +1,2 @@ -warning: there were 3 deprecation warnings; re-run with -deprecation for details +warning: there were three deprecation warnings; re-run with -deprecation for details LinkedList(1, 0, 2, 3) diff --git a/test/files/run/t4461.check b/test/files/run/t4461.check index c44b0fc077..346993af6f 100644 --- a/test/files/run/t4461.check +++ b/test/files/run/t4461.check @@ -1,4 +1,4 @@ -warning: there were 4 deprecation warnings; re-run with -deprecation for details +warning: there were four deprecation warnings; re-run with -deprecation for details Include(End,1) Include(End,2) Include(End,3) diff --git a/test/files/run/t4813.check b/test/files/run/t4813.check index 2e8e558f88..a9ecc29fea 100644 --- a/test/files/run/t4813.check +++ b/test/files/run/t4813.check @@ -1 +1 @@ -warning: there were 2 deprecation warnings; re-run with -deprecation for details +warning: there were two deprecation warnings; re-run with -deprecation for details diff --git a/test/files/run/t6111.check b/test/files/run/t6111.check index 21a5b19ea0..5880658001 100644 --- a/test/files/run/t6111.check +++ b/test/files/run/t6111.check @@ -1,3 +1,3 @@ -warning: there were 2 deprecation warnings; re-run with -deprecation for details +warning: there were two deprecation warnings; re-run with -deprecation for details (8,8) (x,x) diff --git a/test/files/run/t6690.check b/test/files/run/t6690.check index 2e8e558f88..a9ecc29fea 100644 --- a/test/files/run/t6690.check +++ b/test/files/run/t6690.check @@ -1 +1 @@ -warning: there were 2 deprecation warnings; re-run with -deprecation for details +warning: there were two deprecation warnings; re-run with -deprecation for details diff --git a/test/files/run/t6863.check b/test/files/run/t6863.check index 37de2e6e51..d4df5f7a74 100644 --- a/test/files/run/t6863.check +++ b/test/files/run/t6863.check @@ -10,4 +10,4 @@ t6863.scala:46: warning: comparing values of types Unit and Unit using `==' will t6863.scala:59: warning: comparing values of types Unit and Unit using `==' will always yield true assert({ () => x }.apply == ()) ^ -warning: there were 4 deprecation warnings; re-run with -deprecation for details +warning: there were four deprecation warnings; re-run with -deprecation for details diff --git a/test/files/run/t8196.check b/test/files/run/t8196.check index f021a3619f..d11dc27e68 100644 --- a/test/files/run/t8196.check +++ b/test/files/run/t8196.check @@ -1,7 +1,7 @@ t8196.scala:26: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses form2.g1 // comment this line in order to make the test pass ^ -warning: there were 2 feature warnings; re-run with -feature for details +warning: there were two feature warnings; re-run with -feature for details Scope{ final private val f1: Int } diff --git a/test/files/run/t8549.check b/test/files/run/t8549.check index 2e8e558f88..a9ecc29fea 100644 --- a/test/files/run/t8549.check +++ b/test/files/run/t8549.check @@ -1 +1 @@ -warning: there were 2 deprecation warnings; re-run with -deprecation for details +warning: there were two deprecation warnings; re-run with -deprecation for details diff --git a/test/files/run/t8690.check b/test/files/run/t8690.check new file mode 100644 index 0000000000..72f076c4d8 --- /dev/null +++ b/test/files/run/t8690.check @@ -0,0 +1,2 @@ +non-empty iterator +abcdef diff --git a/test/files/run/t8690.scala b/test/files/run/t8690.scala new file mode 100644 index 0000000000..ab8b45b2a7 --- /dev/null +++ b/test/files/run/t8690.scala @@ -0,0 +1,12 @@ +import scala.io.Source +import java.io.ByteArrayInputStream + +object Test extends App { + val txt = "abcdef" + + val in = new ByteArrayInputStream(txt.getBytes()); + val source = Source.fromInputStream(in); + println(source.toString) // forces the BufferedSource to look at the head of the input + + println(source.mkString) // used to return "bcdef" ... +} diff --git a/test/files/run/t8708_b.check b/test/files/run/t8708_b.check new file mode 100644 index 0000000000..30be62a307 --- /dev/null +++ b/test/files/run/t8708_b.check @@ -0,0 +1,8 @@ +Scope{ + def <init>: <?>; + sealed abstract trait T extends ; + def foo: <?> +} +Scope{ + def f: <?> +} diff --git a/test/files/run/t8708_b/A_1.scala b/test/files/run/t8708_b/A_1.scala new file mode 100644 index 0000000000..e767420f9e --- /dev/null +++ b/test/files/run/t8708_b/A_1.scala @@ -0,0 +1,8 @@ +package p + +class C { + + sealed trait T { def f: Int } + + def foo: T = new T { def f = 1 } +} diff --git a/test/files/run/t8708_b/Test_2.scala b/test/files/run/t8708_b/Test_2.scala new file mode 100644 index 0000000000..c978490609 --- /dev/null +++ b/test/files/run/t8708_b/Test_2.scala @@ -0,0 +1,21 @@ +import scala.tools.partest._ +import java.io.{Console => _, _} + +object Test extends DirectTest { + + override def extraSettings: String = "-usejavacp -cp " + testOutput.path + + override def code = "" + + override def show(): Unit = { + val g = newCompiler() + withRun(g)(r => { + val c = g.rootMirror.getRequiredClass("p.C") + println(c.info.decls) + val t = c.info.member(g.newTypeName("T")) + // this test ensrues that the <local child> dummy class symbol is not entered in the + // scope of trait T during unpickling. + println(t.info.decls) + }) + } +} diff --git a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala index 45392de582..409f07037e 100644 --- a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala @@ -310,4 +310,16 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") { val cases = List(cq"a => b", cq"c => d") assertEqAst(q"{ case ..$cases }", "{ case a => b case c => d }") } + + property("SI-8609 a") = test { + val q1 = q"val x = 1" + val q2 = q"..$q1; val y = 2" + assert(q2 ≈ q"{ val x = 1; val y = 2 }") + } + + property("SI-8609 b") = test { + val q1 = q"import foo.bar" + val q2 = q"..$q1; val y = 2" + assert(q2 ≈ q"{ import foo.bar; val y = 2 }") + } } |