Changes in src/ResolvExpr/Unify.cc [8e18b8e:982f95d]
- File:
-
- 1 edited
-
src/ResolvExpr/Unify.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Unify.cc
r8e18b8e 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.