title: Scala implicit conversion of primitive to AnyRef
body: <p>In Scala code that I am writing, I have a <code>Map[String, AnyRef]</code>. When I try to initialize the Map using the following, Scala complains that it is expecting a <code>Map[String, AnyRef]</code> but the value is a <code>Map[String, Any]</code>:</p>
  
  <pre><code>val myMap: Map[String, AnyRef] =
    Map("foo" -&gt; true, "bar" -&gt; false)
  </code></pre>
  
  <p>I know that I can use the following instead:</p>
  
  <pre><code>val myMap: Map[String, AnyRef] =
    Map("foo" -&gt; true.asInstanceOf[AnyRef], "bar" -&gt; false.asInstanceOf[AnyRef])
  </code></pre>
  
  <p>I declared the following in scope:</p>
  
  <pre><code>implicit def booleanToAnyRef(value: Boolean): AnyRef = value.asInstanceOf[AnyRef]
  </code></pre>
  
  <p>but the compiler still complains.</p>
  
  <p>Shouldn't the compiler use the implicit method to convert the primitive boolean values into <code>AnyRef</code> values? Is there any way, short of (the ugly) <code>x.asInstanceOf[AnyRef]</code> to have these converted?</p>