aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Namer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-11-11 22:20:24 +0100
committerMartin Odersky <odersky@gmail.com>2016-11-11 22:20:24 +0100
commit97b6985c34915b58e0c81fbab464f4bd532c27d0 (patch)
tree968795a36f2eb50791166f8288a8d5ad1f72c285 /src/dotty/tools/dotc/typer/Namer.scala
parentf3c8fdddcc7a5aef1c206afb0942d4a961ef1186 (diff)
downloaddotty-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/typer/Namer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Namer.scala16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala
index 77f8ff786..3876fdf15 100644
--- a/src/dotty/tools/dotc/typer/Namer.scala
+++ b/src/dotty/tools/dotc/typer/Namer.scala
@@ -293,7 +293,7 @@ class Namer { typer: Typer =>
val inSuperCall1 = if (tree.mods is ParamOrAccessor) EmptyFlags else inSuperCall
// suppress inSuperCall for constructor parameters
val higherKinded = tree match {
- case tree: TypeDef if tree.tparams.nonEmpty && isDeferred => HigherKinded
+ case TypeDef(_, PolyTypeTree(_, _)) if isDeferred => HigherKinded
case _ => EmptyFlags
}
@@ -605,8 +605,12 @@ class Namer { typer: Typer =>
nestedCtx = localContext(sym).setNewScope
myTypeParams = {
implicit val ctx: Context = nestedCtx
- completeParams(original.tparams)
- original.tparams.map(symbolOfTree(_).asType)
+ val tparams = original.rhs match {
+ case PolyTypeTree(tparams, _) => tparams
+ case _ => Nil
+ }
+ completeParams(tparams)
+ tparams.map(symbolOfTree(_).asType)
}
}
myTypeParams
@@ -1005,7 +1009,11 @@ class Namer { typer: Typer =>
// inspects a TypeRef's info, instead of simply dealiasing alias types.
val isDerived = tdef.rhs.isInstanceOf[untpd.DerivedTypeTree]
- val rhsBodyType = typedAheadType(tdef.rhs).tpe
+ val rhs = tdef.rhs match {
+ case PolyTypeTree(_, body) => body
+ case rhs => rhs
+ }
+ val rhsBodyType = typedAheadType(rhs).tpe
val rhsType = if (isDerived) rhsBodyType else abstracted(rhsBodyType)
val unsafeInfo = rhsType match {
case bounds: TypeBounds => bounds