Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: Scala 2.9.1, Scala 2.9.2
    • Fix Version/s: Scala 2.10.0
    • Component/s: Pattern Matcher
    • Labels:
      None
    • Environment:

      scala JVM, scala interperter

      Description

      There is wrongly positive matching in the following piece of code. Piece of code prints "wrongly positive" when one could expect no match exception.
      I found this bug in production code and wrote this small reproducing snapshort

      Array("a", "b", "c") match {
      case Array("a", "x", "c") => println("x"); 
      case Array("a", "b", "x") => println("a"); 
      case Array("a", "d", _*) => println("wrongly positive")
      }
      

      Result: wrongly positive

      The interesting thing about this code that without the first case it works correctly.

        Issue Links

          Activity

          Hide
          Jason Zaugg added a comment -

          Already fixed in 2.10.0, test cases added for 2.10.1:

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

          Show
          Jason Zaugg added a comment - Already fixed in 2.10.0, test cases added for 2.10.1: https://github.com/scala/scala/pull/1653

            People

            • Assignee:
              Jason Zaugg
              Reporter:
              Pavel Girs
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development