Changeset 982f95d for src/ResolvExpr/Unify.cc
- Timestamp:
- Jun 15, 2018, 5:09:29 PM (6 years ago)
- Branches:
- new-env
- Children:
- 97397a26
- Parents:
- 1d7b0a8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Unify.cc
r1d7b0a8 r982f95d 31 31 #include "SynTree/Visitor.h" // for Visitor 32 32 #include "Tuples/Tuples.h" // for isTtype 33 #include "TypeEnvironment.h" // for EqvClass, AssertionSet, OpenVarSet33 #include "TypeEnvironment.h" // for ClassRef, AssertionSet, OpenVarSet 34 34 #include "Unify.h" 35 35 #include "typeops.h" // for flatten, occurs, commonType … … 128 128 return typeInst->get_isFtype(); 129 129 } // 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 incoming138 // type must also be complete139 // 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 type145 return dynamic_cast< TupleType * >( type ) || Tuples::isTtype( type );146 } // switch147 130 return false; 148 131 } … … 525 508 void premutate( TypeInstType * ) { visit_children = false; } 526 509 Type * postmutate( TypeInstType * typeInst ) { 527 if ( const EqvClass *eqvClass = tenv.lookup( typeInst->get_name() ) ) {510 if ( ClassRef eqvClass = tenv.lookup( typeInst->get_name() ) ) { 528 511 // 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(); 531 515 } 532 516 }
Note: See TracChangeset
for help on using the changeset viewer.