Skip to content

Commit 3eab7d6

Browse files
committed
Split run test to avoid timeouts
1 parent 618e5de commit 3eab7d6

14 files changed

+125
-88
lines changed

tests/run-with-compiler/i3876-b.check

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
6
2+
{
3+
val x$1: Int = 3
4+
{
5+
def f(x: Int): Int = x.+(x)
6+
f(x$1)
7+
}
8+
}

tests/run-with-compiler/i3876-b.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import dotty.tools.dotc.quoted.Runners._
2+
import scala.quoted._
3+
object Test {
4+
def main(args: Array[String]): Unit = {
5+
val x: Expr[Int] = '(3)
6+
7+
val f2: Expr[Int => Int] = '{
8+
def f(x: Int): Int = x + x
9+
f
10+
}
11+
println(f2(x).run)
12+
println(f2(x).show)
13+
}
14+
}

tests/run-with-compiler/i3876-c.check

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
6
2+
{
3+
val x$1: Int = 3
4+
{
5+
val f:
6+
Function1[Int, Int]
7+
{
8+
def apply(x: Int): Int
9+
}
10+
=
11+
{
12+
(x: Int) => x.+(x)
13+
}
14+
(f: (x: Int) => Int).apply(x$1)
15+
}
16+
}

tests/run-with-compiler/i3876-c.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import dotty.tools.dotc.quoted.Runners._
2+
import scala.quoted._
3+
object Test {
4+
def main(args: Array[String]): Unit = {
5+
val x: Expr[Int] = '(3)
6+
7+
val f3: Expr[Int => Int] = '{
8+
val f: (x: Int) => Int = x => x + x
9+
f
10+
}
11+
println(f3(x).run)
12+
println(f3(x).show) // TODO improve printer
13+
}
14+
}

tests/run-with-compiler/i3876-d.check

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
6
2+
{
3+
val x$1: Int = 3
4+
/* inlined from Test*/
5+
{
6+
x$1.+(x$1)
7+
}
8+
}

tests/run-with-compiler/i3876-d.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import dotty.tools.dotc.quoted.Runners._
2+
import scala.quoted._
3+
object Test {
4+
def main(args: Array[String]): Unit = {
5+
val x: Expr[Int] = '(3)
6+
7+
val f4: Expr[Int => Int] = '{
8+
inlineLambda
9+
}
10+
println(f4(x).run)
11+
println(f4(x).show)
12+
}
13+
14+
inline def inlineLambda: Int => Int = x => x + x
15+
}

tests/run-with-compiler/i3876.check

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,3 @@
55
x$1.+(x$1)
66
}
77
}
8-
6
9-
{
10-
val x$1: Int = 3
11-
{
12-
def f(x: Int): Int = x.+(x)
13-
f(x$1)
14-
}
15-
}
16-
6
17-
{
18-
val x$1: Int = 3
19-
{
20-
val f:
21-
Function1[Int, Int]
22-
{
23-
def apply(x: Int): Int
24-
}
25-
=
26-
{
27-
(x: Int) => x.+(x)
28-
}
29-
(f: (x: Int) => Int).apply(x$1)
30-
}
31-
}
32-
6
33-
{
34-
val x$1: Int = 3
35-
/* inlined from Test*/
36-
{
37-
x$1.+(x$1)
38-
}
39-
}

tests/run-with-compiler/i3876.scala

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,5 @@ object Test {
77
val f: Expr[Int => Int] = '{ (x: Int) => x + x }
88
println(f(x).run)
99
println(f(x).show)
10-
11-
val f2: Expr[Int => Int] = '{
12-
def f(x: Int): Int = x + x
13-
f
14-
}
15-
println(f2(x).run)
16-
println(f2(x).show)
17-
18-
val f3: Expr[Int => Int] = '{
19-
val f: (x: Int) => Int = x => x + x
20-
f
21-
}
22-
println(f3(x).run)
23-
println(f3(x).show) // TODO improve printer
24-
25-
val f4: Expr[Int => Int] = '{
26-
inlineLambda
27-
}
28-
println(f4(x).run)
29-
println(f4(x).show)
3010
}
31-
32-
inline def inlineLambda: Int => Int = x => x + x
33-
}
11+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
lambda(4)
3+
lambda(5)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
import dotty.tools.dotc.quoted.Runners._
3+
4+
import scala.quoted._
5+
6+
object Test {
7+
def main(args: Array[String]): Unit = {
8+
val lambdaExpr = '{
9+
(x: Int) => println("lambda(" + x + ")")
10+
}
11+
println()
12+
13+
val lambda = lambdaExpr.run
14+
lambda(4)
15+
lambda(5)
16+
}
17+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Foo
2+
false
3+
Bar
4+
class Quoted$A$1
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
import dotty.tools.dotc.quoted.Runners._
3+
4+
import scala.quoted._
5+
6+
object Test {
7+
def main(args: Array[String]): Unit = {
8+
val classExpr = '{
9+
class A {
10+
override def toString: String = "Foo"
11+
}
12+
new A
13+
}
14+
val classExpr2 = '{
15+
class A {
16+
override def toString: String = "Bar"
17+
}
18+
new A
19+
}
20+
println(classExpr.run)
21+
println(classExpr.run.getClass == classExpr.run.getClass)
22+
println(classExpr2.run)
23+
println(classExpr2.run.getClass)
24+
}
25+
}

tests/run-with-compiler/quote-run.check

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,3 @@ foo
77
println("foo")
88
2.+(a)
99
}
10-
11-
lambda(4)
12-
lambda(5)
13-
Foo
14-
false
15-
Bar
16-
class Quoted$A$1

tests/run-with-compiler/quote-run.scala

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,5 @@ object Test {
1313
println(expr.run)
1414
println(expr.run)
1515
println(expr.show)
16-
17-
val lambdaExpr = '{
18-
(x: Int) => println("lambda(" + x + ")")
19-
}
20-
println()
21-
22-
val lambda = lambdaExpr.run
23-
lambda(4)
24-
lambda(5)
25-
26-
val classExpr = '{
27-
class A {
28-
override def toString: String = "Foo"
29-
}
30-
new A
31-
}
32-
val classExpr2 = '{
33-
class A {
34-
override def toString: String = "Bar"
35-
}
36-
new A
37-
}
38-
println(classExpr.run)
39-
println(classExpr.run.getClass == classExpr.run.getClass)
40-
println(classExpr2.run)
41-
println(classExpr2.run.getClass)
4216
}
4317
}

0 commit comments

Comments
 (0)