False positive warning about passing implicits with a `using` clause in 3.7 nightly
Closed this issue · 2 comments
mrdziuban commented
Compiler version
3.7.0-RC1-bin-20250304-bef520f-NIGHTLY
Minimized code
//> using dep org.scalikejdbc::scalikejdbc:4.3.2
import scalikejdbc.*
given sess: DBSession = NoSession
def one = SQL("SELECT 1 AS x").map(_.get[Int]("x")).single()Output
-- Warning: --------------------------------------------------------------------
1 |def one = SQL("SELECT 1 AS x").map(_.get[Int]("x")).single()
| ^
|Implicit parameters should be provided with a `using` clause.
|To disable the warning, please use the following option:
| "-Wconf:msg=Implicit parameters should be provided with a `using` clause:s"Expectation
There should be no warning -- def single returns an instance of SQLToOption[A, E], which inherits def apply() from SQLToResult.
The () are required to properly call apply(). I tried changing the code to
def one = SQL("SELECT 1 AS x").map(_.get[Int]("x")).single.apply()but it yields the same warning. And remove () yields an error:
def one = SQL("SELECT 1 AS x").map(_.get[Int]("x")).single.apply
-- [E100] Syntax Error: --------------------------------------------------------
1 |def one = SQL("SELECT 1 AS x").map(_.get[Int]("x")).single.apply
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| method apply in trait SQLToResult must be called with () argumentsom-snytt commented
Thanks for the excellent links. I'm guessing
shows implicit with default args.
Gedochao commented
Assuming it's a duplicate of #22567, let's track it there.
Feel free to reopen if they turn out to be separate.
cc @hamzaremmal