Skip to content

confusing Implicit parameters should be provided with a using clause message if implicit default param #22567

Open
@xuwei-k

Description

Compiler version

3.7.0-RC1-bin-20250207-d60a914-NIGHTLY

Minimized example

a1/src/main/scala/A1.scala

object A1 {
  def f1(implicit x1: String, x2: Int = 2): Unit = ()
}

a2/src/main/scala/A2.scala

object A2 {
  given String = "s"

  def f2 = A1.f1
}

build.sbt

val a1 = project.settings(
  scalaVersion := "2.13.16"
)

val a2 = project.settings(
  scalaVersion := "3.7.0-RC1-bin-20250207-d60a914-NIGHTLY"
).dependsOn(a1)

Output Error/Warning message

[warn] -- Warning: example-implicit-using-default-project/a2/src/main/scala/A2.scala:4:16 
[warn] 4 |  def f2 = A1.f1
[warn]   |                ^
[warn]   |Implicit parameters should be provided with a `using` clause.
[warn]   |This code can be rewritten automatically under -rewrite -source 3.7-migration.
[warn]   |To disable the warning, please use the following option: 
[warn]   |  "-Wconf:msg=Implicit parameters should be provided with a `using` clause:s"
[warn] one warning found

Why this Error/Warning was not helpful

This is implicit params but not call with explicit.

Suggested improvement

Note

Metadata

Assignees

Labels

area:reportingError reporting including formatting, implicit suggestions, etcbetter-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesitype:enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions