guardrail-dev / guardrail

Principled code generation from OpenAPI specifications
https://guardrail.dev
MIT License
523 stars 132 forks source link

private[this] syntax is deprecated in scala 3.4.x #1968

Open KristianAN opened 6 months ago

KristianAN commented 6 months ago

The generated code will now cause the Scala 3.4.x compiler to emit the warning:

[warn] 36 |  private[this] def argEscape(k: String, v: String): String = Query.apply((k, Some(v))).toString
[warn]    |                ^
[warn]    |Ignoring [this] qualifier.
[warn]    |This syntax will be deprecated in the future; it should be dropped.
[warn]    |See: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html
[warn]    |This construct can be rewritten automatically under -rewrite -source 3.4-migration.
KristianAN commented 6 months ago

More about the change is here: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html This seems to be related to https://github.com/guardrail-dev/guardrail/blob/master/modules/scala-http4s/src/main/scala/dev/guardrail/generators/scala/http4s/Http4sGenerator.scala in my case.

KristianAN commented 6 months ago

Since the change changes the semantics of the program the easiest fix is maybe to just change from

private[this]

to

private[Http4sGenerator]