an interesting behaviour in the Scala compiler, prepared queries that use the “IN” operator will require special binding at compile time, called ListValue.
trait InSelectPreparedExamples extends db.Connector {
lazy val selectInExample = db.entries.select.where(_.car in ?).prepareAsync()
// This is a select * query, selecting the entire record
def selectFromList(values: List[UUID]): Future[List[CarMetric]] = {
selectInExample.flatMap(_.bind(ListValue(values)).fetch)
}
// We can use also use a vargargs style method call to achieve the same goal.
def selectFromArgs(args: UUID*): Future[List[CarMetric]] = {
selectInExample.flatMap(_.bind(ListValue(args: _*)).fetch)
}
}
when i use this ListValue i have got warn
**
warn] or remove the empty argument list from its definition (Java-defined methods are exempt).
[warn] In Scala 3, an unapplied method like this will be eta-expanded into a function.
[warn] selectInExample.flatMap(_.bind(ListValue(values)).fetch())
[warn] ^
scalaVersion := "2.13.4" libraryDependencies += "com.outworkers" %% "phantom-dsl" % "2.59.0"
how can fix it ?
In Scala 2.12 and below the following syntax was valid without any warnings
However from Scala 2.13 this gives a warning
And in Scala 3 that syntax would be illegal.
In your case the
phantom-dsllibrary has a class with methods with empty parameter list - https://github.com/outworkers/phantom/blob/v2.59.0/phantom-dsl/src/main/scala/com/outworkers/phantom/builder/primitives/Primitives.scala#L166once they fix the bug you already reported the warnings should be gone.