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

Extractor on type alias in conjunction with other pattern causes error #9190

Closed
scabug opened this issue Feb 27, 2015 · 3 comments
Closed

Extractor on type alias in conjunction with other pattern causes error #9190

scabug opened this issue Feb 27, 2015 · 3 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Feb 27, 2015

The following snippet results in compilation error with scala 2.11.x (full stacktrace in attachment). Note that only two patterns together (with extractor first) in match clause brings error.

java.lang.AssertionError: assertion failed: (trait Two,type One)
trait Test {
  trait Two[A, B]
  type One[A] = Two[A, A]

  object Extract {
    def unapply(o: One[_]): Option[_] = ???
  }

  def matcher[T](o: One[T]) = o match {
    case Extract(t) => ??? // extractor alone is ok
    case _: One[_]  => ??? // other pattern in conjunction with extractor causes error
    case _          => ??? // wildcard pattern is also ok
  }
}

Scala version 2.10.4 compiles fine. This seems to be a regression introduced in 2.11.0 and affected subsequent versions.

@scabug
Copy link
Author

scabug commented Feb 27, 2015

Imported From: https://issues.scala-lang.org/browse/SI-9190?orig=1
Reporter: Dmitry Bushev (4e6)
Affected Versions: 2.11.0, 2.11.1, 2.11.2, 2.11.3, 2.11.4, 2.11.5
Attachments:

  • stacktrace.log (created on Feb 27, 2015 12:03:06 PM UTC, 16057 bytes)

@scabug
Copy link
Author

scabug commented Mar 2, 2015

@alexeyr said:
Might be related to (or a duplicate of?) #9114

@xuwei-k
Copy link

xuwei-k commented Aug 16, 2018

duplicate #9114. fixed since Scala 2.11.9

@xuwei-k xuwei-k closed this as completed Aug 16, 2018
@SethTisue SethTisue added this to the 2.11.11 milestone Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants