Skip to content

Commit 58066c7

Browse files
committed
fix default case recursion in child/parentTypeMap
1 parent 65d4dcc commit 58066c7

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,8 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
619619
else this(hi)
620620
debug.println(s"$tp exposed to =====> $exposed")
621621
exposed
622-
case _ =>
623-
mapOver(t)
622+
case tp =>
623+
mapOver(tp)
624624
}
625625
}
626626

@@ -638,8 +638,8 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
638638

639639
debug.println(s"$tp exposed to =====> $exposed")
640640
exposed
641-
case _ =>
642-
mapOver(t)
641+
case tp =>
642+
mapOver(tp)
643643
}
644644
}
645645

tests/patmat/i3645f.check

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
30: Pattern Match Exhaustivity: K1

tests/patmat/i3645f.scala

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
object App {
2+
def main(args: Array[String]): Unit = {
3+
trait ModuleSig {
4+
type U2
5+
type U1
6+
7+
trait FooSig {
8+
type Type = (U1 & U2)
9+
def subst[F[_]](fa: F[Int]): F[Type]
10+
}
11+
12+
val Foo: FooSig
13+
}
14+
val Module: ModuleSig = new ModuleSig {
15+
type U1 = Int
16+
type U2 = Int
17+
18+
val Foo: FooSig = new FooSig {
19+
// type Type = Int
20+
def subst[F[_]](fa: F[Int]): F[Type] = fa
21+
}
22+
}
23+
type Foo = Module.Foo.Type
24+
25+
sealed abstract class K[F]
26+
final case object K1 extends K[Int]
27+
final case object K2 extends K[Foo]
28+
29+
val kv: K[Foo] = Module.Foo.subst[K](K1)
30+
def test(k: K[Foo]): Unit = k match {
31+
case K2 => ()
32+
}
33+
34+
test(kv)
35+
}
36+
}

0 commit comments

Comments
 (0)