diff options
-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" |