diff options
author | Martin Odersky <odersky@gmail.com> | 2015-12-30 16:06:34 +0100 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2016-01-18 16:49:16 +0100 |
commit | c0b545be494bc53f9839c8301cdca71edeb620c7 (patch) | |
tree | 4ff0a9e473d7a63d8c11533331d6560412035781 /src | |
parent | dd733181fd943f5074af57b151da95df7c999fc9 (diff) | |
download | dotty-c0b545be494bc53f9839c8301cdca71edeb620c7.tar.gz dotty-c0b545be494bc53f9839c8301cdca71edeb620c7.tar.bz2 dotty-c0b545be494bc53f9839c8301cdca71edeb620c7.zip |
Keep rhs of TypeDef in typed tree
This is important for IDEs who want to see the full tree.
The tree now gets replaced by a TypeTree in PostTyper.
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/transform/PostTyper.scala | 9 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 3 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/transform/PostTyper.scala b/src/dotty/tools/dotc/transform/PostTyper.scala index 3266d3a02..edf97f5b8 100644 --- a/src/dotty/tools/dotc/transform/PostTyper.scala +++ b/src/dotty/tools/dotc/transform/PostTyper.scala @@ -180,6 +180,15 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisTran case tree: DefDef => transformAnnots(tree) superAcc.wrapDefDef(tree)(super.transform(tree).asInstanceOf[DefDef]) + case tree: TypeDef => + transformAnnots(tree) + val sym = tree.symbol + val tree1 = + if (sym.isClass) tree + else { + cpy.TypeDef(tree)(rhs = TypeTree(tree.symbol.info)) + } + super.transform(tree1) case tree: MemberDef => transformAnnots(tree) super.transform(tree) diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 511a12ea7..008eab0fd 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -961,8 +961,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit val TypeDef(name, rhs) = tdef checkLowerNotHK(sym, tdef.tparams.map(symbolOfTree), tdef.pos) completeAnnotations(tdef, sym) - val _ = typedType(rhs) // unused, typecheck only to remove from typedTree - assignType(cpy.TypeDef(tdef)(name, TypeTree(sym.info), Nil), sym) + assignType(cpy.TypeDef(tdef)(name, typedType(rhs), Nil), sym) } def typedClassDef(cdef: untpd.TypeDef, cls: ClassSymbol)(implicit ctx: Context) = track("typedClassDef") { |