Skip to content

Commit 54a7df8

Browse files
committed
fix test case t2425.scala
Blind substitution of pattern bound type symbol with WildcardType will cause t2425.scala fail, as the following holds: Array[_] <:< Array[Array[_]] To walkaround the problem, we don't substitute pattern bound symbols that are immediate parameters to `Array`.
1 parent 84cf261 commit 54a7df8

File tree

1 file changed

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

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,11 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
356356

357357
val map = new TypeMap {
358358
def apply(tp: Type) = tp match {
359-
case tref: TypeRef if isPatternTypeSymbol(tref.typeSymbol) => WildcardType(tref.underlying.bounds)
359+
case tp @ AppliedType(tycon, args) if tycon.isRef(defn.ArrayClass) =>
360+
// walkaround `Array[_] <:< Array[Array[_]]`, see tests/patmat/t2425.scala
361+
tp.derivedAppliedType(tycon, args.map(mapOver))
362+
case tref: TypeRef if isPatternTypeSymbol(tref.typeSymbol) =>
363+
WildcardType(tref.underlying.bounds)
360364
case _ => mapOver(tp)
361365
}
362366
}

0 commit comments

Comments
 (0)