Skip to content

Commit b830af3

Browse files
authored
Merge pull request #13137 from dwijnand/patmat-dep
Deskolemise patterns to suppress exhaustivity warnings
2 parents 363a493 + 68f7a25 commit b830af3

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,8 @@ class SpaceEngine(using Context) extends SpaceLogic {
354354
case pat: Ident if isBackquoted(pat) =>
355355
Typ(pat.tpe, decomposed = false)
356356

357-
case Ident(nme.WILDCARD) =>
358-
Typ(erase(pat.tpe.stripAnnots, isValue = true), decomposed = false)
359-
360357
case Ident(_) | Select(_, _) =>
361-
Typ(erase(pat.tpe.stripAnnots, isValue = true), decomposed = false)
358+
Typ(erase(pat.tpe.stripAnnots.widenSkolem, isValue = true), decomposed = false)
362359

363360
case Alternative(trees) =>
364361
Or(trees.map(project(_)))

tests/patmat/i13110.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
object Test {
2+
sealed trait Base
3+
class Blub extends Base
4+
object Blub {
5+
def unapply(blub: Blub): Some[(Int, blub.type)] =
6+
Some(1 -> blub)
7+
}
8+
9+
(null: Base) match {
10+
case Blub(i, x) => println(i)
11+
}
12+
}

0 commit comments

Comments
 (0)