Changeset f8d05ee for src/AST/TypeEnvironment.cpp
- Timestamp:
- Aug 12, 2020, 12:19:39 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 74807be, fb0ae06
- Parents:
- 7f66cec (diff), 7ff3e522 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
src/AST/TypeEnvironment.cpp (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/TypeEnvironment.cpp
r7f66cec rf8d05ee 59 59 std::copy( clz.vars.begin(), clz.vars.end(), std::ostream_iterator< std::string >( out, " " ) ); 60 60 out << ")"; 61 61 62 62 if ( clz.bound ) { 63 63 out << " -> "; … … 92 92 } 93 93 } 94 94 95 95 i = next; // go to next node even if this removed 96 96 } … … 161 161 Pass<Occurs> occur{ var, env }; 162 162 maybe_accept( ty, occur ); 163 return occur. pass.result;164 } 165 } 166 167 bool TypeEnvironment::combine( 163 return occur.core.result; 164 } 165 } 166 167 bool TypeEnvironment::combine( 168 168 const TypeEnvironment & o, OpenVarSet & open, const SymbolTable & symtab ) { 169 169 // short-circuit easy cases … … 199 199 auto st = internal_lookup( *vt ); 200 200 if ( st == env.end() ) { 201 // unbound, safe to add if occurs 201 // unbound, safe to add if occurs 202 202 if ( r.bound && occurs( r.bound, *vt, *this ) ) return false; 203 203 r.vars.emplace( *vt ); … … 266 266 } 267 267 268 bool TypeEnvironment::bindVar( 269 const TypeInstType * typeInst, const Type * bindTo, const TypeDecl::Data & data, 270 AssertionSet & need, AssertionSet & have, const OpenVarSet & open, WidenMode widen, 271 const SymbolTable & symtab 268 bool TypeEnvironment::bindVar( 269 const TypeInstType * typeInst, const Type * bindTo, const TypeDecl::Data & data, 270 AssertionSet & need, AssertionSet & have, const OpenVarSet & open, WidenMode widen, 271 const SymbolTable & symtab 272 272 ) { 273 273 // remove references from bound type, so that type variables can only bind to value types … … 286 286 ptr<Type> newType = it->bound; 287 287 reset_qualifiers( newType, typeInst->qualifiers ); 288 if ( unifyInexact( 289 newType, target, *this, need, have, open, 288 if ( unifyInexact( 289 newType, target, *this, need, have, open, 290 290 widen & WidenMode{ it->allowWidening, true }, symtab, common ) ) { 291 291 if ( common ) { … … 300 300 } 301 301 } else { 302 env.emplace_back( 302 env.emplace_back( 303 303 typeInst->name, target, widen.first && widen.second, data ); 304 304 } … … 306 306 } 307 307 308 bool TypeEnvironment::bindVarToVar( 309 const TypeInstType * var1, const TypeInstType * var2, TypeDecl::Data && data, 310 AssertionSet & need, AssertionSet & have, const OpenVarSet & open, 311 WidenMode widen, const SymbolTable & symtab 308 bool TypeEnvironment::bindVarToVar( 309 const TypeInstType * var1, const TypeInstType * var2, TypeDecl::Data && data, 310 AssertionSet & need, AssertionSet & have, const OpenVarSet & open, 311 WidenMode widen, const SymbolTable & symtab 312 312 ) { 313 313 auto c1 = internal_lookup( var1->name ); 314 314 auto c2 = internal_lookup( var2->name ); 315 315 316 316 // exit early if variables already bound together 317 317 if ( c1 != env.end() && c1 == c2 ) { … … 396 396 } 397 397 398 bool TypeEnvironment::mergeBound( 398 bool TypeEnvironment::mergeBound( 399 399 EqvClass & to, const EqvClass & from, OpenVarSet & open, const SymbolTable & symtab ) { 400 400 if ( from.bound ) { … … 406 406 AssertionSet need, have; 407 407 408 if ( unifyInexact( 408 if ( unifyInexact( 409 409 toType, fromType, *this, need, have, open, widen, symtab, common ) ) { 410 410 // unifies, set common type if necessary … … 424 424 } 425 425 426 bool TypeEnvironment::mergeClasses( 426 bool TypeEnvironment::mergeClasses( 427 427 ClassList::iterator to, ClassList::iterator from, OpenVarSet & open, const SymbolTable & symtab 428 428 ) {
Note:
See TracChangeset
for help on using the changeset viewer.