diff options
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 7 | ||||
-rw-r--r-- | src/dotty/tools/dotc/printing/RefinedPrinter.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Checking.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/TypeAssigner.scala | 4 |
4 files changed, 6 insertions, 9 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 16287c827..9b58f8eeb 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -1016,7 +1016,7 @@ object Types { /** The full parent types, including all type arguments */ def parentsWithArgs(implicit ctx: Context): List[Type] = this match { - case tp: TypeProxy => tp.underlying.parents + case tp: TypeProxy => tp.underlying.parentsWithArgs case _ => List() } @@ -2786,11 +2786,8 @@ object Types { parentsCache } - override def parentsWithArgs(implicit ctx: Context): List[Type] = - parents.map(p => typeRef.baseTypeWithArgs(p.symbol)) - /** The parent types with all type arguments */ - def instantiatedParents(implicit ctx: Context): List[Type] = + override def parentsWithArgs(implicit ctx: Context): List[Type] = parents mapConserve { pref => ((pref: Type) /: pref.classSymbol.typeParams) { (parent, tparam) => val targSym = decls.lookup(tparam.name) diff --git a/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/src/dotty/tools/dotc/printing/RefinedPrinter.scala index 204fc95f0..068ed4daa 100644 --- a/src/dotty/tools/dotc/printing/RefinedPrinter.scala +++ b/src/dotty/tools/dotc/printing/RefinedPrinter.scala @@ -160,7 +160,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { case ErasedValueType(clazz, underlying) => return "ErasedValueType(" ~ toText(clazz.typeRef) ~ ", " ~ toText(underlying) ~ ")" case tp: ClassInfo => - return toTextParents(tp.instantiatedParents) ~ "{...}" + return toTextParents(tp.parentsWithArgs) ~ "{...}" case JavaArrayType(elemtp) => return toText(elemtp) ~ "[]" case tp: SelectionProto => diff --git a/src/dotty/tools/dotc/typer/Checking.scala b/src/dotty/tools/dotc/typer/Checking.scala index 64aac7d3b..beb8fc931 100644 --- a/src/dotty/tools/dotc/typer/Checking.scala +++ b/src/dotty/tools/dotc/typer/Checking.scala @@ -342,7 +342,7 @@ object Checking { else errors1 } else errors1 case tp: ClassInfo => - (apply(errors, tp.prefix) /: tp.typeRef.parentsWithArgs)(apply) + (apply(errors, tp.prefix) /: tp.parentsWithArgs)(apply) case _ => foldOver(errors, tp) } diff --git a/src/dotty/tools/dotc/typer/TypeAssigner.scala b/src/dotty/tools/dotc/typer/TypeAssigner.scala index ac46ee723..07cc3c8d6 100644 --- a/src/dotty/tools/dotc/typer/TypeAssigner.scala +++ b/src/dotty/tools/dotc/typer/TypeAssigner.scala @@ -69,7 +69,7 @@ trait TypeAssigner { if (tp1.typeSymbol.exists) return tp1 } - val parentType = info.instantiatedParents.reduceLeft(ctx.typeComparer.andType(_, _)) + val parentType = info.parentsWithArgs.reduceLeft(ctx.typeComparer.andType(_, _)) def addRefinement(parent: Type, decl: Symbol) = { val inherited = parentType.findMember(decl.name, info.cls.thisType, Private) @@ -287,7 +287,7 @@ trait TypeAssigner { else if (!mix.isEmpty) findMixinSuper(cls.info) else if (inConstrCall || ctx.erasedTypes) cls.info.firstParent else { - val ps = cls.classInfo.instantiatedParents + val ps = cls.classInfo.parentsWithArgs if (ps.isEmpty) defn.AnyType else ps.reduceLeft((x: Type, y: Type) => x & y) } tree.withType(SuperType(cls.thisType, owntype)) |