File tree Expand file tree Collapse file tree 4 files changed +11
-13
lines changed
compiler/src/dotty/tools/dotc/quoted Expand file tree Collapse file tree 4 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ import scala.runtime.quoted._
5
5
6
6
/** Default runners for quoted expressions */
7
7
object Runners {
8
- implicit def runner [T ]: Runner [T ] = (expr : Expr [T ]) => new QuoteDriver ().run(expr)
9
- implicit def show [T ]: Show [T ] = (expr : Expr [T ]) => new QuoteDriver ().show(expr)
8
+ implicit def runner [T ]: Runner [T ] = new Runner [T ] {
9
+
10
+ def run (expr : Expr [T ]): T =
11
+ new QuoteDriver ().run(expr)
12
+
13
+ def show (expr : Expr [T ]): String =
14
+ new QuoteDriver ().show(expr)
15
+ }
10
16
}
Original file line number Diff line number Diff line change 1
1
package scala .quoted
2
2
3
- import scala .runtime .quoted .{ Runner , Show }
3
+ import scala .runtime .quoted .Runner
4
4
5
5
abstract class Expr [T ] extends Quoted {
6
6
final def unary_~ : T = throw new Error (" ~ should have been compiled away" )
7
7
final def run (implicit runner : Runner [T ]): T = runner.run(this )
8
- final def show (implicit runner : Show [T ]): String = runner.run (this )
8
+ final def show (implicit runner : Runner [T ]): String = runner.show (this )
9
9
}
10
10
11
11
object Expr {
Original file line number Diff line number Diff line change @@ -6,4 +6,5 @@ import scala.quoted.Expr
6
6
@ implicitNotFound(" Could not find implicit Runner. Default runner can must be imported with `import dotty.tools.dotc.quoted.Runners._`" )
7
7
trait Runner [T ] {
8
8
def run (expr : Expr [T ]): T
9
+ def show (expr : Expr [T ]): String
9
10
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments