diff options
author | Lukas Rytz <lukas.rytz@typesafe.com> | 2014-07-09 16:33:54 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@typesafe.com> | 2014-07-09 16:33:54 +0200 |
commit | aea6519685561ee076e7fdaac48c2bf970389b83 (patch) | |
tree | d8e37b54a6cc5196a555a05df7ce2ddc0200dfe4 /src/compiler/scala/tools/nsc/symtab/classfile | |
parent | 4d3ede90b599a344b6d88316a7f62472ef8520e2 (diff) | |
parent | 14fa7bef120cbb996d042daba6095530167c49ed (diff) | |
download | scala-aea6519685561ee076e7fdaac48c2bf970389b83.tar.gz scala-aea6519685561ee076e7fdaac48c2bf970389b83.tar.bz2 scala-aea6519685561ee076e7fdaac48c2bf970389b83.zip |
Merge pull request #3867 from lrytz/t8708
SI-8708 Fix pickling of LOCAL_CHILD child of sealed classes
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab/classfile')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala index 2fc00fe068..25e13a1314 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala @@ -186,7 +186,16 @@ abstract class Pickler extends SubComponent { val (locals, globals) = sym.children partition (_.isLocalClass) val children = if (locals.isEmpty) globals - else globals + sym.newClassWithInfo(tpnme.LOCAL_CHILD, List(sym.tpe), EmptyScope, pos = sym.pos) + else { + // The LOCAL_CHILD was introduced in 12a2b3b to fix Aladdin bug 1055. When a sealed + // class/trait has local subclasses, a single <local child> class symbol is added + // as pickled child (instead of a reference to the anonymous class; that was done + // initially, but seems not to work, as the bug shows). + // Adding the LOCAL_CHILD is necessary to retain exhaustivity warnings under separate + // compilation. See test neg/aladdin1055. + val parents = (if (sym.isTrait) List(definitions.ObjectTpe) else Nil) ::: List(sym.tpe) + globals + sym.newClassWithInfo(tpnme.LOCAL_CHILD, parents, EmptyScope, pos = sym.pos) + } putChildren(sym, children.toList sortBy (_.sealedSortName)) } |