scala-cli icon indicating copy to clipboard operation
scala-cli copied to clipboard

Compiler output passed wrongly from Bloop

Open prolativ opened this issue 3 years ago • 7 comments

Version(s)

0.1.4, 0.1.5, possibly earlier ones as well

Describe the bug

Compiler options passed after -O seem to be ignored when compiling with scala 2

To Reproduce

Foo.scala:

trait Foo

Running

scala-cli compile -S 2.13.8 -O -Vprint:typer Foo.scala

prints just

Compiling project (Scala 2.13.8, JVM)
Compiled project (Scala 2.13.8, JVM)

Expected behaviour Compiler option passed in the command line after -O should be correctly passed to the compiler.

In the example above this should print the program tree after the typer phase similarly to

sdk use scala 2.13.8
scalac -Vprint:typer Foo.scala

printing

[[syntax trees at end of                     typer]] // Foo.scala
package <empty> {
  abstract trait Foo extends scala.AnyRef
}

prolativ avatar May 19 '22 09:05 prolativ

Hi @prolativ, Thanks for reporting, it seems that is bloop issue that output from scalac is not properly handled.

There is exists a workaround and you have to use plain scalac without bloop. To disable using bloop you should use --server=false flag.

$ scala-cli compile -S 2.13.8 -O -Vprint:typer Foo.scala --server=false
[[syntax trees at end of                     typer]] // Foo.scala
package <empty> {
  abstract trait Foo extends scala.AnyRef
}

lwronski avatar May 19 '22 11:05 lwronski

Could this be considered a blocker for promoting scala-cli to be scala? I feel (rather strongly) that it should be.

SethTisue avatar Mar 06 '24 15:03 SethTisue

Makes sense, I will need to take a look at it.

tgodzik avatar Mar 08 '24 12:03 tgodzik

Fixing it in https://github.com/scalacenter/bloop/pull/2361

tgodzik avatar Jun 28 '24 16:06 tgodzik

@SethTisue do you know if the output from "-Vprint" is being printed only to standard output? This might not be possible to sensibly fix as we would need to forward Bloop stdout and that could bring in more than we wanted, since it is running multiple compilations.

tgodzik avatar Jul 04 '24 14:07 tgodzik