Skip to content
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

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

Open
xuwei-k opened this issue Feb 17, 2025 · 1 comment

Comments

@xuwei-k
Copy link
Contributor

xuwei-k commented Feb 17, 2025

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

@mkurz
Copy link
Member

mkurz commented Feb 17, 2025

Thanks for the report. We probably want to adjust the generated scala 3 code. PRs welcome 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants