Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Unify.cc

    reb50842 r721f17a  
    1010// Created On       : Sun May 17 12:27:10 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun May 17 13:08:48 2015
    13 // Update Count     : 6
     12// Last Modified On : Fri Jun 26 14:57:05 2015
     13// Update Count     : 7
    1414//
    1515
     
    7373        };
    7474
    75         /// Attempts an inexact unification of type1 and type2.
    76         /// Returns false if no such unification; if the types can be unified, sets common (unless they unify exactly and have identical type qualifiers)
    7775        bool unifyInexact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer, Type *&common );
    7876        bool unifyExact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer );
     
    150148                        if ( curClass.type ) {
    151149                                Type *common = 0;
    152                                 // attempt to unify equivalence class type (which has qualifiers stripped, so they must be restored) with the type to bind to
    153150                                std::auto_ptr< Type > newType( curClass.type->clone() );
    154151                                newType->get_qualifiers() = typeInst->get_qualifiers();
     
    283280                TypeEnvironment debugEnv( env );
    284281#endif
    285                 if ( type1->get_qualifiers() != type2->get_qualifiers() ) {
    286                         return false;
    287                 }
    288 
    289282                bool result;
    290283                TypeInstType *var1 = dynamic_cast< TypeInstType* >( type1 );
     
    299292                bool isopen1 = var1 && ( entry1 != openVars.end() );
    300293                bool isopen2 = var2 && ( entry2 != openVars.end() );
    301 
    302                 if ( isopen1 && isopen2 && entry1->second == entry2->second ) {
     294                if ( type1->get_qualifiers() != type2->get_qualifiers() ) {
     295                        return false;
     296                } else if ( isopen1 && isopen2 && entry1->second == entry2->second ) {
    303297                        result = bindVarToVar( var1, var2, entry1->second, env, needAssertions, haveAssertions, openVars, widenMode, indexer );
    304298                } else if ( isopen1 ) {
Note: See TracChangeset for help on using the changeset viewer.