File tree Expand file tree Collapse file tree 14 files changed +125
-88
lines changed Expand file tree Collapse file tree 14 files changed +125
-88
lines changed Original file line number Diff line number Diff line change 1+ 6
2+ {
3+ val x$1: Int = 3
4+ {
5+ def f(x: Int): Int = x.+(x)
6+ f(x$1)
7+ }
8+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 1+ 6
2+ {
3+ val x$1: Int = 3
4+ /* inlined from Test*/
5+ {
6+ x$1.+(x$1)
7+ }
8+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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- }
Original file line number Diff line number Diff 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+ }
Original file line number Diff line number Diff line change 1+
2+ lambda(4)
3+ lambda(5)
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments