Changeset ae7014e


Ignore:
Timestamp:
Apr 6, 2016, 3:09:26 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
2a76297
Parents:
d75038c
Message:

Fix bug that forgets to add dtype mappings to assign op expression

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    rd75038c rae7014e  
    14011401                                        std::list< TypeDecl* >::const_iterator forallIt = forallParams.begin();
    14021402                                        for ( ; tyIt != tyParams.end() && forallIt != forallParams.end(); ++tyIt, ++forallIt ) {
    1403                                                 if ( (*forallIt)->get_kind() != TypeDecl::Any ) continue; // skip types with no assign op (ftype/dtype)
    1404 
    1405                                                 std::list< DeclarationWithType* > &asserts = (*forallIt)->get_assertions();
    1406                                                 assert( ! asserts.empty() && "Type param needs assignment operator assertion" );
    1407                                                 DeclarationWithType *actualDecl = asserts.front();
    1408                                                 TypeInstType *actualType = isTypeInstAssignment( actualDecl );
    1409                                                 assert( actualType && "First assertion of type with assertions should be assignment operator" );
     1403                                                // Add appropriate mapping to assignment expression environment
    14101404                                                TypeExpr *formalTypeExpr = dynamic_cast< TypeExpr* >( *tyIt );
    14111405                                                assert( formalTypeExpr && "type parameters must be type expressions" );
    14121406                                                Type *formalType = formalTypeExpr->get_type();
    1413                                                 assignExpr->get_env()->add( actualType->get_name(), formalType );
    1414                                                
     1407                                                assignExpr->get_env()->add( (*forallIt)->get_name(), formalType );
     1408
     1409                                                // skip types with no assign op (ftype/dtype)
     1410                                                if ( (*forallIt)->get_kind() != TypeDecl::Any ) continue;
     1411
     1412                                                // find assignment operator for formal type
    14151413                                                DeclarationWithType *assertAssign = 0;
    14161414                                                if ( TypeInstType *formalTypeInstType = dynamic_cast< TypeInstType* >( formalType ) ) {
     
    14261424                                                        }
    14271425                                                }
    1428                                                
    1429 
     1426
     1427                                                // add inferred parameter for field assignment operator to assignment expression
     1428                                                std::list< DeclarationWithType* > &asserts = (*forallIt)->get_assertions();
     1429                                                assert( ! asserts.empty() && "Type param needs assignment operator assertion" );
     1430                                                DeclarationWithType *actualDecl = asserts.front();
    14301431                                                assignExpr->get_inferParams()[ actualDecl->get_uniqueId() ]
    14311432                                                        = ParamEntry( assertAssign->get_uniqueId(), assertAssign->get_type()->clone(), actualDecl->get_type()->clone(), wrapFunctionDecl( assertAssign ) );
Note: See TracChangeset for help on using the changeset viewer.