aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-02-21 12:41:41 +0100
committerMartin Odersky <odersky@gmail.com>2014-02-21 18:42:50 +0100
commit2ad997f43d02dd694814fff1037bcbf0557e6753 (patch)
treed3110ae59565831f0067759856238d1bf50eca5e /src/dotty/tools/dotc/core/Types.scala
parent56ffb721b612d7efdf1056335ffe46951217aa06 (diff)
downloaddotty-2ad997f43d02dd694814fff1037bcbf0557e6753.tar.gz
dotty-2ad997f43d02dd694814fff1037bcbf0557e6753.tar.bz2
dotty-2ad997f43d02dd694814fff1037bcbf0557e6753.zip
Performance improvement: Special-case implementation of underlyingIfRepeated
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 9a7fc59b8..661686bdd 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -590,8 +590,12 @@ object Types {
/** If this is repeated parameter type, its underlying type,
* else the type itself.
*/
- def underlyingIfRepeated(implicit ctx: Context): Type =
- this.translateParameterized(defn.RepeatedParamClass, defn.SeqClass)
+ def underlyingIfRepeated(implicit ctx: Context): Type = this match {
+ case rt @ RefinedType(tref: TypeRef, name) if defn.RepeatedParamClasses contains tref.symbol =>
+ RefinedType(defn.SeqClass.typeRef, name, rt.refinedInfo)
+ case _ =>
+ this
+ }
/** If this is a (possibly aliased, annotated, and/or parameterized) reference to
* a class, the class type ref, otherwise NoType.