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

Value Raw is not a member of String error with variable named format present #112

Open
intracer opened this issue Aug 5, 2016 · 1 comment

Comments

@intracer
Copy link

intracer commented Aug 5, 2016

Sometimes variable names lead to this misterious error

Here is example that I found on the internet http://www.ethanjoachimeldridge.info/tech-blog/value-raw-not-member-string-scala

[error] /path/app/views/common/templateNotFound.scala.xml:4: value raw is not a member of String
[error] The template or the format does exist
[error] ^
[error] one error found
error Compilation failed

View did not compile with variables @(template: String, format: String) and compiled with variable names @(badTemplate: String, badFormat: String)

I also had to rename String variable format to outputFormat to avoid this issue

@intracer intracer changed the title Value Raw is not a member of String error with variable named format Value Raw is not a member of String error with variable named format present Aug 5, 2016
@intracer
Copy link
Author

intracer commented Aug 9, 2016

I think it is related to https://github.com/playframework/twirl/blob/cca9cd8c450205bb5b1fed33b5614bd46dccaa6f/compiler/src/main/scala/play/twirl/compiler/TwirlCompiler.scala as it contains format.raw

   (if (previous.isEmpty) Nil else previous :+ ",") :+
              "format.raw" :+ Source("(", p.pos) :+ quoteAndEscape(grouped.head) :+ ")" :+
              grouped.tail.flatMap { t => Seq(",\nformat.raw(", quoteAndEscape(t), ")") }

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

No branches or pull requests

2 participants