Skip to content

Remove duplicate code #11814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5287,17 +5287,6 @@ object Types {
protected def mapClassInfo(tp: ClassInfo): Type =
derivedClassInfo(tp, this(tp.prefix))

/** A version of mapClassInfo which also maps parents and self type */
protected def mapFullClassInfo(tp: ClassInfo): ClassInfo =
tp.derivedClassInfo(
prefix = this(tp.prefix),
declaredParents = tp.declaredParents.mapConserve(this),
selfInfo = tp.selfInfo match {
case tp: Type => this(tp)
case sym => sym
}
)

def andThen(f: Type => Type): TypeMap = new TypeMap {
override def stopAtStatic = thisMap.stopAtStatic
def apply(tp: Type) = f(thisMap(tp))
Expand All @@ -5308,7 +5297,7 @@ object Types {
abstract class DeepTypeMap(using Context) extends TypeMap {
override def mapClassInfo(tp: ClassInfo): ClassInfo = {
val prefix1 = this(tp.prefix)
val parents1 = tp.parents mapConserve this
val parents1 = tp.declaredParents mapConserve this
val selfInfo1: TypeOrSymbol = tp.selfInfo match {
case selfInfo: Type => this(selfInfo)
case selfInfo => selfInfo
Expand Down
3 changes: 1 addition & 2 deletions compiler/src/dotty/tools/dotc/typer/Inliner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
// the owner from the inlined method to the current owner.
val inliner = new TreeTypeMap(
typeMap =
new TypeMap {
new DeepTypeMap {
def apply(t: Type) = t match {
case t: ThisType => thisProxy.getOrElse(t.cls, t)
case t: TypeRef => paramProxy.getOrElse(t, mapOver(t))
Expand All @@ -721,7 +721,6 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
else paramProxy.getOrElse(t, mapOver(t))
case t => mapOver(t)
}
override def mapClassInfo(tp: ClassInfo) = mapFullClassInfo(tp)
},
treeMap = {
case tree: This =>
Expand Down