diff options
author | Martin Odersky <odersky@gmail.com> | 2014-02-19 11:50:13 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-02-21 18:42:50 +0100 |
commit | f699ba201bafccc66657a2765f280a226fcd9e55 (patch) | |
tree | f44f9f9295c781bf182e8eafd25dfda3f6e8c8f3 /src/dotty/tools/dotc/core/Uniques.scala | |
parent | 77fc4d0831dc7a7ddaa74677e2659cdea4a2f52f (diff) | |
download | dotty-f699ba201bafccc66657a2765f280a226fcd9e55.tar.gz dotty-f699ba201bafccc66657a2765f280a226fcd9e55.tar.bz2 dotty-f699ba201bafccc66657a2765f280a226fcd9e55.zip |
Avoid using TypeBounds in alias refinements.
The idea is to use the alias itself. This cuts down on # of typebounds created and makes operations on refined infos and applied types more direct.
Diffstat (limited to 'src/dotty/tools/dotc/core/Uniques.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Uniques.scala | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/Uniques.scala b/src/dotty/tools/dotc/core/Uniques.scala index 9ad736c9c..f05b7821d 100644 --- a/src/dotty/tools/dotc/core/Uniques.scala +++ b/src/dotty/tools/dotc/core/Uniques.scala @@ -92,20 +92,21 @@ object Uniques { } } + /** Todo: clean up once the initialization scheme for refined types is decided */ final class RefinedUniques extends HashSet[RefinedType]("uniqueRefinedTypes", initialUniquesCapacity) with Hashable { - override val hashSeed = classOf[CachedRefinedType].hashCode // some types start life as CachedRefinedTypes, need to have same hash seed +// override val hashSeed = classOf[DerivedRefinedType].hashCode // some types start life as DerivedRefinedTypes, need to have same hash seed override def hash(x: RefinedType): Int = x.hash - private def findPrevious(h: Int, parent: Type, refinedName: Name, refinedInfo: Type): RefinedType = { + private def findPrevious(h: Int, parent: Type, refinedName: Name, compactInfo: Type): RefinedType = { var e = findEntryByHash(h) while (e != null) { - if ((e.parent == parent) && (e.refinedName eq refinedName) && (e.refinedInfo == refinedInfo)) + if ((e.parent == parent) && (e.refinedName eq refinedName) && (e.compactInfo == compactInfo)) return e e = nextEntryByHash(h) } e } - +/* def enterIfNew(parent: Type, refinedName: Name, refinedInfo: Type): RefinedType = { val h = doHash(refinedName, refinedInfo, parent) def newType = new PreHashedRefinedType(parent, refinedName, refinedInfo, h) @@ -116,12 +117,12 @@ object Uniques { if (r ne null) r else addEntryAfterScan(newType) } } - +*/ def enterIfNew(rt: RefinedType) = { if (monitored) recordCaching(rt) if (rt.hash == NotCached) rt else { - val r = findPrevious(rt.hash, rt.parent, rt.refinedName, rt.refinedInfo) + val r = findPrevious(rt.hash, rt.parent, rt.refinedName, rt.compactInfo) if (r ne null) r else addEntryAfterScan(rt) } } |