scala/scala — pull request #3234 by retronym (2013-12-07 18:39:57+00:00)
Title: SI-5508 Fix crasher with private[this] in nested traits

Currently, this is done late in the game as the Mixin tree transformer
treats the trait.

// Mixin#addLateInterfaceMembers
val getter = member.getter(clazz)
if (getter == NoSymbol) addMember(clazz, newGetter(member))

`addMember` mutates the type of the interface to add the getter.

However, if an inner class or anonymous function of the trait
has been flattened to a spot where it precedes the trait in the
enclosing packages info, this code hasn't had a chance to run,
and the lookup of the getter crashes as mixins postTransform
runs over a selection of the not-yet-materialized getter.

// Mixin#postTransform
case Select(qual, name) if sym.owner.isImplClass && !isStaticOnly(sym) =>
val iface = toInterface(sym.owner.tpe).typeSymbol
val ifaceGetter = sym getter iface

This commit removes ensures that Flatten lifts inner classes to
a position *after* the enclosing class in the stats of the
enclosing package.

Bonus fix: SI-6231