diff options
author | Paul Phillips <paulp@improving.org> | 2013-01-25 16:39:39 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-01-25 18:16:40 -0800 |
commit | cc067e6508546d3b830422d57034210489a54151 (patch) | |
tree | b5dd29c21822f4dd6d3064dc1a734a45ca3a712c /src/compiler/scala/tools/nsc/transform/Mixin.scala | |
parent | 5abf901ea347fc0319c6a191454211f704d04961 (diff) | |
parent | 2fa859e1b3eb2ac57058feaba87d96adfbac9209 (diff) | |
download | scala-cc067e6508546d3b830422d57034210489a54151.tar.gz scala-cc067e6508546d3b830422d57034210489a54151.tar.bz2 scala-cc067e6508546d3b830422d57034210489a54151.zip |
Merge remote-tracking branch 'origin/2.10.x' into pr/merge-2.10
* origin/2.10.x:
SI-6969, mishandling of SoftReferences in method cache.
SI-7011 Fix finding constructor type in captured var definitions
SI-6987 Tests fsc verbose output
SI-6987 Fixes fsc compile server verbose output
SI-6231 Report unsupported free var capture by a trait.
SI-6666 Restrict hidden `this` access in self/super calls.
SI-6902 Check unreachability under @unchecked
SI-6976 Fix value class separate compilation crasher.
Closes SI-6952: add correct error positions for Dynamic feature check.
Conflicts:
src/compiler/scala/tools/nsc/CompileServer.scala
src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/Mixin.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/Mixin.scala | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala index 6a253a98b1..3e5ac6922e 100644 --- a/src/compiler/scala/tools/nsc/transform/Mixin.scala +++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala @@ -1214,9 +1214,24 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { // refer to fields in some implementation class via an abstract // getter in the interface. val iface = toInterface(sym.owner.tpe).typeSymbol - val getter = sym getter iface orElse abort("No getter for " + sym + " in " + iface) + val ifaceGetter = sym getter iface + + def si6231Restriction() { + // See SI-6231 comments in LamdaLift for ideas on how to lift the restriction. + val msg = sm"""Implementation restriction: local ${iface.fullLocationString} is unable to automatically capture the + |free variable ${sym} on behalf of ${currentClass}. You can manually assign it to a val inside the trait, + |and refer that that val in ${currentClass}. For more details, see SI-6231.""" + reporter.error(tree.pos, msg) + } - typedPos(tree.pos)((qual DOT getter)()) + if (ifaceGetter == NoSymbol) { + if (sym.isParamAccessor) { + si6231Restriction() + EmptyTree + } + else abort("No getter for " + sym + " in " + iface) + } + else typedPos(tree.pos)((qual DOT ifaceGetter)()) case Assign(Apply(lhs @ Select(qual, _), List()), rhs) => // assign to fields in some implementation class via an abstract |