pauljamescleary/scala-pet-store

Scala 2.13.6 Unused Parameter Value for Higher Kinded Type

theoilie opened this issue · 1 comments

When cloning the latest version of scala-pet-store and changing build.sbt to only compile to Scala 2.13.6 (i.e., changing crossScalaVersions := Seq("2.12.14", "2.13.6") to scalaVersion := "2.13.6"), sbt compile gives the following error about the higher kinded type for Cats Effect Sync being unused:

[info] compiling 36 Scala sources to <LOCAL_PATH_REDACTED>/scala-pet-store/target/scala-2.13/classes ...
[error] <LOCAL_PATH_REDACTED>/scala-pet-store/src/main/scala/io/github/pauljamescleary/petstore/infrastructure/endpoint/OrderEndpoints.scala:19:26: parameter value evidence$2 in class OrderEndpoints is never used
[error] class OrderEndpoints[F[_]: Sync, Auth: JWTMacAlgo] extends Http4sDsl[F] {
[error]                          ^
[error] <LOCAL_PATH_REDACTED>/scala-pet-store/src/main/scala/io/github/pauljamescleary/petstore/infrastructure/endpoint/PetEndpoints.scala:21:24: parameter value evidence$2 in class PetEndpoints is never used
[error] class PetEndpoints[F[_]: Sync, Auth: JWTMacAlgo] extends Http4sDsl[F] {
[error]                        ^
[error] <LOCAL_PATH_REDACTED>/scala-pet-store/src/main/scala/io/github/pauljamescleary/petstore/infrastructure/endpoint/UserEndpoints.scala:21:25: parameter value evidence$2 in class UserEndpoints is never used
[error] class UserEndpoints[F[_]: Sync, A, Auth: JWTMacAlgo] extends Http4sDsl[F] {
[error]                         ^
[error] three errors found
[error] (Compile / compileIncremental) Compilation failed

This could be an upstream issue with sbt-tpolecat or some kind of incompatibility between the Scala compiler and/or Sync and/or higher kinded types. Or I could be interpreting this incorrectly. Anyway, the quick and dirty solution for anyone else having this problem is to disable the sbt-tpolecat plugin (comment it out in project/plugins.sbt) and declare your own scalac options in build.sbt.

An alternative solution is to continue using the sbt-tpolecat plugin and make the compiler not fail on warnings:

// build.sbt
scalacOptions --= Seq(
  "-Xfatal-warnings",
)