From 3eab7d68acfb24e73fde8cbd510d73212ccc41bf Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Wed, 24 Jan 2018 15:28:20 +0100 Subject: [PATCH] Split run test to avoid timeouts --- tests/run-with-compiler/i3876-b.check | 8 ++++++ tests/run-with-compiler/i3876-b.scala | 14 ++++++++++ tests/run-with-compiler/i3876-c.check | 16 ++++++++++++ tests/run-with-compiler/i3876-c.scala | 14 ++++++++++ tests/run-with-compiler/i3876-d.check | 8 ++++++ tests/run-with-compiler/i3876-d.scala | 15 +++++++++++ tests/run-with-compiler/i3876.check | 32 ----------------------- tests/run-with-compiler/i3876.scala | 24 +---------------- tests/run-with-compiler/quote-run-b.check | 3 +++ tests/run-with-compiler/quote-run-b.scala | 17 ++++++++++++ tests/run-with-compiler/quote-run-c.check | 4 +++ tests/run-with-compiler/quote-run-c.scala | 25 ++++++++++++++++++ tests/run-with-compiler/quote-run.check | 7 ----- tests/run-with-compiler/quote-run.scala | 26 ------------------ 14 files changed, 125 insertions(+), 88 deletions(-) create mode 100644 tests/run-with-compiler/i3876-b.check create mode 100644 tests/run-with-compiler/i3876-b.scala create mode 100644 tests/run-with-compiler/i3876-c.check create mode 100644 tests/run-with-compiler/i3876-c.scala create mode 100644 tests/run-with-compiler/i3876-d.check create mode 100644 tests/run-with-compiler/i3876-d.scala create mode 100644 tests/run-with-compiler/quote-run-b.check create mode 100644 tests/run-with-compiler/quote-run-b.scala create mode 100644 tests/run-with-compiler/quote-run-c.check create mode 100644 tests/run-with-compiler/quote-run-c.scala diff --git a/tests/run-with-compiler/i3876-b.check b/tests/run-with-compiler/i3876-b.check new file mode 100644 index 000000000000..0b029c8e91c2 --- /dev/null +++ b/tests/run-with-compiler/i3876-b.check @@ -0,0 +1,8 @@ +6 +{ + val x$1: Int = 3 + { + def f(x: Int): Int = x.+(x) + f(x$1) + } +} diff --git a/tests/run-with-compiler/i3876-b.scala b/tests/run-with-compiler/i3876-b.scala new file mode 100644 index 000000000000..2f067e1d7466 --- /dev/null +++ b/tests/run-with-compiler/i3876-b.scala @@ -0,0 +1,14 @@ +import dotty.tools.dotc.quoted.Runners._ +import scala.quoted._ +object Test { + def main(args: Array[String]): Unit = { + val x: Expr[Int] = '(3) + + val f2: Expr[Int => Int] = '{ + def f(x: Int): Int = x + x + f + } + println(f2(x).run) + println(f2(x).show) + } +} diff --git a/tests/run-with-compiler/i3876-c.check b/tests/run-with-compiler/i3876-c.check new file mode 100644 index 000000000000..494f0ebab329 --- /dev/null +++ b/tests/run-with-compiler/i3876-c.check @@ -0,0 +1,16 @@ +6 +{ + val x$1: Int = 3 + { + val f: + Function1[Int, Int] + { + def apply(x: Int): Int + } + = + { + (x: Int) => x.+(x) + } + (f: (x: Int) => Int).apply(x$1) + } +} diff --git a/tests/run-with-compiler/i3876-c.scala b/tests/run-with-compiler/i3876-c.scala new file mode 100644 index 000000000000..f7d4e09e22da --- /dev/null +++ b/tests/run-with-compiler/i3876-c.scala @@ -0,0 +1,14 @@ +import dotty.tools.dotc.quoted.Runners._ +import scala.quoted._ +object Test { + def main(args: Array[String]): Unit = { + val x: Expr[Int] = '(3) + + val f3: Expr[Int => Int] = '{ + val f: (x: Int) => Int = x => x + x + f + } + println(f3(x).run) + println(f3(x).show) // TODO improve printer + } +} diff --git a/tests/run-with-compiler/i3876-d.check b/tests/run-with-compiler/i3876-d.check new file mode 100644 index 000000000000..15c559cd0246 --- /dev/null +++ b/tests/run-with-compiler/i3876-d.check @@ -0,0 +1,8 @@ +6 +{ + val x$1: Int = 3 + /* inlined from Test*/ + { + x$1.+(x$1) + } +} diff --git a/tests/run-with-compiler/i3876-d.scala b/tests/run-with-compiler/i3876-d.scala new file mode 100644 index 000000000000..4558fe81ad1f --- /dev/null +++ b/tests/run-with-compiler/i3876-d.scala @@ -0,0 +1,15 @@ +import dotty.tools.dotc.quoted.Runners._ +import scala.quoted._ +object Test { + def main(args: Array[String]): Unit = { + val x: Expr[Int] = '(3) + + val f4: Expr[Int => Int] = '{ + inlineLambda + } + println(f4(x).run) + println(f4(x).show) + } + + inline def inlineLambda: Int => Int = x => x + x +} \ No newline at end of file diff --git a/tests/run-with-compiler/i3876.check b/tests/run-with-compiler/i3876.check index f1e0e510f1f1..f761ebed3277 100644 --- a/tests/run-with-compiler/i3876.check +++ b/tests/run-with-compiler/i3876.check @@ -5,35 +5,3 @@ x$1.+(x$1) } } -6 -{ - val x$1: Int = 3 - { - def f(x: Int): Int = x.+(x) - f(x$1) - } -} -6 -{ - val x$1: Int = 3 - { - val f: - Function1[Int, Int] - { - def apply(x: Int): Int - } - = - { - (x: Int) => x.+(x) - } - (f: (x: Int) => Int).apply(x$1) - } -} -6 -{ - val x$1: Int = 3 - /* inlined from Test*/ - { - x$1.+(x$1) - } -} diff --git a/tests/run-with-compiler/i3876.scala b/tests/run-with-compiler/i3876.scala index 84c40c615598..05cafa81d305 100644 --- a/tests/run-with-compiler/i3876.scala +++ b/tests/run-with-compiler/i3876.scala @@ -7,27 +7,5 @@ object Test { val f: Expr[Int => Int] = '{ (x: Int) => x + x } println(f(x).run) println(f(x).show) - - val f2: Expr[Int => Int] = '{ - def f(x: Int): Int = x + x - f - } - println(f2(x).run) - println(f2(x).show) - - val f3: Expr[Int => Int] = '{ - val f: (x: Int) => Int = x => x + x - f - } - println(f3(x).run) - println(f3(x).show) // TODO improve printer - - val f4: Expr[Int => Int] = '{ - inlineLambda - } - println(f4(x).run) - println(f4(x).show) } - - inline def inlineLambda: Int => Int = x => x + x -} \ No newline at end of file +} diff --git a/tests/run-with-compiler/quote-run-b.check b/tests/run-with-compiler/quote-run-b.check new file mode 100644 index 000000000000..75588b33d1b8 --- /dev/null +++ b/tests/run-with-compiler/quote-run-b.check @@ -0,0 +1,3 @@ + +lambda(4) +lambda(5) diff --git a/tests/run-with-compiler/quote-run-b.scala b/tests/run-with-compiler/quote-run-b.scala new file mode 100644 index 000000000000..295d8b498230 --- /dev/null +++ b/tests/run-with-compiler/quote-run-b.scala @@ -0,0 +1,17 @@ + +import dotty.tools.dotc.quoted.Runners._ + +import scala.quoted._ + +object Test { + def main(args: Array[String]): Unit = { + val lambdaExpr = '{ + (x: Int) => println("lambda(" + x + ")") + } + println() + + val lambda = lambdaExpr.run + lambda(4) + lambda(5) + } +} diff --git a/tests/run-with-compiler/quote-run-c.check b/tests/run-with-compiler/quote-run-c.check new file mode 100644 index 000000000000..7735271be69c --- /dev/null +++ b/tests/run-with-compiler/quote-run-c.check @@ -0,0 +1,4 @@ +Foo +false +Bar +class Quoted$A$1 diff --git a/tests/run-with-compiler/quote-run-c.scala b/tests/run-with-compiler/quote-run-c.scala new file mode 100644 index 000000000000..375eae47df7d --- /dev/null +++ b/tests/run-with-compiler/quote-run-c.scala @@ -0,0 +1,25 @@ + +import dotty.tools.dotc.quoted.Runners._ + +import scala.quoted._ + +object Test { + def main(args: Array[String]): Unit = { + val classExpr = '{ + class A { + override def toString: String = "Foo" + } + new A + } + val classExpr2 = '{ + class A { + override def toString: String = "Bar" + } + new A + } + println(classExpr.run) + println(classExpr.run.getClass == classExpr.run.getClass) + println(classExpr2.run) + println(classExpr2.run.getClass) + } +} diff --git a/tests/run-with-compiler/quote-run.check b/tests/run-with-compiler/quote-run.check index 3c3bfba445f9..fce767bf8172 100644 --- a/tests/run-with-compiler/quote-run.check +++ b/tests/run-with-compiler/quote-run.check @@ -7,10 +7,3 @@ foo println("foo") 2.+(a) } - -lambda(4) -lambda(5) -Foo -false -Bar -class Quoted$A$1 diff --git a/tests/run-with-compiler/quote-run.scala b/tests/run-with-compiler/quote-run.scala index ad8c4fe35f7b..12c5373e0a50 100644 --- a/tests/run-with-compiler/quote-run.scala +++ b/tests/run-with-compiler/quote-run.scala @@ -13,31 +13,5 @@ object Test { println(expr.run) println(expr.run) println(expr.show) - - val lambdaExpr = '{ - (x: Int) => println("lambda(" + x + ")") - } - println() - - val lambda = lambdaExpr.run - lambda(4) - lambda(5) - - val classExpr = '{ - class A { - override def toString: String = "Foo" - } - new A - } - val classExpr2 = '{ - class A { - override def toString: String = "Bar" - } - new A - } - println(classExpr.run) - println(classExpr.run.getClass == classExpr.run.getClass) - println(classExpr2.run) - println(classExpr2.run.getClass) } }