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

traits Map and Set do not match mutable versions

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.9.1
    • Fix Version/s: Scala 2.10.3-RC1
    • Component/s: None
    • Labels:
      None
    • Environment:

      Scala 2.9.1

      Description

      I'm wondering why collection.mutable.Seq can be of type Seq while mutable.Map and mutable.Set cannot be of type Map and Set. Is that the expected behavior or a Bug?

      Welcome to Scala version 2.9.1.final (Java HotSpot(TM) Client VM, Java 1.6.0_26).
      Type in expressions to have them evaluated.
      Type :help for more information.
       
      scala> val a:Seq[Int]     = collection.mutable.Seq[Int]()
      a: Seq[Int] = ArrayBuffer()
       
      scala> val b:Set[Int]     = collection.mutable.Set[Int]()
      <console>:7: error: type mismatch;
       found   : scala.collection.mutable.Set[Int]
       required: scala.collection.immutable.Set[Int]
             val b:Set[Int]     = collection.mutable.Set[Int]()
                                                             ^
       
      scala> val c:Map[Int,Int] = collection.mutable.Map[Int,Int]()
      <console>:7: error: type mismatch;
       found   : scala.collection.mutable.Map[Int,Int]
       required: scala.collection.immutable.Map[Int,Int]
             val c:Map[Int,Int] = collection.mutable.Map[Int,Int]()
                                                                 ^
       
      scala>
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              man Felix Dietze
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: