Changeset 7583c02 for src/ResolvExpr/SatisfyAssertions.cpp
- Timestamp:
- Dec 31, 2020, 4:17:19 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 09da82d
- Parents:
- abc2a643
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/SatisfyAssertions.cpp
rabc2a643 r7583c02 202 202 ast::ptr< ast::Type > toType = assn.first->result; 203 203 ast::ptr< ast::Type > adjType = 204 renameTyVars( adjustExprType( candidate->get_type(), newEnv, sat.symtab ) );204 renameTyVars( adjustExprType( candidate->get_type(), newEnv, sat.symtab ), GEN_USAGE, false ); 205 205 206 206 // only keep candidates which unify … … 417 417 if ( it != thresholds.end() && it->second < sat.costs ) goto nextSat; 418 418 419 // make initial pass at matching assertions 420 for ( auto & assn : sat.need ) { 421 // fail early if any assertion is not satisfiable 422 if ( ! satisfyAssertion( assn, sat ) ) { 419 // should a limit be imposed? worst case here is O(n^2) but very unlikely to happen. 420 for (unsigned resetCount = 0; ; ++resetCount) { 421 ast::AssertionList next; 422 resetTyVarRenaming(); 423 // make initial pass at matching assertions 424 for ( auto & assn : sat.need ) { 425 // fail early if any assertion is not satisfiable 426 if ( ! satisfyAssertion( assn, sat ) ) { 427 next.emplace_back(assn); 428 // goto nextSat; 429 } 430 } 431 // success 432 if (next.empty()) break; 433 // fail if nothing resolves 434 else if (next.size() == sat.need.size()) { 423 435 Indenter tabs{ 3 }; 424 436 std::ostringstream ss; … … 426 438 print( ss, *sat.cand, ++tabs ); 427 439 ss << (tabs-1) << "Could not satisfy assertion:\n"; 428 ast::print( ss, assn.first, tabs );440 ast::print( ss, next[0].first, tabs ); 429 441 430 442 errors.emplace_back( ss.str() ); 431 443 goto nextSat; 432 444 } 445 sat.need = std::move(next); 433 446 } 434 447
Note: See TracChangeset
for help on using the changeset viewer.