ajwang / groovypptest

Automatically exported from code.google.com/p/groovypptest
0 stars 0 forks source link

.with{} doesn't work #395

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
THE PROBLEM:
{code}
@Typed package pwn

"Some text".with {println it}
{code}
outputs null

{code}
@Typed package pwn

"Some text".with {String it->println it}
{code}
Doesn't compile because of "Cannot find method String.with({ String -> ...})" 
error.

THE SUGGESTION:
At compile time convert this code to 
{code}
String someTemporaryVariableNotPresentInOuterContext = "Some text"
println someTemporaryVariableNotPresentInOuterContext
{code}
and so on for more complex cases

Original issue reported on code.google.com by justn...@mail.ru on 12 Aug 2011 at 12:04