Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-9190

Extractor on type alias in conjunction with other pattern causes error


    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: Scala 2.11.0, Scala 2.11.1, Scala 2.11.2, Scala 2.11.3, Scala 2.11.4, Scala 2.11.5
    • Fix Version/s: None
    • Component/s: Pattern Matcher
    • Environment:

      java version "1.7.0_76"
      Java(TM) SE Runtime Environment (build 1.7.0_76-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)


      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.




            • Assignee:
              retronym Jason Zaugg
              4e6 Dmitry Bushev
            • Votes:
              1 Vote for this issue
              4 Start watching this issue


              • Created: