Skip to content

Split run test to avoid timeouts #3906

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/run-with-compiler/i3876-b.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
6
{
val x$1: Int = 3
{
def f(x: Int): Int = x.+(x)
f(x$1)
}
}
14 changes: 14 additions & 0 deletions tests/run-with-compiler/i3876-b.scala
Original file line number Diff line number Diff line change
@@ -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)
}
}
16 changes: 16 additions & 0 deletions tests/run-with-compiler/i3876-c.check
Original file line number Diff line number Diff line change
@@ -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)
}
}
14 changes: 14 additions & 0 deletions tests/run-with-compiler/i3876-c.scala
Original file line number Diff line number Diff line change
@@ -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
}
}
8 changes: 8 additions & 0 deletions tests/run-with-compiler/i3876-d.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
6
{
val x$1: Int = 3
/* inlined from Test*/
{
x$1.+(x$1)
}
}
15 changes: 15 additions & 0 deletions tests/run-with-compiler/i3876-d.scala
Original file line number Diff line number Diff line change
@@ -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
}
32 changes: 0 additions & 32 deletions tests/run-with-compiler/i3876.check
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
24 changes: 1 addition & 23 deletions tests/run-with-compiler/i3876.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
3 changes: 3 additions & 0 deletions tests/run-with-compiler/quote-run-b.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

lambda(4)
lambda(5)
17 changes: 17 additions & 0 deletions tests/run-with-compiler/quote-run-b.scala
Original file line number Diff line number Diff line change
@@ -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)
}
}
4 changes: 4 additions & 0 deletions tests/run-with-compiler/quote-run-c.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Foo
false
Bar
class Quoted$A$1
25 changes: 25 additions & 0 deletions tests/run-with-compiler/quote-run-c.scala
Original file line number Diff line number Diff line change
@@ -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)
}
}
7 changes: 0 additions & 7 deletions tests/run-with-compiler/quote-run.check
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,3 @@ foo
println("foo")
2.+(a)
}

lambda(4)
lambda(5)
Foo
false
Bar
class Quoted$A$1
26 changes: 0 additions & 26 deletions tests/run-with-compiler/quote-run.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}