Details
-
Bug
-
Status: In Progress
-
Major
-
Resolution: Unresolved
-
3.0.0-alpha-4
-
None
-
None
Description
Consider this code:
def toUpperCase = { 'ONE' } 'two'.with { println toUpperCase() println 'toUpperCase'() println "${'toUpperCase'}"() }
It outputs this:
ONE ONE TWO
In other words, the argument to the second println is evaluated like the argument to the first one and not like the argument to the third one.
This seems very surprising and wrong:
- 'toUpperCase' is equal to "${'toUpperCase'}", so how can 'toUpperCase'() and "${'toUpperCase'}"() be evaluated differently?
- How can the string literal 'toUpperCase' evaluate to the local variable toUpperCase? The documentation mentions using string literals for property and method names, but not for local variable names.
In my opinion, the output should be:
ONE TWO TWO