From 2ad997f43d02dd694814fff1037bcbf0557e6753 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 21 Feb 2014 12:41:41 +0100 Subject: Performance improvement: Special-case implementation of underlyingIfRepeated --- src/dotty/tools/dotc/core/Types.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/dotty/tools/dotc/core/Types.scala') 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. -- cgit v1.2.3