diff options
author | Martin Odersky <odersky@gmail.com> | 2014-07-10 15:34:26 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-07-17 11:02:01 +0200 |
commit | 290343cbd04d0f97818b0bec6f227c237c1e7293 (patch) | |
tree | 9dcf84a83f2ff2639a07afa69d55a4b4c010682d /src/dotty/tools/dotc/transform/TypeUtils.scala | |
parent | 1bb16c4ec5a5c677d2b606e652733cd7a3867a2b (diff) | |
download | dotty-290343cbd04d0f97818b0bec6f227c237c1e7293.tar.gz dotty-290343cbd04d0f97818b0bec6f227c237c1e7293.tar.bz2 dotty-290343cbd04d0f97818b0bec6f227c237c1e7293.zip |
Fixes to TypeUtils
Some fixes to toStatic. Also added a method that transforms a RepeatedType to the corresponding Seq type.
Diffstat (limited to 'src/dotty/tools/dotc/transform/TypeUtils.scala')
-rw-r--r-- | src/dotty/tools/dotc/transform/TypeUtils.scala | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/TypeUtils.scala b/src/dotty/tools/dotc/transform/TypeUtils.scala index 87d47e0cd..efc0fdd24 100644 --- a/src/dotty/tools/dotc/transform/TypeUtils.scala +++ b/src/dotty/tools/dotc/transform/TypeUtils.scala @@ -7,6 +7,7 @@ import Contexts._ import Symbols._ import Decorators._ import StdNames.nme +import NameOps._ import language.implicitConversions object TypeUtils { @@ -36,10 +37,11 @@ class TypeUtils(val self: Type) extends AnyVal { def toStatic(clazz: ClassSymbol)(implicit ctx: Context): Type = { val (mtparamCount, origResult) = self match { case self @ PolyType(mtnames) => (mtnames.length, self.resultType) + case self: ExprType => (0, self.resultType) case _ => (0, self) } val ctparams = clazz.typeParams - val ctnames = ctparams.map(_.name) + val ctnames = ctparams.map(_.name.unexpandedName()) /** The method result type, prior to mapping any type parameters */ val resultType = { @@ -112,4 +114,8 @@ class TypeUtils(val self: Type) extends AnyVal { case _ => self } + + /** The Seq type corresponding to this repeated parameter type */ + def repeatedToSeq(implicit ctx: Context) = + self.translateParameterized(defn.RepeatedParamClass, defn.SeqClass) }
\ No newline at end of file |