approximate type parameters and references by name

not as accurate, but simpler.
This commit is contained in:
Mark Harrah
2012-05-12 23:12:29 -04:00
parent 00d0918714
commit 864580aae1
9 changed files with 21 additions and 233 deletions
+2 -3
View File
@@ -172,9 +172,8 @@ object ClassToAPI
new api.TypeParameter(typeVariable(tp), emptyAnnotationArray, emptyTypeParameterArray, api.Variance.Invariant, NothingRef, upperBounds(tp.getBounds))
// needs to be stable across compilations
// preferably, it would be a proper unique id based on de Bruijn index
def typeVariable[T <: GenericDeclaration](tv: TypeVariable[T]): Int =
reduceHash((name(tv.getGenericDeclaration) + " " + tv.getName).getBytes)
def typeVariable[T <: GenericDeclaration](tv: TypeVariable[T]): String =
name(tv.getGenericDeclaration) + " " + tv.getName
def reduceHash(in: Array[Byte]): Int =
(0 /: in)( (acc, b) => (acc * 43) ^ b)