anchor.diff:  
   
   gen_out_type(Context, TypeName) ->
  -    gen_out_type(Context, TypeName, _ErlType = 'undefined').
  -
  -
  -gen_out_type(Context, TypeName, ErlType) ->
  -    T = gen_type(Context, TypeName, ErlType),
  +    T = gen_type(Context, TypeName),
  +    output_type(T).
  +
  +
  +gen_out_alias_type(Context, Alias) ->
  +    T = gen_alias_type(Context, Alias),
  +    output_type(T).
  +
  +
  +output_type(T) ->
       % allow more flexible typing for convenience
       case to_string(T) of
           "string" ->
  
positive.code: 
  
  gen_alias(Context, X) ->
      TypeExpr = gen_out_type(Context, X#alias.type, X#alias.erlang_type),
      make_typedef_1(Context, X#alias.erlang_name, TypeExpr).
  
  
  
negative.code:     end.
  
  
  gen_type(Context, TypeName) ->
      {ParentPiqi, Typedef} = resolve_type_name(Context, TypeName),
      ParentContext = piqic:switch_context(Context, ParentPiqi),
      case Typedef of
          {alias, Alias} ->
              case piqic:is_builtin_alias(Alias) of
                  true ->
                      % we need to recurse, because we don't generate -type
                      % definitions for built-in types (see below)
                      gen_alias_type(ParentContext, Alias);
                  false ->
                      gen_typedef_type(ParentContext, Typedef)
              end;
          _ -> % piqi_record | variant | list | enum
              gen_typedef_type(ParentContext, Typedef)
      end.
  
  
  gen_typedef_type(Context, Typedef) ->
      % make scoped name based on the parent module's type prefix
      Name = typedef_erlname(Typedef),
      scoped_name(Context, Name).
  
          
  gen_alias_type(Context, Alias) ->
      case {Alias#alias.erlang_type, Alias#alias.type} of
          {ErlType, _} when ErlType =/= 'undefined' ->
              ErlType;
          {'undefined', 'undefined'} ->
              % this is an alias for a built-in type (piqi_type field must be
              % defined when neither of type and erlang_type fields are present)
              gen_builtin_type(Context, Alias#alias.piqi_type);
          {'undefined', TypeName} ->
              gen_type(Context, TypeName)
      end.
  
  
  