Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Unify.cc

    rc77fd8b r0b150ec  
    114114        }
    115115
    116         bool isFtype( Type *type ) {
     116        bool isFtype( Type *type, const SymTab::Indexer &indexer ) {
    117117                if ( dynamic_cast< FunctionType* >( type ) ) {
    118118                        return true;
     
    123123        }
    124124
    125         bool tyVarCompatible( const TypeDecl::Data & data, Type *type ) {
     125        bool tyVarCompatible( const TypeDecl::Data & data, Type *type, const SymTab::Indexer &indexer ) {
    126126                switch ( data.kind ) {
    127127                  case TypeDecl::Any:
     
    131131                        // type must also be complete
    132132                        // xxx - should this also check that type is not a tuple type and that it's not a ttype?
    133                         return ! isFtype( type ) && (! data.isComplete || type->isComplete() );
     133                        return ! isFtype( type, indexer ) && (! data.isComplete || type->isComplete() );
    134134                  case TypeDecl::Ftype:
    135                         return isFtype( type );
     135                        return isFtype( type, indexer );
    136136                  case TypeDecl::Ttype:
    137137                        // ttype unifies with any tuple type
     
    144144                OpenVarSet::const_iterator tyvar = openVars.find( typeInst->get_name() );
    145145                assert( tyvar != openVars.end() );
    146                 if ( ! tyVarCompatible( tyvar->second, other ) ) {
     146                if ( ! tyVarCompatible( tyvar->second, other, indexer ) ) {
    147147                        return false;
    148148                } // if
     
    388388        }
    389389
    390         void Unify::visit( __attribute__((unused)) VoidType *voidType) {
     390        void Unify::visit(VoidType *voidType) {
    391391                result = dynamic_cast< VoidType* >( type2 );
    392392        }
     
    683683
    684684        template< typename Iterator1, typename Iterator2 >
    685         bool unifyList( Iterator1 list1Begin, Iterator1 list1End, Iterator2 list2Begin, Iterator2 list2End, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, const SymTab::Indexer &indexer ) {
     685        bool unifyList( Iterator1 list1Begin, Iterator1 list1End, Iterator2 list2Begin, Iterator2 list2End, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ) {
    686686                auto get_type = [](Type * t) { return t; };
    687687                for ( ; list1Begin != list1End && list2Begin != list2End; ++list1Begin, ++list2Begin ) {
     
    733733                        flatten( flat2.get(), back_inserter( types2 ) );
    734734
    735                         result = unifyList( types1.begin(), types1.end(), types2.begin(), types2.end(), env, needAssertions, haveAssertions, openVars, indexer );
    736                 } // if
    737         }
    738 
    739         void Unify::visit( __attribute__((unused)) VarArgsType *varArgsType ) {
     735                        result = unifyList( types1.begin(), types1.end(), types2.begin(), types2.end(), env, needAssertions, haveAssertions, openVars, widenMode, indexer );
     736                } // if
     737        }
     738
     739        void Unify::visit(VarArgsType *varArgsType) {
    740740                result = dynamic_cast< VarArgsType* >( type2 );
    741741        }
    742742
    743         void Unify::visit( __attribute__((unused)) ZeroType *zeroType ) {
     743        void Unify::visit(ZeroType *zeroType) {
    744744                result = dynamic_cast< ZeroType* >( type2 );
    745745        }
    746746
    747         void Unify::visit( __attribute__((unused)) OneType *oneType ) {
     747        void Unify::visit(OneType *oneType) {
    748748                result = dynamic_cast< OneType* >( type2 );
    749749        }
Note: See TracChangeset for help on using the changeset viewer.