title: Scala 2.10 "No implicit view available" error on type parameter that asks for a view
body: <p>I have reduced this example from something encountered in a much larger project; the fundamental issue seems to be that Scala 2.10 has weird or possibly broken handling of view constraints:</p>
  
  <pre><code>trait Nameish {
    def name: String
  }
  
  abstract class Namer[A &lt;% Nameish](e: Class[A]) {
    def doNameThing(x: A) = println("argument is named " + x.name)
  }
  class SubNamer[A &lt;% Nameish](e: Class[A]) extends Namer(e) {
  }
  
  object TestViews extends App {
    import scala.language.implicitConversions
    implicit def nameStr(x: String): Nameish = new StringNamer(x);
  
    class StringNamer(x: String) extends Nameish {
      def name = x
    }
  
    println(new SubNamer(classOf[String]).doNameThing("foo"))
  }
  </code></pre>
  
  <p>When I try to compile this, in scala 2.10 I get the errors:</p>
  
  <pre><code>TestViews.scala:8: error: No implicit view available from A =&gt; Nameish.
  class SubNamer[A &lt;% Nameish](e: Class[A]) extends Namer(e) {
                   ^
  TestViews.scala:18: error: value doNameThing is not a member of SubNamer[String]
    println(new SubNamer(classOf[String]).doNameThing("foo"))
                                          ^
  two errors found
  </code></pre>
  
  <p>Note that Scala 2.11 is fine with this code.</p>
  
  <p>Unfortunately, re-tooling this code to a newer scala version would make this task explode in size. I need to find a way to make the existing scala accept a class hierarchy with a type parameter that has a view constraint.</p>
  
  <hr>
  
  <p>Another attempt at a way around this has uncovered a different scala-2.10-only error case:</p>
  
  <pre><code>trait Nameish {
    def name: String
  }
  
  abstract class Namer[A](e: Class[A])(implicit view: A =&gt; Nameish) {
    def doNameThing(x: A) = println("argument is named " + x.name)
  }
  class SubNamer[A](e: Class[A])(implicit view: A =&gt; Nameish) extends Namer(e)(view) {
  }
  
  object TestViews extends App {
    import scala.language.implicitConversions
    implicit def nameStr(x: String): Nameish = new StringNamer(x);
  
    class StringNamer(x: String) extends Nameish {
      def name = x
    }
  
    println(new SubNamer(classOf[String]).doNameThing("foo"))
  }
  </code></pre>
  
  <p>This is just replacing the view constraints with implicit arguments.</p>
  
  <p>With this code, it again compiles just fine with Scala 2.11, but on Scala 2.10:</p>
  
  <pre><code>TestViews.scala:8: error: `implicit' modifier cannot be used for top-level objects
  class SubNamer[A](e: Class[A])(implicit view: A =&gt; Nameish) extends Namer(e)(view) {
                                          ^
  one error found
  </code></pre>
  
  <p>I don't understand what's going on here: I'm not trying to declare an implicit object, I'm trying to declare that the class takes an implicit parameter. Why is it fine for the first class, but not the second one?</p>