summaryrefslogtreecommitdiff
path: root/src/reflect
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-09-18 11:18:28 +0200
committerJason Zaugg <jzaugg@gmail.com>2013-09-18 11:34:39 +0200
commit0f67e8dddcb8b087560fed90339d9235179dd1ea (patch)
tree9a5b92b7139215faf0c3efb5bf48314116db3abb /src/reflect
parent746f53e0cee601c189dac7a011f5be79591ece4c (diff)
downloadscala-0f67e8dddcb8b087560fed90339d9235179dd1ea.tar.gz
scala-0f67e8dddcb8b087560fed90339d9235179dd1ea.tar.bz2
scala-0f67e8dddcb8b087560fed90339d9235179dd1ea.zip
SI-7853 A less ad-hoc place to call memberType
Rather than localizing the fix to the outerAccessor, this commit pushed the call to `memberType` into *all* usages of `newValDef` and `newDefDef`. The TPT of `applyOrElse` in synthetized partial functions must be set explicitly to pass the pos/t7853-partial-function.scala. Otherwise, the as-seen-from ends up cloning the type parameter `B1` of `applyOrElse` as it transforms (questionably) its bound from `List[Int @unchecked]` to `List[Int]`. Partial Function synthesis was already a delicate area, and this makes things more explicit which could be counted as an improvement.
Diffstat (limited to 'src/reflect')
-rw-r--r--src/reflect/scala/reflect/internal/Trees.scala10
1 files changed, 7 insertions, 3 deletions
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
)