title: scala.collection.MapView$MapValues cannot be cast to scala.collection.immutable.Map
body: <p>I have some code that used to work under Scala 2.12 but now fails under 2.13.</p>
  <p>Essentially my calls look like so:</p>
  <p><code>Controller -&gt; Service -&gt; Actor -&gt; Repo</code></p>
  <p>My <strong>controller</strong> looks like this:</p>
  <pre class="lang-scala prettyprint-override"><code>complete {
    dep.chunkService.getChunksWithSubtitlesByDistribution(id, chunkState).map(
      _.right.map(
      chunkMap =&gt; StatusResult(
                    Meta(OK),
                    chunkMap.extractChunkDtoList,
                    chunkMap.extractSubtitleDtoList)): ToResponseMarshallable)
  }
  </code></pre>
  <p>And the error I get is:</p>
  <blockquote>
  <p>scala.collection.MapView$MapValues cannot be cast to scala.collection.immutable.Map</p>
  </blockquote>
  <p>It happens on this line of the controller:</p>
  <pre class="lang-scala prettyprint-override"><code>  chunkMap =&gt; StatusResult(
  </code></pre>
  <p>The <strong>service</strong> method that is called by the controller has the signature:</p>
  <pre class="lang-scala prettyprint-override"><code>def getChunksWithSubtitlesByDistribution(distributionId: UUID, state: Option[ChunkState]): 
          Future[Either[DistributionNotFoundError, Map[Chunk, List[Subtitle]]]]
  </code></pre>
  <p>The service sets up an Actor that makes the call to the Repo like so:</p>
  <pre class="lang-scala prettyprint-override"><code>
  sender ! chunkRepo.getChunksWithSubtitlesByDistribution(distributionId, state).right.map(_.mapValues(_.sortWith((a, b) =&gt; a.start &lt; b.start) ) )
  </code></pre>
  <p>It is that value which will be returned by <code>chunkService.getChunksWithSubtitlesByDistribution</code></p>
  <p><code>chunkRepo.getChunksWithSubtitlesByDistribution</code> returns this:</p>
  <pre class="lang-scala prettyprint-override"><code>result match {
     case Nil =&gt; Left(DistributionNotFoundError(distributionId))
     case rs =&gt;
       Right(
         rs.flatten
           .groupBy { case (c, s) =&gt; c }
             .mapValues(pairs =&gt; pairs.map { case (c, ss) =&gt; ss }.flatten)
             .toMap
       )
  }
  </code></pre>
  <p>Not sure where in the chain the &quot;MapView&quot; comes into play, or how to get it to convert to a &quot;normal&quot; map?</p>