Ignore:
Timestamp:
Aug 20, 2020, 11:48:15 PM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
d685cb0
Parents:
67ca73e (diff), 013b028 (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.
Message:

fix conflicts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/SatisfyAssertions.cpp

    r67ca73e re67a82d  
    99// Author           : Aaron B. Moss
    1010// Created On       : Mon Jun 10 17:45:00 2019
    11 // Last Modified By : Aaron B. Moss
    12 // Last Modified On : Mon Jun 10 17:45:00 2019
    13 // Update Count     : 1
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Tue Oct  1 13:56:00 2019
     13// Update Count     : 2
    1414//
    1515
     
    188188
    189189                                matches.emplace_back(
    190                                         cdata, adjType, std::move( newEnv ), std::move( newNeed ), std::move( have ),
     190                                        cdata, adjType, std::move( newEnv ), std::move( have ), std::move( newNeed ),
    191191                                        std::move( newOpen ), crntResnSlot );
    192192                        }
     
    229229                InferMatcher( InferCache & inferred ) : inferred( inferred ) {}
    230230
    231                 const ast::Expr * postmutate( const ast::Expr * expr ) {
     231                const ast::Expr * postvisit( const ast::Expr * expr ) {
    232232                        // Skip if no slots to find
    233                         if ( expr->inferred.mode != ast::Expr::InferUnion::Slots ) return expr;
    234 
     233                        if ( !expr->inferred.hasSlots() ) return expr;
     234                        // if ( expr->inferred.mode != ast::Expr::InferUnion::Slots ) return expr;
     235                        std::vector<UniqueId> missingSlots;
    235236                        // find inferred parameters for resolution slots
    236                         ast::InferredParams newInferred;
     237                        ast::InferredParams * newInferred = new ast::InferredParams();
    237238                        for ( UniqueId slot : expr->inferred.resnSlots() ) {
    238239                                // fail if no matching assertions found
    239240                                auto it = inferred.find( slot );
    240241                                if ( it == inferred.end() ) {
    241                                         assert(!"missing assertion");
     242                                        std::cerr << "missing assertion " << slot << std::endl;
     243                                        missingSlots.push_back(slot);
     244                                        continue;
    242245                                }
    243246
     
    245248                                for ( auto & entry : it->second ) {
    246249                                        // recurse on inferParams of resolved expressions
    247                                         entry.second.expr = postmutate( entry.second.expr );
    248                                         auto res = newInferred.emplace( entry );
     250                                        entry.second.expr = postvisit( entry.second.expr );
     251                                        auto res = newInferred->emplace( entry );
    249252                                        assert( res.second && "all assertions newly placed" );
    250253                                }
     
    252255
    253256                        ast::Expr * ret = mutate( expr );
    254                         ret->inferred.set_inferParams( std::move( newInferred ) );
     257                        ret->inferred.set_inferParams( newInferred );
     258                        if (!missingSlots.empty()) ret->inferred.resnSlots() = missingSlots;
    255259                        return ret;
    256260                }
     
    299303                        Cost cost;
    300304
    301                         OutType( 
    302                                 const ast::TypeEnvironment & e, const ast::OpenVarSet & o, 
     305                        OutType(
     306                                const ast::TypeEnvironment & e, const ast::OpenVarSet & o,
    303307                                const std::vector< DeferRef > & as, const ast::SymbolTable & symtab )
    304308                        : env( e ), open( o ), assns( as ), cost( Cost::zero ) {
     
    306310                                for ( const DeferRef & assn : assns ) {
    307311                                        // compute conversion cost from satisfying decl to assertion
    308                                         cost += computeConversionCost( 
    309                                                 assn.match.adjType, assn.decl->get_type(), symtab, env );
    310                                        
     312                                        cost += computeConversionCost(
     313                                                assn.match.adjType, assn.decl->get_type(), false, symtab, env );
     314
    311315                                        // mark vars+specialization on function-type assertions
    312                                         const ast::FunctionType * func = 
     316                                        const ast::FunctionType * func =
    313317                                                GenPoly::getFunctionType( assn.match.cdata.id->get_type() );
    314318                                        if ( ! func ) continue;
     
    317321                                                cost.decSpec( specCost( param->get_type() ) );
    318322                                        }
    319                                        
     323
    320324                                        cost.incVar( func->forall.size() );
    321                                        
     325
    322326                                        for ( const ast::TypeDecl * td : func->forall ) {
    323327                                                cost.decSpec( td->assertions.size() );
     
    329333                };
    330334
    331                 CandidateEnvMerger( 
    332                         const ast::TypeEnvironment & env, const ast::OpenVarSet & open, 
     335                CandidateEnvMerger(
     336                        const ast::TypeEnvironment & env, const ast::OpenVarSet & open,
    333337                        const ast::SymbolTable & syms )
    334338                : crnt(), envs{ env }, opens{ open }, symtab( syms ) {}
Note: See TracChangeset for help on using the changeset viewer.