Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deskolemise patterns to suppress exhaustivity warnings #13137

Merged
merged 1 commit into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions compiler/src/dotty/tools/dotc/transform/patmat/Space.scala
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,8 @@ class SpaceEngine(using Context) extends SpaceLogic {
case pat: Ident if isBackquoted(pat) =>
Typ(pat.tpe, decomposed = false)

case Ident(nme.WILDCARD) =>
Typ(erase(pat.tpe.stripAnnots, isValue = true), decomposed = false)

case Ident(_) | Select(_, _) =>
Typ(erase(pat.tpe.stripAnnots, isValue = true), decomposed = false)
Typ(erase(pat.tpe.stripAnnots.widenSkolem, isValue = true), decomposed = false)

case Alternative(trees) =>
Or(trees.map(project(_)))
Expand Down
12 changes: 12 additions & 0 deletions tests/patmat/i13110.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
object Test {
sealed trait Base
class Blub extends Base
object Blub {
def unapply(blub: Blub): Some[(Int, blub.type)] =
Some(1 -> blub)
}

(null: Base) match {
case Blub(i, x) => println(i)
}
}