scalacenter / scalafix

Refactoring and linting tool for Scala

Home Page:https://scalacenter.github.io/scalafix/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SuppressWarnings on ExplicitResultTypes gets Unused Scalafix suppression warning

esamson opened this issue · comments

Quill docs say I should avoid giving explicit types to quotations. So I suppress ExplicitResultTypes in like so:

import io.getquill.Literal
import io.getquill.jdbczio.Quill
import my.project.Organizations

@SuppressWarnings(Array("scalafix:ExplicitResultTypes"))
case class DbService(quill: Quill.Postgres[Literal]) {
  import quill._

  val organizations = quote(query[Organizations])

  def orgByName = quote((name: String) =>
    organizations.filter(org => org.name == name)
  )
}

This works. Scalafix doesn't add explicit types. But I get this warning:

[warn] /home/.../DbService.scala:8:26: warning: [UnusedScalafixSuppression] Unused Scalafix suppression, this can be removed
[warn] @SuppressWarnings(Array("scalafix:ExplicitResultTypes"))
[warn]                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Which is wrong because the suppression is definitely in use. If I remove it then Scalafix would write in the explicit types.

Hi @esamson, thanks for the report!

I did not manage to reproduce the issue. See #1891, where I expected a failure since an undeclared UnusedScalafixSuppression does fail the tests (ignore the JDK8 failure, it's due to Quill being built against a later JDK).

Could you elaborate?

Thanks for checking this, @bjaglin . Indeed, I don't see this happening in the latest version of my project. It's probably not worth the time digging up what bad combination I had that caused this before. Sorry for the trouble.

No worry, thanks for getting back to me!