Scala Programming Language
  1. Scala Programming Language
  2. SI-7214

Pattern matcher outer check generation fooled by type aliases

    Details

      Description

      When I use a java library that returns a Vector, then use JavaConverters 'asScala' to convert the vector to the Scala equivalent and then try to match on the type in flatMap to do processing, I get a compiler crash.

      no-symbol does not have an owner

      This worked in Scala 2.9, but it hasn't worked in any version of 2.10.

      Code would be something like this:
      channel.ls.asScala.filter( _ match .flatMap( _ match

      { case e: LsEntry => Some(rootPath + "/" + e.getFilename) case s => None }

      )
      }

      If I add channel.ls.asInstanceOf[Vector[LsEntry]] to the code, the crash goes away.

      Here is a very simple sbt project that demonstrates the problem.

      https://github.com/OleTraveler/non-symbol-error

        Issue Links

          Activity

          Hide
          Jason Zaugg added a comment -

          A workaround is to match on _: Outer#Inner, rather than on a type alias for the same type.

          Fix for 2.10.2:

          https://github.com/scala/scala/pull/2199

          Show
          Jason Zaugg added a comment - A workaround is to match on _: Outer#Inner , rather than on a type alias for the same type. Fix for 2.10.2: https://github.com/scala/scala/pull/2199
          Hide
          Paul Phillips added a comment -

          This is SI-6813, right?

          Show
          Paul Phillips added a comment - This is SI-6813 , right?
          Hide
          Adriaan Moors added a comment -

          I think SI-6813 is a separate missing dealias.

          Show
          Adriaan Moors added a comment - I think SI-6813 is a separate missing dealias.

            People

            • Assignee:
              Jason Zaugg
              Reporter:
              Travis Stevens
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development