Skip to content

Commit

Permalink
Fix enclosing method attribute for classes nested in trait fields
Browse files Browse the repository at this point in the history
Trait fields are now created as MethodSymbol (no longer TermSymbol).
This symbol shows up in the `originalOwner` chain of a class declared
within the field initializer. This promoted the field getter to
being the enclosing method of the nested class, which it is not
(the EnclosingMethod attribute is a source-level property).
  • Loading branch information
lrytz authored and adriaanm committed Oct 21, 2015
1 parent 2b916f4 commit b9052da
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ final class BCodeAsmCommon[G <: Global](val global: G) {

def enclosingMethod(sym: Symbol): Option[Symbol] = {
if (sym.isClass || sym == NoSymbol) None
else if (sym.isMethod) {
else if (sym.isMethod && !sym.isGetter) {
if (doesNotExist(sym)) None else Some(sym)
}
else enclosingMethod(nextEnclosing(sym))
Expand Down

0 comments on commit b9052da

Please sign in to comment.