We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7bf5d4f + cfdb14d commit 5c6d352Copy full SHA for 5c6d352
compiler/src/dotty/tools/dotc/typer/Inliner.scala
@@ -379,7 +379,8 @@ object Inliner {
379
380
/** Expand call to scala.compiletime.codeOf */
381
def codeOf(arg: Tree, pos: SrcPos)(using Context): Tree =
382
- Literal(Constant(arg.show)).withSpan(pos.span)
+ val ctx1 = ctx.fresh.setSetting(ctx.settings.color, "never")
383
+ Literal(Constant(arg.show(using ctx1))).withSpan(pos.span)
384
}
385
386
extension (tp: Type) {
compiler/test-resources/repl/i13181
@@ -0,0 +1,2 @@
1
+scala> scala.compiletime.codeOf(1+2)
2
+val res0: String = 1.+(2)
tests/run/i13181.scala
@@ -0,0 +1 @@
+@main def Test = assert(scala.compiletime.codeOf(1+2) == "1.+(2)")
0 commit comments