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

subtle source incompatibilty with new overload of Regex#unapplySeq

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.11.0-M7
    • Fix Version/s: Scala 2.11.0-M8
    • Component/s: Misc Library
    • Labels:

      Description

      val full = """.*: (.)$""".r
      val text = "   When I use this operator: *"
      val x :: Nil = full.unapplySeq(text: Any).get
      val y :: Nil = full.unapplySeq(text: CharSequence).get
      

      In 2.11, the latter returns `Option[Seq[String]]`, with the runtime type being a Vector.

      In 2.10, it used to return `Option[List[String]]`.

      This change was noticed in specs-gwt.

        Activity

        Hide
        Jason Zaugg added a comment -

        And:

        scala> val R = """(a)""".r
        R: scala.util.matching.Regex = (a)
        
        scala> val Some(List(x)) = R.unapplySeq(R.findFirstMatchIn("a").get)
        scala.MatchError: Some(Vector(a)) (of class scala.Some)
          ... 32 elided
        
        Show
        Jason Zaugg added a comment - And: scala> val R = """(a)""".r R: scala.util.matching.Regex = (a) scala> val Some(List(x)) = R.unapplySeq(R.findFirstMatchIn("a").get) scala.MatchError: Some(Vector(a)) (of class scala.Some) ... 32 elided
        Show
        Jason Zaugg added a comment - https://github.com/scala/scala/pull/3207

          People

          • Assignee:
            Jason Zaugg
            Reporter:
            Jason Zaugg
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development