title: scala-meta: type mismatch when unquoting; found: Option[scala.meta.Type.Arg] required: scala.meta.Type
body: <p>I am playing a bit with the new-style <a href="http://scalameta.org/tutorial/#Part4-Macroannotations" rel="nofollow noreferrer">macro annotations</a> of <a href="https://github.com/scalameta/scalameta" rel="nofollow noreferrer">scala-meta</a>. So I extended the example of the @Main annotation:</p>
  
  <p>SConsumer.scala:</p>
  
  <pre><code>import scala.meta._
  
  
  class SConsumer extends scala.annotation.StaticAnnotation {
  
    inline def apply(defn: Any): Any = meta {
      defn match {
        case q"case class $name($param: $tpe) { ..$stats }" =&gt;
          val accept = q"def accept($param: $tpe): Unit = { ..$stats }"
          q"case class $name extends SConsumerProperty[${tpe}] { $accept }"
        case _ =&gt;
          abort("error!")
      }
    }
  }
  </code></pre>
  
  <p>SConsumerProperty.scala:</p>
  
  <pre><code>trait SConsumerProperty[T] {
    def accept(param: T): Unit
  }
  </code></pre>
  
  <p>It gives the following compiler error:</p>
  
  <pre><code>Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0
  [info] Loading project definition from /home/erik/Entwicklung/IntelliJ/Android/Apps/scalandroid/project
  [info] Set current project to scalandroid (in build file:/home/erik/Entwicklung/IntelliJ/Android/Apps/scalandroid/)
  [info] Packaging /home/erik/Entwicklung/IntelliJ/Android/Apps/scalandroid/target/scala-2.11/scalandroid_2.11-0.0.23-sources.jar ...
  [info] Done packaging.
  [info] Wrote /home/erik/Entwicklung/IntelliJ/Android/Apps/scalandroid/target/scala-2.11/scalandroid_2.11-0.0.23.pom
  [info] Compiling 4 Scala sources to /home/erik/Entwicklung/IntelliJ/Android/Apps/scalandroid/target/android/intermediates/classes...
  [error] /home/erik/Entwicklung/IntelliJ/Android/Apps/scalandroid/src/main/scala/com/bertderbecker/scalandroid/event/SConsumer.scala:14: type mismatch when unquoting;
  [error]  found   : Option[scala.meta.Type.Arg]
  [error]  required: scala.meta.Type
  [error]         q"case class $name extends com.bertderbecker.scalandroid.event.SConsumerProperty[${tpe}] { $accept }"
  [error]                                                                                        
  [error] one error found
  [error] (compile:compileIncremental) Compilation failed
  [error] Total time: 6 s, completed 17.02.2017 16:16:02
  Process finished with exit code 1
  </code></pre>
  
  <p>So, how to convert a Type.Arg into a Type?</p>