Changeset b729c01 for src/ResolvExpr


Ignore:
Timestamp:
Jul 25, 2022, 12:30:59 PM (22 months ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
bbf17d5
Parents:
d958834b
Message:

Update enum unifier; now unifier compare types based on the enum's base

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Unify.cc

    rd958834b rb729c01  
    165165                ast::Type * newFirst  = shallowCopy( first  );
    166166                ast::Type * newSecond = shallowCopy( second );
     167                if ( auto temp = dynamic_cast<const ast::EnumInstType *>(first) ) {
     168                        if ( !dynamic_cast< const ast::EnumInstType * >( second ) ) {
     169                                const ast::EnumDecl * baseEnum = dynamic_cast<const ast::EnumDecl *>(temp->base.get());
     170                                if ( auto t = baseEnum->base.get() ) {
     171                                        newFirst = ast::shallowCopy( t );
     172                                }
     173                        }
     174                } else if ( auto temp = dynamic_cast<const ast::EnumInstType *>(second) ) {
     175                        const ast::EnumDecl * baseEnum = dynamic_cast<const ast::EnumDecl *>(temp->base.get());
     176                        if ( auto t = baseEnum->base.get() ) {
     177                                newSecond = ast::shallowCopy( t );
     178                        }
     179                }
     180
    167181                newFirst ->qualifiers = {};
    168182                newSecond->qualifiers = {};
     
    9881002                                if ( isTuple && isTuple2 ) {
    9891003                                        ++it; ++jt;  // skip ttype parameters before break
    990                                 } else if ( isTuple ) {
     1004                                } else if ( isTuple ) { 
    9911005                                        // bundle remaining params into tuple
    9921006                                        pty2 = tupleFromExprs( param2, jt, params2.end(), pty->qualifiers );
Note: See TracChangeset for help on using the changeset viewer.