Skip to content

Commit 85983da

Browse files
authored
Merge pull request #11814 from dotty-staging/dedup-typemap
Remove duplicate code
2 parents 2b818ee + 95dc7fc commit 85983da

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5287,17 +5287,6 @@ object Types {
52875287
protected def mapClassInfo(tp: ClassInfo): Type =
52885288
derivedClassInfo(tp, this(tp.prefix))
52895289

5290-
/** A version of mapClassInfo which also maps parents and self type */
5291-
protected def mapFullClassInfo(tp: ClassInfo): ClassInfo =
5292-
tp.derivedClassInfo(
5293-
prefix = this(tp.prefix),
5294-
declaredParents = tp.declaredParents.mapConserve(this),
5295-
selfInfo = tp.selfInfo match {
5296-
case tp: Type => this(tp)
5297-
case sym => sym
5298-
}
5299-
)
5300-
53015290
def andThen(f: Type => Type): TypeMap = new TypeMap {
53025291
override def stopAtStatic = thisMap.stopAtStatic
53035292
def apply(tp: Type) = f(thisMap(tp))
@@ -5308,7 +5297,7 @@ object Types {
53085297
abstract class DeepTypeMap(using Context) extends TypeMap {
53095298
override def mapClassInfo(tp: ClassInfo): ClassInfo = {
53105299
val prefix1 = this(tp.prefix)
5311-
val parents1 = tp.parents mapConserve this
5300+
val parents1 = tp.declaredParents mapConserve this
53125301
val selfInfo1: TypeOrSymbol = tp.selfInfo match {
53135302
case selfInfo: Type => this(selfInfo)
53145303
case selfInfo => selfInfo

compiler/src/dotty/tools/dotc/typer/Inliner.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
712712
// the owner from the inlined method to the current owner.
713713
val inliner = new TreeTypeMap(
714714
typeMap =
715-
new TypeMap {
715+
new DeepTypeMap {
716716
def apply(t: Type) = t match {
717717
case t: ThisType => thisProxy.getOrElse(t.cls, t)
718718
case t: TypeRef => paramProxy.getOrElse(t, mapOver(t))
@@ -721,7 +721,6 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
721721
else paramProxy.getOrElse(t, mapOver(t))
722722
case t => mapOver(t)
723723
}
724-
override def mapClassInfo(tp: ClassInfo) = mapFullClassInfo(tp)
725724
},
726725
treeMap = {
727726
case tree: This =>

0 commit comments

Comments
 (0)