summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2009-12-15 14:47:35 +0000
committerAdriaan Moors <adriaan.moors@epfl.ch>2009-12-15 14:47:35 +0000
commit4681d842dc71ead023878b4c3b1677a51b5177d5 (patch)
treeb81d7cf3c381e93a693b8fd89714fe25ed45db34 /src/compiler
parente59e58b003569be13033d84af38acc7ab6d69139 (diff)
downloadscala-4681d842dc71ead023878b4c3b1677a51b5177d5.tar.gz
scala-4681d842dc71ead023878b4c3b1677a51b5177d5.tar.bz2
scala-4681d842dc71ead023878b4c3b1677a51b5177d5.zip
closes #2778: need to refresh normalize cache w...
closes #2778: need to refresh normalize cache when length of type parameters changes -- thanks to Jason Zaugg for the diagnosis review by odersky
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index 6f9f5ca023..18597a037c 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -1655,12 +1655,21 @@ A type's typeSymbol should never be inspected directly.
super.normalize
}
+ // track number of type parameters that we saw when caching normalization,
+ // so we can refresh our cache when the known list of type parameters changes (due to further class file loading)
+ // TODO: this would not be necessary if we could replace the call to sym.unsafeTypeParams in typeParamsDirect
+ // by a call to sym.typeParams, but need to verify that that does not lead to spurious "illegal cycle" errors
+ // the need for refreshing the cache is illustrated by #2278
+ // TODO: no test case in the suite because don't know how to tell partest to compile in different runs,
+ // and in a specific order
+ private var normalizeTyparCount = -1
override def normalize: Type =
if (phase.erasedTypes) normalize0
- else {
- if (normalized == null) normalized = normalize0
+ else if (normalized == null || typeParamsDirect.length != normalizeTyparCount) {
+ normalizeTyparCount = typeParamsDirect.length
+ normalized = normalize0
normalized
- }
+ } else normalized
override def decls: Scope = {
sym.info match {