Skip to content
Prev Previous commit
address counter-example of two unrelated traits
  • Loading branch information
liufengyun committed Jul 5, 2016
commit c79181d08230b5387fb74e0c9fa3de8a6c56830d
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ object Types {
}

/** Eliminate anonymous classes */
final def elimAnonymousClass(implicit ctx: Context): Type = this match {
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
Expand Down
9 changes: 1 addition & 8 deletions src/dotty/tools/dotc/transform/PatternMatcher.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1254,13 +1254,6 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
case _ => false
}

def elimAnonymousClass(t: Type) = t match {
case t:TypeRef if t.symbol.isAnonymousClass =>
t.symbol.asClass.typeRef.asSeenFrom(t.prefix, t.symbol.owner)
case _ =>
t
}

/** Implement a pattern match by turning its cases (including the implicit failure case)
* into the corresponding (monadic) extractors, and combining them with the `orElse` combinator.
*
Expand All @@ -1274,7 +1267,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
def translateMatch(match_ : Match): Tree = {
val Match(sel, cases) = match_

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

val selectorSym = freshSym(sel.pos, selectorTp, "selector")

Expand Down
Loading