Changeset aac5dfd for src/ResolvExpr


Ignore:
Timestamp:
Dec 12, 2020, 7:30:31 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
5d1aa2f
Parents:
6ce9a4f2 (diff), 4803a901 (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:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src/ResolvExpr
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CandidateFinder.cpp

    r6ce9a4f2 raac5dfd  
    220220
    221221        void makeUnifiableVars(
    222                 const ast::ParameterizedType * type, ast::OpenVarSet & unifiableVars,
     222                const ast::FunctionType * type, ast::OpenVarSet & unifiableVars,
    223223                ast::AssertionSet & need
    224224        ) {
  • src/ResolvExpr/CastCost.cc

    r6ce9a4f2 raac5dfd  
    165165                                } else {
    166166                                        ast::TypeEnvironment newEnv{ env };
    167                                         if ( auto wParams = pointerType->base.as< ast::ParameterizedType >() ) {
     167                                        if ( auto wParams = pointerType->base.as< ast::FunctionType >() ) {
    168168                                                newEnv.add( wParams->forall );
    169169                                        }
  • src/ResolvExpr/RenameVars.cc

    r6ce9a4f2 raac5dfd  
    9393                }
    9494
    95                 template<typename NodeT>
    96                 const NodeT * openLevel( const NodeT * type ) {
     95                const ast::FunctionType * openLevel( const ast::FunctionType * type ) {
    9796                        if ( type->forall.empty() ) return type;
    9897
     
    10099
    101100                        // Load new names from this forall clause and perform renaming.
    102                         NodeT * mutType = ast::mutate( type );
     101                        auto mutType = ast::mutate( type );
    103102                        assert( type == mutType && "mutated type must be unique from ForallSubstitutor" );
    104103                        for ( ast::ptr< ast::TypeDecl > & td : mutType->forall ) {
     104                                assertf(dynamic_cast<ast::FunctionType *>(mutType), "renaming vars in non-function type");
    105105                                std::ostringstream output;
    106106                                output << "_" << resetCount << "_" << level << "_" << td->name;
     
    119119                }
    120120
    121                 void closeLevel( const ast::ParameterizedType * type ) {
     121                void closeLevel( const ast::FunctionType * type ) {
    122122                        if ( type->forall.empty() ) return;
    123123
     
    149149                        return renaming.openLevel( type );
    150150                }
     151
     152                /*
    151153                const ast::StructInstType * previsit( const ast::StructInstType * type ) {
    152154                        return renaming.openLevel( type );
     
    158160                        return renaming.openLevel( type );
    159161                }
     162                */
     163
    160164                const ast::TypeInstType * previsit( const ast::TypeInstType * type ) {
    161                         return renaming.rename( renaming.openLevel( type ) );
     165                        return renaming.rename( type );
    162166                }
    163                 void postvisit( const ast::ParameterizedType * type ) {
     167                void postvisit( const ast::FunctionType * type ) {
    164168                        renaming.closeLevel( type );
    165169                }
  • src/ResolvExpr/Resolver.cc

    r6ce9a4f2 raac5dfd  
    968968        namespace {
    969969                /// Finds deleted expressions in an expression tree
    970                 struct DeleteFinder_new final : public ast::WithShortCircuiting {
     970                struct DeleteFinder_new final : public ast::WithShortCircuiting, public ast::WithVisitorRef<DeleteFinder_new> {
    971971                        const ast::DeletedExpr * result = nullptr;
    972972
     
    976976                        }
    977977
    978                         void previsit( const ast::Expr * ) {
     978                        void previsit( const ast::Expr * expr ) {
    979979                                if ( result ) { visit_children = false; }
     980                                if (expr->inferred.hasParams()) {
     981                                        for (auto & imp : expr->inferred.inferParams() ) {
     982                                                imp.second.expr->accept(*visitor);
     983                                        }
     984                                }
    980985                        }
    981986                };
  • src/ResolvExpr/SatisfyAssertions.cpp

    r6ce9a4f2 raac5dfd  
    194194                        // if we should implement the same rule here
    195195                        // (i.e. error if unique best match is deleted)
    196                         if (candidate->isDeleted) continue;
     196                        if (candidate->isDeleted && candidate->linkage == ast::Linkage::AutoGen) continue;
    197197
    198198                        // build independent unification context for candidate
  • src/ResolvExpr/Unify.cc

    r6ce9a4f2 raac5dfd  
    898898                static void markAssertions(
    899899                        ast::AssertionSet & assn1, ast::AssertionSet & assn2,
    900                         const ast::ParameterizedType * type
     900                        const ast::FunctionType * type
    901901                ) {
    902902                        for ( const auto & tyvar : type->forall ) {
Note: See TracChangeset for help on using the changeset viewer.