Using ScalaTest 3.0.0 Environment: Scala 2.11.8, sbt 0.13.5, IntelliJ 14.1.4
build.sbt has only
// NOTE: not using org.scalactic
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % "test"
The test below passed. However, IntelliJ marks a squiggly red line below MyMiniTest with the warning message:
Class 'MyMiniTest ' must either be declared abstract or implement abstract member 'convertToLegacyEqualizer[T](left: T): TripleEqualsSupport.this.LegacyEqualizer[T]' in 'org.scalactic.TripleEqualsSupport'
import org.scalatest.FeatureSpec
class MyMiniTest extends FeatureSpec {
scenario("A simple test") {
val a = 12
assert(a * 3 == 36)
}
}
What is the reason of this warning and what is the recommended solution to fix it?
I had the same problem on IntelliJ just follow this steps to invalidate cache/restart. This will solve the problem.
In my case it was a transitive dependency (don't know how a test library could appear as such) of a different version clashing with the dependency defined in my project. SBT knows how to deal with most of these cases, IntelliJ doesn't seem to know. Note that invalidating the cache and restarting IntelliJ wouldn't help in this case.
To be sure it's your case, check the following: File -> Project Structure -> [Project Settings - Libraries]. Look for org.scalatest:*
and you will probably find two libraries, like this:
Then remove the unnecessary one by selecting it and pressing -
at the top of the panel. That's it, IntelliJ will be happy now.
A cleaner solution would be to exclude the unnecessary library from your dependencies, e.g.:
ExclusionRule("org.scalatest", "scalatest_2.11-2.2.4")
IntelliJ will show the library among the project's dependencies, but will know that it should be ingored.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With