Skip to content

remove deAnonymize #2900

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
Jul 21, 2017
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
7 changes: 0 additions & 7 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -951,13 +951,6 @@ object Types {
this
}

/** Eliminate anonymous classes */
final def deAnonymize(implicit ctx: Context): Type = this match {
case tp:TypeRef if tp.symbol.isAnonymousClass =>
tp.symbol.asClass.typeRef.asSeenFrom(tp.prefix, tp.symbol.owner)
case tp => tp
}

private def dealias(keepAnnots: Boolean)(implicit ctx: Context): Type = this match {
case tp: TypeRef =>
if (tp.symbol.isClass) tp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ class PatternMatcherOld extends MiniPhaseTransform with DenotTransformer {
def translateMatch(match_ : Match): Tree = {
val Match(sel, cases) = match_

val selectorTp = sel.tpe.widen.deAnonymize/*withoutAnnotations*/
val selectorTp = sel.tpe.widen/*withoutAnnotations*/

val selectorSym = freshSym(sel.pos, selectorTp, PatMatSelectorName)

Expand Down
6 changes: 3 additions & 3 deletions compiler/src/dotty/tools/dotc/transform/patmat/Space.scala
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
}

val Match(sel, cases) = tree
val res = isCheckable(sel.tpe.widen.deAnonymize.dealiasKeepAnnots)
val res = isCheckable(sel.tpe.widen.dealiasKeepAnnots)
debug.println(s"checkable: ${sel.show} = $res")
res
}
Expand Down Expand Up @@ -770,7 +770,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {

def checkExhaustivity(_match: Match): Unit = {
val Match(sel, cases) = _match
val selTyp = sel.tpe.widen.deAnonymize.dealias
val selTyp = sel.tpe.widen.dealias


val patternSpace = cases.map({ x =>
Expand All @@ -787,7 +787,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
def checkRedundancy(_match: Match): Unit = {
val Match(sel, cases) = _match
// ignore selector type for now
// val selTyp = sel.tpe.widen.deAnonymize.dealias
// val selTyp = sel.tpe.widen.dealias

if (cases.length == 1) return

Expand Down