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

fix reverse routes escape with fixed param #11774

Merged
merged 2 commits into from Apr 27, 2023

Conversation

xuwei-k
Copy link
Contributor

@xuwei-k xuwei-k commented Apr 27, 2023

Pull Request Checklist

Helpful things

Fixes

Fix reverse routes generated code.

Purpose

escape if Scala keyword

Background Context

play generate following code and scalac report compile error before this fix

[error] target/scala-2.13/routes/main/controllers/ReverseRoutes.scala:382:35: illegal start of simple expression
[error]         case (_pf_escape_type) if type == "x" =>
[error]                                   ^
[error] target/scala-2.13/routes/main/controllers/ReverseRoutes.scala:383:97: '=>' expected but ';' found.
[error]           implicit lazy val _rrc = new play.core.routing.ReverseRouteContext(Map(("type", "x"))); _rrc
[error]                                                                                                 ^
[error] two errors found

References

@mkurz
Copy link
Member

mkurz commented Apr 27, 2023

Nice catch. I checked the generated code:

        case (_pf_escape_type) if type == "x" =>

now (correctly) becomes:

        case (_pf_escape_type) if _pf_escape_type == "x" =>

This is a bug fix and should be backported to 2.8.x

@mkurz mkurz force-pushed the reverse-routes-escape-fixed-param branch from 440c364 to b234be7 Compare April 27, 2023 21:23
@mkurz
Copy link
Member

mkurz commented Apr 27, 2023

@Mergifyio backport 2.8.x

@mergify
Copy link
Contributor

mergify bot commented Apr 27, 2023

backport 2.8.x

✅ Backports have been created

@mergify mergify bot merged commit dffbcc7 into playframework:main Apr 27, 2023
30 checks passed
@xuwei-k xuwei-k deleted the reverse-routes-escape-fixed-param branch April 27, 2023 22:52
mkurz added a commit that referenced this pull request Apr 28, 2023
[2.8.x] fix reverse routes escape with fixed param (backport #11774) by @xuwei-k
@mkurz
Copy link
Member

mkurz commented Jul 21, 2023

@xuwei-k This is part of Play 2.8.20 (but I guess you know that 😉)

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.

None yet

2 participants