diff options
author | Martin Odersky <odersky@gmail.com> | 2016-10-12 14:37:37 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-10-15 19:33:51 +0200 |
commit | 8b55988c64ab7d777b6bf39987af6bafe070c2fb (patch) | |
tree | f033a4db58bfab9802dbb8e8cdf5b0f693bf402d /src/dotty/tools/dotc/typer/Typer.scala | |
parent | 2575d11bd1a670ace8bd7e91777ea135759af51f (diff) | |
download | dotty-8b55988c64ab7d777b6bf39987af6bafe070c2fb.tar.gz dotty-8b55988c64ab7d777b6bf39987af6bafe070c2fb.tar.bz2 dotty-8b55988c64ab7d777b6bf39987af6bafe070c2fb.zip |
Drop original on TypeTree
The plan is to keep original type until after pickling,
and afterwards replace it with a simple TypeTree.
# Conflicts:
# src/dotty/tools/dotc/core/tasty/TreePickler.scala
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 6be119319..f6d53f1e2 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -961,28 +961,23 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit } def typedTypeTree(tree: untpd.TypeTree, pt: Type)(implicit ctx: Context): TypeTree = track("typedTypeTree") { - if (tree.original.isEmpty) - tree match { - case tree: untpd.DerivedTypeTree => - tree.ensureCompletions - try - TypeTree(tree.derivedType(tree.attachment(untpd.OriginalSymbol))) withPos tree.pos - // btw, no need to remove the attachment. The typed - // tree is different from the untyped one, so the - // untyped tree is no longer accessed after all - // accesses with typedTypeTree are done. - catch { - case ex: NoSuchElementException => - println(s"missing OriginalSymbol for ${ctx.owner.ownersIterator.toList}") - throw ex - } - case _ => - assert(isFullyDefined(pt, ForceDegree.none)) - tree.withType(pt) - } - else { - val original1 = typed(tree.original) - cpy.TypeTree(tree)(original1).withType(original1.tpe) + tree match { + case tree: untpd.DerivedTypeTree => + tree.ensureCompletions + try + TypeTree(tree.derivedType(tree.attachment(untpd.OriginalSymbol))) withPos tree.pos + // btw, no need to remove the attachment. The typed + // tree is different from the untyped one, so the + // untyped tree is no longer accessed after all + // accesses with typedTypeTree are done. + catch { + case ex: NoSuchElementException => + println(s"missing OriginalSymbol for ${ctx.owner.ownersIterator.toList}") + throw ex + } + case _ => + assert(isFullyDefined(pt, ForceDegree.none)) + tree.withType(pt) } } |