title: Type mismatch with Array of Array in Scala
body: <p>I'm trying to build an array of an array to give it as a argument to a method. 
  The value of inner arrays are any kind of data (AnyVal) such as Int or Double. </p>
  
  <p>The method's signature is as follows:</p>
  
  <pre><code>def plot[T &lt;: AnyVal](config:Map[String, String], data:Array[Array[T]]): Unit = {
  </code></pre>
  
  <p>This is the code:</p>
  
  <pre><code>val array1 = (1 to 10).toArray
  val array2 = ArrayBuffer[Int]()
  array1.foreach { i =&gt;
    array2 += (getSize(summary, i))
  }
  val array3 = new Array[Int](summary.getSize())
  
  val arrays = ArrayBuffer[Array[AnyVal]](array1, array2.toArray, array3) # &lt;-- ERROR1
  Gnuplotter.plot(smap, arrays.toArray) # &lt;-- ERROR2
  </code></pre>
  
  <p>However, I have two errors:</p>
  
  <p><img src="https://i.stack.imgur.com/bzFtJ.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/DgYTN.png" alt="enter image description here"></p>
  
  <p>What might be wrong?</p>