Skip to content

Commit c79181d

Browse files
committed
address counter-example of two unrelated traits
1 parent f69b305 commit c79181d

File tree

8 files changed

+239
-163
lines changed

8 files changed

+239
-163
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ object Types {
811811
}
812812

813813
/** Eliminate anonymous classes */
814-
final def elimAnonymousClass(implicit ctx: Context): Type = this match {
814+
final def deAnonymize(implicit ctx: Context): Type = this match {
815815
case tp:TypeRef if tp.symbol.isAnonymousClass =>
816816
tp.symbol.asClass.typeRef.asSeenFrom(tp.prefix, tp.symbol.owner)
817817
case tp => tp

src/dotty/tools/dotc/transform/PatternMatcher.scala

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,13 +1254,6 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
12541254
case _ => false
12551255
}
12561256

1257-
def elimAnonymousClass(t: Type) = t match {
1258-
case t:TypeRef if t.symbol.isAnonymousClass =>
1259-
t.symbol.asClass.typeRef.asSeenFrom(t.prefix, t.symbol.owner)
1260-
case _ =>
1261-
t
1262-
}
1263-
12641257
/** Implement a pattern match by turning its cases (including the implicit failure case)
12651258
* into the corresponding (monadic) extractors, and combining them with the `orElse` combinator.
12661259
*
@@ -1274,7 +1267,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
12741267
def translateMatch(match_ : Match): Tree = {
12751268
val Match(sel, cases) = match_
12761269

1277-
val selectorTp = sel.tpe.widen.elimAnonymousClass/*withoutAnnotations*/
1270+
val selectorTp = sel.tpe.widen.deAnonymize/*withoutAnnotations*/
12781271

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

0 commit comments

Comments
 (0)