diff options
author | Paul Phillips <paulp@improving.org> | 2010-02-16 22:28:27 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-02-16 22:28:27 +0000 |
commit | 2e6f4e7246a6f688cd605fd216612a6eae13e488 (patch) | |
tree | 0724fb4f41cb30d32608b052d1bb7a1cfaa14f16 /src/compiler | |
parent | 1f8b43be3ba5eea5d76a1ded1e6579e247f95a68 (diff) | |
download | scala-2e6f4e7246a6f688cd605fd216612a6eae13e488.tar.gz scala-2e6f4e7246a6f688cd605fd216612a6eae13e488.tar.bz2 scala-2e6f4e7246a6f688cd605fd216612a6eae13e488.zip |
Altered Symbol.isLess to sort on initName befor...
Altered Symbol.isLess to sort on initName before id. No longer will
slightly different classpaths break the stability test. Review by
odersky.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Symbols.scala | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index 1ba70a3fcf..00f5cc0add 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -982,12 +982,15 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable => def baseTypeSeqLength(sym: Symbol) = if (sym.isAbstractType) 1 + sym.info.bounds.hi.baseTypeSeq.length else sym.info.baseTypeSeq.length + + def lastCmp = this.sortName < that.sortName + if (this.isType) (that.isType && { val diff = baseTypeSeqLength(this) - baseTypeSeqLength(that) - diff > 0 || diff == 0 && this.id < that.id }) + diff > 0 || diff == 0 && lastCmp }) else - that.isType || this.id < that.id + that.isType || lastCmp } /** A partial ordering between symbols. @@ -1435,6 +1438,13 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable => /** The simple name of this Symbol */ final def simpleName: Name = name + /** The String used to order otherwise identical symbols in isLess. + * This uses data which is stable across runs and variable classpaths + * (the initial Name) before falling back on id, which varies depending + * on exactly when a symbol is loaded. + */ + final private def sortName: String = initName.toString + "#" + id + /** String representation of symbol's definition key word */ final def keyString: String = if (isTrait && hasFlag(JAVA)) "interface" |