From 89c557d0b5e9590d5c3aab9721ff08778fbe0bdc Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Tue, 9 Nov 2010 20:45:26 -0500 Subject: [PATCH] temporary workaround for dangling type parameter references --- compile/api/SameAPI.scala | 15 +++++++++++---- compile/src/test/scala/BasicAPI.scala | 3 +++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/compile/api/SameAPI.scala b/compile/api/SameAPI.scala index 9ee2ec47f..211ea4d9d 100644 --- a/compile/api/SameAPI.scala +++ b/compile/api/SameAPI.scala @@ -55,7 +55,7 @@ object SameAPI val result = (new SameAPI(tagsA,tagsB, false, true)).check(a,b) val end = System.currentTimeMillis - println(" API comparison took: " + (end - start) / 1000.0 + " s") + //println(" API comparison took: " + (end - start) / 1000.0 + " s") result } @@ -283,14 +283,21 @@ class SameAPI(tagsA: TypeVars, tagsB: TypeVars, includePrivate: Boolean, include def sameTypeParameters(a: Seq[TypeParameter], b: Seq[TypeParameter]): Boolean = debug(sameSeq(a, b)(sameTypeParameter), "Different type parameters") def sameTypeParameter(a: TypeParameter, b: TypeParameter): Boolean = + { sameTypeParameters(a.typeParameters, b.typeParameters) && debug(sameAnnotations(a.annotations, b.annotations), "Different type parameter annotations") && debug(sameVariance(a.variance, b.variance), "Different variance") && debug(sameType(a.lowerBound, b.lowerBound), "Different lower bound") && debug(sameType(a.upperBound, b.upperBound), "Different upper bound") && - debug(sameTags(a.id, b.id), "Different type parameter bindings") - - def sameTags(a: Int, b: Int): Boolean = tagsA(a) == tagsB(b) + sameTags(a.id, b.id) + } + // until dangling type parameter references are straightened out in API phase, approximate + def sameTags(a: Int, b: Int): Boolean = + { + val ta = tagsA.get(a) + val tb = tagsB.get(b) + debug(ta == tb, "Different type parameter bindings: " + ta + "(" + a + "), " + tb + "(" + b + ")") + } def sameType(a: Type, b: Type): Boolean = (a, b) match diff --git a/compile/src/test/scala/BasicAPI.scala b/compile/src/test/scala/BasicAPI.scala index 0d879e275..39d385f50 100644 --- a/compile/src/test/scala/BasicAPI.scala +++ b/compile/src/test/scala/BasicAPI.scala @@ -21,6 +21,9 @@ package org.example { def t: In } } +package org.example3 { + trait A extends Iterator[Int] +} package org.example2 { trait ZZ[S] { val p: S