diff options
author | Martin Odersky <odersky@gmail.com> | 2015-11-04 18:53:36 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-11-04 18:53:36 +0100 |
commit | c164deb13f4fcf0a155945e694a59e9c0b3ec119 (patch) | |
tree | e8c93b530898e503887bde424dc4888913239428 /src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala | |
parent | d3e5a6981c985e71a77356deab9155806b9ffd02 (diff) | |
download | dotty-c164deb13f4fcf0a155945e694a59e9c0b3ec119.tar.gz dotty-c164deb13f4fcf0a155945e694a59e9c0b3ec119.tar.bz2 dotty-c164deb13f4fcf0a155945e694a59e9c0b3ec119.zip |
Reorder unpickled type params if necessary
When compiling Iterator.scala it was observed that
the type parameters of BufferedCanBuildFrom appeared
inm the wrong order. This fix corrects that, making
sure that type parameters appear in the decls scope
in the same order as they are given in the epxlicitly
unpickled type parameter list.
Diffstat (limited to 'src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala index cdb733efa..05d4a70fc 100644 --- a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala +++ b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala @@ -130,8 +130,18 @@ object Scala2Unpickler { } else { registerCompanionPair(scalacCompanion, denot.classSymbol) } + val declsTypeParams = denot.typeParams + val declsInRightOrder = + if (declsTypeParams.corresponds(tparams)(_.name == _.name)) decls + else { // create new scope with type parameters in right order + val decls1 = newScope + for (tparam <- tparams) decls1.enter(decls.lookup(tparam.name)) + for (sym <- decls) if (!declsTypeParams.contains(sym)) decls1.enter(sym) + decls1 + } - denot.info = ClassInfo(denot.owner.thisType, denot.classSymbol, parentRefs, decls, ost) + denot.info = ClassInfo( + denot.owner.thisType, denot.classSymbol, parentRefs, declsInRightOrder, ost) } } |