-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
ScalaGenerator should follow Scala Style Guide in generated code #5422
Comments
Implemented with #5421. This change is too minor compared to the lines of code adapted. We'll thus not merge this to jOOQ 3.8.x |
Hmm... This seems to introduce regressions related to the disambiguations put in place by jOOQ when adding suffixes. For instance, the following is illegal scala code: def getClass_: Integer = { ... } I guess this complicates things unnecessarily, without adding too much value. Will mark as "won't fix" |
Just so this note is somewhere, it occurred to me, this can be fixed in scala by wrapping the identifier in backticks if the last character is an underscore
I'll try submitting a more complete PR that includes the proper SCALA escaping of the identifier - maybe we can move this back from the "wontfix" bucket with a little bit more work. Here's the lexical reference that matters the most here: http://www.scala-lang.org/files/archive/spec/2.11/01-lexical-syntax.html
So, the only time _: would cause a compile error is when _ is the last character of the "original" identifier string, because it thinks there will be an op coming after it. Adding the backticks around the identifier should do the trick if the last character is that _ |
I fucked with this for probably more than I should have today, but I think it's coming together fine: #5431 |
Interesting. But this doesn't mean that the call site will need to quote the identifier too, right? |
@lukaseder Correct, the call site does not need to escape the identifier....unless the identifier had whitespace characters in it...you could technically do:
Will yield "foo and bar" |
Fixing this now in the context of #10191 |
Currently, the ScalaGenerator generates:
When it should generate:
All improvements:
:
return
where possibledef x(): T = expr
(single line) rather thandef x(): T = { expr }
(multi line)See:
The text was updated successfully, but these errors were encountered: