Ignore:
Timestamp:
Jun 1, 2023, 6:29:47 PM (16 months ago)
Author:
Fangren Yu <f37yu@…>
Branches:
ast-experimental, master
Children:
24d6572, ded6c2a6
Parents:
1803d4d
Message:

remove reference to symbol table in unify

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/TypeEnvironment.cpp

    r1803d4d r251ce80  
    178178
    179179bool TypeEnvironment::combine(
    180                 const TypeEnvironment & o, OpenVarSet & open, const SymbolTable & symtab ) {
     180                const TypeEnvironment & o, OpenVarSet & open ) {
    181181        // short-circuit easy cases
    182182        if ( o.empty() ) return true;
     
    201201                        EqvClass & r = *rt;
    202202                        // merge bindings
    203                         if ( ! mergeBound( r, c, open, symtab ) ) return false;
     203                        if ( ! mergeBound( r, c, open ) ) return false;
    204204                        // merge previous unbound variables into this class, checking occurs if needed
    205205                        if ( r.bound ) for ( const auto & u : c.vars ) {
     
    216216                                } else if ( st != rt ) {
    217217                                        // bound, but not to the same class
    218                                         if ( ! mergeClasses( rt, st, open, symtab ) ) return false;
     218                                        if ( ! mergeClasses( rt, st, open ) ) return false;
    219219                                }       // ignore bound into the same class
    220220                        }
     
    280280bool TypeEnvironment::bindVar(
    281281                const TypeInstType * typeInst, const Type * bindTo, const TypeData & data,
    282                 AssertionSet & need, AssertionSet & have, const OpenVarSet & open, WidenMode widen,
    283                 const SymbolTable & symtab
     282                AssertionSet & need, AssertionSet & have, const OpenVarSet & open, WidenMode widen
    284283) {
    285284        // remove references from bound type, so that type variables can only bind to value types
     
    300299                        if ( unifyInexact(
    301300                                        newType, target, *this, need, have, open,
    302                                         widen & WidenMode{ it->allowWidening, true }, symtab, common ) ) {
     301                                        widen & WidenMode{ it->allowWidening, true }, common ) ) {
    303302                                if ( common ) {
    304303                                        it->bound = std::move(common);
     
    321320                const TypeInstType * var1, const TypeInstType * var2, TypeData && data,
    322321                AssertionSet & need, AssertionSet & have, const OpenVarSet & open,
    323                 WidenMode widen, const SymbolTable & symtab
     322                WidenMode widen
    324323) {
    325324        auto c1 = internal_lookup( *var1 );
     
    358357
    359358                if ( unifyInexact(
    360                                 newType1, newType2, *this, need, have, open, newWidenMode, symtab, common ) ) {
     359                                newType1, newType2, *this, need, have, open, newWidenMode, common ) ) {
    361360                        c1->vars.insert( c2->vars.begin(), c2->vars.end() );
    362361                        c1->allowWidening = widen1 && widen2;
     
    409408
    410409bool TypeEnvironment::mergeBound(
    411                 EqvClass & to, const EqvClass & from, OpenVarSet & open, const SymbolTable & symtab ) {
     410                EqvClass & to, const EqvClass & from, OpenVarSet & open ) {
    412411        if ( from.bound ) {
    413412                if ( to.bound ) {
     
    419418
    420419                        if ( unifyInexact(
    421                                         toType, fromType, *this, need, have, open, widen, symtab, common ) ) {
     420                                        toType, fromType, *this, need, have, open, widen, common ) ) {
    422421                                // unifies, set common type if necessary
    423422                                if ( common ) {
     
    437436
    438437bool TypeEnvironment::mergeClasses(
    439         ClassList::iterator to, ClassList::iterator from, OpenVarSet & open, const SymbolTable & symtab
     438        ClassList::iterator to, ClassList::iterator from, OpenVarSet & open
    440439) {
    441440        EqvClass & r = *to, & s = *from;
    442441
    443442        // ensure bounds match
    444         if ( ! mergeBound( r, s, open, symtab ) ) return false;
     443        if ( ! mergeBound( r, s, open ) ) return false;
    445444
    446445        // check safely bindable
Note: See TracChangeset for help on using the changeset viewer.