Skip to content

Commit 580415e

Browse files
committed
Move ConstantShowDeco into ConstantOps
1 parent e7bf627 commit 580415e

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

library/src/scala/tasty/Reflection.scala

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,8 +1941,23 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
19411941
// CONSTANTS //
19421942
///////////////
19431943

1944+
/** Members of `Constant` */
19441945
extension ConstantOps on (const: Constant) {
1946+
1947+
/** Returns the value of the constant */
19451948
def value: Any = internal.Constant_value(const)
1949+
1950+
/** Shows the tree as extractors */
1951+
def showExtractors(given ctx: Context): String =
1952+
new ExtractorsPrinter[self.type](self).showConstant(const)
1953+
1954+
/** Shows the tree as fully typed source code */
1955+
def show(given ctx: Context): String =
1956+
const.showWith(SyntaxHighlight.plain)
1957+
1958+
/** Shows the tree as fully typed source code */
1959+
def showWith(syntaxHighlight: SyntaxHighlight)(given ctx: Context): String =
1960+
new SourceCodePrinter[self.type](self)(syntaxHighlight).showConstant(const)
19461961
}
19471962

19481963
/** Module of Constant literals */
@@ -2671,21 +2686,6 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
26712686
new SourceCodePrinter[self.type](self)(syntaxHighlight).showTypeOrBounds(tpe)
26722687
}
26732688

2674-
/** Adds `show` as an extension method of a `Constant` */
2675-
extension ConstantShowDeco on (const: Constant) {
2676-
/** Shows the tree as extractors */
2677-
def showExtractors(given ctx: Context): String =
2678-
new ExtractorsPrinter[self.type](self).showConstant(const)
2679-
2680-
/** Shows the tree as fully typed source code */
2681-
def show(given ctx: Context): String =
2682-
const.showWith(SyntaxHighlight.plain)
2683-
2684-
/** Shows the tree as fully typed source code */
2685-
def showWith(syntaxHighlight: SyntaxHighlight)(given ctx: Context): String =
2686-
new SourceCodePrinter[self.type](self)(syntaxHighlight).showConstant(const)
2687-
}
2688-
26892689
/** Adds `show` as an extension method of a `Symbol` */
26902690
extension SymbolShowDeco on (symbol: Symbol) {
26912691
/** Shows the tree as extractors */

0 commit comments

Comments
 (0)