Changeset fcd0b9d7 for src/ResolvExpr


Ignore:
Timestamp:
Jan 18, 2021, 3:34:57 PM (4 years ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
4b1c8da
Parents:
e35a32b
Message:

PolyCost? calculation result becomes 0 or 1 per type, avoiding double-couting. Fixes #235?

PolyCost? calculation is documented as "Count of parameters and return values bound to some poly type." Before this fix, the cost calculation, looking inside one parameter or return, counted each occurrence of a poly type that it found there. This caused an incorrect increase in PolyCost? on cases like #235 where several type variables are used in the declaration of one parameter.

libcfa/src/concurrency/thread.cfa: Changing a decl-use pattern to keep resolution consistent (no behaviour is changed). The management of defaultResumptionHandler in the thread constructor was benefitting from bug #235 to disambiguate assignment to local variable vs assignment to declared function (due to #234). After this change, the code works around that false ambiguity by using a different name for the local variable.

tests/avl*: Adding a missing assertion on the custom destructor definition. Previously, the destructor definition was benefiting from bug #235 to avoid the missing-assertion-on-custom-dtor problem described in #227.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/PolyCost.cc

    re35a32b rfcd0b9d7  
    3535                PassVisitor<PolyCost> coster( env, indexer );
    3636                type->accept( coster );
    37                 return coster.pass.result;
     37                return (coster.pass.result > 0) ? 1 : 0;
    3838        }
    3939
     
    8787        ast::Pass<PolyCost_new> costing( symtab, env );
    8888        type->accept( costing );
    89         return costing.core.result;
     89        return (costing.core.result > 0) ? 1 : 0;
    9090}
    9191
Note: See TracChangeset for help on using the changeset viewer.