Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cfab282

Browse files
committed
Call inhabited for AppliedType recursively
1 parent dfacd3f commit cfab282

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,7 @@ object SpaceEngine {
702702
case OrType(tp1, tp2) => inhabited(tp1) || inhabited(tp2)
703703
case tp: RefinedType => inhabited(tp.parent)
704704
case tp: TypeRef => !containsUninhabitedField(tp) && inhabited(tp.prefix)
705+
case tp: AppliedType => !containsUninhabitedField(tp) && inhabited(tp.tycon)
705706
case _ => !containsUninhabitedField(tp)
706707

707708
if inhabited(refined) then refined

‎tests/pos/i23734.scala‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
trait Nodes1 {
2+
sealed trait B
3+
final case class R1() extends B
4+
}
5+
6+
trait Nodes2 extends Nodes1 {
7+
final case class R2[T]() extends B
8+
}
9+
10+
11+
object Impl1 extends Nodes1
12+
13+
object test2 {
14+
val a: Impl1.B = ???
15+
a match {
16+
case Impl1.R1() => ???
17+
}
18+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /