anchor.diff:          [] ->
               {no_records_with_all_fields, Fields};
           [RecName] ->
  -            [{RecName, Formals, _}] = ets:lookup(record_types, RecName),
  +            {Formals, {record_t, _}} = lookup_type(RecName),
               create_freshen_tvars(),
               FreshRecType = freshen({app_t, Attrs, {id, Attrs, RecName}, Formals}),
               destroy_freshen_tvars(),
  
positive.code:          || {RecordType, FieldName, FieldType, When} <- Constraints],
      SolvedConstraints =
          [begin
               RecId = {id, Attrs, RecName} = record_type_name(RecType),
               case ets:lookup(record_types, RecName) of
                   [] ->
                       type_error({not_a_record_type, RecId, When}),
                       not_solved;
                   [{RecName, Formals, Fields}] ->
                       FieldTypes = [{Name, Type} || {field_t, _, {id, _, Name}, Type} <- Fields],
                       {id, _, FieldString} = FieldName,
                       case proplists:get_value(FieldString, FieldTypes) of
  
negative.code:     end;
  unfold_record_types_in_type(Type={id, _, RecName}) ->
      %% Like the case above, but for record types without parameters.
      case lookup_type(RecName) of
          {[], {record_t, Fields}} ->
              {record_t, unfold_record_types_in_type(Fields)};
          _ ->
              %% Not a record type, or ill-formed record type
              Type
  