summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-09-17 20:09:41 +0200
committerJason Zaugg <jzaugg@gmail.com>2013-09-18 09:47:50 +0200
commit746f53e0cee601c189dac7a011f5be79591ece4c (patch)
tree40511a5e5a4b9f867b542fc127873b0733e66636 /src
parent9dbc321504ad5550638d6d7c2b3cd2f98273cf74 (diff)
downloadscala-746f53e0cee601c189dac7a011f5be79591ece4c.tar.gz
scala-746f53e0cee601c189dac7a011f5be79591ece4c.tar.bz2
scala-746f53e0cee601c189dac7a011f5be79591ece4c.zip
SI-7853 An unsatisfying fix regression in explicit outer
The attempt to placate pos/t4970.scala in 55c6fd4 roused another dragon. We've got two levers here: the type of the symbol of the outer accessor, and the type of its DefDef. They have been historically out of sync due to the vaguaries of finalResultType (which is far less vague since 671e6e03c7), but the finicky operation of ExplicitOuter now has a hard time when we try to bring them into line. This stuff is notoriously difficult to understand because the trees you see from `-Xprint` show a tpt derived from the method symbol's info, and discards the actual tpt in the tree. Rather than letting `DefDef(acc)` call `TypeTree(sym)` and use `sym.tpe_*.finalResultType`, this commit computes the member type of the accessor from the current class and explicitly uses that as the return type of the outer accessor def. We should try to push this a little deeper. I tried to put it into `def TypeTree`, but that broke, among others, run/concurrent-stream.scala. Maybe `def DefDef` and `def ValDef`? But a localised fix is the right start as it addresses the regression in a minimal fashion to get the IDE building again.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
index a2bf5bf9e5..ff750face5 100644
--- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
+++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
@@ -90,7 +90,7 @@ abstract class ExplicitOuter extends InfoTransform
sym expandName clazz
sym.referenced = clazz
- sym setInfo MethodType(Nil, restpe.widen)
+ sym setInfo MethodType(Nil, restpe)
}
def newOuterField(clazz: Symbol) = {
val accFlags = SYNTHETIC | ARTIFACT | PARAMACCESSOR | ( if (clazz.isEffectivelyFinal) PrivateLocal else PROTECTED )
@@ -361,10 +361,10 @@ abstract class ExplicitOuter extends InfoTransform
/** The definition tree of the outer accessor of current class
*/
def outerAccessorDef: Tree = localTyper typed {
- outerAccessor(currentClass) match {
- case acc if acc.isDeferred => DefDef(acc, EmptyTree)
- case acc => DefDef(acc, Select(This(currentClass), outerField(currentClass)))
- }
+ val acc = outerAccessor(currentClass)
+ val rhs = if (acc.isDeferred) EmptyTree else Select(This(currentClass), outerField(currentClass))
+ val tp = (currentClass.thisType memberType acc).finalResultType
+ newDefDef(acc, rhs)(tpt = TypeTree(tp))
}
/** The definition tree of the outer accessor for class mixinClass.