scalameta / metals

Scala language server with rich IDE features 🚀
https://scalameta.org/metals/
Apache License 2.0
2.09k stars 332 forks source link

Metals 1.4 fails compilation with Wartremover installed #6889

Open andyczerwonka opened 3 hours ago

andyczerwonka commented 3 hours ago

Compiler quits with Wartremover Enabled

During today's upgrade from 1.3.5 to 1.4.0, I noticed that compilation of our projects just stopped compiling after a couple of projects. After looking at the bloop errors, I decided to remove WartRemover from our environment to see if that was cousing the issue. Once removed, Metals started working again.

I removed the following:

addSbtPlugin("org.wartremover" % "sbt-wartremover" % "3.2.3")
ThisBuild / wartremoverErrors ++= Seq(
  Wart.ArrayEquals,
  Wart.Recursion
)

ThisBuild / wartremoverExcluded += baseDirectory.value / "code" / "orion" / "ml-config-core" / "src" / "main" / "scala" / "db"

I've included the errors we were seeing. reports.zip

Here are another set of errors after removing wartremover, but Metals does seem to work.

reports_removed_wartremover.zip

Expected behavior

I expect Metals to be tolerant of Wartremover, and continue to compile all of the code.

Operating system

Linux

Editor/Extension

VS Code

Version of Metals

v1.4.0

Extra context or search terms

wartremover

andyczerwonka commented 3 hours ago

It looks to be the same problem as https://github.com/scalacenter/bloop/issues/1421 and is a blocker for upgrading for us. We'll revert to 1.3.5 until such time that we have a solution.

andyczerwonka commented 3 hours ago

Also looks like there's a solution coming. https://github.com/scalacenter/bloop/pull/2485

agilesteel commented 2 hours ago

We ran into the same issue. There is an even smaller reproduction (hello world essentially) that I reported on discord. I'll paste it here. Maybe someone will find it useful:

build.sbt

scalaVersion := "2.13.15"
wartremoverWarnings := Warts.all

project/plugins.sbt

addSbtPlugin("org.wartremover" % "sbt-wartremover" % "3.2.3")

src/main/scala/Main.scala

object Main extends App
tgodzik commented 47 minutes ago

Thanks! I think I already have a fix. As soon as it's merged I will release bloop, then probably metals also