Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Unify.cc

    r982f95d r8e18b8e  
    3131#include "SynTree/Visitor.h"      // for Visitor
    3232#include "Tuples/Tuples.h"        // for isTtype
    33 #include "TypeEnvironment.h"      // for ClassRef, AssertionSet, OpenVarSet
     33#include "TypeEnvironment.h"      // for EqvClass, AssertionSet, OpenVarSet
    3434#include "Unify.h"
    3535#include "typeops.h"              // for flatten, occurs, commonType
     
    128128                        return typeInst->get_isFtype();
    129129                } // if
     130                return false;
     131        }
     132
     133        bool tyVarCompatible( const TypeDecl::Data & data, Type *type ) {
     134                switch ( data.kind ) {
     135                  case TypeDecl::Dtype:
     136                        // to bind to an object type variable, the type must not be a function type.
     137                        // if the type variable is specified to be a complete type then the incoming
     138                        // type must also be complete
     139                        // xxx - should this also check that type is not a tuple type and that it's not a ttype?
     140                        return ! isFtype( type ) && (! data.isComplete || type->isComplete() );
     141                  case TypeDecl::Ftype:
     142                        return isFtype( type );
     143                  case TypeDecl::Ttype:
     144                        // ttype unifies with any tuple type
     145                        return dynamic_cast< TupleType * >( type ) || Tuples::isTtype( type );
     146                } // switch
    130147                return false;
    131148        }
     
    508525                void premutate( TypeInstType * ) { visit_children = false; }
    509526                Type * postmutate( TypeInstType * typeInst ) {
    510                         if ( ClassRef eqvClass = tenv.lookup( typeInst->get_name() ) ) {
     527                        if ( const EqvClass *eqvClass = tenv.lookup( typeInst->get_name() ) ) {
    511528                                // expand ttype parameter into its actual type
    512                                 BoundType cBound = eqvClass.get_bound();
    513                                 if ( cBound.data.kind == TypeDecl::Ttype && cBound.type ) {
    514                                         return cBound.type->clone();
     529                                if ( eqvClass->data.kind == TypeDecl::Ttype && eqvClass->type ) {
     530                                        return eqvClass->type->clone();
    515531                                }
    516532                        }
Note: See TracChangeset for help on using the changeset viewer.