Ignore:
Timestamp:
Apr 25, 2018, 4:55:53 PM (6 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
new-env, with_gc
Children:
42107b4
Parents:
2efe4b8 (diff), 9d5fb67 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge remote-tracking branch 'origin/master' into with_gc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/TypeSubstitution.cc

    r2efe4b8 r1cdfa82  
    132132                return inst;
    133133        } else {
    134 ///         std::cerr << "found " << inst->get_name() << ", replacing with ";
    135 ///         i->second->print( std::cerr );
    136 ///         std::cerr << std::endl;
     134                // cut off infinite loop for the case where a type is bound to itself.
     135                // Note: this does not prevent cycles in the general case, so it may be necessary to do something more sophisticated here.
     136                // TODO: investigate preventing type variables from being bound to themselves in the first place.
     137                if ( TypeInstType * replacement = dynamic_cast< TypeInstType * >( i->second ) ) {
     138                        if ( inst->name == replacement->name ) {
     139                                return inst;
     140                        }
     141                }
     142                // std::cerr << "found " << inst->name << ", replacing with " << i->second << std::endl;
    137143                subCount++;
    138144                Type * newtype = i->second->clone();
    139145                newtype->get_qualifiers() |= inst->get_qualifiers();
    140                 return newtype;
     146                // Note: need to recursively apply substitution to the new type because normalize does not substitute bound vars, but bound vars must be substituted when not in freeOnly mode.
     147                return newtype->acceptMutator( *visitor );
    141148        } // if
    142149}
Note: See TracChangeset for help on using the changeset viewer.