summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-07-13 12:08:20 -0700
committerPaul Phillips <paulp@improving.org>2012-07-13 12:08:20 -0700
commit453b7068ed4294eef18bf10a321a5b63497c7466 (patch)
tree8cfc64ec934fdf15d7665208a366611ce9474855 /test/files/run
parent724b0dc71f1f8f91b995d01e9e027789f54ecdfe (diff)
parent3d0099dbc990ab914de5b9deb5087d9d3fb6220c (diff)
downloadscala-453b7068ed4294eef18bf10a321a5b63497c7466.tar.gz
scala-453b7068ed4294eef18bf10a321a5b63497c7466.tar.bz2
scala-453b7068ed4294eef18bf10a321a5b63497c7466.zip
Merge branch '2.10.x' into topic/name-implicits
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/reflect-resolveoverload-bynameparam.scala32
-rw-r--r--test/files/run/reflect-resolveoverload-expected.scala43
-rw-r--r--test/files/run/reflect-resolveoverload-invalid.scala43
-rw-r--r--test/files/run/reflect-resolveoverload-named.scala26
-rw-r--r--test/files/run/reflect-resolveoverload-targs.scala29
-rw-r--r--test/files/run/reflect-resolveoverload-tparm-substitute.scala77
-rw-r--r--test/files/run/reflect-resolveoverload-variadic.scala27
-rw-r--r--test/files/run/reflect-resolveoverload1.scala (renamed from test/files/run/reflect-overload.scala)4
-rw-r--r--test/files/run/reflect-resolveoverload2.scala40
-rw-r--r--test/files/run/reflection-magicsymbols.check22
-rw-r--r--test/files/run/reflection-magicsymbols.scala11
-rw-r--r--test/files/run/stringinterpolation_macro-run.check62
-rw-r--r--test/files/run/stringinterpolation_macro-run.scala103
-rw-r--r--test/files/run/t3613.scala2
-rw-r--r--test/files/run/t5974.check1
-rw-r--r--test/files/run/t5974.scala10
16 files changed, 529 insertions, 3 deletions
diff --git a/test/files/run/reflect-resolveoverload-bynameparam.scala b/test/files/run/reflect-resolveoverload-bynameparam.scala
new file mode 100644
index 0000000000..7fb8c82ab8
--- /dev/null
+++ b/test/files/run/reflect-resolveoverload-bynameparam.scala
@@ -0,0 +1,32 @@
+
+class A
+class B extends A
+
+class C {
+ def foo(x: => Int)(y: String) = x
+ def foo(x: String)(y: List[_]) = x
+ def foo(x: => A)(y: Array[_]) = 1
+ def foo(x: A)(y: Seq[_]) = 2
+ def foo(x: B)(y: Map[_, _]) = 4
+}
+
+object Test extends App {
+ val cm = reflect.runtime.currentMirror
+ val u = cm.universe
+ val c = new C
+ val im = cm.reflect(c)
+ val t = u.typeOf[C] member u.newTermName("foo") asTermSymbol
+ val f1 = t.resolveOverloaded(posVargs = List(u.typeOf[Int])) asMethodSymbol
+ val f2 = t.resolveOverloaded(posVargs = List(u.typeOf[String])) asMethodSymbol
+ val f3 = t.resolveOverloaded(posVargs = List(u.typeOf[A])) asMethodSymbol
+ val f4 = t.resolveOverloaded(posVargs = List(u.typeOf[B])) asMethodSymbol
+ val m1 = im.reflectMethod(f1)
+ val m2 = im.reflectMethod(f2)
+ val m3 = im.reflectMethod(f3)
+ val m4 = im.reflectMethod(f4)
+ assert(m1(() => 1, null) == c.foo(1)(null))
+ assert(m2("a", null) == c.foo("a")(null))
+ assert(m3(new A, null) == c.foo(new A)(null))
+ assert(m4(new B, null) == c.foo(new B)(null))
+}
+
diff --git a/test/files/run/reflect-resolveoverload-expected.scala b/test/files/run/reflect-resolveoverload-expected.scala
new file mode 100644
index 0000000000..1378090309
--- /dev/null
+++ b/test/files/run/reflect-resolveoverload-expected.scala
@@ -0,0 +1,43 @@
+
+class A {
+ override def equals(x: Any) = {
+ x.isInstanceOf[A] && !x.isInstanceOf[B]
+ }
+}
+class B extends A {
+ override def equals(x: Any) = {
+ x.isInstanceOf[B]
+ }
+}
+
+class C {
+ def a(x: String) = 1
+ def a(x: Array[_]) = "a"
+ def b(x: String) = new A
+ def b(x: Array[_]) = new B
+ def c(x: String) = new B
+ def c(x: Array[_]) = "a"
+}
+
+object Test extends App {
+ val cm = reflect.runtime.currentMirror
+ val u = cm.universe
+ val c = new C
+ val im = cm.reflect(c)
+ def invoke(s: String, expectedType: u.Type, expectedResult: Any) {
+ val ol = (u.typeOf[C] member u.newTermName(s)).asTermSymbol
+ val methodSym = ol.resolveOverloaded(posVargs = List(u.typeOf[Null]), expected = expectedType).asMethodSymbol
+ val sig = methodSym.typeSignature.asInstanceOf[u.MethodType]
+ val method = im.reflectMethod(methodSym)
+ assert(method(null) == expectedResult)
+ }
+
+ invoke("a", u.typeOf[Int], c.a(null): Int)
+ invoke("a", u.typeOf[String], c.a(null): String)
+ invoke("b", u.typeOf[B], c.b(null): B)
+ invoke("c", u.typeOf[A], c.c(null): A)
+ invoke("c", u.typeOf[A], c.c(null): A)
+ invoke("c", u.typeOf[B], c.c(null): B)
+ invoke("c", u.typeOf[String], c.c(null): String)
+
+}
diff --git a/test/files/run/reflect-resolveoverload-invalid.scala b/test/files/run/reflect-resolveoverload-invalid.scala
new file mode 100644
index 0000000000..def28ccbb4
--- /dev/null
+++ b/test/files/run/reflect-resolveoverload-invalid.scala
@@ -0,0 +1,43 @@
+
+class A
+class B extends A
+
+class C {
+ def a(x: Int) = 1
+ def a(x: String) = 2
+ def b(x: B) = 3
+ def c(x: A, y: B) = 4
+ def c(x: B, y: A) = 5
+ def d[T](x: Int) = 6
+ def d(x: String) = 7
+ def e(x: A) = 8
+ def e(x: =>B) = 9
+}
+
+object Test extends App {
+ val cm = reflect.runtime.currentMirror
+ val u = cm.universe
+
+ val x = new C
+ val t = u.typeOf[C]
+
+ val a = t member u.newTermName("a") asTermSymbol
+ val b = t member u.newTermName("b") asTermSymbol
+ val c = t member u.newTermName("c") asTermSymbol
+ val d = t member u.newTermName("d") asTermSymbol
+ val e = t member u.newTermName("e") asTermSymbol
+
+ val n1 = a.resolveOverloaded(posVargs = List(u.typeOf[Char]))
+ val n2 = b.resolveOverloaded(posVargs = List(u.typeOf[A]))
+ val n3 = c.resolveOverloaded(posVargs = List(u.typeOf[B], u.typeOf[B]))
+ val n4 = d.resolveOverloaded(targs = List(u.typeOf[Int]))
+ val n5 = d.resolveOverloaded()
+ val n6 = e.resolveOverloaded(posVargs = List(u.typeOf[B]))
+
+ assert(n1 == u.NoSymbol)
+ assert(n2 == u.NoSymbol)
+ assert(n3 == u.NoSymbol)
+ assert(n4 == u.NoSymbol)
+ assert(n5 == u.NoSymbol)
+ assert(n6 == u.NoSymbol)
+}
diff --git a/test/files/run/reflect-resolveoverload-named.scala b/test/files/run/reflect-resolveoverload-named.scala
new file mode 100644
index 0000000000..017ec85c0d
--- /dev/null
+++ b/test/files/run/reflect-resolveoverload-named.scala
@@ -0,0 +1,26 @@
+
+class A {
+ def foo(x: String, y: Int) = 1
+ def foo(x: Int, y: String) = 2
+}
+
+object Test extends App {
+ val cm = reflect.runtime.currentMirror
+ val u = cm.universe
+ val a = new A
+ val im = cm.reflect(a)
+ val tpe = u.typeOf[A]
+ val overloaded = tpe member u.newTermName("foo") asTermSymbol
+ val ms1 =
+ overloaded resolveOverloaded(nameVargs = Seq((u.newTermName("x"), u.typeOf[String]), (u.newTermName("y"), u.typeOf[Int])))
+ val ms2 =
+ overloaded resolveOverloaded(nameVargs = Seq((u.newTermName("y"), u.typeOf[Int]), (u.newTermName("x"), u.typeOf[String])))
+ val ms3 =
+ overloaded resolveOverloaded(nameVargs = Seq((u.newTermName("x"), u.typeOf[Int]), (u.newTermName("y"), u.typeOf[String])))
+ val ms4 =
+ overloaded resolveOverloaded(nameVargs = Seq((u.newTermName("y"), u.typeOf[String]), (u.newTermName("x"), u.typeOf[Int])))
+ assert(im.reflectMethod(ms1 asMethodSymbol)("A", 1) == 1)
+ assert(im.reflectMethod(ms2 asMethodSymbol)("A", 1) == 1)
+ assert(im.reflectMethod(ms3 asMethodSymbol)(1, "A") == 2)
+ assert(im.reflectMethod(ms4 asMethodSymbol)(1, "A") == 2)
+}
diff --git a/test/files/run/reflect-resolveoverload-targs.scala b/test/files/run/reflect-resolveoverload-targs.scala
new file mode 100644
index 0000000000..888b2f0c15
--- /dev/null
+++ b/test/files/run/reflect-resolveoverload-targs.scala
@@ -0,0 +1,29 @@
+
+import reflect.runtime.{universe=>u}
+import scala.reflect.runtime.{currentMirror => cm}
+
+class C {
+ def foo[T: u.TypeTag](x: String) = 1
+ def foo[T: u.TypeTag, S: u.TypeTag](x: String) = 2
+}
+
+object Test extends App {
+ val c = new C
+ val im = cm.reflect(c)
+ val foo = u.typeOf[C] member u.newTermName("foo") asTermSymbol
+ val f1 = foo.resolveOverloaded(
+ targs = Seq(u.typeOf[Int]),
+ posVargs = Seq(u.typeOf[String])
+ )
+
+ val f2 = foo.resolveOverloaded(
+ targs = Seq(u.typeOf[Int],
+ u.typeOf[Int]), posVargs = Seq(u.typeOf[String])
+ )
+
+ val m1 = im.reflectMethod(f1 asMethodSymbol)
+ val m2 = im.reflectMethod(f2 asMethodSymbol)
+
+ assert(m1("a", u.typeTag[Int]) == c.foo[Int]("a"))
+ assert(m2("a", u.typeTag[Int], u.typeTag[Int]) == c.foo[Int, Int]("a"))
+}
diff --git a/test/files/run/reflect-resolveoverload-tparm-substitute.scala b/test/files/run/reflect-resolveoverload-tparm-substitute.scala
new file mode 100644
index 0000000000..22e7bcd40a
--- /dev/null
+++ b/test/files/run/reflect-resolveoverload-tparm-substitute.scala
@@ -0,0 +1,77 @@
+
+class A
+class B extends A
+
+class C {
+ def foo[T](x: T) = x
+ def foo(x: Int) = "a"
+ def foo(x: A) = x
+}
+
+object Test extends App {
+ val cm = reflect.runtime.currentMirror
+ val u = cm.universe
+ val c = new C
+ val im = cm.reflect(c)
+ val term = u.typeOf[C] member u.newTermName("foo") asTermSymbol
+
+ val f1 = term.resolveOverloaded(
+ posVargs = List(u.typeOf[Int]),
+ expected = u.typeOf[String]
+ )
+
+ val f2 = term.resolveOverloaded(
+ targs = List(u.typeOf[String]),
+ posVargs = List(u.typeOf[String]),
+ expected = u.typeOf[String]
+ )
+
+ val f3 = term.resolveOverloaded(
+ posVargs = List(u.typeOf[A]),
+ expected = u.typeOf[A]
+ )
+
+ val f4 = term.resolveOverloaded(
+ targs = List(u.typeOf[A]),
+ posVargs = List(u.typeOf[A]),
+ expected = u.typeOf[A]
+ )
+
+ val f5 = term.resolveOverloaded(
+ targs = List(u.typeOf[B]),
+ posVargs = List(u.typeOf[B]),
+ expected = u.typeOf[B]
+ )
+
+ val f6 = term.resolveOverloaded(
+ targs = List(u.typeOf[B]),
+ posVargs = List(u.typeOf[B]),
+ expected = u.typeOf[A]
+ )
+
+ val f7 = term.resolveOverloaded(
+ targs = List(u.typeOf[A]),
+ posVargs = List(u.typeOf[B]),
+ expected = u.typeOf[A]
+ )
+
+ val m1 = im.reflectMethod(f1 asMethodSymbol)
+ val m2 = im.reflectMethod(f2 asMethodSymbol)
+ val m3 = im.reflectMethod(f3 asMethodSymbol)
+ val m4 = im.reflectMethod(f4 asMethodSymbol)
+ val m5 = im.reflectMethod(f5 asMethodSymbol)
+ val m6 = im.reflectMethod(f6 asMethodSymbol)
+ val m7 = im.reflectMethod(f7 asMethodSymbol)
+
+ val a = new A
+ val b = new B
+ assert(m1(2) == (c.foo(2): String))
+ assert(m2("xyz") == (c.foo[String]("xyz"): String))
+ assert(m3(a) == (c.foo(a): A))
+ assert(m4(a) == (c.foo[A](a): A))
+ assert(m5(b) == (c.foo[B](b): B))
+ assert(m6(b) == (c.foo[B](b): A))
+ assert(m7(b) == (c.foo[A](b): A))
+
+
+}
diff --git a/test/files/run/reflect-resolveoverload-variadic.scala b/test/files/run/reflect-resolveoverload-variadic.scala
new file mode 100644
index 0000000000..8e2e15600f
--- /dev/null
+++ b/test/files/run/reflect-resolveoverload-variadic.scala
@@ -0,0 +1,27 @@
+
+class C {
+ def foo(x: Int*) = 1 + x.sum
+ def foo(x: String) = 2
+}
+
+object Test extends App {
+ val cm = reflect.runtime.currentMirror
+ val u = cm.universe
+ val c = new C
+ val im = cm.reflect(c)
+ val foo = u.typeOf[C] member u.newTermName("foo") asTermSymbol
+ val f0 = foo.resolveOverloaded()
+ val f1 = foo.resolveOverloaded(posVargs = Seq(u.typeOf[Int]))
+ val f2 = foo.resolveOverloaded(posVargs = Seq(u.typeOf[Int], u.typeOf[Int]))
+ val f3 = foo.resolveOverloaded(posVargs = Seq(u.typeOf[String]))
+
+ val m0 = im.reflectMethod(f0 asMethodSymbol)
+ val m1 = im.reflectMethod(f1 asMethodSymbol)
+ val m2 = im.reflectMethod(f2 asMethodSymbol)
+ val m3 = im.reflectMethod(f3 asMethodSymbol)
+
+ assert(m0(Seq()) == c.foo())
+ assert(m1(Seq(1)) == c.foo(1))
+ assert(m2(Seq(4, 9)) == c.foo(4, 9))
+ assert(m3("abc") == c.foo("abc"))
+}
diff --git a/test/files/run/reflect-overload.scala b/test/files/run/reflect-resolveoverload1.scala
index 870a200813..a859a0ec4e 100644
--- a/test/files/run/reflect-overload.scala
+++ b/test/files/run/reflect-resolveoverload1.scala
@@ -9,11 +9,11 @@ object Test extends App {
val st = sc.asType
val meth = (st member newTermName("indexOf")).asTermSymbol
val IntType = definitions.IntClass.asType
- val indexOf = (meth resolveOverloaded(actuals = List(IntType))).asMethodSymbol
+ val indexOf = (meth resolveOverloaded(posVargs = List(IntType))).asMethodSymbol
assert(m.reflectMethod(indexOf)('w') == 6)
assert((m.reflectMethod(indexOf)('w') match { case x: Int => x }) == 6)
val meth2 = (st member newTermName("substring")).asTermSymbol
- val substring = (meth2 resolveOverloaded(actuals = List(IntType, IntType))).asMethodSymbol
+ val substring = (meth2 resolveOverloaded(posVargs = List(IntType, IntType))).asMethodSymbol
assert(m.reflectMethod(substring)(2, 6) == "llo ")
}
diff --git a/test/files/run/reflect-resolveoverload2.scala b/test/files/run/reflect-resolveoverload2.scala
new file mode 100644
index 0000000000..b5f719814b
--- /dev/null
+++ b/test/files/run/reflect-resolveoverload2.scala
@@ -0,0 +1,40 @@
+class A
+class B extends A
+
+class C {
+ def a(x: Int) = 1
+ def a(x: String) = 2
+ //def b(x: => Int)(s: String) = 1
+ //def b(x: => String)(a: Array[_]) = 2
+ def c(x: A) = 1
+ def c(x: B) = 2
+ //def d(x: => A)(s: String) = 1
+ //def d(x: => B)(a: Array[_]) = 2
+ def e(x: A) = 1
+ def e(x: B = new B) = 2
+}
+
+object Test extends App {
+ val cm = reflect.runtime.currentMirror
+ val u = cm.universe
+ val c = new C
+ val im = cm.reflect(c)
+ def invoke(s: String, arg: Any, argType: u.Type): Int = {
+ val ol = u.typeOf[C] member u.newTermName(s) asTermSymbol
+ val methodSym = ol.resolveOverloaded(posVargs = List(argType)) asMethodSymbol
+ val sig = methodSym.typeSignature.asInstanceOf[u.MethodType]
+ val method = im.reflectMethod(methodSym)
+ if (sig.resultType.kind == "MethodType") method(arg, null).asInstanceOf[Int]
+ else method(arg).asInstanceOf[Int]
+ }
+ assert(c.a(1) == invoke("a", 1, u.typeOf[Int]))
+ assert(c.a("a") == invoke("a", "a", u.typeOf[String]))
+ //assert(c.b(1)(null) == invoke("b", 1, u.typeOf[Int]))
+ //assert(c.b("a")(null) == invoke("b", "a", u.typeOf[String]))
+ assert(c.c(new A) == invoke("c", new A, u.typeOf[A]))
+ assert(c.c(new B) == invoke("c", new B, u.typeOf[B]))
+ //assert(c.d(new A)(null) == invoke("d", new A, u.typeOf[A]))
+ //assert(c.d(new B)(null) == invoke("d", new B, u.typeOf[B]))
+ assert(c.e(new A) == invoke("e", new A, u.typeOf[A]))
+ assert(c.e(new B) == invoke("e", new B, u.typeOf[B]))
+}
diff --git a/test/files/run/reflection-magicsymbols.check b/test/files/run/reflection-magicsymbols.check
new file mode 100644
index 0000000000..2600847d99
--- /dev/null
+++ b/test/files/run/reflection-magicsymbols.check
@@ -0,0 +1,22 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala>
+
+scala> import scala.reflect.runtime.universe._
+import scala.reflect.runtime.universe._
+
+scala> class A { def foo(x: Int*) = 1 }
+defined class A
+
+scala> val sig = typeOf[A] member newTermName("foo") typeSignature
+warning: there were 1 feature warnings; re-run with -feature for details
+sig: reflect.runtime.universe.Type = (x: <?>)scala.Int
+
+scala> val x = sig.asInstanceOf[MethodType].params.head
+x: reflect.runtime.universe.Symbol = value x
+
+scala> println(x.typeSignature)
+scala.Int*
+
+scala>
diff --git a/test/files/run/reflection-magicsymbols.scala b/test/files/run/reflection-magicsymbols.scala
new file mode 100644
index 0000000000..a40845d6ac
--- /dev/null
+++ b/test/files/run/reflection-magicsymbols.scala
@@ -0,0 +1,11 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ def code = """
+ |import scala.reflect.runtime.universe._
+ |class A { def foo(x: Int*) = 1 }
+ |val sig = typeOf[A] member newTermName("foo") typeSignature
+ |val x = sig.asInstanceOf[MethodType].params.head
+ |println(x.typeSignature)
+ |""".stripMargin
+}
diff --git a/test/files/run/stringinterpolation_macro-run.check b/test/files/run/stringinterpolation_macro-run.check
new file mode 100644
index 0000000000..be62c5780b
--- /dev/null
+++ b/test/files/run/stringinterpolation_macro-run.check
@@ -0,0 +1,62 @@
+false
+false
+true
+false
+true
+FALSE
+FALSE
+TRUE
+FALSE
+TRUE
+true
+false
+null
+0
+80000000
+4c01926
+NULL
+4C01926
+null
+NULL
+Scala
+SCALA
+5
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+x
+S
+120
+120
+120
+120
+120
+120
+120
+120
+120
+120
+120
+120
+120
+42
+3.400000e+00
+3.400000e+00
+3.400000e+00
+3.400000e+00
+3.400000e+00
+3.400000e+00
+3.000000e+00
+3.000000e+00
+05/26/12
+05/26/12
+05/26/12
+05/26/12
diff --git a/test/files/run/stringinterpolation_macro-run.scala b/test/files/run/stringinterpolation_macro-run.scala
new file mode 100644
index 0000000000..9c59c334f8
--- /dev/null
+++ b/test/files/run/stringinterpolation_macro-run.scala
@@ -0,0 +1,103 @@
+object Test extends App {
+
+// 'b' / 'B' (category: general)
+// -----------------------------
+println(f"${null}%b")
+println(f"${false}%b")
+println(f"${true}%b")
+println(f"${new java.lang.Boolean(false)}%b")
+println(f"${new java.lang.Boolean(true)}%b")
+
+println(f"${null}%B")
+println(f"${false}%B")
+println(f"${true}%B")
+println(f"${new java.lang.Boolean(false)}%B")
+println(f"${new java.lang.Boolean(true)}%B")
+
+implicit val stringToBoolean = java.lang.Boolean.parseBoolean(_: String)
+println(f"${"true"}%b")
+println(f"${"false"}%b")
+
+// 'h' | 'H' (category: general)
+// -----------------------------
+println(f"${null}%h")
+println(f"${0.0}%h")
+println(f"${-0.0}%h")
+println(f"${"Scala"}%h")
+
+println(f"${null}%H")
+println(f"${"Scala"}%H")
+
+// 's' | 'S' (category: general)
+// -----------------------------
+println(f"${null}%s")
+println(f"${null}%S")
+println(f"${"Scala"}%s")
+println(f"${"Scala"}%S")
+println(f"${5}")
+
+// 'c' | 'C' (category: character)
+// -------------------------------
+println(f"${120:Char}%c")
+println(f"${120:Byte}%c")
+println(f"${120:Short}%c")
+println(f"${120:Int}%c")
+println(f"${new java.lang.Character('x')}%c")
+println(f"${new java.lang.Byte(120:Byte)}%c")
+println(f"${new java.lang.Short(120:Short)}%c")
+println(f"${new java.lang.Integer(120)}%c")
+
+println(f"${'x' : java.lang.Character}%c")
+println(f"${(120:Byte) : java.lang.Byte}%c")
+println(f"${(120:Short) : java.lang.Short}%c")
+println(f"${120 : java.lang.Integer}%c")
+
+implicit val stringToChar = (x: String) => x(0)
+println(f"${"Scala"}%c")
+
+// 'd' | 'o' | 'x' | 'X' (category: integral)
+// ------------------------------------------
+println(f"${120:Byte}%d")
+println(f"${120:Short}%d")
+println(f"${120:Int}%d")
+println(f"${120:Long}%d")
+println(f"${new java.lang.Byte(120:Byte)}%d")
+println(f"${new java.lang.Short(120:Short)}%d")
+println(f"${new java.lang.Integer(120)}%d")
+println(f"${new java.lang.Long(120)}%d")
+println(f"${120 : java.lang.Integer}%d")
+println(f"${120 : java.lang.Long}%d")
+println(f"${BigInt(120)}%d")
+println(f"${new java.math.BigInteger("120")}%d")
+
+{
+ implicit val strToShort = (s: String) => java.lang.Short.parseShort(s)
+ println(f"${"120"}%d")
+ implicit val strToInt = (s: String) => 42
+ println(f"${"120"}%d")
+}
+
+// 'e' | 'E' | 'g' | 'G' | 'f' | 'a' | 'A' (category: floating point)
+// ------------------------------------------------------------------
+println(f"${3.4f}%e")
+println(f"${3.4}%e")
+println(f"${3.4f : java.lang.Float}%e")
+println(f"${3.4 : java.lang.Double}%e")
+println(f"${BigDecimal(3.4)}%e")
+println(f"${new java.math.BigDecimal(3.4)}%e")
+println(f"${3}%e")
+println(f"${3L}%e")
+
+// 't' | 'T' (category: date/time)
+// -------------------------------
+import java.util.Calendar
+import java.util.Locale
+val c = Calendar.getInstance(Locale.US)
+c.set(2012, Calendar.MAY, 26)
+println(f"${c}%TD")
+println(f"${c.getTime}%TD")
+println(f"${c.getTime.getTime}%TD")
+
+implicit val strToDate = (x: String) => c
+println(f"""${"1234"}%TD""")
+}
diff --git a/test/files/run/t3613.scala b/test/files/run/t3613.scala
index c3b249571b..171a6a21aa 100644
--- a/test/files/run/t3613.scala
+++ b/test/files/run/t3613.scala
@@ -8,7 +8,7 @@ class Boopy {
case "Boopy" => fireIntervalAdded( model, 0, 1 )
}
def getSize = 0
- def getElementAt( idx: Int ) : AnyRef = "egal"
+ def getElementAt( idx: Int ) = ???
}
}
diff --git a/test/files/run/t5974.check b/test/files/run/t5974.check
new file mode 100644
index 0000000000..9766475a41
--- /dev/null
+++ b/test/files/run/t5974.check
@@ -0,0 +1 @@
+ok
diff --git a/test/files/run/t5974.scala b/test/files/run/t5974.scala
new file mode 100644
index 0000000000..5b99e9f721
--- /dev/null
+++ b/test/files/run/t5974.scala
@@ -0,0 +1,10 @@
+object Test extends App {
+ import scala.collection.JavaConverters._
+
+ def ser(a: AnyRef) =
+ (new java.io.ObjectOutputStream(new java.io.ByteArrayOutputStream())).writeObject(a)
+
+ val l = java.util.Arrays.asList("pigdog").asScala
+ ser(l)
+ println("ok")
+}