Changeset 251ce80 for src/AST/TypeEnvironment.cpp
- Timestamp:
- Jun 1, 2023, 6:29:47 PM (16 months ago)
- Branches:
- ast-experimental, master
- Children:
- 24d6572, ded6c2a6
- Parents:
- 1803d4d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/TypeEnvironment.cpp
r1803d4d r251ce80 178 178 179 179 bool TypeEnvironment::combine( 180 const TypeEnvironment & o, OpenVarSet & open , const SymbolTable & symtab) {180 const TypeEnvironment & o, OpenVarSet & open ) { 181 181 // short-circuit easy cases 182 182 if ( o.empty() ) return true; … … 201 201 EqvClass & r = *rt; 202 202 // merge bindings 203 if ( ! mergeBound( r, c, open , symtab) ) return false;203 if ( ! mergeBound( r, c, open ) ) return false; 204 204 // merge previous unbound variables into this class, checking occurs if needed 205 205 if ( r.bound ) for ( const auto & u : c.vars ) { … … 216 216 } else if ( st != rt ) { 217 217 // bound, but not to the same class 218 if ( ! mergeClasses( rt, st, open , symtab) ) return false;218 if ( ! mergeClasses( rt, st, open ) ) return false; 219 219 } // ignore bound into the same class 220 220 } … … 280 280 bool TypeEnvironment::bindVar( 281 281 const TypeInstType * typeInst, const Type * bindTo, const TypeData & data, 282 AssertionSet & need, AssertionSet & have, const OpenVarSet & open, WidenMode widen, 283 const SymbolTable & symtab 282 AssertionSet & need, AssertionSet & have, const OpenVarSet & open, WidenMode widen 284 283 ) { 285 284 // remove references from bound type, so that type variables can only bind to value types … … 300 299 if ( unifyInexact( 301 300 newType, target, *this, need, have, open, 302 widen & WidenMode{ it->allowWidening, true }, symtab,common ) ) {301 widen & WidenMode{ it->allowWidening, true }, common ) ) { 303 302 if ( common ) { 304 303 it->bound = std::move(common); … … 321 320 const TypeInstType * var1, const TypeInstType * var2, TypeData && data, 322 321 AssertionSet & need, AssertionSet & have, const OpenVarSet & open, 323 WidenMode widen , const SymbolTable & symtab322 WidenMode widen 324 323 ) { 325 324 auto c1 = internal_lookup( *var1 ); … … 358 357 359 358 if ( unifyInexact( 360 newType1, newType2, *this, need, have, open, newWidenMode, symtab,common ) ) {359 newType1, newType2, *this, need, have, open, newWidenMode, common ) ) { 361 360 c1->vars.insert( c2->vars.begin(), c2->vars.end() ); 362 361 c1->allowWidening = widen1 && widen2; … … 409 408 410 409 bool TypeEnvironment::mergeBound( 411 EqvClass & to, const EqvClass & from, OpenVarSet & open , const SymbolTable & symtab) {410 EqvClass & to, const EqvClass & from, OpenVarSet & open ) { 412 411 if ( from.bound ) { 413 412 if ( to.bound ) { … … 419 418 420 419 if ( unifyInexact( 421 toType, fromType, *this, need, have, open, widen, symtab,common ) ) {420 toType, fromType, *this, need, have, open, widen, common ) ) { 422 421 // unifies, set common type if necessary 423 422 if ( common ) { … … 437 436 438 437 bool TypeEnvironment::mergeClasses( 439 ClassList::iterator to, ClassList::iterator from, OpenVarSet & open , const SymbolTable & symtab438 ClassList::iterator to, ClassList::iterator from, OpenVarSet & open 440 439 ) { 441 440 EqvClass & r = *to, & s = *from; 442 441 443 442 // ensure bounds match 444 if ( ! mergeBound( r, s, open , symtab) ) return false;443 if ( ! mergeBound( r, s, open ) ) return false; 445 444 446 445 // check safely bindable
Note: See TracChangeset
for help on using the changeset viewer.