When compiling my project I get warning like this:
[warn] /mnt/e/dev/conf/routes:13:1: patterns after a variable pattern cannot match (SLS 8.1.1)
[warn] If you intended to match against parameter slug of method details, you must use backticks, like: case `slug` =>
[warn] GET /articles/:slug/ articles.ArticleController.details(request: Request, slug: String)
[warn] /mnt/e/dev/conf/routes:49:1: unreachable code due to variable pattern 'slug' on line 70
[warn] If you intended to match against parameter slug of method details, you must use backticks, like: case `slug` =>
[warn] GET /app/en-tos/ articles.ArticleController.details(request: Request, slug: String = "en-tos")
[...]
[warn] /mnt/e/dev/conf/routes:49:1: unreachable code
[warn] GET /app/en-tos/ articles.ArticleController.details(request: Request, slug: String = "en-tos")
Those routes look like:
GET /articles/:slug/ articles.ArticleController.details(request: Request, slug: String)
[...]
GET /app/en-tos/ articles.ArticleController.details(request: Request, slug: String = "en-tos")
The compilation log and route file contain some more similar entries, I only extracted those with method call with provided value slug=en-tos.
As you might guessed, there’s a controller which shows an article based on slug. For some predefined urls, the article slug is hardcoded in routes file. It seems everything works as intended, but the warnings worry me. What might be the issue?
I am using sbt 1.3.13, java 11, scala 2.13.3.