diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-01-13 10:47:05 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-01-13 10:47:05 -0800 |
commit | a68b2e08c95536863576c345047c47d163ec022a (patch) | |
tree | d826d718858a8bf4b6382eb37b94b73a32c9f458 /src | |
parent | 34c8a00da7a14803a7f38927ba11926561b2a188 (diff) | |
parent | 6f42bd6881f9b1a6fa25d744cded38f53058538c (diff) | |
download | scala-a68b2e08c95536863576c345047c47d163ec022a.tar.gz scala-a68b2e08c95536863576c345047c47d163ec022a.tar.bz2 scala-a68b2e08c95536863576c345047c47d163ec022a.zip |
Merge pull request #3242 from retronym/ticket/8046
SI-8046 BaseTypeSeq fixes with aliases
Diffstat (limited to 'src')
-rw-r--r-- | src/reflect/scala/reflect/internal/BaseTypeSeqs.scala | 5 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/Types.scala | 13 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/reflect/scala/reflect/internal/BaseTypeSeqs.scala b/src/reflect/scala/reflect/internal/BaseTypeSeqs.scala index 19c67879f5..0ca8611719 100644 --- a/src/reflect/scala/reflect/internal/BaseTypeSeqs.scala +++ b/src/reflect/scala/reflect/internal/BaseTypeSeqs.scala @@ -166,9 +166,10 @@ trait BaseTypeSeqs { val index = new Array[Int](nparents) var i = 0 for (p <- parents) { + val parentBts = p.dealias.baseTypeSeq // dealias need for SI-8046. pbtss(i) = - if (p.baseTypeSeq eq undetBaseTypeSeq) AnyClass.info.baseTypeSeq - else p.baseTypeSeq + if (parentBts eq undetBaseTypeSeq) AnyClass.info.baseTypeSeq + else parentBts index(i) = 0 i += 1 } diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index d8bbd981b9..e9230aceee 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -1998,7 +1998,9 @@ trait Types if (sym.typeParams.size != args.size) devWarning(s"$this.transform($tp), but tparams.isEmpty and args=$args") - asSeenFromOwner(tp).instantiateTypeParams(sym.typeParams, args) + val GenPolyType(tparams, result) = asSeenFromOwner(tp) + assert((tparams eq Nil) || tparams == sym.typeParams, (tparams, sym.typeParams)) + result.instantiateTypeParams(sym.typeParams, args) } // note: does not go through typeRef. There's no need to because @@ -2308,7 +2310,14 @@ trait Types } thisInfo.decls } - protected[Types] def baseTypeSeqImpl: BaseTypeSeq = sym.info.baseTypeSeq map transform + protected[Types] def baseTypeSeqImpl: BaseTypeSeq = + if (sym.info.baseTypeSeq exists (_.typeSymbolDirect.isAbstractType)) + // SI-8046 base type sequence might have more elements in a subclass, we can't map it element wise. + transform(sym.info).baseTypeSeq + else + // Optimization: no abstract types, we can compute the BTS of this TypeRef as an element-wise map + // of the BTS of the referenced symbol. + sym.info.baseTypeSeq map transform override def baseTypeSeq: BaseTypeSeq = { val cache = baseTypeSeqCache |