Skip to content

Commit df17245

Browse files
Merge pull request #8500 from dotty-staging/remove-unnecessary-indirection
Remove unnecessary indirection
2 parents aa0c87b + 300332f commit df17245

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

library/src/scala/quoted/Expr.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ import scala.quoted.show.SyntaxHighlight
66
class Expr[+T] private[scala] {
77

88
/** Show a source code like representation of this expression without syntax highlight */
9-
def show(using qctx: QuoteContext): String = qctx.show(this, SyntaxHighlight.plain)
9+
def show(using qctx: QuoteContext): String =
10+
this.unseal.showWith(SyntaxHighlight.plain)
1011

1112
/** Show a source code like representation of this expression */
12-
def show(syntaxHighlight: SyntaxHighlight)(using qctx: QuoteContext): String = qctx.show(this, syntaxHighlight)
13+
def show(syntaxHighlight: SyntaxHighlight)(using qctx: QuoteContext): String =
14+
this.unseal.showWith(syntaxHighlight)
1315

1416
/** Return the value of this expression.
1517
*

library/src/scala/quoted/QuoteContext.scala

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,6 @@ class QuoteContext(val tasty: scala.tasty.Reflection) { self =>
2929
val tasty: self.tasty.type
3030
}
3131

32-
/** Show the fully elaborated source code representation of an expression */
33-
def show(expr: Expr[_], syntaxHighlight: SyntaxHighlight): String = {
34-
import tasty.{_, given _}
35-
expr.unseal(using this).showWith(syntaxHighlight)
36-
}
37-
38-
/** Show the fully elaborated source code representation of a type */
39-
def show(tpe: Type[_], syntaxHighlight: SyntaxHighlight): String = {
40-
import tasty.{_, given _}
41-
tpe.unseal(using this).showWith(syntaxHighlight)
42-
}
43-
4432
/** Report an error at the position of the macro expansion */
4533
def error(msg: => String): Unit = {
4634
import tasty.{_, given _}

library/src/scala/quoted/Type.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ class Type[T <: AnyKind] private[scala] {
77
type `$splice` = T
88

99
/** Show a source code like representation of this type without syntax highlight */
10-
def show(using qctx: QuoteContext): String = qctx.show(this, SyntaxHighlight.plain)
10+
def show(using qctx: QuoteContext): String =
11+
this.unseal.showWith(SyntaxHighlight.plain)
1112

1213
/** Show a source code like representation of this type */
13-
def show(syntaxHighlight: SyntaxHighlight)(using qctx: QuoteContext): String = qctx.show(this, syntaxHighlight)
14+
def show(syntaxHighlight: SyntaxHighlight)(using qctx: QuoteContext): String =
15+
this.unseal.showWith(syntaxHighlight)
1416

1517
/** View this expression `quoted.Type[T]` as a `TypeTree` */
1618
def unseal(using qctx: QuoteContext): qctx.tasty.TypeTree =

0 commit comments

Comments
 (0)