Changeset 06601401


Ignore:
Timestamp:
Mar 8, 2024, 12:22:59 AM (4 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
03606ce
Parents:
76fe046
Message:

Change the common type interpretation of EnumPos?

Location:
src/ResolvExpr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CommonType.cc

    r76fe046 r06601401  
    681681
    682682        void postvisit( const ast::EnumPosType * enumPos ) {
    683                 if ( dynamic_cast<const ast::EnumPosType *>(type2) ) {
     683                if ( auto type2AsPos = dynamic_cast<const ast::EnumPosType *>(type2) ) {
    684684                        // result = commonType( type2AsPos->instance, enumPos->instance, tenv, need, have, open, widen );
    685                         result = enumPos;
     685                        // result = enumPos;
     686                        if ( enumPos->instance->base->name == type2AsPos->instance->base->name ) {
     687                                result = type2;
     688                        }
    686689                } else if ( dynamic_cast<const ast::BasicType *>(type2) ) {
    687690                        result = type2;
  • src/ResolvExpr/Unify.cc

    r76fe046 r06601401  
    517517                }
    518518
    519                 void postvisit( const ast::EnumPosType * ) {
     519                void postvisit( const ast::EnumPosType * posType ) {
    520520                        // Lazy approach for now
    521521                        auto otherPos = dynamic_cast< const ast::EnumPosType *>(type2);
    522                         if (otherPos) this->result = otherPos;
     522                        if ( otherPos ) {
     523                                if ( otherPos->instance->base->name == posType->instance->base->name )
     524                                        result = otherPos;
     525                        }
    523526                }
    524527
Note: See TracChangeset for help on using the changeset viewer.