Skip to content

Commit 97e261d

Browse files
committed
Merge parentsWithArgs and instantiatedParents
1 parent 5969e02 commit 97e261d

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

src/dotty/tools/dotc/core/Types.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ object Types {
10161016

10171017
/** The full parent types, including all type arguments */
10181018
def parentsWithArgs(implicit ctx: Context): List[Type] = this match {
1019-
case tp: TypeProxy => tp.underlying.parents
1019+
case tp: TypeProxy => tp.underlying.parentsWithArgs
10201020
case _ => List()
10211021
}
10221022

@@ -2786,11 +2786,8 @@ object Types {
27862786
parentsCache
27872787
}
27882788

2789-
override def parentsWithArgs(implicit ctx: Context): List[Type] =
2790-
parents.map(p => typeRef.baseTypeWithArgs(p.symbol))
2791-
27922789
/** The parent types with all type arguments */
2793-
def instantiatedParents(implicit ctx: Context): List[Type] =
2790+
override def parentsWithArgs(implicit ctx: Context): List[Type] =
27942791
parents mapConserve { pref =>
27952792
((pref: Type) /: pref.classSymbol.typeParams) { (parent, tparam) =>
27962793
val targSym = decls.lookup(tparam.name)

src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
160160
case ErasedValueType(clazz, underlying) =>
161161
return "ErasedValueType(" ~ toText(clazz.typeRef) ~ ", " ~ toText(underlying) ~ ")"
162162
case tp: ClassInfo =>
163-
return toTextParents(tp.instantiatedParents) ~ "{...}"
163+
return toTextParents(tp.parentsWithArgs) ~ "{...}"
164164
case JavaArrayType(elemtp) =>
165165
return toText(elemtp) ~ "[]"
166166
case tp: SelectionProto =>

src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ object Checking {
342342
else errors1
343343
} else errors1
344344
case tp: ClassInfo =>
345-
(apply(errors, tp.prefix) /: tp.typeRef.parentsWithArgs)(apply)
345+
(apply(errors, tp.prefix) /: tp.parentsWithArgs)(apply)
346346
case _ =>
347347
foldOver(errors, tp)
348348
}

src/dotty/tools/dotc/typer/TypeAssigner.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ trait TypeAssigner {
6969
if (tp1.typeSymbol.exists)
7070
return tp1
7171
}
72-
val parentType = info.instantiatedParents.reduceLeft(ctx.typeComparer.andType(_, _))
72+
val parentType = info.parentsWithArgs.reduceLeft(ctx.typeComparer.andType(_, _))
7373
def addRefinement(parent: Type, decl: Symbol) = {
7474
val inherited =
7575
parentType.findMember(decl.name, info.cls.thisType, Private)
@@ -287,7 +287,7 @@ trait TypeAssigner {
287287
else if (!mix.isEmpty) findMixinSuper(cls.info)
288288
else if (inConstrCall || ctx.erasedTypes) cls.info.firstParent
289289
else {
290-
val ps = cls.classInfo.instantiatedParents
290+
val ps = cls.classInfo.parentsWithArgs
291291
if (ps.isEmpty) defn.AnyType else ps.reduceLeft((x: Type, y: Type) => x & y)
292292
}
293293
tree.withType(SuperType(cls.thisType, owntype))

0 commit comments

Comments
 (0)