diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-09-17 23:38:49 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-09-17 23:38:49 +0200 |
commit | 1e3012d5542b41b7303e6b8eda0931814a0b28f9 (patch) | |
tree | 801323966183e4a359e35897eff67f93096cee0e /test/files/run/t6287.scala | |
parent | 66603a2c003852d39faec20a9763fb0e25049cf4 (diff) | |
download | scala-1e3012d5542b41b7303e6b8eda0931814a0b28f9.tar.gz scala-1e3012d5542b41b7303e6b8eda0931814a0b28f9.tar.bz2 scala-1e3012d5542b41b7303e6b8eda0931814a0b28f9.zip |
SI-6287 fixes synthetic symbol clashes in toolbox
Apparently synthetic classes like $anonfun$1 have two properties:
1) Their names are generated using a counter unique to a compilation unit
2) After flatten they levitate to the nearest enclosing package
As a result if we use an empty package to wrap toolbox codegen,
then this package will soon be overflown by $anonfun$1 symbols, because:
1) New codegen session = new compilation unit = new counter which starts at 0
2) New codegen session = new anon funs that end up as children of empty package
Creating a freshly named package for each codegen session fixed the problem.
Now anonfuns from different sessions end up with different parents.
Diffstat (limited to 'test/files/run/t6287.scala')
-rw-r--r-- | test/files/run/t6287.scala | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/files/run/t6287.scala b/test/files/run/t6287.scala new file mode 100644 index 0000000000..0c75d1081b --- /dev/null +++ b/test/files/run/t6287.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect._ + +object Test extends App { + val tb = cm.mkToolBox() + val t1 = tb.parse("1 to 3 map (_+1)") + println(tb.eval(t1)) + println(tb.eval(t1)) + println(tb.eval(t1)) +}
\ No newline at end of file |