aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeApplications.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-11-29 19:11:18 +0100
committerGuillaume Martres <smarter@ubuntu.com>2015-11-30 17:31:32 +0100
commite77428eb0bf0d9f68f4055d686cbabe111a4afdf (patch)
tree16c8fcfc8d8ebaf0ed3840aaa2a334fd3eab029b /src/dotty/tools/dotc/core/TypeApplications.scala
parent4ca8744da021642d9f943224950482b3344cf089 (diff)
downloaddotty-e77428eb0bf0d9f68f4055d686cbabe111a4afdf.tar.gz
dotty-e77428eb0bf0d9f68f4055d686cbabe111a4afdf.tar.bz2
dotty-e77428eb0bf0d9f68f4055d686cbabe111a4afdf.zip
Drop argumnt interpolation.
It turns out it's not needed because now all type arguments are expressed as aliases. Interestingly dropping this feature shaved 20% off the time off junit tests. Which seems to indicate that the handling of type application is really performance critical.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeApplications.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeApplications.scala24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala
index be070dace..a023322ac 100644
--- a/src/dotty/tools/dotc/core/TypeApplications.scala
+++ b/src/dotty/tools/dotc/core/TypeApplications.scala
@@ -286,7 +286,7 @@ class TypeApplications(val self: Type) extends AnyVal {
*/
final def baseArgInfos(base: Symbol)(implicit ctx: Context): List[Type] =
if (self derivesFrom base)
- base.typeParams map (param => self.member(param.name).info.argInfo(param))
+ base.typeParams map (param => self.member(param.name).info.argInfo)
else
Nil
@@ -311,7 +311,7 @@ class TypeApplications(val self: Type) extends AnyVal {
/** The first type argument of the base type instance wrt `base` of this type */
final def firstBaseArgInfo(base: Symbol)(implicit ctx: Context): Type = base.typeParams match {
case param :: _ if self derivesFrom base =>
- self.member(param.name).info.argInfo(param)
+ self.member(param.name).info.argInfo
case _ =>
NoType
}
@@ -371,7 +371,7 @@ class TypeApplications(val self: Type) extends AnyVal {
* Existential types in arguments are returned as TypeBounds instances.
* @param interpolate See argInfo
*/
- final def argInfos(interpolate: Boolean)(implicit ctx: Context): List[Type] = {
+ final def argInfos(implicit ctx: Context): List[Type] = {
var tparams: List[TypeSymbol] = null
def recur(tp: Type, refineCount: Int): mutable.ListBuffer[Type] = tp.stripTypeVar match {
case tp @ RefinedType(tycon, name) =>
@@ -381,7 +381,7 @@ class TypeApplications(val self: Type) extends AnyVal {
if (tparams == null) tparams = tycon.typeParams
if (buf.size < tparams.length) {
val tparam = tparams(buf.size)
- if (name == tparam.name) buf += tp.refinedInfo.argInfo(tparam, interpolate)
+ if (name == tparam.name) buf += tp.refinedInfo.argInfo
else null
} else null
}
@@ -393,8 +393,6 @@ class TypeApplications(val self: Type) extends AnyVal {
if (buf == null) Nil else buf.toList
}
- final def argInfos(implicit ctx: Context): List[Type] = argInfos(interpolate = true)
-
/** Argument types where existential types in arguments are disallowed */
def argTypes(implicit ctx: Context) = argInfos mapConserve noBounds
@@ -428,18 +426,10 @@ class TypeApplications(val self: Type) extends AnyVal {
*
* for a contravariant type-parameter becomes L.
*/
- final def argInfo(tparam: Symbol, interpolate: Boolean = true)(implicit ctx: Context): Type = self match {
+ final def argInfo(implicit ctx: Context): Type = self match {
case self: TypeAlias => self.alias
- case TypeBounds(lo, hi) =>
- if (interpolate) {
- val v = tparam.variance
- if (v > 0 && (lo isRef defn.NothingClass)) hi
- else if (v < 0 && (hi isRef defn.AnyClass)) lo
- else self
- }
- else self
- case _ =>
- NoType
+ case self: TypeBounds => self
+ case _ => NoType
}
/** The element type of a sequence or array */