diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-11-27 15:13:50 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-12-19 15:27:06 +0100 |
commit | cca4d51dbf3f8478cb338e6d53e34003e9a3fa45 (patch) | |
tree | 047ae290cd9490c8494085f94dd07986ee801ec8 /test/files/neg/t6231.check | |
parent | d99a4919e0fa4894829c752a8f881d7b103d8cda (diff) | |
download | scala-cca4d51dbf3f8478cb338e6d53e34003e9a3fa45.tar.gz scala-cca4d51dbf3f8478cb338e6d53e34003e9a3fa45.tar.bz2 scala-cca4d51dbf3f8478cb338e6d53e34003e9a3fa45.zip |
SI-5508 Fix crasher with private[this] in nested traits
Currently, accessors for private local trait fields are added
very late in the game when the `Mixin` tree transformer treats the
trait. By contrast, fields with weaker access have accessors created
eagerly in `Namers`.
// 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.
(This seems like a pretty poor design: usually if a phase changes
types, it should do in an `InfoTransformer`.)
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 ensures that `Flatten` lifts inner classes to
a position *after* the enclosing class in the stats of the
enclosing package.
Bonus fix: SI-7012 (the followup ticket to SI-6231 / SI-2897)
Diffstat (limited to 'test/files/neg/t6231.check')
-rw-r--r-- | test/files/neg/t6231.check | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/test/files/neg/t6231.check b/test/files/neg/t6231.check deleted file mode 100644 index 6e107c97c7..0000000000 --- a/test/files/neg/t6231.check +++ /dev/null @@ -1,6 +0,0 @@ -t6231.scala:4: error: Implementation restriction: local trait Bug$X$1 is unable to automatically capture the -free variable value ev$1 on behalf of <$anon: Function0>. You can manually assign it to a val inside the trait, -and refer to that val in <$anon: Function0>. For more details, see SI-6231. - def qux = { () => ev } - ^ -one error found |