title: Unify generic types in macro
body: <p>I wanted to use macro to check if a function is returning a particular generic type, say <code>Array</code>, so it is fine if the function is returning <code>Array&lt;Dynamic&gt;</code>, <code>Array&lt;String&gt;</code>, or even generic <code>Array&lt;T&gt;</code>.</p>
  
  <p>So I tried to <code>Context.unify</code> it with <code>Array&lt;Dynamic&gt;</code>. It is fine for <code>Array&lt;String&gt;</code> or <code>Array&lt;Dynamic&gt;</code> but it fails when the type parameter is "generic" because the ComplexType <code>Array&lt;T&gt;</code> won't convert to a Type with <code>Type not found: T</code> (See code below). Are there any possible ways to achieve what I am attempting to do?</p>
  
  <pre><code>package;
  
  #if macro
  import haxe.macro.Context;
  using haxe.macro.ComplexTypeTools;
  #end
  
  #if !macro @:build(Macros.build()) #end
  class Main 
  {
      public function test&lt;T&gt;():Array&lt;T&gt;
      {
          return [];
      }
  }
  
  class Macros
  {
      public static function build()
      {
          #if macro
          var fields = Context.getBuildFields();
          for(field in fields)
          {
              switch(field.kind)
              {
                  case FFun(f):
                      // try to unify Array&lt;String&gt; with Array&lt;Dynamic&gt;
                      trace(Context.unify((macro:Array&lt;String&gt;).toType(), (macro:Array&lt;Dynamic&gt;).toType())); 
                      // true
  
                      // try to unify Array&lt;T&gt; with Array&lt;Dynamic&gt;
                      trace(Context.unify(f.ret.toType(), (macro:Array&lt;Dynamic&gt;).toType())); 
                      // Type not found: T
                  default:
              }
          }
          return null;
          #end
      }
  }
  </code></pre>