diff options
author | Martin Odersky <odersky@gmail.com> | 2016-11-11 22:20:24 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-11-11 22:20:24 +0100 |
commit | 97b6985c34915b58e0c81fbab464f4bd532c27d0 (patch) | |
tree | 968795a36f2eb50791166f8288a8d5ad1f72c285 /src/dotty/tools/dotc/ast/TreeInfo.scala | |
parent | f3c8fdddcc7a5aef1c206afb0942d4a961ef1186 (diff) | |
download | dotty-97b6985c34915b58e0c81fbab464f4bd532c27d0.tar.gz dotty-97b6985c34915b58e0c81fbab464f4bd532c27d0.tar.bz2 dotty-97b6985c34915b58e0c81fbab464f4bd532c27d0.zip |
Clean up parameterized typedefs
Express them in terms PolyTypeTrees rather than having an
irregular, untyped only tparams field. This is necessary
if we want to pickle type trees instead of types, because
now the rhs of a typedef tells the whole story, so we are not
required any longer to use the info of the symbol.
Diffstat (limited to 'src/dotty/tools/dotc/ast/TreeInfo.scala')
-rw-r--r-- | src/dotty/tools/dotc/ast/TreeInfo.scala | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/ast/TreeInfo.scala b/src/dotty/tools/dotc/ast/TreeInfo.scala index 8b2915174..d1e6bd38a 100644 --- a/src/dotty/tools/dotc/ast/TreeInfo.scala +++ b/src/dotty/tools/dotc/ast/TreeInfo.scala @@ -272,7 +272,12 @@ trait UntypedTreeInfo extends TreeInfo[Untyped] { self: Trees.Instance[Untyped] case mdef: ValOrDefDef => mdef.unforcedRhs == EmptyTree && !mdef.name.isConstructorName && !mdef.mods.is(ParamAccessor) case mdef: TypeDef => - mdef.rhs.isEmpty || mdef.rhs.isInstanceOf[TypeBoundsTree] + def isBounds(rhs: Tree): Boolean = rhs match { + case _: TypeBoundsTree => true + case PolyTypeTree(_, body) => isBounds(body) + case _ => false + } + mdef.rhs.isEmpty || isBounds(mdef.rhs) case _ => false } @@ -382,9 +387,9 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] => def isIdempotentRef(tree: Tree)(implicit ctx: Context) = refPurity(tree) >= Idempotent - /** If `tree` is a constant expression, its value as a Literal, + /** If `tree` is a constant expression, its value as a Literal, * or `tree` itself otherwise. - * + * * Note: Demanding idempotency instead of purity in literalize is strictly speaking too loose. * Example * @@ -410,11 +415,11 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] => * * Revisit this issue once we have implemented `inline`. Then we can demand * purity of the prefix unless the selection goes to an inline val. - * + * * Note: This method should be applied to all term tree nodes that are not literals, * that can be idempotent, and that can have constant types. So far, only nodes - * of the following classes qualify: - * + * of the following classes qualify: + * * Ident * Select * TypeApply |