Ignore:
Timestamp:
Sep 20, 2022, 6:34:55 PM (22 months ago)
Author:
Fangren Yu <f37yu@…>
Branches:
ADT, ast-experimental, master, pthread-emulation
Children:
79ae13d, a065f1f
Parents:
8f1e035
Message:

try to make parameter qualifier conversion work for assertions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/typeops.h

    r8f1e035 ref1da0e2  
    138138        Type * commonType( Type * type1, Type * type2, bool widenFirst, bool widenSecond, const SymTab::Indexer & indexer, TypeEnvironment & env, const OpenVarSet & openVars );
    139139        ast::ptr< ast::Type > commonType(
    140                 const ast::ptr< ast::Type > & type1, const ast::ptr< ast::Type > & type2, WidenMode widen,
    141                 const ast::SymbolTable & symtab, ast::TypeEnvironment & env, const ast::OpenVarSet & open );
     140                const ast::ptr< ast::Type > & type1, const ast::ptr< ast::Type > & type2,
     141                        ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have,
     142                        const ast::OpenVarSet & open, WidenMode widen, const ast::SymbolTable & symtab
     143        );
     144        // in Unify.cc
     145        std::vector< ast::ptr< ast::Type > > flattenList(
     146                const std::vector< ast::ptr< ast::Type > > & src, ast::TypeEnvironment & env
     147        );
    142148
    143149        // in PolyCost.cc
     
    181187
    182188        /// flatten tuple type into existing list of types
    183         static inline void flatten(
     189        inline void flatten(
    184190                const ast::Type * type, std::vector< ast::ptr< ast::Type > > & out
    185191        ) {
     
    194200
    195201        /// flatten tuple type into list of types
    196         static inline std::vector< ast::ptr< ast::Type > > flatten( const ast::Type * type ) {
     202        inline std::vector< ast::ptr< ast::Type > > flatten( const ast::Type * type ) {
    197203                std::vector< ast::ptr< ast::Type > > out;
    198204                out.reserve( type->size() );
     
    200206                return out;
    201207        }
     208
     209        template< typename Iter >
     210        const ast::Type * tupleFromTypes( Iter crnt, Iter end ) {
     211                std::vector< ast::ptr< ast::Type > > types;
     212                while ( crnt != end ) {
     213                        // it is guaranteed that a ttype variable will be bound to a flat tuple, so ensure
     214                        // that this results in a flat tuple
     215                        flatten( *crnt, types );
     216
     217                        ++crnt;
     218                }
     219
     220
     221                return new ast::TupleType{ std::move(types) };
     222        }
     223
     224        inline const ast::Type * tupleFromTypes(
     225                const std::vector< ast::ptr< ast::Type > > & tys
     226        ) {
     227                return tupleFromTypes( tys.begin(), tys.end() );
     228        }
     229
     230       
    202231
    203232        // in TypeEnvironment.cc
Note: See TracChangeset for help on using the changeset viewer.