Changes in src/ResolvExpr/Unify.cc [982f95d:8e18b8e]
- File:
-
- 1 edited
-
src/ResolvExpr/Unify.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Unify.cc
r982f95d r8e18b8e 31 31 #include "SynTree/Visitor.h" // for Visitor 32 32 #include "Tuples/Tuples.h" // for isTtype 33 #include "TypeEnvironment.h" // for ClassRef, AssertionSet, OpenVarSet33 #include "TypeEnvironment.h" // for EqvClass, 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 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 130 147 return false; 131 148 } … … 508 525 void premutate( TypeInstType * ) { visit_children = false; } 509 526 Type * postmutate( TypeInstType * typeInst ) { 510 if ( ClassRefeqvClass = tenv.lookup( typeInst->get_name() ) ) {527 if ( const EqvClass *eqvClass = tenv.lookup( typeInst->get_name() ) ) { 511 528 // 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(); 515 531 } 516 532 }
Note:
See TracChangeset
for help on using the changeset viewer.