Changeset f18a711


Ignore:
Timestamp:
Aug 10, 2016, 2:29:40 PM (6 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
3078643
Parents:
ce76eb9
Message:

Fix bug in replacing dtype-only generics with stripped versions

Location:
src/GenPoly
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    rce76eb9 rf18a711  
    20542054
    20552055                        DeclClass *ret = static_cast< DeclClass *>( Mutator::mutate( decl ) );
    2056                         ScrubTyVars::scrubDynamic( decl, scopeTyVars );
     2056                        ScrubTyVars::scrub( decl, scopeTyVars );
    20572057
    20582058                        scopeTyVars.endScope();
  • src/GenPoly/InstantiateGeneric.cc

    rce76eb9 rf18a711  
    173173                void insert( UnionInstType *inst, const std::list< TypeExpr* > &typeSubs, UnionDecl *decl ) { instantiations.insert( inst->get_baseUnion(), typeSubs, decl ); }
    174174
    175                 /// If this is an instance of a type already determined to be dtype-static, strips the instances's type parameters and returns true
    176                 bool stripInstParams( AggregateDecl *base, ReferenceToType *inst );
    177        
    178175                /// Strips a dtype-static aggregate decl of its type parameters, marks it as stripped
    179176                void stripDtypeParams( AggregateDecl *base, std::list< TypeDecl* >& baseParams, const std::list< TypeExpr* >& typeSubs );
     
    240237        }
    241238
    242         bool GenericInstantiator::stripInstParams( AggregateDecl *base, ReferenceToType *inst ) {
    243                 if ( dtypeStatics.find( base ) == dtypeStatics.end() ) return false;
    244 
     239        /// Strips the instances's type parameters
     240        void stripInstParams( ReferenceToType *inst ) {
    245241                deleteAll( inst->get_parameters() );
    246242                inst->get_parameters().clear();
    247 
    248                 return true;
    249243        }
    250244       
     
    268262
    269263                // check for an already-instantiatiated dtype-static type
    270                 if ( stripInstParams( inst->get_baseStruct(), inst ) ) return inst;
     264                if ( dtypeStatics.find( inst->get_baseStruct() ) != dtypeStatics.end() ) {
     265                        stripInstParams( inst );
     266                        return inst;
     267                }
    271268               
    272269                // check if type can be concretely instantiated; put substitutions into typeSubs
     
    277274                case genericType::dtypeStatic:
    278275                        stripDtypeParams( inst->get_baseStruct(), *inst->get_baseParameters(), typeSubs );
     276                        stripInstParams( inst );
    279277                        break;
    280278               
     
    316314
    317315                // check for an already-instantiatiated dtype-static type
    318                 if ( stripInstParams( inst->get_baseUnion(), inst ) ) return inst;
     316                if ( dtypeStatics.find( inst->get_baseUnion() ) != dtypeStatics.end() ) {
     317                        stripInstParams( inst );
     318                        return inst;
     319                }
    319320
    320321                // check if type can be concretely instantiated; put substitutions into typeSubs
     
    325326                case genericType::dtypeStatic:
    326327                        stripDtypeParams( inst->get_baseUnion(), *inst->get_baseParameters(), typeSubs );
     328                        stripInstParams( inst );
    327329                        break;
    328330                       
Note: See TracChangeset for help on using the changeset viewer.