question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

suppressing the warning but not the error

See original GitHub issue

In this code https://github.com/scalaz/ioeffect/blob/6f57538969e38f62f942a05d0b7734483629dc62/src/main/scala/scalaz/ioeffect/Void.scala#L34-L35

we are able to suppress this warning

[error] src/main/scala/scalaz/ioeffect/Void.scala:33:26: dead code following this construct
[error] private[ioeffect] object VoidImpl extends VoidModule with VoidSyntax {
[error]                          ^

but when scalacOptions in Compile += "-Xfatal-warnings" is added, we get

[info] Compiling 13 Scala sources to /tmp/fommil-sbt/home/fommil/Projects/scalaz-ioeffect/target/scala-2.12/classes ...
[error] No warnings can be incurred under -Xfatal-warnings.
[error] one error found

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
fommilcommented, Apr 21, 2018

I think it would be good if all plugins tried to be good citizens to the best of their ability, with silencer at the end of the list as the nuclear option.

1reaction
ghikcommented, Apr 21, 2018

OK, I think I nailed it.

There is a clash between silencer and semanticdb compiler plugin. Both have their own error/warning reporter which wraps the original reporter. They should totally be able to wrap each other and work together just fine but it’s important to ensure that the silencer reporter wraps the semanticdb reporter and not the other way. This means that silencer plugin must be applied after semanticdb plugin, which can be forced using this workaround:

def ensureSilencerIsLast(options: Seq[String]): Seq[String] = {
  val (Seq(silencer), rest) = options.partition(o => o.startsWith("-Xplugin:") && o.contains("silencer"))
  rest :+ silencer
}

scalacOptions in Compile := ensureSilencerIsLast((scalacOptions in Compile).value)
scalacOptions in Test := ensureSilencerIsLast((scalacOptions in Test).value)
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to suppress all GCC warning but errors - Stack Overflow
To suppress all warnings (but not errors) use the -w flag. Share.
Read more >
Warning Options (Using the GNU Compiler Collection (GCC))
Warnings are diagnostic messages that report constructions that are not inherently erroneous but that are risky or suggest there may have been an...
Read more >
Suppress compiler warnings - Visual Studio - Microsoft Learn
In Solution Explorer, choose the project or source file in which you want to suppress warnings. On the menu bar, choose View >...
Read more >
4.8. Options to Request or Suppress Warnings
Warnings are diagnostic messages that report constructions which are not inherently erroneous but which are risky or suggest there may have been an...
Read more >
Options to Request or Suppress Warnings — gcc 6 ... - Fedora
Warnings are diagnostic messages that report constructions that are not inherently erroneous but that are risky or suggest there may have been an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found