Skip to content

Allow word format as variable name in templates#1097

Merged
mkurz merged 2 commits intoplayframework:mainfrom
mkurz:allow_var_format
Dec 4, 2025
Merged

Allow word format as variable name in templates#1097
mkurz merged 2 commits intoplayframework:mainfrom
mkurz:allow_var_format

Conversation

@mkurz
Copy link
Copy Markdown
Member

@mkurz mkurz commented Dec 4, 2025

@mkurz
Copy link
Copy Markdown
Member Author

mkurz commented Dec 4, 2025

As expected:

 [info] - should compile successfully when using 'format' as variable name *** FAILED ***
[info]   play.twirl.compiler.test.Helper$CompilationError: value raw is not a member of String
[info]   at play.twirl.compiler.test.Helper$CompilerHelper.$anonfun$compile$1(Helper.scala:117)
[info]   at scala.Option.foreach(Option.scala:407)
[info]   at play.twirl.compiler.test.Helper$CompilerHelper.compile(Helper.scala:114)
[info]   at play.twirl.compiler.test.CompilerSpec.$anonfun$new$65(CompilerSpec.scala:1008)
[info]   at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)
[info]   at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83)
[info]   at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
[info]   at org.scalatest.Transformer.apply(Transformer.scala:22)
[info]   at org.scalatest.Transformer.apply(Transformer.scala:20)
[info]   at org.scalatest.wordspec.AnyWordSpecLike$$anon$3.apply(AnyWordSpecLike.scala:1240)

@mkurz mkurz marked this pull request as ready for review December 4, 2025 22:53
@mkurz
Copy link
Copy Markdown
Member Author

mkurz commented Dec 4, 2025

Fixed.
fyi: Play needs to bump to this twirl version because play compiles some default twirl pages like error.scala.html, so those artifacts need to be updated to use the new variable $twirl__format.

@mkurz mkurz merged commit a712fc3 into playframework:main Dec 4, 2025
15 checks passed
@mkurz mkurz deleted the allow_var_format branch December 4, 2025 23:12
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

Successfully merging this pull request may close these issues.

1 participant