diff options
author | Lukas Rytz <lukas.rytz@typesafe.com> | 2014-10-07 10:20:19 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@typesafe.com> | 2014-10-07 10:20:19 +0200 |
commit | d028d89ece11a886cce88e2c0e1d8443d6271e0c (patch) | |
tree | 63fdbfba99b374c520b49886d32e5ddf0d7babbb | |
parent | 8d25e84c9123fe9784ec9844b5184aa1b697b429 (diff) | |
parent | 1ee6352a79d0b9001f4f1249708e7c6350b241ae (diff) | |
download | scala-d028d89ece11a886cce88e2c0e1d8443d6271e0c.tar.gz scala-d028d89ece11a886cce88e2c0e1d8443d6271e0c.tar.bz2 scala-d028d89ece11a886cce88e2c0e1d8443d6271e0c.zip |
Merge pull request #4033 from retronym/ticket/8888
SI-8888 Avoid ClassFormatError under -Ydelambdafy:method
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/Delambdafy.scala | 2 | ||||
-rw-r--r-- | test/files/run/t8888.flags | 1 | ||||
-rw-r--r-- | test/files/run/t8888.scala | 12 |
3 files changed, 14 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala index 12e7b23f48..835d338ab3 100644 --- a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala +++ b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala @@ -260,7 +260,7 @@ abstract class Delambdafy extends Transform with TypingTransformers with ast.Tre val captureProxies2 = new LinkedHashMap[Symbol, TermSymbol] captures foreach {capture => - val sym = lambdaClass.newVariable(capture.name.toTermName, capture.pos, SYNTHETIC) + val sym = lambdaClass.newVariable(unit.freshTermName(capture.name.toString + "$"), capture.pos, SYNTHETIC) sym setInfo capture.info captureProxies2 += ((capture, sym)) } diff --git a/test/files/run/t8888.flags b/test/files/run/t8888.flags new file mode 100644 index 0000000000..48b438ddf8 --- /dev/null +++ b/test/files/run/t8888.flags @@ -0,0 +1 @@ +-Ydelambdafy:method diff --git a/test/files/run/t8888.scala b/test/files/run/t8888.scala new file mode 100644 index 0000000000..36cc1ddf3e --- /dev/null +++ b/test/files/run/t8888.scala @@ -0,0 +1,12 @@ +class C { + final def resume: Unit = (this: Any) match { + case x : C => (x: Any) match { + case y : C => + () => (x, y) // used to trigger a ClassFormatError under -Ydelambdafy:method + } + } +} + +object Test extends App { + new C().resume +} |