diff options
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/abstypetags_serialize.check | 4 | ||||
-rw-r--r-- | test/files/run/exprs_serialize.check | 21 | ||||
-rw-r--r-- | test/files/run/exprs_serialize.scala | 12 | ||||
-rw-r--r-- | test/files/run/macro-rangepos-subpatterns.check | 1 | ||||
-rw-r--r-- | test/files/run/macro-rangepos-subpatterns.flags | 1 | ||||
-rw-r--r-- | test/files/run/macro-rangepos-subpatterns/Macros_1.scala | 18 | ||||
-rw-r--r-- | test/files/run/macro-rangepos-subpatterns/Test_2.scala | 5 | ||||
-rw-r--r-- | test/files/run/names-defaults.check | 1 | ||||
-rw-r--r-- | test/files/run/names-defaults.scala | 4 | ||||
-rw-r--r-- | test/files/run/reflection-attachments.check | 0 | ||||
-rw-r--r-- | test/files/run/stringinterpolation_macro-run.check | 4 | ||||
-rw-r--r-- | test/files/run/stringinterpolation_macro-run.scala | 1 | ||||
-rw-r--r-- | test/files/run/t8608-no-format.scala | 15 | ||||
-rw-r--r-- | test/files/run/t8610.check | 7 | ||||
-rw-r--r-- | test/files/run/t8610.flags | 1 | ||||
-rw-r--r-- | test/files/run/t8610.scala | 13 | ||||
-rw-r--r-- | test/files/run/t8738.scala | 16 | ||||
-rw-r--r-- | test/files/run/typetags_serialize.check | 5 | ||||
-rw-r--r-- | test/files/run/typetags_serialize.scala | 5 |
19 files changed, 127 insertions, 7 deletions
diff --git a/test/files/run/abstypetags_serialize.check b/test/files/run/abstypetags_serialize.check index bddc4523e6..1b5e2ebddf 100644 --- a/test/files/run/abstypetags_serialize.check +++ b/test/files/run/abstypetags_serialize.check @@ -1,2 +1,2 @@ -java.io.NotSerializableException: Test$$typecreator1$1 -java.io.NotSerializableException: Test$$typecreator2$1 +WeakTypeTag[T] +WeakTypeTag[U[String]] diff --git a/test/files/run/exprs_serialize.check b/test/files/run/exprs_serialize.check index 20ad6c110c..551823ccdc 100644 --- a/test/files/run/exprs_serialize.check +++ b/test/files/run/exprs_serialize.check @@ -1,2 +1,19 @@ -java.io.NotSerializableException: Test$$treecreator1$1 -java.io.NotSerializableException: Test$$treecreator2$1 +Expr[Int(2)](2) +Expr[java.lang.String]({ + def foo = "hello"; + foo.$plus("world!") +}) +Expr[Boolean]({ + def foo(x: Int) = { + class Local extends AnyRef { + def <init>() = { + super.<init>(); + () + }; + val f = 2 + }; + val obj = new Local(); + x.$percent(obj.f).$eq$eq(0) + }; + foo(5) +}) diff --git a/test/files/run/exprs_serialize.scala b/test/files/run/exprs_serialize.scala index c4310b0fe1..91027803b4 100644 --- a/test/files/run/exprs_serialize.scala +++ b/test/files/run/exprs_serialize.scala @@ -26,4 +26,14 @@ object Test extends App { test(reify(2)) test(reify{def foo = "hello"; foo + "world!"}) -}
\ No newline at end of file + test(reify { + def foo(x: Int) = { + class Local { + val f = 2 + } + val obj = new Local + x % obj.f == 0 + } + foo(5) + }) +} diff --git a/test/files/run/macro-rangepos-subpatterns.check b/test/files/run/macro-rangepos-subpatterns.check new file mode 100644 index 0000000000..760e15d019 --- /dev/null +++ b/test/files/run/macro-rangepos-subpatterns.check @@ -0,0 +1 @@ +The width of the subpattern is: 2 diff --git a/test/files/run/macro-rangepos-subpatterns.flags b/test/files/run/macro-rangepos-subpatterns.flags new file mode 100644 index 0000000000..fcf951d907 --- /dev/null +++ b/test/files/run/macro-rangepos-subpatterns.flags @@ -0,0 +1 @@ +-Yrangepos
\ No newline at end of file diff --git a/test/files/run/macro-rangepos-subpatterns/Macros_1.scala b/test/files/run/macro-rangepos-subpatterns/Macros_1.scala new file mode 100644 index 0000000000..0f30862347 --- /dev/null +++ b/test/files/run/macro-rangepos-subpatterns/Macros_1.scala @@ -0,0 +1,18 @@ +import scala.reflect.macros.whitebox.Context +import language.experimental.macros + +object Extractor { + def unapply(x: Any): Any = macro unapplyImpl + def unapplyImpl(c: Context)(x: c.Tree) = { + import c.universe._ + import internal._ + val pos = subpatterns(x).get.head.pos + q""" + new { + def isEmpty = false + def get = ${"The width of the subpattern is: " + (pos.end - pos.start + 1)} + def unapply(x: Any) = this + }.unapply($x) + """ + } +} diff --git a/test/files/run/macro-rangepos-subpatterns/Test_2.scala b/test/files/run/macro-rangepos-subpatterns/Test_2.scala new file mode 100644 index 0000000000..7b076e6632 --- /dev/null +++ b/test/files/run/macro-rangepos-subpatterns/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends App { + 42 match { + case Extractor(a) => println(a) + } +} diff --git a/test/files/run/names-defaults.check b/test/files/run/names-defaults.check index 25999c488a..c358dc5849 100644 --- a/test/files/run/names-defaults.check +++ b/test/files/run/names-defaults.check @@ -124,3 +124,4 @@ List(1, 2) 3 3 (1,0), (1,2) +1 1 0 diff --git a/test/files/run/names-defaults.scala b/test/files/run/names-defaults.scala index 05cd4a540c..b7ed490cbc 100644 --- a/test/files/run/names-defaults.scala +++ b/test/files/run/names-defaults.scala @@ -401,6 +401,10 @@ object Test extends App { C4441a().copy() C4441b()().copy()() + // SI-8117 + def f8177(a: Int = 0, b: Int = 0, c: Int = 0) = s"$a $b $c" + println(f8177(a = 1, 1)) + // DEFINITIONS def test1(a: Int, b: String) = println(a +": "+ b) def test2(u: Int, v: Int)(k: String, l: Int) = println(l +": "+ k +", "+ (u + v)) diff --git a/test/files/run/reflection-attachments.check b/test/files/run/reflection-attachments.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/run/reflection-attachments.check diff --git a/test/files/run/stringinterpolation_macro-run.check b/test/files/run/stringinterpolation_macro-run.check index ead61e76ac..c7f46bac87 100644 --- a/test/files/run/stringinterpolation_macro-run.check +++ b/test/files/run/stringinterpolation_macro-run.check @@ -63,5 +63,9 @@ She is 4 feet tall. 05/26/12 05/26/12 % + mind +------ +matter + 7 7 9 7 9 9 diff --git a/test/files/run/stringinterpolation_macro-run.scala b/test/files/run/stringinterpolation_macro-run.scala index a6def98540..e18375d521 100644 --- a/test/files/run/stringinterpolation_macro-run.scala +++ b/test/files/run/stringinterpolation_macro-run.scala @@ -115,6 +115,7 @@ println(f"""${"1234"}%TD""") // literals and arg indexes println(f"%%") +println(f" mind%n------%nmatter%n") println(f"${7}%d %<d ${9}%d") println(f"${7}%d %2$$d ${9}%d") diff --git a/test/files/run/t8608-no-format.scala b/test/files/run/t8608-no-format.scala new file mode 100644 index 0000000000..71c369a7ea --- /dev/null +++ b/test/files/run/t8608-no-format.scala @@ -0,0 +1,15 @@ + +import scala.tools.partest.JavapTest + +object Test extends JavapTest { + def code = """ + |f"hello, world" + |:javap -prv - + """.stripMargin + + // no format + override def yah(res: Seq[String]) = { + // note: avoid the word "information" + res forall (!_.contains("StringOps.format")) + } +} diff --git a/test/files/run/t8610.check b/test/files/run/t8610.check new file mode 100644 index 0000000000..b3ab7a9cef --- /dev/null +++ b/test/files/run/t8610.check @@ -0,0 +1,7 @@ +t8610.scala:6: warning: Adapting argument list by creating a 2-tuple: this may not be what you want. + signature: X.f(p: (Int, Int)): Int + given arguments: 3, 4 + after adaptation: X.f((3, 4): (Int, Int)) + def g = f(3, 4) // adapted + ^ +Hi, $name diff --git a/test/files/run/t8610.flags b/test/files/run/t8610.flags new file mode 100644 index 0000000000..4195dec383 --- /dev/null +++ b/test/files/run/t8610.flags @@ -0,0 +1 @@ +-Xlint:adapted-args diff --git a/test/files/run/t8610.scala b/test/files/run/t8610.scala new file mode 100644 index 0000000000..dd9e8e861e --- /dev/null +++ b/test/files/run/t8610.scala @@ -0,0 +1,13 @@ + +// flags don't warn on u +case class X(name: String) { + def x = "Hi, $name" // missing interp + def f(p: (Int, Int)): Int = p._1 * p._2 + def g = f(3, 4) // adapted + def u: Unit = () // unitarian universalist +} + +object Test extends App { + // poignant demonstration + Console println X("Bob").x +} diff --git a/test/files/run/t8738.scala b/test/files/run/t8738.scala new file mode 100644 index 0000000000..6898301db7 --- /dev/null +++ b/test/files/run/t8738.scala @@ -0,0 +1,16 @@ +object Test { + def check(a: Range, b: Range) = (a == b) == (a.toList == b.toList) + def main(args: Array[String]) { + val lo = -2 to 2 + val hi = lo + val step = List(-6,-2,-1,1,2,6) + for (i <- lo; j <- hi; n <- step; k <- lo; l <- hi; m <- step) { + assert( + check(i until j by n, k until l by m) && + check(i until j by n, k to l by m) && + check(i to j by n, k until l by m) && + check(i to j by n, k to l by m) + ) + } + } +} diff --git a/test/files/run/typetags_serialize.check b/test/files/run/typetags_serialize.check index f79436ea5d..22928a2e94 100644 --- a/test/files/run/typetags_serialize.check +++ b/test/files/run/typetags_serialize.check @@ -1,2 +1,3 @@ -java.io.NotSerializableException: scala.reflect.api.TypeTags$PredefTypeCreator -java.io.NotSerializableException: Test$$typecreator1$1 +TypeTag[Int] +TypeTag[String] +TypeTag[Test.C[Double]] diff --git a/test/files/run/typetags_serialize.scala b/test/files/run/typetags_serialize.scala index 3c842e6cc9..a7a7845232 100644 --- a/test/files/run/typetags_serialize.scala +++ b/test/files/run/typetags_serialize.scala @@ -4,6 +4,10 @@ import scala.reflect.runtime.{universe => ru} import scala.reflect.runtime.{currentMirror => cm} object Test extends App { + class C[A] { + def m(a: A): Int = 5 + } + def test(tag: TypeTag[_]) = try { val fout = new ByteArrayOutputStream() @@ -26,4 +30,5 @@ object Test extends App { test(implicitly[TypeTag[Int]]) test(implicitly[TypeTag[String]]) + test(implicitly[TypeTag[C[Double]]]) }
\ No newline at end of file |