Skip to content

compiletime.codeOf result colorized twice in repl #13181

Closed
@ansvonwa

Description

@ansvonwa

Compiler version

3.0.{0,1,3-RC1-bin-20210727-b902516-NIGHTLY}

Minimized code

scala> scala.compiletime.codeOf(1+2)

Output

val res0: String = [31m10m.+(31m20m)
(red characters:    ^^  ^    ^^  ^  )

Expectation

1+2 (as plain uncolorized text) or
1+2 (colored)

Comments

  • -Xprint shows the string (colorized once)
$ scala -Xprint:typer
scala> scala.compiletime.codeOf(1+2)
result of rs$line$1 after typer:
package <empty> {
  final lazy module val rs$line$1: rs$line$1$ = new rs$line$1$()
  final module class rs$line$1$() extends Object() { this: rs$line$1.type =>
    val res0: String = "\033[31m1\033[0m.+(\033[31m2\033[0m)"
  }
}
val res0: String = [31m10m.+(31m20m)

(The \033 is an octal, I'll open another issue for that.)

  • sbt console prints val res0: String = 31m10m.+(31m20m) (note the missing [ at the beginning)
  • Intellijs terminal is completely confused [31m1[[31m0m.+([[31m31m2[[31m0m) (resp. [[31m31m1[[31m0m.+([[31m31m2[[31m0m))

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions