Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CandidateFinder.cpp

    r3e5dd913 re3282fe  
    212212                // mark type variable and specialization cost of forall clause
    213213                convCost.incVar( function->forall.size() );
    214                 convCost.decSpec( function->assertions.size() );
     214                for ( const ast::TypeDecl * td : function->forall ) {
     215                        convCost.decSpec( td->assertions.size() );
     216                }
    215217
    216218                return convCost;
     
    218220
    219221        void makeUnifiableVars(
    220                 const ast::FunctionType * type, ast::OpenVarSet & unifiableVars,
     222                const ast::ParameterizedType * type, ast::OpenVarSet & unifiableVars,
    221223                ast::AssertionSet & need
    222224        ) {
    223                 for ( auto & tyvar : type->forall ) {
    224                         unifiableVars[ *tyvar ] = ast::TypeDecl::Data{ tyvar->base };
    225                 }
    226                 for ( auto & assn : type->assertions ) {
    227                         need[ assn ].isUsed = true;
     225                for ( const ast::TypeDecl * tyvar : type->forall ) {
     226                        unifiableVars[ tyvar->name ] = ast::TypeDecl::Data{ tyvar };
     227                        for ( const ast::DeclWithType * assn : tyvar->assertions ) {
     228                                need[ assn ].isUsed = true;
     229                        }
    228230                }
    229231        }
     
    951953                                                auto inst = dynamic_cast< const ast::TypeInstType * >( funcResult )
    952954                                        ) {
    953                                                 if ( const ast::EqvClass * clz = func->env.lookup( *inst ) ) {
     955                                                if ( const ast::EqvClass * clz = func->env.lookup( inst->name ) ) {
    954956                                                        if ( auto function = clz->bound.as< ast::FunctionType >() ) {
    955957                                                                CandidateRef newFunc{ new Candidate{ *func } };
     
    10751077                        assert( toType );
    10761078                        toType = resolveTypeof( toType, symtab );
    1077                         // toType = SymTab::validateType( castExpr->location, toType, symtab );
     1079                        toType = SymTab::validateType( castExpr->location, toType, symtab );
    10781080                        toType = adjustExprType( toType, tenv, symtab );
    10791081
     
    11601162
    11611163                                        if(auto insttype = dynamic_cast<const ast::TypeInstType*>(expr)) {
    1162                                                 auto td = cand->env.lookup(*insttype);
     1164                                                auto td = cand->env.lookup(insttype->name);
    11631165                                                if(!td) { continue; }
    11641166                                                expr = td->bound.get();
     
    15661568                                // calculate target type
    15671569                                const ast::Type * toType = resolveTypeof( initAlt.type, symtab );
    1568                                 // toType = SymTab::validateType( initExpr->location, toType, symtab );
     1570                                toType = SymTab::validateType( initExpr->location, toType, symtab );
    15691571                                toType = adjustExprType( toType, tenv, symtab );
    15701572                                // The call to find must occur inside this loop, otherwise polymorphic return
Note: See TracChangeset for help on using the changeset viewer.