summaryrefslogtreecommitdiff
path: root/test/pending
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2015-07-01 13:53:37 +0200
committerAdriaan Moors <adriaan.moors@typesafe.com>2015-07-01 11:56:35 -0700
commitbf951ec134e8ee2fcfc28152b6d72ddb2c42b988 (patch)
tree44d0af6e25b7d5ee14f0a3cf0715c1db7d6ce632 /test/pending
parentc58f4e4a85ddf9a6d9441b94b1acdccab2d105b4 (diff)
downloadscala-bf951ec134e8ee2fcfc28152b6d72ddb2c42b988.tar.gz
scala-bf951ec134e8ee2fcfc28152b6d72ddb2c42b988.tar.bz2
scala-bf951ec134e8ee2fcfc28152b6d72ddb2c42b988.zip
Fix some tests, move others to pending/
Move run/t8960 to pending It tests the serialVersionUID field on closure classes. The field doesn't exist for indyLambda closures. See https://issues.scala-lang.org/browse/SI-9373 Move some reify tests to pending They fail at runtime in GenBCode since scala is built with indyLambda enabled: java.lang.AssertionError: assertion failed: Bad superClass for trait JFunction1: class Any at scala.tools.nsc.Global.assert(Global.scala:261) at scala.tools.nsc.backend.jvm.BTypesFromSymbols.setClassInfo(BTypesFromSymbols.scala:228) Noted in https://issues.scala-lang.org/browse/SI-9374 force t6546 to GenASM - no closure elimination in GenBCode yet Noted in https://issues.scala-lang.org/browse/SI-9364. Fix or disable some tests that fail because of the old optimizer The old inliner fails more often when the library is built with indylambda. Noted in https://issues.scala-lang.org/browse/SI-9374. Example: List.foreach ➜ sandbox git:(jfun) ✗ qs -Ybackend:GenASM -optimize -Yinline-warnings Welcome to Scala version 2.12.0-20150630-220939-1cb032d806 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45). Type in expressions to have them evaluated. Type :help for more information. scala> List(1,2,3).foreach(x => x + 1) <console>:11: warning: Could not inline required method foreach because bytecode unavailable. List(1,2,3).foreach(x => x + 1) ^ <console>:11: warning: At the end of the day, could not inline @inline-marked method foreach List(1,2,3).foreach(x => x + 1) ^ Upate a number of tests for having indyLambda enabled The delambdafyLambdaClassNames tests was removed, there's nothing to tests with indyLambda.
Diffstat (limited to 'test/pending')
-rw-r--r--test/pending/run/private-inline.check13
-rw-r--r--test/pending/run/private-inline.flags1
-rw-r--r--test/pending/run/private-inline.scala52
-rw-r--r--test/pending/run/reify_csv.check10
-rw-r--r--test/pending/run/reify_csv.scala36
-rw-r--r--test/pending/run/reify_for1.scala10
-rw-r--r--test/pending/run/reify_fors_newpatmat.check5
-rw-r--r--test/pending/run/reify_fors_newpatmat.scala101
-rw-r--r--test/pending/run/reify_fors_oldpatmat.check5
-rw-r--r--test/pending/run/reify_fors_oldpatmat.scala101
-rw-r--r--test/pending/run/reify_newimpl_51.check3
-rw-r--r--test/pending/run/reify_newimpl_51.scala18
-rw-r--r--test/pending/run/reify_newimpl_52.check3
-rw-r--r--test/pending/run/reify_newimpl_52.scala18
-rw-r--r--test/pending/run/reify_properties.check2
-rw-r--r--test/pending/run/reify_properties.scala57
-rw-r--r--test/pending/run/reify_sort1.check2
-rw-r--r--test/pending/run/reify_sort1.scala21
-rw-r--r--test/pending/run/t8960.scala72
19 files changed, 530 insertions, 0 deletions
diff --git a/test/pending/run/private-inline.check b/test/pending/run/private-inline.check
new file mode 100644
index 0000000000..e71aec2fcf
--- /dev/null
+++ b/test/pending/run/private-inline.check
@@ -0,0 +1,13 @@
+private-inline.scala:24: warning: Could not inline required method wrapper1 because callee contains exception handlers / finally clause, and is invoked with non-empty operand stack.
+ def f1b() = identity(wrapper1(5))
+ ^
+private-inline.scala:24: warning: At the end of the day, could not inline @inline-marked method wrapper1
+ def f1b() = identity(wrapper1(5))
+ ^
+private-inline.scala:29: warning: Could not inline required method wrapper2 because callee contains exception handlers / finally clause, and is invoked with non-empty operand stack.
+ def f2b() = identity(wrapper2(5))
+ ^
+private-inline.scala:29: warning: At the end of the day, could not inline @inline-marked method wrapper2
+ def f2b() = identity(wrapper2(5))
+ ^
+20
diff --git a/test/pending/run/private-inline.flags b/test/pending/run/private-inline.flags
new file mode 100644
index 0000000000..c550fdce16
--- /dev/null
+++ b/test/pending/run/private-inline.flags
@@ -0,0 +1 @@
+-optimise -Yinline-warnings -Ybackend:GenASM
diff --git a/test/pending/run/private-inline.scala b/test/pending/run/private-inline.scala
new file mode 100644
index 0000000000..60fef9efca
--- /dev/null
+++ b/test/pending/run/private-inline.scala
@@ -0,0 +1,52 @@
+
+final class A {
+ private var x1 = false
+ var x2 = false
+
+ // manipulates private var
+ @inline private def wrapper1[T](body: => T): T = {
+ val saved = x1
+ x1 = true
+ try body
+ finally x1 = saved
+ }
+ // manipulates public var
+ @inline private def wrapper2[T](body: => T): T = {
+ val saved = x2
+ x2 = true
+ try body
+ finally x2 = saved
+ }
+
+ // not inlined
+ def f1a() = wrapper1(5)
+ // inlined!
+ def f1b() = identity(wrapper1(5))
+
+ // not inlined
+ def f2a() = wrapper2(5)
+ // inlined!
+ def f2b() = identity(wrapper2(5))
+}
+
+object Test {
+ def methodClasses = List("f1a", "f2a") map ("A$$anonfun$" + _ + "$1")
+
+ def main(args: Array[String]): Unit = {
+ val a = new A
+ import a._
+ println(f1a() + f1b() + f2a() + f2b())
+
+ // Don't know how else to test this: all these should have been
+ // inlined, so all should fail.
+ methodClasses foreach { clazz =>
+
+ val foundClass = (
+ try Class.forName(clazz)
+ catch { case _: Throwable => null }
+ )
+
+ assert(foundClass == null, foundClass)
+ }
+ }
+}
diff --git a/test/pending/run/reify_csv.check b/test/pending/run/reify_csv.check
new file mode 100644
index 0000000000..b56f4bb50b
--- /dev/null
+++ b/test/pending/run/reify_csv.check
@@ -0,0 +1,10 @@
+List(phase name, id, description)
+record(parser,1,parse source into ASTs, perform simple desugaring)
+record(namer,2,resolve names, attach symbols to named trees)
+record(packageobjects,3,load package objects)
+record(typer,4,the meat and potatoes: type the trees)
+record(superaccessors,5,add super accessors in traits and nested classes)
+record(pickler,6,serialize symbol tables)
+record(refchecks,7,reference/override checking, translate nested objects)
+record(selectiveanf,8,)
+record(liftcode,9,reify trees)
diff --git a/test/pending/run/reify_csv.scala b/test/pending/run/reify_csv.scala
new file mode 100644
index 0000000000..c35624469c
--- /dev/null
+++ b/test/pending/run/reify_csv.scala
@@ -0,0 +1,36 @@
+import scala.reflect.runtime.universe._
+import scala.tools.reflect.Eval
+
+object Test extends App {
+ val csv = """
+ | phase name; id; description
+ | parser; 1; parse source into ASTs, perform simple desugaring
+ | namer; 2; resolve names, attach symbols to named trees
+ |packageobjects; 3; load package objects
+ | typer; 4; the meat and potatoes: type the trees
+ |superaccessors; 5; add super accessors in traits and nested classes
+ | pickler; 6; serialize symbol tables
+ | refchecks; 7; reference/override checking, translate nested objects
+ | selectiveanf; 8;
+ | liftcode; 9; reify trees""".stripMargin.split("\n").map{_.trim()}.drop(1).toList
+
+ val fields = csv.head.split(";").map{_.trim()}.toList
+ println(fields)
+
+ reify({
+ object Csv {
+ case class record(`phase name`: String, id: String, description: String)
+
+ object record {
+ def parse(lines: List[String]) = {
+ lines drop(1) map { line => line.split(";", -1).toList match {
+ case phase$whitespace$name :: id :: description :: _ => record(phase$whitespace$name.trim(), id.trim(), description.trim())
+ case _ => throw new Exception("format error")
+ }}
+ }
+ }
+ }
+
+ Csv.record.parse(csv) foreach println
+ }).eval
+}
diff --git a/test/pending/run/reify_for1.scala b/test/pending/run/reify_for1.scala
new file mode 100644
index 0000000000..e1f5347572
--- /dev/null
+++ b/test/pending/run/reify_for1.scala
@@ -0,0 +1,10 @@
+import scala.reflect.runtime.universe._
+import scala.tools.reflect.Eval
+
+object Test extends App {
+ reify {
+ val sumOfSquares1 = (for (i <- 1 to 100; if (i % 3 == 0)) yield Math.pow(i, 2)).sum
+ val sumOfSquares2 = (1 to 100).filter(_ % 3 == 0).map(Math.pow(_, 2)).sum
+ assert(sumOfSquares1 == sumOfSquares2)
+ }.eval
+} \ No newline at end of file
diff --git a/test/pending/run/reify_fors_newpatmat.check b/test/pending/run/reify_fors_newpatmat.check
new file mode 100644
index 0000000000..eefddedc20
--- /dev/null
+++ b/test/pending/run/reify_fors_newpatmat.check
@@ -0,0 +1,5 @@
+Persons over 20: John Richard
+divisors(34) = List(1, 2, 17, 34)
+findNums(15) = (4,1) (5,2) (6,1) (7,4) (8,3) (8,5) (9,2) (9,4) (10,1) (10,3) (10,7) (11,2) (11,6) (11,8) (12,1) (12,5) (12,7) (13,4) (13,6) (13,10) (14,3) (14,5) (14,9)
+average(List(3.5, 5.0, 4.5)) = 4.333333333333333
+scalProd(List(3.5, 5.0, 4.5), List(2.0, 1.0, 3.0)) = 25.5
diff --git a/test/pending/run/reify_fors_newpatmat.scala b/test/pending/run/reify_fors_newpatmat.scala
new file mode 100644
index 0000000000..6bee9538a8
--- /dev/null
+++ b/test/pending/run/reify_fors_newpatmat.scala
@@ -0,0 +1,101 @@
+import scala.reflect.runtime.universe._
+import scala.tools.reflect.Eval
+
+object Test extends App {
+ reify {
+ object Persons {
+ /** A list of persons. To create a list, we use Predef.List
+ * which takes a variable number of arguments and constructs
+ * a list out of them.
+ */
+ val persons = List(
+ new Person("Bob", 17),
+ new Person("John", 40),
+ new Person("Richard", 68)
+ )
+
+ /** A Person class. 'val' constructor parameters become
+ * public members of the class.
+ */
+ class Person(val name: String, val age: Int)
+
+ /** Return an iterator over persons that are older than 20.
+ */
+ def olderThan20(xs: Seq[Person]): Iterator[String] =
+ olderThan20(xs.iterator)
+
+ /** Return an iterator over persons older than 20, given
+ * an iterator over persons.
+ */
+ def olderThan20(xs: Iterator[Person]): Iterator[String] = {
+
+ // The first expression is called a 'generator' and makes
+ // 'p' take values from 'xs'. The second expression is
+ // called a 'filter' and it is a boolean expression which
+ // selects only persons older than 20. There can be more than
+ // one generator and filter. The 'yield' expression is evaluated
+ // for each 'p' which satisfies the filters and used to assemble
+ // the resulting iterator
+ for (p <- xs if p.age > 20) yield p.name
+ }
+ }
+
+ /** Some functions over lists of numbers which demonstrate
+ * the use of for comprehensions.
+ */
+ object Numeric {
+
+ /** Return the divisors of n. */
+ def divisors(n: Int): List[Int] =
+ for (i <- List.range(1, n+1) if n % i == 0) yield i
+
+ /** Is 'n' a prime number? */
+ def isPrime(n: Int) = divisors(n).length == 2
+
+ /** Return pairs of numbers whose sum is prime. */
+ def findNums(n: Int): Iterable[(Int, Int)] = {
+
+ // a for comprehension using two generators
+ for (i <- 1 until n;
+ j <- 1 until (i-1);
+ if isPrime(i + j)) yield (i, j)
+ }
+
+ /** Return the sum of the elements of 'xs'. */
+ def sum(xs: List[Double]): Double =
+ xs.foldLeft(0.0) { (x, y) => x + y }
+
+ /** Return the sum of pairwise product of the two lists. */
+ def scalProd(xs: List[Double], ys: List[Double]) =
+ sum(for((x, y) <- xs zip ys) yield x * y);
+
+ /** Remove duplicate elements in 'xs'. */
+ def removeDuplicates[A](xs: List[A]): List[A] =
+ if (xs.isEmpty)
+ xs
+ else
+ xs.head :: removeDuplicates(for (x <- xs.tail if x != xs.head) yield x)
+ }
+
+ // import all members of object 'persons' in the current scope
+ import Persons._
+
+ print("Persons over 20:")
+ olderThan20(persons) foreach { x => print(" " + x) }
+ println
+
+ import Numeric._
+
+ println("divisors(34) = " + divisors(34))
+
+ print("findNums(15) =")
+ findNums(15) foreach { x => print(" " + x) }
+ println
+
+ val xs = List(3.5, 5.0, 4.5)
+ println("average(" + xs + ") = " + sum(xs) / xs.length)
+
+ val ys = List(2.0, 1.0, 3.0)
+ println("scalProd(" + xs + ", " + ys +") = " + scalProd(xs, ys))
+ }.eval
+} \ No newline at end of file
diff --git a/test/pending/run/reify_fors_oldpatmat.check b/test/pending/run/reify_fors_oldpatmat.check
new file mode 100644
index 0000000000..eefddedc20
--- /dev/null
+++ b/test/pending/run/reify_fors_oldpatmat.check
@@ -0,0 +1,5 @@
+Persons over 20: John Richard
+divisors(34) = List(1, 2, 17, 34)
+findNums(15) = (4,1) (5,2) (6,1) (7,4) (8,3) (8,5) (9,2) (9,4) (10,1) (10,3) (10,7) (11,2) (11,6) (11,8) (12,1) (12,5) (12,7) (13,4) (13,6) (13,10) (14,3) (14,5) (14,9)
+average(List(3.5, 5.0, 4.5)) = 4.333333333333333
+scalProd(List(3.5, 5.0, 4.5), List(2.0, 1.0, 3.0)) = 25.5
diff --git a/test/pending/run/reify_fors_oldpatmat.scala b/test/pending/run/reify_fors_oldpatmat.scala
new file mode 100644
index 0000000000..6bee9538a8
--- /dev/null
+++ b/test/pending/run/reify_fors_oldpatmat.scala
@@ -0,0 +1,101 @@
+import scala.reflect.runtime.universe._
+import scala.tools.reflect.Eval
+
+object Test extends App {
+ reify {
+ object Persons {
+ /** A list of persons. To create a list, we use Predef.List
+ * which takes a variable number of arguments and constructs
+ * a list out of them.
+ */
+ val persons = List(
+ new Person("Bob", 17),
+ new Person("John", 40),
+ new Person("Richard", 68)
+ )
+
+ /** A Person class. 'val' constructor parameters become
+ * public members of the class.
+ */
+ class Person(val name: String, val age: Int)
+
+ /** Return an iterator over persons that are older than 20.
+ */
+ def olderThan20(xs: Seq[Person]): Iterator[String] =
+ olderThan20(xs.iterator)
+
+ /** Return an iterator over persons older than 20, given
+ * an iterator over persons.
+ */
+ def olderThan20(xs: Iterator[Person]): Iterator[String] = {
+
+ // The first expression is called a 'generator' and makes
+ // 'p' take values from 'xs'. The second expression is
+ // called a 'filter' and it is a boolean expression which
+ // selects only persons older than 20. There can be more than
+ // one generator and filter. The 'yield' expression is evaluated
+ // for each 'p' which satisfies the filters and used to assemble
+ // the resulting iterator
+ for (p <- xs if p.age > 20) yield p.name
+ }
+ }
+
+ /** Some functions over lists of numbers which demonstrate
+ * the use of for comprehensions.
+ */
+ object Numeric {
+
+ /** Return the divisors of n. */
+ def divisors(n: Int): List[Int] =
+ for (i <- List.range(1, n+1) if n % i == 0) yield i
+
+ /** Is 'n' a prime number? */
+ def isPrime(n: Int) = divisors(n).length == 2
+
+ /** Return pairs of numbers whose sum is prime. */
+ def findNums(n: Int): Iterable[(Int, Int)] = {
+
+ // a for comprehension using two generators
+ for (i <- 1 until n;
+ j <- 1 until (i-1);
+ if isPrime(i + j)) yield (i, j)
+ }
+
+ /** Return the sum of the elements of 'xs'. */
+ def sum(xs: List[Double]): Double =
+ xs.foldLeft(0.0) { (x, y) => x + y }
+
+ /** Return the sum of pairwise product of the two lists. */
+ def scalProd(xs: List[Double], ys: List[Double]) =
+ sum(for((x, y) <- xs zip ys) yield x * y);
+
+ /** Remove duplicate elements in 'xs'. */
+ def removeDuplicates[A](xs: List[A]): List[A] =
+ if (xs.isEmpty)
+ xs
+ else
+ xs.head :: removeDuplicates(for (x <- xs.tail if x != xs.head) yield x)
+ }
+
+ // import all members of object 'persons' in the current scope
+ import Persons._
+
+ print("Persons over 20:")
+ olderThan20(persons) foreach { x => print(" " + x) }
+ println
+
+ import Numeric._
+
+ println("divisors(34) = " + divisors(34))
+
+ print("findNums(15) =")
+ findNums(15) foreach { x => print(" " + x) }
+ println
+
+ val xs = List(3.5, 5.0, 4.5)
+ println("average(" + xs + ") = " + sum(xs) / xs.length)
+
+ val ys = List(2.0, 1.0, 3.0)
+ println("scalProd(" + xs + ", " + ys +") = " + scalProd(xs, ys))
+ }.eval
+} \ No newline at end of file
diff --git a/test/pending/run/reify_newimpl_51.check b/test/pending/run/reify_newimpl_51.check
new file mode 100644
index 0000000000..9a4ddeacd3
--- /dev/null
+++ b/test/pending/run/reify_newimpl_51.check
@@ -0,0 +1,3 @@
+2
+1
+2 \ No newline at end of file
diff --git a/test/pending/run/reify_newimpl_51.scala b/test/pending/run/reify_newimpl_51.scala
new file mode 100644
index 0000000000..f823bf4033
--- /dev/null
+++ b/test/pending/run/reify_newimpl_51.scala
@@ -0,0 +1,18 @@
+import scala.reflect.runtime.universe._
+import scala.tools.reflect.Eval
+
+object Test extends App {
+ {
+ var counter = 0
+ lazy val x = { counter += 1; counter }
+ lazy val y = { counter += 1; counter }
+ val code = reify {
+ def foo = y // ensures that y is the first freevar we find
+ val bar = reify { println(x * y) }
+ bar.eval
+ println(x)
+ println(y)
+ }
+ code.eval
+ }
+} \ No newline at end of file
diff --git a/test/pending/run/reify_newimpl_52.check b/test/pending/run/reify_newimpl_52.check
new file mode 100644
index 0000000000..9359a2b211
--- /dev/null
+++ b/test/pending/run/reify_newimpl_52.check
@@ -0,0 +1,3 @@
+2
+2
+1 \ No newline at end of file
diff --git a/test/pending/run/reify_newimpl_52.scala b/test/pending/run/reify_newimpl_52.scala
new file mode 100644
index 0000000000..f01199e830
--- /dev/null
+++ b/test/pending/run/reify_newimpl_52.scala
@@ -0,0 +1,18 @@
+import scala.reflect.runtime.universe._
+import scala.tools.reflect.Eval
+
+object Test extends App {
+ {
+ var counter = 0
+ lazy val x = { counter += 1; counter }
+ lazy val y = { counter += 1; counter }
+ val code = reify {
+ def foo = y // ensures that y is the first freevar we find
+ val bar = reify { println(y * x) }
+ bar.eval
+ println(x)
+ println(y)
+ }
+ code.eval
+ }
+} \ No newline at end of file
diff --git a/test/pending/run/reify_properties.check b/test/pending/run/reify_properties.check
new file mode 100644
index 0000000000..d769bea4b0
--- /dev/null
+++ b/test/pending/run/reify_properties.check
@@ -0,0 +1,2 @@
+user1: MR. ROBERT <noname>
+user2: MR. BOB KUZ
diff --git a/test/pending/run/reify_properties.scala b/test/pending/run/reify_properties.scala
new file mode 100644
index 0000000000..01a9b12a92
--- /dev/null
+++ b/test/pending/run/reify_properties.scala
@@ -0,0 +1,57 @@
+import scala.reflect.runtime.universe._
+import scala.tools.reflect.Eval
+
+object Test extends App {
+ reify {
+ /** A mutable property whose getter and setter may be customized. */
+ case class Property[T](init: T) {
+ private var value: T = init
+
+ /** The getter function, defaults to identity. */
+ private var setter: T => T = identity[T]
+
+ /** The setter function, defaults to identity. */
+ private var getter: T => T = identity[T]
+
+ /** Retrive the value held in this property. */
+ def apply(): T = getter(value)
+
+ /** Update the value held in this property, through the setter. */
+ def update(newValue: T) = value = setter(newValue)
+
+ /** Change the getter. */
+ def get(newGetter: T => T) = { getter = newGetter; this }
+
+ /** Change the setter */
+ def set(newSetter: T => T) = { setter = newSetter; this }
+ }
+
+ class User {
+ // Create a property with custom getter and setter
+ val firstname = Property("")
+ .get { v => v.toUpperCase() }
+ .set { v => "Mr. " + v }
+ val lastname = Property("<noname>")
+
+ /** Scala provides syntactic sugar for calling 'apply'. Simply
+ * adding a list of arguments between parenthesis (in this case,
+ * an empty list) is translated to a call to 'apply' with those
+ * arguments.
+ */
+ override def toString() = firstname() + " " + lastname()
+ }
+
+ val user1 = new User
+
+ // Syntactic sugar for 'update': an assignment is translated to a
+ // call to method 'update'
+ user1.firstname() = "Robert"
+
+ val user2 = new User
+ user2.firstname() = "bob"
+ user2.lastname() = "KUZ"
+
+ println("user1: " + user1)
+ println("user2: " + user2)
+ }.eval
+}
diff --git a/test/pending/run/reify_sort1.check b/test/pending/run/reify_sort1.check
new file mode 100644
index 0000000000..0d30805141
--- /dev/null
+++ b/test/pending/run/reify_sort1.check
@@ -0,0 +1,2 @@
+List(6, 2, 8, 5, 1)
+List(1, 2, 5, 6, 8)
diff --git a/test/pending/run/reify_sort1.scala b/test/pending/run/reify_sort1.scala
new file mode 100644
index 0000000000..6fb3cc5895
--- /dev/null
+++ b/test/pending/run/reify_sort1.scala
@@ -0,0 +1,21 @@
+import scala.reflect.runtime.universe._
+import scala.tools.reflect.Eval
+
+object Test extends App {
+ reify {
+ def sort(a: List[Int]): List[Int] = {
+ if (a.length < 2)
+ a
+ else {
+ val pivot = a(a.length / 2)
+ sort(a.filter(_ < pivot)) :::
+ a.filter(_ == pivot) :::
+ sort(a.filter(_ > pivot))
+ }
+ }
+
+ val xs = List(6, 2, 8, 5, 1)
+ println(xs)
+ println(sort(xs))
+ }.eval
+} \ No newline at end of file
diff --git a/test/pending/run/t8960.scala b/test/pending/run/t8960.scala
new file mode 100644
index 0000000000..a58ac53d33
--- /dev/null
+++ b/test/pending/run/t8960.scala
@@ -0,0 +1,72 @@
+object Test extends App {
+ def test(o: AnyRef, sp: Boolean = false) = {
+ val isSpecialized = o.getClass.getSuperclass.getName contains "$sp"
+ val isDelambdafyMethod = o.getClass.getName contains "$lambda$"
+ assert(
+ // delambdafy:method doesn't currently emit specialized anonymous function classes
+ if (sp) (isSpecialized || isDelambdafyMethod) else !isSpecialized,
+ o.getClass.getName)
+
+ val Some(f) = o.getClass.getDeclaredFields.find(_.getName == "serialVersionUID")
+ assert(f.getLong(null) == 0l)
+ }
+
+ test(() => (), sp = true)
+ test(() => 1, sp = true)
+ test(() => "")
+
+ test((x: Int) => x, sp = true)
+ test((x: Boolean) => x)
+ test((x: Int) => "")
+
+ test((x1: Int, x2: Int) => 0d, sp = true)
+ test((x1: Int, x2: AnyRef) => 0d)
+ test((x1: Any, x2: Any) => x1)
+
+ // scala> println((for (i <- 3 to 22) yield (for (j <- 1 to i) yield s"x$j: Int").mkString(" test((", ", ", ") => x1)")).mkString("\n"))
+
+ test((x1: Int, x2: Int, x3: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int, x15: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int, x15: Int, x16: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int, x15: Int, x16: Int, x17: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int, x15: Int, x16: Int, x17: Int, x18: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int, x15: Int, x16: Int, x17: Int, x18: Int, x19: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int, x15: Int, x16: Int, x17: Int, x18: Int, x19: Int, x20: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int, x15: Int, x16: Int, x17: Int, x18: Int, x19: Int, x20: Int, x21: Int) => x1)
+ test((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int, x15: Int, x16: Int, x17: Int, x18: Int, x19: Int, x20: Int, x21: Int, x22: Int) => x1)
+
+ test({
+ case x: Int => x
+ }: PartialFunction[Int, Int], sp = true)
+
+ test({
+ case x: Int => x
+ }: PartialFunction[Any, Any])
+
+ test({
+ case x: Int => ()
+ }: PartialFunction[Int, Unit], sp = true)
+
+ test({
+ case x: String => 1
+ }: PartialFunction[String, Int])
+
+ test({
+ case x: String => ()
+ }: PartialFunction[String, Unit])
+
+ test({
+ case x: String => x
+ }: PartialFunction[String, String])
+}