Skip to content

False positive warning about passing implicits with a using clause in 3.7 nightly #22733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mrdziuban opened this issue Mar 6, 2025 · 2 comments
Labels
area:implicits related to implicits better-errors Issues concerned with improving confusing/unhelpful diagnostic messages itype:bug stat:duplicate

Comments

@mrdziuban
Copy link

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 () argument
@mrdziuban mrdziuban added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 6, 2025
@som-snytt
Copy link
Contributor

Thanks for the excellent links. I'm guessing

#22567

because https://github.com/scalikejdbc/scalikejdbc/blob/4.3.2/scalikejdbc-core/src/main/scala/scalikejdbc/SQL.scala#L1095

shows implicit with default args.

@Gedochao Gedochao added area:implicits related to implicits better-errors Issues concerned with improving confusing/unhelpful diagnostic messages stat:needs minimization Needs a self contained minimization stat:duplicate and removed stat:needs triage Every issue needs to have an "area" and "itype" label stat:needs minimization Needs a self contained minimization labels Mar 7, 2025
@Gedochao
Copy link
Contributor

Gedochao commented Mar 7, 2025

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

@Gedochao Gedochao closed this as completed Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:implicits related to implicits better-errors Issues concerned with improving confusing/unhelpful diagnostic messages itype:bug stat:duplicate
Projects
None yet
Development

No branches or pull requests

3 participants