diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2015-01-19 21:40:20 +0100 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2015-01-20 11:39:48 +0100 |
commit | a8b6e361de37705036c4e8307ad75e279fafe9f5 (patch) | |
tree | 2e64ec99d239dca045bff93bdbd1471386090e3f /src | |
parent | 783c5ccfe7c2b22f1a1bdf6530028eac0d941702 (diff) | |
download | scala-a8b6e361de37705036c4e8307ad75e279fafe9f5.tar.gz scala-a8b6e361de37705036c4e8307ad75e279fafe9f5.tar.bz2 scala-a8b6e361de37705036c4e8307ad75e279fafe9f5.zip |
SI-9097 Remove spurious warning about conflicting filenames
When using delambdafy:method, closure classes are generated late.
The class is added to a map and integrated into the PackageDef in
transformStats.
When declaring a package object, there are potentially multiple
PackageDefs for the same package. In this case, the closure class
was added to all of them. As a result, GenASM / GenBCode would run
multiple times on the closure class. In GenBCode this would trigger
a warning about conflicting filenames.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/Delambdafy.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala index d2c511a2d1..1f832ba81e 100644 --- a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala +++ b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala @@ -113,7 +113,9 @@ abstract class Delambdafy extends Transform with TypingTransformers with ast.Tre // after working on the entire compilation until we'll have a set of // new class definitions to add to the top level override def transformStats(stats: List[Tree], exprOwner: Symbol): List[Tree] = { - super.transformStats(stats, exprOwner) ++ lambdaClassDefs(exprOwner) + // Need to remove from the lambdaClassDefs map: there may be multiple PackageDef for the same + // package when defining a package object. We only add the lambda class to one. See SI-9097. + super.transformStats(stats, exprOwner) ++ lambdaClassDefs.remove(exprOwner).getOrElse(Nil) } private def optionSymbol(sym: Symbol): Option[Symbol] = if (sym.exists) Some(sym) else None |