diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala | 9 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 2 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/Trees.scala | 10 |
3 files changed, 12 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala index a2bf5bf9e5..540b8f6c6c 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,9 @@ 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)) + DefDef(acc, rhs) } /** The definition tree of the outer accessor for class mixinClass. diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 3ac0b398ee..55268b1e1a 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -2606,7 +2606,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper } val rhs = methodBodyTyper.virtualizedMatch(match_, mode, B1.tpe) - val defdef = newDefDef(methodSym, rhs)(vparamss = mapParamss(methodSym)(newParam)) + val defdef = newDefDef(methodSym, rhs)(vparamss = mapParamss(methodSym)(newParam), tpt = TypeTree(B1.tpe)) (defdef, matchResTp) } diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala index 38f1f0f725..2163a26b84 100644 --- a/src/reflect/scala/reflect/internal/Trees.scala +++ b/src/reflect/scala/reflect/internal/Trees.scala @@ -589,7 +589,11 @@ trait Trees extends api.Trees { self: SymbolTable => object TypeTree extends TypeTreeExtractor def TypeTree(tp: Type): TypeTree = TypeTree() setType tp - def TypeTree(sym: Symbol): TypeTree = atPos(sym.pos.focus)(TypeTree(sym.tpe_*.finalResultType)) + private def TypeTreeMemberType(sym: Symbol): TypeTree = { + // Needed for pos/t4970*.scala. See SI-7853 + val resType = (sym.owner.thisType memberType sym).finalResultType + atPos(sym.pos.focus)(TypeTree(resType)) + } def TypeBoundsTree(bounds: TypeBounds): TypeBoundsTree = TypeBoundsTree(TypeTree(bounds.lo), TypeTree(bounds.hi)) def TypeBoundsTree(sym: Symbol): TypeBoundsTree = atPos(sym.pos)(TypeBoundsTree(sym.info.bounds)) @@ -1039,7 +1043,7 @@ trait Trees extends api.Trees { self: SymbolTable => def newValDef(sym: Symbol, rhs: Tree)( mods: Modifiers = Modifiers(sym.flags), name: TermName = sym.name.toTermName, - tpt: Tree = TypeTree(sym) + tpt: Tree = TypeTreeMemberType(sym) ): ValDef = ( atPos(sym.pos)(ValDef(mods, name, tpt, rhs)) setSymbol sym ) @@ -1049,7 +1053,7 @@ trait Trees extends api.Trees { self: SymbolTable => name: TermName = sym.name.toTermName, tparams: List[TypeDef] = sym.typeParams map TypeDef, vparamss: List[List[ValDef]] = mapParamss(sym)(ValDef), - tpt: Tree = TypeTree(sym) + tpt: Tree = TypeTreeMemberType(sym) ): DefDef = ( atPos(sym.pos)(DefDef(mods, name, tparams, vparamss, tpt, rhs)) setSymbol sym ) |