Ignore:
Timestamp:
Jun 15, 2018, 5:09:29 PM (6 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
new-env
Children:
97397a26
Parents:
1d7b0a8
Message:

Start of new environment implementation; terribly broken

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Unify.cc

    r1d7b0a8 r982f95d  
    3131#include "SynTree/Visitor.h"      // for Visitor
    3232#include "Tuples/Tuples.h"        // for isTtype
    33 #include "TypeEnvironment.h"      // for EqvClass, AssertionSet, OpenVarSet
     33#include "TypeEnvironment.h"      // for ClassRef, 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
    147130                return false;
    148131        }
     
    525508                void premutate( TypeInstType * ) { visit_children = false; }
    526509                Type * postmutate( TypeInstType * typeInst ) {
    527                         if ( const EqvClass *eqvClass = tenv.lookup( typeInst->get_name() ) ) {
     510                        if ( ClassRef eqvClass = tenv.lookup( typeInst->get_name() ) ) {
    528511                                // expand ttype parameter into its actual type
    529                                 if ( eqvClass->data.kind == TypeDecl::Ttype && eqvClass->type ) {
    530                                         return eqvClass->type->clone();
     512                                BoundType cBound = eqvClass.get_bound();
     513                                if ( cBound.data.kind == TypeDecl::Ttype && cBound.type ) {
     514                                        return cBound.type->clone();
    531515                                }
    532516                        }
Note: See TracChangeset for help on using the changeset viewer.