Skip to content

Commit 0de8041

Browse files
liufengyunodersky
authored andcommitted
address review
1 parent 196b008 commit 0de8041

File tree

1 file changed

+3
-3
lines changed
  • compiler/src/dotty/tools/dotc/transform/patmat

1 file changed

+3
-3
lines changed

compiler/src/dotty/tools/dotc/transform/patmat/Space.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,9 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
411411

412412
/* Erase a type binding according to erasure semantics in pattern matching */
413413
def erase(tp: Type): Type = tp match {
414-
case tp@AppliedType(tycon, args) => erase(tp.superType)
414+
case tp @ AppliedType(tycon, args) =>
415415
if (tycon.isRef(defn.ArrayClass)) tp.derivedAppliedType(tycon, args.map(erase))
416-
else tp.derivedAppliedType(tycon, args.map(t => WildcardType(TypeBounds.empty)))
416+
else tp.derivedAppliedType(tycon, args.map(t => WildcardType))
417417
case OrType(tp1, tp2) =>
418418
OrType(erase(tp1), erase(tp2))
419419
case AndType(tp1, tp2) =>
@@ -583,7 +583,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
583583
val typeParamMap = new TypeMap {
584584
def apply(t: Type): Type = t match {
585585

586-
case tp: TypeRef if tp.underlying.isInstanceOf[TypeBounds] =>
586+
case tp: TypeRef if tp.symbol.is(TypeParam) && tp.underlying.isInstanceOf[TypeBounds] =>
587587
// See tests/patmat/gadt.scala tests/patmat/exhausting.scala
588588
val bound =
589589
if (variance == 0) tp.underlying.bounds // non-variant case is not well-founded

0 commit comments

Comments
 (0)