From a1cf48961de99d5afb0b220fa28a26bee26e9572 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Fri, 3 Jul 2015 12:44:18 +0200 Subject: SI-9373 Restore the test for t8960 with IndyLamba enabled --- test/files/run/t8960.scala | 78 ++++++++++++++++++++++++++++++++++++++++++++ test/pending/run/t8960.scala | 72 ---------------------------------------- 2 files changed, 78 insertions(+), 72 deletions(-) create mode 100644 test/files/run/t8960.scala delete mode 100644 test/pending/run/t8960.scala (limited to 'test') diff --git a/test/files/run/t8960.scala b/test/files/run/t8960.scala new file mode 100644 index 0000000000..a43d5679d8 --- /dev/null +++ b/test/files/run/t8960.scala @@ -0,0 +1,78 @@ +object Test extends App { + def testAnonFunClass(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) + } + + def testIndyLambda(o: AnyRef, sp: Boolean = false) = { + val isSpecialized = o.getClass.getInterfaces.exists(_.getName contains "$sp") + assert(sp == isSpecialized, o.getClass.getName) + } + + + testIndyLambda(() => (), sp = true) + testIndyLambda(() => 1, sp = true) + testIndyLambda(() => "") + + testIndyLambda((x: Int) => x, sp = true) + testIndyLambda((x: Boolean) => x) + testIndyLambda((x: Int) => "") + + testIndyLambda((x1: Int, x2: Int) => 0d, sp = true) + testIndyLambda((x1: Int, x2: AnyRef) => 0d) + testIndyLambda((x1: Any, x2: Any) => x1) + + // scala> println((for (i <- 3 to 22) yield (for (j <- 1 to i) yield s"x$j: Int").mkString(" testIndyLambda((", ", ", ") => x1)")).mkString("\n")) + + testIndyLambda((x1: Int, x2: Int, x3: Int) => x1) + testIndyLambda((x1: Int, x2: Int, x3: Int, x4: Int) => x1) + testIndyLambda((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int) => x1) + testIndyLambda((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int) => x1) + testIndyLambda((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int) => x1) + testIndyLambda((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int) => x1) + testIndyLambda((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int) => x1) + testIndyLambda((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int) => x1) + testIndyLambda((x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int) => x1) + testIndyLambda((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) + testIndyLambda((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) + testIndyLambda((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) + testIndyLambda((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) + testIndyLambda((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) + testIndyLambda((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) + testIndyLambda((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) + testIndyLambda((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) + testIndyLambda((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) + testIndyLambda((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) + testIndyLambda((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) + + testAnonFunClass({ + case x: Int => x + }: PartialFunction[Int, Int], sp = true) + + testAnonFunClass({ + case x: Int => x + }: PartialFunction[Any, Any]) + + testAnonFunClass({ + case x: Int => () + }: PartialFunction[Int, Unit], sp = true) + + testAnonFunClass({ + case x: String => 1 + }: PartialFunction[String, Int]) + + testAnonFunClass({ + case x: String => () + }: PartialFunction[String, Unit]) + + testAnonFunClass({ + case x: String => x + }: PartialFunction[String, String]) +} diff --git a/test/pending/run/t8960.scala b/test/pending/run/t8960.scala deleted file mode 100644 index a58ac53d33..0000000000 --- a/test/pending/run/t8960.scala +++ /dev/null @@ -1,72 +0,0 @@ -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]) -} -- cgit v1.2.3