diff options
author | Martin Odersky <odersky@gmail.com> | 2017-03-22 15:08:28 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-04-11 09:33:10 +0200 |
commit | 2cc16c4d990fa404577dbe1c944958a0cf9896a8 (patch) | |
tree | 44a9a97332da4cccd826754f73ae1b53c838b3ff /compiler/src/dotty | |
parent | e1181d9f5b3fc56baafbe859d3d3441dfdb113a1 (diff) | |
download | dotty-2cc16c4d990fa404577dbe1c944958a0cf9896a8.tar.gz dotty-2cc16c4d990fa404577dbe1c944958a0cf9896a8.tar.bz2 dotty-2cc16c4d990fa404577dbe1c944958a0cf9896a8.zip |
Use system hashcode for all names except SimpleTermNames
Keep start as a hash for SimpleTermNames because it distributed better.
Diffstat (limited to 'compiler/src/dotty')
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/Names.scala | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Names.scala b/compiler/src/dotty/tools/dotc/core/Names.scala index dbaa338a2..9488aef61 100644 --- a/compiler/src/dotty/tools/dotc/core/Names.scala +++ b/compiler/src/dotty/tools/dotc/core/Names.scala @@ -227,13 +227,13 @@ object Names { !NameInfo.definesNewName(ownKind) && ownKind > kind && underlying.is(kind) } - override def hashCode: Int = start - override protected[this] def newBuilder: Builder[Char, Name] = termNameBuilder } class SimpleTermName(val start: Int, val length: Int, @sharable private[Names] var next: SimpleTermName) extends TermName { // `next` is @sharable because it is only modified in the synchronized block of termName. + override def hashCode: Int = start + override def toString = if (length == 0) "" else new String(chrs, start, length) @@ -257,8 +257,6 @@ object Names { def without(kind: NameInfo.Kind): TypeName = toTermName.without(kind).toTypeName def is(kind: NameInfo.Kind) = toTermName.is(kind) - override def hashCode: Int = -start - override protected[this] def newBuilder: Builder[Char, Name] = termNameBuilder.mapResult(_.toTypeName) |