Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiletime.codeOf result colorized twice in repl #13181

Closed
ansvonwa opened this issue Jul 28, 2021 · 0 comments · Fixed by #13186
Closed

compiletime.codeOf result colorized twice in repl #13181

ansvonwa opened this issue Jul 28, 2021 · 0 comments · Fixed by #13186
Assignees
Milestone

Comments

@ansvonwa
Copy link
Member

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))
@nicolasstucki nicolasstucki self-assigned this Jul 28, 2021
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 28, 2021
We printed by mistake in color when the color flag was set.
This was an unintetional change that happend when intinifying this operation.

Fixes scala#13181
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 29, 2021
We printed by mistake in color when the color flag was set.
This was an unintetional change that happend when intinifying this operation.

Fixes scala#13181
tanishiking pushed a commit to tanishiking/scala3 that referenced this issue Aug 10, 2021
We printed by mistake in color when the color flag was set.
This was an unintetional change that happend when intinifying this operation.

Fixes scala#13181
@Kordyjan Kordyjan added this to the 3.1.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants