diff options
author | Martin Odersky <odersky@gmail.com> | 2016-06-29 20:07:51 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-07-11 13:35:03 +0200 |
commit | 02ce995f44c2252f7f7c0f07aa2a86f045b51ac2 (patch) | |
tree | 70768b1bf1aeec2e1f56acc6d0c390d9e9538cb5 /src/dotty/tools/dotc/transform/FullParameterization.scala | |
parent | 73dd03944cdfbc2588e9e41f407e0ad3a48abe96 (diff) | |
download | dotty-02ce995f44c2252f7f7c0f07aa2a86f045b51ac2.tar.gz dotty-02ce995f44c2252f7f7c0f07aa2a86f045b51ac2.tar.bz2 dotty-02ce995f44c2252f7f7c0f07aa2a86f045b51ac2.zip |
Refactoring of PolyType and TypeLambda
Make them each inherit from common BaseType GenericType.
That way we avoid inheriting accidentally stuff from PolyType in TypeLambda.
Also, Fix adaptation of type lambdas. Don't confuse them with PolyTypes.
Diffstat (limited to 'src/dotty/tools/dotc/transform/FullParameterization.scala')
-rw-r--r-- | src/dotty/tools/dotc/transform/FullParameterization.scala | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/transform/FullParameterization.scala b/src/dotty/tools/dotc/transform/FullParameterization.scala index be64df384..d2052d8cb 100644 --- a/src/dotty/tools/dotc/transform/FullParameterization.scala +++ b/src/dotty/tools/dotc/transform/FullParameterization.scala @@ -95,7 +95,7 @@ trait FullParameterization { */ def fullyParameterizedType(info: Type, clazz: ClassSymbol, abstractOverClass: Boolean = true, liftThisType: Boolean = false)(implicit ctx: Context): Type = { val (mtparamCount, origResult) = info match { - case info @ PolyType(mtnames) => (mtnames.length, info.resultType) + case info: PolyType => (info.paramNames.length, info.resultType) case info: ExprType => (0, info.resultType) case _ => (0, info) } @@ -111,18 +111,18 @@ trait FullParameterization { } /** Replace class type parameters by the added type parameters of the polytype `pt` */ - def mapClassParams(tp: Type, pt: PolyType): Type = { + def mapClassParams(tp: Type, pt: GenericType): Type = { val classParamsRange = (mtparamCount until mtparamCount + ctparams.length).toList tp.substDealias(ctparams, classParamsRange map (PolyParam(pt, _))) } /** The bounds for the added type parameters of the polytype `pt` */ - def mappedClassBounds(pt: PolyType): List[TypeBounds] = + def mappedClassBounds(pt: GenericType): List[TypeBounds] = ctparams.map(tparam => mapClassParams(tparam.info, pt).bounds) info match { - case info @ PolyType(mtnames) => - PolyType(mtnames ++ ctnames)( + case info: PolyType => + PolyType(info.paramNames ++ ctnames)( pt => (info.paramBounds.map(mapClassParams(_, pt).bounds) ++ mappedClassBounds(pt)).mapConserve(_.subst(info, pt).bounds), |