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

Wrong exhaustiveness warning when combining path-dependent ADTs and type variables #9289

Closed
scabug opened this issue Apr 29, 2015 · 4 comments

Comments

@scabug
Copy link

scabug commented Apr 29, 2015

The following code:

trait Module {
  sealed trait Tree

  case class LetL() extends Tree
}

class Patmat[T <: Module](val module: T) {
  def patmat(tree: module.Tree) = tree match {
    case module.LetL() => ???
  }
}

Triggers the following warning:

patmat-acc.scala:8: warning: match may not be exhaustive.
It would fail on the following input: LetL()
  def patmat(tree: module.Tree) = tree match {
                                  ^
one warning found

The warning isn't triggered if

class Patmat[T <: Module](val module: T)

is replaced by

class Patmat(val module: Module)
@scabug
Copy link
Author

scabug commented Apr 29, 2015

Imported From: https://issues.scala-lang.org/browse/SI-9289?orig=1
Reporter: Guillaume Martres (Smarter)
Affected Versions: 2.11.6

@scabug
Copy link
Author

scabug commented Feb 22, 2017

Wei-Ren Chen (chenwj) said (edited on Feb 22, 2017 2:52:23 AM UTC):
does anyone work on this? Or this issue won't be fixed?

@scabug scabug added this to the Backlog milestone Apr 7, 2017
@adriaanm adriaanm removed their assignment Sep 28, 2018
@dwijnand
Copy link
Member

dwijnand commented Feb 4, 2021

Similar but distinct from #9672.

@dwijnand dwijnand self-assigned this Feb 4, 2021
@dwijnand dwijnand removed their assignment Nov 22, 2021
@SethTisue SethTisue modified the milestones: Backlog, 2.13.11 Nov 28, 2023
@SethTisue
Copy link
Member

Not sure what the responsible PR was, but it stopped warning in 2.13.11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants