From ab33bb1b34b86a71fa792f4a1e9a388c73192f02 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Tue, 16 Feb 2010 23:48:32 +0000 Subject: Took a less ambitious approach to restoring sta... Took a less ambitious approach to restoring stability. Leave isLess as it was and have the pickler sort without using isLess. Interestingly this approach still leaves a class failing the stability test (scala/actors/remote/Apply0.class) so a little more will be needed. Review by odersky. --- src/compiler/scala/tools/nsc/symtab/Symbols.scala | 11 ++++------- src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index 00f5cc0add..d878839fea 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -982,15 +982,12 @@ 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 && lastCmp }) + diff > 0 || diff == 0 && this.id < that.id }) else - that.isType || lastCmp + that.isType || this.id < that.id } /** A partial ordering between symbols. @@ -1438,12 +1435,12 @@ 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. + /** The String used to order otherwise identical sealed symbols. * 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 + final def sealedSortName: String = initName.toString + "#" + id /** String representation of symbol's definition key word */ final def keyString: String = diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala index 5233868a3f..a4be75c879 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala @@ -145,7 +145,7 @@ abstract class Pickler extends SubComponent { localChildDummy.setInfo(ClassInfoType(List(sym.tpe), EmptyScope, localChildDummy)) localChildDummy :: globals } - putChildren(sym, children sortWith (_ isLess _)) + putChildren(sym, children sortBy (_.sealedSortName)) } for (annot <- staticAnnotations(sym.annotations.reverse)) putAnnotation(sym, annot) -- cgit v1.2.3