Closed cjllanwarne closed 3 years ago
Cats no longer uses simulacrum and instead auto-generates typeclass syntax via https://github.com/typelevel/simulacrum-scalafix. I'm guessing that the upgrade to cats 2.3.0 pulled in the simulacrum-scalafix-annotation jar dependency, which has its own no-op definitions of the simulacrum annotations: https://github.com/typelevel/simulacrum-scalafix/blob/master/annotation/src/main/scala/org/typelevel/simulacrum/package.scala
You can probably work around this by either excluding the simulacrum-scalafix-annotation dependency or ensuring the simulacrum jar is ahead of it on the classpath.
cc @djspiewak
Hi @mpilquist, thanks for responding so quickly!
I tried updating our dependencies to exclude simulacrum-scalafix
but this didn't seem to make any difference. Am I doing this part wrong?
"org.typelevel" %% "cats-core" % catsV
exclude("org.typelevel", "simulacrum-scalafix"),
"org.typelevel" %% "alleycats-core" % catsV
exclude("org.typelevel", "simulacrum-scalafix"),
Try changing the artifact id to "simulacrum-scalafix-annotations_2.13"
So I tried switching to exclude that artifact ID:
"org.typelevel" %% "cats-core" % catsV
exclude("org.typelevel", "simulacrum-scalafix-annotations_2.13"),
"org.typelevel" %% "alleycats-core" % catsV
exclude("org.typelevel", "simulacrum-scalafix-annotations_2.13"),
And then just for good measure included a couple of others excludes as well:
"org.typelevel" %% "cats-core" % catsV
exclude("org.typelevel", "simulacrum-scalafix")
exclude("org.typelevel", "simulacrum-scalafix-annotation")
exclude("org.typelevel", "simulacrum-scalafix-annotations_2.13"),
"org.typelevel" %% "alleycats-core" % catsV
exclude("org.typelevel", "simulacrum-scalafix")
exclude("org.typelevel", "simulacrum-scalafix-annotation")
exclude("org.typelevel", "simulacrum-scalafix-annotations_2.13"),
Unfortunately, neither of these attempts managed to resolve the compilation issue
Can you run dependencyTree
and look for simulacrum dependencies, either simulacrum proper or the scalafix ones and share result here?
That seems to have worked, thanks! Running dependencyTree
identified the following imports which used the simulacrum-scalafix-annotations:
cats-core
alleycats-core
mouse
cats-effect
fs2-io
I also noticed that we're still on 2.12 so liberally excluded both _2.13
and _2.12
versions of the artifacts against all of those imports. That seems to have worked - so thank you!
One thing I'm not sure about is why nothing broke the compilation until I changed the cats version to 2.3.0
even though those libraries were already specified in the Dependencies... but I'm not going to complain since this seems to have resolved the issue.
Thanks again!
One final comment in case anyone re-discovers this thread later. Despite compiling with the individual excludes, my sbt assembly
was still not happy until I issued a global exclude of the simulacrum-scalafix-annotations_2.12
artifact in my settings via:
excludeDependencies ++= List(
"org.typelevel" % "simulacrum-scalafix-annotations_2.12",
"org.typelevel" % "simulacrum-scalafix-annotations_2.13"
)
This had the added benefit of being able to remove all of the individual exclude("org.typelevel", "simulacrum-scalafix-annotation")
annotations against individual indirect importers of the artifact.
This should do the trick too:
excludeDependencies += "org.typelevel" %% "simulacrum-scalafix-annotations"
Thanks again @mpilquist !
We recently tried[0][1] to update from cats 2.2.0 to 2.3.0 but the following error starting being reported on our typeclasses:
Eg on our `AstNodeToTypeElement class (trying to import from our WdlWriter typeclass):
Reverting the cats version back to 2.2.0 resolves these compilation errors.