aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/SymDenotations.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-03-26 16:40:05 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2014-03-27 12:37:41 +0100
commit0e2deaa32e57661743b2cf243833cafee5388b70 (patch)
tree6d71e79382f2894ad2a16ab4fa3707004e4df1c0 /src/dotty/tools/dotc/core/SymDenotations.scala
parentce372c540c5a879db5bf9792b3448ca932f503e5 (diff)
downloaddotty-0e2deaa32e57661743b2cf243833cafee5388b70.tar.gz
dotty-0e2deaa32e57661743b2cf243833cafee5388b70.tar.bz2
dotty-0e2deaa32e57661743b2cf243833cafee5388b70.zip
Changes to how we compute type parameters
Aim: Avoid expensive scanning of definitions in denotations other than the initial one. Technique: 1. If phase is erased, type params is Nil (except for Array class) 2. Otherwise, type params is the same as it was in initial phase.
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 362738caf..248cf3de3 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -805,8 +805,12 @@ object SymDenotations {
/** The type parameters of this class */
override final def typeParams(implicit ctx: Context): List[TypeSymbol] = {
- def computeTypeParams = decls.filter(sym =>
- (sym is TypeParam) && sym.owner == symbol).asInstanceOf[List[TypeSymbol]]
+ def computeTypeParams = {
+ if (ctx.phase.erasedTypes && (this ne defn.ArrayClass)) Nil
+ else if (this ne initial) initial.asSymDenotation.typeParams
+ else decls.filter(sym =>
+ (sym is TypeParam) && sym.owner == symbol).asInstanceOf[List[TypeSymbol]]
+ }
if (myTypeParams == null) myTypeParams = computeTypeParams
myTypeParams
}