Skip to content

Commit ae9e906

Browse files
committed
Merge parentsWithArgs and instantiatedParents
1 parent cf25ec1 commit ae9e906

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
@@ -1010,7 +1010,7 @@ object Types {
10101010

10111011
/** The full parent types, including all type arguments */
10121012
def parentsWithArgs(implicit ctx: Context): List[Type] = this match {
1013-
case tp: TypeProxy => tp.underlying.parents
1013+
case tp: TypeProxy => tp.underlying.parentsWithArgs
10141014
case _ => List()
10151015
}
10161016

@@ -2771,11 +2771,8 @@ object Types {
27712771
parentsCache
27722772
}
27732773

2774-
override def parentsWithArgs(implicit ctx: Context): List[Type] =
2775-
parents.map(p => typeRef.baseTypeWithArgs(p.symbol))
2776-
27772774
/** The parent types with all type arguments */
2778-
def instantiatedParents(implicit ctx: Context): List[Type] =
2775+
override def parentsWithArgs(implicit ctx: Context): List[Type] =
27792776
parents mapConserve { pref =>
27802777
((pref: Type) /: pref.classSymbol.typeParams) { (parent, tparam) =>
27812778
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
@@ -326,7 +326,7 @@ object Checking {
326326
else errors1
327327
} else errors1
328328
case tp: ClassInfo =>
329-
(apply(errors, tp.prefix) /: tp.typeRef.parentsWithArgs)(apply)
329+
(apply(errors, tp.prefix) /: tp.parentsWithArgs)(apply)
330330
case _ =>
331331
foldOver(errors, tp)
332332
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ trait TypeAssigner {
6464
if (tp1.typeSymbol.exists)
6565
return tp1
6666
}
67-
val parentType = info.instantiatedParents.reduceLeft(ctx.typeComparer.andType(_, _))
67+
val parentType = info.parentsWithArgs.reduceLeft(ctx.typeComparer.andType(_, _))
6868
def addRefinement(parent: Type, decl: Symbol) = {
6969
val inherited =
7070
parentType.findMember(decl.name, info.cls.thisType, Private)
@@ -282,7 +282,7 @@ trait TypeAssigner {
282282
else if (!mix.isEmpty) findMixinSuper(cls.info)
283283
else if (inConstrCall || ctx.erasedTypes) cls.info.firstParent
284284
else {
285-
val ps = cls.classInfo.instantiatedParents
285+
val ps = cls.classInfo.parentsWithArgs
286286
if (ps.isEmpty) defn.AnyType else ps.reduceLeft((x: Type, y: Type) => x & y)
287287
}
288288
tree.withType(SuperType(cls.thisType, owntype))

0 commit comments

Comments
 (0)