Skip to content

Implicit parameters should be provided with a using clause warning since Scala 3.7 #894

@xuwei-k

Description

@xuwei-k

reproduce code

build.sbt

enablePlugins(SbtTwirl)

scalaVersion := "3.7.0-RC1-bin-20250215-43f8cdb-NIGHTLY"

project/build.properties

sbt.version=1.10.7

project/plugins.sbt

addSbtPlugin("org.playframework.twirl" % "sbt-twirl" % "2.1.0-M2")

src/main/twirl/example.scala.html

@(x: Int)(implicit y: Int)

<p>hello</p>

problem

sbt compile

/src/main/twirl/example.scala.html:3:13: 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] <p>hello</p>
[warn]             ^
[warn] one warning found

generated code

  /**/
  def apply/*1.2*/(x: Int)(implicit y: Int):play.twirl.api.HtmlFormat.Appendable = {
    _display_ {
      {


Seq[Any](format.raw/*2.1*/("""
"""),format.raw/*3.1*/("""<p>hello</p>
"""))
      }
    }
  }

  def render(x:Int,y:Int): play.twirl.api.HtmlFormat.Appendable = apply(x)(y)

  def f:((Int) => (Int) => play.twirl.api.HtmlFormat.Appendable) = (x) => (y) => apply(x)(y)

  def ref: this.type = this

expect

<   def render(x:Int,y:Int): play.twirl.api.HtmlFormat.Appendable = apply(x)(y)
---
>   def render(x:Int,y:Int): play.twirl.api.HtmlFormat.Appendable = apply(x)(using y)
29c29
<   def f:((Int) => (Int) => play.twirl.api.HtmlFormat.Appendable) = (x) => (y) => apply(x)(y)
---
>   def f:((Int) => (Int) => play.twirl.api.HtmlFormat.Appendable) = (x) => (y) => apply(x)(using y)

note

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions