Description
Compiler version
All of 3.4.0-RCx (no issues with 3.3.x)
Minimized code
Unfortunately I wasn't able to minimize, but I hope I can explain the issue well enough to identify what's causing it
Context / Setup
One of our (large) service at $WORK uses Scala 3 for quite some time now. I wanted to try out 3.4.0-RC4, but came across a very weird regression when Wunused:imports
is enabled.
The service uses Thrift clients that are generated via scrooge, and are defined as a dependency via the Scala 2.13 cross CrossVersion.for3Use2_13
flag. The client is initialized as shown below (Note that the reflectiveSelectable
import is required so that we can close the client. I also tried removing the reflection, but the issue still persists)
import reflect.Selectable.reflectiveSelectable
type SvcType = {
def asClosable: Closable
} & ThriftService
def createServiceClient[S <: SvcType](address: String)(using ClassTag[S]): S =
Thrift.client.build[S](address)
Issue
Since 3.4.0-RC1, having the following code in the project causes ~3,500 deprecation warnings to be raised, many of them that are not even part of the project (i.e., 3rd-party libraries)
...
[warn] .../src/main/scala-3/io/scalaland/chimney/internal/compiletime/ExprPromisesPlatform.scala: <none> is deprecated since 2019-10-03: Use thriftReusableBufferFactory instead
[warn] .../src/main/scala-3/zio/ZLayerCompanionVersionSpecific.scala: <none> is deprecated since 2019-10-03: Use thriftReusableBufferFactory instead
[warn] 3387 warnings found
After searching for the 2019-10-03
string in the finagle codebase, I found this method which contains an argument that is annotated as deprecated.
The (very) weird thing here is that the service codebase does not call this method, at least not directly. Removing the -Wunused:imports
compiler flag makes the issue go away. Similarly, using ???
as the body for the createServiceClient
method above also makes the issue go away.
Hope this helps, please let me know if you need some more info to help track down what's causing this. Unfortunately, there's no workaround (unless linting is disabled which is not possible)