diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2015-02-02 21:04:49 +0100 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2015-02-07 07:45:49 +0100 |
commit | 1437aa88241d5e99900a86b25c6ce385c2708570 (patch) | |
tree | e026a19cb5ed382fc8f2b697045cf4dd5d7c372e /src | |
parent | 0bcc871e3f4c4331fb53ec0e7087669589a607d6 (diff) | |
download | scala-1437aa88241d5e99900a86b25c6ce385c2708570.tar.gz scala-1437aa88241d5e99900a86b25c6ce385c2708570.tar.bz2 scala-1437aa88241d5e99900a86b25c6ce385c2708570.zip |
SI-9124 fix EnclosingMethod of classes nested in implOnly trait defs
Private trait methods are not added to the generated interface, they
end up only in the implementation class. For classes nested in such
methods, the EnclosingMethod attribute was incorrect.
Since the EnclosingMethod attribute expresses a source-level property,
but the actual enclosing method does not exist in the bytecode, we
set the enclosing method to null.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala index 90d2fcf4dc..09d78fdf41 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala @@ -128,7 +128,11 @@ final class BCodeAsmCommon[G <: Global](val global: G) { assert(classSym.isClass, classSym) def enclosingMethod(sym: Symbol): Option[Symbol] = { if (sym.isClass || sym == NoSymbol) None - else if (sym.isMethod) Some(sym) + else if (sym.isMethod) { + // SI-9124, some trait methods don't exist in the generated interface. see comment in BTypes. + if (sym.owner.isTrait && sym.isImplOnly) None + else Some(sym) + } else enclosingMethod(nextEnclosing(sym)) } enclosingMethod(nextEnclosing(classSym)) |