Changeset 51b8582


Ignore:
Timestamp:
Feb 16, 2022, 11:33:08 AM (2 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
7d7ef6f
Parents:
9490621
Message:

So it was a bug in old code that seemed to be cancelling itself out but the new version does not have it. This solution got everything but one test (a polymorphic function calling itself) working.

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/TypeSubstitution.cc

    r9490621 r51b8582  
    146146}
    147147
     148static bool are_same( TypeInstType * left, TypeInstType * right ) {
     149        if ( left->baseType && right->baseType ) {
     150                return left->baseType == right->baseType;
     151        } else {
     152                return left->name == right->name;
     153        }
     154}
     155
    148156Type * TypeSubstitution::Substituter::postmutate( TypeInstType *inst ) {
    149157        BoundVarsType::const_iterator bound = boundVars.find( inst->name );
     
    158166                // TODO: investigate preventing type variables from being bound to themselves in the first place.
    159167                if ( TypeInstType * replacement = dynamic_cast< TypeInstType * >( i->second ) ) {
    160                         if ( inst->name == replacement->name ) {
     168                        if ( are_same( inst, replacement ) ) {
    161169                                return inst;
    162170                        }
  • src/Validate/ForallPointerDecay.cpp

    r9490621 r51b8582  
    177177                }
    178178                auto mut = ast::mutate( decl );
    179                 //mut->assertions = expandAssertions( decl->assertions );
    180                 mut->assertions = expandAssertions_DR( decl->type_params, decl->assertions );
     179                mut->assertions = expandAssertions( decl->assertions );
    181180                auto mutType = ast::mutate( mut->type.get() );
    182181                // *
     
    209208                }
    210209                return ast::mutate_field( decl, &ast::StructDecl::params,
    211                         //expandTypeDecls( decl->params ) );
    212                         expandTypeDecls_DR( decl->params ) );
     210                        expandTypeDecls( decl->params ) );
    213211        }
    214212
     
    218216                }
    219217                return ast::mutate_field( decl, &ast::UnionDecl::params,
    220                         //expandTypeDecls( decl->params ) );
    221                         expandTypeDecls_DR( decl->params ) );
     218                        expandTypeDecls( decl->params ) );
    222219        }
    223220};
Note: See TracChangeset for help on using the changeset viewer.