diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2013-01-29 11:38:18 +0100 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2013-02-03 21:08:33 +0100 |
commit | a06d31f6a2df021acc18b10ad9cad0f80d7498f2 (patch) | |
tree | 25cebc80ca24ed95d4f2e297e583a07f98624403 /src | |
parent | 6697c283af73ff82b37f50a50e93e56934d5701c (diff) | |
download | scala-a06d31f6a2df021acc18b10ad9cad0f80d7498f2.tar.gz scala-a06d31f6a2df021acc18b10ad9cad0f80d7498f2.tar.bz2 scala-a06d31f6a2df021acc18b10ad9cad0f80d7498f2.zip |
Keep annotations when computing lubs
Integrates annotationsLub into lub.
Also fixes SubstSymMap when mapping over annotaion trees. I don't
understand what the previous code was supposed to achieve, but it
crashed in some of my examples.
Diffstat (limited to 'src')
-rw-r--r-- | src/reflect/scala/reflect/internal/Types.scala | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index 55873f6c2f..9d4bdab837 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -4706,23 +4706,13 @@ trait Types extends api.Types { self: SymbolTable => case idx => Some(to(idx)) } - override def transform(tree: Tree) = - tree match { - case tree@Ident(_) => - termMapsTo(tree.symbol) match { - case Some(tosym) => - if (tosym.info.bounds.hi.typeSymbol isSubClass SingletonClass) { - Ident(tosym.existentialToString) - .setSymbol(tosym) - .setPos(tosym.pos) - .setType(dropSingletonType(tosym.info.bounds.hi)) - } else { - giveup() - } - case none => super.transform(tree) - } - case tree => super.transform(tree) + override def transform(tree: Tree) = { + termMapsTo(tree.symbol) match { + case Some(tosym) => tree.symbol = tosym + case None => () } + super.transform(tree) + } } trans.transform(tree) } @@ -6618,7 +6608,7 @@ trait Types extends api.Types { self: SymbolTable => val ts0 = elimSub0(ts) if (ts0.isEmpty || ts0.tail.isEmpty) ts0 else { - val ts1 = ts0 mapConserve (t => elimAnonymousClass(t.underlying)) + val ts1 = ts0 mapConserve (t => elimAnonymousClass(t.dealiasWiden)) if (ts1 eq ts0) ts0 else elimSub(ts1, depth) } @@ -6735,6 +6725,8 @@ trait Types extends api.Types { self: SymbolTable => NullaryMethodType(lub0(matchingRestypes(ts, Nil))) case ts @ TypeBounds(_, _) :: rest => TypeBounds(glb(ts map (_.bounds.lo), depth), lub(ts map (_.bounds.hi), depth)) + case ts @ AnnotatedType(annots, tpe, _) :: rest => + annotationsLub(lub0(ts map (_.withoutAnnotations)), ts) case ts => lubResults get (depth, ts) match { case Some(lubType) => |