diff options
author | Uladzimir Abramchuk <u.abramchuk@gmail.com> | 2013-02-15 17:19:21 +0300 |
---|---|---|
committer | Uladzimir Abramchuk <u.abramchuk@gmail.com> | 2013-04-09 08:48:11 +0300 |
commit | 72503126d9c29ff029c4c9537234e1fb1d7a0130 (patch) | |
tree | 98169d35afebc835aaa886d2976401ba66695a21 /src/compiler | |
parent | 58ae1cacdb5fd65bbf876cc6a8d1d1de09e3ce68 (diff) | |
download | scala-72503126d9c29ff029c4c9537234e1fb1d7a0130.tar.gz scala-72503126d9c29ff029c4c9537234e1fb1d7a0130.tar.bz2 scala-72503126d9c29ff029c4c9537234e1fb1d7a0130.zip |
SI-6386 typed existential type tree's original now have tpe set
Tree reification fails for ExistentialTypeTree. The reason is that the
tree passed for reification (see reifyTree at GetTrees.scala) must have
not null tpe (see reifyBoundType at GenTrees.scala), which is not true
in the case of ExistentialTypeTree.
Why is it so? The tree passed to reifyTree was obtained in the reshape
phase of reificationusing using original TypeTrees that reporesent pre-
typer representation of a type. The problem is that original's tpe for
ExistentialTypeTree is not set.
So the solution to the issue is to create ExistentialTypeTree's original
in a such way that is has actual tpe set.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 34ba8b46f9..d1d6feae97 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -3887,8 +3887,16 @@ trait Typers extends Modes with Adaptations with Tags { if (vd.symbol.tpe.isVolatile) AbstractionFromVolatileTypeError(vd) val tpt1 = typedType(tree.tpt, mode) - existentialTransform(tree.whereClauses map (_.symbol), tpt1.tpe)((tparams, tp) => - TypeTree(newExistentialType(tparams, tp)) setOriginal tree + existentialTransform(tree.whereClauses map (_.symbol), tpt1.tpe)((tparams, tp) => { + val original = tpt1 match { + case tpt : TypeTree => atPos(tree.pos)(ExistentialTypeTree(tpt.original, tree.whereClauses)) + case _ => { + debuglog(s"cannot reconstruct the original for $tree, because $tpt1 is not a TypeTree") + tree + } + } + TypeTree(newExistentialType(tparams, tp)) setOriginal original + } ) } |